@colbymchenry/codegraph-win32-arm64 1.4.1 → 1.5.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.
Files changed (171) hide show
  1. package/bin/codegraph.cmd +1 -1
  2. package/lib/dist/bin/codegraph.js +61 -15
  3. package/lib/dist/bin/codegraph.js.map +1 -1
  4. package/lib/dist/context/index.d.ts.map +1 -1
  5. package/lib/dist/context/index.js +41 -11
  6. package/lib/dist/context/index.js.map +1 -1
  7. package/lib/dist/db/index.d.ts +142 -0
  8. package/lib/dist/db/index.d.ts.map +1 -1
  9. package/lib/dist/db/index.js +267 -6
  10. package/lib/dist/db/index.js.map +1 -1
  11. package/lib/dist/db/queries.d.ts +74 -2
  12. package/lib/dist/db/queries.d.ts.map +1 -1
  13. package/lib/dist/db/queries.js +287 -20
  14. package/lib/dist/db/queries.js.map +1 -1
  15. package/lib/dist/db/sqlite-adapter.d.ts +3 -1
  16. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  17. package/lib/dist/db/sqlite-adapter.js +22 -4
  18. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  19. package/lib/dist/db/wal-valve.d.ts +15 -2
  20. package/lib/dist/db/wal-valve.d.ts.map +1 -1
  21. package/lib/dist/db/wal-valve.js +88 -6
  22. package/lib/dist/db/wal-valve.js.map +1 -1
  23. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  24. package/lib/dist/extraction/grammars.js +63 -0
  25. package/lib/dist/extraction/grammars.js.map +1 -1
  26. package/lib/dist/extraction/index.d.ts +32 -3
  27. package/lib/dist/extraction/index.d.ts.map +1 -1
  28. package/lib/dist/extraction/index.js +254 -61
  29. package/lib/dist/extraction/index.js.map +1 -1
  30. package/lib/dist/extraction/kernel/decode.d.ts +9 -0
  31. package/lib/dist/extraction/kernel/decode.d.ts.map +1 -0
  32. package/lib/dist/extraction/kernel/decode.js +162 -0
  33. package/lib/dist/extraction/kernel/decode.js.map +1 -0
  34. package/lib/dist/extraction/kernel/index.d.ts +64 -0
  35. package/lib/dist/extraction/kernel/index.d.ts.map +1 -0
  36. package/lib/dist/extraction/kernel/index.js +279 -0
  37. package/lib/dist/extraction/kernel/index.js.map +1 -0
  38. package/lib/dist/extraction/kernel/layout.d.ts +101 -0
  39. package/lib/dist/extraction/kernel/layout.d.ts.map +1 -0
  40. package/lib/dist/extraction/kernel/layout.js +104 -0
  41. package/lib/dist/extraction/kernel/layout.js.map +1 -0
  42. package/lib/dist/extraction/kernel/loader.d.ts +103 -0
  43. package/lib/dist/extraction/kernel/loader.d.ts.map +1 -0
  44. package/lib/dist/extraction/kernel/loader.js +146 -0
  45. package/lib/dist/extraction/kernel/loader.js.map +1 -0
  46. package/lib/dist/extraction/languages/c-cpp.d.ts +14 -0
  47. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  48. package/lib/dist/extraction/languages/c-cpp.js +849 -12
  49. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  50. package/lib/dist/extraction/parse-pool.d.ts +8 -0
  51. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  52. package/lib/dist/extraction/parse-pool.js +15 -0
  53. package/lib/dist/extraction/parse-pool.js.map +1 -1
  54. package/lib/dist/extraction/parse-worker.js +35 -1
  55. package/lib/dist/extraction/parse-worker.js.map +1 -1
  56. package/lib/dist/extraction/store-worker.d.ts +24 -0
  57. package/lib/dist/extraction/store-worker.d.ts.map +1 -0
  58. package/lib/dist/extraction/store-worker.js +139 -0
  59. package/lib/dist/extraction/store-worker.js.map +1 -0
  60. package/lib/dist/extraction/store-writer.d.ts +63 -0
  61. package/lib/dist/extraction/store-writer.d.ts.map +1 -0
  62. package/lib/dist/extraction/store-writer.js +174 -0
  63. package/lib/dist/extraction/store-writer.js.map +1 -0
  64. package/lib/dist/extraction/tree-sitter.d.ts +22 -4
  65. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  66. package/lib/dist/extraction/tree-sitter.js +151 -6
  67. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  68. package/lib/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  69. package/lib/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  70. package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  71. package/lib/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  72. package/lib/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  73. package/lib/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  74. package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  75. package/lib/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  76. package/lib/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  77. package/lib/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  78. package/lib/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  79. package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  80. package/lib/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  81. package/lib/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  82. package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
  83. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  84. package/lib/dist/extraction/wasm-runtime-flags.js +27 -3
  85. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  86. package/lib/dist/index.d.ts +14 -2
  87. package/lib/dist/index.d.ts.map +1 -1
  88. package/lib/dist/index.js +188 -10
  89. package/lib/dist/index.js.map +1 -1
  90. package/lib/dist/installer/beta-signup.d.ts +54 -0
  91. package/lib/dist/installer/beta-signup.d.ts.map +1 -0
  92. package/lib/dist/installer/beta-signup.js +178 -0
  93. package/lib/dist/installer/beta-signup.js.map +1 -0
  94. package/lib/dist/installer/index.d.ts.map +1 -1
  95. package/lib/dist/installer/index.js +11 -0
  96. package/lib/dist/installer/index.js.map +1 -1
  97. package/lib/dist/mcp/tools.d.ts.map +1 -1
  98. package/lib/dist/mcp/tools.js +27 -0
  99. package/lib/dist/mcp/tools.js.map +1 -1
  100. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +1 -1
  101. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  102. package/lib/dist/resolution/c-fnptr-synthesizer.js +574 -132
  103. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  104. package/lib/dist/resolution/callback-synthesizer.d.ts +54 -10
  105. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  106. package/lib/dist/resolution/callback-synthesizer.js +249 -157
  107. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  108. package/lib/dist/resolution/cooperative-yield.d.ts +10 -2
  109. package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -1
  110. package/lib/dist/resolution/cooperative-yield.js +6 -4
  111. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  112. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  113. package/lib/dist/resolution/frameworks/go.js +29 -6
  114. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  115. package/lib/dist/resolution/import-resolver.d.ts +2 -3
  116. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  117. package/lib/dist/resolution/import-resolver.js +166 -7
  118. package/lib/dist/resolution/import-resolver.js.map +1 -1
  119. package/lib/dist/resolution/index.d.ts +87 -2
  120. package/lib/dist/resolution/index.d.ts.map +1 -1
  121. package/lib/dist/resolution/index.js +716 -130
  122. package/lib/dist/resolution/index.js.map +1 -1
  123. package/lib/dist/resolution/memory-budget.d.ts +48 -0
  124. package/lib/dist/resolution/memory-budget.d.ts.map +1 -0
  125. package/lib/dist/resolution/memory-budget.js +162 -0
  126. package/lib/dist/resolution/memory-budget.js.map +1 -0
  127. package/lib/dist/resolution/name-matcher.d.ts +12 -1
  128. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  129. package/lib/dist/resolution/name-matcher.js +387 -95
  130. package/lib/dist/resolution/name-matcher.js.map +1 -1
  131. package/lib/dist/resolution/resolver-pool.d.ts +106 -0
  132. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -0
  133. package/lib/dist/resolution/resolver-pool.js +344 -0
  134. package/lib/dist/resolution/resolver-pool.js.map +1 -0
  135. package/lib/dist/resolution/resolver-worker.d.ts +17 -0
  136. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -0
  137. package/lib/dist/resolution/resolver-worker.js +141 -0
  138. package/lib/dist/resolution/resolver-worker.js.map +1 -0
  139. package/lib/dist/resolution/types.d.ts +3 -0
  140. package/lib/dist/resolution/types.d.ts.map +1 -1
  141. package/lib/dist/sync/watcher.d.ts +25 -1
  142. package/lib/dist/sync/watcher.d.ts.map +1 -1
  143. package/lib/dist/sync/watcher.js +76 -3
  144. package/lib/dist/sync/watcher.js.map +1 -1
  145. package/lib/dist/types.d.ts +41 -2
  146. package/lib/dist/types.d.ts.map +1 -1
  147. package/lib/dist/types.js +26 -1
  148. package/lib/dist/types.js.map +1 -1
  149. package/lib/dist/ui/color.d.ts +21 -0
  150. package/lib/dist/ui/color.d.ts.map +1 -0
  151. package/lib/dist/ui/color.js +42 -0
  152. package/lib/dist/ui/color.js.map +1 -0
  153. package/lib/dist/ui/glyphs.d.ts +35 -10
  154. package/lib/dist/ui/glyphs.d.ts.map +1 -1
  155. package/lib/dist/ui/glyphs.js +59 -12
  156. package/lib/dist/ui/glyphs.js.map +1 -1
  157. package/lib/dist/ui/shimmer-progress.d.ts.map +1 -1
  158. package/lib/dist/ui/shimmer-progress.js +78 -4
  159. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  160. package/lib/dist/ui/shimmer-worker.js +25 -17
  161. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  162. package/lib/dist/ui/types.d.ts +0 -2
  163. package/lib/dist/ui/types.d.ts.map +1 -1
  164. package/lib/dist/upgrade/index.d.ts +7 -0
  165. package/lib/dist/upgrade/index.d.ts.map +1 -1
  166. package/lib/dist/upgrade/index.js +18 -5
  167. package/lib/dist/upgrade/index.js.map +1 -1
  168. package/lib/kernel/codegraph-kernel.node +0 -0
  169. package/lib/node_modules/.package-lock.json +1 -1
  170. package/lib/package.json +6 -1
  171. package/package.json +6 -2
