@leanlabsinnov/codegraph 0.1.1 → 0.1.3
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 +3 -3
- package/dist/bin.js +2 -2
- package/dist/{chunk-AMJXGXLM.js → chunk-5WYXRWEY.js} +827 -119
- package/dist/chunk-5WYXRWEY.js.map +1 -0
- package/dist/{chunk-VFE242Y7.js → chunk-AVP24SX5.js} +73 -43
- package/dist/chunk-AVP24SX5.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{src-7P6XREHJ.js → src-M7HSEMBT.js} +4 -4
- package/package.json +3 -3
- package/dist/chunk-AMJXGXLM.js.map +0 -1
- package/dist/chunk-VFE242Y7.js.map +0 -1
- /package/dist/{src-7P6XREHJ.js.map → src-M7HSEMBT.js.map} +0 -0
|
@@ -77,13 +77,7 @@ function buildSchemaStatements(opts) {
|
|
|
77
77
|
}
|
|
78
78
|
return statements;
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
return [
|
|
82
|
-
"INSTALL VECTOR",
|
|
83
|
-
"LOAD EXTENSION VECTOR",
|
|
84
|
-
"CALL CREATE_VECTOR_INDEX('Symbol', 'embedding_idx', 'embedding', metric := 'cosine')"
|
|
85
|
-
];
|
|
86
|
-
}
|
|
80
|
+
var SEMANTIC_SEARCH_MODE = "brute-force";
|
|
87
81
|
var DEFAULT_EMBEDDING_DIMENSION = 1536;
|
|
88
82
|
|
|
89
83
|
// ../graph-db/src/client.ts
|
|
@@ -95,7 +89,6 @@ var GraphDb = class {
|
|
|
95
89
|
embeddingDimension;
|
|
96
90
|
db = null;
|
|
97
91
|
conn = null;
|
|
98
|
-
vectorIndexReady = false;
|
|
99
92
|
/**
|
|
100
93
|
* Cache of `conn.prepare()` results keyed by Cypher source. Kuzu's Node SDK requires a
|
|
101
94
|
* prepared statement for any parameterized query - reusing the prepared object keeps
|
|
@@ -116,7 +109,6 @@ var GraphDb = class {
|
|
|
116
109
|
this.preparedCache.clear();
|
|
117
110
|
this.conn = null;
|
|
118
111
|
this.db = null;
|
|
119
|
-
this.vectorIndexReady = false;
|
|
120
112
|
}
|
|
121
113
|
requireConn() {
|
|
122
114
|
if (!this.conn) {
|
|
@@ -125,8 +117,11 @@ var GraphDb = class {
|
|
|
125
117
|
return this.conn;
|
|
126
118
|
}
|
|
127
119
|
/**
|
|
128
|
-
* Idempotent migration
|
|
129
|
-
*
|
|
120
|
+
* Idempotent migration: creates the `Symbol` node table and one REL table per
|
|
121
|
+
* `EdgeKind`. The `embedding FLOAT[N]` column lives on `Symbol` but we deliberately
|
|
122
|
+
* skip Kuzu's `CREATE_VECTOR_INDEX` - semantic search is brute-force via
|
|
123
|
+
* `array_cosine_similarity` to work around kuzudb/kuzu#5965 and kuzudb/kuzu#6040.
|
|
124
|
+
* See `schema.ts` for the full rationale.
|
|
130
125
|
*/
|
|
131
126
|
async migrate() {
|
|
132
127
|
await this.connect();
|
|
@@ -134,22 +129,6 @@ var GraphDb = class {
|
|
|
134
129
|
for (const stmt of schemaStmts) {
|
|
135
130
|
await this.exec(stmt);
|
|
136
131
|
}
|
|
137
|
-
for (const stmt of buildVectorIndexStatements()) {
|
|
138
|
-
try {
|
|
139
|
-
await this.exec(stmt);
|
|
140
|
-
} catch (err) {
|
|
141
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
142
|
-
if (isAlreadyExistsError(message)) continue;
|
|
143
|
-
if (/extension/i.test(message) && /(not found|missing|unsupported|disabled)/i.test(message)) {
|
|
144
|
-
console.warn(
|
|
145
|
-
`[codegraph] vector extension unavailable; semantic search disabled. Underlying: ${message}`
|
|
146
|
-
);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
throw new Error(`migrate failed on \`${stmt}\`: ${message}`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
this.vectorIndexReady = true;
|
|
153
132
|
}
|
|
154
133
|
/**
|
|
155
134
|
* Typed Cypher escape hatch.
|
|
@@ -175,12 +154,22 @@ var GraphDb = class {
|
|
|
175
154
|
* `progressCallback`, NOT params - mistaking that is the #1 way to confuse the API).
|
|
176
155
|
* - `conn.prepare(stmt) + conn.execute(prepared, params)` for anything with `$name`
|
|
177
156
|
* placeholders. We cache the prepared statement so UNWIND batches reuse it.
|
|
157
|
+
*
|
|
158
|
+
* Kuzu's `execute` rejects bind maps that contain keys the prepared statement does not
|
|
159
|
+
* reference (`Parameter <name> not found`). Tool authors often pass a uniform params bag
|
|
160
|
+
* and let the Cypher branch internally on which placeholders to use, so we filter the
|
|
161
|
+
* bind map down to the keys actually referenced by `$name` before handing it off.
|
|
178
162
|
*/
|
|
179
163
|
async runQuery(cypher, params) {
|
|
180
164
|
const conn = this.requireConn();
|
|
181
|
-
|
|
165
|
+
const referenced = extractParamNames(cypher);
|
|
166
|
+
if (referenced.size === 0) {
|
|
182
167
|
return conn.query(cypher);
|
|
183
168
|
}
|
|
169
|
+
const bound = {};
|
|
170
|
+
for (const key of referenced) {
|
|
171
|
+
if (key in params) bound[key] = params[key];
|
|
172
|
+
}
|
|
184
173
|
let prepared = this.preparedCache.get(cypher);
|
|
185
174
|
if (!prepared) {
|
|
186
175
|
prepared = await conn.prepare(cypher);
|
|
@@ -189,22 +178,42 @@ var GraphDb = class {
|
|
|
189
178
|
}
|
|
190
179
|
this.preparedCache.set(cypher, prepared);
|
|
191
180
|
}
|
|
192
|
-
return conn.execute(prepared,
|
|
181
|
+
return conn.execute(prepared, bound);
|
|
193
182
|
}
|
|
194
183
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
184
|
+
* Inserts nodes via batched UNWIND + bare CREATE. The whole property map (including
|
|
185
|
+
* `embedding` when present) is set in the CREATE clause - we deliberately avoid `SET`
|
|
186
|
+
* because Kuzu rejects writes to an HNSW-indexed column even after the index is dropped
|
|
187
|
+
* (kuzudb/kuzu#6040). Callers must wipe pre-existing rows with `deleteByRepo` first.
|
|
188
|
+
*
|
|
189
|
+
* In-batch duplicates (same `id`) are coalesced to the last occurrence to keep CREATE
|
|
190
|
+
* from violating the primary-key uniqueness constraint.
|
|
198
191
|
*/
|
|
199
192
|
async upsertNodes(nodes) {
|
|
200
193
|
if (nodes.length === 0) return;
|
|
201
194
|
await this.connect();
|
|
195
|
+
const deduped = dedupeById(nodes);
|
|
196
|
+
const withEmbedding = [];
|
|
197
|
+
const withoutEmbedding = [];
|
|
198
|
+
for (const n of deduped) {
|
|
199
|
+
if (Array.isArray(n.embedding) && n.embedding.length > 0) {
|
|
200
|
+
withEmbedding.push(n);
|
|
201
|
+
} else {
|
|
202
|
+
withoutEmbedding.push(n);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
await this.createSymbolBatch(withoutEmbedding, false);
|
|
206
|
+
await this.createSymbolBatch(withEmbedding, true);
|
|
207
|
+
}
|
|
208
|
+
async createSymbolBatch(nodes, withEmbedding) {
|
|
209
|
+
if (nodes.length === 0) return;
|
|
202
210
|
const BATCH = 200;
|
|
203
|
-
const
|
|
204
|
-
const
|
|
211
|
+
const columns = [...SYMBOL_COLUMNS, ...withEmbedding ? ["embedding"] : []];
|
|
212
|
+
const propMap = columns.map((c) => `${c}: r.${c}`).join(", ");
|
|
213
|
+
const cypher = `UNWIND $batch AS r CREATE (n:Symbol {${propMap}})`;
|
|
205
214
|
for (let i = 0; i < nodes.length; i += BATCH) {
|
|
206
215
|
const slice = nodes.slice(i, i + BATCH);
|
|
207
|
-
const payload = slice.map(buildSymbolRow);
|
|
216
|
+
const payload = slice.map((n) => buildSymbolRow(n, withEmbedding, this.embeddingDimension));
|
|
208
217
|
await this.exec(cypher, { batch: payload });
|
|
209
218
|
}
|
|
210
219
|
}
|
|
@@ -291,12 +300,17 @@ var GraphDb = class {
|
|
|
291
300
|
const coverage = total === 0 ? 0 : embedded / total;
|
|
292
301
|
return { nodes, edges, embeddingCoverage: coverage };
|
|
293
302
|
}
|
|
294
|
-
/**
|
|
303
|
+
/**
|
|
304
|
+
* v0.1.x never creates an HNSW index - semantic search is brute-force via
|
|
305
|
+
* `array_cosine_similarity`. Always returns `false`. Kept on the surface so callers
|
|
306
|
+
* (e.g. `codegraph doctor`) can branch on a single boolean once the upstream Kuzu
|
|
307
|
+
* fixes ship and we flip the index back on.
|
|
308
|
+
*/
|
|
295
309
|
hasVectorIndex() {
|
|
296
|
-
return
|
|
310
|
+
return false;
|
|
297
311
|
}
|
|
298
312
|
};
|
|
299
|
-
function buildSymbolRow(node) {
|
|
313
|
+
function buildSymbolRow(node, withEmbedding, embeddingDimension) {
|
|
300
314
|
const src = node;
|
|
301
315
|
const row = {};
|
|
302
316
|
for (const col of SYMBOL_COLUMNS) {
|
|
@@ -305,8 +319,27 @@ function buildSymbolRow(node) {
|
|
|
305
319
|
}
|
|
306
320
|
row.id = node.id;
|
|
307
321
|
row.kind = node.kind;
|
|
322
|
+
if (withEmbedding) {
|
|
323
|
+
const vec = node.embedding;
|
|
324
|
+
row.embedding = Array.isArray(vec) && vec.length === embeddingDimension ? vec : new Array(embeddingDimension).fill(0);
|
|
325
|
+
}
|
|
308
326
|
return row;
|
|
309
327
|
}
|
|
328
|
+
var PARAM_PATTERN = /(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\$([A-Za-z_][A-Za-z0-9_]*))/g;
|
|
329
|
+
function extractParamNames(cypher) {
|
|
330
|
+
const out = /* @__PURE__ */ new Set();
|
|
331
|
+
for (const match of cypher.matchAll(PARAM_PATTERN)) {
|
|
332
|
+
if (match[1]) out.add(match[1]);
|
|
333
|
+
}
|
|
334
|
+
return out;
|
|
335
|
+
}
|
|
336
|
+
function dedupeById(nodes) {
|
|
337
|
+
const seen = /* @__PURE__ */ new Map();
|
|
338
|
+
for (const n of nodes) {
|
|
339
|
+
seen.set(n.id, n);
|
|
340
|
+
}
|
|
341
|
+
return Array.from(seen.values());
|
|
342
|
+
}
|
|
310
343
|
function normalizeRow(row) {
|
|
311
344
|
if (row instanceof Map) {
|
|
312
345
|
const out = {};
|
|
@@ -342,9 +375,6 @@ async function collectAll(result) {
|
|
|
342
375
|
if (typeof getAll !== "function") return [];
|
|
343
376
|
return getAll.call(target);
|
|
344
377
|
}
|
|
345
|
-
function isAlreadyExistsError(message) {
|
|
346
|
-
return /already exists/i.test(message) || /already loaded/i.test(message) || /already installed/i.test(message) || /duplicate (table|index)/i.test(message);
|
|
347
|
-
}
|
|
348
378
|
|
|
349
379
|
export {
|
|
350
380
|
SYMBOL_COLUMN_SPEC,
|
|
@@ -352,9 +382,9 @@ export {
|
|
|
352
382
|
defaultFor,
|
|
353
383
|
EDGE_COLUMNS,
|
|
354
384
|
buildSchemaStatements,
|
|
355
|
-
|
|
385
|
+
SEMANTIC_SEARCH_MODE,
|
|
356
386
|
DEFAULT_EMBEDDING_DIMENSION,
|
|
357
387
|
defaultDbPath,
|
|
358
388
|
GraphDb
|
|
359
389
|
};
|
|
360
|
-
//# sourceMappingURL=chunk-
|
|
390
|
+
//# sourceMappingURL=chunk-AVP24SX5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../graph-db/src/client.ts","../../graph-db/src/schema.ts"],"sourcesContent":["import { mkdir } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { dirname, resolve } from \"node:path\";\nimport { EDGE_KINDS, NODE_KINDS, type EdgeKind } from \"@codegraph/shared\";\nimport * as kuzu from \"kuzu\";\nimport {\n DEFAULT_EMBEDDING_DIMENSION,\n SYMBOL_COLUMNS,\n buildSchemaStatements,\n defaultFor,\n} from \"./schema.js\";\nimport type { QueryResult, UpsertEdgeInput, UpsertNodeInput } from \"./types.js\";\n\nexport interface GraphDbOptions {\n /** Directory where Kuzu stores its on-disk database files. Defaults to `~/.codegraph/graph`. */\n dbPath?: string;\n /**\n * Legacy `url` option kept for back-compat with Phase-1 callers. Ignored at runtime -\n * Kuzu is embedded - but accepted so existing call sites compile while the rest of the\n * codebase migrates to `dbPath`.\n */\n url?: string;\n /** Vector dimension for the `Symbol.embedding` column. Baked into the schema at create time. */\n embeddingDimension?: number;\n}\n\n/** Default on-disk location for the embedded graph. */\nexport function defaultDbPath(): string {\n return resolve(homedir(), \".codegraph\", \"graph\");\n}\n\n/**\n * Thin, typed wrapper around the embedded Kuzu database.\n *\n * Public surface (intentionally identical to the Phase-1 FalkorDB client so callers don't\n * change): connect / close / migrate / query / upsertNodes / upsertEdges / deleteByRepo /\n * stats. Internals are pure Kuzu.\n */\nexport class GraphDb {\n private readonly dbPath: string;\n private readonly embeddingDimension: number;\n private db: kuzu.Database | null = null;\n private conn: kuzu.Connection | null = null;\n /**\n * Cache of `conn.prepare()` results keyed by Cypher source. Kuzu's Node SDK requires a\n * prepared statement for any parameterized query - reusing the prepared object keeps\n * UNWIND-batched upserts fast.\n */\n private preparedCache = new Map<string, kuzu.PreparedStatement>();\n\n constructor(opts: GraphDbOptions = {}) {\n this.dbPath = opts.dbPath ?? defaultDbPath();\n this.embeddingDimension = opts.embeddingDimension ?? DEFAULT_EMBEDDING_DIMENSION;\n }\n\n async connect(): Promise<void> {\n if (this.conn) return;\n await mkdir(dirname(this.dbPath), { recursive: true });\n this.db = new kuzu.Database(this.dbPath);\n this.conn = new kuzu.Connection(this.db);\n }\n\n async close(): Promise<void> {\n // We deliberately do NOT call `conn.close()` / `db.close()` on Kuzu's Node bindings.\n // In 0.11.x those native handles are also disposed by the binding's process-exit hook,\n // and double-disposing can SIGSEGV the worker on cleanup. Dropping references is\n // enough for the GC to release the underlying memory before the process exits.\n this.preparedCache.clear();\n this.conn = null;\n this.db = null;\n }\n\n private requireConn(): kuzu.Connection {\n if (!this.conn) {\n throw new Error(\"GraphDb not connected. Call connect() first.\");\n }\n return this.conn;\n }\n\n /**\n * Idempotent migration: creates the `Symbol` node table and one REL table per\n * `EdgeKind`. The `embedding FLOAT[N]` column lives on `Symbol` but we deliberately\n * skip Kuzu's `CREATE_VECTOR_INDEX` - semantic search is brute-force via\n * `array_cosine_similarity` to work around kuzudb/kuzu#5965 and kuzudb/kuzu#6040.\n * See `schema.ts` for the full rationale.\n */\n async migrate(): Promise<void> {\n await this.connect();\n const schemaStmts = buildSchemaStatements({ embeddingDimension: this.embeddingDimension });\n for (const stmt of schemaStmts) {\n await this.exec(stmt);\n }\n }\n\n /**\n * Typed Cypher escape hatch.\n *\n * Kuzu returns BIGINT columns as native BigInt; we coerce to plain `number` when safe so\n * downstream JSON serialization (MCP responses, snapshot tests) does not need bespoke\n * handling.\n */\n async query<T = Record<string, unknown>>(\n cypher: string,\n params: Record<string, unknown> = {},\n ): Promise<QueryResult<T>> {\n const result = await this.runQuery(cypher, params);\n const raw = await collectAll(result);\n const data = raw.map((row) => normalizeRow(row)) as T[];\n const headers = raw.length > 0 ? Object.keys(raw[0] ?? {}) : [];\n return { data, headers, metadata: [] };\n }\n\n /** Fire-and-forget DDL/exec. */\n private async exec(cypher: string, params: Record<string, unknown> = {}): Promise<void> {\n await this.runQuery(cypher, params);\n }\n\n /**\n * Bridge to Kuzu's two execution paths:\n * - `conn.query(stmt)` for unparameterized statements (the second positional arg is a\n * `progressCallback`, NOT params - mistaking that is the #1 way to confuse the API).\n * - `conn.prepare(stmt) + conn.execute(prepared, params)` for anything with `$name`\n * placeholders. We cache the prepared statement so UNWIND batches reuse it.\n *\n * Kuzu's `execute` rejects bind maps that contain keys the prepared statement does not\n * reference (`Parameter <name> not found`). Tool authors often pass a uniform params bag\n * and let the Cypher branch internally on which placeholders to use, so we filter the\n * bind map down to the keys actually referenced by `$name` before handing it off.\n */\n private async runQuery(cypher: string, params: Record<string, unknown>): Promise<unknown> {\n const conn = this.requireConn();\n const referenced = extractParamNames(cypher);\n if (referenced.size === 0) {\n return conn.query(cypher);\n }\n const bound: Record<string, unknown> = {};\n for (const key of referenced) {\n if (key in params) bound[key] = params[key];\n }\n let prepared = this.preparedCache.get(cypher);\n if (!prepared) {\n prepared = await conn.prepare(cypher);\n if (!prepared.isSuccess()) {\n throw new Error(prepared.getErrorMessage());\n }\n this.preparedCache.set(cypher, prepared);\n }\n // Cast through `unknown`: Kuzu's bindings advertise a strict `KuzuValue` union, but\n // we can pass through any JSON-serializable value the embedded engine accepts (nested\n // structs and lists are converted at the native layer).\n return conn.execute(prepared, bound as unknown as Parameters<kuzu.Connection[\"execute\"]>[1]);\n }\n\n /**\n * Inserts nodes via batched UNWIND + bare CREATE. The whole property map (including\n * `embedding` when present) is set in the CREATE clause - we deliberately avoid `SET`\n * because Kuzu rejects writes to an HNSW-indexed column even after the index is dropped\n * (kuzudb/kuzu#6040). Callers must wipe pre-existing rows with `deleteByRepo` first.\n *\n * In-batch duplicates (same `id`) are coalesced to the last occurrence to keep CREATE\n * from violating the primary-key uniqueness constraint.\n */\n async upsertNodes(nodes: UpsertNodeInput[]): Promise<void> {\n if (nodes.length === 0) return;\n await this.connect();\n const deduped = dedupeById(nodes);\n const withEmbedding: UpsertNodeInput[] = [];\n const withoutEmbedding: UpsertNodeInput[] = [];\n for (const n of deduped) {\n if (Array.isArray(n.embedding) && n.embedding.length > 0) {\n withEmbedding.push(n);\n } else {\n withoutEmbedding.push(n);\n }\n }\n await this.createSymbolBatch(withoutEmbedding, false);\n await this.createSymbolBatch(withEmbedding, true);\n }\n\n private async createSymbolBatch(\n nodes: UpsertNodeInput[],\n withEmbedding: boolean,\n ): Promise<void> {\n if (nodes.length === 0) return;\n const BATCH = 200;\n const columns = [...SYMBOL_COLUMNS, ...(withEmbedding ? ([\"embedding\"] as const) : [])];\n const propMap = columns.map((c) => `${c}: r.${c}`).join(\", \");\n const cypher = `UNWIND $batch AS r CREATE (n:Symbol {${propMap}})`;\n for (let i = 0; i < nodes.length; i += BATCH) {\n const slice = nodes.slice(i, i + BATCH);\n const payload = slice.map((n) => buildSymbolRow(n, withEmbedding, this.embeddingDimension));\n await this.exec(cypher, { batch: payload });\n }\n }\n\n /**\n * Upserts edges. Both endpoints must already exist as `Symbol` nodes; rows where the\n * MATCH fails are silently dropped, matching Cypher semantics.\n *\n * Uses CREATE because the orchestrator wipes the repo's slice before writing, so\n * duplicates can't pre-exist within a single index pass.\n */\n async upsertEdges(edges: UpsertEdgeInput[]): Promise<void> {\n if (edges.length === 0) return;\n await this.connect();\n const byKind = new Map<EdgeKind, UpsertEdgeInput[]>();\n for (const e of edges) {\n const bucket = byKind.get(e.kind);\n if (bucket) bucket.push(e);\n else byKind.set(e.kind, [e]);\n }\n const BATCH = 500;\n for (const [kind, batch] of byKind) {\n const cypher = `UNWIND $batch AS r MATCH (a:Symbol {id: r.fromId}) MATCH (b:Symbol {id: r.toId}) CREATE (a)-[e:${kind} {line: r.line}]->(b)`;\n for (let i = 0; i < batch.length; i += BATCH) {\n const slice = batch.slice(i, i + BATCH);\n // Use 0 (not null) for missing line numbers so Kuzu can infer the struct field\n // as INT64 even when an entire batch happens to have no `line` set.\n const payload = slice.map((e) => ({\n fromId: e.fromId,\n toId: e.toId,\n line: typeof e.line === \"number\" ? e.line : 0,\n }));\n await this.exec(cypher, { batch: payload });\n }\n }\n }\n\n /**\n * Deletes all nodes (and incident edges via DETACH DELETE) for a repo. If `paths` is\n * provided, restricts the delete to nodes whose `path` is in the list - used by\n * incremental re-indexing.\n */\n async deleteByRepo(repoId: string, paths?: string[]): Promise<void> {\n await this.connect();\n if (paths && paths.length > 0) {\n await this.exec(\n \"MATCH (n:Symbol) WHERE n.repoId = $repoId AND n.path IN $paths DETACH DELETE n\",\n { repoId, paths },\n );\n return;\n }\n await this.exec(\"MATCH (n:Symbol) WHERE n.repoId = $repoId DETACH DELETE n\", { repoId });\n }\n\n /**\n * Returns counts of nodes (per kind) and edges (per kind) for a repo, plus the share of\n * non-File nodes that carry an embedding.\n */\n async stats(repoId: string): Promise<{\n nodes: Record<string, number>;\n edges: Record<string, number>;\n embeddingCoverage: number;\n }> {\n await this.connect();\n const nodes: Record<string, number> = {};\n for (const kind of NODE_KINDS) {\n const r = await this.query<{ count: number }>(\n \"MATCH (n:Symbol) WHERE n.repoId = $repoId AND n.kind = $kind RETURN count(n) AS count\",\n { repoId, kind },\n );\n nodes[kind] = Number(r.data[0]?.count ?? 0);\n }\n const edges: Record<string, number> = {};\n for (const kind of EDGE_KINDS) {\n const r = await this.query<{ count: number }>(\n `MATCH (a:Symbol)-[r:${kind}]->(b:Symbol)\n WHERE a.repoId = $repoId AND b.repoId = $repoId\n RETURN count(r) AS count`,\n { repoId },\n );\n edges[kind] = Number(r.data[0]?.count ?? 0);\n }\n const cov = await this.query<{ total: number | bigint; embedded: number | bigint }>(\n `MATCH (n:Symbol)\n WHERE n.repoId = $repoId AND n.kind <> 'File'\n RETURN count(n) AS total,\n count(n.embedding) AS embedded`,\n { repoId },\n );\n const row = cov.data[0];\n const total = Number(row?.total ?? 0);\n const embedded = Number(row?.embedded ?? 0);\n const coverage = total === 0 ? 0 : embedded / total;\n return { nodes, edges, embeddingCoverage: coverage };\n }\n\n /**\n * v0.1.x never creates an HNSW index - semantic search is brute-force via\n * `array_cosine_similarity`. Always returns `false`. Kept on the surface so callers\n * (e.g. `codegraph doctor`) can branch on a single boolean once the upstream Kuzu\n * fixes ship and we flip the index back on.\n */\n hasVectorIndex(): boolean {\n return false;\n }\n}\n\n/**\n * Build a fully-populated row for a Kuzu UNWIND batch. Every column in `SYMBOL_COLUMNS`\n * is present (typed default when missing) so Kuzu can infer a homogeneous struct schema\n * for the batch parameter. When `withEmbedding` is true the `embedding` field is also\n * populated - we either use the provided vector or a zero-vector of the configured\n * dimension so the struct schema stays uniform across the batch.\n */\nfunction buildSymbolRow(\n node: UpsertNodeInput,\n withEmbedding: boolean,\n embeddingDimension: number,\n): Record<string, unknown> {\n const src = node as unknown as Record<string, unknown>;\n const row: Record<string, unknown> = {};\n for (const col of SYMBOL_COLUMNS) {\n const value = src[col];\n row[col] = value === undefined || value === null ? defaultFor(col) : value;\n }\n row.id = node.id;\n row.kind = node.kind;\n if (withEmbedding) {\n const vec = node.embedding;\n row.embedding =\n Array.isArray(vec) && vec.length === embeddingDimension\n ? vec\n : new Array<number>(embeddingDimension).fill(0);\n }\n return row;\n}\n\n/**\n * Pull every `$name` placeholder out of a Cypher string. Skips occurrences inside\n * single/double-quoted string literals so a literal like `\"$10\"` is not mistaken for a\n * parameter. Returns a `Set` so callers can membership-test cheaply.\n */\nconst PARAM_PATTERN = /(?:\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|\\$([A-Za-z_][A-Za-z0-9_]*))/g;\nfunction extractParamNames(cypher: string): Set<string> {\n const out = new Set<string>();\n for (const match of cypher.matchAll(PARAM_PATTERN)) {\n if (match[1]) out.add(match[1]);\n }\n return out;\n}\n\n/**\n * Coalesce same-id rows down to the last occurrence. Required because we now use bare\n * CREATE (not MERGE) for inserts and Kuzu rejects primary-key collisions inside a single\n * UNWIND batch.\n */\nfunction dedupeById(nodes: UpsertNodeInput[]): UpsertNodeInput[] {\n const seen = new Map<string, UpsertNodeInput>();\n for (const n of nodes) {\n seen.set(n.id, n);\n }\n return Array.from(seen.values());\n}\n\n/** Convert Kuzu's row representation (Map or plain object) into a plain JSON object. */\nfunction normalizeRow(row: unknown): Record<string, unknown> {\n if (row instanceof Map) {\n const out: Record<string, unknown> = {};\n for (const [k, v] of row) {\n out[String(k)] = coerceValue(v);\n }\n return out;\n }\n if (row && typeof row === \"object\") {\n const src = row as Record<string, unknown>;\n const out: Record<string, unknown> = {};\n for (const k of Object.keys(src)) {\n out[k] = coerceValue(src[k]);\n }\n return out;\n }\n return { value: coerceValue(row) };\n}\n\n/**\n * Kuzu returns BIGINT columns as JS BigInt. Coerce to `number` when within Number.MAX_SAFE\n * for JSON-friendly downstream consumption.\n */\nfunction coerceValue(value: unknown): unknown {\n if (typeof value === \"bigint\") {\n if (value <= BigInt(Number.MAX_SAFE_INTEGER) && value >= BigInt(Number.MIN_SAFE_INTEGER)) {\n return Number(value);\n }\n return value.toString();\n }\n if (Array.isArray(value)) return value.map(coerceValue);\n return value;\n}\n\n/** Drain a Kuzu QueryResult (or array of them) into an array of row objects. */\nasync function collectAll(result: unknown): Promise<unknown[]> {\n // Multi-statement queries return an array; we keep only the last one (matches how the\n // final statement is the one that carries a `RETURN`).\n const target = Array.isArray(result) ? result[result.length - 1] : result;\n if (!target) return [];\n const getAll = (target as { getAll?: () => Promise<unknown[]> }).getAll;\n if (typeof getAll !== \"function\") return [];\n return getAll.call(target);\n}\n\n","import { EDGE_KINDS } from \"@codegraph/shared\";\n\n/**\n * Kuzu is schema-first. Unlike FalkorDB which is schema-less, every column we ever want to\n * SET on a node must exist up-front. We use ONE `Symbol` node table with a `kind` column\n * (Kuzu does not support multi-labels), and one REL table per `EdgeKind`.\n *\n * Columns are the union of every field across the `GraphNode` discriminated union in\n * `@codegraph/shared` plus the two embedding-namespace fields. Fields that are not\n * relevant to a given kind stay NULL.\n */\n\n/**\n * Per-column metadata so the upserter can build batches with explicit typed defaults.\n *\n * Kuzu's struct parameter type inference fails when a column is null on every row in a\n * batch (it defaults to STRING and rejects assignment to a BOOL/INT64 column). Concrete\n * defaults keep inference deterministic and let us skip clunky CAST() clauses.\n *\n * Convention: optional booleans default to `false`, optional ints to `0`, optional strings\n * to `\"\"`. We never check `WHERE n.foo IS NULL` in queries, so the lost null-distinction\n * is acceptable for v0.1.0.\n */\nexport const SYMBOL_COLUMN_SPEC = {\n id: \"STRING\",\n kind: \"STRING\",\n repoId: \"STRING\",\n name: \"STRING\",\n path: \"STRING\",\n lineStart: \"INT64\",\n lineEnd: \"INT64\",\n signature: \"STRING\",\n leadingComment: \"STRING\",\n isExported: \"BOOLEAN\",\n // File-specific\n language: \"STRING\",\n sizeBytes: \"INT64\",\n contentHash: \"STRING\",\n // Function-specific\n isAsync: \"BOOLEAN\",\n isArrow: \"BOOLEAN\",\n // Route-specific\n method: \"STRING\",\n routePath: \"STRING\",\n framework: \"STRING\",\n // Embedding namespace tag\n embeddingNamespace: \"STRING\",\n} as const;\n\nexport type SymbolColumn = keyof typeof SYMBOL_COLUMN_SPEC;\n\nexport const SYMBOL_COLUMNS = Object.keys(SYMBOL_COLUMN_SPEC) as SymbolColumn[];\n\n/** Return the typed default for an unset optional column. */\nexport function defaultFor(column: SymbolColumn): unknown {\n const t = SYMBOL_COLUMN_SPEC[column];\n if (t === \"BOOLEAN\") return false;\n if (t === \"INT64\") return 0;\n return \"\";\n}\n\n/** Optional per-edge metadata. Currently only `line`. */\nexport const EDGE_COLUMNS = [\"line\"] as const;\n\nexport type EdgeColumn = (typeof EDGE_COLUMNS)[number];\n\n/**\n * DDL statements that bring an empty Kuzu database to the codegraph schema.\n * `IF NOT EXISTS` makes `migrate()` idempotent so it can run on every connect.\n *\n * `embedding` is a fixed-dimension column - dimension is configured at migrate time and\n * baked into the schema. If a user later switches to an embedding provider with a\n * different dimension they must delete the on-disk graph directory to recreate it. The\n * embedding-namespace tag ensures we never silently mix dimensions.\n */\nexport function buildSchemaStatements(opts: { embeddingDimension: number }): string[] {\n const columnDefs = [\n \"id STRING\",\n \"kind STRING\",\n \"repoId STRING\",\n \"name STRING\",\n \"path STRING\",\n \"lineStart INT64\",\n \"lineEnd INT64\",\n \"signature STRING\",\n \"leadingComment STRING\",\n \"isExported BOOLEAN\",\n \"language STRING\",\n \"sizeBytes INT64\",\n \"contentHash STRING\",\n \"isAsync BOOLEAN\",\n \"isArrow BOOLEAN\",\n \"method STRING\",\n \"routePath STRING\",\n \"framework STRING\",\n \"embeddingNamespace STRING\",\n `embedding FLOAT[${opts.embeddingDimension}]`,\n \"PRIMARY KEY (id)\",\n ];\n const statements: string[] = [\n `CREATE NODE TABLE IF NOT EXISTS Symbol(${columnDefs.join(\", \")})`,\n ];\n for (const kind of EDGE_KINDS) {\n statements.push(\n `CREATE REL TABLE IF NOT EXISTS ${kind}(FROM Symbol TO Symbol, line INT64)`,\n );\n }\n return statements;\n}\n\n/**\n * Semantic search in v0.1.x is intentionally brute-force via Kuzu's built-in\n * `array_cosine_similarity` function - we do NOT create an HNSW vector index.\n *\n * Why: Kuzu 0.11.x has two open issues that make the HNSW path unusable for a\n * mutable graph workload:\n * - kuzudb/kuzu#5965: SET on a vector-indexed column is rejected with\n * \"Cannot set property vec in table embeddings because it is used in one or more\n * indexes\". The Kuzu team's own recommended workaround in that thread is\n * \"delay creation of the index itself\".\n * - kuzudb/kuzu#6040: DROP_VECTOR_INDEX leaves stale on-disk metadata, so once a\n * column has ever been indexed it becomes permanently un-writable - even fresh\n * CREATEs fail with \"Catalog exception: _N_<index>_UPPER does not exist\".\n *\n * `array_cosine_similarity` is a core Kuzu function (not part of the vector extension)\n * and runs in microseconds for the corpus sizes Phase 1 targets. We will switch back\n * to `CALL CREATE_VECTOR_INDEX` / `QUERY_VECTOR_INDEX` once the upstream fixes ship.\n */\nexport const SEMANTIC_SEARCH_MODE = \"brute-force\" as const;\n\n/** Default embedding dimension when none is supplied. Matches `text-embedding-3-small`. */\nexport const DEFAULT_EMBEDDING_DIMENSION = 1536;\n"],"mappings":";;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,SAAS,eAAe;AAEjC,YAAY,UAAU;;;ACmBf,IAAM,qBAAqB;AAAA,EAChC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EACT,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,YAAY;AAAA;AAAA,EAEZ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,aAAa;AAAA;AAAA,EAEb,SAAS;AAAA,EACT,SAAS;AAAA;AAAA,EAET,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,WAAW;AAAA;AAAA,EAEX,oBAAoB;AACtB;AAIO,IAAM,iBAAiB,OAAO,KAAK,kBAAkB;AAGrD,SAAS,WAAW,QAA+B;AACxD,QAAM,IAAI,mBAAmB,MAAM;AACnC,MAAI,MAAM,UAAW,QAAO;AAC5B,MAAI,MAAM,QAAS,QAAO;AAC1B,SAAO;AACT;AAGO,IAAM,eAAe,CAAC,MAAM;AAa5B,SAAS,sBAAsB,MAAgD;AACpF,QAAM,aA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AAO,CAAC;AACrB,QAAM,SAAU,OAAiD;AACjE,MAAI,OAAO,WAAW,WAAY,QAAO,CAAC;AAC1C,SAAO,OAAO,KAAK,MAAM;AAC3B;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
configPath,
|
|
4
4
|
loadConfig,
|
|
5
5
|
saveConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5WYXRWEY.js";
|
|
7
7
|
import "./chunk-B2TIVKUB.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-AVP24SX5.js";
|
|
9
9
|
import "./chunk-XGPZDCQ4.js";
|
|
10
10
|
export {
|
|
11
11
|
buildProgram,
|
|
@@ -2,23 +2,23 @@ import {
|
|
|
2
2
|
DEFAULT_EMBEDDING_DIMENSION,
|
|
3
3
|
EDGE_COLUMNS,
|
|
4
4
|
GraphDb,
|
|
5
|
+
SEMANTIC_SEARCH_MODE,
|
|
5
6
|
SYMBOL_COLUMNS,
|
|
6
7
|
SYMBOL_COLUMN_SPEC,
|
|
7
8
|
buildSchemaStatements,
|
|
8
|
-
buildVectorIndexStatements,
|
|
9
9
|
defaultDbPath,
|
|
10
10
|
defaultFor
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AVP24SX5.js";
|
|
12
12
|
import "./chunk-XGPZDCQ4.js";
|
|
13
13
|
export {
|
|
14
14
|
DEFAULT_EMBEDDING_DIMENSION,
|
|
15
15
|
EDGE_COLUMNS,
|
|
16
16
|
GraphDb,
|
|
17
|
+
SEMANTIC_SEARCH_MODE,
|
|
17
18
|
SYMBOL_COLUMNS,
|
|
18
19
|
SYMBOL_COLUMN_SPEC,
|
|
19
20
|
buildSchemaStatements,
|
|
20
|
-
buildVectorIndexStatements,
|
|
21
21
|
defaultDbPath,
|
|
22
22
|
defaultFor
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=src-
|
|
24
|
+
//# sourceMappingURL=src-M7HSEMBT.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leanlabsinnov/codegraph",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Live, queryable knowledge graph for your codebase. Indexes JS/TS into an embedded graph DB with embeddings and exposes an MCP server Claude Code and Cursor can call.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
],
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"author": "Ciril Cyriac",
|
|
17
|
-
"homepage": "https://github.com/
|
|
17
|
+
"homepage": "https://github.com/leanlabsinnov/codegraph",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/
|
|
20
|
+
"url": "https://github.com/leanlabsinnov/codegraph.git"
|
|
21
21
|
},
|
|
22
22
|
"type": "module",
|
|
23
23
|
"main": "./dist/index.js",
|