@esankhan3/anvil-knowledge-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +194 -0
- package/dist/__tests__/chunker.test.d.ts +10 -0
- package/dist/__tests__/chunker.test.d.ts.map +1 -0
- package/dist/__tests__/chunker.test.js +161 -0
- package/dist/__tests__/chunker.test.js.map +1 -0
- package/dist/__tests__/query-classifier.test.d.ts +5 -0
- package/dist/__tests__/query-classifier.test.d.ts.map +1 -0
- package/dist/__tests__/query-classifier.test.js +158 -0
- package/dist/__tests__/query-classifier.test.js.map +1 -0
- package/dist/__tests__/retriever-defaults.test.d.ts +12 -0
- package/dist/__tests__/retriever-defaults.test.d.ts.map +1 -0
- package/dist/__tests__/retriever-defaults.test.js +37 -0
- package/dist/__tests__/retriever-defaults.test.js.map +1 -0
- package/dist/__tests__/structural-hasher.test.d.ts +5 -0
- package/dist/__tests__/structural-hasher.test.d.ts.map +1 -0
- package/dist/__tests__/structural-hasher.test.js +185 -0
- package/dist/__tests__/structural-hasher.test.js.map +1 -0
- package/dist/ast-graph-builder.d.ts +38 -0
- package/dist/ast-graph-builder.d.ts.map +1 -0
- package/dist/ast-graph-builder.js +1041 -0
- package/dist/ast-graph-builder.js.map +1 -0
- package/dist/chunker.d.ts +47 -0
- package/dist/chunker.d.ts.map +1 -0
- package/dist/chunker.js +428 -0
- package/dist/chunker.js.map +1 -0
- package/dist/claude-runner.d.ts +10 -0
- package/dist/claude-runner.d.ts.map +1 -0
- package/dist/claude-runner.js +10 -0
- package/dist/claude-runner.js.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +83 -0
- package/dist/config.js.map +1 -0
- package/dist/cross-repo-detector.d.ts +7 -0
- package/dist/cross-repo-detector.d.ts.map +1 -0
- package/dist/cross-repo-detector.js +990 -0
- package/dist/cross-repo-detector.js.map +1 -0
- package/dist/embedder.d.ts +84 -0
- package/dist/embedder.d.ts.map +1 -0
- package/dist/embedder.js +378 -0
- package/dist/embedder.js.map +1 -0
- package/dist/file-walker.d.ts +18 -0
- package/dist/file-walker.d.ts.map +1 -0
- package/dist/file-walker.js +221 -0
- package/dist/file-walker.js.map +1 -0
- package/dist/git-diff.d.ts +32 -0
- package/dist/git-diff.d.ts.map +1 -0
- package/dist/git-diff.js +145 -0
- package/dist/git-diff.js.map +1 -0
- package/dist/graph-metrics.d.ts +31 -0
- package/dist/graph-metrics.d.ts.map +1 -0
- package/dist/graph-metrics.js +277 -0
- package/dist/graph-metrics.js.map +1 -0
- package/dist/graph-query.d.ts +8 -0
- package/dist/graph-query.d.ts.map +1 -0
- package/dist/graph-query.js +79 -0
- package/dist/graph-query.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer.d.ts +98 -0
- package/dist/indexer.d.ts.map +1 -0
- package/dist/indexer.js +635 -0
- package/dist/indexer.js.map +1 -0
- package/dist/project-graph-builder-core.d.ts +48 -0
- package/dist/project-graph-builder-core.d.ts.map +1 -0
- package/dist/project-graph-builder-core.js +213 -0
- package/dist/project-graph-builder-core.js.map +1 -0
- package/dist/project-graph-builder.d.ts +39 -0
- package/dist/project-graph-builder.d.ts.map +1 -0
- package/dist/project-graph-builder.js +640 -0
- package/dist/project-graph-builder.js.map +1 -0
- package/dist/query-classifier.d.ts +38 -0
- package/dist/query-classifier.d.ts.map +1 -0
- package/dist/query-classifier.js +199 -0
- package/dist/query-classifier.js.map +1 -0
- package/dist/query-router.d.ts +82 -0
- package/dist/query-router.d.ts.map +1 -0
- package/dist/query-router.js +278 -0
- package/dist/query-router.js.map +1 -0
- package/dist/rag-evaluator.d.ts +53 -0
- package/dist/rag-evaluator.d.ts.map +1 -0
- package/dist/rag-evaluator.js +217 -0
- package/dist/rag-evaluator.js.map +1 -0
- package/dist/repo-profiler.d.ts +62 -0
- package/dist/repo-profiler.d.ts.map +1 -0
- package/dist/repo-profiler.js +488 -0
- package/dist/repo-profiler.js.map +1 -0
- package/dist/reranker.d.ts +8 -0
- package/dist/reranker.d.ts.map +1 -0
- package/dist/reranker.js +250 -0
- package/dist/reranker.js.map +1 -0
- package/dist/retriever.d.ts +42 -0
- package/dist/retriever.d.ts.map +1 -0
- package/dist/retriever.js +320 -0
- package/dist/retriever.js.map +1 -0
- package/dist/semantic-edge-detector.d.ts +28 -0
- package/dist/semantic-edge-detector.d.ts.map +1 -0
- package/dist/semantic-edge-detector.js +191 -0
- package/dist/semantic-edge-detector.js.map +1 -0
- package/dist/service-mesh-inferrer.d.ts +57 -0
- package/dist/service-mesh-inferrer.d.ts.map +1 -0
- package/dist/service-mesh-inferrer.js +322 -0
- package/dist/service-mesh-inferrer.js.map +1 -0
- package/dist/structural-hasher.d.ts +57 -0
- package/dist/structural-hasher.d.ts.map +1 -0
- package/dist/structural-hasher.js +350 -0
- package/dist/structural-hasher.js.map +1 -0
- package/dist/tree-sitter-parser.d.ts +71 -0
- package/dist/tree-sitter-parser.d.ts.map +1 -0
- package/dist/tree-sitter-parser.js +633 -0
- package/dist/tree-sitter-parser.js.map +1 -0
- package/dist/types.d.ts +179 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/vector-store.d.ts +56 -0
- package/dist/vector-store.d.ts.map +1 -0
- package/dist/vector-store.js +299 -0
- package/dist/vector-store.js.map +1 -0
- package/dist/workspace-detector.d.ts +11 -0
- package/dist/workspace-detector.d.ts.map +1 -0
- package/dist/workspace-detector.js +587 -0
- package/dist/workspace-detector.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree-sitter AST parser — compiler-accurate entity extraction.
|
|
3
|
+
*
|
|
4
|
+
* Real AST parsing via web-tree-sitter (WASM). Supports TypeScript,
|
|
5
|
+
* JavaScript, TSX, Go, Python, Rust, Java, and PHP.
|
|
6
|
+
*/
|
|
7
|
+
import { Parser as TSParser, Language as TSLanguage, Query as TSQuery } from 'web-tree-sitter';
|
|
8
|
+
import { createHash } from 'node:crypto';
|
|
9
|
+
import { createRequire } from 'node:module';
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Grammar map and singleton state
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
const GRAMMAR_MAP = {
|
|
15
|
+
typescript: 'tree-sitter-typescript.wasm',
|
|
16
|
+
javascript: 'tree-sitter-javascript.wasm',
|
|
17
|
+
tsx: 'tree-sitter-tsx.wasm',
|
|
18
|
+
go: 'tree-sitter-go.wasm',
|
|
19
|
+
python: 'tree-sitter-python.wasm',
|
|
20
|
+
rust: 'tree-sitter-rust.wasm',
|
|
21
|
+
java: 'tree-sitter-java.wasm',
|
|
22
|
+
php: 'tree-sitter-php.wasm',
|
|
23
|
+
};
|
|
24
|
+
let parserReady = false;
|
|
25
|
+
const languageParsers = new Map();
|
|
26
|
+
/** Initialize the Tree-sitter WASM runtime. Must be called before parsing. */
|
|
27
|
+
export async function initTreeSitter() {
|
|
28
|
+
if (parserReady)
|
|
29
|
+
return;
|
|
30
|
+
await TSParser.init();
|
|
31
|
+
parserReady = true;
|
|
32
|
+
}
|
|
33
|
+
async function getParserAndLang(language) {
|
|
34
|
+
if (languageParsers.has(language))
|
|
35
|
+
return languageParsers.get(language);
|
|
36
|
+
const wasmFile = GRAMMAR_MAP[language];
|
|
37
|
+
if (!wasmFile)
|
|
38
|
+
return null;
|
|
39
|
+
try {
|
|
40
|
+
const wasmPath = require.resolve(`tree-sitter-wasms/out/${wasmFile}`);
|
|
41
|
+
const lang = await TSLanguage.load(wasmPath);
|
|
42
|
+
const parser = new TSParser();
|
|
43
|
+
parser.setLanguage(lang);
|
|
44
|
+
const entry = { parser, lang };
|
|
45
|
+
languageParsers.set(language, entry);
|
|
46
|
+
return entry;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const TS_QUERIES = {
|
|
53
|
+
entities: `
|
|
54
|
+
(function_declaration name: (identifier) @name) @entity
|
|
55
|
+
(class_declaration name: (type_identifier) @name) @entity
|
|
56
|
+
(interface_declaration name: (type_identifier) @name) @entity
|
|
57
|
+
(type_alias_declaration name: (type_identifier) @name) @entity
|
|
58
|
+
(enum_declaration name: (identifier) @name) @entity
|
|
59
|
+
(method_definition name: (property_identifier) @name) @entity
|
|
60
|
+
(export_statement declaration: (function_declaration name: (identifier) @name) @entity) @export
|
|
61
|
+
(export_statement declaration: (class_declaration name: (type_identifier) @name) @entity) @export
|
|
62
|
+
(export_statement declaration: (interface_declaration name: (type_identifier) @name) @entity) @export
|
|
63
|
+
(export_statement declaration: (type_alias_declaration name: (type_identifier) @name) @entity) @export
|
|
64
|
+
(export_statement declaration: (enum_declaration name: (identifier) @name) @entity) @export
|
|
65
|
+
(export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name value: (arrow_function) @entity))) @export
|
|
66
|
+
`,
|
|
67
|
+
imports: `
|
|
68
|
+
(import_statement source: (string) @source) @import
|
|
69
|
+
`,
|
|
70
|
+
calls: `
|
|
71
|
+
(call_expression function: (identifier) @callee) @call
|
|
72
|
+
(call_expression function: (member_expression property: (property_identifier) @callee)) @call
|
|
73
|
+
`,
|
|
74
|
+
};
|
|
75
|
+
const GO_QUERIES = {
|
|
76
|
+
entities: `
|
|
77
|
+
(function_declaration name: (identifier) @name) @entity
|
|
78
|
+
(method_declaration name: (field_identifier) @name) @entity
|
|
79
|
+
(type_declaration (type_spec name: (type_identifier) @name type: (struct_type))) @entity
|
|
80
|
+
(type_declaration (type_spec name: (type_identifier) @name type: (interface_type))) @entity
|
|
81
|
+
`,
|
|
82
|
+
imports: `
|
|
83
|
+
(import_spec path: (interpreted_string_literal) @source) @import
|
|
84
|
+
`,
|
|
85
|
+
calls: `
|
|
86
|
+
(call_expression function: (identifier) @callee) @call
|
|
87
|
+
(call_expression function: (selector_expression field: (field_identifier) @callee)) @call
|
|
88
|
+
`,
|
|
89
|
+
};
|
|
90
|
+
const PY_QUERIES = {
|
|
91
|
+
entities: `
|
|
92
|
+
(function_definition name: (identifier) @name) @entity
|
|
93
|
+
(class_definition name: (identifier) @name) @entity
|
|
94
|
+
`,
|
|
95
|
+
imports: `
|
|
96
|
+
(import_from_statement module_name: (dotted_name) @source) @import
|
|
97
|
+
(import_statement name: (dotted_name) @source) @import
|
|
98
|
+
`,
|
|
99
|
+
calls: `
|
|
100
|
+
(call function: (identifier) @callee) @call
|
|
101
|
+
(call function: (attribute attribute: (identifier) @callee)) @call
|
|
102
|
+
`,
|
|
103
|
+
};
|
|
104
|
+
const RUST_QUERIES = {
|
|
105
|
+
entities: `
|
|
106
|
+
(function_item name: (identifier) @name) @entity
|
|
107
|
+
(struct_item name: (type_identifier) @name) @entity
|
|
108
|
+
(impl_item type: (type_identifier) @name) @entity
|
|
109
|
+
(trait_item name: (type_identifier) @name) @entity
|
|
110
|
+
(enum_item name: (type_identifier) @name) @entity
|
|
111
|
+
`,
|
|
112
|
+
imports: `
|
|
113
|
+
(use_declaration argument: (scoped_identifier) @source) @import
|
|
114
|
+
`,
|
|
115
|
+
calls: `
|
|
116
|
+
(call_expression function: (identifier) @callee) @call
|
|
117
|
+
(call_expression function: (field_expression field: (field_identifier) @callee)) @call
|
|
118
|
+
`,
|
|
119
|
+
};
|
|
120
|
+
const JAVA_QUERIES = {
|
|
121
|
+
entities: `
|
|
122
|
+
(class_declaration name: (identifier) @name) @entity
|
|
123
|
+
(interface_declaration name: (identifier) @name) @entity
|
|
124
|
+
(method_declaration name: (identifier) @name) @entity
|
|
125
|
+
(enum_declaration name: (identifier) @name) @entity
|
|
126
|
+
`,
|
|
127
|
+
imports: `
|
|
128
|
+
(import_declaration (scoped_identifier) @source) @import
|
|
129
|
+
`,
|
|
130
|
+
calls: `
|
|
131
|
+
(method_invocation name: (identifier) @callee) @call
|
|
132
|
+
`,
|
|
133
|
+
};
|
|
134
|
+
const PHP_QUERIES = {
|
|
135
|
+
entities: `
|
|
136
|
+
(function_definition name: (name) @name) @entity
|
|
137
|
+
(class_declaration name: (name) @name) @entity
|
|
138
|
+
(method_declaration name: (name) @name) @entity
|
|
139
|
+
(interface_declaration name: (name) @name) @entity
|
|
140
|
+
(trait_declaration name: (name) @name) @entity
|
|
141
|
+
`,
|
|
142
|
+
imports: `
|
|
143
|
+
(namespace_use_declaration (namespace_use_clause (qualified_name) @source)) @import
|
|
144
|
+
`,
|
|
145
|
+
calls: `
|
|
146
|
+
(function_call_expression function: (name) @callee) @call
|
|
147
|
+
(member_call_expression name: (name) @callee) @call
|
|
148
|
+
`,
|
|
149
|
+
};
|
|
150
|
+
function queriesForLanguage(language) {
|
|
151
|
+
switch (language) {
|
|
152
|
+
case 'typescript':
|
|
153
|
+
case 'javascript':
|
|
154
|
+
case 'tsx':
|
|
155
|
+
return TS_QUERIES;
|
|
156
|
+
case 'go':
|
|
157
|
+
return GO_QUERIES;
|
|
158
|
+
case 'python':
|
|
159
|
+
return PY_QUERIES;
|
|
160
|
+
case 'rust':
|
|
161
|
+
return RUST_QUERIES;
|
|
162
|
+
case 'java':
|
|
163
|
+
return JAVA_QUERIES;
|
|
164
|
+
case 'php':
|
|
165
|
+
return PHP_QUERIES;
|
|
166
|
+
default:
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const NODE_TYPE_TO_ENTITY = {
|
|
171
|
+
// TypeScript / JavaScript
|
|
172
|
+
function_declaration: 'function',
|
|
173
|
+
arrow_function: 'function',
|
|
174
|
+
class_declaration: 'class',
|
|
175
|
+
method_definition: 'method',
|
|
176
|
+
interface_declaration: 'interface',
|
|
177
|
+
type_alias_declaration: 'type',
|
|
178
|
+
enum_declaration: 'enum',
|
|
179
|
+
// Python
|
|
180
|
+
function_definition: 'function',
|
|
181
|
+
class_definition: 'class',
|
|
182
|
+
// Go (type_spec handled separately via child type)
|
|
183
|
+
// Rust
|
|
184
|
+
function_item: 'function',
|
|
185
|
+
struct_item: 'struct',
|
|
186
|
+
impl_item: 'module', // impl blocks act as module-level grouping
|
|
187
|
+
trait_item: 'trait',
|
|
188
|
+
enum_item: 'enum',
|
|
189
|
+
// Java
|
|
190
|
+
method_declaration: 'method',
|
|
191
|
+
// PHP (uses same names as TS for class/interface + 'trait_declaration')
|
|
192
|
+
function_definition_php: 'function',
|
|
193
|
+
trait_declaration: 'trait',
|
|
194
|
+
};
|
|
195
|
+
function detectEntityType(node, _language) {
|
|
196
|
+
const t = node.type;
|
|
197
|
+
// Direct mapping
|
|
198
|
+
const mapped = NODE_TYPE_TO_ENTITY[t];
|
|
199
|
+
if (mapped)
|
|
200
|
+
return mapped;
|
|
201
|
+
// Go: type_declaration wrapping type_spec
|
|
202
|
+
if (t === 'type_declaration' || t === 'type_spec') {
|
|
203
|
+
const spec = t === 'type_declaration' ? node.namedChildren.find((c) => c.type === 'type_spec') : node;
|
|
204
|
+
if (spec) {
|
|
205
|
+
const typeChild = spec.namedChildren.find((c) => c.type === 'struct_type' || c.type === 'interface_type');
|
|
206
|
+
if (typeChild?.type === 'struct_type')
|
|
207
|
+
return 'struct';
|
|
208
|
+
if (typeChild?.type === 'interface_type')
|
|
209
|
+
return 'interface';
|
|
210
|
+
}
|
|
211
|
+
return 'type';
|
|
212
|
+
}
|
|
213
|
+
// Fallback heuristic based on language
|
|
214
|
+
if (t.includes('class'))
|
|
215
|
+
return 'class';
|
|
216
|
+
if (t.includes('interface'))
|
|
217
|
+
return 'interface';
|
|
218
|
+
if (t.includes('method'))
|
|
219
|
+
return 'method';
|
|
220
|
+
if (t.includes('function') || t.includes('func'))
|
|
221
|
+
return 'function';
|
|
222
|
+
if (t.includes('struct'))
|
|
223
|
+
return 'struct';
|
|
224
|
+
if (t.includes('enum'))
|
|
225
|
+
return 'enum';
|
|
226
|
+
if (t.includes('trait'))
|
|
227
|
+
return 'trait';
|
|
228
|
+
return 'function'; // safe default
|
|
229
|
+
}
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
// Export detection
|
|
232
|
+
// ---------------------------------------------------------------------------
|
|
233
|
+
function isExported(entityNode, language, content) {
|
|
234
|
+
// TS/JS: parent is export_statement
|
|
235
|
+
if (language === 'typescript' || language === 'javascript' || language === 'tsx') {
|
|
236
|
+
let cursor = entityNode.parent;
|
|
237
|
+
while (cursor) {
|
|
238
|
+
if (cursor.type === 'export_statement')
|
|
239
|
+
return true;
|
|
240
|
+
cursor = cursor.parent;
|
|
241
|
+
}
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
// Rust: starts with 'pub'
|
|
245
|
+
if (language === 'rust') {
|
|
246
|
+
const text = content.slice(entityNode.startIndex, entityNode.startIndex + 10);
|
|
247
|
+
return text.trimStart().startsWith('pub');
|
|
248
|
+
}
|
|
249
|
+
// Go: exported if name starts with uppercase
|
|
250
|
+
if (language === 'go') {
|
|
251
|
+
const nameChild = entityNode.namedChildren.find((c) => c.type === 'identifier' || c.type === 'type_identifier' || c.type === 'field_identifier');
|
|
252
|
+
if (nameChild) {
|
|
253
|
+
const name = nameChild.text;
|
|
254
|
+
return name.length > 0 && name[0] === name[0].toUpperCase() && name[0] !== name[0].toLowerCase();
|
|
255
|
+
}
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
// Java: check for 'public' modifier
|
|
259
|
+
if (language === 'java') {
|
|
260
|
+
const modifiers = entityNode.namedChildren.find((c) => c.type === 'modifiers');
|
|
261
|
+
if (modifiers)
|
|
262
|
+
return modifiers.text.includes('public');
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
// Python/PHP: no export concept — treat all top-level as exported
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
// ---------------------------------------------------------------------------
|
|
269
|
+
// Containing entity (parent class/struct)
|
|
270
|
+
// ---------------------------------------------------------------------------
|
|
271
|
+
function findContainingEntity(node) {
|
|
272
|
+
let cursor = node.parent;
|
|
273
|
+
while (cursor) {
|
|
274
|
+
const t = cursor.type;
|
|
275
|
+
if (t === 'class_declaration' || t === 'class_definition' || t === 'class_body' ||
|
|
276
|
+
t === 'impl_item' || t === 'struct_item' || t === 'trait_item' ||
|
|
277
|
+
t === 'interface_declaration' || t === 'trait_declaration') {
|
|
278
|
+
// If we landed on class_body, go up one more to the declaration
|
|
279
|
+
const target = t === 'class_body' && cursor.parent ? cursor.parent : cursor;
|
|
280
|
+
const nameChild = target.namedChildren.find((c) => c.type === 'identifier' || c.type === 'type_identifier' || c.type === 'name');
|
|
281
|
+
if (nameChild)
|
|
282
|
+
return nameChild.text;
|
|
283
|
+
}
|
|
284
|
+
cursor = cursor.parent;
|
|
285
|
+
}
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
// ---------------------------------------------------------------------------
|
|
289
|
+
// Signature extraction
|
|
290
|
+
// ---------------------------------------------------------------------------
|
|
291
|
+
function extractSignature(entityNode, entityType, _content) {
|
|
292
|
+
if (entityType !== 'function' && entityType !== 'method')
|
|
293
|
+
return undefined;
|
|
294
|
+
// Find the parameters node
|
|
295
|
+
const params = entityNode.namedChildren.find((c) => c.type === 'formal_parameters' || c.type === 'parameters' ||
|
|
296
|
+
c.type === 'parameter_list' || c.type === 'typed_parameters');
|
|
297
|
+
// Find return type annotation if present
|
|
298
|
+
const returnType = entityNode.namedChildren.find((c) => c.type === 'type_annotation' || c.type === 'return_type');
|
|
299
|
+
if (!params)
|
|
300
|
+
return undefined;
|
|
301
|
+
let sig = params.text;
|
|
302
|
+
if (returnType)
|
|
303
|
+
sig += `: ${returnType.text}`;
|
|
304
|
+
return sig;
|
|
305
|
+
}
|
|
306
|
+
// ---------------------------------------------------------------------------
|
|
307
|
+
// Query execution with fallback
|
|
308
|
+
// ---------------------------------------------------------------------------
|
|
309
|
+
function runQuery(language, querySource, rootNode) {
|
|
310
|
+
try {
|
|
311
|
+
const query = new TSQuery(language, querySource);
|
|
312
|
+
return query.matches(rootNode);
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
// Query syntax mismatch for this grammar version — return empty
|
|
316
|
+
return [];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Try running a query. If the full query fails (some patterns may not match
|
|
321
|
+
* this grammar), try each pattern individually and collect what works.
|
|
322
|
+
*/
|
|
323
|
+
function runQueryWithFallback(language, querySource, rootNode) {
|
|
324
|
+
const fullResult = runQuery(language, querySource, rootNode);
|
|
325
|
+
if (fullResult.length > 0)
|
|
326
|
+
return fullResult;
|
|
327
|
+
// Split into individual patterns and try each
|
|
328
|
+
const patterns = querySource
|
|
329
|
+
.split('\n')
|
|
330
|
+
.map((l) => l.trim())
|
|
331
|
+
.filter((l) => l.startsWith('('));
|
|
332
|
+
const results = [];
|
|
333
|
+
for (const pattern of patterns) {
|
|
334
|
+
try {
|
|
335
|
+
const q = new TSQuery(language, pattern);
|
|
336
|
+
results.push(...q.matches(rootNode));
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
// This specific pattern doesn't work with this grammar — skip
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return results;
|
|
343
|
+
}
|
|
344
|
+
// ---------------------------------------------------------------------------
|
|
345
|
+
// Import parsing helpers
|
|
346
|
+
// ---------------------------------------------------------------------------
|
|
347
|
+
function parseImportMatches(matches, language, _content, _rootNode) {
|
|
348
|
+
const imports = [];
|
|
349
|
+
for (const match of matches) {
|
|
350
|
+
const sourceCapture = match.captures.find((c) => c.name === 'source');
|
|
351
|
+
const importCapture = match.captures.find((c) => c.name === 'import');
|
|
352
|
+
if (!sourceCapture)
|
|
353
|
+
continue;
|
|
354
|
+
// Strip quotes from source
|
|
355
|
+
let source = sourceCapture.node.text.replace(/^['"`]|['"`]$/g, '');
|
|
356
|
+
const startLine = (importCapture ?? sourceCapture).node.startPosition.row;
|
|
357
|
+
const isRelative = source.startsWith('./') || source.startsWith('../');
|
|
358
|
+
// Extract named imports for TS/JS
|
|
359
|
+
const names = [];
|
|
360
|
+
if (language === 'typescript' || language === 'javascript' || language === 'tsx') {
|
|
361
|
+
const importNode = importCapture?.node ?? sourceCapture.node.parent;
|
|
362
|
+
if (importNode) {
|
|
363
|
+
// Walk the import statement for import_clause → named_imports
|
|
364
|
+
const walk = (n) => {
|
|
365
|
+
if (n.type === 'import_specifier') {
|
|
366
|
+
const nameNode = n.namedChildren.find((c) => c.type === 'identifier');
|
|
367
|
+
if (nameNode)
|
|
368
|
+
names.push(nameNode.text);
|
|
369
|
+
}
|
|
370
|
+
if (n.type === 'identifier' && n.parent?.type === 'import_clause') {
|
|
371
|
+
names.push(n.text); // default import
|
|
372
|
+
}
|
|
373
|
+
for (const child of n.namedChildren)
|
|
374
|
+
walk(child);
|
|
375
|
+
};
|
|
376
|
+
walk(importNode);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
// Python: extract names from import_from_statement
|
|
380
|
+
if (language === 'python') {
|
|
381
|
+
const importNode = importCapture?.node ?? sourceCapture.node.parent;
|
|
382
|
+
if (importNode && importNode.type === 'import_from_statement') {
|
|
383
|
+
for (const child of importNode.namedChildren) {
|
|
384
|
+
if (child.type === 'dotted_name' && child !== sourceCapture.node) {
|
|
385
|
+
names.push(child.text);
|
|
386
|
+
}
|
|
387
|
+
if (child.type === 'aliased_import') {
|
|
388
|
+
const nameNode = child.namedChildren.find((c) => c.type === 'dotted_name');
|
|
389
|
+
if (nameNode)
|
|
390
|
+
names.push(nameNode.text);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
imports.push({ source, names, startLine, isRelative });
|
|
396
|
+
}
|
|
397
|
+
return imports;
|
|
398
|
+
}
|
|
399
|
+
// ---------------------------------------------------------------------------
|
|
400
|
+
// Call site parsing
|
|
401
|
+
// ---------------------------------------------------------------------------
|
|
402
|
+
function parseCallMatches(matches, entities) {
|
|
403
|
+
const callSites = [];
|
|
404
|
+
for (const match of matches) {
|
|
405
|
+
const calleeCapture = match.captures.find((c) => c.name === 'callee');
|
|
406
|
+
if (!calleeCapture)
|
|
407
|
+
continue;
|
|
408
|
+
const callee = calleeCapture.node.text;
|
|
409
|
+
const startLine = calleeCapture.node.startPosition.row;
|
|
410
|
+
// Find containing entity by line range
|
|
411
|
+
const containingEntity = entities.find((e) => startLine >= e.startLine && startLine <= e.endLine)?.name;
|
|
412
|
+
callSites.push({ callee, startLine, containingEntity });
|
|
413
|
+
}
|
|
414
|
+
return callSites;
|
|
415
|
+
}
|
|
416
|
+
// ---------------------------------------------------------------------------
|
|
417
|
+
// Type reference extraction
|
|
418
|
+
// ---------------------------------------------------------------------------
|
|
419
|
+
function extractTypeReferences(entities) {
|
|
420
|
+
const typeRefs = new Set();
|
|
421
|
+
// Match PascalCase identifiers in signatures that look like type references
|
|
422
|
+
const typeRefPattern = /(?<!['"@/\\])\b([A-Z][A-Za-z0-9]*(?:<[^>]+>)?)\b/g;
|
|
423
|
+
for (const entity of entities) {
|
|
424
|
+
if (entity.signature) {
|
|
425
|
+
let m;
|
|
426
|
+
while ((m = typeRefPattern.exec(entity.signature)) !== null) {
|
|
427
|
+
const ref = m[1].replace(/<.*>$/, ''); // strip generics
|
|
428
|
+
if (!BUILTIN_TYPES.has(ref))
|
|
429
|
+
typeRefs.add(ref);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return [...typeRefs];
|
|
434
|
+
}
|
|
435
|
+
const BUILTIN_TYPES = new Set([
|
|
436
|
+
'String', 'Number', 'Boolean', 'Object', 'Array', 'Function', 'Symbol',
|
|
437
|
+
'Promise', 'Map', 'Set', 'WeakMap', 'WeakSet', 'Date', 'RegExp', 'Error',
|
|
438
|
+
'Record', 'Partial', 'Required', 'Readonly', 'Pick', 'Omit', 'Exclude',
|
|
439
|
+
'Extract', 'NonNullable', 'ReturnType', 'Parameters', 'InstanceType',
|
|
440
|
+
'Awaited', 'Uint8Array', 'Int32Array', 'Float64Array', 'ArrayBuffer',
|
|
441
|
+
'Iterator', 'AsyncIterator', 'Generator', 'AsyncGenerator',
|
|
442
|
+
]);
|
|
443
|
+
// ---------------------------------------------------------------------------
|
|
444
|
+
// Main parse function
|
|
445
|
+
// ---------------------------------------------------------------------------
|
|
446
|
+
/**
|
|
447
|
+
* Parse a single source file using Tree-sitter AST parsing.
|
|
448
|
+
*
|
|
449
|
+
* Returns null for unsupported languages or parse failures.
|
|
450
|
+
*/
|
|
451
|
+
export async function parseFile(filePath, content, language) {
|
|
452
|
+
await initTreeSitter();
|
|
453
|
+
const parserEntry = await getParserAndLang(language);
|
|
454
|
+
if (!parserEntry)
|
|
455
|
+
return null;
|
|
456
|
+
const queries = queriesForLanguage(language);
|
|
457
|
+
if (!queries)
|
|
458
|
+
return null;
|
|
459
|
+
let tree;
|
|
460
|
+
try {
|
|
461
|
+
tree = parserEntry.parser.parse(content);
|
|
462
|
+
}
|
|
463
|
+
catch {
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
if (!tree)
|
|
467
|
+
return null;
|
|
468
|
+
const rootNode = tree.rootNode;
|
|
469
|
+
const lang = parserEntry.lang;
|
|
470
|
+
// --- Entities ---
|
|
471
|
+
const entityMatches = runQueryWithFallback(lang, queries.entities, rootNode);
|
|
472
|
+
const entities = [];
|
|
473
|
+
const seenEntityKeys = new Set();
|
|
474
|
+
for (const match of entityMatches) {
|
|
475
|
+
const nameCapture = match.captures.find((c) => c.name === 'name');
|
|
476
|
+
const entityCapture = match.captures.find((c) => c.name === 'entity');
|
|
477
|
+
if (!nameCapture || !entityCapture)
|
|
478
|
+
continue;
|
|
479
|
+
const entityNode = entityCapture.node;
|
|
480
|
+
const name = nameCapture.node.text;
|
|
481
|
+
const type = detectEntityType(entityNode, language);
|
|
482
|
+
const startLine = entityNode.startPosition.row;
|
|
483
|
+
const endLine = entityNode.endPosition.row;
|
|
484
|
+
// Deduplicate: same name + same start line means a duplicate match
|
|
485
|
+
// (e.g., both the bare function and the export_statement match)
|
|
486
|
+
const key = `${name}:${startLine}`;
|
|
487
|
+
if (seenEntityKeys.has(key)) {
|
|
488
|
+
// If the existing entity is not marked exported but this match has
|
|
489
|
+
// an @export capture, update the existing entity
|
|
490
|
+
const existing = entities.find((e) => e.name === name && e.startLine === startLine);
|
|
491
|
+
const hasExportCapture = match.captures.some((c) => c.name === 'export');
|
|
492
|
+
if (existing && hasExportCapture) {
|
|
493
|
+
existing.isExported = true;
|
|
494
|
+
}
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
seenEntityKeys.add(key);
|
|
498
|
+
const hasExportCapture = match.captures.some((c) => c.name === 'export');
|
|
499
|
+
const exported = hasExportCapture || isExported(entityNode, language, content);
|
|
500
|
+
const parentName = type === 'method' ? findContainingEntity(entityNode) : undefined;
|
|
501
|
+
const signature = extractSignature(entityNode, type, content);
|
|
502
|
+
const body = content.slice(entityNode.startIndex, entityNode.endIndex);
|
|
503
|
+
entities.push({
|
|
504
|
+
name,
|
|
505
|
+
type,
|
|
506
|
+
startLine,
|
|
507
|
+
endLine,
|
|
508
|
+
startByte: entityNode.startIndex,
|
|
509
|
+
endByte: entityNode.endIndex,
|
|
510
|
+
parent: parentName,
|
|
511
|
+
signature,
|
|
512
|
+
isExported: exported,
|
|
513
|
+
body,
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
// --- Imports ---
|
|
517
|
+
const importMatches = runQueryWithFallback(lang, queries.imports, rootNode);
|
|
518
|
+
const imports = parseImportMatches(importMatches, language, content, rootNode);
|
|
519
|
+
// --- Call sites ---
|
|
520
|
+
const callMatches = runQueryWithFallback(lang, queries.calls, rootNode);
|
|
521
|
+
const callSites = parseCallMatches(callMatches, entities);
|
|
522
|
+
// --- Type references ---
|
|
523
|
+
const typeReferences = extractTypeReferences(entities);
|
|
524
|
+
tree.delete();
|
|
525
|
+
return {
|
|
526
|
+
filePath,
|
|
527
|
+
language,
|
|
528
|
+
entities,
|
|
529
|
+
imports,
|
|
530
|
+
callSites,
|
|
531
|
+
typeReferences,
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
// ---------------------------------------------------------------------------
|
|
535
|
+
// Batch parse
|
|
536
|
+
// ---------------------------------------------------------------------------
|
|
537
|
+
/**
|
|
538
|
+
* Parse multiple files, initializing Tree-sitter once.
|
|
539
|
+
* Returns results for all files that parsed successfully (failures are skipped).
|
|
540
|
+
*/
|
|
541
|
+
export async function parseFiles(files) {
|
|
542
|
+
await initTreeSitter();
|
|
543
|
+
const results = [];
|
|
544
|
+
for (const file of files) {
|
|
545
|
+
const result = await parseFile(file.path, file.content, file.language);
|
|
546
|
+
if (result)
|
|
547
|
+
results.push(result);
|
|
548
|
+
}
|
|
549
|
+
return results;
|
|
550
|
+
}
|
|
551
|
+
// ---------------------------------------------------------------------------
|
|
552
|
+
// Structural hash (WS-6 foundation)
|
|
553
|
+
// ---------------------------------------------------------------------------
|
|
554
|
+
/**
|
|
555
|
+
* Compute a structural hash of an entity's AST subtree.
|
|
556
|
+
*
|
|
557
|
+
* Two functions with identical logic but different variable names produce the
|
|
558
|
+
* same hash. This is used by WS-6 for deduplication.
|
|
559
|
+
*
|
|
560
|
+
* The algorithm:
|
|
561
|
+
* 1. Parse the entity body into an AST
|
|
562
|
+
* 2. Walk the tree, collecting node types (skip comments and whitespace)
|
|
563
|
+
* 3. Normalize identifier names to positional tokens (v0, v1, v2...)
|
|
564
|
+
* 4. Build a canonical string representation
|
|
565
|
+
* 5. SHA256 hash it
|
|
566
|
+
*/
|
|
567
|
+
export async function computeStructuralHash(_content, entity, language) {
|
|
568
|
+
await initTreeSitter();
|
|
569
|
+
const parserEntry = await getParserAndLang(language);
|
|
570
|
+
if (!parserEntry)
|
|
571
|
+
return null;
|
|
572
|
+
let tree;
|
|
573
|
+
try {
|
|
574
|
+
tree = parserEntry.parser.parse(entity.body);
|
|
575
|
+
}
|
|
576
|
+
catch {
|
|
577
|
+
return null;
|
|
578
|
+
}
|
|
579
|
+
if (!tree)
|
|
580
|
+
return null;
|
|
581
|
+
const identifierMap = new Map();
|
|
582
|
+
let identifierCounter = 0;
|
|
583
|
+
const tokens = [];
|
|
584
|
+
const SKIP_TYPES = new Set([
|
|
585
|
+
'comment', 'line_comment', 'block_comment', 'doc_comment',
|
|
586
|
+
// Whitespace nodes are typically not named, but include for safety
|
|
587
|
+
]);
|
|
588
|
+
const IDENTIFIER_TYPES = new Set([
|
|
589
|
+
'identifier', 'type_identifier', 'property_identifier',
|
|
590
|
+
'field_identifier', 'shorthand_field_identifier',
|
|
591
|
+
'name', 'dotted_name',
|
|
592
|
+
]);
|
|
593
|
+
function walk(node) {
|
|
594
|
+
// Skip comments
|
|
595
|
+
if (SKIP_TYPES.has(node.type))
|
|
596
|
+
return;
|
|
597
|
+
if (node.namedChildCount === 0) {
|
|
598
|
+
// Leaf node
|
|
599
|
+
if (IDENTIFIER_TYPES.has(node.type)) {
|
|
600
|
+
// Normalize identifiers to positional tokens
|
|
601
|
+
const text = node.text;
|
|
602
|
+
if (!identifierMap.has(text)) {
|
|
603
|
+
identifierMap.set(text, `v${identifierCounter++}`);
|
|
604
|
+
}
|
|
605
|
+
tokens.push(`${node.type}:${identifierMap.get(text)}`);
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
// Literals, keywords, operators — keep node type + text
|
|
609
|
+
tokens.push(`${node.type}:${node.text}`);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
// Internal node — record structure
|
|
614
|
+
tokens.push(`(${node.type}`);
|
|
615
|
+
for (const child of node.namedChildren) {
|
|
616
|
+
walk(child);
|
|
617
|
+
}
|
|
618
|
+
tokens.push(')');
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
walk(tree.rootNode);
|
|
622
|
+
tree.delete();
|
|
623
|
+
const canonical = tokens.join(' ');
|
|
624
|
+
return createHash('sha256').update(canonical).digest('hex');
|
|
625
|
+
}
|
|
626
|
+
// ---------------------------------------------------------------------------
|
|
627
|
+
// Supported languages query
|
|
628
|
+
// ---------------------------------------------------------------------------
|
|
629
|
+
/** Returns the list of languages supported by the Tree-sitter parser. */
|
|
630
|
+
export function supportedLanguages() {
|
|
631
|
+
return Object.keys(GRAMMAR_MAP);
|
|
632
|
+
}
|
|
633
|
+
//# sourceMappingURL=tree-sitter-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-sitter-parser.js","sourceRoot":"","sources":["../src/tree-sitter-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,QAAQ,IAAI,UAAU,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAyC/C,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E,MAAM,WAAW,GAA2B;IAC1C,UAAU,EAAE,6BAA6B;IACzC,UAAU,EAAE,6BAA6B;IACzC,GAAG,EAAE,sBAAsB;IAC3B,EAAE,EAAE,qBAAqB;IACzB,MAAM,EAAE,yBAAyB;IACjC,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,uBAAuB;IAC7B,GAAG,EAAE,sBAAsB;CAC5B,CAAC;AAEF,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,MAAM,eAAe,GAAG,IAAI,GAAG,EAAkD,CAAC;AAElF,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,IAAI,WAAW;QAAE,OAAO;IACxB,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACtB,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,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