@@ -5,6 +5,21 @@
5
5
  * runtime, so a rename can't silently regress the fix).
6
6
  */
7
7
  export declare const WASM_RUNTIME_FLAGS: readonly string[];
8
+ /**
9
+ * Node CLI options (not V8 flags) passed alongside the WASM flags on every
10
+ * launch path. `--disable-warning=ExperimentalWarning` mutes node:sqlite's
11
+ * "SQLite is an experimental feature" warning, which is emitted once per
12
+ * THREAD — the main process plus every parse worker — so during indexing it
13
+ * prints repeatedly, interleaved with the progress UI. Node options apply
14
+ * process-wide (workers inherit them), so the command line covers everything.
15
+ *
16
+ * Deliberately NOT part of the {@link processHasWasmRuntimeFlags} re-exec
17
+ * gate: a launcher passing only the WASM flags (an older installed bundle
18
+ * running a newer dist) must not trigger a whole re-exec over a cosmetic
19
+ * warning.
20
+ */
21
+ export declare function nodeRuntimeFlagsFor(nodeVersion: string): readonly string[];
22
+ export declare const NODE_RUNTIME_FLAGS: readonly string[];
8
23
  /**
9
24
  * Env var carrying the *host* PID (the relauncher's own parent) across the
10
25
  * re-exec. Without `--liftoff-only` the CLI re-execs itself once, inserting an
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-runtime-flags.d.ts","sourceRoot":"","sources":["../../src/extraction/wasm-runtime-flags.ts"],"names":[],"mappings":"AAkCA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAuB,CAAC;AAQxE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,wBAAwB,CAAC;AAEnD,mFAAmF;AACnF,wBAAgB,0BAA0B,CACxC,QAAQ,GAAE,SAAS,MAAM,EAAqB,GAC7C,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,QAAQ,GAAE,SAAS,MAAM,EAAqB,GAC7C,MAAM,EAAE,CAGV;AAED;;;;;;;;GAQG;AACH,wBAAgB,oCAAoC,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAkB7E"}
1
+ {"version":3,"file":"wasm-runtime-flags.d.ts","sourceRoot":"","sources":["../../src/extraction/wasm-runtime-flags.ts"],"names":[],"mappings":"AAkCA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAuB,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAQ1E;AAED,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAA+C,CAAC;AAQhG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,wBAAwB,CAAC;AAEnD,mFAAmF;AACnF,wBAAgB,0BAA0B,CACxC,QAAQ,GAAE,SAAS,MAAM,EAAqB,GAC7C,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,QAAQ,GAAE,SAAS,MAAM,EAAqB,GAC7C,MAAM,EAAE,CAKV;AAED;;;;;;;;GAQG;AACH,wBAAgB,oCAAoC,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAkB7E"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HOST_PPID_ENV = exports.WASM_RUNTIME_FLAGS = void 0;
3
+ exports.HOST_PPID_ENV = exports.NODE_RUNTIME_FLAGS = exports.WASM_RUNTIME_FLAGS = void 0;
4
+ exports.nodeRuntimeFlagsFor = nodeRuntimeFlagsFor;
4
5
  exports.processHasWasmRuntimeFlags = processHasWasmRuntimeFlags;
5
6
  exports.buildRelaunchArgv = buildRelaunchArgv;
6
7
  exports.relaunchWithWasmRuntimeFlagsIfNeeded = relaunchWithWasmRuntimeFlagsIfNeeded;
@@ -44,6 +45,29 @@ const child_process_1 = require("child_process");
44
45
  * runtime, so a rename can't silently regress the fix).
45
46
  */
