@optave/codegraph 3.0.2 → 3.0.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 +5 -5
- package/package.json +5 -5
- package/src/ast.js +9 -11
package/README.md
CHANGED
|
@@ -555,14 +555,14 @@ Self-measured on every release via CI ([build benchmarks](generated/benchmarks/B
|
|
|
555
555
|
|
|
556
556
|
| Metric | Latest |
|
|
557
557
|
|---|---|
|
|
558
|
-
| Build speed (native) | **
|
|
559
|
-
| Build speed (WASM) | **
|
|
558
|
+
| Build speed (native) | **11.5 ms/file** |
|
|
559
|
+
| Build speed (WASM) | **17.8 ms/file** |
|
|
560
560
|
| Query time | **3ms** |
|
|
561
561
|
| No-op rebuild (native) | **5ms** |
|
|
562
|
-
| 1-file rebuild (native) | **
|
|
563
|
-
| Query: fn-deps | **0.
|
|
562
|
+
| 1-file rebuild (native) | **384ms** |
|
|
563
|
+
| Query: fn-deps | **0.8ms** |
|
|
564
564
|
| Query: path | **0.8ms** |
|
|
565
|
-
| ~50,000 files (est.) | **~
|
|
565
|
+
| ~50,000 files (est.) | **~575.0s build** |
|
|
566
566
|
|
|
567
567
|
Metrics are normalized per file for cross-version comparability. Times above are for a full initial build — incremental rebuilds only re-parse changed files.
|
|
568
568
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optave/codegraph",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Local code graph CLI — parse codebases with tree-sitter, build dependency graphs, query them",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
73
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
74
|
-
"@optave/codegraph-darwin-arm64": "3.0.
|
|
75
|
-
"@optave/codegraph-darwin-x64": "3.0.
|
|
76
|
-
"@optave/codegraph-linux-x64-gnu": "3.0.
|
|
77
|
-
"@optave/codegraph-win32-x64-msvc": "3.0.
|
|
74
|
+
"@optave/codegraph-darwin-arm64": "3.0.3",
|
|
75
|
+
"@optave/codegraph-darwin-x64": "3.0.3",
|
|
76
|
+
"@optave/codegraph-linux-x64-gnu": "3.0.3",
|
|
77
|
+
"@optave/codegraph-win32-x64-msvc": "3.0.3"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@biomejs/biome": "^2.4.4",
|
package/src/ast.js
CHANGED
|
@@ -165,13 +165,12 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
|
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
const allRows = [];
|
|
169
169
|
|
|
170
170
|
for (const [relPath, symbols] of fileSymbols) {
|
|
171
|
-
const rows = [];
|
|
172
171
|
const defs = symbols.definitions || [];
|
|
173
172
|
|
|
174
|
-
// Pre-load all node IDs for this file into a map
|
|
173
|
+
// Pre-load all node IDs for this file into a map (read-only, fast)
|
|
175
174
|
const nodeIdMap = new Map();
|
|
176
175
|
for (const row of bulkGetNodeIds.all(relPath)) {
|
|
177
176
|
nodeIdMap.set(`${row.name}|${row.kind}|${row.line}`, row.id);
|
|
@@ -186,7 +185,7 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
|
|
|
186
185
|
parentNodeId =
|
|
187
186
|
nodeIdMap.get(`${parentDef.name}|${parentDef.kind}|${parentDef.line}`) || null;
|
|
188
187
|
}
|
|
189
|
-
|
|
188
|
+
allRows.push({
|
|
190
189
|
file: relPath,
|
|
191
190
|
line: call.line,
|
|
192
191
|
kind: 'call',
|
|
@@ -205,7 +204,7 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
|
|
|
205
204
|
// WASM path: walk the tree-sitter AST
|
|
206
205
|
const astRows = [];
|
|
207
206
|
walkAst(symbols._tree.rootNode, defs, relPath, astRows, nodeIdMap);
|
|
208
|
-
|
|
207
|
+
allRows.push(...astRows);
|
|
209
208
|
} else if (symbols.astNodes?.length) {
|
|
210
209
|
// Native path: use pre-extracted AST nodes from Rust
|
|
211
210
|
for (const n of symbols.astNodes) {
|
|
@@ -215,7 +214,7 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
|
|
|
215
214
|
parentNodeId =
|
|
216
215
|
nodeIdMap.get(`${parentDef.name}|${parentDef.kind}|${parentDef.line}`) || null;
|
|
217
216
|
}
|
|
218
|
-
|
|
217
|
+
allRows.push({
|
|
219
218
|
file: relPath,
|
|
220
219
|
line: n.line,
|
|
221
220
|
kind: n.kind,
|
|
@@ -227,14 +226,13 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
|
|
|
227
226
|
}
|
|
228
227
|
}
|
|
229
228
|
}
|
|
229
|
+
}
|
|
230
230
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
totalInserted += rows.length;
|
|
234
|
-
}
|
|
231
|
+
if (allRows.length > 0) {
|
|
232
|
+
tx(allRows);
|
|
235
233
|
}
|
|
236
234
|
|
|
237
|
-
debug(`AST extraction: ${
|
|
235
|
+
debug(`AST extraction: ${allRows.length} nodes stored`);
|
|
238
236
|
}
|
|
239
237
|
|
|
240
238
|
/**
|