gitnexus 1.6.4-rc.24 → 1.6.4-rc.26
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.
- package/dist/_shared/scope-resolution/finalize-algorithm.js +50 -2
- package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -1
- package/dist/core/ingestion/languages/typescript/captures.js +22 -0
- package/dist/core/ingestion/languages/typescript/query.d.ts +7 -0
- package/dist/core/ingestion/languages/typescript/query.js +116 -5
- package/dist/core/ingestion/languages/typescript.js +46 -11
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +33 -3
- package/dist/core/ingestion/tree-sitter-queries.d.ts +2 -2
- package/dist/core/ingestion/tree-sitter-queries.js +41 -0
- package/dist/core/ingestion/utils/ast-helpers.d.ts +12 -1
- package/dist/core/ingestion/utils/ast-helpers.js +15 -1
- package/dist/mcp/local/local-backend.d.ts +7 -0
- package/dist/mcp/local/local-backend.js +33 -15
- package/package.json +1 -1
|
@@ -541,11 +541,59 @@ function deriveSimpleName(def) {
|
|
|
541
541
|
return dot === -1 ? q : q.slice(dot + 1);
|
|
542
542
|
}
|
|
543
543
|
function findExportByName(defs, name) {
|
|
544
|
+
// GENERIC RULE (applies to every language using this finalize
|
|
545
|
+
// algorithm): when MULTIPLE `SymbolDefinition`s share the same simple
|
|
546
|
+
// name in `localDefs`, prefer callable / type-like defs over plain
|
|
547
|
+
// value defs (`Variable`, `Property`, …). The CALLER side of an
|
|
548
|
+
// import almost always wants the callable, not a value shadow that
|
|
549
|
+
// happens to share the name — and without a deterministic
|
|
550
|
+
// preference, capture order silently decides which def the import
|
|
551
|
+
// binds to.
|
|
552
|
+
//
|
|
553
|
+
// The single-def case is unchanged: when only one def has the name,
|
|
554
|
+
// it's returned regardless of its type (the `fallback` path below).
|
|
555
|
+
//
|
|
556
|
+
// TypeScript is the first known language where this matters in
|
|
557
|
+
// practice: `const fn = () => {}` emits BOTH a `Function` def (from
|
|
558
|
+
// `@declaration.function` on the inner arrow) AND a `Variable` def
|
|
559
|
+
// (from the generic `@declaration.variable` pattern matching the
|
|
560
|
+
// wrapping `lexical_declaration`), and consumers of `import { fn }`
|
|
561
|
+
// need to bind to the callable. Other migrated languages don't
|
|
562
|
+
// currently produce dual emits of this shape, so the rule is a no-op
|
|
563
|
+
// for them today; future languages get the same correctness
|
|
564
|
+
// guarantee for free if they ever do.
|
|
565
|
+
//
|
|
566
|
+
// See `gitnexus/test/integration/resolvers/typescript-hof-callbacks.test.ts`
|
|
567
|
+
// for the cross-file regression this rule prevents.
|
|
568
|
+
let fallback;
|
|
544
569
|
for (const d of defs) {
|
|
545
|
-
if (deriveSimpleName(d)
|
|
570
|
+
if (deriveSimpleName(d) !== name)
|
|
571
|
+
continue;
|
|
572
|
+
if (isCallableOrTypeLike(d.type))
|
|
546
573
|
return d;
|
|
574
|
+
if (fallback === undefined)
|
|
575
|
+
fallback = d;
|
|
547
576
|
}
|
|
548
|
-
return
|
|
577
|
+
return fallback;
|
|
578
|
+
}
|
|
579
|
+
const CALLABLE_OR_TYPE_LIKE = new Set([
|
|
580
|
+
'Function',
|
|
581
|
+
'Method',
|
|
582
|
+
'Constructor',
|
|
583
|
+
'Class',
|
|
584
|
+
'Interface',
|
|
585
|
+
'Enum',
|
|
586
|
+
'Struct',
|
|
587
|
+
'Record',
|
|
588
|
+
'Trait',
|
|
589
|
+
'Namespace',
|
|
590
|
+
'Module',
|
|
591
|
+
'TypeAlias',
|
|
592
|
+
'Type',
|
|
593
|
+
'Typedef',
|
|
594
|
+
]);
|
|
595
|
+
function isCallableOrTypeLike(type) {
|
|
596
|
+
return CALLABLE_OR_TYPE_LIKE.has(type);
|
|
549
597
|
}
|
|
550
598
|
function countEdgesWithin(edgeIndex, files) {
|
|
551
599
|
let n = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalize-algorithm.js","sourceRoot":"","sources":["../../src/scope-resolution/finalize-algorithm.ts"],"names":[],"mappings":"AAAA;;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EAAE,SAAS,CAAC,EAC/C,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAC/C,CACF,CAAC;oBACJ,CAAC;gBACH,CAAC;gBACD,SAAS;YACX,CAAC;YAED,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtB,SAAS,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,KAAK;oBACX,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC,CAAC,MAAM,EAAE;oBAC1D,OAAO,EAAE,KAAK;iBACf,CAAC,CAAC;YACL,CAAC;iBAAM,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,IAAI,EACV,IAAI,CAAC,GAAG,CACN,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,EAC9C,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CACtC,CACF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,GAAgC,EAAE,GAAW,EAAE,KAAa;IAClF,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,sCAAsC,KAAK,QAAQ,GAAG,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -73,6 +73,11 @@ function pickFirstDefined(grouped, tags) {
|
|
|
73
73
|
* as `@reference.write.member`).
|
|
74
74
|
* 4. The member_expression is the `function:` of an `await_expression`
|
|
75
75
|
* being called (handled by the member-call capture).
|
|
76
|
+
* 5. The member_expression is the `name:` of a `jsx_self_closing_element`
|
|
77
|
+
* or `jsx_opening_element` (it's a JSX component invocation, already
|
|
78
|
+
* captured as `@reference.call.member` by the TSX-only query suffix).
|
|
79
|
+
* Without this filter, `<Foo.Bar />` would emit a phantom ACCESSES
|
|
80
|
+
* edge to `Foo.Bar` IN ADDITION to the CALLS edge.
|
|
76
81
|
*
|
|
77
82
|
* Returns `true` when the capture should be kept as a read reference,
|
|
78
83
|
* `false` when it should be dropped.
|
|
@@ -89,6 +94,9 @@ function shouldEmitReadMember(memberNode) {
|
|
|
89
94
|
case 'assignment_expression':
|
|
90
95
|
case 'augmented_assignment_expression':
|
|
91
96
|
return parent.childForFieldName('left')?.id !== memberNode.id;
|
|
97
|
+
case 'jsx_self_closing_element':
|
|
98
|
+
case 'jsx_opening_element':
|
|
99
|
+
return parent.childForFieldName('name')?.id !== memberNode.id;
|
|
92
100
|
default:
|
|
93
101
|
return true;
|
|
94
102
|
}
|
|
@@ -201,6 +209,20 @@ export function emitTsScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
201
209
|
// arity filter can narrow overloads. Count the `argument` named
|
|
202
210
|
// children of the backing `arguments` node. TypeScript constructor
|
|
203
211
|
// calls use `new_expression`; regular calls use `call_expression`.
|
|
212
|
+
//
|
|
213
|
+
// JSX call anchors (`jsx_self_closing_element` / `jsx_opening_element`
|
|
214
|
+
// captured by the TSX-only suffix in `query.ts`) intentionally do
|
|
215
|
+
// NOT carry arity metadata. The lookup below would resolve `callNode`
|
|
216
|
+
// to `null` for a JSX anchor (the anchor is neither a call_expression
|
|
217
|
+
// nor a new_expression), so the synthesis branch silently no-ops and
|
|
218
|
+
// the JSX call enters the registry with name-only resolution. This
|
|
219
|
+
// is acceptable for React: components are virtually never
|
|
220
|
+
// overloaded in the current GitNexus graph model, so name-only
|
|
221
|
+
// dispatch matches the single component definition. If a future
|
|
222
|
+
// codebase introduces overloaded React components AND needs JSX
|
|
223
|
+
// calls to disambiguate by props-arity, a JSX-aware arity
|
|
224
|
+
// synthesizer would need to count `jsx_attribute` children of the
|
|
225
|
+
// opening tag instead of `arguments`.
|
|
204
226
|
const callAnchor = pickFirstDefined(grouped, CALL_TAGS);
|
|
205
227
|
if (callAnchor !== undefined && grouped['@reference.arity'] === undefined) {
|
|
206
228
|
const callNode = findNodeAtRange(tree.rootNode, callAnchor.range, 'call_expression') ??
|
|
@@ -62,6 +62,13 @@ export declare function getTsParser(filePath?: string): Parser;
|
|
|
62
62
|
* executed against a Tree produced by the `tsx` grammar — tree-sitter
|
|
63
63
|
* matches by node-type id, and the two grammars have separate id
|
|
64
64
|
* spaces.
|
|
65
|
+
*
|
|
66
|
+
* The TSX query is compiled with the JSX-as-call patterns appended.
|
|
67
|
+
* Those patterns reference `jsx_self_closing_element` /
|
|
68
|
+
* `jsx_opening_element` which exist only in the TSX grammar — embedding
|
|
69
|
+
* them in the plain TS query would throw `Query.InvalidNodeType` at
|
|
70
|
+
* compile time (and even if it didn't, the patterns would never fire on
|
|
71
|
+
* `.ts` source).
|
|
65
72
|
*/
|
|
66
73
|
export declare function getTsScopeQuery(filePath?: string): Parser.Query;
|
|
67
74
|
/**
|
|
@@ -132,25 +132,83 @@ const TYPESCRIPT_SCOPE_QUERY = `
|
|
|
132
132
|
;; Arrow/function-expression assigned to a const/let/var — named by the
|
|
133
133
|
;; variable_declarator. Covers \`const fn = () => {}\` and its export
|
|
134
134
|
;; variant. Matches the legacy TYPESCRIPT_QUERIES pattern.
|
|
135
|
+
;;
|
|
136
|
+
;; The \`@declaration.function\` anchor sits on the INNER arrow_function /
|
|
137
|
+
;; function_expression node (NOT the wrapping lexical_declaration), so
|
|
138
|
+
;; \`anchor.range\` aligns with the corresponding \`@scope.function\` scope
|
|
139
|
+
;; range. \`pass2AttachDeclarations\` then resolves \`innermost\` to the
|
|
140
|
+
;; arrow's own scope (instead of the module scope) and the def is owned
|
|
141
|
+
;; by the arrow itself. Without this alignment, calls inside the arrow
|
|
142
|
+
;; body lose caller attribution: \`resolveCallerGraphId\` walks up past
|
|
143
|
+
;; the empty arrow scope into the module scope and grabs whichever
|
|
144
|
+
;; Function-like def appears first there — silently mis-attributing
|
|
145
|
+
;; every nested call (Zustand stores, TanStack hooks, Promise-all/map,
|
|
146
|
+
;; etc.). See \`typescript-hof-callbacks.test.ts\`.
|
|
135
147
|
(lexical_declaration
|
|
136
148
|
(variable_declarator
|
|
137
149
|
name: (identifier) @declaration.name
|
|
138
|
-
value: (arrow_function)
|
|
150
|
+
value: (arrow_function) @declaration.function))
|
|
139
151
|
|
|
140
152
|
(lexical_declaration
|
|
141
153
|
(variable_declarator
|
|
142
154
|
name: (identifier) @declaration.name
|
|
143
|
-
value: (function_expression)
|
|
155
|
+
value: (function_expression) @declaration.function))
|
|
144
156
|
|
|
145
157
|
(variable_declaration
|
|
146
158
|
(variable_declarator
|
|
147
159
|
name: (identifier) @declaration.name
|
|
148
|
-
value: (arrow_function)
|
|
160
|
+
value: (arrow_function) @declaration.function))
|
|
149
161
|
|
|
150
162
|
(variable_declaration
|
|
151
163
|
(variable_declarator
|
|
152
164
|
name: (identifier) @declaration.name
|
|
153
|
-
value: (function_expression)
|
|
165
|
+
value: (function_expression) @declaration.function))
|
|
166
|
+
|
|
167
|
+
;; Object-property arrows / function expressions named by their pair key:
|
|
168
|
+
;; \`{ addItem: (item) => ..., removeItem: (item) => ... }\`. The legacy
|
|
169
|
+
;; TYPESCRIPT_QUERIES emits the same shape; mirroring it here keeps
|
|
170
|
+
;; scope-resolution declarations in sync (issue #1166). Computed keys
|
|
171
|
+
;; (\`[K]: () => ...\`) intentionally fall through anonymous.
|
|
172
|
+
;;
|
|
173
|
+
;; Same anchor discipline as the \`lexical_declaration\` block above: the
|
|
174
|
+
;; \`@declaration.function\` capture must sit on the INNER \`arrow_function\`
|
|
175
|
+
;; / \`function_expression\` node — NOT the outer \`pair\`. The pair node
|
|
176
|
+
;; starts at the property-key token, BEFORE the arrow's
|
|
177
|
+
;; \`@scope.function\` range. \`pass2AttachDeclarations.atPosition(pair.startLine,
|
|
178
|
+
;; pair.startCol)\` therefore resolves to the PARENT scope (the enclosing
|
|
179
|
+
;; function-like, e.g. the \`(set) => ({...})\` callback in
|
|
180
|
+
;; \`persist((set) => ({...}))\`), not the inner arrow's own scope.
|
|
181
|
+
;;
|
|
182
|
+
;; With the anchor on \`pair\`, ALL pair-function defs from the same object
|
|
183
|
+
;; literal land in the same parent scope's \`ownedDefs\`. \`resolveCallerGraphId\`
|
|
184
|
+
;; walking up from a call inside any of those arrows then matches the
|
|
185
|
+
;; FIRST Function-like def via \`ownedDefs.find()\` — silently mis-attributing
|
|
186
|
+
;; every call to the first sibling. Multi-action Zustand stores
|
|
187
|
+
;; (\`{ addItem, removeItem, fetchData, … }\`) — the dominant 0%-capture
|
|
188
|
+
;; pattern in the bug report — would land all calls on \`addItem\`.
|
|
189
|
+
;;
|
|
190
|
+
;; With the anchor on the inner \`arrow_function\` / \`function_expression\`,
|
|
191
|
+
;; \`anchor.range\` matches the arrow's own \`@scope.function\` range; the
|
|
192
|
+
;; def lands in the arrow scope's own \`ownedDefs\` and \`pass2AttachDeclarations\`'s
|
|
193
|
+
;; auto-hoist (\`rangesEqual(anchor.range, innermost.range)\`) promotes
|
|
194
|
+
;; the BINDING to the parent scope (so importers and lookups still find
|
|
195
|
+
;; the name in the object's surrounding scope). Each pair-arrow becomes
|
|
196
|
+
;; an independent caller anchor in the walk.
|
|
197
|
+
(pair
|
|
198
|
+
key: (property_identifier) @declaration.name
|
|
199
|
+
value: (arrow_function) @declaration.function)
|
|
200
|
+
|
|
201
|
+
(pair
|
|
202
|
+
key: (property_identifier) @declaration.name
|
|
203
|
+
value: (function_expression) @declaration.function)
|
|
204
|
+
|
|
205
|
+
(pair
|
|
206
|
+
key: (string (string_fragment) @declaration.name)
|
|
207
|
+
value: (arrow_function) @declaration.function)
|
|
208
|
+
|
|
209
|
+
(pair
|
|
210
|
+
key: (string (string_fragment) @declaration.name)
|
|
211
|
+
value: (function_expression) @declaration.function)
|
|
154
212
|
|
|
155
213
|
;; Method definitions — regular + private (#field) methods.
|
|
156
214
|
(method_definition
|
|
@@ -718,6 +776,52 @@ const TYPESCRIPT_SCOPE_QUERY = `
|
|
|
718
776
|
object: (_) @reference.receiver
|
|
719
777
|
property: (property_identifier) @reference.name) @reference.read.member
|
|
720
778
|
`;
|
|
779
|
+
/**
|
|
780
|
+
* JSX-only query suffix. Appended to the base query when compiling
|
|
781
|
+
* against the TSX grammar; NOT compiled against the plain TS grammar
|
|
782
|
+
* (which has no \`jsx_*\` node types and would reject these patterns).
|
|
783
|
+
*
|
|
784
|
+
* Why JSX as a CALLS edge: \`<Foo />\` is syntactic sugar for \`Foo(props)\`
|
|
785
|
+
* and the React component is invoked by the renderer, so for blast-radius
|
|
786
|
+
* (\`gitnexus_impact("Badge", direction: "upstream")\`) and call-graph
|
|
787
|
+
* (\`gitnexus_context("Foo")\`) purposes JSX usage IS a call. Routing
|
|
788
|
+
* through \`@reference.call.free\` / \`@reference.call.member\` makes the
|
|
789
|
+
* downstream caller-walk + edge-emission paths handle JSX uniformly with
|
|
790
|
+
* ordinary call expressions — no new edge type, no schema changes.
|
|
791
|
+
*
|
|
792
|
+
* Identifier-only JSX is filtered to PascalCase via \`(#match? ... "^[A-Z]")\`
|
|
793
|
+
* so \`<div>\`, \`<span>\`, \`<button>\` and other native HTML elements (which
|
|
794
|
+
* by JSX convention start lowercase) don't emit edges to nonexistent
|
|
795
|
+
* "div" / "span" symbols. Member-form JSX (\`<Foo.Bar />\`) is always a
|
|
796
|
+
* component (HTML element names can't contain dots), so no predicate
|
|
797
|
+
* filter is applied there.
|
|
798
|
+
*
|
|
799
|
+
* Both \`jsx_self_closing_element\` (\`<Foo />\`) and \`jsx_opening_element\`
|
|
800
|
+
* (\`<Foo>...</Foo>\`) emit; the closing tag is intentionally NOT captured —
|
|
801
|
+
* each JSX element should emit exactly one CALLS edge per use site.
|
|
802
|
+
*/
|
|
803
|
+
const TSX_JSX_QUERY_SUFFIX = `
|
|
804
|
+
;; <Foo />
|
|
805
|
+
((jsx_self_closing_element
|
|
806
|
+
name: (identifier) @reference.name) @reference.call.free
|
|
807
|
+
(#match? @reference.name "^[A-Z]"))
|
|
808
|
+
|
|
809
|
+
;; <Foo> ... </Foo> (paired form — match the opening tag only)
|
|
810
|
+
((jsx_opening_element
|
|
811
|
+
name: (identifier) @reference.name) @reference.call.free
|
|
812
|
+
(#match? @reference.name "^[A-Z]"))
|
|
813
|
+
|
|
814
|
+
;; <Foo.Bar /> / <Container.Section.Title /> — namespaced JSX
|
|
815
|
+
(jsx_self_closing_element
|
|
816
|
+
name: (member_expression
|
|
817
|
+
object: (_) @reference.receiver
|
|
818
|
+
property: (property_identifier) @reference.name)) @reference.call.member
|
|
819
|
+
|
|
820
|
+
(jsx_opening_element
|
|
821
|
+
name: (member_expression
|
|
822
|
+
object: (_) @reference.receiver
|
|
823
|
+
property: (property_identifier) @reference.name)) @reference.call.member
|
|
824
|
+
`;
|
|
721
825
|
let _tsParser = null;
|
|
722
826
|
let _tsxParser = null;
|
|
723
827
|
let _tsQuery = null;
|
|
@@ -746,11 +850,18 @@ export function getTsParser(filePath) {
|
|
|
746
850
|
* executed against a Tree produced by the `tsx` grammar — tree-sitter
|
|
747
851
|
* matches by node-type id, and the two grammars have separate id
|
|
748
852
|
* spaces.
|
|
853
|
+
*
|
|
854
|
+
* The TSX query is compiled with the JSX-as-call patterns appended.
|
|
855
|
+
* Those patterns reference `jsx_self_closing_element` /
|
|
856
|
+
* `jsx_opening_element` which exist only in the TSX grammar — embedding
|
|
857
|
+
* them in the plain TS query would throw `Query.InvalidNodeType` at
|
|
858
|
+
* compile time (and even if it didn't, the patterns would never fire on
|
|
859
|
+
* `.ts` source).
|
|
749
860
|
*/
|
|
750
861
|
export function getTsScopeQuery(filePath) {
|
|
751
862
|
if (filePath !== undefined && isTsxFile(filePath)) {
|
|
752
863
|
if (_tsxQuery === null) {
|
|
753
|
-
_tsxQuery = new Parser.Query(TSX_GRAMMAR, TYPESCRIPT_SCOPE_QUERY);
|
|
864
|
+
_tsxQuery = new Parser.Query(TSX_GRAMMAR, TYPESCRIPT_SCOPE_QUERY + TSX_JSX_QUERY_SUFFIX);
|
|
754
865
|
}
|
|
755
866
|
return _tsxQuery;
|
|
756
867
|
}
|
|
@@ -28,26 +28,61 @@ import { typescriptCallConfig, javascriptCallConfig, } from '../call-extractors/
|
|
|
28
28
|
import { createHeritageExtractor } from '../heritage-extractors/generic.js';
|
|
29
29
|
import { emitTsScopeCaptures, interpretTsImport, interpretTsTypeBinding, tsBindingScopeFor, tsImportOwningScope, tsReceiverBinding, typescriptMergeBindings, typescriptArityCompatibility, resolveTsImportTarget, } from './typescript/index.js';
|
|
30
30
|
/**
|
|
31
|
-
* TypeScript/JavaScript: arrow_function and function_expression
|
|
32
|
-
*
|
|
31
|
+
* TypeScript/JavaScript: arrow_function and function_expression are
|
|
32
|
+
* anonymous AST nodes — they take their name from the surrounding
|
|
33
|
+
* declarative context.
|
|
34
|
+
*
|
|
35
|
+
* Recognised contexts:
|
|
36
|
+
* - `const foo = () => {}` (variable_declarator) → "foo"
|
|
37
|
+
* - `{ addItem: (item) => ... }` (pair / property_assignment) → "addItem"
|
|
38
|
+
* Covers Zustand stores, TanStack Query factories, React Context
|
|
39
|
+
* providers, and most other HOF-heavy idioms (issue #1166).
|
|
40
|
+
*
|
|
41
|
+
* Returns `null` for funcName when the arrow lives in a context that has
|
|
42
|
+
* no static name — call arguments, computed keys, return-from-arrow
|
|
43
|
+
* positions. The parent walk in findEnclosingFunctionId then continues
|
|
44
|
+
* up to the next named ancestor (or to the file).
|
|
33
45
|
*/
|
|
34
46
|
const tsExtractFunctionName = (node) => {
|
|
35
47
|
if (node.type !== 'arrow_function' && node.type !== 'function_expression')
|
|
36
48
|
return null;
|
|
37
49
|
const parent = node.parent;
|
|
38
|
-
if (parent
|
|
50
|
+
if (!parent)
|
|
39
51
|
return null;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
if (parent.type === 'variable_declarator') {
|
|
53
|
+
let nameNode = parent.childForFieldName?.('name');
|
|
54
|
+
if (!nameNode) {
|
|
55
|
+
for (let i = 0; i < parent.childCount; i++) {
|
|
56
|
+
const c = parent.child(i);
|
|
57
|
+
if (c?.type === 'identifier') {
|
|
58
|
+
nameNode = c;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
47
61
|
}
|
|
48
62
|
}
|
|
63
|
+
return { funcName: nameNode?.text ?? null, label: 'Function' };
|
|
64
|
+
}
|
|
65
|
+
// Object property pair: `{ addItem: (item) => ... }`.
|
|
66
|
+
// tree-sitter-typescript uses `pair`; tree-sitter-javascript also exposes
|
|
67
|
+
// `pair`. (Older grammars used `property_assignment`; we accept both.)
|
|
68
|
+
if (parent.type === 'pair' || parent.type === 'property_assignment') {
|
|
69
|
+
const keyNode = parent.childForFieldName?.('key');
|
|
70
|
+
if (!keyNode)
|
|
71
|
+
return { funcName: null, label: 'Function' };
|
|
72
|
+
if (keyNode.type === 'property_identifier' || keyNode.type === 'identifier') {
|
|
73
|
+
return { funcName: keyNode.text, label: 'Function' };
|
|
74
|
+
}
|
|
75
|
+
if (keyNode.type === 'string') {
|
|
76
|
+
// `"add-item": () => ...` — the literal text inside the quotes.
|
|
77
|
+
const fragment = keyNode.children?.find((c) => c.type === 'string_fragment');
|
|
78
|
+
const text = fragment?.text ?? null;
|
|
79
|
+
return { funcName: text, label: 'Function' };
|
|
80
|
+
}
|
|
81
|
+
// computed_property_name (`[ACTION_KEY]`) and other dynamic keys have
|
|
82
|
+
// no static name — fall through anonymous.
|
|
83
|
+
return { funcName: null, label: 'Function' };
|
|
49
84
|
}
|
|
50
|
-
return { funcName:
|
|
85
|
+
return { funcName: null, label: 'Function' };
|
|
51
86
|
};
|
|
52
87
|
export const BUILT_INS = new Set([
|
|
53
88
|
'console',
|
|
@@ -17,7 +17,35 @@
|
|
|
17
17
|
* migrate.
|
|
18
18
|
*/
|
|
19
19
|
import { generateId } from '../../../../lib/utils.js';
|
|
20
|
-
import {
|
|
20
|
+
import { qualifiedKey, simpleKey } from '../graph-bridge/node-lookup.js';
|
|
21
|
+
/**
|
|
22
|
+
* Labels that may legitimately ANCHOR a CALLS/ACCESSES edge as the
|
|
23
|
+
* source ("caller"). A Variable / Property can be the TARGET of an
|
|
24
|
+
* edge (e.g., a write-access to `user.name`), but it cannot be a
|
|
25
|
+
* caller — variables don't execute code, so attributing a call to a
|
|
26
|
+
* sibling Variable in the same scope produces nonsense edges like
|
|
27
|
+
* `Variable:create → Function:create` (which the simpleKey fallback
|
|
28
|
+
* in `resolveDefGraphId` then silently rewrites to
|
|
29
|
+
* `Function:create → Function:create`, a self-loop that doesn't exist
|
|
30
|
+
* in the source).
|
|
31
|
+
*
|
|
32
|
+
* Module-level call expressions inside a `const X = expr(args)`
|
|
33
|
+
* declaration are the canonical case where this used to fail: the
|
|
34
|
+
* walk-up over module scope's ownedDefs (only Variables) would land
|
|
35
|
+
* on the FIRST Variable, get name-aliased to its sibling Function
|
|
36
|
+
* with the same simple name, and emit a self-CALLS. With this label
|
|
37
|
+
* restricted to function/class-likes, those calls correctly fall
|
|
38
|
+
* through to the File-node fallback at the bottom of the walk.
|
|
39
|
+
*/
|
|
40
|
+
function isCallerAnchorLabel(label) {
|
|
41
|
+
return (label === 'Function' ||
|
|
42
|
+
label === 'Method' ||
|
|
43
|
+
label === 'Constructor' ||
|
|
44
|
+
label === 'Class' ||
|
|
45
|
+
label === 'Interface' ||
|
|
46
|
+
label === 'Struct' ||
|
|
47
|
+
label === 'Enum');
|
|
48
|
+
}
|
|
21
49
|
/**
|
|
22
50
|
* Look up a `SymbolDefinition` in the graph node lookup.
|
|
23
51
|
*
|
|
@@ -89,14 +117,16 @@ export function resolveCallerGraphId(startScope, scopes, nodeLookup) {
|
|
|
89
117
|
if (scope === undefined)
|
|
90
118
|
break;
|
|
91
119
|
lastFilePath = scope.filePath;
|
|
92
|
-
// Prefer Function/Method anchors; fall back to
|
|
120
|
+
// Prefer Function/Method/Constructor anchors; fall back to
|
|
121
|
+
// Class/Interface/Struct/Enum. Variable/Property are NOT valid
|
|
122
|
+
// caller anchors — see `isCallerAnchorLabel` for why.
|
|
93
123
|
const fnDef = scope.ownedDefs.find((d) => d.type === 'Function' || d.type === 'Method' || d.type === 'Constructor');
|
|
94
124
|
if (fnDef !== undefined) {
|
|
95
125
|
const id = resolveDefGraphId(scope.filePath, fnDef, nodeLookup);
|
|
96
126
|
if (id !== undefined)
|
|
97
127
|
return id;
|
|
98
128
|
}
|
|
99
|
-
const classDef = scope.ownedDefs.find((d) =>
|
|
129
|
+
const classDef = scope.ownedDefs.find((d) => isCallerAnchorLabel(d.type));
|
|
100
130
|
if (classDef !== undefined) {
|
|
101
131
|
const id = resolveDefGraphId(scope.filePath, classDef, nodeLookup);
|
|
102
132
|
if (id !== undefined)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const TYPESCRIPT_QUERIES = "\n(class_declaration\n name: (type_identifier) @name) @definition.class\n\n(abstract_class_declaration\n name: (type_identifier) @name) @definition.class\n\n(interface_declaration\n name: (type_identifier) @name) @definition.interface\n\n(function_declaration\n name: (identifier) @name) @definition.function\n\n; TypeScript overload signatures (function_signature is a separate node type from function_declaration)\n(function_signature\n name: (identifier) @name) @definition.function\n\n(method_definition\n name: (property_identifier) @name) @definition.method\n\n; ES2022 #private methods (private_property_identifier not matched by property_identifier)\n(method_definition\n name: (private_property_identifier) @name) @definition.method\n\n; Abstract method signatures in abstract classes\n(abstract_method_signature\n name: (property_identifier) @name) @definition.method\n\n; Interface method signatures\n(method_signature\n name: (property_identifier) @name) @definition.method\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function))) @definition.function\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function)))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression)))) @definition.function\n\n; Variable/constant declarations (non-function values).\n; Overlap with @definition.function patterns is handled by parse-worker dedup.\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name)) @definition.const\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name))) @definition.const\n\n; var declarations (mutable, function-scoped)\n(variable_declaration\n (variable_declarator\n name: (identifier) @name)) @definition.variable\n\n(import_statement\n source: (string) @import.source) @import\n\n; Re-export statements: export { X } from './y'\n(export_statement\n source: (string) @import.source) @import\n\n(call_expression\n function: (identifier) @call.name) @call\n\n(call_expression\n function: (member_expression\n property: (property_identifier) @call.name)) @call\n\n; Generic awaited free call: await fn<T>(args)\n; tree-sitter-typescript parses \"await fn<T>(args)\" as a call_expression whose\n; \"function\" field is an await_expression (not a bare identifier), because the\n; grammar resolves the ambiguity between generics and comparisons by consuming\n; \"await fn\" as an expression before attaching <T> as type_arguments.\n(call_expression\n function: (await_expression\n (identifier) @call.name)\n (type_arguments)) @call\n\n; Generic awaited member call: await obj.fn<T>(args)\n(call_expression\n function: (await_expression\n (member_expression\n property: (property_identifier) @call.name))\n (type_arguments)) @call\n\n; Constructor calls: new Foo()\n(new_expression\n constructor: (identifier) @call.name) @call\n\n; Class properties \u2014 public_field_definition covers most TS class fields\n(public_field_definition\n name: (property_identifier) @name) @definition.property\n\n; Private class fields: #address: Address\n(public_field_definition\n name: (private_property_identifier) @name) @definition.property\n\n; Constructor parameter properties: constructor(public address: Address)\n(required_parameter\n (accessibility_modifier)\n pattern: (identifier) @name) @definition.property\n\n; Heritage queries - class extends\n(class_declaration\n name: (type_identifier) @heritage.class\n (class_heritage\n (extends_clause\n value: (identifier) @heritage.extends))) @heritage\n\n; Heritage queries - class implements interface\n(class_declaration\n name: (type_identifier) @heritage.class\n (class_heritage\n (implements_clause\n (type_identifier) @heritage.implements))) @heritage.impl\n\n; Write access: obj.field = value\n(assignment_expression\n left: (member_expression\n object: (_) @assignment.receiver\n property: (property_identifier) @assignment.property)\n right: (_)) @assignment\n\n; Write access: obj.field += value (compound assignment)\n(augmented_assignment_expression\n left: (member_expression\n object: (_) @assignment.receiver\n property: (property_identifier) @assignment.property)\n right: (_)) @assignment\n\n; HTTP consumers: fetch('/path'), axios.get('/path'), $.get('/path'), etc.\n; fetch() \u2014 global function\n(call_expression\n function: (identifier) @_fetch_fn (#eq? @_fetch_fn \"fetch\")\n arguments: (arguments\n [(string (string_fragment) @route.url)\n (template_string) @route.template_url])) @route.fetch\n\n; axios.get/post/put/delete/patch('/path'), $.get/post/ajax({url:'/path'})\n(call_expression\n function: (member_expression\n property: (property_identifier) @http_client.method)\n arguments: (arguments\n (string (string_fragment) @http_client.url))) @http_client\n\n; Decorators: @Controller, @Get, @Post, etc.\n(decorator\n (call_expression\n function: (identifier) @decorator.name\n arguments: (arguments (string (string_fragment) @decorator.arg)?))) @decorator\n\n; Express/Hono route registration: app.get('/path', handler), router.post('/path', fn)\n(call_expression\n function: (member_expression\n property: (property_identifier) @express_route.method)\n arguments: (arguments\n (string (string_fragment) @express_route.path))) @express_route\n";
|
|
2
|
-
export declare const JAVASCRIPT_QUERIES = "\n(class_declaration\n name: (identifier) @name) @definition.class\n\n(function_declaration\n name: (identifier) @name) @definition.function\n\n(method_definition\n name: (property_identifier) @name) @definition.method\n\n; ES2022 #private methods\n(method_definition\n name: (private_property_identifier) @name) @definition.method\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function))) @definition.function\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function)))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression)))) @definition.function\n\n; Variable/constant declarations (non-function values).\n; Overlap with @definition.function patterns is handled by parse-worker dedup.\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name)) @definition.const\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name))) @definition.const\n\n; var declarations (mutable, function-scoped)\n(variable_declaration\n (variable_declarator\n name: (identifier) @name)) @definition.variable\n\n(import_statement\n source: (string) @import.source) @import\n\n; Re-export statements: export { X } from './y'\n(export_statement\n source: (string) @import.source) @import\n\n(call_expression\n function: (identifier) @call.name) @call\n\n(call_expression\n function: (member_expression\n property: (property_identifier) @call.name)) @call\n\n; Constructor calls: new Foo()\n(new_expression\n constructor: (identifier) @call.name) @call\n\n; Class fields \u2014 field_definition captures JS class fields (class User { address = ... })\n(field_definition\n property: (property_identifier) @name) @definition.property\n\n; Heritage queries - class extends (JavaScript uses different AST than TypeScript)\n; In tree-sitter-javascript, class_heritage directly contains the parent identifier\n(class_declaration\n name: (identifier) @heritage.class\n (class_heritage\n (identifier) @heritage.extends)) @heritage\n\n; Write access: obj.field = value\n(assignment_expression\n left: (member_expression\n object: (_) @assignment.receiver\n property: (property_identifier) @assignment.property)\n right: (_)) @assignment\n\n; Write access: obj.field += value (compound assignment)\n(augmented_assignment_expression\n left: (member_expression\n object: (_) @assignment.receiver\n property: (property_identifier) @assignment.property)\n right: (_)) @assignment\n\n; HTTP consumers: fetch('/path'), axios.get('/path'), $.get('/path'), etc.\n(call_expression\n function: (identifier) @_fetch_fn (#eq? @_fetch_fn \"fetch\")\n arguments: (arguments\n [(string (string_fragment) @route.url)\n (template_string) @route.template_url])) @route.fetch\n\n; axios.get/post, $.get/post/ajax\n(call_expression\n function: (member_expression\n property: (property_identifier) @http_client.method)\n arguments: (arguments\n (string (string_fragment) @http_client.url))) @http_client\n\n; Express/Hono route registration\n(call_expression\n function: (member_expression\n property: (property_identifier) @express_route.method)\n arguments: (arguments\n (string (string_fragment) @express_route.path))) @express_route\n";
|
|
1
|
+
export declare const TYPESCRIPT_QUERIES = "\n(class_declaration\n name: (type_identifier) @name) @definition.class\n\n(abstract_class_declaration\n name: (type_identifier) @name) @definition.class\n\n(interface_declaration\n name: (type_identifier) @name) @definition.interface\n\n(function_declaration\n name: (identifier) @name) @definition.function\n\n; TypeScript overload signatures (function_signature is a separate node type from function_declaration)\n(function_signature\n name: (identifier) @name) @definition.function\n\n(method_definition\n name: (property_identifier) @name) @definition.method\n\n; ES2022 #private methods (private_property_identifier not matched by property_identifier)\n(method_definition\n name: (private_property_identifier) @name) @definition.method\n\n; Abstract method signatures in abstract classes\n(abstract_method_signature\n name: (property_identifier) @name) @definition.method\n\n; Interface method signatures\n(method_signature\n name: (property_identifier) @name) @definition.method\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function))) @definition.function\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function)))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression)))) @definition.function\n\n; Object-property arrows / function expressions: `{ addItem: () => ... }`.\n; The pair's key field carries the meaningful name. Without these patterns,\n; calls inside the arrow are attributed to the file (issue #1166), and the\n; arrow itself is invisible to context() / impact() despite carrying real\n; behaviour (Zustand actions, TanStack queryFn, React Context providers).\n; String-key variant covers `\"add-item\": () => ...`; computed keys\n; (`[K]: () => ...`) intentionally fall through anonymous.\n(pair\n key: (property_identifier) @name\n value: (arrow_function)) @definition.function\n\n(pair\n key: (property_identifier) @name\n value: (function_expression)) @definition.function\n\n(pair\n key: (string (string_fragment) @name)\n value: (arrow_function)) @definition.function\n\n(pair\n key: (string (string_fragment) @name)\n value: (function_expression)) @definition.function\n\n; Variable/constant declarations (non-function values).\n; Overlap with @definition.function patterns is handled by parse-worker dedup.\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name)) @definition.const\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name))) @definition.const\n\n; var declarations (mutable, function-scoped)\n(variable_declaration\n (variable_declarator\n name: (identifier) @name)) @definition.variable\n\n(import_statement\n source: (string) @import.source) @import\n\n; Re-export statements: export { X } from './y'\n(export_statement\n source: (string) @import.source) @import\n\n(call_expression\n function: (identifier) @call.name) @call\n\n(call_expression\n function: (member_expression\n property: (property_identifier) @call.name)) @call\n\n; Generic awaited free call: await fn<T>(args)\n; tree-sitter-typescript parses \"await fn<T>(args)\" as a call_expression whose\n; \"function\" field is an await_expression (not a bare identifier), because the\n; grammar resolves the ambiguity between generics and comparisons by consuming\n; \"await fn\" as an expression before attaching <T> as type_arguments.\n(call_expression\n function: (await_expression\n (identifier) @call.name)\n (type_arguments)) @call\n\n; Generic awaited member call: await obj.fn<T>(args)\n(call_expression\n function: (await_expression\n (member_expression\n property: (property_identifier) @call.name))\n (type_arguments)) @call\n\n; Constructor calls: new Foo()\n(new_expression\n constructor: (identifier) @call.name) @call\n\n; Class properties \u2014 public_field_definition covers most TS class fields\n(public_field_definition\n name: (property_identifier) @name) @definition.property\n\n; Private class fields: #address: Address\n(public_field_definition\n name: (private_property_identifier) @name) @definition.property\n\n; Constructor parameter properties: constructor(public address: Address)\n(required_parameter\n (accessibility_modifier)\n pattern: (identifier) @name) @definition.property\n\n; Heritage queries - class extends\n(class_declaration\n name: (type_identifier) @heritage.class\n (class_heritage\n (extends_clause\n value: (identifier) @heritage.extends))) @heritage\n\n; Heritage queries - class implements interface\n(class_declaration\n name: (type_identifier) @heritage.class\n (class_heritage\n (implements_clause\n (type_identifier) @heritage.implements))) @heritage.impl\n\n; Write access: obj.field = value\n(assignment_expression\n left: (member_expression\n object: (_) @assignment.receiver\n property: (property_identifier) @assignment.property)\n right: (_)) @assignment\n\n; Write access: obj.field += value (compound assignment)\n(augmented_assignment_expression\n left: (member_expression\n object: (_) @assignment.receiver\n property: (property_identifier) @assignment.property)\n right: (_)) @assignment\n\n; HTTP consumers: fetch('/path'), axios.get('/path'), $.get('/path'), etc.\n; fetch() \u2014 global function\n(call_expression\n function: (identifier) @_fetch_fn (#eq? @_fetch_fn \"fetch\")\n arguments: (arguments\n [(string (string_fragment) @route.url)\n (template_string) @route.template_url])) @route.fetch\n\n; axios.get/post/put/delete/patch('/path'), $.get/post/ajax({url:'/path'})\n(call_expression\n function: (member_expression\n property: (property_identifier) @http_client.method)\n arguments: (arguments\n (string (string_fragment) @http_client.url))) @http_client\n\n; Decorators: @Controller, @Get, @Post, etc.\n(decorator\n (call_expression\n function: (identifier) @decorator.name\n arguments: (arguments (string (string_fragment) @decorator.arg)?))) @decorator\n\n; Express/Hono route registration: app.get('/path', handler), router.post('/path', fn)\n(call_expression\n function: (member_expression\n property: (property_identifier) @express_route.method)\n arguments: (arguments\n (string (string_fragment) @express_route.path))) @express_route\n";
|
|
2
|
+
export declare const JAVASCRIPT_QUERIES = "\n(class_declaration\n name: (identifier) @name) @definition.class\n\n(function_declaration\n name: (identifier) @name) @definition.function\n\n(method_definition\n name: (property_identifier) @name) @definition.method\n\n; ES2022 #private methods\n(method_definition\n name: (private_property_identifier) @name) @definition.method\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function))) @definition.function\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function)))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression)))) @definition.function\n\n; Object-property arrows / function expressions: `{ addItem: () => ... }`.\n; See TYPESCRIPT_QUERIES for rationale (issue #1166).\n(pair\n key: (property_identifier) @name\n value: (arrow_function)) @definition.function\n\n(pair\n key: (property_identifier) @name\n value: (function_expression)) @definition.function\n\n(pair\n key: (string (string_fragment) @name)\n value: (arrow_function)) @definition.function\n\n(pair\n key: (string (string_fragment) @name)\n value: (function_expression)) @definition.function\n\n; Variable/constant declarations (non-function values).\n; Overlap with @definition.function patterns is handled by parse-worker dedup.\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name)) @definition.const\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name))) @definition.const\n\n; var declarations (mutable, function-scoped)\n(variable_declaration\n (variable_declarator\n name: (identifier) @name)) @definition.variable\n\n(import_statement\n source: (string) @import.source) @import\n\n; Re-export statements: export { X } from './y'\n(export_statement\n source: (string) @import.source) @import\n\n(call_expression\n function: (identifier) @call.name) @call\n\n(call_expression\n function: (member_expression\n property: (property_identifier) @call.name)) @call\n\n; Constructor calls: new Foo()\n(new_expression\n constructor: (identifier) @call.name) @call\n\n; Class fields \u2014 field_definition captures JS class fields (class User { address = ... })\n(field_definition\n property: (property_identifier) @name) @definition.property\n\n; Heritage queries - class extends (JavaScript uses different AST than TypeScript)\n; In tree-sitter-javascript, class_heritage directly contains the parent identifier\n(class_declaration\n name: (identifier) @heritage.class\n (class_heritage\n (identifier) @heritage.extends)) @heritage\n\n; Write access: obj.field = value\n(assignment_expression\n left: (member_expression\n object: (_) @assignment.receiver\n property: (property_identifier) @assignment.property)\n right: (_)) @assignment\n\n; Write access: obj.field += value (compound assignment)\n(augmented_assignment_expression\n left: (member_expression\n object: (_) @assignment.receiver\n property: (property_identifier) @assignment.property)\n right: (_)) @assignment\n\n; HTTP consumers: fetch('/path'), axios.get('/path'), $.get('/path'), etc.\n(call_expression\n function: (identifier) @_fetch_fn (#eq? @_fetch_fn \"fetch\")\n arguments: (arguments\n [(string (string_fragment) @route.url)\n (template_string) @route.template_url])) @route.fetch\n\n; axios.get/post, $.get/post/ajax\n(call_expression\n function: (member_expression\n property: (property_identifier) @http_client.method)\n arguments: (arguments\n (string (string_fragment) @http_client.url))) @http_client\n\n; Express/Hono route registration\n(call_expression\n function: (member_expression\n property: (property_identifier) @express_route.method)\n arguments: (arguments\n (string (string_fragment) @express_route.path))) @express_route\n";
|
|
3
3
|
export declare const PYTHON_QUERIES = "\n(class_definition\n name: (identifier) @name) @definition.class\n\n(function_definition\n name: (identifier) @name) @definition.function\n\n(import_statement\n name: (dotted_name) @import.source) @import\n\n; import numpy as np \u2192 aliased_import captures the module name so the\n; import path is resolved and named-binding extraction stores \"np\" \u2192 \"numpy\".\n(import_statement\n name: (aliased_import\n name: (dotted_name) @import.source)) @import\n\n(import_from_statement\n module_name: (dotted_name) @import.source) @import\n\n(import_from_statement\n module_name: (relative_import) @import.source) @import\n\n(call\n function: (identifier) @call.name) @call\n\n(call\n function: (attribute\n attribute: (identifier) @call.name)) @call\n\n; Class attribute type annotations \u2014 PEP 526: address: Address or address: Address = Address()\n; Both bare annotations (address: Address) and annotated assignments (name: str = \"test\")\n; are parsed as (assignment left: ... type: ...) in tree-sitter-python.\n(expression_statement\n (assignment\n left: (identifier) @name\n type: (type)) @definition.property)\n\n; Plain variable assignments without type annotation: x = 5, MAX_SIZE = 100\n; Overlap with @definition.property (typed) is handled by parse-worker dedup.\n(expression_statement\n (assignment\n left: (identifier) @name)) @definition.variable\n\n; Heritage queries - Python class inheritance\n(class_definition\n name: (identifier) @heritage.class\n superclasses: (argument_list\n (identifier) @heritage.extends)) @heritage\n\n; Write access: obj.field = value\n(assignment\n left: (attribute\n object: (_) @assignment.receiver\n attribute: (identifier) @assignment.property)\n right: (_)) @assignment\n\n; Write access: obj.field += value (compound assignment)\n(augmented_assignment\n left: (attribute\n object: (_) @assignment.receiver\n attribute: (identifier) @assignment.property)\n right: (_)) @assignment\n\n; Python HTTP clients: requests.get('/path'), httpx.post('/path'), session.get('/path')\n(call\n function: (attribute\n attribute: (identifier) @http_client.method)\n arguments: (argument_list\n (string (string_content) @http_client.url))) @http_client\n\n; Python decorators: @app.route, @router.get, etc.\n(decorator\n (call\n function: (attribute\n object: (identifier) @decorator.receiver\n attribute: (identifier) @decorator.name)\n arguments: (argument_list\n (string (string_content) @decorator.arg)?))) @decorator\n";
|
|
4
4
|
export declare const JAVA_QUERIES = "\n; Classes, Interfaces, Enums, Annotations\n(class_declaration name: (identifier) @name) @definition.class\n(interface_declaration name: (identifier) @name) @definition.interface\n(enum_declaration name: (identifier) @name) @definition.enum\n(annotation_type_declaration name: (identifier) @name) @definition.annotation\n\n; Methods & Constructors\n(method_declaration name: (identifier) @name) @definition.method\n(constructor_declaration name: (identifier) @name) @definition.constructor\n\n; Fields \u2014 typed field declarations inside class bodies\n(field_declaration\n declarator: (variable_declarator\n name: (identifier) @name)) @definition.property\n\n; Imports - capture any import declaration child as source\n(import_declaration (_) @import.source) @import\n\n; Calls\n(method_invocation name: (identifier) @call.name) @call\n(method_invocation object: (_) name: (identifier) @call.name) @call\n(method_reference) @call\n\n; Constructor calls: new Foo()\n(object_creation_expression type: (type_identifier) @call.name) @call\n\n; Local variable declarations inside method bodies\n(local_variable_declaration\n declarator: (variable_declarator\n name: (identifier) @name)) @definition.variable\n\n; Heritage - extends class\n(class_declaration name: (identifier) @heritage.class\n (superclass (type_identifier) @heritage.extends)) @heritage\n\n; Heritage - implements interfaces\n(class_declaration name: (identifier) @heritage.class\n (super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl\n\n; Write access: obj.field = value\n(assignment_expression\n left: (field_access\n object: (_) @assignment.receiver\n field: (identifier) @assignment.property)\n right: (_)) @assignment\n";
|
|
5
5
|
export declare const C_QUERIES = "\n; Functions (direct declarator)\n(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n\n; Functions returning pointers (pointer_declarator wraps function_declarator)\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n\n; Functions returning double pointers (nested pointer_declarator)\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function\n\n; Structs, Unions, Enums, Typedefs\n(struct_specifier name: (type_identifier) @name) @definition.struct\n(union_specifier name: (type_identifier) @name) @definition.union\n(enum_specifier name: (type_identifier) @name) @definition.enum\n(type_definition declarator: (type_identifier) @name) @definition.typedef\n\n; Macros\n(preproc_function_def name: (identifier) @name) @definition.macro\n(preproc_def name: (identifier) @name) @definition.macro\n\n; Includes\n(preproc_include path: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n\n; Variable declarations: int x = 5; or int x;\n(declaration\n declarator: (init_declarator\n declarator: (identifier) @name)) @definition.variable\n";
|
|
@@ -60,6 +60,29 @@ export const TYPESCRIPT_QUERIES = `
|
|
|
60
60
|
name: (identifier) @name
|
|
61
61
|
value: (function_expression)))) @definition.function
|
|
62
62
|
|
|
63
|
+
; Object-property arrows / function expressions: \`{ addItem: () => ... }\`.
|
|
64
|
+
; The pair's key field carries the meaningful name. Without these patterns,
|
|
65
|
+
; calls inside the arrow are attributed to the file (issue #1166), and the
|
|
66
|
+
; arrow itself is invisible to context() / impact() despite carrying real
|
|
67
|
+
; behaviour (Zustand actions, TanStack queryFn, React Context providers).
|
|
68
|
+
; String-key variant covers \`"add-item": () => ...\`; computed keys
|
|
69
|
+
; (\`[K]: () => ...\`) intentionally fall through anonymous.
|
|
70
|
+
(pair
|
|
71
|
+
key: (property_identifier) @name
|
|
72
|
+
value: (arrow_function)) @definition.function
|
|
73
|
+
|
|
74
|
+
(pair
|
|
75
|
+
key: (property_identifier) @name
|
|
76
|
+
value: (function_expression)) @definition.function
|
|
77
|
+
|
|
78
|
+
(pair
|
|
79
|
+
key: (string (string_fragment) @name)
|
|
80
|
+
value: (arrow_function)) @definition.function
|
|
81
|
+
|
|
82
|
+
(pair
|
|
83
|
+
key: (string (string_fragment) @name)
|
|
84
|
+
value: (function_expression)) @definition.function
|
|
85
|
+
|
|
63
86
|
; Variable/constant declarations (non-function values).
|
|
64
87
|
; Overlap with @definition.function patterns is handled by parse-worker dedup.
|
|
65
88
|
(lexical_declaration
|
|
@@ -217,6 +240,24 @@ export const JAVASCRIPT_QUERIES = `
|
|
|
217
240
|
name: (identifier) @name
|
|
218
241
|
value: (function_expression)))) @definition.function
|
|
219
242
|
|
|
243
|
+
; Object-property arrows / function expressions: \`{ addItem: () => ... }\`.
|
|
244
|
+
; See TYPESCRIPT_QUERIES for rationale (issue #1166).
|
|
245
|
+
(pair
|
|
246
|
+
key: (property_identifier) @name
|
|
247
|
+
value: (arrow_function)) @definition.function
|
|
248
|
+
|
|
249
|
+
(pair
|
|
250
|
+
key: (property_identifier) @name
|
|
251
|
+
value: (function_expression)) @definition.function
|
|
252
|
+
|
|
253
|
+
(pair
|
|
254
|
+
key: (string (string_fragment) @name)
|
|
255
|
+
value: (arrow_function)) @definition.function
|
|
256
|
+
|
|
257
|
+
(pair
|
|
258
|
+
key: (string (string_fragment) @name)
|
|
259
|
+
value: (function_expression)) @definition.function
|
|
260
|
+
|
|
220
261
|
; Variable/constant declarations (non-function values).
|
|
221
262
|
; Overlap with @definition.function patterns is handled by parse-worker dedup.
|
|
222
263
|
(lexical_declaration
|
|
@@ -55,7 +55,18 @@ export declare const findEnclosingClassId: (node: SyntaxNode, filePath: string)
|
|
|
55
55
|
export declare const findSiblingChild: (parent: SyntaxNode, siblingType: string, childType: string) => SyntaxNode | null;
|
|
56
56
|
/** Generic name extraction from a function-like AST node.
|
|
57
57
|
* Tries `node.childForFieldName('name')?.text`, then scans children for
|
|
58
|
-
* `identifier` / `property_identifier` / `simple_identifier`.
|
|
58
|
+
* `identifier` / `property_identifier` / `simple_identifier`.
|
|
59
|
+
*
|
|
60
|
+
* `arrow_function` and `function_expression` (TS/JS) are inherently
|
|
61
|
+
* anonymous — they have no `name` field, and their first identifier
|
|
62
|
+
* child is a *parameter*, not a function name. Returning a parameter
|
|
63
|
+
* identifier here would synthesize phantom Function IDs (e.g. callers
|
|
64
|
+
* walking up from a call inside `arr.map(x => fn(x))` would get
|
|
65
|
+
* attributed to a non-existent "Function x"). The language's
|
|
66
|
+
* `methodExtractor.extractFunctionName` hook is responsible for naming
|
|
67
|
+
* these via parent context (variable_declarator, pair, etc.); when it
|
|
68
|
+
* declines, the parent walk should continue rather than fall through
|
|
69
|
+
* here. See issue #1166. */
|
|
59
70
|
export declare const genericFuncName: (node: SyntaxNode) => string | null;
|
|
60
71
|
/** AST node types that represent a method definition (for `inferFunctionLabel`). */
|
|
61
72
|
export declare const METHOD_LABEL_NODE_TYPES: Set<string>;
|
|
@@ -403,11 +403,25 @@ export const findSiblingChild = (parent, siblingType, childType) => {
|
|
|
403
403
|
};
|
|
404
404
|
/** Generic name extraction from a function-like AST node.
|
|
405
405
|
* Tries `node.childForFieldName('name')?.text`, then scans children for
|
|
406
|
-
* `identifier` / `property_identifier` / `simple_identifier`.
|
|
406
|
+
* `identifier` / `property_identifier` / `simple_identifier`.
|
|
407
|
+
*
|
|
408
|
+
* `arrow_function` and `function_expression` (TS/JS) are inherently
|
|
409
|
+
* anonymous — they have no `name` field, and their first identifier
|
|
410
|
+
* child is a *parameter*, not a function name. Returning a parameter
|
|
411
|
+
* identifier here would synthesize phantom Function IDs (e.g. callers
|
|
412
|
+
* walking up from a call inside `arr.map(x => fn(x))` would get
|
|
413
|
+
* attributed to a non-existent "Function x"). The language's
|
|
414
|
+
* `methodExtractor.extractFunctionName` hook is responsible for naming
|
|
415
|
+
* these via parent context (variable_declarator, pair, etc.); when it
|
|
416
|
+
* declines, the parent walk should continue rather than fall through
|
|
417
|
+
* here. See issue #1166. */
|
|
407
418
|
export const genericFuncName = (node) => {
|
|
408
419
|
const nameField = node.childForFieldName?.('name');
|
|
409
420
|
if (nameField)
|
|
410
421
|
return nameField.text;
|
|
422
|
+
if (node.type === 'arrow_function' || node.type === 'function_expression') {
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
411
425
|
for (let i = 0; i < node.childCount; i++) {
|
|
412
426
|
const c = node.child(i);
|
|
413
427
|
if (c?.type === 'identifier' ||
|
|
@@ -73,6 +73,13 @@ export declare class LocalBackend {
|
|
|
73
73
|
* making MCP stderr unreadable.
|
|
74
74
|
*/
|
|
75
75
|
private warnedSiblingDrift;
|
|
76
|
+
/**
|
|
77
|
+
* One-shot stderr warning for the VECTOR-extension fallback. Without this
|
|
78
|
+
* guard the diagnostic would fire on every `semanticSearch()` call on
|
|
79
|
+
* platforms where the extension is unsupported (e.g. Windows), making MCP
|
|
80
|
+
* stderr noisy per DoD §2.8.
|
|
81
|
+
*/
|
|
82
|
+
private warnedVectorUnsupported;
|
|
76
83
|
/**
|
|
77
84
|
* Cross-repo group tools (CLI). Shares logic with MCP `group_*` handlers.
|
|
78
85
|
*/
|
|
@@ -20,7 +20,7 @@ import { resolveAtGroupMemberRepoPath } from '../../core/group/resolve-at-member
|
|
|
20
20
|
import { collectBestChunks } from '../../core/embeddings/types.js';
|
|
21
21
|
import { rankExactEmbeddingRows, } from '../../core/embeddings/exact-search.js';
|
|
22
22
|
import { EMBEDDING_TABLE_NAME, EMBEDDING_INDEX_NAME } from '../../core/lbug/schema.js';
|
|
23
|
-
import { getExactScanLimit } from '../../core/platform/capabilities.js';
|
|
23
|
+
import { getExactScanLimit, isVectorExtensionSupportedByPlatform, } from '../../core/platform/capabilities.js';
|
|
24
24
|
import { PhaseTimer } from '../../core/search/phase-timer.js';
|
|
25
25
|
import { checkStaleness, checkCwdMatch } from '../../core/git-staleness.js';
|
|
26
26
|
// AI context generation is CLI-only (gitnexus analyze)
|
|
@@ -172,6 +172,13 @@ export class LocalBackend {
|
|
|
172
172
|
* making MCP stderr unreadable.
|
|
173
173
|
*/
|
|
174
174
|
warnedSiblingDrift = new Set();
|
|
175
|
+
/**
|
|
176
|
+
* One-shot stderr warning for the VECTOR-extension fallback. Without this
|
|
177
|
+
* guard the diagnostic would fire on every `semanticSearch()` call on
|
|
178
|
+
* platforms where the extension is unsupported (e.g. Windows), making MCP
|
|
179
|
+
* stderr noisy per DoD §2.8.
|
|
180
|
+
*/
|
|
181
|
+
warnedVectorUnsupported = false;
|
|
175
182
|
/**
|
|
176
183
|
* Cross-repo group tools (CLI). Shares logic with MCP `group_*` handlers.
|
|
177
184
|
*/
|
|
@@ -892,9 +899,10 @@ export class LocalBackend {
|
|
|
892
899
|
const dims = getEmbeddingDims();
|
|
893
900
|
const queryVecStr = `[${queryVec.join(',')}]`;
|
|
894
901
|
let bestChunks = new Map();
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
902
|
+
if (isVectorExtensionSupportedByPlatform()) {
|
|
903
|
+
try {
|
|
904
|
+
bestChunks = await collectBestChunks(limit, async (fetchLimit) => {
|
|
905
|
+
const vectorQuery = `
|
|
898
906
|
CALL QUERY_VECTOR_INDEX('${EMBEDDING_TABLE_NAME}', '${EMBEDDING_INDEX_NAME}',
|
|
899
907
|
CAST(${queryVecStr} AS FLOAT[${dims}]), ${fetchLimit})
|
|
900
908
|
YIELD node AS emb, distance
|
|
@@ -904,18 +912,28 @@ export class LocalBackend {
|
|
|
904
912
|
emb.startLine AS startLine, emb.endLine AS endLine, distance
|
|
905
913
|
ORDER BY distance
|
|
906
914
|
`;
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
915
|
+
const embResults = await executeQuery(repo.id, vectorQuery);
|
|
916
|
+
return embResults.map((row) => ({
|
|
917
|
+
nodeId: row.nodeId ?? row[0],
|
|
918
|
+
chunkIndex: row.chunkIndex ?? row[1] ?? 0,
|
|
919
|
+
startLine: row.startLine ?? row[2] ?? 0,
|
|
920
|
+
endLine: row.endLine ?? row[3] ?? 0,
|
|
921
|
+
distance: row.distance ?? row[4],
|
|
922
|
+
}));
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
catch {
|
|
926
|
+
bestChunks = new Map();
|
|
927
|
+
}
|
|
916
928
|
}
|
|
917
|
-
|
|
918
|
-
|
|
929
|
+
else if (!this.warnedVectorUnsupported) {
|
|
930
|
+
// Rare diagnostic: surface why we fell back to the exact scan path so
|
|
931
|
+
// operators can see at a glance that the VECTOR extension is missing on
|
|
932
|
+
// this runtime (e.g. Windows builds without the optional native
|
|
933
|
+
// dependency). Emitted once per `LocalBackend` instance lifetime to
|
|
934
|
+
// avoid noisy stderr on hot semantic-search paths (DoD §2.8).
|
|
935
|
+
this.warnedVectorUnsupported = true;
|
|
936
|
+
console.error('GitNexus [query:vector]: VECTOR index unavailable for this runtime; using exact scan fallback');
|
|
919
937
|
}
|
|
920
938
|
if (bestChunks.size === 0) {
|
|
921
939
|
const embeddingCount = Number(tableCheck[0].cnt ?? tableCheck[0][0] ?? 0);
|
package/package.json
CHANGED