46
47
  exports.WASM_RUNTIME_FLAGS = ['--liftoff-only'];
48
+ /**
49
+ * Node CLI options (not V8 flags) passed alongside the WASM flags on every
50
+ * launch path. `--disable-warning=ExperimentalWarning` mutes node:sqlite's
51
+ * "SQLite is an experimental feature" warning, which is emitted once per
52
+ * THREAD — the main process plus every parse worker — so during indexing it
53
+ * prints repeatedly, interleaved with the progress UI. Node options apply
54
+ * process-wide (workers inherit them), so the command line covers everything.
55
+ *
56
+ * Deliberately NOT part of the {@link processHasWasmRuntimeFlags} re-exec
57
+ * gate: a launcher passing only the WASM flags (an older installed bundle
58
+ * running a newer dist) must not trigger a whole re-exec over a cosmetic
59
+ * warning.
60
+ */
61
+ function nodeRuntimeFlagsFor(nodeVersion) {
62
+ // `--disable-warning` landed in Node 20.11 / 21.3; older nodes treat it as
63
+ // a fatal "bad option" at spawn. Those runtimes can't run codegraph anyway
64
+ // (node:sqlite needs >= 22.5), but let them reach our own version messaging
65
+ // instead of a cryptic spawn failure.
66
+ const [major = 0, minor = 0] = nodeVersion.split('.').map(Number);
67
+ const supported = major > 21 || (major === 21 && minor >= 3) || (major === 20 && minor >= 11);
68
+ return supported ? ['--disable-warning=ExperimentalWarning'] : [];
69
+ }
70
+ exports.NODE_RUNTIME_FLAGS = nodeRuntimeFlagsFor(process.versions.node);
47
71
  /**
48
72
  * Env var set on the relaunched child so a detection slip can never cause an
49
73
  * infinite re-exec loop. Also lets users force-disable the relaunch.
@@ -71,8 +95,8 @@ function processHasWasmRuntimeFlags(execArgv = process.execArgv) {
71
95
  * and its args. Pure — exported for unit testing.
72
96
  */
