{
  "definitions": [
    {
      "callable": true,
      "callees": [],
      "callers": [
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "brokenContracts",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        },
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "collisionOf",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        },
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "declaredId",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        },
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "missingKeys",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        }
      ],
      "exported": false,
      "flow": "leaf",
      "kind": "lexical_declaration",
      "line": 34,
      "name": "contractFinding",
      "signature": "const contractFinding = function contractFinding(path: string, locus: string, actual: string, decide: string): Finding {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "registered",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        },
        {
          "file": "tools/core/validators/emission.validator.ts",
          "name": "idsDeclaredIn",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-validators-emission-validator-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/validators/emission.validator.ts",
            "label": "tools/core/validators/emission.validator.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/validators/emission.validator.ts.md",
            "ref": "anatomy:file-coordination-tools-core-validators-emission-validator-ts"
          }
        }
      ],
      "exported": true,
      "flow": "leaf",
      "kind": "lexical_declaration",
      "line": 27,
      "name": "identityOf",
      "signature": "export const identityOf = function identityOf(path: string): string {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "validated",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        }
      ],
      "exported": false,
      "flow": "leaf",
      "kind": "lexical_declaration",
      "line": 120,
      "name": "isDeclaration",
      "signature": "const isDeclaration = function isDeclaration(value: object, path: string): value is RuleDeclaration {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "contractFinding",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "lexical_declaration",
      "line": 58,
      "name": "missingKeys",
      "signature": "const missingKeys: FieldCheck = (path, value) =>"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "contractFinding",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "lexical_declaration",
      "line": 63,
      "name": "declaredId",
      "signature": "const declaredId: FieldCheck = (path, value) =>"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "contractFinding",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "lexical_declaration",
      "line": 113,
      "name": "brokenContracts",
      "signature": "const brokenContracts: FieldCheck = (path, value) =>"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "isDeclaration",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "lexical_declaration",
      "line": 124,
      "name": "validated",
      "signature": "const validated = function validated(source: LoadedSource): Validated {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "identityOf",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "lexical_declaration",
      "line": 155,
      "name": "registered",
      "signature": "const registered = function registered(check: Validated): RegisteredRule[] {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "tools/core/registries/rule.registry.ts",
          "name": "contractFinding",
          "source": {
            "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
            "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/rule.registry.ts",
            "label": "tools/core/registries/rule.registry.ts",
            "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.md",
            "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "lexical_declaration",
      "line": 161,
      "name": "collisionOf",
      "signature": "const collisionOf = function collisionOf(rule: RegisteredRule, first: RegisteredRule): Finding {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 17,
      "name": "RULES_DIR",
      "signature": "const RULES_DIR = surfacePath(\"rules\");"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "type_alias_declaration",
      "line": 19,
      "name": "FieldCheck",
      "signature": "type FieldCheck = (path: string, value: object) => Finding[];"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "interface_declaration",
      "line": 21,
      "name": "Validated",
      "signature": "interface Validated {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 28,
      "name": "cut",
      "signature": "const cut = Math.max(path.lastIndexOf(\"/\"), path.lastIndexOf(\"\\\\\"));"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 29,
      "name": "name",
      "signature": "const name = path.slice(cut + 1);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 30,
      "name": "stop",
      "signature": "const stop = name.indexOf(\".\");"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "interface_declaration",
      "line": 51,
      "name": "FieldContract",
      "signature": "interface FieldContract {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 75,
      "name": "isKindList",
      "signature": "const isKindList = function isKindList(kinds: unknown): boolean {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 79,
      "name": "FIELD_CONTRACTS",
      "signature": "const FIELD_CONTRACTS: readonly FieldContract[] = ["
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 118,
      "name": "FIELD_CHECKS",
      "signature": "const FIELD_CHECKS: readonly FieldCheck[] = [missingKeys, declaredId, brokenContracts];"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 126,
      "name": "imported",
      "signature": "const imported = contractFinding("
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 135,
      "name": "value",
      "signature": "const value = source.exports[\"rule\"];"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 137,
      "name": "exported",
      "signature": "const exported = contractFinding("
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 146,
      "name": "problems",
      "signature": "const problems = FIELD_CHECKS.flatMap((check) => check(source.file, value));"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 150,
      "name": "byStageThenId",
      "signature": "const byStageThenId = function byStageThenId(left: RegisteredRule, right: RegisteredRule): number {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 151,
      "name": "byStage",
      "signature": "const byStage = STAGES.indexOf(left.declaration.stage) - STAGES.indexOf(right.declaration.stage);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 162,
      "name": "collision",
      "signature": "const collision = `identity collides with the rule discovered at ${first.path} — a filename subject names exactly one check`;"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 166,
      "name": "discoverRules",
      "signature": "export const discoverRules = async function discoverRules(repoRoot: string): Promise<Registry> {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 167,
      "name": "sources",
      "signature": "const sources = await importSources(walk({ extensions: [\".ts\"], ignored: [], root: resolve(repoRoot, RULES_DIR) }));"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 168,
      "name": "checked",
      "signature": "const checked = sources.map(validated);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 169,
      "name": "valid",
      "signature": "const valid = checked.flatMap(registered);"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 170,
      "name": "firstOf",
      "signature": "const firstOf = (rule: RegisteredRule): RegisteredRule => valid.find((other) => other.id === rule.id) ?? rule;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 172,
      "name": "rules",
      "signature": "const rules = valid.filter((rule) => firstOf(rule) === rule);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 173,
      "name": "collisions",
      "signature": "const collisions = valid.filter((rule) => firstOf(rule) !== rule).map((rule) => collisionOf(rule, firstOf(rule)));"
    }
  ],
  "document": null,
  "findings": [],
  "generated": false,
  "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-rule-registry-ts",
  "language": "typescript",
  "layer": "infrastructure",
  "name": "rule.registry.ts",
  "path": "tools/core/registries/rule.registry.ts",
  "ref": "anatomy:file-coordination-tools-core-registries-rule-registry-ts",
  "relations": [
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/coordination#folder-coordination-tools-core-registries",
          "json": "https://banes-lab.com/json/anatomy/coordination/folder-coordination-tools-core-registries",
          "label": "tools/core/registries",
          "markdown": "https://banes-lab.com/anatomy/coordination/folder-coordination-tools-core-registries.md",
          "ref": "chapter:/anatomy/coordination#folder-coordination-tools-core-registries"
        }
      ],
      "relation": "contained-in"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-validators-emission-validator-ts",
          "json": "https://banes-lab.com/json/source/coordination/tools/core/validators/emission.validator.ts",
          "label": "tools/core/validators/emission.validator.ts",
          "markdown": "https://banes-lab.com/source/coordination/tools/core/validators/emission.validator.ts.md",
          "ref": "anatomy:file-coordination-tools-core-validators-emission-validator-ts"
        }
      ],
      "relation": "used-by"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/coordination#folder-coordination-tools-core-registries",
          "json": "https://banes-lab.com/json/anatomy/coordination/folder-coordination-tools-core-registries",
          "label": "tools/core/registries",
          "markdown": "https://banes-lab.com/anatomy/coordination/folder-coordination-tools-core-registries.md",
          "ref": "chapter:/anatomy/coordination#folder-coordination-tools-core-registries"
        },
        {
          "href": "https://banes-lab.com/anatomy/coordination#folder-coordination-tools-core-validators",
          "json": "https://banes-lab.com/json/anatomy/coordination/folder-coordination-tools-core-validators",
          "label": "tools/core/validators",
          "markdown": "https://banes-lab.com/anatomy/coordination/folder-coordination-tools-core-validators.md",
          "ref": "chapter:/anatomy/coordination#folder-coordination-tools-core-validators"
        }
      ],
      "relation": "linked-from"
    }
  ],
  "slots": {
    "concern": "registry",
    "subject": "rule",
    "variant": null
  },
  "stats": {
    "bytes": 7367,
    "callable": 13,
    "definitions": 33,
    "edges": 6,
    "exported": 11,
    "files": 1,
    "findings": {},
    "flows": {
      "leaf": 3,
      "entry": 6,
      "isolated": 24
    },
    "lines": {
      "blank": 23,
      "code": 156,
      "total": 179
    }
  },
  "summary": "156 lines of code and 33 definitions.",
  "text": "https://banes-lab.com/source/coordination/tools/core/registries/rule.registry.ts.txt",
  "tree": "coordination",
  "siblings": {
    "next": {
      "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-snapshot-registry-ts",
      "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/snapshot.registry.ts",
      "label": "tools/core/registries/snapshot.registry.ts",
      "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/snapshot.registry.ts.md",
      "ref": "anatomy:file-coordination-tools-core-registries-snapshot-registry-ts"
    },
    "previous": {
      "href": "https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-registries-invocation-registry-ts",
      "json": "https://banes-lab.com/json/source/coordination/tools/core/registries/invocation.registry.ts",
      "label": "tools/core/registries/invocation.registry.ts",
      "markdown": "https://banes-lab.com/source/coordination/tools/core/registries/invocation.registry.ts.md",
      "ref": "anatomy:file-coordination-tools-core-registries-invocation-registry-ts"
    }
  },
  "up": {
    "href": null,
    "json": "https://banes-lab.com/json/api/source/coordination/tools/core/registries",
    "label": "tools/core/registries",
    "markdown": "https://banes-lab.com/api/source/coordination/tools/core/registries.md",
    "ref": "api:source/coordination/tools/core/registries"
  }
}
