gitnexus 1.4.6 → 1.4.8
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/README.md +22 -1
- package/dist/cli/ai-context.d.ts +1 -1
- package/dist/cli/ai-context.js +1 -1
- package/dist/cli/analyze.d.ts +2 -0
- package/dist/cli/analyze.js +54 -21
- package/dist/cli/index.js +2 -1
- package/dist/cli/setup.js +78 -1
- package/dist/config/supported-languages.d.ts +30 -0
- package/dist/config/supported-languages.js +30 -0
- package/dist/core/embeddings/embedder.d.ts +6 -1
- package/dist/core/embeddings/embedder.js +65 -5
- package/dist/core/embeddings/embedding-pipeline.js +11 -9
- package/dist/core/embeddings/http-client.d.ts +31 -0
- package/dist/core/embeddings/http-client.js +179 -0
- package/dist/core/embeddings/index.d.ts +1 -0
- package/dist/core/embeddings/index.js +1 -0
- package/dist/core/embeddings/types.d.ts +1 -1
- package/dist/core/graph/types.d.ts +4 -3
- package/dist/core/ingestion/ast-helpers.d.ts +80 -0
- package/dist/core/ingestion/ast-helpers.js +738 -0
- package/dist/core/ingestion/call-analysis.d.ts +73 -0
- package/dist/core/ingestion/call-analysis.js +490 -0
- package/dist/core/ingestion/call-processor.d.ts +55 -2
- package/dist/core/ingestion/call-processor.js +673 -108
- package/dist/core/ingestion/call-routing.d.ts +23 -2
- package/dist/core/ingestion/call-routing.js +21 -0
- package/dist/core/ingestion/entry-point-scoring.js +36 -26
- package/dist/core/ingestion/framework-detection.d.ts +10 -2
- package/dist/core/ingestion/framework-detection.js +49 -12
- package/dist/core/ingestion/heritage-processor.js +47 -49
- package/dist/core/ingestion/import-processor.d.ts +1 -1
- package/dist/core/ingestion/import-processor.js +103 -194
- package/dist/core/ingestion/import-resolution.d.ts +101 -0
- package/dist/core/ingestion/import-resolution.js +251 -0
- package/dist/core/ingestion/language-config.d.ts +3 -0
- package/dist/core/ingestion/language-config.js +13 -0
- package/dist/core/ingestion/markdown-processor.d.ts +17 -0
- package/dist/core/ingestion/markdown-processor.js +124 -0
- package/dist/core/ingestion/mro-processor.js +8 -3
- package/dist/core/ingestion/named-binding-extraction.d.ts +9 -43
- package/dist/core/ingestion/named-binding-extraction.js +89 -79
- package/dist/core/ingestion/parsing-processor.d.ts +3 -2
- package/dist/core/ingestion/parsing-processor.js +27 -60
- package/dist/core/ingestion/pipeline.d.ts +10 -0
- package/dist/core/ingestion/pipeline.js +425 -4
- package/dist/core/ingestion/resolution-context.d.ts +5 -0
- package/dist/core/ingestion/resolution-context.js +7 -4
- package/dist/core/ingestion/resolvers/index.d.ts +1 -1
- package/dist/core/ingestion/resolvers/index.js +1 -1
- package/dist/core/ingestion/resolvers/jvm.d.ts +2 -1
- package/dist/core/ingestion/resolvers/jvm.js +25 -9
- package/dist/core/ingestion/resolvers/php.d.ts +14 -0
- package/dist/core/ingestion/resolvers/php.js +43 -3
- package/dist/core/ingestion/resolvers/utils.d.ts +5 -0
- package/dist/core/ingestion/resolvers/utils.js +16 -0
- package/dist/core/ingestion/symbol-table.d.ts +29 -3
- package/dist/core/ingestion/symbol-table.js +42 -9
- package/dist/core/ingestion/tree-sitter-queries.d.ts +12 -12
- package/dist/core/ingestion/tree-sitter-queries.js +243 -2
- package/dist/core/ingestion/type-env.d.ts +28 -1
- package/dist/core/ingestion/type-env.js +451 -72
- package/dist/core/ingestion/type-extractors/c-cpp.d.ts +5 -0
- package/dist/core/ingestion/type-extractors/c-cpp.js +146 -2
- package/dist/core/ingestion/type-extractors/csharp.js +189 -16
- package/dist/core/ingestion/type-extractors/go.js +45 -0
- package/dist/core/ingestion/type-extractors/index.d.ts +1 -1
- package/dist/core/ingestion/type-extractors/index.js +1 -1
- package/dist/core/ingestion/type-extractors/jvm.js +244 -69
- package/dist/core/ingestion/type-extractors/php.js +31 -4
- package/dist/core/ingestion/type-extractors/python.js +89 -17
- package/dist/core/ingestion/type-extractors/ruby.js +17 -2
- package/dist/core/ingestion/type-extractors/rust.js +72 -4
- package/dist/core/ingestion/type-extractors/shared.d.ts +12 -2
- package/dist/core/ingestion/type-extractors/shared.js +115 -13
- package/dist/core/ingestion/type-extractors/swift.js +7 -6
- package/dist/core/ingestion/type-extractors/types.d.ts +54 -11
- package/dist/core/ingestion/type-extractors/typescript.js +171 -9
- package/dist/core/ingestion/utils.d.ts +2 -95
- package/dist/core/ingestion/utils.js +3 -892
- package/dist/core/ingestion/workers/parse-worker.d.ts +36 -11
- package/dist/core/ingestion/workers/parse-worker.js +116 -95
- package/dist/core/lbug/csv-generator.js +18 -1
- package/dist/core/lbug/lbug-adapter.d.ts +12 -0
- package/dist/core/lbug/lbug-adapter.js +71 -4
- package/dist/core/lbug/schema.d.ts +6 -4
- package/dist/core/lbug/schema.js +27 -3
- package/dist/mcp/core/embedder.js +11 -3
- package/dist/mcp/core/lbug-adapter.d.ts +22 -0
- package/dist/mcp/core/lbug-adapter.js +178 -23
- package/dist/mcp/local/local-backend.d.ts +22 -0
- package/dist/mcp/local/local-backend.js +136 -32
- package/dist/mcp/resources.js +13 -0
- package/dist/mcp/server.js +26 -4
- package/dist/mcp/tools.js +17 -7
- package/dist/server/api.d.ts +19 -1
- package/dist/server/api.js +66 -6
- package/dist/storage/git.d.ts +12 -0
- package/dist/storage/git.js +21 -0
- package/package.json +12 -4
|
@@ -17,6 +17,10 @@ export const TYPESCRIPT_QUERIES = `
|
|
|
17
17
|
(function_declaration
|
|
18
18
|
name: (identifier) @name) @definition.function
|
|
19
19
|
|
|
20
|
+
; TypeScript overload signatures (function_signature is a separate node type from function_declaration)
|
|
21
|
+
(function_signature
|
|
22
|
+
name: (identifier) @name) @definition.function
|
|
23
|
+
|
|
20
24
|
(method_definition
|
|
21
25
|
name: (property_identifier) @name) @definition.method
|
|
22
26
|
|
|
@@ -60,6 +64,19 @@ export const TYPESCRIPT_QUERIES = `
|
|
|
60
64
|
(new_expression
|
|
61
65
|
constructor: (identifier) @call.name) @call
|
|
62
66
|
|
|
67
|
+
; Class properties — public_field_definition covers most TS class fields
|
|
68
|
+
(public_field_definition
|
|
69
|
+
name: (property_identifier) @name) @definition.property
|
|
70
|
+
|
|
71
|
+
; Private class fields: #address: Address
|
|
72
|
+
(public_field_definition
|
|
73
|
+
name: (private_property_identifier) @name) @definition.property
|
|
74
|
+
|
|
75
|
+
; Constructor parameter properties: constructor(public address: Address)
|
|
76
|
+
(required_parameter
|
|
77
|
+
(accessibility_modifier)
|
|
78
|
+
pattern: (identifier) @name) @definition.property
|
|
79
|
+
|
|
63
80
|
; Heritage queries - class extends
|
|
64
81
|
(class_declaration
|
|
65
82
|
name: (type_identifier) @heritage.class
|
|
@@ -73,6 +90,20 @@ export const TYPESCRIPT_QUERIES = `
|
|
|
73
90
|
(class_heritage
|
|
74
91
|
(implements_clause
|
|
75
92
|
(type_identifier) @heritage.implements))) @heritage.impl
|
|
93
|
+
|
|
94
|
+
; Write access: obj.field = value
|
|
95
|
+
(assignment_expression
|
|
96
|
+
left: (member_expression
|
|
97
|
+
object: (_) @assignment.receiver
|
|
98
|
+
property: (property_identifier) @assignment.property)
|
|
99
|
+
right: (_)) @assignment
|
|
100
|
+
|
|
101
|
+
; Write access: obj.field += value (compound assignment)
|
|
102
|
+
(augmented_assignment_expression
|
|
103
|
+
left: (member_expression
|
|
104
|
+
object: (_) @assignment.receiver
|
|
105
|
+
property: (property_identifier) @assignment.property)
|
|
106
|
+
right: (_)) @assignment
|
|
76
107
|
`;
|
|
77
108
|
// JavaScript queries - works with tree-sitter-javascript
|
|
78
109
|
export const JAVASCRIPT_QUERIES = `
|
|
@@ -125,12 +156,30 @@ export const JAVASCRIPT_QUERIES = `
|
|
|
125
156
|
(new_expression
|
|
126
157
|
constructor: (identifier) @call.name) @call
|
|
127
158
|
|
|
159
|
+
; Class fields — field_definition captures JS class fields (class User { address = ... })
|
|
160
|
+
(field_definition
|
|
161
|
+
property: (property_identifier) @name) @definition.property
|
|
162
|
+
|
|
128
163
|
; Heritage queries - class extends (JavaScript uses different AST than TypeScript)
|
|
129
164
|
; In tree-sitter-javascript, class_heritage directly contains the parent identifier
|
|
130
165
|
(class_declaration
|
|
131
166
|
name: (identifier) @heritage.class
|
|
132
167
|
(class_heritage
|
|
133
168
|
(identifier) @heritage.extends)) @heritage
|
|
169
|
+
|
|
170
|
+
; Write access: obj.field = value
|
|
171
|
+
(assignment_expression
|
|
172
|
+
left: (member_expression
|
|
173
|
+
object: (_) @assignment.receiver
|
|
174
|
+
property: (property_identifier) @assignment.property)
|
|
175
|
+
right: (_)) @assignment
|
|
176
|
+
|
|
177
|
+
; Write access: obj.field += value (compound assignment)
|
|
178
|
+
(augmented_assignment_expression
|
|
179
|
+
left: (member_expression
|
|
180
|
+
object: (_) @assignment.receiver
|
|
181
|
+
property: (property_identifier) @assignment.property)
|
|
182
|
+
right: (_)) @assignment
|
|
134
183
|
`;
|
|
135
184
|
// Python queries - works with tree-sitter-python
|
|
136
185
|
export const PYTHON_QUERIES = `
|
|
@@ -143,6 +192,12 @@ export const PYTHON_QUERIES = `
|
|
|
143
192
|
(import_statement
|
|
144
193
|
name: (dotted_name) @import.source) @import
|
|
145
194
|
|
|
195
|
+
; import numpy as np → aliased_import captures the module name so the
|
|
196
|
+
; import path is resolved and named-binding extraction stores "np" → "numpy".
|
|
197
|
+
(import_statement
|
|
198
|
+
name: (aliased_import
|
|
199
|
+
name: (dotted_name) @import.source)) @import
|
|
200
|
+
|
|
146
201
|
(import_from_statement
|
|
147
202
|
module_name: (dotted_name) @import.source) @import
|
|
148
203
|
|
|
@@ -156,11 +211,33 @@ export const PYTHON_QUERIES = `
|
|
|
156
211
|
function: (attribute
|
|
157
212
|
attribute: (identifier) @call.name)) @call
|
|
158
213
|
|
|
214
|
+
; Class attribute type annotations — PEP 526: address: Address or address: Address = Address()
|
|
215
|
+
; Both bare annotations (address: Address) and annotated assignments (name: str = "test")
|
|
216
|
+
; are parsed as (assignment left: ... type: ...) in tree-sitter-python.
|
|
217
|
+
(expression_statement
|
|
218
|
+
(assignment
|
|
219
|
+
left: (identifier) @name
|
|
220
|
+
type: (type)) @definition.property)
|
|
221
|
+
|
|
159
222
|
; Heritage queries - Python class inheritance
|
|
160
223
|
(class_definition
|
|
161
224
|
name: (identifier) @heritage.class
|
|
162
225
|
superclasses: (argument_list
|
|
163
226
|
(identifier) @heritage.extends)) @heritage
|
|
227
|
+
|
|
228
|
+
; Write access: obj.field = value
|
|
229
|
+
(assignment
|
|
230
|
+
left: (attribute
|
|
231
|
+
object: (_) @assignment.receiver
|
|
232
|
+
attribute: (identifier) @assignment.property)
|
|
233
|
+
right: (_)) @assignment
|
|
234
|
+
|
|
235
|
+
; Write access: obj.field += value (compound assignment)
|
|
236
|
+
(augmented_assignment
|
|
237
|
+
left: (attribute
|
|
238
|
+
object: (_) @assignment.receiver
|
|
239
|
+
attribute: (identifier) @assignment.property)
|
|
240
|
+
right: (_)) @assignment
|
|
164
241
|
`;
|
|
165
242
|
// Java queries - works with tree-sitter-java
|
|
166
243
|
export const JAVA_QUERIES = `
|
|
@@ -174,6 +251,11 @@ export const JAVA_QUERIES = `
|
|
|
174
251
|
(method_declaration name: (identifier) @name) @definition.method
|
|
175
252
|
(constructor_declaration name: (identifier) @name) @definition.constructor
|
|
176
253
|
|
|
254
|
+
; Fields — typed field declarations inside class bodies
|
|
255
|
+
(field_declaration
|
|
256
|
+
declarator: (variable_declarator
|
|
257
|
+
name: (identifier) @name)) @definition.property
|
|
258
|
+
|
|
177
259
|
; Imports - capture any import declaration child as source
|
|
178
260
|
(import_declaration (_) @import.source) @import
|
|
179
261
|
|
|
@@ -191,6 +273,13 @@ export const JAVA_QUERIES = `
|
|
|
191
273
|
; Heritage - implements interfaces
|
|
192
274
|
(class_declaration name: (identifier) @heritage.class
|
|
193
275
|
(super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl
|
|
276
|
+
|
|
277
|
+
; Write access: obj.field = value
|
|
278
|
+
(assignment_expression
|
|
279
|
+
left: (field_access
|
|
280
|
+
object: (_) @assignment.receiver
|
|
281
|
+
field: (identifier) @assignment.property)
|
|
282
|
+
right: (_)) @assignment
|
|
194
283
|
`;
|
|
195
284
|
// C queries - works with tree-sitter-c
|
|
196
285
|
export const C_QUERIES = `
|
|
@@ -236,6 +325,11 @@ export const GO_QUERIES = `
|
|
|
236
325
|
(import_declaration (import_spec path: (interpreted_string_literal) @import.source)) @import
|
|
237
326
|
(import_declaration (import_spec_list (import_spec path: (interpreted_string_literal) @import.source))) @import
|
|
238
327
|
|
|
328
|
+
; Struct fields — named field declarations inside struct types
|
|
329
|
+
(field_declaration_list
|
|
330
|
+
(field_declaration
|
|
331
|
+
name: (field_identifier) @name) @definition.property)
|
|
332
|
+
|
|
239
333
|
; Struct embedding (anonymous fields = inheritance)
|
|
240
334
|
(type_declaration
|
|
241
335
|
(type_spec
|
|
@@ -251,6 +345,24 @@ export const GO_QUERIES = `
|
|
|
251
345
|
|
|
252
346
|
; Struct literal construction: User{Name: "Alice"}
|
|
253
347
|
(composite_literal type: (type_identifier) @call.name) @call
|
|
348
|
+
|
|
349
|
+
; Write access: obj.field = value
|
|
350
|
+
(assignment_statement
|
|
351
|
+
left: (expression_list
|
|
352
|
+
(selector_expression
|
|
353
|
+
operand: (_) @assignment.receiver
|
|
354
|
+
field: (field_identifier) @assignment.property))
|
|
355
|
+
right: (_)) @assignment
|
|
356
|
+
|
|
357
|
+
; Write access: obj.field++ / obj.field--
|
|
358
|
+
(inc_statement
|
|
359
|
+
(selector_expression
|
|
360
|
+
operand: (_) @assignment.receiver
|
|
361
|
+
field: (field_identifier) @assignment.property)) @assignment
|
|
362
|
+
(dec_statement
|
|
363
|
+
(selector_expression
|
|
364
|
+
operand: (_) @assignment.receiver
|
|
365
|
+
field: (field_identifier) @assignment.property)) @assignment
|
|
254
366
|
`;
|
|
255
367
|
// C++ queries - works with tree-sitter-cpp
|
|
256
368
|
export const CPP_QUERIES = `
|
|
@@ -291,8 +403,30 @@ export const CPP_QUERIES = `
|
|
|
291
403
|
(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function
|
|
292
404
|
(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function
|
|
293
405
|
|
|
294
|
-
;
|
|
295
|
-
|
|
406
|
+
; Class/struct data member fields (Address address; int count;)
|
|
407
|
+
; Uses field_identifier to exclude method declarations (which use function_declarator)
|
|
408
|
+
(field_declaration
|
|
409
|
+
declarator: (field_identifier) @name) @definition.property
|
|
410
|
+
|
|
411
|
+
; Pointer member fields (Address* address;)
|
|
412
|
+
(field_declaration
|
|
413
|
+
declarator: (pointer_declarator
|
|
414
|
+
declarator: (field_identifier) @name)) @definition.property
|
|
415
|
+
|
|
416
|
+
; Reference member fields (Address& address;)
|
|
417
|
+
(field_declaration
|
|
418
|
+
declarator: (reference_declarator
|
|
419
|
+
(field_identifier) @name)) @definition.property
|
|
420
|
+
|
|
421
|
+
; Inline class method declarations (inside class body, no body: void save();)
|
|
422
|
+
; tree-sitter-cpp uses field_identifier (not identifier) for names inside class bodies
|
|
423
|
+
(field_declaration declarator: (function_declarator declarator: [(field_identifier) (identifier)] @name)) @definition.method
|
|
424
|
+
|
|
425
|
+
; Inline class method declarations returning a pointer (User* lookup();)
|
|
426
|
+
(field_declaration declarator: (pointer_declarator declarator: (function_declarator declarator: [(field_identifier) (identifier)] @name))) @definition.method
|
|
427
|
+
|
|
428
|
+
; Inline class method declarations returning a reference (User& lookup();)
|
|
429
|
+
(field_declaration declarator: (reference_declarator (function_declarator declarator: [(field_identifier) (identifier)] @name))) @definition.method
|
|
296
430
|
|
|
297
431
|
; Inline class method definitions (inside class body, with body: void Foo() { ... })
|
|
298
432
|
(field_declaration_list
|
|
@@ -300,6 +434,20 @@ export const CPP_QUERIES = `
|
|
|
300
434
|
declarator: (function_declarator
|
|
301
435
|
declarator: [(field_identifier) (identifier) (operator_name) (destructor_name)] @name)) @definition.method)
|
|
302
436
|
|
|
437
|
+
; Inline class methods returning a pointer type (User* lookup(int id) { ... })
|
|
438
|
+
(field_declaration_list
|
|
439
|
+
(function_definition
|
|
440
|
+
declarator: (pointer_declarator
|
|
441
|
+
declarator: (function_declarator
|
|
442
|
+
declarator: [(field_identifier) (identifier) (operator_name)] @name))) @definition.method)
|
|
443
|
+
|
|
444
|
+
; Inline class methods returning a reference type (User& lookup(int id) { ... })
|
|
445
|
+
(field_declaration_list
|
|
446
|
+
(function_definition
|
|
447
|
+
declarator: (reference_declarator
|
|
448
|
+
(function_declarator
|
|
449
|
+
declarator: [(field_identifier) (identifier) (operator_name)] @name))) @definition.method)
|
|
450
|
+
|
|
303
451
|
; Templates
|
|
304
452
|
(template_declaration (class_specifier name: (type_identifier) @name)) @definition.template
|
|
305
453
|
(template_declaration (function_definition declarator: (function_declarator declarator: (identifier) @name))) @definition.template
|
|
@@ -321,6 +469,14 @@ export const CPP_QUERIES = `
|
|
|
321
469
|
(base_class_clause (type_identifier) @heritage.extends)) @heritage
|
|
322
470
|
(class_specifier name: (type_identifier) @heritage.class
|
|
323
471
|
(base_class_clause (access_specifier) (type_identifier) @heritage.extends)) @heritage
|
|
472
|
+
|
|
473
|
+
; Write access: obj.field = value
|
|
474
|
+
(assignment_expression
|
|
475
|
+
left: (field_expression
|
|
476
|
+
argument: (_) @assignment.receiver
|
|
477
|
+
field: (field_identifier) @assignment.property)
|
|
478
|
+
right: (_)) @assignment
|
|
479
|
+
|
|
324
480
|
`;
|
|
325
481
|
// C# queries - works with tree-sitter-c-sharp
|
|
326
482
|
export const CSHARP_QUERIES = `
|
|
@@ -374,6 +530,13 @@ export const CSHARP_QUERIES = `
|
|
|
374
530
|
(base_list (identifier) @heritage.extends)) @heritage
|
|
375
531
|
(class_declaration name: (identifier) @heritage.class
|
|
376
532
|
(base_list (generic_name (identifier) @heritage.extends))) @heritage
|
|
533
|
+
|
|
534
|
+
; Write access: obj.field = value
|
|
535
|
+
(assignment_expression
|
|
536
|
+
left: (member_access_expression
|
|
537
|
+
expression: (_) @assignment.receiver
|
|
538
|
+
name: (identifier) @assignment.property)
|
|
539
|
+
right: (_)) @assignment
|
|
377
540
|
`;
|
|
378
541
|
// Rust queries - works with tree-sitter-rust
|
|
379
542
|
export const RUST_QUERIES = `
|
|
@@ -404,11 +567,30 @@ export const RUST_QUERIES = `
|
|
|
404
567
|
; Struct literal construction: User { name: value }
|
|
405
568
|
(struct_expression name: (type_identifier) @call.name) @call
|
|
406
569
|
|
|
570
|
+
; Struct fields — named field declarations inside struct bodies
|
|
571
|
+
(field_declaration_list
|
|
572
|
+
(field_declaration
|
|
573
|
+
name: (field_identifier) @name) @definition.property)
|
|
574
|
+
|
|
407
575
|
; Heritage (trait implementation) — all combinations of concrete/generic trait × concrete/generic type
|
|
408
576
|
(impl_item trait: (type_identifier) @heritage.trait type: (type_identifier) @heritage.class) @heritage
|
|
409
577
|
(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (type_identifier) @heritage.class) @heritage
|
|
410
578
|
(impl_item trait: (type_identifier) @heritage.trait type: (generic_type type: (type_identifier) @heritage.class)) @heritage
|
|
411
579
|
(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (generic_type type: (type_identifier) @heritage.class)) @heritage
|
|
580
|
+
|
|
581
|
+
; Write access: obj.field = value
|
|
582
|
+
(assignment_expression
|
|
583
|
+
left: (field_expression
|
|
584
|
+
value: (_) @assignment.receiver
|
|
585
|
+
field: (field_identifier) @assignment.property)
|
|
586
|
+
right: (_)) @assignment
|
|
587
|
+
|
|
588
|
+
; Write access: obj.field += value (compound assignment)
|
|
589
|
+
(compound_assignment_expr
|
|
590
|
+
left: (field_expression
|
|
591
|
+
value: (_) @assignment.receiver
|
|
592
|
+
field: (field_identifier) @assignment.property)
|
|
593
|
+
right: (_)) @assignment
|
|
412
594
|
`;
|
|
413
595
|
// PHP queries - works with tree-sitter-php (php_only grammar)
|
|
414
596
|
export const PHP_QUERIES = `
|
|
@@ -446,6 +628,13 @@ export const PHP_QUERIES = `
|
|
|
446
628
|
(variable_name
|
|
447
629
|
(name) @name))) @definition.property
|
|
448
630
|
|
|
631
|
+
; Constructor property promotion (PHP 8.0+: public Address $address in __construct)
|
|
632
|
+
(method_declaration
|
|
633
|
+
parameters: (formal_parameters
|
|
634
|
+
(property_promotion_parameter
|
|
635
|
+
name: (variable_name
|
|
636
|
+
(name) @name)))) @definition.property
|
|
637
|
+
|
|
449
638
|
; ── Imports: use statements ──────────────────────────────────────────────────
|
|
450
639
|
; Simple: use App\\Models\\User;
|
|
451
640
|
(namespace_use_declaration
|
|
@@ -490,6 +679,20 @@ export const PHP_QUERIES = `
|
|
|
490
679
|
body: (declaration_list
|
|
491
680
|
(use_declaration
|
|
492
681
|
[(name) (qualified_name)] @heritage.trait))) @heritage
|
|
682
|
+
|
|
683
|
+
; Write access: $obj->field = value
|
|
684
|
+
(assignment_expression
|
|
685
|
+
left: (member_access_expression
|
|
686
|
+
object: (_) @assignment.receiver
|
|
687
|
+
name: (name) @assignment.property)
|
|
688
|
+
right: (_)) @assignment
|
|
689
|
+
|
|
690
|
+
; Write access: ClassName::$field = value (static property)
|
|
691
|
+
(assignment_expression
|
|
692
|
+
left: (scoped_property_access_expression
|
|
693
|
+
scope: (_) @assignment.receiver
|
|
694
|
+
name: (variable_name (name) @assignment.property))
|
|
695
|
+
right: (_)) @assignment
|
|
493
696
|
`;
|
|
494
697
|
// Ruby queries - works with tree-sitter-ruby
|
|
495
698
|
// NOTE: Ruby uses `call` for require, include, extend, prepend, attr_* etc.
|
|
@@ -534,6 +737,20 @@ export const RUBY_QUERIES = `
|
|
|
534
737
|
name: (constant) @heritage.class
|
|
535
738
|
superclass: (superclass
|
|
536
739
|
(constant) @heritage.extends)) @heritage
|
|
740
|
+
|
|
741
|
+
; Write access: obj.field = value (Ruby setter — syntactically a method call to field=)
|
|
742
|
+
(assignment
|
|
743
|
+
left: (call
|
|
744
|
+
receiver: (_) @assignment.receiver
|
|
745
|
+
method: (identifier) @assignment.property)
|
|
746
|
+
right: (_)) @assignment
|
|
747
|
+
|
|
748
|
+
; Write access: obj.field += value (compound assignment — operator_assignment node, not assignment)
|
|
749
|
+
(operator_assignment
|
|
750
|
+
left: (call
|
|
751
|
+
receiver: (_) @assignment.receiver
|
|
752
|
+
method: (identifier) @assignment.property)
|
|
753
|
+
right: (_)) @assignment
|
|
537
754
|
`;
|
|
538
755
|
// Kotlin queries - works with tree-sitter-kotlin (fwcd/tree-sitter-kotlin)
|
|
539
756
|
// Based on official tags.scm; functions use simple_identifier, classes use type_identifier
|
|
@@ -569,6 +786,12 @@ export const KOTLIN_QUERIES = `
|
|
|
569
786
|
(variable_declaration
|
|
570
787
|
(simple_identifier) @name)) @definition.property
|
|
571
788
|
|
|
789
|
+
; Primary constructor val/var parameters (data class, value class, regular class)
|
|
790
|
+
; binding_pattern_kind contains "val" or "var" — without it, the param is not a property
|
|
791
|
+
(class_parameter
|
|
792
|
+
(binding_pattern_kind)
|
|
793
|
+
(simple_identifier) @name) @definition.property
|
|
794
|
+
|
|
572
795
|
; ── Enum entries ─────────────────────────────────────────────────────────
|
|
573
796
|
(enum_entry
|
|
574
797
|
(simple_identifier) @name) @definition.enum
|
|
@@ -613,6 +836,15 @@ export const KOTLIN_QUERIES = `
|
|
|
613
836
|
(delegation_specifier
|
|
614
837
|
(constructor_invocation
|
|
615
838
|
(user_type (type_identifier) @heritage.extends)))) @heritage
|
|
839
|
+
|
|
840
|
+
; Write access: obj.field = value
|
|
841
|
+
(assignment
|
|
842
|
+
(directly_assignable_expression
|
|
843
|
+
(_) @assignment.receiver
|
|
844
|
+
(navigation_suffix
|
|
845
|
+
(simple_identifier) @assignment.property))
|
|
846
|
+
(_)) @assignment
|
|
847
|
+
|
|
616
848
|
`;
|
|
617
849
|
// Swift queries - works with tree-sitter-swift
|
|
618
850
|
export const SWIFT_QUERIES = `
|
|
@@ -670,6 +902,15 @@ export const SWIFT_QUERIES = `
|
|
|
670
902
|
; Extensions wrap the name in user_type unlike class/struct/enum declarations
|
|
671
903
|
(class_declaration "extension" name: (user_type (type_identifier) @heritage.class)
|
|
672
904
|
(inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage
|
|
905
|
+
|
|
906
|
+
; Write access: obj.field = value
|
|
907
|
+
(assignment
|
|
908
|
+
(directly_assignable_expression
|
|
909
|
+
(_) @assignment.receiver
|
|
910
|
+
(navigation_suffix
|
|
911
|
+
(simple_identifier) @assignment.property))
|
|
912
|
+
(_)) @assignment
|
|
913
|
+
|
|
673
914
|
`;
|
|
674
915
|
export const LANGUAGE_QUERIES = {
|
|
675
916
|
[SupportedLanguages.TypeScript]: TYPESCRIPT_QUERIES,
|
|
@@ -28,10 +28,37 @@ export interface TypeEnvironment {
|
|
|
28
28
|
readonly constructorBindings: readonly ConstructorBinding[];
|
|
29
29
|
/** Raw per-scope type bindings — for testing and debugging. */
|
|
30
30
|
readonly env: TypeEnv;
|
|
31
|
+
/** Maps `scope\0varName` → constructor type for virtual dispatch override.
|
|
32
|
+
* Populated when a variable has BOTH a declared base type AND a more specific
|
|
33
|
+
* constructor type (e.g., `Animal a = new Dog()` → key maps to 'Dog'). */
|
|
34
|
+
readonly constructorTypeMap: ReadonlyMap<string, string>;
|
|
35
|
+
}
|
|
36
|
+
/** Check if `child` is a subclass of `parent` using the parentMap.
|
|
37
|
+
* BFS up from child, depth-limited (5), cycle-safe. */
|
|
38
|
+
export declare const isSubclassOf: (child: string, parent: string, parentMap: ReadonlyMap<string, readonly string[]> | undefined) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Options for buildTypeEnv.
|
|
41
|
+
* Uses an options object to allow future extensions without positional parameter sprawl.
|
|
42
|
+
*/
|
|
43
|
+
export interface BuildTypeEnvOptions {
|
|
44
|
+
symbolTable?: SymbolTable;
|
|
45
|
+
parentMap?: ReadonlyMap<string, readonly string[]>;
|
|
46
|
+
/** Pre-resolved bindings from upstream files (Phase 14).
|
|
47
|
+
* Seeded into FILE_SCOPE after walk() for names with no local binding.
|
|
48
|
+
* Local declarations always take precedence (first-writer-wins). */
|
|
49
|
+
importedBindings?: ReadonlyMap<string, string>;
|
|
50
|
+
/** Cross-file return type fallback for imported callables (Phase 14 E3).
|
|
51
|
+
* Consulted ONLY when SymbolTable has no unambiguous match.
|
|
52
|
+
* Local definitions always take precedence (local-first principle). */
|
|
53
|
+
importedReturnTypes?: ReadonlyMap<string, string>;
|
|
54
|
+
/** Cross-file RAW return types for imported callables (Phase 14 E3).
|
|
55
|
+
* Stores raw declared return type strings (e.g., 'User[]', 'List<User>').
|
|
56
|
+
* Used by lookupRawReturnType for for-loop element extraction. */
|
|
57
|
+
importedRawReturnTypes?: ReadonlyMap<string, string>;
|
|
31
58
|
}
|
|
32
59
|
export declare const buildTypeEnv: (tree: {
|
|
33
60
|
rootNode: SyntaxNode;
|
|
34
|
-
}, language: SupportedLanguages,
|
|
61
|
+
}, language: SupportedLanguages, options?: BuildTypeEnvOptions) => TypeEnvironment;
|
|
35
62
|
/**
|
|
36
63
|
* Unverified constructor binding: a `val x = Callee()` pattern where we
|
|
37
64
|
* couldn't confirm the callee is a class (because it's defined in another file).
|