73
97
  function buildRelaunchArgv(scriptPath, scriptArgs, execArgv = process.execArgv) {
74
- const preserved = execArgv.filter((arg) => !exports.WASM_RUNTIME_FLAGS.includes(arg));
75
- return [...exports.WASM_RUNTIME_FLAGS, ...preserved, scriptPath, ...scriptArgs];
98
+ const preserved = execArgv.filter((arg) => !exports.WASM_RUNTIME_FLAGS.includes(arg) && !exports.NODE_RUNTIME_FLAGS.includes(arg));
99
+ return [...exports.NODE_RUNTIME_FLAGS, ...exports.WASM_RUNTIME_FLAGS, ...preserved, scriptPath, ...scriptArgs];
76
100
  }
77
101
  /**
78
102
  * If the current process is missing the WASM runtime flags, re-exec it once
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-runtime-flags.js","sourceRoot":"","sources":["../../src/extraction/wasm-runtime-flags.ts"],"names":[],"mappings":";;;AA8DA,gEAIC;AAOD,8CAOC;AAWD,oFAkBC;AA7GD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,iDAA0C;AAE1C;;;;;GAKG;AACU,QAAA,kBAAkB,GAAsB,CAAC,gBAAgB,CAAC,CAAC;AAExE;;;GAGG;AACH,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAEvD;;;;;;;;;;GAUG;AACU,QAAA,aAAa,GAAG,qBAAqB,CAAC;AAEnD,mFAAmF;AACnF,SAAgB,0BAA0B,CACxC,WAA8B,OAAO,CAAC,QAAQ;IAE9C,OAAO,0BAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,UAA6B,EAC7B,WAA8B,OAAO,CAAC,QAAQ;IAE9C,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,0BAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9E,OAAO,CAAC,GAAG,0BAAkB,EAAE,GAAG,SAAS,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,oCA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C;AACjG,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,oCAAoC,CAAC,UAAkB;IACrE,IAAI,0BAA0B,EAAE;QAAE,OAAO;IACzC,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAAE,OAAO;IAC5C,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB;QAAE,OAAO;IAE9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE;QAC/C,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,CAAC,qBAAa,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACzF,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,0EAA0E;QAC1E,iEAAiE;QACjE,OAAO;IACT,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * A local-first code intelligence system that builds a semantic
5
5
  * knowledge graph from any codebase.
6
6
  */
7
- import { Node, Edge, FileRecord, ExtractionResult, Subgraph, TraversalOptions, SearchOptions, SearchResult, SegmentMatch, Context, GraphStats, TaskInput, TaskContext, BuildContextOptions, FindRelevantContextOptions } from './types';
7
+ import { Node, NodeKind, Edge, FileRecord, ExtractionResult, Subgraph, TraversalOptions, SearchOptions, SearchResult, SegmentMatch, Context, GraphStats, TaskInput, TaskContext, BuildContextOptions, FindRelevantContextOptions } from './types';
8
8
  import { IndexProgress, IndexResult, SyncResult } from './extraction';
9
9
  import { ResolutionResult } from './resolution';
10
10
  import { WatchOptions, PendingFile } from './sync';
@@ -47,6 +47,8 @@ export interface IndexOptions {
47
47
  signal?: AbortSignal;
48
48
  /** Enable verbose logging (worker lifecycle, memory, timeouts) */
49
49
  verbose?: boolean;
50
+ /** Watcher fast path: reconcile ONLY these project-relative paths (see ExtractionOrchestrator.sync). */
51
+ paths?: string[];
50
52
  }
51
53
  /**
52
54
  * Main CodeGraph class
@@ -273,7 +275,7 @@ export declare class CodeGraph {
273
275
  * Resolve references in batches to keep memory bounded on large codebases.
274
276
  * Processes chunks of unresolved refs, persisting results after each batch.
275
277
  */
