@colbymchenry/codegraph-win32-arm64 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dist/bin/codegraph.js +145 -29
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/context/formatter.d.ts +7 -1
- package/lib/dist/context/formatter.d.ts.map +1 -1
- package/lib/dist/context/formatter.js +12 -6
- package/lib/dist/context/formatter.js.map +1 -1
- package/lib/dist/context/index.d.ts +12 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +60 -14
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +37 -0
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +101 -1
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +25 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +160 -3
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +400 -33
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +16 -3
- package/lib/dist/directory.d.ts +29 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +52 -0
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +6 -0
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.d.ts +48 -12
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
- package/lib/dist/extraction/generated-detection.js +176 -11
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +38 -2
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +106 -0
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +284 -53
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +19 -4
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
- package/lib/dist/extraction/languages/erlang.js +58 -22
- package/lib/dist/extraction/languages/erlang.js.map +1 -1
- package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
- package/lib/dist/extraction/languages/objc.js +4 -0
- package/lib/dist/extraction/languages/objc.js.map +1 -1
- package/lib/dist/extraction/languages/rust.d.ts +20 -0
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +47 -20
- package/lib/dist/extraction/languages/rust.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +7 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +20 -1
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +2 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +5 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +106 -50
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +2 -0
- package/lib/dist/graph/queries.js.map +1 -1
- package/lib/dist/graph/traversal.js +1 -1
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/index.d.ts +22 -0
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +117 -1
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +4 -3
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +8 -6
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +37 -5
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts +22 -8
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +65 -48
- package/lib/dist/installer/targets/codex.js.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.d.ts +32 -0
- package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-cli.js +209 -0
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js +238 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts +47 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.js +219 -0
- package/lib/dist/installer/targets/copilot-vscode.js.map +1 -0
- package/lib/dist/installer/targets/registry.d.ts.map +1 -1
- package/lib/dist/installer/targets/registry.js +6 -0
- package/lib/dist/installer/targets/registry.js.map +1 -1
- package/lib/dist/installer/targets/toml.d.ts +6 -5
- package/lib/dist/installer/targets/toml.d.ts.map +1 -1
- package/lib/dist/installer/targets/toml.js +99 -20
- package/lib/dist/installer/targets/toml.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +5 -5
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +1 -1
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +6 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +54 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +10 -0
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +51 -3
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +9 -6
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +10 -8
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +3 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +45 -3
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.d.ts +137 -0
- package/lib/dist/mcp/explore-dedup.d.ts.map +1 -0
- package/lib/dist/mcp/explore-dedup.js +236 -0
- package/lib/dist/mcp/explore-dedup.js.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts +289 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.js +558 -0
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -0
- package/lib/dist/mcp/explore-session-state.d.ts +217 -0
- package/lib/dist/mcp/explore-session-state.d.ts.map +1 -0
- package/lib/dist/mcp/explore-session-state.js +322 -0
- package/lib/dist/mcp/explore-session-state.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +24 -0
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +67 -6
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +3 -1
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +6 -1
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +2 -2
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +8 -3
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +16 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +36 -13
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +276 -10
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +2402 -241
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/project-config.d.ts +23 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +39 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +21 -19
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +39 -11
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +11 -1
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +18 -2
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +15 -4
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +30 -0
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +295 -5
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/path-aliases.d.ts +6 -4
- package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
- package/lib/dist/resolution/path-aliases.js +125 -17
- package/lib/dist/resolution/path-aliases.js.map +1 -1
- package/lib/dist/search/identifier-segments.d.ts +10 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -1
- package/lib/dist/search/identifier-segments.js +29 -0
- package/lib/dist/search/identifier-segments.js.map +1 -1
- package/lib/dist/search/query-paths.d.ts +57 -0
- package/lib/dist/search/query-paths.d.ts.map +1 -0
- package/lib/dist/search/query-paths.js +298 -0
- package/lib/dist/search/query-paths.js.map +1 -0
- package/lib/dist/search/query-utils.d.ts +1 -1
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +13 -3
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +22 -0
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +51 -5
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/types.d.ts +20 -1
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +1 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/kernel/codegraph-kernel.node +0 -0
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -47,6 +47,7 @@ exports.buildDefaultIgnore = buildDefaultIgnore;
|
|
|
47
47
|
exports.buildScopeIgnore = buildScopeIgnore;
|
|
48
48
|
exports.discoverEmbeddedRepoRoots = discoverEmbeddedRepoRoots;
|
|
49
49
|
exports.findUnindexedIgnoredRepos = findUnindexedIgnoredRepos;
|
|
50
|
+
exports.getGitChangedFiles = getGitChangedFiles;
|
|
50
51
|
exports.scanDirectory = scanDirectory;
|
|
51
52
|
exports.scanDirectoryAsync = scanDirectoryAsync;
|
|
52
53
|
const fs = __importStar(require("fs"));
|
|
@@ -59,6 +60,7 @@ const tree_sitter_1 = require("./tree-sitter");
|
|
|
59
60
|
const parse_pool_1 = require("./parse-pool");
|
|
60
61
|
const store_writer_1 = require("./store-writer");
|
|
61
62
|
const kernel_1 = require("./kernel");
|
|
63
|
+
const generated_detection_1 = require("./generated-detection");
|
|
62
64
|
const grammars_1 = require("./grammars");
|
|
63
65
|
const project_config_1 = require("../project-config");
|
|
64
66
|
const directory_1 = require("../directory");
|
|
@@ -1056,7 +1058,14 @@ function getGitChangedFiles(rootDir) {
|
|
|
1056
1058
|
}
|
|
1057
1059
|
}
|
|
1058
1060
|
function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null, exclude = null) {
|
|
1059
|
-
const output = (0, child_process_1.execFileSync)('git',
|
|
1061
|
+
const output = (0, child_process_1.execFileSync)('git',
|
|
1062
|
+
// `-uall` lists individual untracked files instead of collapsing an
|
|
1063
|
+
// entirely-untracked directory into one `?? dir/` entry, which would
|
|
1064
|
+
// otherwise be dropped here (only embedded git repos are recursed into
|
|
1065
|
+
// below). Nested untracked git repos still collapse to `?? repo/` even
|
|
1066
|
+
// with `-uall` — git never crosses a repo boundary — so the recursion
|
|
1067
|
+
// still handles them. (#1213)
|
|
1068
|
+
['status', '--porcelain', '--no-renames', '-uall'], { cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
1060
1069
|
// This repo's own ignore rules — built-in defaults (#407) plus its .gitignore.
|
|
1061
1070
|
// Change detection must exclude the SAME files the full index does, but git
|
|
1062
1071
|
// status hides neither: it ignores nothing for *tracked* paths, and the
|
|
@@ -1343,10 +1352,47 @@ class ExtractionOrchestrator {
|
|
|
1343
1352
|
* hasn't run yet so single-file re-index paths can detect on the spot.
|
|
1344
1353
|
*/
|
|
1345
1354
|
detectedFrameworkNames = null;
|
|
1355
|
+
/**
|
|
1356
|
+
* Scope matcher for SCOPED syncs, memoized on the mtimes of the two root
|
|
1357
|
+
* files it is derived from (`codegraph.json`, `.gitignore`). See
|
|
1358
|
+
* {@link scopedSyncMatcher}.
|
|
1359
|
+
*/
|
|
1360
|
+
scopedMatcher = null;
|
|
1346
1361
|
constructor(rootDir, queries) {
|
|
1347
1362
|
this.rootDir = rootDir;
|
|
1348
1363
|
this.queries = queries;
|
|
1349
1364
|
}
|
|
1365
|
+
/**
|
|
1366
|
+
* The scope matcher a scoped sync applies to the paths it was handed — the
|
|
1367
|
+
* same `buildScopeIgnore` the full scan uses, so an explicitly-passed path
|
|
1368
|
+
* that is OUT of scope (a user `exclude` in `codegraph.json`, a `.gitignore`
|
|
1369
|
+
* rule, a built-in default) is treated exactly as the full walk would treat
|
|
1370
|
+
* it: absent, hence removed if tracked, never parsed (#1590).
|
|
1371
|
+
*
|
|
1372
|
+
* Memoized on the root config + root `.gitignore` mtimes: building the
|
|
1373
|
+
* matcher runs embedded-repo discovery (`git ls-files`), which would defeat
|
|
1374
|
+
* the scoped path's whole point (skipping O(repo) work) if paid per sync.
|
|
1375
|
+
* Two `stat`s per sync while nothing changed. An embedded repo created
|
|
1376
|
+
* between config edits joins the scoped matcher on the next full sync, the
|
|
1377
|
+
* same lifecycle the watcher's own matcher already has.
|
|
1378
|
+
*/
|
|
1379
|
+
scopedSyncMatcher() {
|
|
1380
|
+
const key = [project_config_1.PROJECT_CONFIG_FILENAME, '.gitignore']
|
|
1381
|
+
.map((name) => {
|
|
1382
|
+
try {
|
|
1383
|
+
return String(fs.statSync(path.join(this.rootDir, name)).mtimeMs);
|
|
1384
|
+
}
|
|
1385
|
+
catch {
|
|
1386
|
+
return '-';
|
|
1387
|
+
}
|
|
1388
|
+
})
|
|
1389
|
+
.join('|');
|
|
1390
|
+
if (this.scopedMatcher && this.scopedMatcher.key === key)
|
|
1391
|
+
return this.scopedMatcher.matcher;
|
|
1392
|
+
const matcher = buildScopeIgnore(this.rootDir);
|
|
1393
|
+
this.scopedMatcher = { key, matcher };
|
|
1394
|
+
return matcher;
|
|
1395
|
+
}
|
|
1350
1396
|
/**
|
|
1351
1397
|
* Build a filesystem-backed ResolutionContext sufficient for framework
|
|
1352
1398
|
* detection. Graph-query methods (getNodesByName etc.) return empty because
|
|
@@ -1472,6 +1518,10 @@ class ExtractionOrchestrator {
|
|
|
1472
1518
|
});
|
|
1473
1519
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
1474
1520
|
console.error(`[phase-timing] scan: ${Date.now() - tScan}ms (${files.length} files)`);
|
|
1521
|
+
// A re-index over an existing DB skips unchanged-hash files at the store,
|
|
1522
|
+
// which would preserve wiped zero-node rows (#1541) — drop them first so
|
|
1523
|
+
// this run stores their files fresh. No-op on a fresh DB.
|
|
1524
|
+
this.healZeroNodeRows();
|
|
1475
1525
|
// Detect frameworks once per indexAll run using the scanned file list.
|
|
1476
1526
|
// Names are passed to each parse call so framework-specific extractors
|
|
1477
1527
|
// (route nodes, middleware, etc.) run after the tree-sitter pass.
|
|
@@ -1618,29 +1668,27 @@ class ExtractionOrchestrator {
|
|
|
1618
1668
|
// Store: on the writer thread when active (fresh DB — bundles applied
|
|
1619
1669
|
// in the same file order this chain dispatches them), else on the main
|
|
1620
1670
|
// thread (SQLite connections are per-thread).
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
if (
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
});
|
|
1634
|
-
}
|
|
1635
|
-
else {
|
|
1636
|
-
storeWriter.send(this.buildFreshStoreBundle(filePath, content, language, stats, result));
|
|
1637
|
-
}
|
|
1638
|
-
await storeWriter.waitBelow(STORE_WRITER_WINDOW);
|
|
1671
|
+
const language = (0, grammars_1.detectLanguage)(filePath, content, overrides);
|
|
1672
|
+
if (storeWriter) {
|
|
1673
|
+
if (result.kernelBuffers) {
|
|
1674
|
+
// Buffers go to the writer as-is; the worker decodes + finalizes.
|
|
1675
|
+
// The main thread's only per-file work stays O(1) + the content hash.
|
|
1676
|
+
storeWriter.send({
|
|
1677
|
+
kernel: true,
|
|
1678
|
+
filePath,
|
|
1679
|
+
language,
|
|
1680
|
+
buffers: result.kernelBuffers,
|
|
1681
|
+
file: this.buildFileRecord(filePath, content, language, stats, nodeCount, result.errors),
|
|
1682
|
+
});
|
|
1639
1683
|
}
|
|
1640
1684
|
else {
|
|
1641
|
-
|
|
1642
|
-
await this.storeExtractionResult(filePath, content, language, stats, materialized, commitYield);
|
|
1685
|
+
storeWriter.send(this.buildFreshStoreBundle(filePath, content, language, stats, result));
|
|
1643
1686
|
}
|
|
1687
|
+
await storeWriter.waitBelow(STORE_WRITER_WINDOW);
|
|
1688
|
+
}
|
|
1689
|
+
else {
|
|
1690
|
+
const materialized = (0, kernel_1.materializeKernelResult)(result, filePath, language);
|
|
1691
|
+
await this.storeExtractionResult(filePath, content, language, stats, materialized, commitYield);
|
|
1644
1692
|
}
|
|
1645
1693
|
if (result.errors.length > 0) {
|
|
1646
1694
|
for (const err of result.errors) {
|
|
@@ -1671,16 +1719,19 @@ class ExtractionOrchestrator {
|
|
|
1671
1719
|
}
|
|
1672
1720
|
onProgress?.({ phase: 'parsing', current: processed, total, currentFile: filePath });
|
|
1673
1721
|
};
|
|
1674
|
-
const recordParseFailure = (filePath, err) => {
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1722
|
+
const recordParseFailure = async (filePath, content, stats, err) => {
|
|
1723
|
+
await storeResult(filePath, content, stats, {
|
|
1724
|
+
nodes: [],
|
|
1725
|
+
edges: [],
|
|
1726
|
+
unresolvedReferences: [],
|
|
1727
|
+
errors: [{
|
|
1728
|
+
message: err instanceof Error ? err.message : String(err),
|
|
1729
|
+
filePath,
|
|
1730
|
+
severity: 'error',
|
|
1731
|
+
code: 'parse_error',
|
|
1732
|
+
}],
|
|
1733
|
+
durationMs: 0,
|
|
1682
1734
|
});
|
|
1683
|
-
onProgress?.({ phase: 'parsing', current: processed, total });
|
|
1684
1735
|
};
|
|
1685
1736
|
// Commit buffered parses to the DB in file order, advancing the cursor over
|
|
1686
1737
|
// contiguous completed results. Runs after each parse settles (and once more
|
|
@@ -1705,7 +1756,7 @@ class ExtractionOrchestrator {
|
|
|
1705
1756
|
if (item.ok)
|
|
1706
1757
|
await storeResult(item.filePath, item.content, item.stats, item.result);
|
|
1707
1758
|
else
|
|
1708
|
-
recordParseFailure(item.filePath, item.err);
|
|
1759
|
+
await recordParseFailure(item.filePath, item.content, item.stats, item.err);
|
|
1709
1760
|
}
|
|
1710
1761
|
}
|
|
1711
1762
|
catch (err) {
|
|
@@ -1725,7 +1776,7 @@ class ExtractionOrchestrator {
|
|
|
1725
1776
|
completed.set(seq, { ok: true, filePath, content, stats, result });
|
|
1726
1777
|
}
|
|
1727
1778
|
catch (parseErr) {
|
|
1728
|
-
completed.set(seq, { ok: false, filePath, err: parseErr });
|
|
1779
|
+
completed.set(seq, { ok: false, filePath, content, stats, err: parseErr });
|
|
1729
1780
|
}
|
|
1730
1781
|
flushOrdered();
|
|
1731
1782
|
})();
|
|
@@ -1797,15 +1848,18 @@ class ExtractionOrchestrator {
|
|
|
1797
1848
|
// useful symbols. The single-file extractFile path already enforces
|
|
1798
1849
|
// this; the bulk path used to silently skip the check.
|
|
1799
1850
|
if (stats.size > MAX_FILE_SIZE) {
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1851
|
+
await storeResult(filePath, content, stats, {
|
|
1852
|
+
nodes: [],
|
|
1853
|
+
edges: [],
|
|
1854
|
+
unresolvedReferences: [],
|
|
1855
|
+
errors: [{
|
|
1856
|
+
message: `File exceeds max size (${stats.size} > ${MAX_FILE_SIZE})`,
|
|
1857
|
+
filePath,
|
|
1858
|
+
severity: 'warning',
|
|
1859
|
+
code: 'size_exceeded',
|
|
1860
|
+
}],
|
|
1861
|
+
durationMs: 0,
|
|
1807
1862
|
});
|
|
1808
|
-
onProgress?.({ phase: 'parsing', current: processed, total });
|
|
1809
1863
|
continue;
|
|
1810
1864
|
}
|
|
1811
1865
|
// Parse on the pool (main thread stays unblocked). Errors/timeouts are
|
|
@@ -1906,8 +1960,15 @@ class ExtractionOrchestrator {
|
|
|
1906
1960
|
stillFailing.push(errEntry);
|
|
1907
1961
|
continue;
|
|
1908
1962
|
}
|
|
1963
|
+
// The pool hands kernel results back as an undecoded buffer transport
|
|
1964
|
+
// (`nodes`/`edges` EMPTY, tables in kernelBuffers). The main loop
|
|
1965
|
+
// decodes or forwards to the store worker; this path stores directly,
|
|
1966
|
+
// so decode here — otherwise a kernel-language retry passes the gate
|
|
1967
|
+
// below via `errors.length === 0`, stores nothing, and the file is
|
|
1968
|
+
// permanently recorded as "(0 symbols)" with the error erased (#1541).
|
|
1969
|
+
const language = (0, grammars_1.detectLanguage)(filePath, content, overrides);
|
|
1970
|
+
result = (0, kernel_1.materializeKernelResult)(result, filePath, language);
|
|
1909
1971
|
if (result.nodes.length > 0 || result.errors.length === 0) {
|
|
1910
|
-
const language = (0, grammars_1.detectLanguage)(filePath, content, overrides);
|
|
1911
1972
|
const stats = await fsp.stat(path.join(this.rootDir, filePath));
|
|
1912
1973
|
await this.storeExtractionResult(filePath, content, language, stats, result, commitYield);
|
|
1913
1974
|
const idx = errors.indexOf(errEntry);
|
|
@@ -1954,13 +2015,20 @@ class ExtractionOrchestrator {
|
|
|
1954
2015
|
catch {
|
|
1955
2016
|
continue;
|
|
1956
2017
|
}
|
|
2018
|
+
// Same undecoded-transport hazard as the first retry pass (#1541).
|
|
2019
|
+
const language = (0, grammars_1.detectLanguage)(filePath, fullContent, overrides);
|
|
2020
|
+
result = (0, kernel_1.materializeKernelResult)(result, filePath, language);
|
|
1957
2021
|
if (result.nodes.length > 0 || result.errors.length === 0) {
|
|
1958
|
-
const language = (0, grammars_1.detectLanguage)(filePath, fullContent, overrides);
|
|
1959
2022
|
const stats = await fsp.stat(path.join(this.rootDir, filePath));
|
|
1960
2023
|
await this.storeExtractionResult(filePath, fullContent, language, stats, result, commitYield);
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
2024
|
+
// Salvaged from comment-stripped source: keep a visible trace in
|
|
2025
|
+
// the summary instead of erasing the failure outright — the
|
|
2026
|
+
// stored result may be missing whatever the failing parse choked
|
|
2027
|
+
// on, and a silently "clean" file here is how an index quietly
|
|
2028
|
+
// disagrees with a later per-file sync of the same bytes (#1565).
|
|
2029
|
+
errEntry.severity = 'warning';
|
|
2030
|
+
errEntry.code = 'salvaged_stripped';
|
|
2031
|
+
errEntry.message = `Indexed from comment-stripped source after repeated parse failures (symbols may be incomplete until the file is re-indexed): ${errEntry.message}`;
|
|
1964
2032
|
filesErrored--;
|
|
1965
2033
|
filesIndexed++;
|
|
1966
2034
|
totalNodes += result.nodes.length;
|
|
@@ -2087,9 +2155,10 @@ class ExtractionOrchestrator {
|
|
|
2087
2155
|
durationMs: 0,
|
|
2088
2156
|
};
|
|
2089
2157
|
}
|
|
2158
|
+
const language = (0, grammars_1.detectLanguage)(relativePath, content, (0, project_config_1.loadExtensionOverrides)(this.rootDir));
|
|
2090
2159
|
// Check file size
|
|
2091
2160
|
if (stats.size > MAX_FILE_SIZE) {
|
|
2092
|
-
|
|
2161
|
+
const result = {
|
|
2093
2162
|
nodes: [],
|
|
2094
2163
|
edges: [],
|
|
2095
2164
|
unresolvedReferences: [],
|
|
@@ -2103,9 +2172,10 @@ class ExtractionOrchestrator {
|
|
|
2103
2172
|
],
|
|
2104
2173
|
durationMs: 0,
|
|
2105
2174
|
};
|
|
2175
|
+
await this.storeExtractionResult(relativePath, content, language, stats, result, (0, cooperative_yield_1.createYielder)());
|
|
2176
|
+
return result;
|
|
2106
2177
|
}
|
|
2107
2178
|
// Detect language (honoring the project's codegraph.json extension overrides)
|
|
2108
|
-
const language = (0, grammars_1.detectLanguage)(relativePath, content, (0, project_config_1.loadExtensionOverrides)(this.rootDir));
|
|
2109
2179
|
if (!(0, grammars_1.isLanguageSupported)(language)) {
|
|
2110
2180
|
return {
|
|
2111
2181
|
nodes: [],
|
|
@@ -2121,15 +2191,43 @@ class ExtractionOrchestrator {
|
|
|
2121
2191
|
const frameworkNames = this.ensureDetectedFrameworks();
|
|
2122
2192
|
const result = (0, tree_sitter_1.extractFromSource)(relativePath, content, language, frameworkNames);
|
|
2123
2193
|
// Store in database
|
|
2124
|
-
|
|
2125
|
-
await this.storeExtractionResult(relativePath, content, language, stats, result, (0, cooperative_yield_1.createYielder)());
|
|
2126
|
-
}
|
|
2194
|
+
await this.storeExtractionResult(relativePath, content, language, stats, result, (0, cooperative_yield_1.createYielder)());
|
|
2127
2195
|
return result;
|
|
2128
2196
|
}
|
|
2129
2197
|
/**
|
|
2130
2198
|
* Store extraction result in database
|
|
2131
2199
|
*/
|
|
2200
|
+
/**
|
|
2201
|
+
* Delete file rows recorded with ZERO nodes so their files re-index.
|
|
2202
|
+
*
|
|
2203
|
+
* No extraction path stores an empty, error-free result for a
|
|
2204
|
+
* symbol-bearing language — even an empty file keeps its file node — so a
|
|
2205
|
+
* zero-node row is a wiped one (#1541: an interrupted parse's retry stored
|
|
2206
|
+
* an undecoded kernel transport). The wiped row's content hash matches the
|
|
2207
|
+
* on-disk bytes, so every hash-based reconcile skips the file forever;
|
|
2208
|
+
* deleting the row lets the normal add path repair it. File-level-only
|
|
2209
|
+
* languages (yaml, twig, properties) are left alone. Deleting a zero-node
|
|
2210
|
+
* row cascades nothing: it has no nodes, so no edges or refs either.
|
|
2211
|
+
*/
|
|
2212
|
+
healZeroNodeRows() {
|
|
2213
|
+
for (const f of this.queries.getAllFiles()) {
|
|
2214
|
+
// A zero-node row WITH recorded errors is a deliberate skip marker
|
|
2215
|
+
// (#1557: oversized / repeatedly-unparseable files are persisted with
|
|
2216
|
+
// their reason so syncs stop retrying them) — leave those alone. The
|
|
2217
|
+
// #1541 wipe rows are the error-FREE zero-node rows.
|
|
2218
|
+
if (f.nodeCount === 0 &&
|
|
2219
|
+
!(0, grammars_1.isFileLevelOnlyLanguage)(f.language) &&
|
|
2220
|
+
(f.errors === undefined || f.errors.length === 0)) {
|
|
2221
|
+
this.queries.deleteFile(f.path);
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2132
2225
|
async storeExtractionResult(filePath, content, language, stats, result, onYield) {
|
|
2226
|
+
// A kernel result can arrive as an undecoded buffer transport (empty
|
|
2227
|
+
// node/edge arrays, tables riding in kernelBuffers). Decode it before
|
|
2228
|
+
// storing — persisting the transport as-is records the file as having no
|
|
2229
|
+
// symbols at all (#1541). No-op for already-decoded results.
|
|
2230
|
+
result = (0, kernel_1.materializeKernelResult)(result, filePath, language);
|
|
2133
2231
|
// Bulk inserts run in bounded sub-transactions with a yield between, so a
|
|
2134
2232
|
// giant generated file (tens of thousands of symbols) can't block the
|
|
2135
2233
|
// event loop — and the #850 watchdog heartbeat — for the whole store.
|
|
@@ -2138,11 +2236,24 @@ class ExtractionOrchestrator {
|
|
|
2138
2236
|
// is unchanged: a partially-stored file has no record and re-indexes.
|
|
2139
2237
|
const STORE_CHUNK = 2000;
|
|
2140
2238
|
const contentHash = hashContent(content);
|
|
2141
|
-
// Check if file already exists and hasn't changed
|
|
2239
|
+
// Check if file already exists and hasn't changed. A skip/failure MARKER
|
|
2240
|
+
// row (zero nodes + recorded errors, #1557) never blocks a store carrying
|
|
2241
|
+
// real content: markers are written BEFORE the retry pass under the same
|
|
2242
|
+
// content hash, so treating them as "no changes" would silently discard a
|
|
2243
|
+
// successful retry's symbols — a permanent empty file presented as
|
|
2244
|
+
// recovered (the #1541 wipe, reintroduced through the marker path).
|
|
2142
2245
|
const existingFile = this.queries.getFileByPath(filePath);
|
|
2143
2246
|
if (existingFile && existingFile.contentHash === contentHash) {
|
|
2144
|
-
|
|
2247
|
+
const existingIsMarker = existingFile.nodeCount === 0 && (existingFile.errors?.length ?? 0) > 0;
|
|
2248
|
+
const incomingHasContent = result.nodes.length > 0;
|
|
2249
|
+
if (!existingIsMarker || !incomingHasContent) {
|
|
2250
|
+
return; // No changes
|
|
2251
|
+
}
|
|
2145
2252
|
}
|
|
2253
|
+
// Re-decided on every re-index of a changed file, so a banner added (or
|
|
2254
|
+
// removed) by an edit is reflected on the next sync (#1500). Computed after
|
|
2255
|
+
// the unchanged-file early return so untouched files pay nothing.
|
|
2256
|
+
const generated = (0, generated_detection_1.detectGeneratedFile)(filePath, content);
|
|
2146
2257
|
// Snapshot incoming cross-file edges BEFORE deleting this file's nodes.
|
|
2147
2258
|
// `deleteFile` cascades to delete every edge whose source OR target is a
|
|
2148
2259
|
// node in this file (edges.FK ... ON DELETE CASCADE). Edges whose SOURCE is
|
|
@@ -2202,6 +2313,7 @@ class ExtractionOrchestrator {
|
|
|
2202
2313
|
indexedAt: Date.now(),
|
|
2203
2314
|
nodeCount: result.nodes.length,
|
|
2204
2315
|
errors: result.errors.length > 0 ? result.errors : undefined,
|
|
2316
|
+
generated,
|
|
2205
2317
|
},
|
|
2206
2318
|
});
|
|
2207
2319
|
if (crossFileIncomingEdges.length > 0) {
|
|
@@ -2257,6 +2369,7 @@ class ExtractionOrchestrator {
|
|
|
2257
2369
|
indexedAt: Date.now(),
|
|
2258
2370
|
nodeCount: result.nodes.length,
|
|
2259
2371
|
errors: result.errors.length > 0 ? result.errors : undefined,
|
|
2372
|
+
generated,
|
|
2260
2373
|
};
|
|
2261
2374
|
this.queries.upsertFile(fileRecord);
|
|
2262
2375
|
}
|
|
@@ -2276,6 +2389,10 @@ class ExtractionOrchestrator {
|
|
|
2276
2389
|
indexedAt: Date.now(),
|
|
2277
2390
|
nodeCount,
|
|
2278
2391
|
errors: resultErrors.length > 0 ? resultErrors : undefined,
|
|
2392
|
+
// Decided here, once, while the content is already in memory — never at
|
|
2393
|
+
// query time (#1500). The header scan short-circuits on a single
|
|
2394
|
+
// substring test for ~every hand-written file.
|
|
2395
|
+
generated: (0, generated_detection_1.detectGeneratedFile)(filePath, content),
|
|
2279
2396
|
};
|
|
2280
2397
|
}
|
|
2281
2398
|
buildFreshStoreBundle(filePath, content, language, stats, result) {
|
|
@@ -2313,6 +2430,65 @@ class ExtractionOrchestrator {
|
|
|
2313
2430
|
this.queries.insertUnresolvedRefsBatch(resurrected);
|
|
2314
2431
|
}
|
|
2315
2432
|
}
|
|
2433
|
+
/**
|
|
2434
|
+
* Re-open, for re-resolution, every resolution edge whose answer this sync
|
|
2435
|
+
* may have changed — the fix for index drift (CG-33).
|
|
2436
|
+
*
|
|
2437
|
+
* Incremental sync re-resolves only the references IN the changed files, but
|
|
2438
|
+
* resolution's answer is a function of the WHOLE graph: a reference binds to
|
|
2439
|
+
* one of the same-named definitions project-wide, so adding or removing a
|
|
2440
|
+
* definition of `pct` can change which `pct` every other file's `pct(...)`
|
|
2441
|
+
* should bind to. Those other files are never revisited, and their references
|
|
2442
|
+
* resolved successfully once and were deleted from `unresolved_refs`, so
|
|
2443
|
+
* nothing existed to revisit them with — the index kept an answer that was
|
|
2444
|
+
* correct against an older graph. Measured on codegraph's own long-lived
|
|
2445
|
+
* index: 4.3% of distinct edges differed from a clean rebuild, in BOTH
|
|
2446
|
+
* directions, overwhelmingly `calls`. See docs/benchmarks/index-drift-cg33.md.
|
|
2447
|
+
*
|
|
2448
|
+
* This deletes each affected edge and re-inserts it as the reference that
|
|
2449
|
+
* created it (the refName/refKind stamp), status='pending', for the sync's
|
|
2450
|
+
* resolution sweep to bind against the post-sync graph — the same input a
|
|
2451
|
+
* full rebuild resolves from, which is what makes the two converge.
|
|
2452
|
+
*
|
|
2453
|
+
* Deliberately conservative in three ways, because a wrong deletion is a
|
|
2454
|
+
* permanent edge loss while a missed rebind is only residual drift:
|
|
2455
|
+
* - an edge with no refName stamp (synthesized, or built by an engine older
|
|
2456
|
+
* than the stamp) is left ALONE rather than reconstructed from the target's
|
|
2457
|
+
* plain name, same rule as `resurrectRefFromDroppedEdge`;
|
|
2458
|
+
* - edges whose source is in a file this sync already re-extracted are
|
|
2459
|
+
* skipped — their references were re-resolved from scratch moments ago;
|
|
2460
|
+
* - very common names are skipped by the per-name ceiling in
|
|
2461
|
+
* `getResolutionEdgesByTargetName`.
|
|
2462
|
+
*
|
|
2463
|
+
* Returns the number of references resurrected.
|
|
2464
|
+
*/
|
|
2465
|
+
resurrectStaleResolutionEdges(definitionDelta, changedFilePaths) {
|
|
2466
|
+
if (definitionDelta.length === 0)
|
|
2467
|
+
return 0;
|
|
2468
|
+
const alreadyFresh = new Set(changedFilePaths);
|
|
2469
|
+
const candidates = this.queries.getResolutionEdgesByTargetName(definitionDelta);
|
|
2470
|
+
const edgeIds = [];
|
|
2471
|
+
const refs = [];
|
|
2472
|
+
for (const e of candidates) {
|
|
2473
|
+
if (alreadyFresh.has(e.sourceFilePath))
|
|
2474
|
+
continue;
|
|
2475
|
+
const ref = resurrectRefFromDroppedEdge(e);
|
|
2476
|
+
if (!ref)
|
|
2477
|
+
continue; // no stamp — never delete what we cannot restore
|
|
2478
|
+
edgeIds.push(e.edgeId);
|
|
2479
|
+
refs.push(ref);
|
|
2480
|
+
}
|
|
2481
|
+
if (refs.length === 0)
|
|
2482
|
+
return 0;
|
|
2483
|
+
// Delete first. The sweep re-inserts whichever edge resolution now picks,
|
|
2484
|
+
// and `insertEdges` is INSERT OR IGNORE against idx_edges_identity — so a
|
|
2485
|
+
// rebind to the same target is a clean no-op, but leaving the old row in
|
|
2486
|
+
// place for a rebind ELSEWHERE would keep both, turning drift into
|
|
2487
|
+
// duplication.
|
|
2488
|
+
this.queries.deleteEdgesByIds(edgeIds);
|
|
2489
|
+
this.queries.insertUnresolvedRefsBatch(refs);
|
|
2490
|
+
return refs.length;
|
|
2491
|
+
}
|
|
2316
2492
|
/**
|
|
2317
2493
|
* Sync the index with the current file state.
|
|
2318
2494
|
*
|
|
@@ -2340,6 +2516,10 @@ class ExtractionOrchestrator {
|
|
|
2340
2516
|
let filesRemoved = 0;
|
|
2341
2517
|
let nodesUpdated = 0;
|
|
2342
2518
|
const changedFilePaths = [];
|
|
2519
|
+
// `file\0name` definition pairs for the files this sync touches, sampled
|
|
2520
|
+
// BEFORE their nodes are replaced/deleted. Compared against the post-store
|
|
2521
|
+
// pairs below to derive `definitionDelta` (CG-33).
|
|
2522
|
+
const pairsBefore = new Set();
|
|
2343
2523
|
onProgress?.({
|
|
2344
2524
|
phase: 'scanning',
|
|
2345
2525
|
current: 0,
|
|
@@ -2365,7 +2545,20 @@ class ExtractionOrchestrator {
|
|
|
2365
2545
|
// reads `filesChecked === 0 && durationMs === 0` as the
|
|
2366
2546
|
// lock-unavailable signature (#449).
|
|
2367
2547
|
const unique = [...new Set(scopedPaths)];
|
|
2368
|
-
|
|
2548
|
+
// A scoped path is "present" only if it exists AND is in scope — the
|
|
2549
|
+
// same two gates the full walk applies (source extension, scope
|
|
2550
|
+
// matcher). Without the scope gate a caller's stale view of scope
|
|
2551
|
+
// leaked straight into the index: the watcher re-parsed a file the
|
|
2552
|
+
// user had just excluded in `codegraph.json` while `codegraph sync`
|
|
2553
|
+
// removed it (#1590). Out-of-scope paths fall out of `currentFiles`,
|
|
2554
|
+
// so a tracked one takes the removal branch below, exactly as a full
|
|
2555
|
+
// sync would treat it. (`include`-forced paths pass: ScopeIgnore
|
|
2556
|
+
// applies the include precedence itself.)
|
|
2557
|
+
const scope = this.scopedSyncMatcher();
|
|
2558
|
+
const overrides = (0, project_config_1.loadExtensionOverrides)(this.rootDir);
|
|
2559
|
+
currentFiles = unique.filter((p) => (0, grammars_1.isSourceFile)(p, overrides) &&
|
|
2560
|
+
!scope.ignores(p) &&
|
|
2561
|
+
fs.existsSync(path.join(this.rootDir, p)));
|
|
2369
2562
|
trackedFiles = [];
|
|
2370
2563
|
for (const p of unique) {
|
|
2371
2564
|
const rec = this.queries.getFileByPath(p);
|
|
@@ -2381,6 +2574,9 @@ class ExtractionOrchestrator {
|
|
|
2381
2574
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
2382
2575
|
console.error(`[phase-timing] sync-scan: ${Date.now() - tSyncScan}ms (${currentFiles.length} files)`);
|
|
2383
2576
|
filesChecked = currentFiles.length;
|
|
2577
|
+
// Full reconcile only (scoped syncs must not touch rows outside their
|
|
2578
|
+
// scope): drop zero-node rows so the wiped files re-index as adds below.
|
|
2579
|
+
this.healZeroNodeRows();
|
|
2384
2580
|
const tTracked = Date.now();
|
|
2385
2581
|
trackedFiles = this.queries.getAllFiles();
|
|
2386
2582
|
if (process.env.CODEGRAPH_SYNTH_TIMINGS)
|
|
@@ -2406,6 +2602,10 @@ class ExtractionOrchestrator {
|
|
|
2406
2602
|
// failed until the symbol reappears somewhere. (A deleted file whose
|
|
2407
2603
|
// CALLERS are also being deleted is fine: their nodes cascade later
|
|
2408
2604
|
// in this loop and take the resurrected rows with them.)
|
|
2605
|
+
// Every name this file defined is about to stop existing here, which
|
|
2606
|
+
// narrows the candidate set for that name repo-wide (CG-33).
|
|
2607
|
+
for (const pair of this.queries.getNodeNamePairsByFiles([tracked.path]))
|
|
2608
|
+
pairsBefore.add(pair);
|
|
2409
2609
|
const incoming = this.queries.getCrossFileIncomingEdgesWithTarget(tracked.path);
|
|
2410
2610
|
if (incoming.length > 0) {
|
|
2411
2611
|
const resurrected = incoming
|
|
@@ -2470,6 +2670,14 @@ class ExtractionOrchestrator {
|
|
|
2470
2670
|
filesModified++;
|
|
2471
2671
|
}
|
|
2472
2672
|
}
|
|
2673
|
+
// Sampled here — after the add/modify classification, before any file is
|
|
2674
|
+
// re-extracted — because `storeExtractionResult` deletes a file's nodes
|
|
2675
|
+
// before inserting the new ones, so this is the last point the pre-edit
|
|
2676
|
+
// definition set is readable (CG-33).
|
|
2677
|
+
if (filesToIndex.length > 0) {
|
|
2678
|
+
for (const pair of this.queries.getNodeNamePairsByFiles(filesToIndex))
|
|
2679
|
+
pairsBefore.add(pair);
|
|
2680
|
+
}
|
|
2473
2681
|
// Load only grammars needed for changed files
|
|
2474
2682
|
if (filesToIndex.length > 0) {
|
|
2475
2683
|
const overrides = (0, project_config_1.loadExtensionOverrides)(this.rootDir);
|
|
@@ -2493,6 +2701,28 @@ class ExtractionOrchestrator {
|
|
|
2493
2701
|
const result = await this.indexFile(filePath);
|
|
2494
2702
|
nodesUpdated += result.nodes.length;
|
|
2495
2703
|
}
|
|
2704
|
+
// Names whose definition set this sync changed: a `file\0name` pair present
|
|
2705
|
+
// before but not after (removed/renamed away) or after but not before
|
|
2706
|
+
// (added). A pair on both sides is untouched as far as resolution's
|
|
2707
|
+
// candidate set is concerned — only its node id moved, which
|
|
2708
|
+
// reattachCrossFileEdges already follows — so an edit that only changes
|
|
2709
|
+
// bodies yields an empty delta and no downstream rebind work (CG-33).
|
|
2710
|
+
//
|
|
2711
|
+
// Compared per FILE, not as one name set over the whole batch: a commit
|
|
2712
|
+
// that adds `collect` to a new file while an unrelated changed file already
|
|
2713
|
+
// defined `collect` must still flag the name, and a bare name set cancels
|
|
2714
|
+
// exactly that case out. That miss left the largest residual class in the
|
|
2715
|
+
// first measurement of this fix.
|
|
2716
|
+
const pairsAfter = this.queries.getNodeNamePairsByFiles(filesToIndex);
|
|
2717
|
+
const deltaNames = new Set();
|
|
2718
|
+
const nameOf = (pair) => pair.slice(pair.indexOf('\0') + 1);
|
|
2719
|
+
for (const pair of pairsBefore)
|
|
2720
|
+
if (!pairsAfter.has(pair))
|
|
2721
|
+
deltaNames.add(nameOf(pair));
|
|
2722
|
+
for (const pair of pairsAfter)
|
|
2723
|
+
if (!pairsBefore.has(pair))
|
|
2724
|
+
deltaNames.add(nameOf(pair));
|
|
2725
|
+
const definitionDelta = [...deltaNames];
|
|
2496
2726
|
return {
|
|
2497
2727
|
filesChecked,
|
|
2498
2728
|
filesAdded,
|
|
@@ -2501,6 +2731,7 @@ class ExtractionOrchestrator {
|
|
|
2501
2731
|
nodesUpdated,
|
|
2502
2732
|
durationMs: Date.now() - startTime,
|
|
2503
2733
|
changedFilePaths: changedFilePaths.length > 0 ? changedFilePaths : undefined,
|
|
2734
|
+
definitionDelta: definitionDelta.length > 0 ? definitionDelta : undefined,
|
|
2504
2735
|
};
|
|
2505
2736
|
}
|
|
2506
2737
|
/**
|