@stupidloud/codegraph 0.8.1 → 0.9.5

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 (121) hide show
  1. package/README.md +91 -60
  2. package/dist/bin/codegraph.d.ts +4 -0
  3. package/dist/bin/codegraph.d.ts.map +1 -1
  4. package/dist/bin/codegraph.js +302 -8
  5. package/dist/bin/codegraph.js.map +1 -1
  6. package/dist/bin/node-version-check.d.ts +17 -0
  7. package/dist/bin/node-version-check.d.ts.map +1 -1
  8. package/dist/bin/node-version-check.js +37 -0
  9. package/dist/bin/node-version-check.js.map +1 -1
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +1 -11
  12. package/dist/config.js.map +1 -1
  13. package/dist/db/index.d.ts +30 -1
  14. package/dist/db/index.d.ts.map +1 -1
  15. package/dist/db/index.js +75 -25
  16. package/dist/db/index.js.map +1 -1
  17. package/dist/db/queries.d.ts +16 -0
  18. package/dist/db/queries.d.ts.map +1 -1
  19. package/dist/db/queries.js +80 -27
  20. package/dist/db/queries.js.map +1 -1
  21. package/dist/db/sqlite-adapter.d.ts +17 -23
  22. package/dist/db/sqlite-adapter.d.ts.map +1 -1
  23. package/dist/db/sqlite-adapter.js +51 -174
  24. package/dist/db/sqlite-adapter.js.map +1 -1
  25. package/dist/extraction/grammars.d.ts +7 -1
  26. package/dist/extraction/grammars.d.ts.map +1 -1
  27. package/dist/extraction/grammars.js +42 -2
  28. package/dist/extraction/grammars.js.map +1 -1
  29. package/dist/extraction/index.d.ts +9 -14
  30. package/dist/extraction/index.d.ts.map +1 -1
  31. package/dist/extraction/index.js +75 -94
  32. package/dist/extraction/index.js.map +1 -1
  33. package/dist/extraction/languages/index.d.ts.map +1 -1
  34. package/dist/extraction/languages/index.js +4 -0
  35. package/dist/extraction/languages/index.js.map +1 -1
  36. package/dist/extraction/languages/lua.d.ts +3 -0
  37. package/dist/extraction/languages/lua.d.ts.map +1 -0
  38. package/dist/extraction/languages/lua.js +150 -0
  39. package/dist/extraction/languages/lua.js.map +1 -0
  40. package/dist/extraction/languages/luau.d.ts +3 -0
  41. package/dist/extraction/languages/luau.d.ts.map +1 -0
  42. package/dist/extraction/languages/luau.js +37 -0
  43. package/dist/extraction/languages/luau.js.map +1 -0
  44. package/dist/extraction/tree-sitter.d.ts.map +1 -1
  45. package/dist/extraction/tree-sitter.js +38 -0
  46. package/dist/extraction/tree-sitter.js.map +1 -1
  47. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  48. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  49. package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
  50. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  51. package/dist/extraction/wasm-runtime-flags.js +105 -0
  52. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  53. package/dist/graph/traversal.d.ts.map +1 -1
  54. package/dist/graph/traversal.js +71 -36
  55. package/dist/graph/traversal.js.map +1 -1
  56. package/dist/index.d.ts +11 -5
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +28 -18
  59. package/dist/index.js.map +1 -1
  60. package/dist/installer/index.d.ts +54 -2
  61. package/dist/installer/index.d.ts.map +1 -1
  62. package/dist/installer/index.js +123 -1
  63. package/dist/installer/index.js.map +1 -1
  64. package/dist/installer/targets/claude.d.ts +16 -0
  65. package/dist/installer/targets/claude.d.ts.map +1 -1
  66. package/dist/installer/targets/claude.js +93 -0
  67. package/dist/installer/targets/claude.js.map +1 -1
  68. package/dist/installer/targets/cursor.d.ts.map +1 -1
  69. package/dist/installer/targets/cursor.js +57 -3
  70. package/dist/installer/targets/cursor.js.map +1 -1
  71. package/dist/installer/targets/hermes.d.ts +18 -0
  72. package/dist/installer/targets/hermes.d.ts.map +1 -0
  73. package/dist/installer/targets/hermes.js +305 -0
  74. package/dist/installer/targets/hermes.js.map +1 -0
  75. package/dist/installer/targets/registry.d.ts.map +1 -1
  76. package/dist/installer/targets/registry.js +2 -0
  77. package/dist/installer/targets/registry.js.map +1 -1
  78. package/dist/installer/targets/types.d.ts +1 -1
  79. package/dist/installer/targets/types.d.ts.map +1 -1
  80. package/dist/mcp/index.d.ts +4 -0
  81. package/dist/mcp/index.d.ts.map +1 -1
  82. package/dist/mcp/index.js +97 -0
  83. package/dist/mcp/index.js.map +1 -1
  84. package/dist/mcp/tools.d.ts +11 -1
  85. package/dist/mcp/tools.d.ts.map +1 -1
  86. package/dist/mcp/tools.js +131 -15
  87. package/dist/mcp/tools.js.map +1 -1
  88. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  89. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  90. package/dist/resolution/frameworks/drupal.js +335 -0
  91. package/dist/resolution/frameworks/drupal.js.map +1 -0
  92. package/dist/resolution/frameworks/index.d.ts +1 -0
  93. package/dist/resolution/frameworks/index.d.ts.map +1 -1
  94. package/dist/resolution/frameworks/index.js +5 -1
  95. package/dist/resolution/frameworks/index.js.map +1 -1
  96. package/dist/resolution/index.d.ts.map +1 -1
  97. package/dist/resolution/index.js +40 -7
  98. package/dist/resolution/index.js.map +1 -1
  99. package/dist/resolution/lru-cache.d.ts +24 -0
  100. package/dist/resolution/lru-cache.d.ts.map +1 -0
  101. package/dist/resolution/lru-cache.js +62 -0
  102. package/dist/resolution/lru-cache.js.map +1 -0
  103. package/dist/sync/watcher.d.ts +2 -4
  104. package/dist/sync/watcher.d.ts.map +1 -1
  105. package/dist/sync/watcher.js +4 -6
  106. package/dist/sync/watcher.js.map +1 -1
  107. package/dist/types.d.ts +1 -1
  108. package/dist/types.d.ts.map +1 -1
  109. package/dist/types.js +11 -0
  110. package/dist/types.js.map +1 -1
  111. package/dist/utils.js +1 -1
  112. package/package.json +2 -2
  113. package/scripts/add-lang/bench.sh +60 -0
  114. package/scripts/add-lang/check-grammar.mjs +75 -0
  115. package/scripts/add-lang/dump-ast.mjs +103 -0
  116. package/scripts/add-lang/verify-extraction.mjs +70 -0
  117. package/scripts/build-bundle.sh +118 -0
  118. package/scripts/npm-shim.js +246 -0
  119. package/scripts/pack-npm.sh +95 -0
  120. package/scripts/patch-tree-sitter-dart.js +0 -112
  121. package/scripts/release.sh +0 -68
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.luaExtractor = void 0;
4
+ const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
5
+ // Node names follow the vendored ABI-15 grammar (@tree-sitter-grammars/
6
+ // tree-sitter-lua), NOT the older tree-sitter-wasms build — see grammars.ts.
7
+ /** First descendant of a given type (breadth-first), or null. */
8
+ function findDescendant(node, type) {
9
+ const queue = [...node.namedChildren];
10
+ while (queue.length) {
11
+ const n = queue.shift();
12
+ if (n.type === type)
13
+ return n;
14
+ queue.push(...n.namedChildren);
15
+ }
16
+ return null;
17
+ }
18
+ /**
19
+ * If `callNode` is a `require(...)` call, return the module name; otherwise null.
20
+ * Lua/Luau have no import statement — modules are loaded by calling the global
21
+ * `require`. Handles both:
22
+ * - string requires: `require("net.http")` / `require "net.http"` → "net.http"
23
+ * - Roblox/Luau path requires: `require(script.Parent.Signal)` → "Signal"
24
+ * (the dominant idiom in Roblox code, where the argument is an instance path
25
+ * rather than a string — use the trailing field as the module name).
26
+ */
27
+ function requireModule(callNode, source) {
28
+ // function_call > name: <callee>, arguments: arguments
29
+ const name = (0, tree_sitter_helpers_1.getChildByField)(callNode, 'name');
30
+ // A dotted/colon callee (e.g. `socket.connect`) is dot/method_index_expression,
31
+ // never a bare `require`.
32
+ if (!name || name.type !== 'identifier')
33
+ return null;
34
+ if ((0, tree_sitter_helpers_1.getNodeText)(name, source) !== 'require')
35
+ return null;
36
+ const args = (0, tree_sitter_helpers_1.getChildByField)(callNode, 'arguments');
37
+ if (!args)
38
+ return null;
39
+ // String require — `string > content: string_content` gives the bare name.
40
+ const content = findDescendant(args, 'string_content');
41
+ if (content)
42
+ return (0, tree_sitter_helpers_1.getNodeText)(content, source).trim() || null;
43
+ const str = findDescendant(args, 'string');
44
+ if (str) {
45
+ const mod = (0, tree_sitter_helpers_1.getNodeText)(str, source)
46
+ .trim()
47
+ .replace(/^\[\[/, '')
48
+ .replace(/\]\]$/, '')
49
+ .replace(/^["']/, '')
50
+ .replace(/["']$/, '');
51
+ if (mod)
52
+ return mod;
53
+ }
54
+ // Roblox/Luau instance-path require: `require(script.Parent.Signal)` → "Signal".
55
+ const idx = findDescendant(args, 'dot_index_expression') ?? findDescendant(args, 'method_index_expression');
56
+ if (idx) {
57
+ const field = (0, tree_sitter_helpers_1.getChildByField)(idx, 'field') ?? (0, tree_sitter_helpers_1.getChildByField)(idx, 'method');
58
+ if (field)
59
+ return (0, tree_sitter_helpers_1.getNodeText)(field, source).trim() || null;
60
+ }
61
+ return null;
62
+ }
63
+ exports.luaExtractor = {
64
+ // function_declaration covers global (`function f`), table (`function t.f`),
65
+ // method (`function t:m`), and local (`local function f`) forms — the form is
66
+ // distinguished by the `name:` child (identifier / dot_index_expression /
67
+ // method_index_expression) and a `local` token, not by separate node types.
68
+ // Anonymous `function() ... end` (function_definition) has no name and is
69
+ // captured via its enclosing variable instead.
70
+ functionTypes: ['function_declaration'],
71
+ classTypes: [], // Lua has no classes/structs/interfaces/enums — tables are used for everything
72
+ methodTypes: [],
73
+ interfaceTypes: [],
74
+ structTypes: [],
75
+ enumTypes: [],
76
+ typeAliasTypes: [],
77
+ importTypes: [], // `require` is a function_call — handled in visitNode below
78
+ callTypes: ['function_call'],
79
+ variableTypes: ['variable_declaration'], // see the `lua` branch in extractVariable
80
+ nameField: 'name',
81
+ bodyField: 'body',
82
+ paramsField: 'parameters',
83
+ getSignature: (node, source) => {
84
+ const params = (0, tree_sitter_helpers_1.getChildByField)(node, 'parameters');
85
+ return params ? (0, tree_sitter_helpers_1.getNodeText)(params, source) : undefined;
86
+ },
87
+ // `function t.f()` / `function t:m()` are methods on table `t`: return the
88
+ // table as the receiver so they extract as methods with a `t::f` qualified
89
+ // name. Plain `function f()` / `local function f()` have no receiver and stay
90
+ // functions. (For `a.b.c`, the receiver is the nested `a.b`.)
91
+ getReceiverType: (node, source) => {
92
+ const name = (0, tree_sitter_helpers_1.getChildByField)(node, 'name');
93
+ if (name && (name.type === 'dot_index_expression' || name.type === 'method_index_expression')) {
94
+ const table = (0, tree_sitter_helpers_1.getChildByField)(name, 'table');
95
+ if (table)
96
+ return (0, tree_sitter_helpers_1.getNodeText)(table, source);
97
+ }
98
+ return undefined;
99
+ },
100
+ // Emit import nodes for `require(...)`. The local-declaration form is handled
101
+ // explicitly because the variable branch skips the initializer subtree; bare
102
+ // and global `require` calls are caught when the walker reaches the
103
+ // function_call node.
104
+ visitNode: (node, ctx) => {
105
+ const source = ctx.source;
106
+ const emit = (callNode) => {
107
+ const mod = requireModule(callNode, source);
108
+ if (!mod)
109
+ return;
110
+ const imp = ctx.createNode('import', mod, callNode, {
111
+ signature: (0, tree_sitter_helpers_1.getNodeText)(callNode, source).trim().slice(0, 100),
112
+ });
113
+ if (imp && ctx.nodeStack.length > 0) {
114
+ const parentId = ctx.nodeStack[ctx.nodeStack.length - 1];
115
+ if (parentId) {
116
+ ctx.addUnresolvedReference({
117
+ fromNodeId: parentId,
118
+ referenceName: mod,
119
+ referenceKind: 'imports',
120
+ line: callNode.startPosition.row + 1,
121
+ column: callNode.startPosition.column,
122
+ });
123
+ }
124
+ }
125
+ };
126
+ // Bare / global `require("x")` — claim it so it isn't double-counted as a call.
127
+ if (node.type === 'function_call') {
128
+ if (requireModule(node, source)) {
129
+ emit(node);
130
+ return true;
131
+ }
132
+ return false;
133
+ }
134
+ // `local x = require("x")` — variable_declaration wraps an assignment_statement
135
+ // whose initializer subtree the variable branch will skip, so dig it out here.
136
+ if (node.type === 'variable_declaration') {
137
+ const assign = node.namedChildren.find((c) => c.type === 'assignment_statement');
138
+ const exprList = assign?.namedChildren.find((c) => c.type === 'expression_list');
139
+ if (exprList) {
140
+ for (const val of exprList.namedChildren) {
141
+ if (val.type === 'function_call')
142
+ emit(val);
143
+ }
144
+ }
145
+ return false;
146
+ }
147
+ return false;
148
+ },
149
+ };
150
+ //# sourceMappingURL=lua.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lua.js","sourceRoot":"","sources":["../../../src/extraction/languages/lua.ts"],"names":[],"mappings":";;;AACA,gEAAsE;AAGtE,wEAAwE;AACxE,6EAA6E;AAE7E,iEAAiE;AACjE,SAAS,cAAc,CAAC,IAAgB,EAAE,IAAY;IACpD,MAAM,KAAK,GAAiB,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,EAAG,CAAC;QACzB,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,CAAC,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,aAAa,CAAC,QAAoB,EAAE,MAAc;IACzD,uDAAuD;IACvD,MAAM,IAAI,GAAG,IAAA,qCAAe,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC/C,gFAAgF;IAChF,0BAA0B;IAC1B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,IAAI,CAAC;IACrD,IAAI,IAAA,iCAAW,EAAC,IAAI,EAAE,MAAM,CAAC,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAEzD,MAAM,IAAI,GAAG,IAAA,qCAAe,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACpD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,2EAA2E;IAC3E,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACvD,IAAI,OAAO;QAAE,OAAO,IAAA,iCAAW,EAA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ACjF,MAAM,QAAQ,GAAG,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAC;YACjF,IAAI,QAAQ,EAAE,CAAC;gBACb,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;oBACzC,IAAI,GAAG,CAAC,IAAI,KAAK,eAAe;wBAAE,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC9C,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { LanguageExtractor } from '../tree-sitter-types';
2
+ export declare const luauExtractor: LanguageExtractor;
3
+ //# sourceMappingURL=luau.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"luau.d.ts","sourceRoot":"","sources":["../../../src/extraction/languages/luau.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAc9D,eAAO,MAAM,aAAa,EAAE,iBAoB3B,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.luauExtractor = void 0;
4
+ const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
5
+ const lua_1 = require("./lua");
6
+ // Luau (https://luau.org) is a gradually-typed superset of Lua. The
7
+ // tree-sitter-luau grammar reuses the same node names as the vendored Lua
8
+ // grammar (function_declaration, variable_declaration, function_call,
9
+ // dot/method_index_expression, …), so the Luau extractor extends the Lua one
10
+ // and adds the type-system pieces Luau introduces:
11
+ // - `type X = ...` / `export type X = ...` → type_definition (type_alias)
12
+ // - typed parameters and return types → richer signatures
13
+ //
14
+ // require detection, receiver-splitting (t.f / t:m → methods), and local
15
+ // variable extraction are inherited unchanged from luaExtractor. The shared
16
+ // `extractVariable` core branch is gated on `lua` || `luau`.
17
+ exports.luauExtractor = {
18
+ ...lua_1.luaExtractor,
19
+ // `type X = ...` and `export type X = ...`
20
+ typeAliasTypes: ['type_definition'],
21
+ // Only Luau `export type` is exported; the keyword leads the node.
22
+ isExported: (node, source) => source.slice(node.startIndex, node.startIndex + 7) === 'export ',
23
+ // Params + Luau return type (the named child after `parameters`, before the body).
24
+ getSignature: (node, source) => {
25
+ const params = (0, tree_sitter_helpers_1.getChildByField)(node, 'parameters');
26
+ if (!params)
27
+ return undefined;
28
+ let sig = (0, tree_sitter_helpers_1.getNodeText)(params, source);
29
+ const kids = node.namedChildren;
30
+ const idx = kids.findIndex((c) => c.startIndex === params.startIndex);
31
+ const ret = idx >= 0 ? kids[idx + 1] : null;
32
+ if (ret && ret.type !== 'block')
33
+ sig += `: ${(0, tree_sitter_helpers_1.getNodeText)(ret, source)}`;
34
+ return sig;
35
+ },
36
+ };
37
+ //# sourceMappingURL=luau.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"luau.js","sourceRoot":"","sources":["../../../src/extraction/languages/luau.ts"],"names":[],"mappings":";;;AAAA,gEAAsE;AAEtE,+BAAqC;AAErC,oEAAoE;AACpE,0EAA0E;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,mDAAmD;AACnD,6EAA6E;AAC7E,mEAAmE;AACnE,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,6DAA6D;AAChD,QAAA,aAAa,GAAsB;IAC9C,GAAG,kBAAY;IAEf,2CAA2C;IAC3C,cAAc,EAAE,CAAC,iBAAiB,CAAC;IAEnC,mEAAmE;IACnE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,SAAS;IAE9F,mFAAmF;IACnF,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;QAC7B,MAAM,MAAM,G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,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAEvC;IAEH;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAW3B;IAEH;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAyB9B;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAYrC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAwBlC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAuIvB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAuE7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA0BzB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAW1B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAiBhC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA0D5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAyCzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAmBzB;AAGD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,QAAQ,EACnB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,gBAAgB,CA6DlB"}
@@ -72,6 +72,19 @@ function extractName(node, source, extractor) {
72
72
  const innerName = (0, tree_sitter_helpers_1.getChildByField)(resolved, 'declarator') || resolved.namedChild(0);
73
73
  return innerName ? (0, tree_sitter_helpers_1.getNodeText)(innerName, source) : (0, tree_sitter_helpers_1.getNodeText)(resolved, source);
74
74
  }
75
+ // Lua: `function t.f()` / `function t:m()` — the name node is a dot/method
76
+ // index expression; the simple name is the trailing field/method (the table
77
+ // receiver is captured separately via getReceiverType).
78
+ if (resolved.type === 'dot_index_expression') {
79
+ const field = (0, tree_sitter_helpers_1.getChildByField)(resolved, 'field');
80
+ if (field)
81
+ return (0, tree_sitter_helpers_1.getNodeText)(field, source);
82
+ }
83
+ if (resolved.type === 'method_index_expression') {
84
+ const method = (0, tree_sitter_helpers_1.getChildByField)(resolved, 'method');
85
+ if (method)
86
+ return (0, tree_sitter_helpers_1.getNodeText)(method, source);
87
+ }
75
88
  return (0, tree_sitter_helpers_1.getNodeText)(resolved, source);
76
89
  }
77
90
  // For Dart method_signature, look inside inner signature types
@@ -1039,6 +1052,25 @@ class TreeSitterExtractor {
1039
1052
  }
1040
1053
  }
1041
1054
  }
1055
+ else if (this.language === 'lua' || this.language === 'luau') {
1056
+ // Lua/Luau: variable_declaration → assignment_statement → variable_list
1057
+ // (name: identifier...) = expression_list. `local x, y = 1, 2`
1058
+ // declares multiple names; only plain identifiers are locals.
1059
+ const assign = node.namedChildren.find((c) => c.type === 'assignment_statement') ?? node;
1060
+ const varList = assign.namedChildren.find((c) => c.type === 'variable_list');
1061
+ const exprList = assign.namedChildren.find((c) => c.type === 'expression_list');
1062
+ const values = exprList ? exprList.namedChildren : [];
1063
+ const names = varList ? varList.namedChildren.filter((c) => c.type === 'identifier') : [];
1064
+ names.forEach((nameNode, i) => {
1065
+ const name = (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source);
1066
+ if (!name)
1067
+ return;
1068
+ const valueNode = values[i];
1069
+ const initValue = valueNode ? (0, tree_sitter_helpers_1.getNodeText)(valueNode, this.source).slice(0, 100) : undefined;
1070
+ const initSignature = initValue ? `= ${initValue}${initValue.length >= 100 ? '...' : ''}` : undefined;
1071
+ this.createNode(kind, name, nameNode, { docstring, signature: initSignature, isExported });
1072
+ });
1073
+ }
1042
1074
  else {
1043
1075
  // Generic fallback for other languages
1044
1076
  // Try to find identifier children
@@ -2357,6 +2389,12 @@ function extractFromSource(filePath, source, language, frameworkNames) {
2357
2389
  const extractor = new liquid_extractor_1.LiquidExtractor(filePath, source);
2358
2390
  result = extractor.extract();
2359
2391
  }
2392
+ else if (detectedLanguage === 'yaml' || detectedLanguage === 'twig') {
2393
+ // No symbol extraction — file is tracked at the file-record level only.
2394
+ // Framework extractors (e.g. Drupal routing resolver) run below and may
2395
+ // add route nodes / references for yaml files such as *.routing.yml.
2396
+ result = { nodes: [], edges: [], unresolvedReferences: [], errors: [], durationMs: 0 };
2397
+ }
2360
2398
  else if (detectedLanguage === 'pascal' &&
2361
2399
  (fileExtension === '.dfm' || fileExtension === '.fmx')) {
2362
2400
  // Use custom extractor for DFM/FMX form files