276
- resolveReferencesBatched(onProgress?: (current: number, total: number) => void): Promise<ResolutionResult>;
278
+ resolveReferencesBatched(onProgress?: (current: number, total: number) => void, onSynthesisProgress?: (done: number, total: number) => void, backpressure?: () => Promise<void> | null): Promise<ResolutionResult>;
277
279
  /**
278
280
  * References extracted but never attempted by a resolution pass. Zero on a
279
281
  * healthy index — a completed pass consumes every pending row (resolving it
@@ -327,6 +329,16 @@ export declare class CodeGraph {
327
329
  getNodesByName(name: string): Node[];
328
330
  /** Nodes whose name starts with `prefix` (index range scan, capped). */
329
331
  getNodesByNamePrefix(prefix: string, limit?: number): Node[];
332
+ /**
333
+ * Nodes whose name CONTAINS `substring` (LIKE scan, ASCII-case-insensitive,
334
+ * shortest-first). The camel-infix lookup FTS can't do — `profileInfo`
335
+ * inside `getProfileInfoV2` is one FTS token (#1196).
336
+ */
337
+ getNodesByNameSubstring(substring: string, options?: {
338
+ kinds?: NodeKind[];
339
+ limit?: number;
340
+ excludePrefix?: boolean;
341
+ }): Node[];
330
342
  /**
331
343
  * Search nodes by text
332
344
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,IAAI,EACJ,IAA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KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE;IAI5C;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG;QAC9B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf;IAQD;;;;;;;OAOG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIrD;;;;;;;;;OASG;IACG,mBAAmB,CACvB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,QAAQ,CAAC;IAIpB;;;;;;;;;;;;OAYG;IACG,YAAY,CAChB,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC;IAQhC;;OAEG;IACH,QAAQ,IAAI,IAAI;IAIhB;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;IACH,OAAO,IAAI,IAAI;IAIf;;;;;OAKG;IACH,YAAY,IAAI,IAAI;CAIrB;AAGD,eAAe,SAAS,CAAC"}
package/lib/dist/index.js CHANGED
@@ -60,6 +60,7 @@ const query_utils_1 = require("./search/query-utils");
60
60
  const version_1 = require("./mcp/version");
61
61
  const identifier_segments_1 = require("./search/identifier-segments");
62
62
  const cooperative_yield_1 = require("./resolution/cooperative-yield");
63
+ const resolver_pool_1 = require("./resolution/resolver-pool");
63
64
  // Re-export types for consumers
64
65
  __exportStar(require("./types"), exports);
65
66
  // Storage building blocks for embedded/SDK consumers that drive the graph
@@ -380,13 +381,31 @@ class CodeGraph {
380
381
  // the final fold-up before the interval is restored in the finally.
381
382
  // Kill switch: CODEGRAPH_NO_WAL_DEFER=1. Non-WAL journal modes (some
382
383
  // network filesystems) have no WAL to defer — skip.
383
- const deferWal = process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
384
+ // Fast-init: on a COMPLETELY fresh DB, trade crash-durability for speed
385
+ // during the bulk build (journal in memory, no fsync). Safe because the
386
+ // DB is disposable until the index completes — index_state stays
387
+ // 'indexing' and a crashed init is re-run from scratch; existing DBs
388
+ // (re-index/sync) never take this path. Kill switch:
389
+ // CODEGRAPH_NO_FAST_INIT=1 (same pattern as CODEGRAPH_NO_WAL_DEFER).
390
+ const freshDb = this.queries.getNodeAndEdgeCount().nodes === 0;
391
+ const fastInit = process.env.CODEGRAPH_NO_FAST_INIT !== '1' && freshDb;
392
+ if (fastInit) {
393
+ try {
394
+ this.db.getDb().pragma('journal_mode = MEMORY');
395
+ this.db.getDb().pragma('synchronous = OFF');
396
+ }
397
+ catch { /* keep WAL */ }
398
+ }
399
+ const deferWal = !fastInit && process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
384
400
  let walValve = null;
385
401
  let priorAutocheckpoint = 1000;
402
+ // Set when the fastInit+pool path below defers autocheckpointing, so the
403
+ // finally knows to restore the interval on that path too.
404
+ let restoreAutocheckpoint = false;
386
405
  if (deferWal) {
387
406
  priorAutocheckpoint = this.db.getWalAutocheckpoint();
388
407
  this.db.setWalAutocheckpoint(0);
389
- walValve = new wal_valve_1.WalCheckpointValve(this.db, undefined, undefined, options.verbose ? (m) => console.log(`[wal-valve] ${m}`) : undefined);
408
+ walValve = new wal_valve_1.WalCheckpointValve(this.db, (0, wal_valve_1.resolveWalValveMb)(process.env.CODEGRAPH_WAL_VALVE_MB, this.db.getDbFileSizeBytes()), undefined, options.verbose ? (m) => console.log(`[wal-valve] ${m}`) : undefined);
390
409
  walValve.start();
391
410
  }
