@colbymchenry/codegraph-win32-arm64 1.4.1 → 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.
Files changed (314) hide show
  1. package/bin/codegraph.cmd +1 -1
  2. package/lib/dist/bin/codegraph.js +206 -44
  3. package/lib/dist/bin/codegraph.js.map +1 -1
  4. package/lib/dist/context/formatter.d.ts +7 -1
  5. package/lib/dist/context/formatter.d.ts.map +1 -1
  6. package/lib/dist/context/formatter.js +12 -6
  7. package/lib/dist/context/formatter.js.map +1 -1
  8. package/lib/dist/context/index.d.ts +12 -0
  9. package/lib/dist/context/index.d.ts.map +1 -1
  10. package/lib/dist/context/index.js +101 -25
  11. package/lib/dist/context/index.js.map +1 -1
  12. package/lib/dist/db/index.d.ts +179 -0
  13. package/lib/dist/db/index.d.ts.map +1 -1
  14. package/lib/dist/db/index.js +368 -7
  15. package/lib/dist/db/index.js.map +1 -1
  16. package/lib/dist/db/migrations.d.ts +1 -1
  17. package/lib/dist/db/migrations.d.ts.map +1 -1
  18. package/lib/dist/db/migrations.js +25 -1
  19. package/lib/dist/db/migrations.js.map +1 -1
  20. package/lib/dist/db/queries.d.ts +234 -5
  21. package/lib/dist/db/queries.d.ts.map +1 -1
  22. package/lib/dist/db/queries.js +687 -53
  23. package/lib/dist/db/queries.js.map +1 -1
  24. package/lib/dist/db/schema.sql +16 -3
  25. package/lib/dist/db/sqlite-adapter.d.ts +3 -1
  26. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  27. package/lib/dist/db/sqlite-adapter.js +22 -4
  28. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  29. package/lib/dist/db/wal-valve.d.ts +15 -2
  30. package/lib/dist/db/wal-valve.d.ts.map +1 -1
  31. package/lib/dist/db/wal-valve.js +88 -6
  32. package/lib/dist/db/wal-valve.js.map +1 -1
  33. package/lib/dist/directory.d.ts +29 -0
  34. package/lib/dist/directory.d.ts.map +1 -1
  35. package/lib/dist/directory.js +52 -0
  36. package/lib/dist/directory.js.map +1 -1
  37. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  38. package/lib/dist/extraction/extraction-version.js +1 -1
  39. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  40. package/lib/dist/extraction/function-ref.js +6 -0
  41. package/lib/dist/extraction/function-ref.js.map +1 -1
  42. package/lib/dist/extraction/generated-detection.d.ts +48 -12
  43. package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
  44. package/lib/dist/extraction/generated-detection.js +176 -11
  45. package/lib/dist/extraction/generated-detection.js.map +1 -1
  46. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  47. package/lib/dist/extraction/grammars.js +101 -2
  48. package/lib/dist/extraction/grammars.js.map +1 -1
  49. package/lib/dist/extraction/index.d.ts +138 -3
  50. package/lib/dist/extraction/index.d.ts.map +1 -1
  51. package/lib/dist/extraction/index.js +518 -94
  52. package/lib/dist/extraction/index.js.map +1 -1
  53. package/lib/dist/extraction/kernel/decode.d.ts +9 -0
  54. package/lib/dist/extraction/kernel/decode.d.ts.map +1 -0
  55. package/lib/dist/extraction/kernel/decode.js +162 -0
  56. package/lib/dist/extraction/kernel/decode.js.map +1 -0
  57. package/lib/dist/extraction/kernel/index.d.ts +64 -0
  58. package/lib/dist/extraction/kernel/index.d.ts.map +1 -0
  59. package/lib/dist/extraction/kernel/index.js +279 -0
  60. package/lib/dist/extraction/kernel/index.js.map +1 -0
  61. package/lib/dist/extraction/kernel/layout.d.ts +101 -0
  62. package/lib/dist/extraction/kernel/layout.d.ts.map +1 -0
  63. package/lib/dist/extraction/kernel/layout.js +104 -0
  64. package/lib/dist/extraction/kernel/layout.js.map +1 -0
  65. package/lib/dist/extraction/kernel/loader.d.ts +103 -0
  66. package/lib/dist/extraction/kernel/loader.d.ts.map +1 -0
  67. package/lib/dist/extraction/kernel/loader.js +146 -0
  68. package/lib/dist/extraction/kernel/loader.js.map +1 -0
  69. package/lib/dist/extraction/languages/c-cpp.d.ts +14 -0
  70. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  71. package/lib/dist/extraction/languages/c-cpp.js +868 -16
  72. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  73. package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
  74. package/lib/dist/extraction/languages/erlang.js +58 -22
  75. package/lib/dist/extraction/languages/erlang.js.map +1 -1
  76. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  77. package/lib/dist/extraction/languages/objc.js +4 -0
  78. package/lib/dist/extraction/languages/objc.js.map +1 -1
  79. package/lib/dist/extraction/languages/rust.d.ts +20 -0
  80. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  81. package/lib/dist/extraction/languages/rust.js +47 -20
  82. package/lib/dist/extraction/languages/rust.js.map +1 -1
  83. package/lib/dist/extraction/parse-pool.d.ts +15 -0
  84. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  85. package/lib/dist/extraction/parse-pool.js +35 -1
  86. package/lib/dist/extraction/parse-pool.js.map +1 -1
  87. package/lib/dist/extraction/parse-worker.js +35 -1
  88. package/lib/dist/extraction/parse-worker.js.map +1 -1
  89. package/lib/dist/extraction/store-worker.d.ts +24 -0
  90. package/lib/dist/extraction/store-worker.d.ts.map +1 -0
  91. package/lib/dist/extraction/store-worker.js +139 -0
  92. package/lib/dist/extraction/store-worker.js.map +1 -0
  93. package/lib/dist/extraction/store-writer.d.ts +63 -0
  94. package/lib/dist/extraction/store-writer.d.ts.map +1 -0
  95. package/lib/dist/extraction/store-writer.js +174 -0
  96. package/lib/dist/extraction/store-writer.js.map +1 -0
  97. package/lib/dist/extraction/tree-sitter-types.d.ts +2 -0
  98. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  99. package/lib/dist/extraction/tree-sitter.d.ts +27 -5
  100. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  101. package/lib/dist/extraction/tree-sitter.js +257 -56
  102. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  103. package/lib/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  104. package/lib/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  105. package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  106. package/lib/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  107. package/lib/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  108. package/lib/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  109. package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  110. package/lib/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  111. package/lib/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  112. package/lib/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  113. package/lib/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  114. package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  115. package/lib/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  116. package/lib/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  117. package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
  118. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  119. package/lib/dist/extraction/wasm-runtime-flags.js +27 -3
  120. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  121. package/lib/dist/graph/queries.d.ts.map +1 -1
  122. package/lib/dist/graph/queries.js +2 -0
  123. package/lib/dist/graph/queries.js.map +1 -1
  124. package/lib/dist/graph/traversal.js +1 -1
  125. package/lib/dist/graph/traversal.js.map +1 -1
  126. package/lib/dist/index.d.ts +36 -2
  127. package/lib/dist/index.d.ts.map +1 -1
  128. package/lib/dist/index.js +305 -11
  129. package/lib/dist/index.js.map +1 -1
  130. package/lib/dist/installer/beta-signup.d.ts +54 -0
  131. package/lib/dist/installer/beta-signup.d.ts.map +1 -0
  132. package/lib/dist/installer/beta-signup.js +178 -0
  133. package/lib/dist/installer/beta-signup.js.map +1 -0
  134. package/lib/dist/installer/index.d.ts +4 -3
  135. package/lib/dist/installer/index.d.ts.map +1 -1
  136. package/lib/dist/installer/index.js +19 -6
  137. package/lib/dist/installer/index.js.map +1 -1
  138. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  139. package/lib/dist/installer/targets/claude.js +37 -5
  140. package/lib/dist/installer/targets/claude.js.map +1 -1
  141. package/lib/dist/installer/targets/codex.d.ts +22 -8
  142. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  143. package/lib/dist/installer/targets/codex.js +65 -48
  144. package/lib/dist/installer/targets/codex.js.map +1 -1
  145. package/lib/dist/installer/targets/copilot-cli.d.ts +32 -0
  146. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -0
  147. package/lib/dist/installer/targets/copilot-cli.js +209 -0
  148. package/lib/dist/installer/targets/copilot-cli.js.map +1 -0
  149. package/lib/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
  150. package/lib/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
  151. package/lib/dist/installer/targets/copilot-jetbrains.js +238 -0
  152. package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -0
  153. package/lib/dist/installer/targets/copilot-vscode.d.ts +47 -0
  154. package/lib/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
  155. package/lib/dist/installer/targets/copilot-vscode.js +219 -0
  156. package/lib/dist/installer/targets/copilot-vscode.js.map +1 -0
  157. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  158. package/lib/dist/installer/targets/registry.js +6 -0
  159. package/lib/dist/installer/targets/registry.js.map +1 -1
  160. package/lib/dist/installer/targets/toml.d.ts +6 -5
  161. package/lib/dist/installer/targets/toml.d.ts.map +1 -1
  162. package/lib/dist/installer/targets/toml.js +99 -20
  163. package/lib/dist/installer/targets/toml.js.map +1 -1
  164. package/lib/dist/installer/targets/types.d.ts +5 -5
  165. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  166. package/lib/dist/mcp/daemon-manager.d.ts +1 -1
  167. package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
  168. package/lib/dist/mcp/daemon-manager.js +1 -1
  169. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  170. package/lib/dist/mcp/daemon-paths.d.ts +6 -0
  171. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  172. package/lib/dist/mcp/daemon-paths.js +54 -0
  173. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  174. package/lib/dist/mcp/daemon-registry.d.ts +10 -0
  175. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  176. package/lib/dist/mcp/daemon-registry.js +51 -3
  177. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  178. package/lib/dist/mcp/daemon.d.ts +9 -6
  179. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  180. package/lib/dist/mcp/daemon.js +10 -8
  181. package/lib/dist/mcp/daemon.js.map +1 -1
  182. package/lib/dist/mcp/engine.d.ts +3 -0
  183. package/lib/dist/mcp/engine.d.ts.map +1 -1
  184. package/lib/dist/mcp/engine.js +45 -3
  185. package/lib/dist/mcp/engine.js.map +1 -1
  186. package/lib/dist/mcp/explore-dedup.d.ts +137 -0
  187. package/lib/dist/mcp/explore-dedup.d.ts.map +1 -0
  188. package/lib/dist/mcp/explore-dedup.js +236 -0
  189. package/lib/dist/mcp/explore-dedup.js.map +1 -0
  190. package/lib/dist/mcp/explore-diagnostics.d.ts +289 -0
  191. package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -0
  192. package/lib/dist/mcp/explore-diagnostics.js +558 -0
  193. package/lib/dist/mcp/explore-diagnostics.js.map +1 -0
  194. package/lib/dist/mcp/explore-session-state.d.ts +217 -0
  195. package/lib/dist/mcp/explore-session-state.d.ts.map +1 -0
  196. package/lib/dist/mcp/explore-session-state.js +322 -0
  197. package/lib/dist/mcp/explore-session-state.js.map +1 -0
  198. package/lib/dist/mcp/index.d.ts +24 -0
  199. package/lib/dist/mcp/index.d.ts.map +1 -1
  200. package/lib/dist/mcp/index.js +67 -6
  201. package/lib/dist/mcp/index.js.map +1 -1
  202. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  203. package/lib/dist/mcp/liveness-watchdog.js +3 -1
  204. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  205. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  206. package/lib/dist/mcp/proxy.js +6 -1
  207. package/lib/dist/mcp/proxy.js.map +1 -1
  208. package/lib/dist/mcp/server-instructions.d.ts +2 -2
  209. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  210. package/lib/dist/mcp/server-instructions.js +8 -3
  211. package/lib/dist/mcp/server-instructions.js.map +1 -1
  212. package/lib/dist/mcp/session.d.ts +16 -0
  213. package/lib/dist/mcp/session.d.ts.map +1 -1
  214. package/lib/dist/mcp/session.js +36 -13
  215. package/lib/dist/mcp/session.js.map +1 -1
  216. package/lib/dist/mcp/tools.d.ts +276 -10
  217. package/lib/dist/mcp/tools.d.ts.map +1 -1
  218. package/lib/dist/mcp/tools.js +2425 -237
  219. package/lib/dist/mcp/tools.js.map +1 -1
  220. package/lib/dist/project-config.d.ts +23 -0
  221. package/lib/dist/project-config.d.ts.map +1 -1
  222. package/lib/dist/project-config.js +39 -2
  223. package/lib/dist/project-config.js.map +1 -1
  224. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +1 -1
  225. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  226. package/lib/dist/resolution/c-fnptr-synthesizer.js +582 -138
  227. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  228. package/lib/dist/resolution/callback-synthesizer.d.ts +54 -10
  229. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  230. package/lib/dist/resolution/callback-synthesizer.js +287 -167
  231. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  232. package/lib/dist/resolution/cooperative-yield.d.ts +10 -2
  233. package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -1
  234. package/lib/dist/resolution/cooperative-yield.js +6 -4
  235. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  236. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  237. package/lib/dist/resolution/frameworks/go.js +29 -6
  238. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  239. package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
  240. package/lib/dist/resolution/frameworks/swift.js +11 -1
  241. package/lib/dist/resolution/frameworks/swift.js.map +1 -1
  242. package/lib/dist/resolution/import-resolver.d.ts +2 -3
  243. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  244. package/lib/dist/resolution/import-resolver.js +184 -9
  245. package/lib/dist/resolution/import-resolver.js.map +1 -1
  246. package/lib/dist/resolution/index.d.ts +87 -2
  247. package/lib/dist/resolution/index.d.ts.map +1 -1
  248. package/lib/dist/resolution/index.js +731 -134
  249. package/lib/dist/resolution/index.js.map +1 -1
  250. package/lib/dist/resolution/memory-budget.d.ts +48 -0
  251. package/lib/dist/resolution/memory-budget.d.ts.map +1 -0
  252. package/lib/dist/resolution/memory-budget.js +162 -0
  253. package/lib/dist/resolution/memory-budget.js.map +1 -0
  254. package/lib/dist/resolution/name-matcher.d.ts +42 -1
  255. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  256. package/lib/dist/resolution/name-matcher.js +681 -99
  257. package/lib/dist/resolution/name-matcher.js.map +1 -1
  258. package/lib/dist/resolution/path-aliases.d.ts +6 -4
  259. package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
  260. package/lib/dist/resolution/path-aliases.js +125 -17
  261. package/lib/dist/resolution/path-aliases.js.map +1 -1
  262. package/lib/dist/resolution/resolver-pool.d.ts +106 -0
  263. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -0
  264. package/lib/dist/resolution/resolver-pool.js +344 -0
  265. package/lib/dist/resolution/resolver-pool.js.map +1 -0
  266. package/lib/dist/resolution/resolver-worker.d.ts +17 -0
  267. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -0
  268. package/lib/dist/resolution/resolver-worker.js +141 -0
  269. package/lib/dist/resolution/resolver-worker.js.map +1 -0
  270. package/lib/dist/resolution/types.d.ts +3 -0
  271. package/lib/dist/resolution/types.d.ts.map +1 -1
  272. package/lib/dist/search/identifier-segments.d.ts +10 -0
  273. package/lib/dist/search/identifier-segments.d.ts.map +1 -1
  274. package/lib/dist/search/identifier-segments.js +29 -0
  275. package/lib/dist/search/identifier-segments.js.map +1 -1
  276. package/lib/dist/search/query-paths.d.ts +57 -0
  277. package/lib/dist/search/query-paths.d.ts.map +1 -0
  278. package/lib/dist/search/query-paths.js +298 -0
  279. package/lib/dist/search/query-paths.js.map +1 -0
  280. package/lib/dist/search/query-utils.d.ts +1 -1
  281. package/lib/dist/search/query-utils.d.ts.map +1 -1
  282. package/lib/dist/search/query-utils.js +13 -3
  283. package/lib/dist/search/query-utils.js.map +1 -1
  284. package/lib/dist/sync/watcher.d.ts +47 -1
  285. package/lib/dist/sync/watcher.d.ts.map +1 -1
  286. package/lib/dist/sync/watcher.js +127 -8
  287. package/lib/dist/sync/watcher.js.map +1 -1
  288. package/lib/dist/types.d.ts +61 -3
  289. package/lib/dist/types.d.ts.map +1 -1
  290. package/lib/dist/types.js +27 -1
  291. package/lib/dist/types.js.map +1 -1
  292. package/lib/dist/ui/color.d.ts +21 -0
  293. package/lib/dist/ui/color.d.ts.map +1 -0
  294. package/lib/dist/ui/color.js +42 -0
  295. package/lib/dist/ui/color.js.map +1 -0
  296. package/lib/dist/ui/glyphs.d.ts +35 -10
  297. package/lib/dist/ui/glyphs.d.ts.map +1 -1
  298. package/lib/dist/ui/glyphs.js +59 -12
  299. package/lib/dist/ui/glyphs.js.map +1 -1
  300. package/lib/dist/ui/shimmer-progress.d.ts.map +1 -1
  301. package/lib/dist/ui/shimmer-progress.js +78 -4
  302. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  303. package/lib/dist/ui/shimmer-worker.js +25 -17
  304. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  305. package/lib/dist/ui/types.d.ts +0 -2
  306. package/lib/dist/ui/types.d.ts.map +1 -1
  307. package/lib/dist/upgrade/index.d.ts +7 -0
  308. package/lib/dist/upgrade/index.d.ts.map +1 -1
  309. package/lib/dist/upgrade/index.js +18 -5
  310. package/lib/dist/upgrade/index.js.map +1 -1
  311. package/lib/kernel/codegraph-kernel.node +0 -0
  312. package/lib/node_modules/.package-lock.json +1 -1
  313. package/lib/package.json +6 -1
  314. package/package.json +6 -2
