gitnexus 1.2.6 → 1.2.7
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 +186 -187
- package/dist/cli/ai-context.js +71 -71
- package/dist/cli/eval-server.js +1 -1
- package/dist/cli/mcp.js +1 -1
- package/dist/core/embeddings/embedder.js +6 -0
- package/dist/core/ingestion/filesystem-walker.js +17 -3
- package/dist/core/ingestion/parsing-processor.js +4 -1
- package/dist/core/ingestion/tree-sitter-queries.js +282 -282
- package/dist/core/ingestion/workers/parse-worker.js +13 -4
- package/dist/core/ingestion/workers/worker-pool.js +43 -9
- package/dist/core/kuzu/schema.js +256 -256
- package/dist/core/search/bm25-index.js +5 -5
- package/dist/core/wiki/html-viewer.js +192 -192
- package/dist/mcp/local/local-backend.d.ts +18 -3
- package/dist/mcp/local/local-backend.js +169 -125
- package/dist/mcp/resources.js +46 -46
- package/dist/mcp/server.js +16 -16
- package/dist/mcp/tools.js +77 -77
- package/package.json +82 -82
- package/skills/debugging.md +85 -85
- package/skills/exploring.md +75 -75
- package/skills/impact-analysis.md +94 -94
- package/skills/refactoring.md +113 -113
|
@@ -7,304 +7,304 @@ import { SupportedLanguages } from '../../config/supported-languages.js';
|
|
|
7
7
|
* compatible with the standard tree-sitter grammars.
|
|
8
8
|
*/
|
|
9
9
|
// TypeScript queries - works with tree-sitter-typescript
|
|
10
|
-
export const TYPESCRIPT_QUERIES = `
|
|
11
|
-
(class_declaration
|
|
12
|
-
name: (type_identifier) @name) @definition.class
|
|
13
|
-
|
|
14
|
-
(interface_declaration
|
|
15
|
-
name: (type_identifier) @name) @definition.interface
|
|
16
|
-
|
|
17
|
-
(function_declaration
|
|
18
|
-
name: (identifier) @name) @definition.function
|
|
19
|
-
|
|
20
|
-
(method_definition
|
|
21
|
-
name: (property_identifier) @name) @definition.method
|
|
22
|
-
|
|
23
|
-
(lexical_declaration
|
|
24
|
-
(variable_declarator
|
|
25
|
-
name: (identifier) @name
|
|
26
|
-
value: (arrow_function))) @definition.function
|
|
27
|
-
|
|
28
|
-
(lexical_declaration
|
|
29
|
-
(variable_declarator
|
|
30
|
-
name: (identifier) @name
|
|
31
|
-
value: (function_expression))) @definition.function
|
|
32
|
-
|
|
33
|
-
(export_statement
|
|
34
|
-
declaration: (lexical_declaration
|
|
35
|
-
(variable_declarator
|
|
36
|
-
name: (identifier) @name
|
|
37
|
-
value: (arrow_function)))) @definition.function
|
|
38
|
-
|
|
39
|
-
(export_statement
|
|
40
|
-
declaration: (lexical_declaration
|
|
41
|
-
(variable_declarator
|
|
42
|
-
name: (identifier) @name
|
|
43
|
-
value: (function_expression)))) @definition.function
|
|
44
|
-
|
|
45
|
-
(import_statement
|
|
46
|
-
source: (string) @import.source) @import
|
|
47
|
-
|
|
48
|
-
(call_expression
|
|
49
|
-
function: (identifier) @call.name) @call
|
|
50
|
-
|
|
51
|
-
(call_expression
|
|
52
|
-
function: (member_expression
|
|
53
|
-
property: (property_identifier) @call.name)) @call
|
|
54
|
-
|
|
55
|
-
; Heritage queries - class extends
|
|
56
|
-
(class_declaration
|
|
57
|
-
name: (type_identifier) @heritage.class
|
|
58
|
-
(class_heritage
|
|
59
|
-
(extends_clause
|
|
60
|
-
value: (identifier) @heritage.extends))) @heritage
|
|
61
|
-
|
|
62
|
-
; Heritage queries - class implements interface
|
|
63
|
-
(class_declaration
|
|
64
|
-
name: (type_identifier) @heritage.class
|
|
65
|
-
(class_heritage
|
|
66
|
-
(implements_clause
|
|
67
|
-
(type_identifier) @heritage.implements))) @heritage.impl
|
|
10
|
+
export const TYPESCRIPT_QUERIES = `
|
|
11
|
+
(class_declaration
|
|
12
|
+
name: (type_identifier) @name) @definition.class
|
|
13
|
+
|
|
14
|
+
(interface_declaration
|
|
15
|
+
name: (type_identifier) @name) @definition.interface
|
|
16
|
+
|
|
17
|
+
(function_declaration
|
|
18
|
+
name: (identifier) @name) @definition.function
|
|
19
|
+
|
|
20
|
+
(method_definition
|
|
21
|
+
name: (property_identifier) @name) @definition.method
|
|
22
|
+
|
|
23
|
+
(lexical_declaration
|
|
24
|
+
(variable_declarator
|
|
25
|
+
name: (identifier) @name
|
|
26
|
+
value: (arrow_function))) @definition.function
|
|
27
|
+
|
|
28
|
+
(lexical_declaration
|
|
29
|
+
(variable_declarator
|
|
30
|
+
name: (identifier) @name
|
|
31
|
+
value: (function_expression))) @definition.function
|
|
32
|
+
|
|
33
|
+
(export_statement
|
|
34
|
+
declaration: (lexical_declaration
|
|
35
|
+
(variable_declarator
|
|
36
|
+
name: (identifier) @name
|
|
37
|
+
value: (arrow_function)))) @definition.function
|
|
38
|
+
|
|
39
|
+
(export_statement
|
|
40
|
+
declaration: (lexical_declaration
|
|
41
|
+
(variable_declarator
|
|
42
|
+
name: (identifier) @name
|
|
43
|
+
value: (function_expression)))) @definition.function
|
|
44
|
+
|
|
45
|
+
(import_statement
|
|
46
|
+
source: (string) @import.source) @import
|
|
47
|
+
|
|
48
|
+
(call_expression
|
|
49
|
+
function: (identifier) @call.name) @call
|
|
50
|
+
|
|
51
|
+
(call_expression
|
|
52
|
+
function: (member_expression
|
|
53
|
+
property: (property_identifier) @call.name)) @call
|
|
54
|
+
|
|
55
|
+
; Heritage queries - class extends
|
|
56
|
+
(class_declaration
|
|
57
|
+
name: (type_identifier) @heritage.class
|
|
58
|
+
(class_heritage
|
|
59
|
+
(extends_clause
|
|
60
|
+
value: (identifier) @heritage.extends))) @heritage
|
|
61
|
+
|
|
62
|
+
; Heritage queries - class implements interface
|
|
63
|
+
(class_declaration
|
|
64
|
+
name: (type_identifier) @heritage.class
|
|
65
|
+
(class_heritage
|
|
66
|
+
(implements_clause
|
|
67
|
+
(type_identifier) @heritage.implements))) @heritage.impl
|
|
68
68
|
`;
|
|
69
69
|
// JavaScript queries - works with tree-sitter-javascript
|
|
70
|
-
export const JAVASCRIPT_QUERIES = `
|
|
71
|
-
(class_declaration
|
|
72
|
-
name: (identifier) @name) @definition.class
|
|
73
|
-
|
|
74
|
-
(function_declaration
|
|
75
|
-
name: (identifier) @name) @definition.function
|
|
76
|
-
|
|
77
|
-
(method_definition
|
|
78
|
-
name: (property_identifier) @name) @definition.method
|
|
79
|
-
|
|
80
|
-
(lexical_declaration
|
|
81
|
-
(variable_declarator
|
|
82
|
-
name: (identifier) @name
|
|
83
|
-
value: (arrow_function))) @definition.function
|
|
84
|
-
|
|
85
|
-
(lexical_declaration
|
|
86
|
-
(variable_declarator
|
|
87
|
-
name: (identifier) @name
|
|
88
|
-
value: (function_expression))) @definition.function
|
|
89
|
-
|
|
90
|
-
(export_statement
|
|
91
|
-
declaration: (lexical_declaration
|
|
92
|
-
(variable_declarator
|
|
93
|
-
name: (identifier) @name
|
|
94
|
-
value: (arrow_function)))) @definition.function
|
|
95
|
-
|
|
96
|
-
(export_statement
|
|
97
|
-
declaration: (lexical_declaration
|
|
98
|
-
(variable_declarator
|
|
99
|
-
name: (identifier) @name
|
|
100
|
-
value: (function_expression)))) @definition.function
|
|
101
|
-
|
|
102
|
-
(import_statement
|
|
103
|
-
source: (string) @import.source) @import
|
|
104
|
-
|
|
105
|
-
(call_expression
|
|
106
|
-
function: (identifier) @call.name) @call
|
|
107
|
-
|
|
108
|
-
(call_expression
|
|
109
|
-
function: (member_expression
|
|
110
|
-
property: (property_identifier) @call.name)) @call
|
|
111
|
-
|
|
112
|
-
; Heritage queries - class extends (JavaScript uses different AST than TypeScript)
|
|
113
|
-
; In tree-sitter-javascript, class_heritage directly contains the parent identifier
|
|
114
|
-
(class_declaration
|
|
115
|
-
name: (identifier) @heritage.class
|
|
116
|
-
(class_heritage
|
|
117
|
-
(identifier) @heritage.extends)) @heritage
|
|
70
|
+
export const JAVASCRIPT_QUERIES = `
|
|
71
|
+
(class_declaration
|
|
72
|
+
name: (identifier) @name) @definition.class
|
|
73
|
+
|
|
74
|
+
(function_declaration
|
|
75
|
+
name: (identifier) @name) @definition.function
|
|
76
|
+
|
|
77
|
+
(method_definition
|
|
78
|
+
name: (property_identifier) @name) @definition.method
|
|
79
|
+
|
|
80
|
+
(lexical_declaration
|
|
81
|
+
(variable_declarator
|
|
82
|
+
name: (identifier) @name
|
|
83
|
+
value: (arrow_function))) @definition.function
|
|
84
|
+
|
|
85
|
+
(lexical_declaration
|
|
86
|
+
(variable_declarator
|
|
87
|
+
name: (identifier) @name
|
|
88
|
+
value: (function_expression))) @definition.function
|
|
89
|
+
|
|
90
|
+
(export_statement
|
|
91
|
+
declaration: (lexical_declaration
|
|
92
|
+
(variable_declarator
|
|
93
|
+
name: (identifier) @name
|
|
94
|
+
value: (arrow_function)))) @definition.function
|
|
95
|
+
|
|
96
|
+
(export_statement
|
|
97
|
+
declaration: (lexical_declaration
|
|
98
|
+
(variable_declarator
|
|
99
|
+
name: (identifier) @name
|
|
100
|
+
value: (function_expression)))) @definition.function
|
|
101
|
+
|
|
102
|
+
(import_statement
|
|
103
|
+
source: (string) @import.source) @import
|
|
104
|
+
|
|
105
|
+
(call_expression
|
|
106
|
+
function: (identifier) @call.name) @call
|
|
107
|
+
|
|
108
|
+
(call_expression
|
|
109
|
+
function: (member_expression
|
|
110
|
+
property: (property_identifier) @call.name)) @call
|
|
111
|
+
|
|
112
|
+
; Heritage queries - class extends (JavaScript uses different AST than TypeScript)
|
|
113
|
+
; In tree-sitter-javascript, class_heritage directly contains the parent identifier
|
|
114
|
+
(class_declaration
|
|
115
|
+
name: (identifier) @heritage.class
|
|
116
|
+
(class_heritage
|
|
117
|
+
(identifier) @heritage.extends)) @heritage
|
|
118
118
|
`;
|
|
119
119
|
// Python queries - works with tree-sitter-python
|
|
120
|
-
export const PYTHON_QUERIES = `
|
|
121
|
-
(class_definition
|
|
122
|
-
name: (identifier) @name) @definition.class
|
|
123
|
-
|
|
124
|
-
(function_definition
|
|
125
|
-
name: (identifier) @name) @definition.function
|
|
126
|
-
|
|
127
|
-
(import_statement
|
|
128
|
-
name: (dotted_name) @import.source) @import
|
|
129
|
-
|
|
130
|
-
(import_from_statement
|
|
131
|
-
module_name: (dotted_name) @import.source) @import
|
|
132
|
-
|
|
133
|
-
(call
|
|
134
|
-
function: (identifier) @call.name) @call
|
|
135
|
-
|
|
136
|
-
(call
|
|
137
|
-
function: (attribute
|
|
138
|
-
attribute: (identifier) @call.name)) @call
|
|
139
|
-
|
|
140
|
-
; Heritage queries - Python class inheritance
|
|
141
|
-
(class_definition
|
|
142
|
-
name: (identifier) @heritage.class
|
|
143
|
-
superclasses: (argument_list
|
|
144
|
-
(identifier) @heritage.extends)) @heritage
|
|
120
|
+
export const PYTHON_QUERIES = `
|
|
121
|
+
(class_definition
|
|
122
|
+
name: (identifier) @name) @definition.class
|
|
123
|
+
|
|
124
|
+
(function_definition
|
|
125
|
+
name: (identifier) @name) @definition.function
|
|
126
|
+
|
|
127
|
+
(import_statement
|
|
128
|
+
name: (dotted_name) @import.source) @import
|
|
129
|
+
|
|
130
|
+
(import_from_statement
|
|
131
|
+
module_name: (dotted_name) @import.source) @import
|
|
132
|
+
|
|
133
|
+
(call
|
|
134
|
+
function: (identifier) @call.name) @call
|
|
135
|
+
|
|
136
|
+
(call
|
|
137
|
+
function: (attribute
|
|
138
|
+
attribute: (identifier) @call.name)) @call
|
|
139
|
+
|
|
140
|
+
; Heritage queries - Python class inheritance
|
|
141
|
+
(class_definition
|
|
142
|
+
name: (identifier) @heritage.class
|
|
143
|
+
superclasses: (argument_list
|
|
144
|
+
(identifier) @heritage.extends)) @heritage
|
|
145
145
|
`;
|
|
146
146
|
// Java queries - works with tree-sitter-java
|
|
147
|
-
export const JAVA_QUERIES = `
|
|
148
|
-
; Classes, Interfaces, Enums, Annotations
|
|
149
|
-
(class_declaration name: (identifier) @name) @definition.class
|
|
150
|
-
(interface_declaration name: (identifier) @name) @definition.interface
|
|
151
|
-
(enum_declaration name: (identifier) @name) @definition.enum
|
|
152
|
-
(annotation_type_declaration name: (identifier) @name) @definition.annotation
|
|
153
|
-
|
|
154
|
-
; Methods & Constructors
|
|
155
|
-
(method_declaration name: (identifier) @name) @definition.method
|
|
156
|
-
(constructor_declaration name: (identifier) @name) @definition.constructor
|
|
157
|
-
|
|
158
|
-
; Imports - capture any import declaration child as source
|
|
159
|
-
(import_declaration (_) @import.source) @import
|
|
160
|
-
|
|
161
|
-
; Calls
|
|
162
|
-
(method_invocation name: (identifier) @call.name) @call
|
|
163
|
-
(method_invocation object: (_) name: (identifier) @call.name) @call
|
|
164
|
-
|
|
165
|
-
; Heritage - extends class
|
|
166
|
-
(class_declaration name: (identifier) @heritage.class
|
|
167
|
-
(superclass (type_identifier) @heritage.extends)) @heritage
|
|
168
|
-
|
|
169
|
-
; Heritage - implements interfaces
|
|
170
|
-
(class_declaration name: (identifier) @heritage.class
|
|
171
|
-
(super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl
|
|
147
|
+
export const JAVA_QUERIES = `
|
|
148
|
+
; Classes, Interfaces, Enums, Annotations
|
|
149
|
+
(class_declaration name: (identifier) @name) @definition.class
|
|
150
|
+
(interface_declaration name: (identifier) @name) @definition.interface
|
|
151
|
+
(enum_declaration name: (identifier) @name) @definition.enum
|
|
152
|
+
(annotation_type_declaration name: (identifier) @name) @definition.annotation
|
|
153
|
+
|
|
154
|
+
; Methods & Constructors
|
|
155
|
+
(method_declaration name: (identifier) @name) @definition.method
|
|
156
|
+
(constructor_declaration name: (identifier) @name) @definition.constructor
|
|
157
|
+
|
|
158
|
+
; Imports - capture any import declaration child as source
|
|
159
|
+
(import_declaration (_) @import.source) @import
|
|
160
|
+
|
|
161
|
+
; Calls
|
|
162
|
+
(method_invocation name: (identifier) @call.name) @call
|
|
163
|
+
(method_invocation object: (_) name: (identifier) @call.name) @call
|
|
164
|
+
|
|
165
|
+
; Heritage - extends class
|
|
166
|
+
(class_declaration name: (identifier) @heritage.class
|
|
167
|
+
(superclass (type_identifier) @heritage.extends)) @heritage
|
|
168
|
+
|
|
169
|
+
; Heritage - implements interfaces
|
|
170
|
+
(class_declaration name: (identifier) @heritage.class
|
|
171
|
+
(super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl
|
|
172
172
|
`;
|
|
173
173
|
// C queries - works with tree-sitter-c
|
|
174
|
-
export const C_QUERIES = `
|
|
175
|
-
; Functions
|
|
176
|
-
(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function
|
|
177
|
-
(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function
|
|
178
|
-
|
|
179
|
-
; Structs, Unions, Enums, Typedefs
|
|
180
|
-
(struct_specifier name: (type_identifier) @name) @definition.struct
|
|
181
|
-
(union_specifier name: (type_identifier) @name) @definition.union
|
|
182
|
-
(enum_specifier name: (type_identifier) @name) @definition.enum
|
|
183
|
-
(type_definition declarator: (type_identifier) @name) @definition.typedef
|
|
184
|
-
|
|
185
|
-
; Macros
|
|
186
|
-
(preproc_function_def name: (identifier) @name) @definition.macro
|
|
187
|
-
(preproc_def name: (identifier) @name) @definition.macro
|
|
188
|
-
|
|
189
|
-
; Includes
|
|
190
|
-
(preproc_include path: (_) @import.source) @import
|
|
191
|
-
|
|
192
|
-
; Calls
|
|
193
|
-
(call_expression function: (identifier) @call.name) @call
|
|
194
|
-
(call_expression function: (field_expression field: (field_identifier) @call.name)) @call
|
|
174
|
+
export const C_QUERIES = `
|
|
175
|
+
; Functions
|
|
176
|
+
(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function
|
|
177
|
+
(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function
|
|
178
|
+
|
|
179
|
+
; Structs, Unions, Enums, Typedefs
|
|
180
|
+
(struct_specifier name: (type_identifier) @name) @definition.struct
|
|
181
|
+
(union_specifier name: (type_identifier) @name) @definition.union
|
|
182
|
+
(enum_specifier name: (type_identifier) @name) @definition.enum
|
|
183
|
+
(type_definition declarator: (type_identifier) @name) @definition.typedef
|
|
184
|
+
|
|
185
|
+
; Macros
|
|
186
|
+
(preproc_function_def name: (identifier) @name) @definition.macro
|
|
187
|
+
(preproc_def name: (identifier) @name) @definition.macro
|
|
188
|
+
|
|
189
|
+
; Includes
|
|
190
|
+
(preproc_include path: (_) @import.source) @import
|
|
191
|
+
|
|
192
|
+
; Calls
|
|
193
|
+
(call_expression function: (identifier) @call.name) @call
|
|
194
|
+
(call_expression function: (field_expression field: (field_identifier) @call.name)) @call
|
|
195
195
|
`;
|
|
196
196
|
// Go queries - works with tree-sitter-go
|
|
197
|
-
export const GO_QUERIES = `
|
|
198
|
-
; Functions & Methods
|
|
199
|
-
(function_declaration name: (identifier) @name) @definition.function
|
|
200
|
-
(method_declaration name: (field_identifier) @name) @definition.method
|
|
201
|
-
|
|
202
|
-
; Types
|
|
203
|
-
(type_declaration (type_spec name: (type_identifier) @name type: (struct_type))) @definition.struct
|
|
204
|
-
(type_declaration (type_spec name: (type_identifier) @name type: (interface_type))) @definition.interface
|
|
205
|
-
(type_declaration (type_spec name: (type_identifier) @name)) @definition.type
|
|
206
|
-
|
|
207
|
-
; Imports
|
|
208
|
-
(import_declaration (import_spec path: (interpreted_string_literal) @import.source)) @import
|
|
209
|
-
(import_declaration (import_spec_list (import_spec path: (interpreted_string_literal) @import.source))) @import
|
|
210
|
-
|
|
211
|
-
; Calls
|
|
212
|
-
(call_expression function: (identifier) @call.name) @call
|
|
213
|
-
(call_expression function: (selector_expression field: (field_identifier) @call.name)) @call
|
|
197
|
+
export const GO_QUERIES = `
|
|
198
|
+
; Functions & Methods
|
|
199
|
+
(function_declaration name: (identifier) @name) @definition.function
|
|
200
|
+
(method_declaration name: (field_identifier) @name) @definition.method
|
|
201
|
+
|
|
202
|
+
; Types
|
|
203
|
+
(type_declaration (type_spec name: (type_identifier) @name type: (struct_type))) @definition.struct
|
|
204
|
+
(type_declaration (type_spec name: (type_identifier) @name type: (interface_type))) @definition.interface
|
|
205
|
+
(type_declaration (type_spec name: (type_identifier) @name)) @definition.type
|
|
206
|
+
|
|
207
|
+
; Imports
|
|
208
|
+
(import_declaration (import_spec path: (interpreted_string_literal) @import.source)) @import
|
|
209
|
+
(import_declaration (import_spec_list (import_spec path: (interpreted_string_literal) @import.source))) @import
|
|
210
|
+
|
|
211
|
+
; Calls
|
|
212
|
+
(call_expression function: (identifier) @call.name) @call
|
|
213
|
+
(call_expression function: (selector_expression field: (field_identifier) @call.name)) @call
|
|
214
214
|
`;
|
|
215
215
|
// C++ queries - works with tree-sitter-cpp
|
|
216
|
-
export const CPP_QUERIES = `
|
|
217
|
-
; Classes, Structs, Namespaces
|
|
218
|
-
(class_specifier name: (type_identifier) @name) @definition.class
|
|
219
|
-
(struct_specifier name: (type_identifier) @name) @definition.struct
|
|
220
|
-
(namespace_definition name: (namespace_identifier) @name) @definition.namespace
|
|
221
|
-
(enum_specifier name: (type_identifier) @name) @definition.enum
|
|
222
|
-
|
|
223
|
-
; Functions & Methods
|
|
224
|
-
(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function
|
|
225
|
-
(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) @definition.method
|
|
226
|
-
|
|
227
|
-
; Templates
|
|
228
|
-
(template_declaration (class_specifier name: (type_identifier) @name)) @definition.template
|
|
229
|
-
(template_declaration (function_definition declarator: (function_declarator declarator: (identifier) @name))) @definition.template
|
|
230
|
-
|
|
231
|
-
; Includes
|
|
232
|
-
(preproc_include path: (_) @import.source) @import
|
|
233
|
-
|
|
234
|
-
; Calls
|
|
235
|
-
(call_expression function: (identifier) @call.name) @call
|
|
236
|
-
(call_expression function: (field_expression field: (field_identifier) @call.name)) @call
|
|
237
|
-
(call_expression function: (qualified_identifier name: (identifier) @call.name)) @call
|
|
238
|
-
(call_expression function: (template_function name: (identifier) @call.name)) @call
|
|
239
|
-
|
|
240
|
-
; Heritage
|
|
241
|
-
(class_specifier name: (type_identifier) @heritage.class
|
|
242
|
-
(base_class_clause (type_identifier) @heritage.extends)) @heritage
|
|
243
|
-
(class_specifier name: (type_identifier) @heritage.class
|
|
244
|
-
(base_class_clause (access_specifier) (type_identifier) @heritage.extends)) @heritage
|
|
216
|
+
export const CPP_QUERIES = `
|
|
217
|
+
; Classes, Structs, Namespaces
|
|
218
|
+
(class_specifier name: (type_identifier) @name) @definition.class
|
|
219
|
+
(struct_specifier name: (type_identifier) @name) @definition.struct
|
|
220
|
+
(namespace_definition name: (namespace_identifier) @name) @definition.namespace
|
|
221
|
+
(enum_specifier name: (type_identifier) @name) @definition.enum
|
|
222
|
+
|
|
223
|
+
; Functions & Methods
|
|
224
|
+
(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function
|
|
225
|
+
(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) @definition.method
|
|
226
|
+
|
|
227
|
+
; Templates
|
|
228
|
+
(template_declaration (class_specifier name: (type_identifier) @name)) @definition.template
|
|
229
|
+
(template_declaration (function_definition declarator: (function_declarator declarator: (identifier) @name))) @definition.template
|
|
230
|
+
|
|
231
|
+
; Includes
|
|
232
|
+
(preproc_include path: (_) @import.source) @import
|
|
233
|
+
|
|
234
|
+
; Calls
|
|
235
|
+
(call_expression function: (identifier) @call.name) @call
|
|
236
|
+
(call_expression function: (field_expression field: (field_identifier) @call.name)) @call
|
|
237
|
+
(call_expression function: (qualified_identifier name: (identifier) @call.name)) @call
|
|
238
|
+
(call_expression function: (template_function name: (identifier) @call.name)) @call
|
|
239
|
+
|
|
240
|
+
; Heritage
|
|
241
|
+
(class_specifier name: (type_identifier) @heritage.class
|
|
242
|
+
(base_class_clause (type_identifier) @heritage.extends)) @heritage
|
|
243
|
+
(class_specifier name: (type_identifier) @heritage.class
|
|
244
|
+
(base_class_clause (access_specifier) (type_identifier) @heritage.extends)) @heritage
|
|
245
245
|
`;
|
|
246
246
|
// C# queries - works with tree-sitter-c-sharp
|
|
247
|
-
export const CSHARP_QUERIES = `
|
|
248
|
-
; Types
|
|
249
|
-
(class_declaration name: (identifier) @name) @definition.class
|
|
250
|
-
(interface_declaration name: (identifier) @name) @definition.interface
|
|
251
|
-
(struct_declaration name: (identifier) @name) @definition.struct
|
|
252
|
-
(enum_declaration name: (identifier) @name) @definition.enum
|
|
253
|
-
(record_declaration name: (identifier) @name) @definition.record
|
|
254
|
-
(delegate_declaration name: (identifier) @name) @definition.delegate
|
|
255
|
-
|
|
256
|
-
; Namespaces
|
|
257
|
-
(namespace_declaration name: (identifier) @name) @definition.namespace
|
|
258
|
-
(namespace_declaration name: (qualified_name) @name) @definition.namespace
|
|
259
|
-
|
|
260
|
-
; Methods & Properties
|
|
261
|
-
(method_declaration name: (identifier) @name) @definition.method
|
|
262
|
-
(local_function_statement name: (identifier) @name) @definition.function
|
|
263
|
-
(constructor_declaration name: (identifier) @name) @definition.constructor
|
|
264
|
-
(property_declaration name: (identifier) @name) @definition.property
|
|
265
|
-
|
|
266
|
-
; Using
|
|
267
|
-
(using_directive (qualified_name) @import.source) @import
|
|
268
|
-
(using_directive (identifier) @import.source) @import
|
|
269
|
-
|
|
270
|
-
; Calls
|
|
271
|
-
(invocation_expression function: (identifier) @call.name) @call
|
|
272
|
-
(invocation_expression function: (member_access_expression name: (identifier) @call.name)) @call
|
|
273
|
-
|
|
274
|
-
; Heritage
|
|
275
|
-
(class_declaration name: (identifier) @heritage.class
|
|
276
|
-
(base_list (simple_base_type (identifier) @heritage.extends))) @heritage
|
|
277
|
-
(class_declaration name: (identifier) @heritage.class
|
|
278
|
-
(base_list (simple_base_type (generic_name (identifier) @heritage.extends)))) @heritage
|
|
247
|
+
export const CSHARP_QUERIES = `
|
|
248
|
+
; Types
|
|
249
|
+
(class_declaration name: (identifier) @name) @definition.class
|
|
250
|
+
(interface_declaration name: (identifier) @name) @definition.interface
|
|
251
|
+
(struct_declaration name: (identifier) @name) @definition.struct
|
|
252
|
+
(enum_declaration name: (identifier) @name) @definition.enum
|
|
253
|
+
(record_declaration name: (identifier) @name) @definition.record
|
|
254
|
+
(delegate_declaration name: (identifier) @name) @definition.delegate
|
|
255
|
+
|
|
256
|
+
; Namespaces
|
|
257
|
+
(namespace_declaration name: (identifier) @name) @definition.namespace
|
|
258
|
+
(namespace_declaration name: (qualified_name) @name) @definition.namespace
|
|
259
|
+
|
|
260
|
+
; Methods & Properties
|
|
261
|
+
(method_declaration name: (identifier) @name) @definition.method
|
|
262
|
+
(local_function_statement name: (identifier) @name) @definition.function
|
|
263
|
+
(constructor_declaration name: (identifier) @name) @definition.constructor
|
|
264
|
+
(property_declaration name: (identifier) @name) @definition.property
|
|
265
|
+
|
|
266
|
+
; Using
|
|
267
|
+
(using_directive (qualified_name) @import.source) @import
|
|
268
|
+
(using_directive (identifier) @import.source) @import
|
|
269
|
+
|
|
270
|
+
; Calls
|
|
271
|
+
(invocation_expression function: (identifier) @call.name) @call
|
|
272
|
+
(invocation_expression function: (member_access_expression name: (identifier) @call.name)) @call
|
|
273
|
+
|
|
274
|
+
; Heritage
|
|
275
|
+
(class_declaration name: (identifier) @heritage.class
|
|
276
|
+
(base_list (simple_base_type (identifier) @heritage.extends))) @heritage
|
|
277
|
+
(class_declaration name: (identifier) @heritage.class
|
|
278
|
+
(base_list (simple_base_type (generic_name (identifier) @heritage.extends)))) @heritage
|
|
279
279
|
`;
|
|
280
280
|
// Rust queries - works with tree-sitter-rust
|
|
281
|
-
export const RUST_QUERIES = `
|
|
282
|
-
; Functions & Items
|
|
283
|
-
(function_item name: (identifier) @name) @definition.function
|
|
284
|
-
(struct_item name: (type_identifier) @name) @definition.struct
|
|
285
|
-
(enum_item name: (type_identifier) @name) @definition.enum
|
|
286
|
-
(trait_item name: (type_identifier) @name) @definition.trait
|
|
287
|
-
(impl_item type: (type_identifier) @name) @definition.impl
|
|
288
|
-
(mod_item name: (identifier) @name) @definition.module
|
|
289
|
-
|
|
290
|
-
; Type aliases, const, static, macros
|
|
291
|
-
(type_item name: (type_identifier) @name) @definition.type
|
|
292
|
-
(const_item name: (identifier) @name) @definition.const
|
|
293
|
-
(static_item name: (identifier) @name) @definition.static
|
|
294
|
-
(macro_definition name: (identifier) @name) @definition.macro
|
|
295
|
-
|
|
296
|
-
; Use statements
|
|
297
|
-
(use_declaration argument: (_) @import.source) @import
|
|
298
|
-
|
|
299
|
-
; Calls
|
|
300
|
-
(call_expression function: (identifier) @call.name) @call
|
|
301
|
-
(call_expression function: (field_expression field: (field_identifier) @call.name)) @call
|
|
302
|
-
(call_expression function: (scoped_identifier name: (identifier) @call.name)) @call
|
|
303
|
-
(call_expression function: (generic_function function: (identifier) @call.name)) @call
|
|
304
|
-
|
|
305
|
-
; Heritage (trait implementation)
|
|
306
|
-
(impl_item trait: (type_identifier) @heritage.trait type: (type_identifier) @heritage.class) @heritage
|
|
307
|
-
(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (type_identifier) @heritage.class) @heritage
|
|
281
|
+
export const RUST_QUERIES = `
|
|
282
|
+
; Functions & Items
|
|
283
|
+
(function_item name: (identifier) @name) @definition.function
|
|
284
|
+
(struct_item name: (type_identifier) @name) @definition.struct
|
|
285
|
+
(enum_item name: (type_identifier) @name) @definition.enum
|
|
286
|
+
(trait_item name: (type_identifier) @name) @definition.trait
|
|
287
|
+
(impl_item type: (type_identifier) @name) @definition.impl
|
|
288
|
+
(mod_item name: (identifier) @name) @definition.module
|
|
289
|
+
|
|
290
|
+
; Type aliases, const, static, macros
|
|
291
|
+
(type_item name: (type_identifier) @name) @definition.type
|
|
292
|
+
(const_item name: (identifier) @name) @definition.const
|
|
293
|
+
(static_item name: (identifier) @name) @definition.static
|
|
294
|
+
(macro_definition name: (identifier) @name) @definition.macro
|
|
295
|
+
|
|
296
|
+
; Use statements
|
|
297
|
+
(use_declaration argument: (_) @import.source) @import
|
|
298
|
+
|
|
299
|
+
; Calls
|
|
300
|
+
(call_expression function: (identifier) @call.name) @call
|
|
301
|
+
(call_expression function: (field_expression field: (field_identifier) @call.name)) @call
|
|
302
|
+
(call_expression function: (scoped_identifier name: (identifier) @call.name)) @call
|
|
303
|
+
(call_expression function: (generic_function function: (identifier) @call.name)) @call
|
|
304
|
+
|
|
305
|
+
; Heritage (trait implementation)
|
|
306
|
+
(impl_item trait: (type_identifier) @heritage.trait type: (type_identifier) @heritage.class) @heritage
|
|
307
|
+
(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (type_identifier) @heritage.class) @heritage
|
|
308
308
|
`;
|
|
309
309
|
export const LANGUAGE_QUERIES = {
|
|
310
310
|
[SupportedLanguages.TypeScript]: TYPESCRIPT_QUERIES,
|
|
@@ -328,6 +328,9 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
330
|
for (const file of files) {
|
|
331
|
+
// Skip very large files — they can crash tree-sitter or cause OOM
|
|
332
|
+
if (file.content.length > 512 * 1024)
|
|
333
|
+
continue;
|
|
331
334
|
let tree;
|
|
332
335
|
try {
|
|
333
336
|
tree = parser.parse(file.content, undefined, { bufferSize: 1024 * 256 });
|
|
@@ -444,8 +447,14 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
444
447
|
// Worker message handler
|
|
445
448
|
// ============================================================================
|
|
446
449
|
parentPort.on('message', (files) => {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
450
|
+
try {
|
|
451
|
+
const result = processBatch(files, (filesProcessed) => {
|
|
452
|
+
parentPort.postMessage({ type: 'progress', filesProcessed });
|
|
453
|
+
});
|
|
454
|
+
parentPort.postMessage({ type: 'result', data: result });
|
|
455
|
+
}
|
|
456
|
+
catch (err) {
|
|
457
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
458
|
+
parentPort.postMessage({ type: 'error', error: message });
|
|
459
|
+
}
|
|
451
460
|
});
|