392
411
  try {
@@ -406,7 +425,36 @@ class CodeGraph {
406
425
  this.queries.clearNameSegmentVocab();
407
426
  }
408
427
  catch { /* vocab is advisory — never fail an index over it */ }
409
- const result = await this.orchestrator.indexAll(options.onProgress, options.signal, options.verbose, walValve ? () => walValve.backpressure() : undefined);
428
+ // Bulk FTS mode for the mass-insert phase: drop the per-row FTS sync
429
+ // triggers, rebuild nodes_fts once from the nodes table afterwards.
430
+ // Crash inside the window is healed on the next DatabaseConnection.open.
431
+ this.db.beginBulkNodeLoad();
432
+ // Fresh-init only: also drop the parse-lane secondary indexes for the
433
+ // mass insert (the store-writer's B-tree-maintenance floor, plan §4d)
434
+ // and rebuild each in one scan afterwards. Incremental runs keep them
435
+ // — they delete per-file rows mid-phase through the file_path indexes.
436
+ if (freshDb)
437
+ this.db.beginBulkParseLoad();
438
+ let result;
439
+ try {
440
+ result = await this.orchestrator.indexAll(options.onProgress, options.signal, options.verbose, walValve ? () => walValve.backpressure() : undefined,
441
+ // Store-writer offload is fresh-DB-only: with any pre-existing
442
+ // data the store path must read (existing-file checks, cross-file
443
+ // edge snapshots) and delete, which belongs on one thread.
444
+ freshDb ? { dbPath: this.db.getPath(), fastInit } : null);
445
+ }
446
+ finally {
447
+ if (freshDb) {
448
+ const tIdx = Date.now();
449
+ await this.db.endBulkParseLoad();
450
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
451
+ console.error(`[phase-timing] parse-index-rebuild: ${Date.now() - tIdx}ms`);
452
+ }
453
+ const tFts = Date.now();
454
+ this.db.endBulkNodeLoad();
455
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
456
+ console.error(`[phase-timing] fts-rebuild: ${Date.now() - tFts}ms`);
457
+ }
410
458
  // Fold the parse phase's WAL BEFORE the first post-parse reads
411
459
  // (resolver re-init and resolution both read on the main thread):
412
460
  // paging a bulk-write-sized WAL there is what blew the #850
@@ -422,27 +470,65 @@ class CodeGraph {
422
470
  // and silently drop themselves. Re-initializing here gives them a
423
471
  // chance to see the actual project before resolution runs.
424
472
  if (result.success && result.filesIndexed > 0) {
473
+ const tReinit = Date.now();
425
474
  this.resolver.initialize();
426
475
  // Cross-file finalization (e.g. NestJS RouterModule prefixes). Runs
427
476
  // before resolution so updated names show up in subsequent reads.
428
477
  this.resolver.runPostExtract();
478
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
479
+ console.error(`[phase-timing] resolver-reinit: ${Date.now() - tReinit}ms`);
429
480
  }
430
481
  // Resolve references to create call/import/extends edges
431
482
  if (result.success && result.filesIndexed > 0) {
432
483
  // Get count without loading all refs into memory
433
484
  const unresolvedCount = this.queries.getUnresolvedReferencesCount();
485
+ // Fast-init leaves the DB in memory-journal (rollback) mode, where
486
+ // the parallel resolver pool's read connections would contend with
487
+ // the main writer's exclusive commits. When the pool will actually
488
+ // run (enough pending refs), restore WAL BEFORE resolution so
489
+ // readers never block the writer; otherwise stay in the fast mode
490
+ // until the finally — sequential resolution has no readers.
491
+ if (fastInit && unresolvedCount >= (0, resolver_pool_1.minRefsForPool)()) {
492
+ try {
493
+ this.db.getDb().pragma('synchronous = NORMAL');
494
+ this.db.getDb().pragma('journal_mode = WAL');
495
+ // Defer auto-checkpointing for the resolution phase, same
496
+ // rationale as the deferWal path above: at the default 1000-page
497
+ // interval, the persist loop's edge inserts + ref deletes make
498
+ // SQLite re-write hot B-tree pages into the main DB file inline
499
+ // on the writer over and over (#1231's pathology — measured as
500
+ // ~58% of the resolution phase on a 255k-ref repo). The valve
501
+ // bounds WAL growth off-thread; runMaintenance does the final
502
+ // fold and the finally restores the interval.
503
+ priorAutocheckpoint = this.db.getWalAutocheckpoint();
504
+ this.db.setWalAutocheckpoint(0);
505
+ restoreAutocheckpoint = true;
506
+ walValve = new wal_valve_1.WalCheckpointValve(this.db, undefined, undefined, options.verbose ? (m) => console.log(`[wal-valve] ${m}`) : undefined);
507
+ walValve.start();
508
+ }
509
+ catch { /* keep current mode; resolution still works sequentially */ }
510
+ }
434
511
  options.onProgress?.({
435
512
  phase: 'resolving',
436
513
  current: 0,
437
514
  total: unresolvedCount,
438
515
  });
516
+ const tResolve = Date.now();
439
517
  await this.resolveReferencesBatched((current, total) => {
440
518
  options.onProgress?.({
441
519
  phase: 'resolving',
442
520
  current,
443
521
  total,
444
522
  });
445
- });
523
+ }, (done, totalPasses) => {
524
+ options.onProgress?.({
525
+ phase: 'linking',
526
+ current: done,
527
+ total: totalPasses,
528
+ });
529
+ }, walValve ? () => walValve.backpressure() : undefined);
530
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
531
+ console.error(`[phase-timing] resolution: ${Date.now() - tResolve}ms`);
446
532
  // Second pass: chained calls whose method lives on a supertype the
447
533
  // receiver conforms to (protocol-extension / inherited / default-
448
534
  // interface). Needs the implements/extends edges the main pass just
@@ -543,12 +629,21 @@ class CodeGraph {
543
629
  walValve.stop();
544
630
  await walValve.drain();
545
631
  }
546
- if (deferWal) {
632
+ if (deferWal || restoreAutocheckpoint) {
547
633
  try {
548
634
  this.db.setWalAutocheckpoint(priorAutocheckpoint);
549
635
  }
550
636
  catch { /* connection may be closing */ }
551
637
  }
638
+ if (fastInit) {
639
+ // Back to the durable defaults; journal_mode=WAL folds the MEMORY
640
+ // journal state into a normal WAL-mode database file.
641
+ try {
642
+ this.db.getDb().pragma('synchronous = NORMAL');
643
+ this.db.getDb().pragma('journal_mode = WAL');
644
+ }
645
+ catch { /* connection may be closing */ }
646
+ }
552
647
  this.fileLock.release();
553
648
  }
554
649
  });
