@nanonets/graft 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +49 -45
  2. package/dist/ask/fuse.d.ts.map +1 -1
  3. package/dist/ask/fuse.js +32 -14
  4. package/dist/ask/fuse.js.map +1 -1
  5. package/dist/claude/init.d.ts.map +1 -1
  6. package/dist/claude/init.js +6 -3
  7. package/dist/claude/init.js.map +1 -1
  8. package/dist/cli.js +93 -39
  9. package/dist/cli.js.map +1 -1
  10. package/dist/engine.d.ts +6 -2
  11. package/dist/engine.d.ts.map +1 -1
  12. package/dist/engine.js +4 -1
  13. package/dist/engine.js.map +1 -1
  14. package/dist/graph/build.d.ts +5 -0
  15. package/dist/graph/build.d.ts.map +1 -1
  16. package/dist/graph/build.js +21 -2
  17. package/dist/graph/build.js.map +1 -1
  18. package/dist/graph/check.d.ts +1 -1
  19. package/dist/graph/check.d.ts.map +1 -1
  20. package/dist/graph/check.js +13 -3
  21. package/dist/graph/check.js.map +1 -1
  22. package/dist/graph/generic.d.ts +25 -0
  23. package/dist/graph/generic.d.ts.map +1 -0
  24. package/dist/graph/generic.js +320 -0
  25. package/dist/graph/generic.js.map +1 -0
  26. package/dist/graph/lsp/client.d.ts +43 -0
  27. package/dist/graph/lsp/client.d.ts.map +1 -0
  28. package/dist/graph/lsp/client.js +179 -0
  29. package/dist/graph/lsp/client.js.map +1 -0
  30. package/dist/graph/lsp/enrich.d.ts +11 -0
  31. package/dist/graph/lsp/enrich.d.ts.map +1 -0
  32. package/dist/graph/lsp/enrich.js +155 -0
  33. package/dist/graph/lsp/enrich.js.map +1 -0
  34. package/dist/graph/lsp/registry.d.ts +15 -0
  35. package/dist/graph/lsp/registry.d.ts.map +1 -0
  36. package/dist/graph/lsp/registry.js +46 -0
  37. package/dist/graph/lsp/registry.js.map +1 -0
  38. package/dist/graph/queries/c.scm +13 -0
  39. package/dist/graph/queries/c_sharp.scm +19 -0
  40. package/dist/graph/queries/cpp.scm +23 -0
  41. package/dist/graph/queries/elixir.scm +54 -0
  42. package/dist/graph/queries/java.scm +20 -0
  43. package/dist/graph/queries/kotlin.scm +43 -0
  44. package/dist/graph/queries/php.scm +40 -0
  45. package/dist/graph/queries/ruby.scm +65 -0
  46. package/dist/graph/queries/rust.scm +41 -0
  47. package/dist/graph/queries/scala.scm +66 -0
  48. package/dist/graph/queries/solidity.scm +43 -0
  49. package/dist/graph/queries/swift.scm +51 -0
  50. package/dist/graph/resolve.d.ts.map +1 -1
  51. package/dist/graph/resolve.js +13 -3
  52. package/dist/graph/resolve.js.map +1 -1
  53. package/dist/graph/root.d.ts +11 -0
  54. package/dist/graph/root.d.ts.map +1 -0
  55. package/dist/graph/root.js +40 -0
  56. package/dist/graph/root.js.map +1 -0
  57. package/dist/graph/source-files.d.ts.map +1 -1
  58. package/dist/graph/source-files.js +5 -1
  59. package/dist/graph/source-files.js.map +1 -1
  60. package/dist/graph/types.d.ts +12 -7
  61. package/dist/graph/types.d.ts.map +1 -1
  62. package/dist/graph/types.js +2 -2
  63. package/dist/graph/workspace-cli.d.ts +1 -1
  64. package/dist/graph/workspace-cli.d.ts.map +1 -1
  65. package/dist/graph/workspace-cli.js +2 -2
  66. package/dist/graph/workspace-cli.js.map +1 -1
  67. package/dist/graph/workspace.d.ts +2 -2
  68. package/dist/graph/workspace.d.ts.map +1 -1
  69. package/dist/graph/workspace.js +2 -2
  70. package/dist/graph/workspace.js.map +1 -1
  71. package/dist/mcp/tools.js +6 -6
  72. package/dist/mcp/tools.js.map +1 -1
  73. package/package.json +6 -2
  74. package/scripts/build-viewer.mjs +17 -1
  75. package/scripts/graph-quality.mjs +117 -0
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Opt-in LSP enrichment (`graft build --lsp`): add compiler-grade call edges the
3
+ * AST resolver couldn't — chiefly member calls (`obj.foo()`) whose receiver type
4
+ * graft can't infer, and every call in the generic breadth tier (which has no
5
+ * receiver typing at all). For each function/method node we ask the language
6
+ * server for its outgoing calls (call hierarchy) and map each callee's definition
7
+ * back to a graft node, adding a `calls` edge stamped `lsp_resolved`. Precision is
8
+ * the server's (compiler-grade), so this closes the edge-recall gap WITHOUT the
9
+ * name-guessing that halved precision (see resolve.ts). Best-effort: no server /
10
+ * a timeout / an error → the graph is returned unchanged.
11
+ */
12
+ import { join } from "node:path";
13
+ import { readFileSync, realpathSync } from "node:fs";
14
+ import { fileURLToPath } from "node:url";
15
+ import { relPosix } from "../../util/paths.js";
16
+ import { languageLabelOf } from "../extract.js";
17
+ import { genericLangOf } from "../generic.js";
18
+ import { LspClient } from "./client.js";
19
+ import { pickServer } from "./registry.js";
20
+ const CALLABLE = new Set(["function", "method"]);
21
+ const DEFN = new Set(["function", "method", "class", "struct", "interface", "type", "enum"]);
22
+ const langOf = (path) => genericLangOf(path)?.name ?? languageLabelOf(path);
23
+ const parseSpan = (s) => {
24
+ const m = /^L(\d+)-L(\d+)$/.exec(s);
25
+ return m ? [Number(m[1]), Number(m[2])] : null;
26
+ };
27
+ export async function enrichWithLsp(graph, root, opts = {}) {
28
+ const languagesPresent = new Set();
29
+ for (const n of graph.nodes) {
30
+ const l = langOf(n.path);
31
+ if (l)
32
+ languagesPresent.add(l);
33
+ }
34
+ const server = pickServer(languagesPresent);
35
+ if (!server)
36
+ return { added: 0, queried: 0, server: null };
37
+ // Canonicalize the root: servers (rust-analyzer/clangd) report callee URIs
38
+ // against the REAL path, so under a symlinked checkout (macOS /tmp →
39
+ // /private/tmp, common in CI) an un-resolved root would fail the in-repo test
40
+ // for every callee and silently zero out enrichment.
41
+ const realRoot = (() => { try {
42
+ return realpathSync(root);
43
+ }
44
+ catch {
45
+ return root;
46
+ } })();
47
+ root = realRoot;
48
+ // Index nodes by file for both source selection and callee→node mapping.
49
+ const byId = new Map(graph.nodes.map((n) => [n.id, n]));
50
+ const spansByFile = new Map();
51
+ for (const n of graph.nodes) {
52
+ if (n.kind === "file" || !DEFN.has(n.kind))
53
+ continue;
54
+ const sp = parseSpan(n.span);
55
+ if (!sp)
56
+ continue;
57
+ const list = spansByFile.get(n.path) ?? [];
58
+ list.push({ node: n, from: sp[0], to: sp[1] });
59
+ spansByFile.set(n.path, list);
60
+ }
61
+ // The definition node covering a 1-indexed line in a file: innermost (smallest span).
62
+ const nodeAt = (rel, line) => {
63
+ const cands = (spansByFile.get(rel) ?? []).filter((s) => s.from <= line && line <= s.to);
64
+ if (!cands.length)
65
+ return null;
66
+ return cands.sort((a, b) => (a.to - a.from) - (b.to - b.from))[0].node;
67
+ };
68
+ // Source nodes to query: callable nodes in files this server handles.
69
+ const serverLangs = new Set(server.languages);
70
+ let sources = graph.nodes.filter((n) => CALLABLE.has(n.kind) && serverLangs.has(langOf(n.path) ?? ""));
71
+ if (opts.maxNodes && sources.length > opts.maxNodes)
72
+ sources = sources.slice(0, opts.maxNodes);
73
+ const client = new LspClient(server.command, server.args, root, server.languageId);
74
+ if (!(await client.initialize())) {
75
+ await client.dispose();
76
+ return { added: 0, queried: 0, server: server.command };
77
+ }
78
+ const existing = new Set(graph.edges.map((e) => `${e.source}\0${e.relation}\0${e.target}`));
79
+ const fileLines = new Map();
80
+ const linesOf = (rel) => {
81
+ if (!fileLines.has(rel)) {
82
+ try {
83
+ fileLines.set(rel, readFileSync(join(root, rel), "utf8").split("\n"));
84
+ }
85
+ catch {
86
+ fileLines.set(rel, []);
87
+ }
88
+ }
89
+ return fileLines.get(rel);
90
+ };
91
+ // The name-token position of a definition (0-indexed), scanning its first few
92
+ // lines for the name — call hierarchy needs a position ON the symbol.
93
+ const namePos = (src) => {
94
+ const sp = parseSpan(src.span);
95
+ if (!sp)
96
+ return null;
97
+ const lines = linesOf(src.path);
98
+ for (let ln = sp[0] - 1; ln < Math.min(sp[0] + 2, lines.length); ln++) {
99
+ const c = (lines[ln] ?? "").indexOf(src.name);
100
+ if (c >= 0)
101
+ return { line: ln, character: c };
102
+ }
103
+ return null;
104
+ };
105
+ // Wait for the server to finish indexing (it answers call-hierarchy empty
106
+ // until ready). Warm up on the first source node that has a findable position.
107
+ const warm = sources.find((s) => namePos(s));
108
+ if (warm) {
109
+ const wp = namePos(warm);
110
+ if (!(await client.waitUntilReady(join(root, warm.path), wp))) {
111
+ await client.dispose();
112
+ return { added: 0, queried: 0, server: server.command }; // never became ready
113
+ }
114
+ }
115
+ let added = 0, queried = 0;
116
+ for (const src of sources) {
117
+ const abs = join(root, src.path);
118
+ client.didOpen(abs);
119
+ const pos = namePos(src);
120
+ if (!pos)
121
+ continue;
122
+ const items = await client.prepareCallHierarchy(abs, pos);
123
+ if (!items.length)
124
+ continue;
125
+ queried++;
126
+ opts.onProgress?.(queried, sources.length);
127
+ const callees = await client.outgoingCalls(items[0]);
128
+ for (const callee of callees) {
129
+ let calleeAbs;
130
+ try {
131
+ calleeAbs = fileURLToPath(callee.uri);
132
+ }
133
+ catch {
134
+ continue;
135
+ }
136
+ const rel = relPosix(root, calleeAbs);
137
+ // In-repo iff the repo-relative path doesn't escape the root. (A raw
138
+ // `startsWith(root)` is separator-unsafe: root=/a/foo matches /a/foo-bar.)
139
+ if (rel.startsWith("..") || rel.startsWith("/"))
140
+ continue; // external/dependency
141
+ const target = nodeAt(rel, (callee.selectionRange?.start.line ?? callee.range.start.line) + 1);
142
+ if (!target || target.id === src.id)
143
+ continue;
144
+ const key = `${src.id}\0calls\0${target.id}`;
145
+ if (existing.has(key))
146
+ continue;
147
+ existing.add(key);
148
+ graph.edges.push({ source: src.id, target: target.id, relation: "calls", confidence: "lsp_resolved" });
149
+ added++;
150
+ }
151
+ }
152
+ await client.dispose();
153
+ return { added, queried, server: server.command };
154
+ }
155
+ //# sourceMappingURL=enrich.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrich.js","sourceRoot":"","sources":["../../../src/graph/lsp/enrich.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAA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AAC,CAAC,CAAC;YAC/F,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE;gBAAE,SAAS;YAC9C,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,EAAE,YAAY,MAAM,CAAC,EAAE,EAAE,CAAC;YAC7C,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,SAAS;YAChC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAClB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAY,CAAC,CAAC;YACjH,KAAK,EAAE,CAAC;QACV,CAAC;IACH,CAAC;IACD,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACvB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;AACpD,CAAC"}
@@ -0,0 +1,15 @@
1
+ export interface LspServer {
2
+ /** graft language names (as produced by languageLabelOf/genericLangOf) this serves. */
3
+ languages: string[];
4
+ command: string;
5
+ args: string[];
6
+ /** the LSP `languageId` to tag opened documents with. */
7
+ languageId: string;
8
+ }
9
+ /** First-match-wins; ordering is priority. Extend by adding a row. */
10
+ export declare const LSP_SERVERS: readonly LspServer[];
11
+ /** Pick the highest-priority installed server that covers at least one of the
12
+ * languages present in the repo, with `command` resolved to an absolute path.
13
+ * Returns null if none is installed. */
14
+ export declare function pickServer(languagesPresent: Set<string>): LspServer | null;
15
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/graph/lsp/registry.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,uFAAuF;IACvF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,sEAAsE;AACtE,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAM3C,CAAC;AAeF;;wCAEwC;AACxC,wBAAgB,UAAU,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,CAO1E"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * LSP server registry — maps graft language names to a language server command.
3
+ * Only servers whose binary is actually on PATH are eligible; a missing binary
4
+ * simply means that language gets no LSP enrichment (the AST graph stands alone).
5
+ */
6
+ import { execSync } from "node:child_process";
7
+ /** First-match-wins; ordering is priority. Extend by adding a row. */
8
+ export const LSP_SERVERS = [
9
+ { languages: ["rust"], command: "rust-analyzer", args: [], languageId: "rust" },
10
+ { languages: ["cpp", "c"], command: "clangd", args: ["--background-index"], languageId: "cpp" },
11
+ { languages: ["go"], command: "gopls", args: [], languageId: "go" },
12
+ { languages: ["python"], command: "pyright-langserver", args: ["--stdio"], languageId: "python" },
13
+ { languages: ["typescript", "javascript", "tsx"], command: "typescript-language-server", args: ["--stdio"], languageId: "typescript" },
14
+ ];
15
+ const resolved = new Map();
16
+ /** Resolve a command to its ABSOLUTE path via the login shell's PATH. `spawn`
17
+ * resolves against `process.env.PATH`, which often omits `~/.cargo/bin`,
18
+ * `~/go/bin`, etc. where these servers live — so `command -v` can find a server
19
+ * that `spawn(cmd)` then can't. Spawning the absolute path avoids that mismatch. */
20
+ function resolveCommand(cmd) {
21
+ if (resolved.has(cmd))
22
+ return resolved.get(cmd);
23
+ let abs = null;
24
+ try {
25
+ abs = execSync(`command -v ${cmd}`, { encoding: "utf8" }).trim() || null;
26
+ }
27
+ catch {
28
+ abs = null;
29
+ }
30
+ resolved.set(cmd, abs);
31
+ return abs;
32
+ }
33
+ /** Pick the highest-priority installed server that covers at least one of the
34
+ * languages present in the repo, with `command` resolved to an absolute path.
35
+ * Returns null if none is installed. */
36
+ export function pickServer(languagesPresent) {
37
+ for (const s of LSP_SERVERS) {
38
+ if (!s.languages.some((l) => languagesPresent.has(l)))
39
+ continue;
40
+ const abs = resolveCommand(s.command);
41
+ if (abs)
42
+ return { ...s, command: abs };
43
+ }
44
+ return null;
45
+ }
46
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/graph/lsp/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAW9C,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE;IAC/E,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,oBAAoB,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE;IAC/F,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;IACnE,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE;IACjG,EAAE,SAAS,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE;CACvI,CAAC;AAEF,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;AAClD;;;oFAGoF;AACpF,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;IACjD,IAAI,GAAG,GAAkB,IAAI,CAAC;IAC9B,IAAI,CAAC;QAAC,GAAG,GAAG,QAAQ,CAAC,cAAc,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,GAAG,GAAG,IAAI,CAAC;IAAC,CAAC;IACvG,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACvB,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;wCAEwC;AACxC,MAAM,UAAU,UAAU,CAAC,gBAA6B;IACtD,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAAE,SAAS;QAChE,MAAM,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,GAAG;YAAE,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IACzC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,13 @@
1
+ (struct_specifier name: (type_identifier) @name body:(_)) @definition.class
2
+
3
+ (declaration type: (union_specifier name: (type_identifier) @name)) @definition.class
4
+
5
+ (function_declarator declarator: (identifier) @name) @definition.function
6
+
7
+ (type_definition declarator: (type_identifier) @name) @definition.type
8
+
9
+ (enum_specifier name: (type_identifier) @name) @definition.type
10
+
11
+ ; graft: call sites (upstream c tags.scm is definition-only)
12
+ (call_expression
13
+ function: (identifier) @name) @reference.call
@@ -0,0 +1,19 @@
1
+ ; C# tags — minimal, matched to the tree-sitter-wasms c_sharp grammar node types.
2
+ ; (Upstream tree-sitter-c-sharp tags.scm references node types the bundled wasm
3
+ ; grammar version lacks — "Bad node name 'type'" — so graft ships this instead.)
4
+
5
+ (class_declaration name: (identifier) @name) @definition.class
6
+ (interface_declaration name: (identifier) @name) @definition.interface
7
+ (struct_declaration (identifier) @name) @definition.struct
8
+ (enum_declaration name: (identifier) @name) @definition.enum
9
+ (record_declaration (identifier) @name) @definition.class
10
+ (method_declaration name: (identifier) @name) @definition.method
11
+ (constructor_declaration (identifier) @name) @definition.method
12
+ (property_declaration name: (identifier) @name) @definition.variable
13
+ (namespace_declaration name: (identifier) @name) @definition.module
14
+
15
+ (invocation_expression
16
+ function: [
17
+ (identifier) @name
18
+ (member_access_expression name: (identifier) @name)
19
+ ]) @reference.call
@@ -0,0 +1,23 @@
1
+ (struct_specifier name: (type_identifier) @name body:(_)) @definition.class
2
+
3
+ (declaration type: (union_specifier name: (type_identifier) @name)) @definition.class
4
+
5
+ (function_declarator declarator: (identifier) @name) @definition.function
6
+
7
+ (function_declarator declarator: (field_identifier) @name) @definition.function
8
+
9
+ (function_declarator declarator: (qualified_identifier scope: (namespace_identifier) @local.scope name: (identifier) @name)) @definition.method
10
+
11
+ (type_definition declarator: (type_identifier) @name) @definition.type
12
+
13
+ (enum_specifier name: (type_identifier) @name) @definition.type
14
+
15
+ (class_specifier name: (type_identifier) @name) @definition.class
16
+
17
+ ; graft: call sites (upstream cpp tags.scm is definition-only)
18
+ (call_expression
19
+ function: [
20
+ (identifier) @name
21
+ (field_expression field: (field_identifier) @name)
22
+ (qualified_identifier name: (identifier) @name)
23
+ ]) @reference.call
@@ -0,0 +1,54 @@
1
+ ; Definitions
2
+
3
+ ; * modules and protocols
4
+ (call
5
+ target: (identifier) @ignore
6
+ (arguments (alias) @name)
7
+ (#any-of? @ignore "defmodule" "defprotocol")) @definition.module
8
+
9
+ ; * functions/macros
10
+ (call
11
+ target: (identifier) @ignore
12
+ (arguments
13
+ [
14
+ ; zero-arity functions with no parentheses
15
+ (identifier) @name
16
+ ; regular function clause
17
+ (call target: (identifier) @name)
18
+ ; function clause with a guard clause
19
+ (binary_operator
20
+ left: (call target: (identifier) @name)
21
+ operator: "when")
22
+ ])
23
+ (#any-of? @ignore "def" "defp" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp")) @definition.function
24
+
25
+ ; References
26
+
27
+ ; ignore calls to kernel/special-forms keywords
28
+ (call
29
+ target: (identifier) @ignore
30
+ (#any-of? @ignore "def" "defp" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defmodule" "defprotocol" "defimpl" "defstruct" "defexception" "defoverridable" "alias" "case" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))
31
+
32
+ ; ignore module attributes
33
+ (unary_operator
34
+ operator: "@"
35
+ operand: (call
36
+ target: (identifier) @ignore))
37
+
38
+ ; * function call
39
+ (call
40
+ target: [
41
+ ; local
42
+ (identifier) @name
43
+ ; remote
44
+ (dot
45
+ right: (identifier) @name)
46
+ ]) @reference.call
47
+
48
+ ; * pipe into function call
49
+ (binary_operator
50
+ operator: "|>"
51
+ right: (identifier) @name) @reference.call
52
+
53
+ ; * modules
54
+ (alias) @name @reference.module
@@ -0,0 +1,20 @@
1
+ (class_declaration
2
+ name: (identifier) @name) @definition.class
3
+
4
+ (method_declaration
5
+ name: (identifier) @name) @definition.method
6
+
7
+ (method_invocation
8
+ name: (identifier) @name
9
+ arguments: (argument_list) @reference.call)
10
+
11
+ (interface_declaration
12
+ name: (identifier) @name) @definition.interface
13
+
14
+ (type_list
15
+ (type_identifier) @name) @reference.implementation
16
+
17
+ (object_creation_expression
18
+ type: (type_identifier) @name) @reference.class
19
+
20
+ (superclass (type_identifier) @name) @reference.class
@@ -0,0 +1,43 @@
1
+ ; Classes
2
+ (class_declaration
3
+ (type_identifier) @name) @definition.class
4
+
5
+ ; Objects
6
+ (object_declaration
7
+ (type_identifier) @name) @definition.class
8
+
9
+ ; Functions (top-level and member)
10
+ (function_declaration
11
+ (simple_identifier) @name) @definition.function
12
+
13
+ ; Properties
14
+ (property_declaration
15
+ (variable_declaration
16
+ (simple_identifier) @name)) @definition.constant
17
+
18
+ ; Enum entries
19
+ (enum_entry
20
+ (simple_identifier) @name) @definition.constant
21
+
22
+ ; Type aliases
23
+ (type_alias
24
+ (type_identifier) @name) @definition.type
25
+
26
+ ; Companion objects (only named ones)
27
+ (companion_object
28
+ (type_identifier) @name) @definition.class
29
+
30
+ ; Function calls
31
+ (call_expression
32
+ (simple_identifier) @name) @reference.call
33
+
34
+ ; Method calls via navigation
35
+ (call_expression
36
+ (navigation_expression
37
+ (navigation_suffix
38
+ (simple_identifier) @name))) @reference.call
39
+
40
+ ; Constructor invocations (class references)
41
+ (constructor_invocation
42
+ (user_type
43
+ (type_identifier) @name)) @reference.class
@@ -0,0 +1,40 @@
1
+ (namespace_definition
2
+ name: (namespace_name) @name) @definition.module
3
+
4
+ (interface_declaration
5
+ name: (name) @name) @definition.interface
6
+
7
+ (trait_declaration
8
+ name: (name) @name) @definition.interface
9
+
10
+ (class_declaration
11
+ name: (name) @name) @definition.class
12
+
13
+ (class_interface_clause [(name) (qualified_name)] @name) @reference.implementation
14
+
15
+ (property_declaration
16
+ (property_element (variable_name (name) @name))) @definition.field
17
+
18
+ (function_definition
19
+ name: (name) @name) @definition.function
20
+
21
+ (method_declaration
22
+ name: (name) @name) @definition.function
23
+
24
+ (object_creation_expression
25
+ [
26
+ (qualified_name (name) @name)
27
+ (variable_name (name) @name)
28
+ ]) @reference.class
29
+
30
+ (function_call_expression
31
+ function: [
32
+ (qualified_name (name) @name)
33
+ (variable_name (name)) @name
34
+ ]) @reference.call
35
+
36
+ (scoped_call_expression
37
+ name: (name) @name) @reference.call
38
+
39
+ (member_call_expression
40
+ name: (name) @name) @reference.call
@@ -0,0 +1,65 @@
1
+ ; Method definitions
2
+
3
+ (
4
+ (comment)* @doc
5
+ .
6
+ [
7
+ (method
8
+ name: (_) @name) @definition.method
9
+ (singleton_method
10
+ name: (_) @name) @definition.method
11
+ ]
12
+ (#strip! @doc "^#\\s*")
13
+ (#select-adjacent! @doc @definition.method)
14
+ )
15
+
16
+ (alias
17
+ name: (_) @name) @definition.method
18
+
19
+ (setter
20
+ (identifier) @ignore)
21
+
22
+ ; Class definitions
23
+
24
+ (
25
+ (comment)* @doc
26
+ .
27
+ [
28
+ (class
29
+ name: [
30
+ (constant) @name
31
+ (scope_resolution
32
+ name: (_) @name)
33
+ ]) @definition.class
34
+ (singleton_class
35
+ value: [
36
+ (constant) @name
37
+ (scope_resolution
38
+ name: (_) @name)
39
+ ]) @definition.class
40
+ ]
41
+ (#strip! @doc "^#\\s*")
42
+ (#select-adjacent! @doc @definition.class)
43
+ )
44
+
45
+ ; Module definitions
46
+
47
+ (
48
+ (module
49
+ name: [
50
+ (constant) @name
51
+ (scope_resolution
52
+ name: (_) @name)
53
+ ]) @definition.module
54
+ )
55
+
56
+ ; Calls
57
+ ; NB: only explicit call nodes — the upstream tags.scm also tags bare
58
+ ; [(identifier)(constant)] as @reference.call gated by (#is-not? local), but that
59
+ ; predicate needs the paired @local.* captures (from locals.scm, which graft does
60
+ ; not load) to mean anything. Without them it's a no-op, so bare *variable reads*
61
+ ; that share a name with a same-file/unique method become bogus `calls` edges
62
+ ; (resolve.ts can't tell a var read from a zero-arg call). Dropped for precision —
63
+ ; consistent with every other breadth-tier query (all use explicit call nodes).
64
+
65
+ (call method: (identifier) @name) @reference.call
@@ -0,0 +1,41 @@
1
+ ; Rust tags — standard tree-sitter tags convention (@definition.<kind> + @name + @reference.call).
2
+ ; Vendored for graft's generic breadth tier. Predicates like (#strip! ...) are
3
+ ; sanitized out at load time by generic.ts.
4
+
5
+ (function_item (identifier) @name) @definition.function
6
+
7
+ (function_signature_item (identifier) @name) @definition.function
8
+
9
+ (struct_item (type_identifier) @name) @definition.struct
10
+
11
+ (enum_item (type_identifier) @name) @definition.enum
12
+
13
+ (union_item (type_identifier) @name) @definition.struct
14
+
15
+ (trait_item (type_identifier) @name) @definition.interface
16
+
17
+ (type_item (type_identifier) @name) @definition.type
18
+
19
+ (mod_item (identifier) @name) @definition.module
20
+
21
+ (macro_definition (identifier) @name) @definition.function
22
+
23
+ (const_item (identifier) @name) @definition.constant
24
+
25
+ (static_item (identifier) @name) @definition.constant
26
+
27
+ ; associated functions / methods inside impl blocks are function_item too,
28
+ ; already captured above; call sites below:
29
+
30
+ (call_expression
31
+ function: [
32
+ (identifier) @name
33
+ (field_expression field: (field_identifier) @name)
34
+ (scoped_identifier name: (identifier) @name)
35
+ ]) @reference.call
36
+
37
+ (macro_invocation
38
+ macro: [
39
+ (identifier) @name
40
+ (scoped_identifier name: (identifier) @name)
41
+ ]) @reference.call
@@ -0,0 +1,66 @@
1
+ ; Definitions
2
+
3
+ (package_clause
4
+ name: (package_identifier) @name) @definition.module
5
+
6
+ (trait_definition
7
+ name: (identifier) @name) @definition.interface
8
+
9
+ (enum_definition
10
+ name: (identifier) @name) @definition.enum
11
+
12
+ (simple_enum_case
13
+ name: (identifier) @name) @definition.class
14
+
15
+ (full_enum_case
16
+ name: (identifier) @name) @definition.class
17
+
18
+ (class_definition
19
+ name: (identifier) @name) @definition.class
20
+
21
+ (object_definition
22
+ name: (identifier) @name) @definition.object
23
+
24
+ (function_definition
25
+ name: (identifier) @name) @definition.function
26
+
27
+ (val_definition
28
+ pattern: (identifier) @name) @definition.variable
29
+
30
+ (given_definition
31
+ name: (identifier) @name) @definition.variable
32
+
33
+ (var_definition
34
+ pattern: (identifier) @name) @definition.variable
35
+
36
+ (val_declaration
37
+ name: (identifier) @name) @definition.variable
38
+
39
+ (var_declaration
40
+ name: (identifier) @name) @definition.variable
41
+
42
+ (type_definition
43
+ name: (type_identifier) @name) @definition.type
44
+
45
+ (class_parameter
46
+ name: (identifier) @name) @definition.property
47
+
48
+ ; References
49
+
50
+ (call_expression
51
+ (identifier) @name) @reference.call
52
+
53
+ (instance_expression
54
+ (type_identifier) @name) @reference.interface
55
+
56
+ (instance_expression
57
+ (generic_type
58
+ (type_identifier) @name)) @reference.interface
59
+
60
+ (extends_clause
61
+ (type_identifier) @name) @reference.class
62
+
63
+ (extends_clause
64
+ (generic_type
65
+ (type_identifier) @name)) @reference.class
66
+