package/bin/codegraph.cmd CHANGED
@@ -1 +1 @@
1
- @"%~dp0..\node.exe" --liftoff-only "%~dp0..\lib\dist\bin\codegraph.js" %*
1
+ @"%~dp0..\node.exe" --liftoff-only --disable-warning=ExperimentalWarning "%~dp0..\lib\dist\bin\codegraph.js" %*
@@ -61,6 +61,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
61
61
  // launcher is (almost certainly) still alive. A launcher killed mid-startup
62
62
  // otherwise blinds the PPID watchdog forever (#1185) — see early-ppid.ts.
63
63
  require("../mcp/early-ppid");
64
+ // Persist V8 compile artifacts across runs (Node ≥22.8). Every invocation —
65
+ // and every worker thread, which re-requires the whole extraction module
66
+ // graph — skips recompiling unchanged sources. Worth hundreds of ms of
67
+ // worker-boot latency per bulk index; harmless no-op when unavailable.
68
+ try {
69
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
70
+ require('node:module').enableCompileCache?.();
71
+ }
72
+ catch { /* cache is best-effort */ }
64
73
  const commander_1 = require("commander");
65
74
  const path = __importStar(require("path"));
66
75
  const fs = __importStar(require("fs"));
@@ -69,12 +78,16 @@ const identifier_segments_1 = require("../search/identifier-segments");
69
78
  const worktree_1 = require("../sync/worktree");