@@ -587,6 +682,26 @@ class CodeGraph {
587
682
  catch {
588
683
  return { filesChecked: 0, filesAdded: 0, filesModified: 0, filesRemoved: 0, nodesUpdated: 0, durationMs: 0 };
589
684
  }
685
+ // Defer WAL auto-checkpointing for the whole incremental run, exactly
686
+ // as indexAll does for the bulk path (#1231): sync's store loop and its
687
+ // resolution passes churn the same FTS + secondary-index hot pages, and
688
+ // at the default 1000-page cadence the inline checkpoints re-write them
689
+ // over and over — on HDD-class storage a 7-file sync took 2 minutes at
690
+ // 0-2% CPU (#1248). The cost scales with the EXISTING database size,
691
+ // not the change size, so small syncs on big indexes hurt most. The
692
+ // valve bounds WAL growth off-thread; runMaintenance at the end does
693
+ // the final fold-up before the interval is restored in the finally.
694
+ // Same kill switch as indexAll: CODEGRAPH_NO_WAL_DEFER=1. Idle valve
695
+ // cost is one timer, so watcher-frequency syncs stay cheap.
696
+ const deferWal = process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
697
+ let walValve = null;
698
+ let priorAutocheckpoint = 1000;
699
+ if (deferWal) {
700
+ priorAutocheckpoint = this.db.getWalAutocheckpoint();
701
+ this.db.setWalAutocheckpoint(0);
702
+ walValve = new wal_valve_1.WalCheckpointValve(this.db, (0, wal_valve_1.resolveWalValveMb)(process.env.CODEGRAPH_WAL_VALVE_MB, this.db.getDbFileSizeBytes()), undefined, options.verbose ? (m) => console.log(`[wal-valve] ${m}`) : undefined);
703
+ walValve.start();
704
+ }
590
705
  try {
591
706
  // Captured BEFORE the sync runs: the sync's own incremental writes
592
707
  // populate vocab rows for the files it touches, so an end-of-sync
@@ -600,7 +715,12 @@ class CodeGraph {
600
715
  return false;
601
716
  }
602
717
  })();
603
- const result = await this.orchestrator.sync(options.onProgress);
718
+ const result = await this.orchestrator.sync(options.onProgress, options.paths);
719
+ // Fold the store phase's WAL BEFORE the post-store reads below
720
+ // (resolution reads on the main thread) — same rationale as
721
+ // indexAll's fold between store and resolution.
722
+ if (walValve)
723
+ await walValve.foldNow();
604
724
  // Cross-file finalization (e.g. NestJS RouterModule prefixes). Run on
605
725
  // every sync that touched files so edits to `app.module.ts` propagate
606
726
  // to controllers in unchanged files. The pass is idempotent and cheap
@@ -680,6 +800,12 @@ class CodeGraph {
680
800
  current,
681
801
  total,
682
802
  });
