gitnexus 1.3.8 → 1.3.10
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 -194
- package/dist/cli/ai-context.js +87 -87
- package/dist/cli/index.js +15 -25
- package/dist/cli/lazy-action.d.ts +6 -0
- package/dist/cli/lazy-action.js +18 -0
- package/dist/core/augmentation/engine.js +20 -20
- package/dist/core/embeddings/embedding-pipeline.js +26 -26
- package/dist/core/ingestion/ast-cache.js +3 -2
- package/dist/core/ingestion/cluster-enricher.js +16 -16
- package/dist/core/ingestion/pipeline.js +8 -0
- package/dist/core/ingestion/tree-sitter-queries.js +484 -484
- package/dist/core/ingestion/workers/parse-worker.js +4 -2
- package/dist/core/kuzu/kuzu-adapter.js +9 -9
- package/dist/core/kuzu/schema.js +287 -287
- package/dist/core/search/bm25-index.js +5 -5
- package/dist/core/search/hybrid-search.js +3 -3
- package/dist/core/wiki/graph-queries.js +52 -52
- package/dist/core/wiki/html-viewer.js +192 -192
- package/dist/core/wiki/prompts.js +82 -82
- package/dist/mcp/compatible-stdio-transport.d.ts +25 -0
- package/dist/mcp/compatible-stdio-transport.js +200 -0
- package/dist/mcp/local/local-backend.js +128 -128
- package/dist/mcp/resources.js +42 -42
- package/dist/mcp/server.js +18 -18
- package/dist/mcp/tools.js +86 -86
- package/hooks/claude/gitnexus-hook.cjs +155 -155
- package/hooks/claude/pre-tool-use.sh +79 -79
- package/hooks/claude/session-start.sh +42 -42
- package/package.json +96 -96
- package/scripts/patch-tree-sitter-swift.cjs +74 -74
- package/skills/gitnexus-cli.md +82 -82
- package/skills/gitnexus-debugging.md +89 -89
- package/skills/gitnexus-exploring.md +78 -78
- package/skills/gitnexus-guide.md +64 -64
- package/skills/gitnexus-impact-analysis.md +97 -97
- package/skills/gitnexus-pr-review.md +163 -163
- package/skills/gitnexus-refactoring.md +121 -121
- package/vendor/leiden/index.cjs +355 -355
- package/vendor/leiden/utils.cjs +392 -392
|
@@ -195,7 +195,8 @@ const findEnclosingFunctionId = (node, filePath) => {
|
|
|
195
195
|
if (current.type === 'init_declaration' || current.type === 'deinit_declaration') {
|
|
196
196
|
const funcName = current.type === 'init_declaration' ? 'init' : 'deinit';
|
|
197
197
|
const label = 'Constructor';
|
|
198
|
-
|
|
198
|
+
const startLine = current.startPosition?.row ?? 0;
|
|
199
|
+
return generateId(label, `${filePath}:${funcName}:${startLine}`);
|
|
199
200
|
}
|
|
200
201
|
if (['function_declaration', 'function_definition', 'async_function_declaration',
|
|
201
202
|
'generator_function_declaration', 'function_item'].includes(current.type)) {
|
|
@@ -233,7 +234,8 @@ const findEnclosingFunctionId = (node, filePath) => {
|
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
if (funcName) {
|
|
236
|
-
|
|
237
|
+
const startLine = current.startPosition?.row ?? 0;
|
|
238
|
+
return generateId(label, `${filePath}:${funcName}:${startLine}`);
|
|
237
239
|
}
|
|
238
240
|
}
|
|
239
241
|
current = current.parent;
|
|
@@ -289,10 +289,10 @@ const fallbackRelationshipInserts = async (validRelLines, validTables, getNodeLa
|
|
|
289
289
|
continue;
|
|
290
290
|
const confidence = parseFloat(confidenceStr) || 1.0;
|
|
291
291
|
const step = parseInt(stepStr) || 0;
|
|
292
|
-
await conn.query(`
|
|
293
|
-
MATCH (a:${escapeLabel(fromLabel)} {id: '${fromId.replace(/'/g, "''")}' }),
|
|
294
|
-
(b:${escapeLabel(toLabel)} {id: '${toId.replace(/'/g, "''")}' })
|
|
295
|
-
CREATE (a)-[:${REL_TABLE_NAME} {type: '${relType}', confidence: ${confidence}, reason: '${reason.replace(/'/g, "''")}', step: ${step}}]->(b)
|
|
292
|
+
await conn.query(`
|
|
293
|
+
MATCH (a:${escapeLabel(fromLabel)} {id: '${fromId.replace(/'/g, "''")}' }),
|
|
294
|
+
(b:${escapeLabel(toLabel)} {id: '${toId.replace(/'/g, "''")}' })
|
|
295
|
+
CREATE (a)-[:${REL_TABLE_NAME} {type: '${relType}', confidence: ${confidence}, reason: '${reason.replace(/'/g, "''")}', step: ${step}}]->(b)
|
|
296
296
|
`);
|
|
297
297
|
}
|
|
298
298
|
catch {
|
|
@@ -713,11 +713,11 @@ export const queryFTS = async (tableName, indexName, query, limit = 20, conjunct
|
|
|
713
713
|
}
|
|
714
714
|
// Escape single quotes in query
|
|
715
715
|
const escapedQuery = query.replace(/'/g, "''");
|
|
716
|
-
const cypher = `
|
|
717
|
-
CALL QUERY_FTS_INDEX('${tableName}', '${indexName}', '${escapedQuery}', conjunctive := ${conjunctive})
|
|
718
|
-
RETURN node, score
|
|
719
|
-
ORDER BY score DESC
|
|
720
|
-
LIMIT ${limit}
|
|
716
|
+
const cypher = `
|
|
717
|
+
CALL QUERY_FTS_INDEX('${tableName}', '${indexName}', '${escapedQuery}', conjunctive := ${conjunctive})
|
|
718
|
+
RETURN node, score
|
|
719
|
+
ORDER BY score DESC
|
|
720
|
+
LIMIT ${limit}
|
|
721
721
|
`;
|
|
722
722
|
try {
|
|
723
723
|
const queryResult = await conn.query(cypher);
|
package/dist/core/kuzu/schema.js
CHANGED
|
@@ -30,126 +30,126 @@ export const EMBEDDING_TABLE_NAME = 'CodeEmbedding';
|
|
|
30
30
|
// ============================================================================
|
|
31
31
|
// NODE TABLE SCHEMAS
|
|
32
32
|
// ============================================================================
|
|
33
|
-
export const FILE_SCHEMA = `
|
|
34
|
-
CREATE NODE TABLE File (
|
|
35
|
-
id STRING,
|
|
36
|
-
name STRING,
|
|
37
|
-
filePath STRING,
|
|
38
|
-
content STRING,
|
|
39
|
-
PRIMARY KEY (id)
|
|
33
|
+
export const FILE_SCHEMA = `
|
|
34
|
+
CREATE NODE TABLE File (
|
|
35
|
+
id STRING,
|
|
36
|
+
name STRING,
|
|
37
|
+
filePath STRING,
|
|
38
|
+
content STRING,
|
|
39
|
+
PRIMARY KEY (id)
|
|
40
40
|
)`;
|
|
41
|
-
export const FOLDER_SCHEMA = `
|
|
42
|
-
CREATE NODE TABLE Folder (
|
|
43
|
-
id STRING,
|
|
44
|
-
name STRING,
|
|
45
|
-
filePath STRING,
|
|
46
|
-
PRIMARY KEY (id)
|
|
41
|
+
export const FOLDER_SCHEMA = `
|
|
42
|
+
CREATE NODE TABLE Folder (
|
|
43
|
+
id STRING,
|
|
44
|
+
name STRING,
|
|
45
|
+
filePath STRING,
|
|
46
|
+
PRIMARY KEY (id)
|
|
47
47
|
)`;
|
|
48
|
-
export const FUNCTION_SCHEMA = `
|
|
49
|
-
CREATE NODE TABLE Function (
|
|
50
|
-
id STRING,
|
|
51
|
-
name STRING,
|
|
52
|
-
filePath STRING,
|
|
53
|
-
startLine INT64,
|
|
54
|
-
endLine INT64,
|
|
55
|
-
isExported BOOLEAN,
|
|
56
|
-
content STRING,
|
|
57
|
-
description STRING,
|
|
58
|
-
PRIMARY KEY (id)
|
|
48
|
+
export const FUNCTION_SCHEMA = `
|
|
49
|
+
CREATE NODE TABLE Function (
|
|
50
|
+
id STRING,
|
|
51
|
+
name STRING,
|
|
52
|
+
filePath STRING,
|
|
53
|
+
startLine INT64,
|
|
54
|
+
endLine INT64,
|
|
55
|
+
isExported BOOLEAN,
|
|
56
|
+
content STRING,
|
|
57
|
+
description STRING,
|
|
58
|
+
PRIMARY KEY (id)
|
|
59
59
|
)`;
|
|
60
|
-
export const CLASS_SCHEMA = `
|
|
61
|
-
CREATE NODE TABLE Class (
|
|
62
|
-
id STRING,
|
|
63
|
-
name STRING,
|
|
64
|
-
filePath STRING,
|
|
65
|
-
startLine INT64,
|
|
66
|
-
endLine INT64,
|
|
67
|
-
isExported BOOLEAN,
|
|
68
|
-
content STRING,
|
|
69
|
-
description STRING,
|
|
70
|
-
PRIMARY KEY (id)
|
|
60
|
+
export const CLASS_SCHEMA = `
|
|
61
|
+
CREATE NODE TABLE Class (
|
|
62
|
+
id STRING,
|
|
63
|
+
name STRING,
|
|
64
|
+
filePath STRING,
|
|
65
|
+
startLine INT64,
|
|
66
|
+
endLine INT64,
|
|
67
|
+
isExported BOOLEAN,
|
|
68
|
+
content STRING,
|
|
69
|
+
description STRING,
|
|
70
|
+
PRIMARY KEY (id)
|
|
71
71
|
)`;
|
|
72
|
-
export const INTERFACE_SCHEMA = `
|
|
73
|
-
CREATE NODE TABLE Interface (
|
|
74
|
-
id STRING,
|
|
75
|
-
name STRING,
|
|
76
|
-
filePath STRING,
|
|
77
|
-
startLine INT64,
|
|
78
|
-
endLine INT64,
|
|
79
|
-
isExported BOOLEAN,
|
|
80
|
-
content STRING,
|
|
81
|
-
description STRING,
|
|
82
|
-
PRIMARY KEY (id)
|
|
72
|
+
export const INTERFACE_SCHEMA = `
|
|
73
|
+
CREATE NODE TABLE Interface (
|
|
74
|
+
id STRING,
|
|
75
|
+
name STRING,
|
|
76
|
+
filePath STRING,
|
|
77
|
+
startLine INT64,
|
|
78
|
+
endLine INT64,
|
|
79
|
+
isExported BOOLEAN,
|
|
80
|
+
content STRING,
|
|
81
|
+
description STRING,
|
|
82
|
+
PRIMARY KEY (id)
|
|
83
83
|
)`;
|
|
84
|
-
export const METHOD_SCHEMA = `
|
|
85
|
-
CREATE NODE TABLE Method (
|
|
86
|
-
id STRING,
|
|
87
|
-
name STRING,
|
|
88
|
-
filePath STRING,
|
|
89
|
-
startLine INT64,
|
|
90
|
-
endLine INT64,
|
|
91
|
-
isExported BOOLEAN,
|
|
92
|
-
content STRING,
|
|
93
|
-
description STRING,
|
|
94
|
-
PRIMARY KEY (id)
|
|
84
|
+
export const METHOD_SCHEMA = `
|
|
85
|
+
CREATE NODE TABLE Method (
|
|
86
|
+
id STRING,
|
|
87
|
+
name STRING,
|
|
88
|
+
filePath STRING,
|
|
89
|
+
startLine INT64,
|
|
90
|
+
endLine INT64,
|
|
91
|
+
isExported BOOLEAN,
|
|
92
|
+
content STRING,
|
|
93
|
+
description STRING,
|
|
94
|
+
PRIMARY KEY (id)
|
|
95
95
|
)`;
|
|
96
|
-
export const CODE_ELEMENT_SCHEMA = `
|
|
97
|
-
CREATE NODE TABLE CodeElement (
|
|
98
|
-
id STRING,
|
|
99
|
-
name STRING,
|
|
100
|
-
filePath STRING,
|
|
101
|
-
startLine INT64,
|
|
102
|
-
endLine INT64,
|
|
103
|
-
isExported BOOLEAN,
|
|
104
|
-
content STRING,
|
|
105
|
-
description STRING,
|
|
106
|
-
PRIMARY KEY (id)
|
|
96
|
+
export const CODE_ELEMENT_SCHEMA = `
|
|
97
|
+
CREATE NODE TABLE CodeElement (
|
|
98
|
+
id STRING,
|
|
99
|
+
name STRING,
|
|
100
|
+
filePath STRING,
|
|
101
|
+
startLine INT64,
|
|
102
|
+
endLine INT64,
|
|
103
|
+
isExported BOOLEAN,
|
|
104
|
+
content STRING,
|
|
105
|
+
description STRING,
|
|
106
|
+
PRIMARY KEY (id)
|
|
107
107
|
)`;
|
|
108
108
|
// ============================================================================
|
|
109
109
|
// COMMUNITY NODE TABLE (for Leiden algorithm clusters)
|
|
110
110
|
// ============================================================================
|
|
111
|
-
export const COMMUNITY_SCHEMA = `
|
|
112
|
-
CREATE NODE TABLE Community (
|
|
113
|
-
id STRING,
|
|
114
|
-
label STRING,
|
|
115
|
-
heuristicLabel STRING,
|
|
116
|
-
keywords STRING[],
|
|
117
|
-
description STRING,
|
|
118
|
-
enrichedBy STRING,
|
|
119
|
-
cohesion DOUBLE,
|
|
120
|
-
symbolCount INT32,
|
|
121
|
-
PRIMARY KEY (id)
|
|
111
|
+
export const COMMUNITY_SCHEMA = `
|
|
112
|
+
CREATE NODE TABLE Community (
|
|
113
|
+
id STRING,
|
|
114
|
+
label STRING,
|
|
115
|
+
heuristicLabel STRING,
|
|
116
|
+
keywords STRING[],
|
|
117
|
+
description STRING,
|
|
118
|
+
enrichedBy STRING,
|
|
119
|
+
cohesion DOUBLE,
|
|
120
|
+
symbolCount INT32,
|
|
121
|
+
PRIMARY KEY (id)
|
|
122
122
|
)`;
|
|
123
123
|
// ============================================================================
|
|
124
124
|
// PROCESS NODE TABLE (for execution flow detection)
|
|
125
125
|
// ============================================================================
|
|
126
|
-
export const PROCESS_SCHEMA = `
|
|
127
|
-
CREATE NODE TABLE Process (
|
|
128
|
-
id STRING,
|
|
129
|
-
label STRING,
|
|
130
|
-
heuristicLabel STRING,
|
|
131
|
-
processType STRING,
|
|
132
|
-
stepCount INT32,
|
|
133
|
-
communities STRING[],
|
|
134
|
-
entryPointId STRING,
|
|
135
|
-
terminalId STRING,
|
|
136
|
-
PRIMARY KEY (id)
|
|
126
|
+
export const PROCESS_SCHEMA = `
|
|
127
|
+
CREATE NODE TABLE Process (
|
|
128
|
+
id STRING,
|
|
129
|
+
label STRING,
|
|
130
|
+
heuristicLabel STRING,
|
|
131
|
+
processType STRING,
|
|
132
|
+
stepCount INT32,
|
|
133
|
+
communities STRING[],
|
|
134
|
+
entryPointId STRING,
|
|
135
|
+
terminalId STRING,
|
|
136
|
+
PRIMARY KEY (id)
|
|
137
137
|
)`;
|
|
138
138
|
// ============================================================================
|
|
139
139
|
// MULTI-LANGUAGE NODE TABLE SCHEMAS
|
|
140
140
|
// ============================================================================
|
|
141
141
|
// Generic code element with startLine/endLine for C, C++, Rust, Go, Java, C#
|
|
142
142
|
// description: optional metadata (e.g. Eloquent $fillable fields, relationship targets)
|
|
143
|
-
const CODE_ELEMENT_BASE = (name) => `
|
|
144
|
-
CREATE NODE TABLE \`${name}\` (
|
|
145
|
-
id STRING,
|
|
146
|
-
name STRING,
|
|
147
|
-
filePath STRING,
|
|
148
|
-
startLine INT64,
|
|
149
|
-
endLine INT64,
|
|
150
|
-
content STRING,
|
|
151
|
-
description STRING,
|
|
152
|
-
PRIMARY KEY (id)
|
|
143
|
+
const CODE_ELEMENT_BASE = (name) => `
|
|
144
|
+
CREATE NODE TABLE \`${name}\` (
|
|
145
|
+
id STRING,
|
|
146
|
+
name STRING,
|
|
147
|
+
filePath STRING,
|
|
148
|
+
startLine INT64,
|
|
149
|
+
endLine INT64,
|
|
150
|
+
content STRING,
|
|
151
|
+
description STRING,
|
|
152
|
+
PRIMARY KEY (id)
|
|
153
153
|
)`;
|
|
154
154
|
export const STRUCT_SCHEMA = CODE_ELEMENT_BASE('Struct');
|
|
155
155
|
export const ENUM_SCHEMA = CODE_ELEMENT_BASE('Enum');
|
|
@@ -173,203 +173,203 @@ export const MODULE_SCHEMA = CODE_ELEMENT_BASE('Module');
|
|
|
173
173
|
// RELATION TABLE SCHEMA
|
|
174
174
|
// Single table with 'type' property - connects all node tables
|
|
175
175
|
// ============================================================================
|
|
176
|
-
export const RELATION_SCHEMA = `
|
|
177
|
-
CREATE REL TABLE ${REL_TABLE_NAME} (
|
|
178
|
-
FROM File TO File,
|
|
179
|
-
FROM File TO Folder,
|
|
180
|
-
FROM File TO Function,
|
|
181
|
-
FROM File TO Class,
|
|
182
|
-
FROM File TO Interface,
|
|
183
|
-
FROM File TO Method,
|
|
184
|
-
FROM File TO CodeElement,
|
|
185
|
-
FROM File TO \`Struct\`,
|
|
186
|
-
FROM File TO \`Enum\`,
|
|
187
|
-
FROM File TO \`Macro\`,
|
|
188
|
-
FROM File TO \`Typedef\`,
|
|
189
|
-
FROM File TO \`Union\`,
|
|
190
|
-
FROM File TO \`Namespace\`,
|
|
191
|
-
FROM File TO \`Trait\`,
|
|
192
|
-
FROM File TO \`Impl\`,
|
|
193
|
-
FROM File TO \`TypeAlias\`,
|
|
194
|
-
FROM File TO \`Const\`,
|
|
195
|
-
FROM File TO \`Static\`,
|
|
196
|
-
FROM File TO \`Property\`,
|
|
197
|
-
FROM File TO \`Record\`,
|
|
198
|
-
FROM File TO \`Delegate\`,
|
|
199
|
-
FROM File TO \`Annotation\`,
|
|
200
|
-
FROM File TO \`Constructor\`,
|
|
201
|
-
FROM File TO \`Template\`,
|
|
202
|
-
FROM File TO \`Module\`,
|
|
203
|
-
FROM Folder TO Folder,
|
|
204
|
-
FROM Folder TO File,
|
|
205
|
-
FROM Function TO Function,
|
|
206
|
-
FROM Function TO Method,
|
|
207
|
-
FROM Function TO Class,
|
|
208
|
-
FROM Function TO Community,
|
|
209
|
-
FROM Function TO \`Macro\`,
|
|
210
|
-
FROM Function TO \`Struct\`,
|
|
211
|
-
FROM Function TO \`Template\`,
|
|
212
|
-
FROM Function TO \`Enum\`,
|
|
213
|
-
FROM Function TO \`Namespace\`,
|
|
214
|
-
FROM Function TO \`TypeAlias\`,
|
|
215
|
-
FROM Function TO \`Module\`,
|
|
216
|
-
FROM Function TO \`Impl\`,
|
|
217
|
-
FROM Function TO Interface,
|
|
218
|
-
FROM Function TO \`Constructor\`,
|
|
219
|
-
FROM Function TO \`Const\`,
|
|
220
|
-
FROM Function TO \`Typedef\`,
|
|
221
|
-
FROM Function TO \`Union\`,
|
|
222
|
-
FROM Function TO \`Property\`,
|
|
223
|
-
FROM Class TO Method,
|
|
224
|
-
FROM Class TO Function,
|
|
225
|
-
FROM Class TO Class,
|
|
226
|
-
FROM Class TO Interface,
|
|
227
|
-
FROM Class TO Community,
|
|
228
|
-
FROM Class TO \`Template\`,
|
|
229
|
-
FROM Class TO \`TypeAlias\`,
|
|
230
|
-
FROM Class TO \`Struct\`,
|
|
231
|
-
FROM Class TO \`Enum\`,
|
|
232
|
-
FROM Class TO \`Annotation\`,
|
|
233
|
-
FROM Class TO \`Constructor\`,
|
|
234
|
-
FROM Class TO \`Trait\`,
|
|
235
|
-
FROM Class TO \`Macro\`,
|
|
236
|
-
FROM Class TO \`Impl\`,
|
|
237
|
-
FROM Class TO \`Union\`,
|
|
238
|
-
FROM Class TO \`Namespace\`,
|
|
239
|
-
FROM Class TO \`Typedef\`,
|
|
240
|
-
FROM Method TO Function,
|
|
241
|
-
FROM Method TO Method,
|
|
242
|
-
FROM Method TO Class,
|
|
243
|
-
FROM Method TO Community,
|
|
244
|
-
FROM Method TO \`Template\`,
|
|
245
|
-
FROM Method TO \`Struct\`,
|
|
246
|
-
FROM Method TO \`TypeAlias\`,
|
|
247
|
-
FROM Method TO \`Enum\`,
|
|
248
|
-
FROM Method TO \`Macro\`,
|
|
249
|
-
FROM Method TO \`Namespace\`,
|
|
250
|
-
FROM Method TO \`Module\`,
|
|
251
|
-
FROM Method TO \`Impl\`,
|
|
252
|
-
FROM Method TO Interface,
|
|
253
|
-
FROM Method TO \`Constructor\`,
|
|
254
|
-
FROM Method TO \`Property\`,
|
|
255
|
-
FROM \`Template\` TO \`Template\`,
|
|
256
|
-
FROM \`Template\` TO Function,
|
|
257
|
-
FROM \`Template\` TO Method,
|
|
258
|
-
FROM \`Template\` TO Class,
|
|
259
|
-
FROM \`Template\` TO \`Struct\`,
|
|
260
|
-
FROM \`Template\` TO \`TypeAlias\`,
|
|
261
|
-
FROM \`Template\` TO \`Enum\`,
|
|
262
|
-
FROM \`Template\` TO \`Macro\`,
|
|
263
|
-
FROM \`Template\` TO Interface,
|
|
264
|
-
FROM \`Template\` TO \`Constructor\`,
|
|
265
|
-
FROM \`Module\` TO \`Module\`,
|
|
266
|
-
FROM CodeElement TO Community,
|
|
267
|
-
FROM Interface TO Community,
|
|
268
|
-
FROM Interface TO Function,
|
|
269
|
-
FROM Interface TO Method,
|
|
270
|
-
FROM Interface TO Class,
|
|
271
|
-
FROM Interface TO Interface,
|
|
272
|
-
FROM Interface TO \`TypeAlias\`,
|
|
273
|
-
FROM Interface TO \`Struct\`,
|
|
274
|
-
FROM Interface TO \`Constructor\`,
|
|
275
|
-
FROM \`Struct\` TO Community,
|
|
276
|
-
FROM \`Struct\` TO \`Trait\`,
|
|
277
|
-
FROM \`Struct\` TO \`Struct\`,
|
|
278
|
-
FROM \`Struct\` TO Class,
|
|
279
|
-
FROM \`Struct\` TO \`Enum\`,
|
|
280
|
-
FROM \`Struct\` TO Function,
|
|
281
|
-
FROM \`Struct\` TO Method,
|
|
282
|
-
FROM \`Struct\` TO Interface,
|
|
283
|
-
FROM \`Enum\` TO \`Enum\`,
|
|
284
|
-
FROM \`Enum\` TO Community,
|
|
285
|
-
FROM \`Enum\` TO Class,
|
|
286
|
-
FROM \`Enum\` TO Interface,
|
|
287
|
-
FROM \`Macro\` TO Community,
|
|
288
|
-
FROM \`Macro\` TO Function,
|
|
289
|
-
FROM \`Macro\` TO Method,
|
|
290
|
-
FROM \`Module\` TO Function,
|
|
291
|
-
FROM \`Module\` TO Method,
|
|
292
|
-
FROM \`Typedef\` TO Community,
|
|
293
|
-
FROM \`Union\` TO Community,
|
|
294
|
-
FROM \`Namespace\` TO Community,
|
|
295
|
-
FROM \`Namespace\` TO \`Struct\`,
|
|
296
|
-
FROM \`Trait\` TO Community,
|
|
297
|
-
FROM \`Impl\` TO Community,
|
|
298
|
-
FROM \`Impl\` TO \`Trait\`,
|
|
299
|
-
FROM \`Impl\` TO \`Struct\`,
|
|
300
|
-
FROM \`Impl\` TO \`Impl\`,
|
|
301
|
-
FROM \`TypeAlias\` TO Community,
|
|
302
|
-
FROM \`TypeAlias\` TO \`Trait\`,
|
|
303
|
-
FROM \`TypeAlias\` TO Class,
|
|
304
|
-
FROM \`Const\` TO Community,
|
|
305
|
-
FROM \`Static\` TO Community,
|
|
306
|
-
FROM \`Property\` TO Community,
|
|
307
|
-
FROM \`Record\` TO Community,
|
|
308
|
-
FROM \`Delegate\` TO Community,
|
|
309
|
-
FROM \`Annotation\` TO Community,
|
|
310
|
-
FROM \`Constructor\` TO Community,
|
|
311
|
-
FROM \`Constructor\` TO Interface,
|
|
312
|
-
FROM \`Constructor\` TO Class,
|
|
313
|
-
FROM \`Constructor\` TO Method,
|
|
314
|
-
FROM \`Constructor\` TO Function,
|
|
315
|
-
FROM \`Constructor\` TO \`Constructor\`,
|
|
316
|
-
FROM \`Constructor\` TO \`Struct\`,
|
|
317
|
-
FROM \`Constructor\` TO \`Macro\`,
|
|
318
|
-
FROM \`Constructor\` TO \`Template\`,
|
|
319
|
-
FROM \`Constructor\` TO \`TypeAlias\`,
|
|
320
|
-
FROM \`Constructor\` TO \`Enum\`,
|
|
321
|
-
FROM \`Constructor\` TO \`Annotation\`,
|
|
322
|
-
FROM \`Constructor\` TO \`Impl\`,
|
|
323
|
-
FROM \`Constructor\` TO \`Namespace\`,
|
|
324
|
-
FROM \`Constructor\` TO \`Module\`,
|
|
325
|
-
FROM \`Constructor\` TO \`Property\`,
|
|
326
|
-
FROM \`Constructor\` TO \`Typedef\`,
|
|
327
|
-
FROM \`Template\` TO Community,
|
|
328
|
-
FROM \`Module\` TO Community,
|
|
329
|
-
FROM Function TO Process,
|
|
330
|
-
FROM Method TO Process,
|
|
331
|
-
FROM Class TO Process,
|
|
332
|
-
FROM Interface TO Process,
|
|
333
|
-
FROM \`Struct\` TO Process,
|
|
334
|
-
FROM \`Constructor\` TO Process,
|
|
335
|
-
FROM \`Module\` TO Process,
|
|
336
|
-
FROM \`Macro\` TO Process,
|
|
337
|
-
FROM \`Impl\` TO Process,
|
|
338
|
-
FROM \`Typedef\` TO Process,
|
|
339
|
-
FROM \`TypeAlias\` TO Process,
|
|
340
|
-
FROM \`Enum\` TO Process,
|
|
341
|
-
FROM \`Union\` TO Process,
|
|
342
|
-
FROM \`Namespace\` TO Process,
|
|
343
|
-
FROM \`Trait\` TO Process,
|
|
344
|
-
FROM \`Const\` TO Process,
|
|
345
|
-
FROM \`Static\` TO Process,
|
|
346
|
-
FROM \`Property\` TO Process,
|
|
347
|
-
FROM \`Record\` TO Process,
|
|
348
|
-
FROM \`Delegate\` TO Process,
|
|
349
|
-
FROM \`Annotation\` TO Process,
|
|
350
|
-
FROM \`Template\` TO Process,
|
|
351
|
-
FROM CodeElement TO Process,
|
|
352
|
-
type STRING,
|
|
353
|
-
confidence DOUBLE,
|
|
354
|
-
reason STRING,
|
|
355
|
-
step INT32
|
|
176
|
+
export const RELATION_SCHEMA = `
|
|
177
|
+
CREATE REL TABLE ${REL_TABLE_NAME} (
|
|
178
|
+
FROM File TO File,
|
|
179
|
+
FROM File TO Folder,
|
|
180
|
+
FROM File TO Function,
|
|
181
|
+
FROM File TO Class,
|
|
182
|
+
FROM File TO Interface,
|
|
183
|
+
FROM File TO Method,
|
|
184
|
+
FROM File TO CodeElement,
|
|
185
|
+
FROM File TO \`Struct\`,
|
|
186
|
+
FROM File TO \`Enum\`,
|
|
187
|
+
FROM File TO \`Macro\`,
|
|
188
|
+
FROM File TO \`Typedef\`,
|
|
189
|
+
FROM File TO \`Union\`,
|
|
190
|
+
FROM File TO \`Namespace\`,
|
|
191
|
+
FROM File TO \`Trait\`,
|
|
192
|
+
FROM File TO \`Impl\`,
|
|
193
|
+
FROM File TO \`TypeAlias\`,
|
|
194
|
+
FROM File TO \`Const\`,
|
|
195
|
+
FROM File TO \`Static\`,
|
|
196
|
+
FROM File TO \`Property\`,
|
|
197
|
+
FROM File TO \`Record\`,
|
|
198
|
+
FROM File TO \`Delegate\`,
|
|
199
|
+
FROM File TO \`Annotation\`,
|
|
200
|
+
FROM File TO \`Constructor\`,
|
|
201
|
+
FROM File TO \`Template\`,
|
|
202
|
+
FROM File TO \`Module\`,
|
|
203
|
+
FROM Folder TO Folder,
|
|
204
|
+
FROM Folder TO File,
|
|
205
|
+
FROM Function TO Function,
|
|
206
|
+
FROM Function TO Method,
|
|
207
|
+
FROM Function TO Class,
|
|
208
|
+
FROM Function TO Community,
|
|
209
|
+
FROM Function TO \`Macro\`,
|
|
210
|
+
FROM Function TO \`Struct\`,
|
|
211
|
+
FROM Function TO \`Template\`,
|
|
212
|
+
FROM Function TO \`Enum\`,
|
|
213
|
+
FROM Function TO \`Namespace\`,
|
|
214
|
+
FROM Function TO \`TypeAlias\`,
|
|
215
|
+
FROM Function TO \`Module\`,
|
|
216
|
+
FROM Function TO \`Impl\`,
|
|
217
|
+
FROM Function TO Interface,
|
|
218
|
+
FROM Function TO \`Constructor\`,
|
|
219
|
+
FROM Function TO \`Const\`,
|
|
220
|
+
FROM Function TO \`Typedef\`,
|
|
221
|
+
FROM Function TO \`Union\`,
|
|
222
|
+
FROM Function TO \`Property\`,
|
|
223
|
+
FROM Class TO Method,
|
|
224
|
+
FROM Class TO Function,
|
|
225
|
+
FROM Class TO Class,
|
|
226
|
+
FROM Class TO Interface,
|
|
227
|
+
FROM Class TO Community,
|
|
228
|
+
FROM Class TO \`Template\`,
|
|
229
|
+
FROM Class TO \`TypeAlias\`,
|
|
230
|
+
FROM Class TO \`Struct\`,
|
|
231
|
+
FROM Class TO \`Enum\`,
|
|
232
|
+
FROM Class TO \`Annotation\`,
|
|
233
|
+
FROM Class TO \`Constructor\`,
|
|
234
|
+
FROM Class TO \`Trait\`,
|
|
235
|
+
FROM Class TO \`Macro\`,
|
|
236
|
+
FROM Class TO \`Impl\`,
|
|
237
|
+
FROM Class TO \`Union\`,
|
|
238
|
+
FROM Class TO \`Namespace\`,
|
|
239
|
+
FROM Class TO \`Typedef\`,
|
|
240
|
+
FROM Method TO Function,
|
|
241
|
+
FROM Method TO Method,
|
|
242
|
+
FROM Method TO Class,
|
|
243
|
+
FROM Method TO Community,
|
|
244
|
+
FROM Method TO \`Template\`,
|
|
245
|
+
FROM Method TO \`Struct\`,
|
|
246
|
+
FROM Method TO \`TypeAlias\`,
|
|
247
|
+
FROM Method TO \`Enum\`,
|
|
248
|
+
FROM Method TO \`Macro\`,
|
|
249
|
+
FROM Method TO \`Namespace\`,
|
|
250
|
+
FROM Method TO \`Module\`,
|
|
251
|
+
FROM Method TO \`Impl\`,
|
|
252
|
+
FROM Method TO Interface,
|
|
253
|
+
FROM Method TO \`Constructor\`,
|
|
254
|
+
FROM Method TO \`Property\`,
|
|
255
|
+
FROM \`Template\` TO \`Template\`,
|
|
256
|
+
FROM \`Template\` TO Function,
|
|
257
|
+
FROM \`Template\` TO Method,
|
|
258
|
+
FROM \`Template\` TO Class,
|
|
259
|
+
FROM \`Template\` TO \`Struct\`,
|
|
260
|
+
FROM \`Template\` TO \`TypeAlias\`,
|
|
261
|
+
FROM \`Template\` TO \`Enum\`,
|
|
262
|
+
FROM \`Template\` TO \`Macro\`,
|
|
263
|
+
FROM \`Template\` TO Interface,
|
|
264
|
+
FROM \`Template\` TO \`Constructor\`,
|
|
265
|
+
FROM \`Module\` TO \`Module\`,
|
|
266
|
+
FROM CodeElement TO Community,
|
|
267
|
+
FROM Interface TO Community,
|
|
268
|
+
FROM Interface TO Function,
|
|
269
|
+
FROM Interface TO Method,
|
|
270
|
+
FROM Interface TO Class,
|
|
271
|
+
FROM Interface TO Interface,
|
|
272
|
+
FROM Interface TO \`TypeAlias\`,
|
|
273
|
+
FROM Interface TO \`Struct\`,
|
|
274
|
+
FROM Interface TO \`Constructor\`,
|
|
275
|
+
FROM \`Struct\` TO Community,
|
|
276
|
+
FROM \`Struct\` TO \`Trait\`,
|
|
277
|
+
FROM \`Struct\` TO \`Struct\`,
|
|
278
|
+
FROM \`Struct\` TO Class,
|
|
279
|
+
FROM \`Struct\` TO \`Enum\`,
|
|
280
|
+
FROM \`Struct\` TO Function,
|
|
281
|
+
FROM \`Struct\` TO Method,
|
|
282
|
+
FROM \`Struct\` TO Interface,
|
|
283
|
+
FROM \`Enum\` TO \`Enum\`,
|
|
284
|
+
FROM \`Enum\` TO Community,
|
|
285
|
+
FROM \`Enum\` TO Class,
|
|
286
|
+
FROM \`Enum\` TO Interface,
|
|
287
|
+
FROM \`Macro\` TO Community,
|
|
288
|
+
FROM \`Macro\` TO Function,
|
|
289
|
+
FROM \`Macro\` TO Method,
|
|
290
|
+
FROM \`Module\` TO Function,
|
|
291
|
+
FROM \`Module\` TO Method,
|
|
292
|
+
FROM \`Typedef\` TO Community,
|
|
293
|
+
FROM \`Union\` TO Community,
|
|
294
|
+
FROM \`Namespace\` TO Community,
|
|
295
|
+
FROM \`Namespace\` TO \`Struct\`,
|
|
296
|
+
FROM \`Trait\` TO Community,
|
|
297
|
+
FROM \`Impl\` TO Community,
|
|
298
|
+
FROM \`Impl\` TO \`Trait\`,
|
|
299
|
+
FROM \`Impl\` TO \`Struct\`,
|
|
300
|
+
FROM \`Impl\` TO \`Impl\`,
|
|
301
|
+
FROM \`TypeAlias\` TO Community,
|
|
302
|
+
FROM \`TypeAlias\` TO \`Trait\`,
|
|
303
|
+
FROM \`TypeAlias\` TO Class,
|
|
304
|
+
FROM \`Const\` TO Community,
|
|
305
|
+
FROM \`Static\` TO Community,
|
|
306
|
+
FROM \`Property\` TO Community,
|
|
307
|
+
FROM \`Record\` TO Community,
|
|
308
|
+
FROM \`Delegate\` TO Community,
|
|
309
|
+
FROM \`Annotation\` TO Community,
|
|
310
|
+
FROM \`Constructor\` TO Community,
|
|
311
|
+
FROM \`Constructor\` TO Interface,
|
|
312
|
+
FROM \`Constructor\` TO Class,
|
|
313
|
+
FROM \`Constructor\` TO Method,
|
|
314
|
+
FROM \`Constructor\` TO Function,
|
|
315
|
+
FROM \`Constructor\` TO \`Constructor\`,
|
|
316
|
+
FROM \`Constructor\` TO \`Struct\`,
|
|
317
|
+
FROM \`Constructor\` TO \`Macro\`,
|
|
318
|
+
FROM \`Constructor\` TO \`Template\`,
|
|
319
|
+
FROM \`Constructor\` TO \`TypeAlias\`,
|
|
320
|
+
FROM \`Constructor\` TO \`Enum\`,
|
|
321
|
+
FROM \`Constructor\` TO \`Annotation\`,
|
|
322
|
+
FROM \`Constructor\` TO \`Impl\`,
|
|
323
|
+
FROM \`Constructor\` TO \`Namespace\`,
|
|
324
|
+
FROM \`Constructor\` TO \`Module\`,
|
|
325
|
+
FROM \`Constructor\` TO \`Property\`,
|
|
326
|
+
FROM \`Constructor\` TO \`Typedef\`,
|
|
327
|
+
FROM \`Template\` TO Community,
|
|
328
|
+
FROM \`Module\` TO Community,
|
|
329
|
+
FROM Function TO Process,
|
|
330
|
+
FROM Method TO Process,
|
|
331
|
+
FROM Class TO Process,
|
|
332
|
+
FROM Interface TO Process,
|
|
333
|
+
FROM \`Struct\` TO Process,
|
|
334
|
+
FROM \`Constructor\` TO Process,
|
|
335
|
+
FROM \`Module\` TO Process,
|
|
336
|
+
FROM \`Macro\` TO Process,
|
|
337
|
+
FROM \`Impl\` TO Process,
|
|
338
|
+
FROM \`Typedef\` TO Process,
|
|
339
|
+
FROM \`TypeAlias\` TO Process,
|
|
340
|
+
FROM \`Enum\` TO Process,
|
|
341
|
+
FROM \`Union\` TO Process,
|
|
342
|
+
FROM \`Namespace\` TO Process,
|
|
343
|
+
FROM \`Trait\` TO Process,
|
|
344
|
+
FROM \`Const\` TO Process,
|
|
345
|
+
FROM \`Static\` TO Process,
|
|
346
|
+
FROM \`Property\` TO Process,
|
|
347
|
+
FROM \`Record\` TO Process,
|
|
348
|
+
FROM \`Delegate\` TO Process,
|
|
349
|
+
FROM \`Annotation\` TO Process,
|
|
350
|
+
FROM \`Template\` TO Process,
|
|
351
|
+
FROM CodeElement TO Process,
|
|
352
|
+
type STRING,
|
|
353
|
+
confidence DOUBLE,
|
|
354
|
+
reason STRING,
|
|
355
|
+
step INT32
|
|
356
356
|
)`;
|
|
357
357
|
// ============================================================================
|
|
358
358
|
// EMBEDDING TABLE SCHEMA
|
|
359
359
|
// Separate table for vector storage to avoid copy-on-write overhead
|
|
360
360
|
// ============================================================================
|
|
361
|
-
export const EMBEDDING_SCHEMA = `
|
|
362
|
-
CREATE NODE TABLE ${EMBEDDING_TABLE_NAME} (
|
|
363
|
-
nodeId STRING,
|
|
364
|
-
embedding FLOAT[384],
|
|
365
|
-
PRIMARY KEY (nodeId)
|
|
361
|
+
export const EMBEDDING_SCHEMA = `
|
|
362
|
+
CREATE NODE TABLE ${EMBEDDING_TABLE_NAME} (
|
|
363
|
+
nodeId STRING,
|
|
364
|
+
embedding FLOAT[384],
|
|
365
|
+
PRIMARY KEY (nodeId)
|
|
366
366
|
)`;
|
|
367
367
|
/**
|
|
368
368
|
* Create vector index for semantic search
|
|
369
369
|
* Uses HNSW (Hierarchical Navigable Small World) algorithm with cosine similarity
|
|
370
370
|
*/
|
|
371
|
-
export const CREATE_VECTOR_INDEX_QUERY = `
|
|
372
|
-
CALL CREATE_VECTOR_INDEX('${EMBEDDING_TABLE_NAME}', 'code_embedding_idx', 'embedding', metric := 'cosine')
|
|
371
|
+
export const CREATE_VECTOR_INDEX_QUERY = `
|
|
372
|
+
CALL CREATE_VECTOR_INDEX('${EMBEDDING_TABLE_NAME}', 'code_embedding_idx', 'embedding', metric := 'cosine')
|
|
373
373
|
`;
|
|
374
374
|
// ============================================================================
|
|
375
375
|
// ALL SCHEMA QUERIES IN ORDER
|