gitnexus 1.4.0 → 1.4.1
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 -214
- package/dist/cli/ai-context.d.ts +1 -2
- package/dist/cli/ai-context.js +90 -117
- package/dist/cli/analyze.d.ts +0 -2
- package/dist/cli/analyze.js +2 -20
- package/dist/cli/index.js +25 -17
- package/dist/cli/setup.js +19 -17
- package/dist/core/augmentation/engine.js +20 -20
- package/dist/core/embeddings/embedding-pipeline.js +26 -26
- package/dist/core/graph/types.d.ts +2 -5
- package/dist/core/ingestion/ast-cache.js +2 -3
- package/dist/core/ingestion/call-processor.d.ts +5 -5
- package/dist/core/ingestion/call-processor.js +258 -173
- package/dist/core/ingestion/cluster-enricher.js +16 -16
- package/dist/core/ingestion/entry-point-scoring.d.ts +1 -2
- package/dist/core/ingestion/entry-point-scoring.js +22 -81
- package/dist/core/ingestion/framework-detection.d.ts +1 -5
- package/dist/core/ingestion/framework-detection.js +8 -39
- package/dist/core/ingestion/heritage-processor.d.ts +4 -13
- package/dist/core/ingestion/heritage-processor.js +28 -92
- package/dist/core/ingestion/import-processor.d.ts +19 -17
- package/dist/core/ingestion/import-processor.js +695 -170
- package/dist/core/ingestion/parsing-processor.d.ts +10 -1
- package/dist/core/ingestion/parsing-processor.js +177 -41
- package/dist/core/ingestion/pipeline.js +26 -49
- package/dist/core/ingestion/process-processor.js +1 -2
- package/dist/core/ingestion/symbol-table.d.ts +1 -12
- package/dist/core/ingestion/symbol-table.js +12 -19
- package/dist/core/ingestion/tree-sitter-queries.d.ts +11 -11
- package/dist/core/ingestion/tree-sitter-queries.js +485 -590
- package/dist/core/ingestion/utils.d.ts +0 -67
- package/dist/core/ingestion/utils.js +9 -692
- package/dist/core/ingestion/workers/parse-worker.d.ts +3 -20
- package/dist/core/ingestion/workers/parse-worker.js +345 -84
- package/dist/core/ingestion/workers/worker-pool.js +0 -8
- package/dist/core/kuzu/csv-generator.js +3 -19
- package/dist/core/kuzu/kuzu-adapter.js +19 -14
- package/dist/core/kuzu/schema.d.ts +3 -3
- package/dist/core/kuzu/schema.js +288 -303
- package/dist/core/search/bm25-index.js +6 -7
- package/dist/core/search/hybrid-search.js +3 -3
- package/dist/core/wiki/diagrams.d.ts +27 -0
- package/dist/core/wiki/diagrams.js +163 -0
- package/dist/core/wiki/generator.d.ts +50 -2
- package/dist/core/wiki/generator.js +548 -49
- package/dist/core/wiki/graph-queries.d.ts +42 -0
- package/dist/core/wiki/graph-queries.js +276 -97
- package/dist/core/wiki/html-viewer.js +192 -192
- package/dist/core/wiki/llm-client.js +73 -11
- package/dist/core/wiki/prompts.d.ts +52 -8
- package/dist/core/wiki/prompts.js +200 -86
- package/dist/mcp/core/kuzu-adapter.d.ts +3 -1
- package/dist/mcp/core/kuzu-adapter.js +44 -13
- package/dist/mcp/local/local-backend.js +128 -128
- package/dist/mcp/resources.js +42 -42
- package/dist/mcp/server.js +19 -18
- package/dist/mcp/tools.js +104 -103
- package/hooks/claude/gitnexus-hook.cjs +155 -238
- 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
- package/dist/cli/lazy-action.d.ts +0 -6
- package/dist/cli/lazy-action.js +0 -18
- package/dist/cli/skill-gen.d.ts +0 -26
- package/dist/cli/skill-gen.js +0 -549
- package/dist/core/ingestion/constants.d.ts +0 -16
- package/dist/core/ingestion/constants.js +0 -16
- package/dist/core/ingestion/export-detection.d.ts +0 -18
- package/dist/core/ingestion/export-detection.js +0 -230
- package/dist/core/ingestion/language-config.d.ts +0 -46
- package/dist/core/ingestion/language-config.js +0 -167
- package/dist/core/ingestion/mro-processor.d.ts +0 -45
- package/dist/core/ingestion/mro-processor.js +0 -369
- package/dist/core/ingestion/named-binding-extraction.d.ts +0 -61
- package/dist/core/ingestion/named-binding-extraction.js +0 -363
- package/dist/core/ingestion/resolvers/csharp.d.ts +0 -22
- package/dist/core/ingestion/resolvers/csharp.js +0 -109
- package/dist/core/ingestion/resolvers/go.d.ts +0 -19
- package/dist/core/ingestion/resolvers/go.js +0 -42
- package/dist/core/ingestion/resolvers/index.d.ts +0 -16
- package/dist/core/ingestion/resolvers/index.js +0 -11
- package/dist/core/ingestion/resolvers/jvm.d.ts +0 -23
- package/dist/core/ingestion/resolvers/jvm.js +0 -87
- package/dist/core/ingestion/resolvers/php.d.ts +0 -15
- package/dist/core/ingestion/resolvers/php.js +0 -35
- package/dist/core/ingestion/resolvers/rust.d.ts +0 -15
- package/dist/core/ingestion/resolvers/rust.js +0 -73
- package/dist/core/ingestion/resolvers/standard.d.ts +0 -28
- package/dist/core/ingestion/resolvers/standard.js +0 -145
- package/dist/core/ingestion/resolvers/utils.d.ts +0 -33
- package/dist/core/ingestion/resolvers/utils.js +0 -120
- package/dist/core/ingestion/symbol-resolver.d.ts +0 -32
- package/dist/core/ingestion/symbol-resolver.js +0 -83
- package/dist/core/ingestion/type-env.d.ts +0 -27
- package/dist/core/ingestion/type-env.js +0 -86
- package/dist/core/ingestion/type-extractors/c-cpp.d.ts +0 -2
- package/dist/core/ingestion/type-extractors/c-cpp.js +0 -60
- package/dist/core/ingestion/type-extractors/csharp.d.ts +0 -2
- package/dist/core/ingestion/type-extractors/csharp.js +0 -89
- package/dist/core/ingestion/type-extractors/go.d.ts +0 -2
- package/dist/core/ingestion/type-extractors/go.js +0 -105
- package/dist/core/ingestion/type-extractors/index.d.ts +0 -21
- package/dist/core/ingestion/type-extractors/index.js +0 -29
- package/dist/core/ingestion/type-extractors/jvm.d.ts +0 -3
- package/dist/core/ingestion/type-extractors/jvm.js +0 -121
- package/dist/core/ingestion/type-extractors/php.d.ts +0 -2
- package/dist/core/ingestion/type-extractors/php.js +0 -31
- package/dist/core/ingestion/type-extractors/python.d.ts +0 -2
- package/dist/core/ingestion/type-extractors/python.js +0 -41
- package/dist/core/ingestion/type-extractors/rust.d.ts +0 -2
- package/dist/core/ingestion/type-extractors/rust.js +0 -39
- package/dist/core/ingestion/type-extractors/shared.d.ts +0 -17
- package/dist/core/ingestion/type-extractors/shared.js +0 -97
- package/dist/core/ingestion/type-extractors/swift.d.ts +0 -2
- package/dist/core/ingestion/type-extractors/swift.js +0 -43
- package/dist/core/ingestion/type-extractors/types.d.ts +0 -14
- package/dist/core/ingestion/type-extractors/types.js +0 -1
- package/dist/core/ingestion/type-extractors/typescript.d.ts +0 -2
- package/dist/core/ingestion/type-extractors/typescript.js +0 -46
- package/dist/mcp/compatible-stdio-transport.d.ts +0 -25
- package/dist/mcp/compatible-stdio-transport.js +0 -200
package/dist/core/kuzu/schema.js
CHANGED
|
@@ -22,7 +22,7 @@ export const NODE_TABLES = [
|
|
|
22
22
|
// ============================================================================
|
|
23
23
|
export const REL_TABLE_NAME = 'CodeRelation';
|
|
24
24
|
// Valid relation types
|
|
25
|
-
export const REL_TYPES = ['CONTAINS', 'DEFINES', 'IMPORTS', 'CALLS', 'EXTENDS', 'IMPLEMENTS', '
|
|
25
|
+
export const REL_TYPES = ['CONTAINS', 'DEFINES', 'IMPORTS', 'CALLS', 'EXTENDS', 'IMPLEMENTS', 'MEMBER_OF', 'STEP_IN_PROCESS'];
|
|
26
26
|
// ============================================================================
|
|
27
27
|
// EMBEDDING TABLE
|
|
28
28
|
// ============================================================================
|
|
@@ -30,128 +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
|
-
|
|
95
|
-
returnType STRING,
|
|
96
|
-
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)
|
|
97
95
|
)`;
|
|
98
|
-
export const CODE_ELEMENT_SCHEMA = `
|
|
99
|
-
CREATE NODE TABLE CodeElement (
|
|
100
|
-
id STRING,
|
|
101
|
-
name STRING,
|
|
102
|
-
filePath STRING,
|
|
103
|
-
startLine INT64,
|
|
104
|
-
endLine INT64,
|
|
105
|
-
isExported BOOLEAN,
|
|
106
|
-
content STRING,
|
|
107
|
-
description STRING,
|
|
108
|
-
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)
|
|
109
107
|
)`;
|
|
110
108
|
// ============================================================================
|
|
111
109
|
// COMMUNITY NODE TABLE (for Leiden algorithm clusters)
|
|
112
110
|
// ============================================================================
|
|
113
|
-
export const COMMUNITY_SCHEMA = `
|
|
114
|
-
CREATE NODE TABLE Community (
|
|
115
|
-
id STRING,
|
|
116
|
-
label STRING,
|
|
117
|
-
heuristicLabel STRING,
|
|
118
|
-
keywords STRING[],
|
|
119
|
-
description STRING,
|
|
120
|
-
enrichedBy STRING,
|
|
121
|
-
cohesion DOUBLE,
|
|
122
|
-
symbolCount INT32,
|
|
123
|
-
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)
|
|
124
122
|
)`;
|
|
125
123
|
// ============================================================================
|
|
126
124
|
// PROCESS NODE TABLE (for execution flow detection)
|
|
127
125
|
// ============================================================================
|
|
128
|
-
export const PROCESS_SCHEMA = `
|
|
129
|
-
CREATE NODE TABLE Process (
|
|
130
|
-
id STRING,
|
|
131
|
-
label STRING,
|
|
132
|
-
heuristicLabel STRING,
|
|
133
|
-
processType STRING,
|
|
134
|
-
stepCount INT32,
|
|
135
|
-
communities STRING[],
|
|
136
|
-
entryPointId STRING,
|
|
137
|
-
terminalId STRING,
|
|
138
|
-
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)
|
|
139
137
|
)`;
|
|
140
138
|
// ============================================================================
|
|
141
139
|
// MULTI-LANGUAGE NODE TABLE SCHEMAS
|
|
142
140
|
// ============================================================================
|
|
143
141
|
// Generic code element with startLine/endLine for C, C++, Rust, Go, Java, C#
|
|
144
142
|
// description: optional metadata (e.g. Eloquent $fillable fields, relationship targets)
|
|
145
|
-
const CODE_ELEMENT_BASE = (name) => `
|
|
146
|
-
CREATE NODE TABLE \`${name}\` (
|
|
147
|
-
id STRING,
|
|
148
|
-
name STRING,
|
|
149
|
-
filePath STRING,
|
|
150
|
-
startLine INT64,
|
|
151
|
-
endLine INT64,
|
|
152
|
-
content STRING,
|
|
153
|
-
description STRING,
|
|
154
|
-
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)
|
|
155
153
|
)`;
|
|
156
154
|
export const STRUCT_SCHEMA = CODE_ELEMENT_BASE('Struct');
|
|
157
155
|
export const ENUM_SCHEMA = CODE_ELEMENT_BASE('Enum');
|
|
@@ -175,216 +173,203 @@ export const MODULE_SCHEMA = CODE_ELEMENT_BASE('Module');
|
|
|
175
173
|
// RELATION TABLE SCHEMA
|
|
176
174
|
// Single table with 'type' property - connects all node tables
|
|
177
175
|
// ============================================================================
|
|
178
|
-
export const RELATION_SCHEMA = `
|
|
179
|
-
CREATE REL TABLE ${REL_TABLE_NAME} (
|
|
180
|
-
FROM File TO File,
|
|
181
|
-
FROM File TO Folder,
|
|
182
|
-
FROM File TO Function,
|
|
183
|
-
FROM File TO Class,
|
|
184
|
-
FROM File TO Interface,
|
|
185
|
-
FROM File TO Method,
|
|
186
|
-
FROM File TO CodeElement,
|
|
187
|
-
FROM File TO \`Struct\`,
|
|
188
|
-
FROM File TO \`Enum\`,
|
|
189
|
-
FROM File TO \`Macro\`,
|
|
190
|
-
FROM File TO \`Typedef\`,
|
|
191
|
-
FROM File TO \`Union\`,
|
|
192
|
-
FROM File TO \`Namespace\`,
|
|
193
|
-
FROM File TO \`Trait\`,
|
|
194
|
-
FROM File TO \`Impl\`,
|
|
195
|
-
FROM File TO \`TypeAlias\`,
|
|
196
|
-
FROM File TO \`Const\`,
|
|
197
|
-
FROM File TO \`Static\`,
|
|
198
|
-
FROM File TO \`Property\`,
|
|
199
|
-
FROM File TO \`Record\`,
|
|
200
|
-
FROM File TO \`Delegate\`,
|
|
201
|
-
FROM File TO \`Annotation\`,
|
|
202
|
-
FROM File TO \`Constructor\`,
|
|
203
|
-
FROM File TO \`Template\`,
|
|
204
|
-
FROM File TO \`Module\`,
|
|
205
|
-
FROM Folder TO Folder,
|
|
206
|
-
FROM Folder TO File,
|
|
207
|
-
FROM Function TO Function,
|
|
208
|
-
FROM Function TO Method,
|
|
209
|
-
FROM Function TO Class,
|
|
210
|
-
FROM Function TO Community,
|
|
211
|
-
FROM Function TO \`Macro\`,
|
|
212
|
-
FROM Function TO \`Struct\`,
|
|
213
|
-
FROM Function TO \`Template\`,
|
|
214
|
-
FROM Function TO \`Enum\`,
|
|
215
|
-
FROM Function TO \`Namespace\`,
|
|
216
|
-
FROM Function TO \`TypeAlias\`,
|
|
217
|
-
FROM Function TO \`Module\`,
|
|
218
|
-
FROM Function TO \`Impl\`,
|
|
219
|
-
FROM Function TO Interface,
|
|
220
|
-
FROM Function TO \`Constructor\`,
|
|
221
|
-
FROM Function TO \`Const\`,
|
|
222
|
-
FROM Function TO \`Typedef\`,
|
|
223
|
-
FROM Function TO \`Union\`,
|
|
224
|
-
FROM Function TO \`Property\`,
|
|
225
|
-
FROM Class TO Method,
|
|
226
|
-
FROM Class TO Function,
|
|
227
|
-
FROM Class TO Class,
|
|
228
|
-
FROM Class TO Interface,
|
|
229
|
-
FROM Class TO Community,
|
|
230
|
-
FROM Class TO \`Template\`,
|
|
231
|
-
FROM Class TO \`TypeAlias\`,
|
|
232
|
-
FROM Class TO \`Struct\`,
|
|
233
|
-
FROM Class TO \`Enum\`,
|
|
234
|
-
FROM Class TO \`Annotation\`,
|
|
235
|
-
FROM Class TO \`Constructor\`,
|
|
236
|
-
FROM Class TO \`Trait\`,
|
|
237
|
-
FROM Class TO \`Macro\`,
|
|
238
|
-
FROM Class TO \`Impl\`,
|
|
239
|
-
FROM Class TO \`Union\`,
|
|
240
|
-
FROM Class TO \`Namespace\`,
|
|
241
|
-
FROM Class TO \`Typedef\`,
|
|
242
|
-
FROM
|
|
243
|
-
FROM Method TO
|
|
244
|
-
FROM Method TO
|
|
245
|
-
FROM Method TO
|
|
246
|
-
FROM Method TO
|
|
247
|
-
FROM Method TO \`
|
|
248
|
-
FROM Method TO \`
|
|
249
|
-
FROM Method TO \`
|
|
250
|
-
FROM Method TO \`
|
|
251
|
-
FROM Method TO \`
|
|
252
|
-
FROM Method TO \`
|
|
253
|
-
FROM Method TO \`
|
|
254
|
-
FROM Method TO
|
|
255
|
-
FROM Method TO
|
|
256
|
-
FROM Method TO \`
|
|
257
|
-
FROM
|
|
258
|
-
FROM \`Template\` TO
|
|
259
|
-
FROM \`Template\` TO
|
|
260
|
-
FROM \`Template\` TO
|
|
261
|
-
FROM \`Template\` TO
|
|
262
|
-
FROM \`Template\` TO \`
|
|
263
|
-
FROM \`Template\` TO \`
|
|
264
|
-
FROM \`Template\` TO \`
|
|
265
|
-
FROM \`Template\` TO
|
|
266
|
-
FROM \`Template\` TO
|
|
267
|
-
FROM \`
|
|
268
|
-
FROM
|
|
269
|
-
FROM
|
|
270
|
-
FROM Interface TO
|
|
271
|
-
FROM Interface TO
|
|
272
|
-
FROM Interface TO
|
|
273
|
-
FROM Interface TO
|
|
274
|
-
FROM Interface TO
|
|
275
|
-
FROM Interface TO \`
|
|
276
|
-
FROM Interface TO \`
|
|
277
|
-
FROM
|
|
278
|
-
FROM
|
|
279
|
-
FROM \`Struct\` TO
|
|
280
|
-
FROM \`Struct\` TO
|
|
281
|
-
FROM \`Struct\` TO \`
|
|
282
|
-
FROM \`Struct\` TO
|
|
283
|
-
FROM \`Struct\` TO
|
|
284
|
-
FROM \`Struct\` TO
|
|
285
|
-
FROM \`
|
|
286
|
-
FROM \`
|
|
287
|
-
FROM \`
|
|
288
|
-
FROM \`
|
|
289
|
-
FROM \`
|
|
290
|
-
FROM \`
|
|
291
|
-
FROM \`
|
|
292
|
-
FROM \`
|
|
293
|
-
FROM \`
|
|
294
|
-
FROM \`
|
|
295
|
-
FROM \`
|
|
296
|
-
FROM \`
|
|
297
|
-
FROM \`
|
|
298
|
-
FROM \`
|
|
299
|
-
FROM \`
|
|
300
|
-
FROM \`
|
|
301
|
-
FROM \`
|
|
302
|
-
FROM \`
|
|
303
|
-
FROM \`
|
|
304
|
-
FROM \`
|
|
305
|
-
FROM \`
|
|
306
|
-
FROM \`
|
|
307
|
-
FROM \`
|
|
308
|
-
FROM \`
|
|
309
|
-
FROM \`
|
|
310
|
-
FROM \`
|
|
311
|
-
FROM \`
|
|
312
|
-
FROM \`
|
|
313
|
-
FROM \`
|
|
314
|
-
FROM \`
|
|
315
|
-
FROM \`
|
|
316
|
-
FROM \`
|
|
317
|
-
FROM \`
|
|
318
|
-
FROM \`
|
|
319
|
-
FROM \`
|
|
320
|
-
FROM \`
|
|
321
|
-
FROM \`
|
|
322
|
-
FROM \`
|
|
323
|
-
FROM \`
|
|
324
|
-
FROM \`
|
|
325
|
-
FROM \`Constructor\` TO
|
|
326
|
-
FROM \`Constructor\` TO
|
|
327
|
-
FROM \`Constructor\` TO
|
|
328
|
-
FROM \`Constructor\` TO
|
|
329
|
-
FROM \`
|
|
330
|
-
FROM \`
|
|
331
|
-
FROM
|
|
332
|
-
FROM
|
|
333
|
-
FROM
|
|
334
|
-
FROM
|
|
335
|
-
FROM \`
|
|
336
|
-
FROM \`Constructor\` TO
|
|
337
|
-
FROM \`
|
|
338
|
-
FROM \`
|
|
339
|
-
FROM \`
|
|
340
|
-
FROM \`
|
|
341
|
-
FROM \`
|
|
342
|
-
FROM \`
|
|
343
|
-
FROM \`
|
|
344
|
-
FROM
|
|
345
|
-
FROM
|
|
346
|
-
FROM
|
|
347
|
-
FROM
|
|
348
|
-
FROM \`
|
|
349
|
-
FROM \`
|
|
350
|
-
FROM \`
|
|
351
|
-
FROM \`
|
|
352
|
-
FROM \`
|
|
353
|
-
FROM
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
FROM \`Trait\` TO Process,
|
|
359
|
-
FROM \`Const\` TO Process,
|
|
360
|
-
FROM \`Static\` TO Process,
|
|
361
|
-
FROM \`Property\` TO Process,
|
|
362
|
-
FROM \`Record\` TO Process,
|
|
363
|
-
FROM \`Delegate\` TO Process,
|
|
364
|
-
FROM \`Annotation\` TO Process,
|
|
365
|
-
FROM \`Template\` TO Process,
|
|
366
|
-
FROM CodeElement TO Process,
|
|
367
|
-
type STRING,
|
|
368
|
-
confidence DOUBLE,
|
|
369
|
-
reason STRING,
|
|
370
|
-
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
|
|
371
356
|
)`;
|
|
372
357
|
// ============================================================================
|
|
373
358
|
// EMBEDDING TABLE SCHEMA
|
|
374
359
|
// Separate table for vector storage to avoid copy-on-write overhead
|
|
375
360
|
// ============================================================================
|
|
376
|
-
export const EMBEDDING_SCHEMA = `
|
|
377
|
-
CREATE NODE TABLE ${EMBEDDING_TABLE_NAME} (
|
|
378
|
-
nodeId STRING,
|
|
379
|
-
embedding FLOAT[384],
|
|
380
|
-
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)
|
|
381
366
|
)`;
|
|
382
367
|
/**
|
|
383
368
|
* Create vector index for semantic search
|
|
384
369
|
* Uses HNSW (Hierarchical Navigable Small World) algorithm with cosine similarity
|
|
385
370
|
*/
|
|
386
|
-
export const CREATE_VECTOR_INDEX_QUERY = `
|
|
387
|
-
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')
|
|
388
373
|
`;
|
|
389
374
|
// ============================================================================
|
|
390
375
|
// ALL SCHEMA QUERIES IN ORDER
|
|
@@ -10,13 +10,12 @@ import { queryFTS } from '../kuzu/kuzu-adapter.js';
|
|
|
10
10
|
* Returns the same shape as core queryFTS.
|
|
11
11
|
*/
|
|
12
12
|
async function queryFTSViaExecutor(executor, tableName, indexName, query, limit) {
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
LIMIT ${limit}
|
|
13
|
+
const escapedQuery = query.replace(/'/g, "''");
|
|
14
|
+
const cypher = `
|
|
15
|
+
CALL QUERY_FTS_INDEX('${tableName}', '${indexName}', '${escapedQuery}', conjunctive := false)
|
|
16
|
+
RETURN node, score
|
|
17
|
+
ORDER BY score DESC
|
|
18
|
+
LIMIT ${limit}
|
|
20
19
|
`;
|
|
21
20
|
try {
|
|
22
21
|
const rows = await executor(cypher);
|
|
@@ -98,9 +98,9 @@ export const formatHybridResults = (results) => {
|
|
|
98
98
|
const location = r.startLine ? ` (lines ${r.startLine}-${r.endLine})` : '';
|
|
99
99
|
const label = r.label ? `${r.label}: ` : 'File: ';
|
|
100
100
|
const name = r.name || r.filePath.split('/').pop() || r.filePath;
|
|
101
|
-
return `[${i + 1}] ${label}${name}
|
|
102
|
-
File: ${r.filePath}${location}
|
|
103
|
-
Found by: ${sources}
|
|
101
|
+
return `[${i + 1}] ${label}${name}
|
|
102
|
+
File: ${r.filePath}${location}
|
|
103
|
+
Found by: ${sources}
|
|
104
104
|
Relevance: ${r.score.toFixed(4)}`;
|
|
105
105
|
});
|
|
106
106
|
return `Found ${results.length} results:\n\n${formatted.join('\n\n')}`;
|