803
+ }, (done, totalPasses) => {
804
+ options.onProgress?.({
805
+ phase: 'linking',
806
+ current: done,
807
+ total: totalPasses,
808
+ });
683
809
  });
684
810
  }
685
811
  }
@@ -709,6 +835,12 @@ class CodeGraph {
709
835
  current,
710
836
  total,
711
837
  });
838
+ }, (done, totalPasses) => {
839
+ options.onProgress?.({
840
+ phase: 'linking',
841
+ current: done,
842
+ total: totalPasses,
843
+ });
712
844
  });
713
845
  }
714
846
  if (filesChanged || orphanCount > 0) {
@@ -740,6 +872,20 @@ class CodeGraph {
740
872
  return result;
741
873
  }
742
874
  finally {
875
+ // Mirror indexAll's teardown: stop the valve, then restore the
876
+ // auto-checkpoint interval (runMaintenance above already folded the
877
+ // WAL on the success path; on the error path SQLite replays it on
878
+ // the next open).
879
+ if (walValve) {
880
+ walValve.stop();
881
+ await walValve.drain();
882
+ }
883
+ if (deferWal) {
884
+ try {
885
+ this.db.setWalAutocheckpoint(priorAutocheckpoint);
886
+ }
887
+ catch { /* connection may be closing */ }
888
+ }
743
889
  this.fileLock.release();
744
890
  }
745
891
  });
@@ -765,8 +911,8 @@ class CodeGraph {
765
911
  watch(options = {}) {
766
912
  if (this.watcher?.isActive())
767
913
  return true;
768
- this.watcher = new sync_1.FileWatcher(this.projectRoot, async () => {
769
- const result = await this.sync();
914
+ this.watcher = new sync_1.FileWatcher(this.projectRoot, async (paths) => {
915
+ const result = await this.sync({ paths });
770
916
  // sync() returns this exact zero-shape iff it failed to acquire the
771
917
  // file lock (a real empty sync always has filesChecked > 0 because
772
918
  // scanDirectory ran). Surface that to the watcher as a typed error
@@ -914,8 +1060,30 @@ class CodeGraph {
914
1060
  * Resolve references in batches to keep memory bounded on large codebases.
915
1061
  * Processes chunks of unresolved refs, persisting results after each batch.
916
1062
  */
917
- async resolveReferencesBatched(onProgress) {
918
- return this.resolver.resolveAndPersistBatched(onProgress);
1063
+ async resolveReferencesBatched(onProgress, onSynthesisProgress,
1064
+ // The WAL valve's writer-side backstop, threaded into the batch loop's
1065
+ // pool-idle boundaries. Without it the valve's only lever during
1066
+ // resolution is timer-driven passive checkpoints, which the pool's
1067
+ // continuous reads keep perpetually partial — the WAL then accretes the
1068
+ // whole phase's write volume (22GB on a 4.6GB DB at kernel scale).
1069
+ backpressure) {
1070
+ return this.resolver.resolveAndPersistBatched(onProgress, undefined, onSynthesisProgress, {
1071
+ dbPath: this.db.getPath(),
1072
+ // Bulk-edge-load hooks: on big runs the resolver drops the non-unique
1073
+ // edge indexes for the batch loop and recreates them before synthesis
1074
+ // (which reads kind-keyed). Concurrent readers (a daemon serving this
1075
+ // project mid-index) stay CORRECT during the window — target/kind reads
1076
+ // just degrade to scans until the recreate.
1077
+ bulkEdgeLoad: {
1078
+ begin: () => this.db.beginBulkEdgeLoad(),
1079
+ end: () => this.db.endBulkEdgeLoad(),
1080
+ },
1081
+ refIndexLoad: {
1082
+ begin: () => this.db.beginBulkRefLoad(),
1083
+ end: () => this.db.endBulkRefLoad(),
1084
+ },
1085
+ backpressure,
1086
+ });
919
1087
  }
920
1088
  /**
921
1089
  * References extracted but never attempted by a resolution pass. Zero on a
@@ -1000,6 +1168,16 @@ class CodeGraph {
1000
1168
  getNodesByNamePrefix(prefix, limit = 20) {
1001
1169
  return this.queries.getNodesByNamePrefix(prefix, limit);
1002
1170
  }
1171
+ /**
1172
+ * Nodes whose name CONTAINS `substring` (LIKE scan, ASCII-case-insensitive,
1173
+ * shortest-first). The camel-infix lookup FTS can't do — `profileInfo`
1174
+ * inside `getProfileInfoV2` is one FTS token (#1196).
1175
+ */
1176
+ getNodesByNameSubstring(substring, options = {}) {
1177
+ return this.queries
1178
+ .findNodesByNameSubstring(substring, options)
1179
+ .map((r) => r.node);
1180
+ }
1003
1181
  /**
1004
1182
  * Search nodes by text
1005
1183
  */