{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "stack": "ios",
  "description": "Swift code-graph rules. Adds what the graph needs on top of test-gap-rules/ios.json, which already owns sourceExtensions, excludePathGlobs and the test-path predicates. Definition patterns here are deliberately broader than the test-gap publicApiPatterns: the graph wants internal types too, because Phase 1 narrows scope on the whole module, not just its public surface.",
  "comments": {
    "line": ["//"],
    "block": [["/*", "*/"]],
    "string": ["\"\"\"", "\""]
  },
  "definitionPatterns": [
    {
      "id": "class",
      "kind": "class",
      "regex": "\\b(?:final\\s+)?class\\s+([A-Z][A-Za-z0-9_]*)"
    },
    {
      "id": "struct",
      "kind": "struct",
      "regex": "\\bstruct\\s+([A-Z][A-Za-z0-9_]*)"
    },
    {
      "id": "enum",
      "kind": "enum",
      "regex": "\\benum\\s+([A-Z][A-Za-z0-9_]*)"
    },
    {
      "id": "protocol",
      "kind": "protocol",
      "regex": "\\bprotocol\\s+([A-Z][A-Za-z0-9_]*)"
    },
    {
      "id": "actor",
      "kind": "actor",
      "regex": "\\bactor\\s+([A-Z][A-Za-z0-9_]*)"
    },
    {
      "id": "typealias",
      "kind": "typealias",
      "regex": "\\btypealias\\s+([A-Z][A-Za-z0-9_]*)"
    },
    {
      "id": "func",
      "kind": "func",
      "regex": "\\bfunc\\s+([a-zA-Z_][A-Za-z0-9_]*)"
    }
  ],
  "importPatterns": [
    {
      "id": "import",
      "regex": "^\\s*import\\s+(?:class|struct|enum|protocol|func|var|let|typealias)\\s+([A-Za-z_][A-Za-z0-9_]*)|^\\s*import\\s+([A-Za-z_][A-Za-z0-9_]*)"
    }
  ],
  "referenceKinds": ["class", "struct", "enum", "protocol", "actor", "typealias"],
  "referenceKindsNote": "func is deliberately absent. A bare lowercase method name matched across files is almost never a call to that exact declaration: on a large Swift app `with`, `size`, `name`, `image` and `model` took the top god-node slots purely because each happened to be declared in exactly one file. Functions still reach the graph through their `defines` edge, so they stay findable by name.",
  "ignoredIdentifiers": [
    "self",
    "Self",
    "super",
    "init",
    "deinit",
    "body",
    "some",
    "any",
    "func",
    "class",
    "struct",
    "enum",
    "protocol",
    "extension",
    "var",
    "let",
    "return",
    "guard",
    "where",
    "case",
    "default",
    "import",
    "public",
    "private",
    "internal",
    "fileprivate",
    "open",
    "static",
    "final",
    "override",
    "throws",
    "async",
    "await",
    "try",
    "nil",
    "true",
    "false"
  ],
  "note": "extension is intentionally NOT a definition pattern. `extension Foo` would register a second symbol named Foo alongside its declaring file, the name would become ambiguous, and buildGraph drops ambiguous references - so every reference to an extended type would vanish. Extensions still reach the graph as reference edges through the identifier pass."
}