70
79
  const shimmer_progress_1 = require("../ui/shimmer-progress");
71
80
  const glyphs_1 = require("../ui/glyphs");
81
+ const color_1 = require("../ui/color");
72
82
  const node_version_check_1 = require("./node-version-check");
73
83
  const fatal_handler_1 = require("./fatal-handler");
74
84
  const wasm_runtime_flags_1 = require("../extraction/wasm-runtime-flags");
75
85
  const command_supervision_1 = require("./command-supervision");
76
86
  const extraction_version_1 = require("../extraction/extraction-version");
77
87
  const telemetry_1 = require("../telemetry");
88
+ // Decided once, before `--color`/`--no-color` are stripped from argv below
89
+ // (#1281). Piped/redirected stdout, NO_COLOR, or --no-color -> plain output.
90
+ const COLORS_ENABLED = (0, color_1.ansiColorsEnabled)();
78
91
  // Lazy-load heavy modules (CodeGraph, runInstaller) to keep CLI startup fast.
79
92
  async function loadCodeGraph() {
80
93
  try {
@@ -82,7 +95,8 @@ async function loadCodeGraph() {
82
95
  }
83
96
  catch (err) {
84
97
  const msg = err instanceof Error ? err.message : String(err);
85
- console.error(`\x1b[31m${(0, glyphs_1.getGlyphs)().err}\x1b[0m Failed to load CodeGraph modules.`);
98
+ const [red, reset] = COLORS_ENABLED ? ['\x1b[31m', '\x1b[0m'] : ['', ''];
99
+ console.error(`${red}${(0, glyphs_1.getGlyphs)().err}${reset} Failed to load CodeGraph modules.`);
86
100
  console.error(`\n Node: ${process.version} Platform: ${process.platform} ${process.arch}`);
87
101
  console.error(`\n Error: ${msg}`);
88
102
  console.error('\n Try reinstalling with: npm install -g @colbymchenry/codegraph\n');
@@ -160,18 +174,35 @@ function main() {
160
174
  // =============================================================================
161
175
  // ANSI Color Helpers (avoid chalk ESM issues)
162
176
  // =============================================================================
163
- const colors = {
164
- reset: '\x1b[0m',
165
- bold: '\x1b[1m',
166
- dim: '\x1b[2m',
167
- red: '\x1b[31m',
168
- green: '\x1b[32m',
169
- yellow: '\x1b[33m',
170
- blue: '\x1b[34m',
171
- cyan: '\x1b[36m',
172
- white: '\x1b[37m',
173
- gray: '\x1b[90m',
174
- };
177
+ // `--color` / `--no-color` are global and position-independent — they were
178
+ // already read by ansiColorsEnabled() at module load, so strip them before
179
+ // commander parses (a subcommand would otherwise reject the unknown flag).
180
+ process.argv = process.argv.filter((a) => a !== '--color' && a !== '--no-color');
181
+ const colors = COLORS_ENABLED
182
+ ? {
183
+ reset: '\x1b[0m',
184
+ bold: '\x1b[1m',
185
+ dim: '\x1b[2m',
186
+ red: '\x1b[31m',
187
+ green: '\x1b[32m',
188
+ yellow: '\x1b[33m',
189
+ blue: '\x1b[34m',
190
+ cyan: '\x1b[36m',
191
+ white: '\x1b[37m',
192
+ gray: '\x1b[90m',
193
+ }
194
+ : {
195
+ reset: '',
196
+ bold: '',
197
+ dim: '',
198
+ red: '',
199
+ green: '',
200
+ yellow: '',
201
+ blue: '',
202
+ cyan: '',
203
+ white: '',
204
+ gray: '',
205
+ };
175
206
  const chalk = {
176
207
  bold: (s) => `${colors.bold}${s}${colors.reset}`,
177
208
  dim: (s) => `${colors.dim}${s}${colors.reset}`,
@@ -186,7 +217,12 @@ function main() {
186
217
  program
187
218
  .name('codegraph')
188
219
  .description('Code intelligence and knowledge graph for any codebase')
189
- .version(packageJson.version);
220
+ .version(packageJson.version)
221
+ // Parsed manually before commander runs (any argv position works); declared
222
+ // here so they show up in --help. NO_COLOR / FORCE_COLOR env vars are also
223
+ // honored, and piped output defaults to no color (#1281).
224
+ .option('--color', 'force ANSI colors even when stdout is not a TTY')
225
+ .option('--no-color', 'disable ANSI colors (NO_COLOR env is also honored)');
190
226
  // Anonymous usage telemetry (see TELEMETRY.md): record the invoked subcommand
191
227
  // NAME only — never arguments or paths. Counts buffer locally; network sends
192
228
  // piggyback on commands that run long anyway (quick commands only append to
@@ -356,6 +392,16 @@ function main() {
356
392
  for (const w of result.errors.filter((e) => e.code === 'index_partial')) {
357
393
  clack.log.warn(w.message);
358
394
  }
395
+ // Files salvaged from comment-stripped source after repeated parser
396
+ // failures are indexed but possibly incomplete — say so here, or the run
397
+ // reads as fully clean and the index quietly disagrees with a later
398
+ // re-parse of the same bytes (#1565).
399
+ const salvaged = result.errors.filter((e) => e.code === 'salvaged_stripped');
400
+ if (salvaged.length > 0) {
401
+ const sample = salvaged.slice(0, 3).map((e) => e.filePath).filter(Boolean).join(', ');
402
+ const more = salvaged.length > 3 ? ', ...' : '';
403
+ clack.log.warn(`${formatNumber(salvaged.length)} file(s) indexed from comment-stripped source after repeated parse failures ${(0, glyphs_1.getGlyphs)().dash} symbols may be incomplete (${sample}${more})`);
404
+ }
359
405
  }
360
406
  else if (hasErrors) {
361
407
  clack.log.error(`Indexing failed ${(0, glyphs_1.getGlyphs)().dash} all ${formatNumber(result.filesErrored)} files had errors`);
@@ -392,9 +438,17 @@ function main() {
392
438
  }
393
439
  }
394
440
  else if (projectPath) {
395
- const logPath = path.join((0, directory_1.getCodeGraphDir)(projectPath), 'errors.log');
396
- if (fs.existsSync(logPath)) {
397
- fs.unlinkSync(logPath);
441
+ // No hard errors. Salvaged-file warnings still belong in the log — it
442
+ // carries the per-file detail behind the one-line summary above.
443
+ if (result.errors.some((e) => e.code === 'salvaged_stripped')) {
444
+ writeErrorLog(projectPath, result.errors);
445
+ clack.log.info('See .codegraph/errors.log for details');
446
+ }
447
+ else {
448
+ const logPath = path.join((0, directory_1.getCodeGraphDir)(projectPath), 'errors.log');
449
+ if (fs.existsSync(logPath)) {
450
+ fs.unlinkSync(logPath);
451
+ }
398
452
  }
399
453
  }
400
454
  }
@@ -514,16 +568,14 @@ function main() {
514
568
  // Commands
515
569
  // =============================================================================
516
570
  /**
517
- * codegraph init [path]
571
+ * The `init` flow — shared by `codegraph init` and `codegraph install --init`
572
+ * (#1578): refuse an unsafe root, create `.codegraph/`, build the initial
573
+ * index under supervision, then the post-index offers. `yes` makes every
574
+ * offer non-interactive (defaults only), so a container / CI bootstrap never
575
+ * blocks on a prompt. An unsafe root sets `process.exitCode = 1` and returns
576
+ * (no `--force` is implied by any caller); an index failure exits 1.
518
577
  */
519
- program
520
- .command('init [path]')
521
- .description('Initialize CodeGraph in a project directory and build the initial index')
522
- .option('-i, --index', 'Deprecated: indexing now runs by default; flag accepted for backward compatibility')
523
- .option('-f, --force', 'Initialize even if the path looks like your home directory or a filesystem root')
524
- .option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
525
- .action(async (pathArg, options) => {
526
- const projectPath = path.resolve(pathArg || process.cwd());
578
+ async function runInit(projectPath, options) {
527
579
  const clack = await importESM('@clack/prompts');
528
580
  clack.intro('Initializing CodeGraph');
529
581
  try {
@@ -543,7 +595,7 @@ function main() {
543
595
  clack.log.info('Use "codegraph index" to re-index or "codegraph sync" to update');
544
596
  try {
545
597
  const { offerWatchFallback } = await Promise.resolve().then(() => __importStar(require('../installer')));
546
- await offerWatchFallback(clack, projectPath);
598
+ await offerWatchFallback(clack, projectPath, { yes: options.yes });
547
599
  }
548
600
  catch { /* non-fatal */ }
549
601
  clack.outro('');
@@ -583,12 +635,14 @@ function main() {
583
635
  // An empty graph at a git super-repo usually means `.gitignore` excludes
584
636
  // the child repos that hold the code — surface them and offer to opt in
585
637
  // rather than leaving the user with a silent 0-node "Done". (#1156)
638
+ // Under --yes the offer prints its one-line opt-in snippet instead of
639
+ // prompting (same as a non-TTY run).
586
640
  if (result.nodesCreated === 0) {
587
- await offerIndexIgnoredRepos(clack, projectPath, runIndex, { interactive: true });
641
+ await offerIndexIgnoredRepos(clack, projectPath, runIndex, { interactive: !options.yes });
588
642
  }
589
643
  try {
590
644
  const { offerWatchFallback } = await Promise.resolve().then(() => __importStar(require('../installer')));
591
- await offerWatchFallback(clack, projectPath);
645
+ await offerWatchFallback(clack, projectPath, { yes: options.yes });
592
646
  }
593
647
  catch { /* non-fatal */ }
594
648
  clack.outro('Done');
@@ -598,6 +652,19 @@ function main() {
598
652
  clack.log.error(`Failed: ${err instanceof Error ? err.message : String(err)}`);
599
653
  process.exit(1);
600
654
  }
655
+ }
656
+ /**
657
+ * codegraph init [path]
658
+ */
659
+ program
660
+ .command('init [path]')
661
+ .description('Initialize CodeGraph in a project directory and build the initial index')
662
+ .option('-i, --index', 'Deprecated: indexing now runs by default; flag accepted for backward compatibility')
663
+ .option('-f, --force', 'Initialize even if the path looks like your home directory or a filesystem root')
664
+ .option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
665
+ .option('-y, --yes', 'Non-interactive: skip every prompt and take the defaults (for scripts / CI / container bootstraps)')
666
+ .action(async (pathArg, options) => {
667
+ await runInit(path.resolve(pathArg || process.cwd()), options);
601
668
  });
602
669
  /**
603
670
  * codegraph uninit [path]
@@ -853,6 +920,7 @@ function main() {
853
920
  nodeCount: stats.nodeCount,
854
921
  edgeCount: stats.edgeCount,
855
922
  dbSizeBytes: stats.dbSizeBytes,
923
+ walSizeBytes: stats.walSizeBytes,
856
924
  backend,
857
925
  journalMode,
858
926
  nodesByKind: stats.nodesByKind,
@@ -908,6 +976,19 @@ function main() {
908
976
  console.log(` Nodes: ${formatNumber(stats.nodeCount)}`);
909
977
  console.log(` Edges: ${formatNumber(stats.edgeCount)}`);
910
978
  console.log(` DB Size: ${(stats.dbSizeBytes / 1024 / 1024).toFixed(2)} MB`);
979
+ // Surface the WAL sidecar (#1431): a WAL that dwarfs the DB at rest is
980
+ // the killed-session leak — invisible before this line, it only showed
981
+ // up as a mysteriously full disk. open() above already kicked off the
982
+ // automatic heal for the oversized case.
983
+ if (stats.walSizeBytes > 0) {
984
+ const { WAL_HEAL_THRESHOLD_BYTES } = await Promise.resolve().then(() => __importStar(require('../db/index')));
985
+ const oversized = stats.walSizeBytes > Math.max(WAL_HEAL_THRESHOLD_BYTES, stats.dbSizeBytes);
986
+ const walLabel = `${(stats.walSizeBytes / 1024 / 1024).toFixed(2)} MB`;
987
+ console.log(` WAL Size: ${oversized ? chalk.yellow(walLabel) : walLabel}`);
988
+ if (oversized) {
989
+ warn('The write-ahead log is larger than the database — killed sessions left it behind. It is reclaimed automatically on open; if it persists across runs, another live CodeGraph process is holding it.');
990
+ }
991
+ }
911
992
  // Surface the active SQLite backend (node:sqlite — Node's built-in real
912
993
  // SQLite, full WAL + FTS5, no native build).
913
994
  const backendLabel = chalk.green(`node:sqlite ${(0, glyphs_1.getGlyphs)().dash} built-in (full WAL)`);
@@ -1000,10 +1081,10 @@ function main() {
1000
1081
  // Mirror the MCP search down-rank so the CLI also surfaces the
1001
1082
  // hand-written implementation before protobuf/gRPC scaffolding
1002
1083
  // when both share a name. See extraction/generated-detection.ts.
1003
- const { isGeneratedFile } = await Promise.resolve().then(() => __importStar(require('../extraction/generated-detection')));
1084
+ const isGen = cg.generatedFilePredicate(rawResults.map((r) => r.node.filePath));
1004
1085
  const results = [...rawResults].sort((a, b) => {
1005
- const aGen = isGeneratedFile(a.node.filePath) ? 1 : 0;
1006
- const bGen = isGeneratedFile(b.node.filePath) ? 1 : 0;
1086
+ const aGen = isGen(a.node.filePath) ? 1 : 0;
1087
+ const bGen = isGen(b.node.filePath) ? 1 : 0;
1007
1088
  return aGen - bGen;
1008
1089
  });
1009
1090
  if (options.json) {
@@ -1079,6 +1160,60 @@ function main() {
1079
1160
  process.exit(1);
1080
1161
  }
1081
1162
  });
1163
+ /**
1164
+ * codegraph context <task...>
1165
+ *
1166
+ * The CLI face of the public `buildContext` API (ContextBuilder): FTS entry
1167
+ * points + graph expansion + code blocks, formatted as markdown or JSON.
1168
+ * Advertised in the usage header since the first release but never actually
1169
+ * registered (#1611); external integrations (e.g. Memorix) invoke it as
1170
+ * `codegraph context --path <root> --format json --max-nodes 8 --no-code <task>`.
1171
+ */
1172
+ program
1173
+ .command('context <task...>')
1174
+ .description('Build context for a task: relevant symbols, relationships, and code blocks')
1175
+ .option('-p, --path <path>', 'Project path')
1176
+ .option('-f, --format <format>', 'Output format: markdown or json', 'markdown')
1177
+ .option('-n, --max-nodes <number>', 'Maximum number of symbols to include')
1178
+ .option('--no-code', 'Omit code blocks (structure only)')
1179
+ .action(async (taskParts, options) => {
1180
+ const projectPath = resolveProjectPath(options.path);
1181
+ const format = options.format ?? 'markdown';
1182
+ if (format !== 'markdown' && format !== 'json') {
1183
+ error(`Unknown format "${options.format}" — use "markdown" or "json".`);
1184
+ process.exit(1);
1185
+ }
1186
+ let maxNodes;
1187
+ if (options.maxNodes !== undefined) {
1188
+ maxNodes = parseInt(options.maxNodes, 10);
1189
+ if (Number.isNaN(maxNodes) || maxNodes < 1) {
1190
+ error(`--max-nodes expects a positive integer, got "${options.maxNodes}".`);
1191
+ process.exit(1);
1192
+ }
1193
+ }
1194
+ try {
1195
+ if (!(0, directory_1.isInitialized)(projectPath)) {
1196
+ error(`CodeGraph not initialized in ${projectPath}`);
1197
+ process.exit(1);
1198
+ }
1199
+ const { default: CodeGraph } = await loadCodeGraph();
1200
+ const cg = await CodeGraph.open(projectPath);
1201
+ const result = await cg.buildContext(taskParts.join(' '), {
1202
+ format,
1203
+ includeCode: options.code !== false,
1204
+ ...(maxNodes !== undefined ? { maxNodes } : {}),
1205
+ });
1206
+ // Both supported formats return a formatted string; print it verbatim so
1207
+ // `--format json` stays machine-parseable on stdout (error()/warnings go
1208
+ // to stderr only).
1209
+ console.log(typeof result === 'string' ? result : JSON.stringify(result, null, 2));
1210
+ cg.destroy();
1211
+ }
1212
+ catch (err) {
1213
+ error(`Context build failed: ${err instanceof Error ? err.message : String(err)}`);
1214
+ process.exit(1);
1215
+ }
1216
+ });
1082
1217
  /**
1083
1218
  * codegraph prompt-hook (hidden)
1084
1219
  *
@@ -1296,8 +1431,14 @@ function main() {
1296
1431
  const args = {};
1297
1432
  if (options.file) {
1298
1433
  args.file = options.file;
1299
- if (name && name !== options.file)
1434
+ if (name && name !== options.file) {
1300
1435
  args.symbol = name;
1436
+ // Symbol mode pinned to a file is still symbol mode — the CLI
1437
+ // always wants the body, exactly like the bare-symbol branch
1438
+ // below. Omitting this printed location + trail with no source
1439
+ // (#1284).
1440
+ args.includeCode = true;
1441
+ }
1301
1442
  }
1302
1443
  else if (name && (name.includes('/') || name.includes('\\'))) {
1303
1444
  args.file = name.replace(/\\/g, '/');
@@ -1520,9 +1661,9 @@ function main() {
1520
1661
  .aliases(['daemons'])
1521
1662
  .description('Manage running CodeGraph background daemons — pick one and press enter to stop it')
1522
1663
  .action(async () => {
1523
- const { listDaemons, stopDaemonAt, stopAllDaemons } = await Promise.resolve().then(() => __importStar(require('../mcp/daemon-registry')));
1664
+ const { listVerifiedDaemons, stopDaemonAt, stopAllDaemons } = await Promise.resolve().then(() => __importStar(require('../mcp/daemon-registry')));
1524
1665
  const { runDaemonPicker } = await Promise.resolve().then(() => __importStar(require('../mcp/daemon-manager')));
1525
- const daemons = listDaemons();
1666
+ const daemons = await listVerifiedDaemons();
1526
1667
  if (daemons.length === 0) {
1527
1668
  info('No CodeGraph daemons running.');
1528
1669
  return;
@@ -1549,7 +1690,7 @@ function main() {
1549
1690
  const clack = await importESM('@clack/prompts');
1550
1691
  clack.intro('CodeGraph daemons');
1551
1692
  await runDaemonPicker({
1552
- list: listDaemons,
1693
+ list: listVerifiedDaemons,
1553
1694
  stop: stopDaemonAt,
1554
1695
  stopAll: stopAllDaemons,
1555
1696
  cwdRoot,
@@ -1651,12 +1792,17 @@ function main() {
1651
1792
  return;
1652
1793
  }
1653
1794
  const lockPath = path.join((0, directory_1.getCodeGraphDir)(projectPath), 'codegraph.lock');
1654
- if (!fs.existsSync(lockPath)) {
1655
- info(`No lock file found ${(0, glyphs_1.getGlyphs)().dash} nothing to do`);
1656
- return;
1657
- }
1658
- fs.unlinkSync(lockPath);
1659
- success('Removed lock file. You can now run indexing again.');
1795
+ let removed = false;
1796
+ if (fs.existsSync(lockPath)) {
1797
+ fs.unlinkSync(lockPath);
1798
+ removed = true;
1799
+ }
1800
+ const { clearStaleDaemonArtifacts } = await Promise.resolve().then(() => __importStar(require('../mcp/daemon-registry')));
1801
+ removed = await clearStaleDaemonArtifacts(projectPath) || removed;
1802
+ if (removed)
1803
+ success('Removed stale lock artifacts. You can now run indexing again.');
1804
+ else
1805
+ info(`No stale lock files found ${(0, glyphs_1.getGlyphs)().dash} nothing to do`);
1660
1806
  }
1661
1807
  catch (err) {
1662
1808
  error(`Failed to remove lock: ${err instanceof Error ? err.message : String(err)}`);
@@ -2040,10 +2186,11 @@ function main() {
2040
2186
  */
2041
2187
  program
2042
2188
  .command('install')
2043
- .description('Install codegraph MCP server into one or more agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent)')
2189
+ .description('Install codegraph MCP server into one or more agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, Kiro, GitHub Copilot)')
2044
2190
  .option('-t, --target <ids>', 'Target agent(s): comma-separated ids, or "auto"|"all"|"none". Default: prompt')
2045
2191
  .option('-l, --location <where>', 'Install location: "global" or "local". Default: prompt')
2046
2192
  .option('-y, --yes', 'Non-interactive: defaults to --location=global --target=auto, auto-allow on')
2193
+ .option('-i, --init', 'After wiring agents, also run `codegraph init` in the current directory — builds this project’s index, so install + index is one command (combine with --yes for an unattended bootstrap)')
2047
2194
  .option('--no-permissions', 'Skip writing the auto-allow permissions list (Claude Code only)')
2048
2195
  .option('--print-config <id>', 'Print MCP config snippet for the named agent and exit (no file writes)')
2049
2196
  .option('--refresh', 'Rewrite what previous installs configured, for already-configured agents only (never adds new ones). Run automatically by `codegraph upgrade`')
@@ -2119,6 +2266,17 @@ function main() {
2119
2266
  error(err instanceof Error ? err.message : String(err));
2120
2267
  process.exit(1);
2121
2268
  }
2269
+ // --init: the one-shot "wire agents AND build this project's index"
2270
+ // bootstrap (#1578). The installer itself never indexes implicitly (a
2271
+ // surprise index of $HOME is the thing we refuse) — an explicit flag is
2272
+ // the user choosing. Runs after a successful install, including the
2273
+ // `--target none` / nothing-detected case (the installer returns normally
2274
+ // there), and shares every guard with `codegraph init`: an unsafe root
2275
+ // is refused (exit 1, no implied --force), an already-initialized
2276
+ // project just says so. `--yes` flows through so no offer prompts.
2277
+ if (opts.init) {
2278
+ await runInit(process.cwd(), { yes: opts.yes });
2279
+ }
2122
2280
  });
2123
2281
  /**
2124
2282
  * codegraph uninstall
@@ -2130,7 +2288,7 @@ function main() {
2130
2288
  */
2131
2289
  program
2132
2290
  .command('uninstall')
2133
- .description('Remove codegraph from your agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent)')
2291
+ .description('Remove codegraph from your agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, Kiro, GitHub Copilot)')
2134
2292
  .option('-t, --target <ids>', 'Target agent(s): comma-separated ids, or "all". Default: all')
2135
2293
  .option('-l, --location <where>', 'Uninstall location: "global" or "local". Default: prompt')
2136
2294
  .option('-y, --yes', 'Non-interactive: defaults to --location=global --target=all')
@@ -2225,6 +2383,10 @@ function main() {
2225
2383
  warn: (m) => warn(m),
2226
2384
  error: (m) => error(m),
2227
2385
  platform: process.platform,
2386
+ offerBetaSignup: async () => {
2387
+ const { maybeOfferBetaSignup } = await Promise.resolve().then(() => __importStar(require('../installer/beta-signup')));
2388
+ await maybeOfferBetaSignup({ source: 'cli-upgrade' });
2389
+ },
2228
2390
  });
2229
2391
  process.exit(code);
2230
2392
  });