@colbymchenry/codegraph-win32-arm64 1.6.2 → 1.6.4

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 (1110) hide show
  1. package/bin/codegraph +1 -1
  2. package/bin/codegraph.cmd +1 -1
  3. package/lib/dist/.test-build-engine.json +1 -1
  4. package/lib/dist/.test-build-viewer.json +1 -1
  5. package/lib/dist/bin/codegraph.d.ts +3 -0
  6. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  7. package/lib/dist/bin/codegraph.js +507 -702
  8. package/lib/dist/bin/codegraph.js.map +1 -1
  9. package/lib/dist/bin/command-supervision.js +1 -57
  10. package/lib/dist/bin/command-supervision.js.map +1 -1
  11. package/lib/dist/bin/fatal-handler.js +0 -46
  12. package/lib/dist/bin/fatal-handler.js.map +1 -1
  13. package/lib/dist/bin/node-version-check.js +0 -33
  14. package/lib/dist/bin/node-version-check.js.map +1 -1
  15. package/lib/dist/bin/uninstall.js +0 -19
  16. package/lib/dist/bin/uninstall.js.map +1 -1
  17. package/lib/dist/bin/viewer-gate.js +0 -14
  18. package/lib/dist/bin/viewer-gate.js.map +1 -1
  19. package/lib/dist/compile-cache.d.ts +2 -0
  20. package/lib/dist/compile-cache.d.ts.map +1 -0
  21. package/lib/dist/compile-cache.js +45 -0
  22. package/lib/dist/compile-cache.js.map +1 -0
  23. package/lib/dist/context/formatter.js +3 -66
  24. package/lib/dist/context/formatter.js.map +1 -1
  25. package/lib/dist/context/index.d.ts +44 -1
  26. package/lib/dist/context/index.d.ts.map +1 -1
  27. package/lib/dist/context/index.js +123 -430
  28. package/lib/dist/context/index.js.map +1 -1
  29. package/lib/dist/context/markers.js +0 -17
  30. package/lib/dist/context/markers.js.map +1 -1
  31. package/lib/dist/db/index.d.ts +44 -1
  32. package/lib/dist/db/index.d.ts.map +1 -1
  33. package/lib/dist/db/index.js +123 -395
  34. package/lib/dist/db/index.js.map +1 -1
  35. package/lib/dist/db/migrations.d.ts +11 -1
  36. package/lib/dist/db/migrations.d.ts.map +1 -1
  37. package/lib/dist/db/migrations.js +71 -79
  38. package/lib/dist/db/migrations.js.map +1 -1
  39. package/lib/dist/db/name-substring-index.d.ts +63 -0
  40. package/lib/dist/db/name-substring-index.d.ts.map +1 -0
  41. package/lib/dist/db/name-substring-index.js +151 -0
  42. package/lib/dist/db/name-substring-index.js.map +1 -0
  43. package/lib/dist/db/node-sqlite.d.ts +19 -0
  44. package/lib/dist/db/node-sqlite.d.ts.map +1 -0
  45. package/lib/dist/db/node-sqlite.js +23 -0
  46. package/lib/dist/db/node-sqlite.js.map +1 -0
  47. package/lib/dist/db/open-error.d.ts +36 -0
  48. package/lib/dist/db/open-error.d.ts.map +1 -0
  49. package/lib/dist/db/open-error.js +63 -0
  50. package/lib/dist/db/open-error.js.map +1 -0
  51. package/lib/dist/db/parameter-flow-queries.d.ts +120 -0
  52. package/lib/dist/db/parameter-flow-queries.d.ts.map +1 -0
  53. package/lib/dist/db/parameter-flow-queries.js +168 -0
  54. package/lib/dist/db/parameter-flow-queries.js.map +1 -0
  55. package/lib/dist/db/queries.d.ts +654 -34
  56. package/lib/dist/db/queries.d.ts.map +1 -1
  57. package/lib/dist/db/queries.js +1466 -1470
  58. package/lib/dist/db/queries.js.map +1 -1
  59. package/lib/dist/db/reference-tail.d.ts +83 -0
  60. package/lib/dist/db/reference-tail.d.ts.map +1 -0
  61. package/lib/dist/db/reference-tail.js +68 -0
  62. package/lib/dist/db/reference-tail.js.map +1 -0
  63. package/lib/dist/db/schema.sql +18 -2
  64. package/lib/dist/db/sqlite-adapter.d.ts +18 -1
  65. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  66. package/lib/dist/db/sqlite-adapter.js +12 -62
  67. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  68. package/lib/dist/db/synthesis-stage.d.ts.map +1 -1
  69. package/lib/dist/db/synthesis-stage.js +2 -6
  70. package/lib/dist/db/synthesis-stage.js.map +1 -1
  71. package/lib/dist/db/wal-valve.js +1 -153
  72. package/lib/dist/db/wal-valve.js.map +1 -1
  73. package/lib/dist/db/wsl-shared-index.js +0 -37
  74. package/lib/dist/db/wsl-shared-index.js.map +1 -1
  75. package/lib/dist/directory.d.ts +51 -0
  76. package/lib/dist/directory.d.ts.map +1 -1
  77. package/lib/dist/directory.js +76 -530
  78. package/lib/dist/directory.js.map +1 -1
  79. package/lib/dist/engine.d.ts +15 -0
  80. package/lib/dist/engine.d.ts.map +1 -0
  81. package/lib/dist/engine.js +35 -0
  82. package/lib/dist/engine.js.map +1 -0
  83. package/lib/dist/errors.d.ts +10 -0
  84. package/lib/dist/errors.d.ts.map +1 -1
  85. package/lib/dist/errors.js +8 -101
  86. package/lib/dist/errors.js.map +1 -1
  87. package/lib/dist/extraction/astro-extractor.d.ts.map +1 -1
  88. package/lib/dist/extraction/astro-extractor.js +11 -101
  89. package/lib/dist/extraction/astro-extractor.js.map +1 -1
  90. package/lib/dist/extraction/cfml-extractor.d.ts +27 -1
  91. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
  92. package/lib/dist/extraction/cfml-extractor.js +70 -206
  93. package/lib/dist/extraction/cfml-extractor.js.map +1 -1
  94. package/lib/dist/extraction/commonjs-requires.js +0 -31
  95. package/lib/dist/extraction/commonjs-requires.js.map +1 -1
  96. package/lib/dist/extraction/dfm-extractor.js +0 -21
  97. package/lib/dist/extraction/dfm-extractor.js.map +1 -1
  98. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  99. package/lib/dist/extraction/extraction-version.js +1 -24
  100. package/lib/dist/extraction/extraction-version.js.map +1 -1
  101. package/lib/dist/extraction/function-ref.d.ts +40 -0
  102. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  103. package/lib/dist/extraction/function-ref.js +157 -207
  104. package/lib/dist/extraction/function-ref.js.map +1 -1
  105. package/lib/dist/extraction/generated-detection.js +0 -165
  106. package/lib/dist/extraction/generated-detection.js.map +1 -1
  107. package/lib/dist/extraction/grammars.d.ts +73 -4
  108. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  109. package/lib/dist/extraction/grammars.js +160 -431
  110. package/lib/dist/extraction/grammars.js.map +1 -1
  111. package/lib/dist/extraction/index.d.ts +208 -7
  112. package/lib/dist/extraction/index.d.ts.map +1 -1
  113. package/lib/dist/extraction/index.js +594 -1383
  114. package/lib/dist/extraction/index.js.map +1 -1
  115. package/lib/dist/extraction/kernel/decode.js +0 -16
  116. package/lib/dist/extraction/kernel/decode.js.map +1 -1
  117. package/lib/dist/extraction/kernel/index.d.ts +3 -1
  118. package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
  119. package/lib/dist/extraction/kernel/index.js +48 -135
  120. package/lib/dist/extraction/kernel/index.js.map +1 -1
  121. package/lib/dist/extraction/kernel/layout.js +42 -76
  122. package/lib/dist/extraction/kernel/layout.js.map +1 -1
  123. package/lib/dist/extraction/kernel/loader.d.ts +5 -1
  124. package/lib/dist/extraction/kernel/loader.d.ts.map +1 -1
  125. package/lib/dist/extraction/kernel/loader.js +0 -37
  126. package/lib/dist/extraction/kernel/loader.js.map +1 -1
  127. package/lib/dist/extraction/languages/arkts.js +0 -59
  128. package/lib/dist/extraction/languages/arkts.js.map +1 -1
  129. package/lib/dist/extraction/languages/c-cpp.d.ts +125 -28
  130. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  131. package/lib/dist/extraction/languages/c-cpp.js +789 -856
  132. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  133. package/lib/dist/extraction/languages/cfquery.js +0 -9
  134. package/lib/dist/extraction/languages/cfquery.js.map +1 -1
  135. package/lib/dist/extraction/languages/cfscript.d.ts +20 -0
  136. package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -1
  137. package/lib/dist/extraction/languages/cfscript.js +80 -9
  138. package/lib/dist/extraction/languages/cfscript.js.map +1 -1
  139. package/lib/dist/extraction/languages/cobol.js +0 -114
  140. package/lib/dist/extraction/languages/cobol.js.map +1 -1
  141. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts +66 -0
  142. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts.map +1 -0
  143. package/lib/dist/extraction/languages/cpp-brace-scopes.js +343 -0
  144. package/lib/dist/extraction/languages/cpp-brace-scopes.js.map +1 -0
  145. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts +41 -0
  146. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts.map +1 -0
  147. package/lib/dist/extraction/languages/cpp-macro-methods.js +487 -0
  148. package/lib/dist/extraction/languages/cpp-macro-methods.js.map +1 -0
  149. package/lib/dist/extraction/languages/csharp.js +3 -55
  150. package/lib/dist/extraction/languages/csharp.js.map +1 -1
  151. package/lib/dist/extraction/languages/dart.d.ts +129 -0
  152. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  153. package/lib/dist/extraction/languages/dart.js +517 -162
  154. package/lib/dist/extraction/languages/dart.js.map +1 -1
  155. package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
  156. package/lib/dist/extraction/languages/erlang.js +15 -102
  157. package/lib/dist/extraction/languages/erlang.js.map +1 -1
  158. package/lib/dist/extraction/languages/go.d.ts +48 -0
  159. package/lib/dist/extraction/languages/go.d.ts.map +1 -1
  160. package/lib/dist/extraction/languages/go.js +102 -31
  161. package/lib/dist/extraction/languages/go.js.map +1 -1
  162. package/lib/dist/extraction/languages/index.js +0 -6
  163. package/lib/dist/extraction/languages/index.js.map +1 -1
  164. package/lib/dist/extraction/languages/java.d.ts.map +1 -1
  165. package/lib/dist/extraction/languages/java.js +67 -78
  166. package/lib/dist/extraction/languages/java.js.map +1 -1
  167. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
  168. package/lib/dist/extraction/languages/javascript.js +2 -12
  169. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  170. package/lib/dist/extraction/languages/kotlin.d.ts +11 -0
  171. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  172. package/lib/dist/extraction/languages/kotlin.js +43 -197
  173. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  174. package/lib/dist/extraction/languages/lua.js +2 -39
  175. package/lib/dist/extraction/languages/lua.js.map +1 -1
  176. package/lib/dist/extraction/languages/luau.js +0 -14
  177. package/lib/dist/extraction/languages/luau.js.map +1 -1
  178. package/lib/dist/extraction/languages/nix.js +0 -16
  179. package/lib/dist/extraction/languages/nix.js.map +1 -1
  180. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  181. package/lib/dist/extraction/languages/objc.js +5 -16
  182. package/lib/dist/extraction/languages/objc.js.map +1 -1
  183. package/lib/dist/extraction/languages/pascal-preparse.d.ts +66 -0
  184. package/lib/dist/extraction/languages/pascal-preparse.d.ts.map +1 -0
  185. package/lib/dist/extraction/languages/pascal-preparse.js +958 -0
  186. package/lib/dist/extraction/languages/pascal-preparse.js.map +1 -0
  187. package/lib/dist/extraction/languages/pascal-system.d.ts +11 -0
  188. package/lib/dist/extraction/languages/pascal-system.d.ts.map +1 -0
  189. package/lib/dist/extraction/languages/pascal-system.js +23 -0
  190. package/lib/dist/extraction/languages/pascal-system.js.map +1 -0
  191. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
  192. package/lib/dist/extraction/languages/pascal.js +3 -4
  193. package/lib/dist/extraction/languages/pascal.js.map +1 -1
  194. package/lib/dist/extraction/languages/php.d.ts +9 -0
  195. package/lib/dist/extraction/languages/php.d.ts.map +1 -1
  196. package/lib/dist/extraction/languages/php.js +207 -44
  197. package/lib/dist/extraction/languages/php.js.map +1 -1
  198. package/lib/dist/extraction/languages/python.js +2 -20
  199. package/lib/dist/extraction/languages/python.js.map +1 -1
  200. package/lib/dist/extraction/languages/r.js +8 -78
  201. package/lib/dist/extraction/languages/r.js.map +1 -1
  202. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
  203. package/lib/dist/extraction/languages/ruby.js +17 -25
  204. package/lib/dist/extraction/languages/ruby.js.map +1 -1
  205. package/lib/dist/extraction/languages/rust-macro-calls.d.ts +32 -0
  206. package/lib/dist/extraction/languages/rust-macro-calls.d.ts.map +1 -0
  207. package/lib/dist/extraction/languages/rust-macro-calls.js +306 -0
  208. package/lib/dist/extraction/languages/rust-macro-calls.js.map +1 -0
  209. package/lib/dist/extraction/languages/rust.d.ts +10 -0
  210. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  211. package/lib/dist/extraction/languages/rust.js +15 -47
  212. package/lib/dist/extraction/languages/rust.js.map +1 -1
  213. package/lib/dist/extraction/languages/scala.js +5 -41
  214. package/lib/dist/extraction/languages/scala.js.map +1 -1
  215. package/lib/dist/extraction/languages/solidity.js +1 -82
  216. package/lib/dist/extraction/languages/solidity.js.map +1 -1
  217. package/lib/dist/extraction/languages/swift.js +3 -47
  218. package/lib/dist/extraction/languages/swift.js.map +1 -1
  219. package/lib/dist/extraction/languages/terraform.js +6 -152
  220. package/lib/dist/extraction/languages/terraform.js.map +1 -1
  221. package/lib/dist/extraction/languages/typescript.d.ts +64 -0
  222. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  223. package/lib/dist/extraction/languages/typescript.js +73 -49
  224. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  225. package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -1
  226. package/lib/dist/extraction/languages/vbnet.js +9 -42
  227. package/lib/dist/extraction/languages/vbnet.js.map +1 -1
  228. package/lib/dist/extraction/lazy-frameworks.d.ts +15 -0
  229. package/lib/dist/extraction/lazy-frameworks.d.ts.map +1 -0
  230. package/lib/dist/extraction/lazy-frameworks.js +8 -0
  231. package/lib/dist/extraction/lazy-frameworks.js.map +1 -0
  232. package/lib/dist/extraction/liquid-extractor.d.ts +29 -3
  233. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  234. package/lib/dist/extraction/liquid-extractor.js +89 -148
  235. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  236. package/lib/dist/extraction/mybatis-extractor.js +0 -78
  237. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  238. package/lib/dist/extraction/parse-budget.d.ts +42 -7
  239. package/lib/dist/extraction/parse-budget.d.ts.map +1 -1
  240. package/lib/dist/extraction/parse-budget.js +39 -15
  241. package/lib/dist/extraction/parse-budget.js.map +1 -1
  242. package/lib/dist/extraction/parse-pool.d.ts +29 -17
  243. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  244. package/lib/dist/extraction/parse-pool.js +49 -193
  245. package/lib/dist/extraction/parse-pool.js.map +1 -1
  246. package/lib/dist/extraction/parse-worker.d.ts +1 -1
  247. package/lib/dist/extraction/parse-worker.d.ts.map +1 -1
  248. package/lib/dist/extraction/parse-worker.js +5 -58
  249. package/lib/dist/extraction/parse-worker.js.map +1 -1
  250. package/lib/dist/extraction/razor-extractor.d.ts +9 -0
  251. package/lib/dist/extraction/razor-extractor.d.ts.map +1 -1
  252. package/lib/dist/extraction/razor-extractor.js +45 -69
  253. package/lib/dist/extraction/razor-extractor.js.map +1 -1
  254. package/lib/dist/extraction/razor-script.d.ts +23 -0
  255. package/lib/dist/extraction/razor-script.d.ts.map +1 -0
  256. package/lib/dist/extraction/razor-script.js +244 -0
  257. package/lib/dist/extraction/razor-script.js.map +1 -0
  258. package/lib/dist/extraction/sfc-script.d.ts +42 -0
  259. package/lib/dist/extraction/sfc-script.d.ts.map +1 -1
  260. package/lib/dist/extraction/sfc-script.js +32 -31
  261. package/lib/dist/extraction/sfc-script.js.map +1 -1
  262. package/lib/dist/extraction/store-worker.d.ts +1 -1
  263. package/lib/dist/extraction/store-worker.d.ts.map +1 -1
  264. package/lib/dist/extraction/store-worker.js +1 -38
  265. package/lib/dist/extraction/store-worker.js.map +1 -1
  266. package/lib/dist/extraction/store-writer.js +2 -34
  267. package/lib/dist/extraction/store-writer.js.map +1 -1
  268. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
  269. package/lib/dist/extraction/svelte-extractor.js +11 -87
  270. package/lib/dist/extraction/svelte-extractor.js.map +1 -1
  271. package/lib/dist/extraction/syntax-tokens.d.ts +6 -5
  272. package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -1
  273. package/lib/dist/extraction/syntax-tokens.js +4 -152
  274. package/lib/dist/extraction/syntax-tokens.js.map +1 -1
  275. package/lib/dist/extraction/tree-sitter-helpers.d.ts +37 -1
  276. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  277. package/lib/dist/extraction/tree-sitter-helpers.js +76 -68
  278. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  279. package/lib/dist/extraction/tree-sitter-types.d.ts +102 -22
  280. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  281. package/lib/dist/extraction/tree-sitter-types.js +0 -7
  282. package/lib/dist/extraction/tree-sitter-types.js.map +1 -1
  283. package/lib/dist/extraction/tree-sitter.d.ts +518 -10
  284. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  285. package/lib/dist/extraction/tree-sitter.js +2118 -2554
  286. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  287. package/lib/dist/extraction/vue-extractor.d.ts +13 -0
  288. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
  289. package/lib/dist/extraction/vue-extractor.js +52 -92
  290. package/lib/dist/extraction/vue-extractor.js.map +1 -1
  291. package/lib/dist/extraction/vue-options-api.js +0 -32
  292. package/lib/dist/extraction/vue-options-api.js.map +1 -1
  293. package/lib/dist/extraction/vue-template-calls.d.ts +37 -0
  294. package/lib/dist/extraction/vue-template-calls.d.ts.map +1 -0
  295. package/lib/dist/extraction/vue-template-calls.js +497 -0
  296. package/lib/dist/extraction/vue-template-calls.js.map +1 -0
  297. package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  298. package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  299. package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  300. package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  301. package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
  302. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  303. package/lib/dist/extraction/wasm-runtime-flags.js +18 -89
  304. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  305. package/lib/dist/file-limits.d.ts +8 -0
  306. package/lib/dist/file-limits.d.ts.map +1 -1
  307. package/lib/dist/file-limits.js +13 -28
  308. package/lib/dist/file-limits.js.map +1 -1
  309. package/lib/dist/graph/branch-guards.d.ts.map +1 -1
  310. package/lib/dist/graph/branch-guards.js +4 -251
  311. package/lib/dist/graph/branch-guards.js.map +1 -1
  312. package/lib/dist/graph/call-sites.d.ts +12 -0
  313. package/lib/dist/graph/call-sites.d.ts.map +1 -0
  314. package/lib/dist/graph/call-sites.js +17 -0
  315. package/lib/dist/graph/call-sites.js.map +1 -0
  316. package/lib/dist/graph/cobol-copybooks.d.ts +75 -0
  317. package/lib/dist/graph/cobol-copybooks.d.ts.map +1 -0
  318. package/lib/dist/graph/cobol-copybooks.js +45 -0
  319. package/lib/dist/graph/cobol-copybooks.js.map +1 -0
  320. package/lib/dist/graph/dead-code.d.ts +26 -4
  321. package/lib/dist/graph/dead-code.d.ts.map +1 -1
  322. package/lib/dist/graph/dead-code.js +157 -311
  323. package/lib/dist/graph/dead-code.js.map +1 -1
  324. package/lib/dist/graph/dynamic-boundary-report.js +1 -88
  325. package/lib/dist/graph/dynamic-boundary-report.js.map +1 -1
  326. package/lib/dist/graph/file-cycles.d.ts +20 -0
  327. package/lib/dist/graph/file-cycles.d.ts.map +1 -0
  328. package/lib/dist/graph/file-cycles.js +79 -0
  329. package/lib/dist/graph/file-cycles.js.map +1 -0
  330. package/lib/dist/graph/file-drift.d.ts +35 -0
  331. package/lib/dist/graph/file-drift.d.ts.map +1 -0
  332. package/lib/dist/graph/file-drift.js +46 -0
  333. package/lib/dist/graph/file-drift.js.map +1 -0
  334. package/lib/dist/graph/go-package.d.ts +27 -0
  335. package/lib/dist/graph/go-package.d.ts.map +1 -0
  336. package/lib/dist/graph/go-package.js +49 -0
  337. package/lib/dist/graph/go-package.js.map +1 -0
  338. package/lib/dist/graph/index.d.ts +2 -0
  339. package/lib/dist/graph/index.d.ts.map +1 -1
  340. package/lib/dist/graph/index.js +4 -6
  341. package/lib/dist/graph/index.js.map +1 -1
  342. package/lib/dist/graph/named-symbol-flow.d.ts +5 -1
  343. package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -1
  344. package/lib/dist/graph/named-symbol-flow.js +82 -223
  345. package/lib/dist/graph/named-symbol-flow.js.map +1 -1
  346. package/lib/dist/graph/owning-package.d.ts +59 -0
  347. package/lib/dist/graph/owning-package.d.ts.map +1 -0
  348. package/lib/dist/graph/owning-package.js +120 -0
  349. package/lib/dist/graph/owning-package.js.map +1 -0
  350. package/lib/dist/graph/queries.d.ts +6 -3
  351. package/lib/dist/graph/queries.d.ts.map +1 -1
  352. package/lib/dist/graph/queries.js +4 -137
  353. package/lib/dist/graph/queries.js.map +1 -1
  354. package/lib/dist/graph/symbol-lookup.d.ts +15 -3
  355. package/lib/dist/graph/symbol-lookup.d.ts.map +1 -1
  356. package/lib/dist/graph/symbol-lookup.js +47 -89
  357. package/lib/dist/graph/symbol-lookup.js.map +1 -1
  358. package/lib/dist/graph/symbol-references.d.ts +86 -0
  359. package/lib/dist/graph/symbol-references.d.ts.map +1 -0
  360. package/lib/dist/graph/symbol-references.js +304 -0
  361. package/lib/dist/graph/symbol-references.js.map +1 -0
  362. package/lib/dist/graph/synthesized-hop.d.ts +37 -0
  363. package/lib/dist/graph/synthesized-hop.d.ts.map +1 -0
  364. package/lib/dist/graph/synthesized-hop.js +62 -0
  365. package/lib/dist/graph/synthesized-hop.js.map +1 -0
  366. package/lib/dist/graph/test-code.d.ts +33 -0
  367. package/lib/dist/graph/test-code.d.ts.map +1 -0
  368. package/lib/dist/graph/test-code.js +104 -0
  369. package/lib/dist/graph/test-code.js.map +1 -0
  370. package/lib/dist/graph/traversal.d.ts +31 -2
  371. package/lib/dist/graph/traversal.d.ts.map +1 -1
  372. package/lib/dist/graph/traversal.js +96 -226
  373. package/lib/dist/graph/traversal.js.map +1 -1
  374. package/lib/dist/graph/type-hierarchy.js +0 -138
  375. package/lib/dist/graph/type-hierarchy.js.map +1 -1
  376. package/lib/dist/index.d.ts +214 -26
  377. package/lib/dist/index.d.ts.map +1 -1
  378. package/lib/dist/index.js +736 -1112
  379. package/lib/dist/index.js.map +1 -1
  380. package/lib/dist/installer/beta-signup.js +0 -39
  381. package/lib/dist/installer/beta-signup.js.map +1 -1
  382. package/lib/dist/installer/config-writer.js +0 -24
  383. package/lib/dist/installer/config-writer.js.map +1 -1
  384. package/lib/dist/installer/index.d.ts +13 -6
  385. package/lib/dist/installer/index.d.ts.map +1 -1
  386. package/lib/dist/installer/index.js +27 -160
  387. package/lib/dist/installer/index.js.map +1 -1
  388. package/lib/dist/installer/instructions-template.d.ts +16 -1
  389. package/lib/dist/installer/instructions-template.d.ts.map +1 -1
  390. package/lib/dist/installer/instructions-template.js +10 -38
  391. package/lib/dist/installer/instructions-template.js.map +1 -1
  392. package/lib/dist/installer/targets/antigravity.js +0 -113
  393. package/lib/dist/installer/targets/antigravity.js.map +1 -1
  394. package/lib/dist/installer/targets/bob.d.ts +20 -0
  395. package/lib/dist/installer/targets/bob.d.ts.map +1 -0
  396. package/lib/dist/installer/targets/bob.js +83 -0
  397. package/lib/dist/installer/targets/bob.js.map +1 -0
  398. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  399. package/lib/dist/installer/targets/claude.js +1 -185
  400. package/lib/dist/installer/targets/claude.js.map +1 -1
  401. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  402. package/lib/dist/installer/targets/codex.js +17 -109
  403. package/lib/dist/installer/targets/codex.js.map +1 -1
  404. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
  405. package/lib/dist/installer/targets/copilot-cli.js +2 -54
  406. package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
  407. package/lib/dist/installer/targets/copilot-jetbrains.js +0 -57
  408. package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -1
  409. package/lib/dist/installer/targets/copilot-vscode.js +0 -58
  410. package/lib/dist/installer/targets/copilot-vscode.js.map +1 -1
  411. package/lib/dist/installer/targets/cursor.js +7 -88
  412. package/lib/dist/installer/targets/cursor.js.map +1 -1
  413. package/lib/dist/installer/targets/droid.d.ts +18 -0
  414. package/lib/dist/installer/targets/droid.d.ts.map +1 -0
  415. package/lib/dist/installer/targets/droid.js +92 -0
  416. package/lib/dist/installer/targets/droid.js.map +1 -0
  417. package/lib/dist/installer/targets/dsh.d.ts +35 -0
  418. package/lib/dist/installer/targets/dsh.d.ts.map +1 -0
  419. package/lib/dist/installer/targets/dsh.js +267 -0
  420. package/lib/dist/installer/targets/dsh.js.map +1 -0
  421. package/lib/dist/installer/targets/gemini.js +0 -37
  422. package/lib/dist/installer/targets/gemini.js.map +1 -1
  423. package/lib/dist/installer/targets/grok.d.ts +25 -0
  424. package/lib/dist/installer/targets/grok.d.ts.map +1 -0
  425. package/lib/dist/installer/targets/grok.js +96 -0
  426. package/lib/dist/installer/targets/grok.js.map +1 -0
  427. package/lib/dist/installer/targets/hermes.d.ts +19 -7
  428. package/lib/dist/installer/targets/hermes.d.ts.map +1 -1
  429. package/lib/dist/installer/targets/hermes.js +218 -214
  430. package/lib/dist/installer/targets/hermes.js.map +1 -1
  431. package/lib/dist/installer/targets/json-config.d.ts +45 -0
  432. package/lib/dist/installer/targets/json-config.d.ts.map +1 -0
  433. package/lib/dist/installer/targets/json-config.js +128 -0
  434. package/lib/dist/installer/targets/json-config.js.map +1 -0
  435. package/lib/dist/installer/targets/kimi.d.ts +21 -0
  436. package/lib/dist/installer/targets/kimi.d.ts.map +1 -0
  437. package/lib/dist/installer/targets/kimi.js +97 -0
  438. package/lib/dist/installer/targets/kimi.js.map +1 -0
  439. package/lib/dist/installer/targets/kiro.js +1 -41
  440. package/lib/dist/installer/targets/kiro.js.map +1 -1
  441. package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
  442. package/lib/dist/installer/targets/opencode.js +1 -103
  443. package/lib/dist/installer/targets/opencode.js.map +1 -1
  444. package/lib/dist/installer/targets/pi.d.ts +24 -0
  445. package/lib/dist/installer/targets/pi.d.ts.map +1 -0
  446. package/lib/dist/installer/targets/pi.js +100 -0
  447. package/lib/dist/installer/targets/pi.js.map +1 -0
  448. package/lib/dist/installer/targets/qoder.d.ts +23 -0
  449. package/lib/dist/installer/targets/qoder.d.ts.map +1 -0
  450. package/lib/dist/installer/targets/qoder.js +83 -0
  451. package/lib/dist/installer/targets/qoder.js.map +1 -0
  452. package/lib/dist/installer/targets/qwen.d.ts +21 -0
  453. package/lib/dist/installer/targets/qwen.d.ts.map +1 -0
  454. package/lib/dist/installer/targets/qwen.js +115 -0
  455. package/lib/dist/installer/targets/qwen.js.map +1 -0
  456. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  457. package/lib/dist/installer/targets/registry.js +18 -25
  458. package/lib/dist/installer/targets/registry.js.map +1 -1
  459. package/lib/dist/installer/targets/shared.d.ts +83 -13
  460. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  461. package/lib/dist/installer/targets/shared.js +201 -131
  462. package/lib/dist/installer/targets/shared.js.map +1 -1
  463. package/lib/dist/installer/targets/toml.d.ts +82 -6
  464. package/lib/dist/installer/targets/toml.d.ts.map +1 -1
  465. package/lib/dist/installer/targets/toml.js +318 -112
  466. package/lib/dist/installer/targets/toml.js.map +1 -1
  467. package/lib/dist/installer/targets/types.d.ts +1 -1
  468. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  469. package/lib/dist/installer/targets/types.js +0 -13
  470. package/lib/dist/installer/targets/types.js.map +1 -1
  471. package/lib/dist/installer/targets/windsurf.d.ts +22 -0
  472. package/lib/dist/installer/targets/windsurf.d.ts.map +1 -0
  473. package/lib/dist/installer/targets/windsurf.js +90 -0
  474. package/lib/dist/installer/targets/windsurf.js.map +1 -0
  475. package/lib/dist/lazy-engine.d.ts +22 -0
  476. package/lib/dist/lazy-engine.d.ts.map +1 -0
  477. package/lib/dist/lazy-engine.js +16 -0
  478. package/lib/dist/lazy-engine.js.map +1 -0
  479. package/lib/dist/mcp/answer-freshness.js +0 -6
  480. package/lib/dist/mcp/answer-freshness.js.map +1 -1
  481. package/lib/dist/mcp/daemon-manager.js +2 -23
  482. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  483. package/lib/dist/mcp/daemon-paths.d.ts +2 -0
  484. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  485. package/lib/dist/mcp/daemon-paths.js +9 -85
  486. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  487. package/lib/dist/mcp/daemon-proof.d.ts +19 -0
  488. package/lib/dist/mcp/daemon-proof.d.ts.map +1 -0
  489. package/lib/dist/mcp/daemon-proof.js +126 -0
  490. package/lib/dist/mcp/daemon-proof.js.map +1 -0
  491. package/lib/dist/mcp/daemon-registry.d.ts +47 -2
  492. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  493. package/lib/dist/mcp/daemon-registry.js +188 -139
  494. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  495. package/lib/dist/mcp/daemon.d.ts +69 -0
  496. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  497. package/lib/dist/mcp/daemon.js +186 -376
  498. package/lib/dist/mcp/daemon.js.map +1 -1
  499. package/lib/dist/mcp/dynamic-boundaries.js +4 -78
  500. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  501. package/lib/dist/mcp/early-ppid.js +0 -24
  502. package/lib/dist/mcp/early-ppid.js.map +1 -1
  503. package/lib/dist/mcp/engine.d.ts +24 -0
  504. package/lib/dist/mcp/engine.d.ts.map +1 -1
  505. package/lib/dist/mcp/engine.js +47 -152
  506. package/lib/dist/mcp/engine.js.map +1 -1
  507. package/lib/dist/mcp/explore-dedup.js +0 -108
  508. package/lib/dist/mcp/explore-dedup.js.map +1 -1
  509. package/lib/dist/mcp/explore-diagnostics.d.ts +6 -0
  510. package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -1
  511. package/lib/dist/mcp/explore-diagnostics.js +8 -116
  512. package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
  513. package/lib/dist/mcp/explore-one-symbol.d.ts +77 -0
  514. package/lib/dist/mcp/explore-one-symbol.d.ts.map +1 -0
  515. package/lib/dist/mcp/explore-one-symbol.js +431 -0
  516. package/lib/dist/mcp/explore-one-symbol.js.map +1 -0
  517. package/lib/dist/mcp/explore-session-state.js +0 -129
  518. package/lib/dist/mcp/explore-session-state.js.map +1 -1
  519. package/lib/dist/mcp/hook-client.d.ts +44 -0
  520. package/lib/dist/mcp/hook-client.d.ts.map +1 -0
  521. package/lib/dist/mcp/hook-client.js +202 -0
  522. package/lib/dist/mcp/hook-client.js.map +1 -0
  523. package/lib/dist/mcp/index-freshness-worker.js +1 -6
  524. package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
  525. package/lib/dist/mcp/index-freshness.js +0 -15
  526. package/lib/dist/mcp/index-freshness.js.map +1 -1
  527. package/lib/dist/mcp/index-version-warning.d.ts +21 -0
  528. package/lib/dist/mcp/index-version-warning.d.ts.map +1 -0
  529. package/lib/dist/mcp/index-version-warning.js +38 -0
  530. package/lib/dist/mcp/index-version-warning.js.map +1 -0
  531. package/lib/dist/mcp/index.d.ts +29 -1
  532. package/lib/dist/mcp/index.d.ts.map +1 -1
  533. package/lib/dist/mcp/index.js +131 -300
  534. package/lib/dist/mcp/index.js.map +1 -1
  535. package/lib/dist/mcp/liveness-watchdog.d.ts +13 -3
  536. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  537. package/lib/dist/mcp/liveness-watchdog.js +106 -121
  538. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  539. package/lib/dist/mcp/opencode-tool-names.d.ts +32 -0
  540. package/lib/dist/mcp/opencode-tool-names.d.ts.map +1 -0
  541. package/lib/dist/mcp/opencode-tool-names.js +24 -0
  542. package/lib/dist/mcp/opencode-tool-names.js.map +1 -0
  543. package/lib/dist/mcp/ppid-watchdog.js +0 -24
  544. package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
  545. package/lib/dist/mcp/process-identity.d.ts +42 -0
  546. package/lib/dist/mcp/process-identity.d.ts.map +1 -0
  547. package/lib/dist/mcp/process-identity.js +130 -0
  548. package/lib/dist/mcp/process-identity.js.map +1 -0
  549. package/lib/dist/mcp/project-lifecycle.d.ts +6 -0
  550. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
  551. package/lib/dist/mcp/project-lifecycle.js +70 -19
  552. package/lib/dist/mcp/project-lifecycle.js.map +1 -1
  553. package/lib/dist/mcp/prompt-explore.d.ts +19 -0
  554. package/lib/dist/mcp/prompt-explore.d.ts.map +1 -0
  555. package/lib/dist/mcp/prompt-explore.js +6 -0
  556. package/lib/dist/mcp/prompt-explore.js.map +1 -0
  557. package/lib/dist/mcp/proxy.d.ts +25 -7
  558. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  559. package/lib/dist/mcp/proxy.js +145 -274
  560. package/lib/dist/mcp/proxy.js.map +1 -1
  561. package/lib/dist/mcp/query-pool.d.ts +52 -3
  562. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  563. package/lib/dist/mcp/query-pool.js +114 -123
  564. package/lib/dist/mcp/query-pool.js.map +1 -1
  565. package/lib/dist/mcp/query-worker.js +24 -36
  566. package/lib/dist/mcp/query-worker.js.map +1 -1
  567. package/lib/dist/mcp/server-instructions.d.ts +18 -0
  568. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  569. package/lib/dist/mcp/server-instructions.js +12 -32
  570. package/lib/dist/mcp/server-instructions.js.map +1 -1
  571. package/lib/dist/mcp/session.d.ts +46 -0
  572. package/lib/dist/mcp/session.d.ts.map +1 -1
  573. package/lib/dist/mcp/session.js +70 -132
  574. package/lib/dist/mcp/session.js.map +1 -1
  575. package/lib/dist/mcp/startup-handshake.js +1 -48
  576. package/lib/dist/mcp/startup-handshake.js.map +1 -1
  577. package/lib/dist/mcp/stdin-teardown.js +0 -28
  578. package/lib/dist/mcp/stdin-teardown.js.map +1 -1
  579. package/lib/dist/mcp/stdout-teardown.d.ts +26 -0
  580. package/lib/dist/mcp/stdout-teardown.d.ts.map +1 -0
  581. package/lib/dist/mcp/stdout-teardown.js +20 -0
  582. package/lib/dist/mcp/stdout-teardown.js.map +1 -0
  583. package/lib/dist/mcp/tools.d.ts +157 -18
  584. package/lib/dist/mcp/tools.d.ts.map +1 -1
  585. package/lib/dist/mcp/tools.js +797 -3621
  586. package/lib/dist/mcp/tools.js.map +1 -1
  587. package/lib/dist/mcp/transport.d.ts.map +1 -1
  588. package/lib/dist/mcp/transport.js +4 -96
  589. package/lib/dist/mcp/transport.js.map +1 -1
  590. package/lib/dist/mcp/version.d.ts +13 -1
  591. package/lib/dist/mcp/version.d.ts.map +1 -1
  592. package/lib/dist/mcp/version.js +19 -21
  593. package/lib/dist/mcp/version.js.map +1 -1
  594. package/lib/dist/mcp/writer-lock.d.ts +11 -0
  595. package/lib/dist/mcp/writer-lock.d.ts.map +1 -1
  596. package/lib/dist/mcp/writer-lock.js +49 -46
  597. package/lib/dist/mcp/writer-lock.js.map +1 -1
  598. package/lib/dist/project-config.d.ts +20 -0
  599. package/lib/dist/project-config.d.ts.map +1 -1
  600. package/lib/dist/project-config.js +31 -140
  601. package/lib/dist/project-config.js.map +1 -1
  602. package/lib/dist/resolution/alias-binding.d.ts +7 -0
  603. package/lib/dist/resolution/alias-binding.d.ts.map +1 -1
  604. package/lib/dist/resolution/alias-binding.js +7 -56
  605. package/lib/dist/resolution/alias-binding.js.map +1 -1
  606. package/lib/dist/resolution/ambient-modules.d.ts +185 -0
  607. package/lib/dist/resolution/ambient-modules.d.ts.map +1 -0
  608. package/lib/dist/resolution/ambient-modules.js +732 -0
  609. package/lib/dist/resolution/ambient-modules.js.map +1 -0
  610. package/lib/dist/resolution/angular-template-synthesizer.d.ts +48 -1
  611. package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -1
  612. package/lib/dist/resolution/angular-template-synthesizer.js +401 -65
  613. package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -1
  614. package/lib/dist/resolution/c-feature-variants.d.ts +40 -0
  615. package/lib/dist/resolution/c-feature-variants.d.ts.map +1 -0
  616. package/lib/dist/resolution/c-feature-variants.js +249 -0
  617. package/lib/dist/resolution/c-feature-variants.js.map +1 -0
  618. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  619. package/lib/dist/resolution/c-fnptr-synthesizer.js +23 -391
  620. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  621. package/lib/dist/resolution/c-macro-renames.d.ts +25 -0
  622. package/lib/dist/resolution/c-macro-renames.d.ts.map +1 -0
  623. package/lib/dist/resolution/c-macro-renames.js +95 -0
  624. package/lib/dist/resolution/c-macro-renames.js.map +1 -0
  625. package/lib/dist/resolution/callback-synthesizer.d.ts +19 -5
  626. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  627. package/lib/dist/resolution/callback-synthesizer.js +1395 -1343
  628. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  629. package/lib/dist/resolution/const-alias-synthesizer.d.ts +48 -0
  630. package/lib/dist/resolution/const-alias-synthesizer.d.ts.map +1 -0
  631. package/lib/dist/resolution/const-alias-synthesizer.js +234 -0
  632. package/lib/dist/resolution/const-alias-synthesizer.js.map +1 -0
  633. package/lib/dist/resolution/cooperative-yield.js +0 -27
  634. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  635. package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -1
  636. package/lib/dist/resolution/cpp-constructor.js +15 -17
  637. package/lib/dist/resolution/cpp-constructor.js.map +1 -1
  638. package/lib/dist/resolution/cpp-includers.d.ts +46 -0
  639. package/lib/dist/resolution/cpp-includers.d.ts.map +1 -0
  640. package/lib/dist/resolution/cpp-includers.js +153 -0
  641. package/lib/dist/resolution/cpp-includers.js.map +1 -0
  642. package/lib/dist/resolution/cpp-macro-visibility.d.ts +16 -0
  643. package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -1
  644. package/lib/dist/resolution/cpp-macro-visibility.js +17 -68
  645. package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -1
  646. package/lib/dist/resolution/cpp-namespaces.d.ts +54 -0
  647. package/lib/dist/resolution/cpp-namespaces.d.ts.map +1 -0
  648. package/lib/dist/resolution/cpp-namespaces.js +151 -0
  649. package/lib/dist/resolution/cpp-namespaces.js.map +1 -0
  650. package/lib/dist/resolution/cpp-raw-strings.d.ts +33 -0
  651. package/lib/dist/resolution/cpp-raw-strings.d.ts.map +1 -0
  652. package/lib/dist/resolution/cpp-raw-strings.js +167 -0
  653. package/lib/dist/resolution/cpp-raw-strings.js.map +1 -0
  654. package/lib/dist/resolution/cpp-supertypes.d.ts +118 -0
  655. package/lib/dist/resolution/cpp-supertypes.d.ts.map +1 -0
  656. package/lib/dist/resolution/cpp-supertypes.js +322 -0
  657. package/lib/dist/resolution/cpp-supertypes.js.map +1 -0
  658. package/lib/dist/resolution/cpp-template-instantiations.d.ts +83 -0
  659. package/lib/dist/resolution/cpp-template-instantiations.d.ts.map +1 -0
  660. package/lib/dist/resolution/cpp-template-instantiations.js +983 -0
  661. package/lib/dist/resolution/cpp-template-instantiations.js.map +1 -0
  662. package/lib/dist/resolution/cpp-type-aliases.d.ts +194 -0
  663. package/lib/dist/resolution/cpp-type-aliases.d.ts.map +1 -0
  664. package/lib/dist/resolution/cpp-type-aliases.js +648 -0
  665. package/lib/dist/resolution/cpp-type-aliases.js.map +1 -0
  666. package/lib/dist/resolution/dart-libraries.d.ts +75 -0
  667. package/lib/dist/resolution/dart-libraries.d.ts.map +1 -0
  668. package/lib/dist/resolution/dart-libraries.js +721 -0
  669. package/lib/dist/resolution/dart-libraries.js.map +1 -0
  670. package/lib/dist/resolution/dart-local-scope.d.ts +41 -0
  671. package/lib/dist/resolution/dart-local-scope.d.ts.map +1 -0
  672. package/lib/dist/resolution/dart-local-scope.js +565 -0
  673. package/lib/dist/resolution/dart-local-scope.js.map +1 -0
  674. package/lib/dist/resolution/event-emitter-synthesizer.d.ts +39 -0
  675. package/lib/dist/resolution/event-emitter-synthesizer.d.ts.map +1 -0
  676. package/lib/dist/resolution/event-emitter-synthesizer.js +656 -0
  677. package/lib/dist/resolution/event-emitter-synthesizer.js.map +1 -0
  678. package/lib/dist/resolution/expo-router-synthesizer.js +0 -52
  679. package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -1
  680. package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -1
  681. package/lib/dist/resolution/frameworks/angular-router.js +41 -208
  682. package/lib/dist/resolution/frameworks/angular-router.js.map +1 -1
  683. package/lib/dist/resolution/frameworks/aspnet-routes.d.ts +62 -0
  684. package/lib/dist/resolution/frameworks/aspnet-routes.d.ts.map +1 -0
  685. package/lib/dist/resolution/frameworks/aspnet-routes.js +382 -0
  686. package/lib/dist/resolution/frameworks/aspnet-routes.js.map +1 -0
  687. package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
  688. package/lib/dist/resolution/frameworks/astro.js +4 -60
  689. package/lib/dist/resolution/frameworks/astro.js.map +1 -1
  690. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -1
  691. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -1
  692. package/lib/dist/resolution/frameworks/cargo-workspace.js +65 -15
  693. package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -1
  694. package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -1
  695. package/lib/dist/resolution/frameworks/cics.js +7 -33
  696. package/lib/dist/resolution/frameworks/cics.js.map +1 -1
  697. package/lib/dist/resolution/frameworks/codeigniter.d.ts +23 -0
  698. package/lib/dist/resolution/frameworks/codeigniter.d.ts.map +1 -0
  699. package/lib/dist/resolution/frameworks/codeigniter.js +271 -0
  700. package/lib/dist/resolution/frameworks/codeigniter.js.map +1 -0
  701. package/lib/dist/resolution/frameworks/component-folder.d.ts +17 -0
  702. package/lib/dist/resolution/frameworks/component-folder.d.ts.map +1 -0
  703. package/lib/dist/resolution/frameworks/component-folder.js +11 -0
  704. package/lib/dist/resolution/frameworks/component-folder.js.map +1 -0
  705. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  706. package/lib/dist/resolution/frameworks/csharp.js +85 -102
  707. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  708. package/lib/dist/resolution/frameworks/drupal.d.ts +17 -8
  709. package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
  710. package/lib/dist/resolution/frameworks/drupal.js +377 -142
  711. package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
  712. package/lib/dist/resolution/frameworks/elysia.d.ts +38 -0
  713. package/lib/dist/resolution/frameworks/elysia.d.ts.map +1 -0
  714. package/lib/dist/resolution/frameworks/elysia.js +683 -0
  715. package/lib/dist/resolution/frameworks/elysia.js.map +1 -0
  716. package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
  717. package/lib/dist/resolution/frameworks/expo-modules.js +8 -88
  718. package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
  719. package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
  720. package/lib/dist/resolution/frameworks/expo-router.js +9 -190
  721. package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
  722. package/lib/dist/resolution/frameworks/express.d.ts +48 -1
  723. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  724. package/lib/dist/resolution/frameworks/express.js +193 -199
  725. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  726. package/lib/dist/resolution/frameworks/fabric.js +1 -104
  727. package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
  728. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  729. package/lib/dist/resolution/frameworks/go.js +14 -43
  730. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  731. package/lib/dist/resolution/frameworks/goframe.js +1 -55
  732. package/lib/dist/resolution/frameworks/goframe.js.map +1 -1
  733. package/lib/dist/resolution/frameworks/index.d.ts +14 -0
  734. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  735. package/lib/dist/resolution/frameworks/index.js +16 -50
  736. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  737. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  738. package/lib/dist/resolution/frameworks/java.js +203 -129
  739. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  740. package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
  741. package/lib/dist/resolution/frameworks/laravel.js +71 -136
  742. package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
  743. package/lib/dist/resolution/frameworks/name-heuristic.js +0 -12
  744. package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -1
  745. package/lib/dist/resolution/frameworks/nestjs.js +2 -199
  746. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
  747. package/lib/dist/resolution/frameworks/next-proxy.d.ts +67 -0
  748. package/lib/dist/resolution/frameworks/next-proxy.d.ts.map +1 -0
  749. package/lib/dist/resolution/frameworks/next-proxy.js +239 -0
  750. package/lib/dist/resolution/frameworks/next-proxy.js.map +1 -0
  751. package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -1
  752. package/lib/dist/resolution/frameworks/nextjs.js +10 -66
  753. package/lib/dist/resolution/frameworks/nextjs.js.map +1 -1
  754. package/lib/dist/resolution/frameworks/object-literal.js +0 -21
  755. package/lib/dist/resolution/frameworks/object-literal.js.map +1 -1
  756. package/lib/dist/resolution/frameworks/package-deps.d.ts +11 -7
  757. package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -1
  758. package/lib/dist/resolution/frameworks/package-deps.js +35 -26
  759. package/lib/dist/resolution/frameworks/package-deps.js.map +1 -1
  760. package/lib/dist/resolution/frameworks/page-component.js +0 -14
  761. package/lib/dist/resolution/frameworks/page-component.js.map +1 -1
  762. package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
  763. package/lib/dist/resolution/frameworks/play.js +26 -34
  764. package/lib/dist/resolution/frameworks/play.js.map +1 -1
  765. package/lib/dist/resolution/frameworks/python.js +5 -102
  766. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  767. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  768. package/lib/dist/resolution/frameworks/react-native.js +1 -166
  769. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  770. package/lib/dist/resolution/frameworks/react-router.d.ts +13 -4
  771. package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
  772. package/lib/dist/resolution/frameworks/react-router.js +10 -82
  773. package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
  774. package/lib/dist/resolution/frameworks/react.d.ts +57 -0
  775. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  776. package/lib/dist/resolution/frameworks/react.js +1449 -191
  777. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  778. package/lib/dist/resolution/frameworks/ruby.js +1 -61
  779. package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
  780. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
  781. package/lib/dist/resolution/frameworks/rust.js +35 -56
  782. package/lib/dist/resolution/frameworks/rust.js.map +1 -1
  783. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  784. package/lib/dist/resolution/frameworks/svelte.js +7 -75
  785. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  786. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -1
  787. package/lib/dist/resolution/frameworks/sveltekit-router.js +8 -46
  788. package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -1
  789. package/lib/dist/resolution/frameworks/swift-objc.js +0 -97
  790. package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -1
  791. package/lib/dist/resolution/frameworks/swift.js +0 -97
  792. package/lib/dist/resolution/frameworks/swift.js.map +1 -1
  793. package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -1
  794. package/lib/dist/resolution/frameworks/tanstack-router.js +9 -130
  795. package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -1
  796. package/lib/dist/resolution/frameworks/terraform.js +1 -85
  797. package/lib/dist/resolution/frameworks/terraform.js.map +1 -1
  798. package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
  799. package/lib/dist/resolution/frameworks/vue-router.js +11 -134
  800. package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
  801. package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
  802. package/lib/dist/resolution/frameworks/vue.js +42 -114
  803. package/lib/dist/resolution/frameworks/vue.js.map +1 -1
  804. package/lib/dist/resolution/go-func-field-synthesizer.d.ts +58 -0
  805. package/lib/dist/resolution/go-func-field-synthesizer.d.ts.map +1 -0
  806. package/lib/dist/resolution/go-func-field-synthesizer.js +696 -0
  807. package/lib/dist/resolution/go-func-field-synthesizer.js.map +1 -0
  808. package/lib/dist/resolution/go-module.d.ts +23 -7
  809. package/lib/dist/resolution/go-module.d.ts.map +1 -1
  810. package/lib/dist/resolution/go-module.js +21 -24
  811. package/lib/dist/resolution/go-module.js.map +1 -1
  812. package/lib/dist/resolution/go-stdlib-methods.d.ts +9 -0
  813. package/lib/dist/resolution/go-stdlib-methods.d.ts.map +1 -0
  814. package/lib/dist/resolution/go-stdlib-methods.js +224 -0
  815. package/lib/dist/resolution/go-stdlib-methods.js.map +1 -0
  816. package/lib/dist/resolution/goframe-synthesizer.js +2 -53
  817. package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
  818. package/lib/dist/resolution/import-resolver.d.ts +278 -29
  819. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  820. package/lib/dist/resolution/import-resolver.js +1825 -1396
  821. package/lib/dist/resolution/import-resolver.js.map +1 -1
  822. package/lib/dist/resolution/index.d.ts +517 -6
  823. package/lib/dist/resolution/index.d.ts.map +1 -1
  824. package/lib/dist/resolution/index.js +1604 -1042
  825. package/lib/dist/resolution/index.js.map +1 -1
  826. package/lib/dist/resolution/js-builtins.d.ts +23 -0
  827. package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
  828. package/lib/dist/resolution/js-builtins.js +34 -14
  829. package/lib/dist/resolution/js-builtins.js.map +1 -1
  830. package/lib/dist/resolution/js-class-expressions.d.ts +48 -0
  831. package/lib/dist/resolution/js-class-expressions.d.ts.map +1 -0
  832. package/lib/dist/resolution/js-class-expressions.js +25 -0
  833. package/lib/dist/resolution/js-class-expressions.js.map +1 -0
  834. package/lib/dist/resolution/js-super-calls.d.ts +18 -0
  835. package/lib/dist/resolution/js-super-calls.d.ts.map +1 -0
  836. package/lib/dist/resolution/js-super-calls.js +94 -0
  837. package/lib/dist/resolution/js-super-calls.js.map +1 -0
  838. package/lib/dist/resolution/jsx-code.d.ts +28 -0
  839. package/lib/dist/resolution/jsx-code.d.ts.map +1 -0
  840. package/lib/dist/resolution/jsx-code.js +459 -0
  841. package/lib/dist/resolution/jsx-code.js.map +1 -0
  842. package/lib/dist/resolution/lru-cache.d.ts +5 -13
  843. package/lib/dist/resolution/lru-cache.d.ts.map +1 -1
  844. package/lib/dist/resolution/lru-cache.js +43 -32
  845. package/lib/dist/resolution/lru-cache.js.map +1 -1
  846. package/lib/dist/resolution/memory-budget.js +0 -52
  847. package/lib/dist/resolution/memory-budget.js.map +1 -1
  848. package/lib/dist/resolution/module-importers.d.ts +210 -0
  849. package/lib/dist/resolution/module-importers.d.ts.map +1 -0
  850. package/lib/dist/resolution/module-importers.js +673 -0
  851. package/lib/dist/resolution/module-importers.js.map +1 -0
  852. package/lib/dist/resolution/name-matcher.d.ts +986 -7
  853. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  854. package/lib/dist/resolution/name-matcher.js +24176 -6745
  855. package/lib/dist/resolution/name-matcher.js.map +1 -1
  856. package/lib/dist/resolution/next-router-synthesizer.d.ts +19 -0
  857. package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -1
  858. package/lib/dist/resolution/next-router-synthesizer.js +46 -28
  859. package/lib/dist/resolution/next-router-synthesizer.js.map +1 -1
  860. package/lib/dist/resolution/override-parameters.d.ts +40 -0
  861. package/lib/dist/resolution/override-parameters.d.ts.map +1 -0
  862. package/lib/dist/resolution/override-parameters.js +339 -0
  863. package/lib/dist/resolution/override-parameters.js.map +1 -0
  864. package/lib/dist/resolution/parameter-flow.d.ts +218 -0
  865. package/lib/dist/resolution/parameter-flow.d.ts.map +1 -0
  866. package/lib/dist/resolution/parameter-flow.js +474 -0
  867. package/lib/dist/resolution/parameter-flow.js.map +1 -0
  868. package/lib/dist/resolution/pascal-scope.d.ts +91 -0
  869. package/lib/dist/resolution/pascal-scope.d.ts.map +1 -0
  870. package/lib/dist/resolution/pascal-scope.js +961 -0
  871. package/lib/dist/resolution/pascal-scope.js.map +1 -0
  872. package/lib/dist/resolution/path-aliases.d.ts +32 -4
  873. package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
  874. package/lib/dist/resolution/path-aliases.js +43 -110
  875. package/lib/dist/resolution/path-aliases.js.map +1 -1
  876. package/lib/dist/resolution/php-web-root.d.ts +39 -0
  877. package/lib/dist/resolution/php-web-root.d.ts.map +1 -0
  878. package/lib/dist/resolution/php-web-root.js +141 -0
  879. package/lib/dist/resolution/php-web-root.js.map +1 -0
  880. package/lib/dist/resolution/project-scans.d.ts +38 -0
  881. package/lib/dist/resolution/project-scans.d.ts.map +1 -0
  882. package/lib/dist/resolution/project-scans.js +30 -0
  883. package/lib/dist/resolution/project-scans.js.map +1 -0
  884. package/lib/dist/resolution/python-overloads.d.ts +10 -0
  885. package/lib/dist/resolution/python-overloads.d.ts.map +1 -0
  886. package/lib/dist/resolution/python-overloads.js +75 -0
  887. package/lib/dist/resolution/python-overloads.js.map +1 -0
  888. package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
  889. package/lib/dist/resolution/react-router-synthesizer.js +3 -55
  890. package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
  891. package/lib/dist/resolution/resolver-pool.d.ts +23 -2
  892. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
  893. package/lib/dist/resolution/resolver-pool.js +43 -111
  894. package/lib/dist/resolution/resolver-pool.js.map +1 -1
  895. package/lib/dist/resolution/resolver-worker.d.ts +1 -1
  896. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -1
  897. package/lib/dist/resolution/resolver-worker.js +8 -37
  898. package/lib/dist/resolution/resolver-worker.js.map +1 -1
  899. package/lib/dist/resolution/resurrect-ref.d.ts +25 -0
  900. package/lib/dist/resolution/resurrect-ref.d.ts.map +1 -0
  901. package/lib/dist/resolution/resurrect-ref.js +19 -0
  902. package/lib/dist/resolution/resurrect-ref.js.map +1 -0
  903. package/lib/dist/resolution/ruby-constant-paths.d.ts +56 -0
  904. package/lib/dist/resolution/ruby-constant-paths.d.ts.map +1 -0
  905. package/lib/dist/resolution/ruby-constant-paths.js +255 -0
  906. package/lib/dist/resolution/ruby-constant-paths.js.map +1 -0
  907. package/lib/dist/resolution/ruby-parameter-flow.d.ts +10 -0
  908. package/lib/dist/resolution/ruby-parameter-flow.d.ts.map +1 -0
  909. package/lib/dist/resolution/ruby-parameter-flow.js +801 -0
  910. package/lib/dist/resolution/ruby-parameter-flow.js.map +1 -0
  911. package/lib/dist/resolution/rust-scopes.d.ts +120 -0
  912. package/lib/dist/resolution/rust-scopes.d.ts.map +1 -0
  913. package/lib/dist/resolution/rust-scopes.js +730 -0
  914. package/lib/dist/resolution/rust-scopes.js.map +1 -0
  915. package/lib/dist/resolution/shopify-themes.d.ts +10 -0
  916. package/lib/dist/resolution/shopify-themes.d.ts.map +1 -0
  917. package/lib/dist/resolution/shopify-themes.js +19 -0
  918. package/lib/dist/resolution/shopify-themes.js.map +1 -0
  919. package/lib/dist/resolution/strip-comments.d.ts +20 -1
  920. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  921. package/lib/dist/resolution/strip-comments.js +164 -119
  922. package/lib/dist/resolution/strip-comments.js.map +1 -1
  923. package/lib/dist/resolution/sveltekit-synthesizer.js +0 -64
  924. package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -1
  925. package/lib/dist/resolution/swift-objc-bridge.js +0 -160
  926. package/lib/dist/resolution/swift-objc-bridge.js.map +1 -1
  927. package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -1
  928. package/lib/dist/resolution/swift-type-visibility.js +62 -104
  929. package/lib/dist/resolution/swift-type-visibility.js.map +1 -1
  930. package/lib/dist/resolution/synth-utils.js +1 -22
  931. package/lib/dist/resolution/synth-utils.js.map +1 -1
  932. package/lib/dist/resolution/tanstack-router-synthesizer.js +0 -32
  933. package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -1
  934. package/lib/dist/resolution/tauri-synthesizer.d.ts +37 -0
  935. package/lib/dist/resolution/tauri-synthesizer.d.ts.map +1 -0
  936. package/lib/dist/resolution/tauri-synthesizer.js +1038 -0
  937. package/lib/dist/resolution/tauri-synthesizer.js.map +1 -0
  938. package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
  939. package/lib/dist/resolution/tier-synthesizer.js +35 -177
  940. package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
  941. package/lib/dist/resolution/type-parameters.d.ts +23 -0
  942. package/lib/dist/resolution/type-parameters.d.ts.map +1 -1
  943. package/lib/dist/resolution/type-parameters.js +52 -54
  944. package/lib/dist/resolution/type-parameters.js.map +1 -1
  945. package/lib/dist/resolution/types.d.ts +192 -11
  946. package/lib/dist/resolution/types.d.ts.map +1 -1
  947. package/lib/dist/resolution/types.js +0 -47
  948. package/lib/dist/resolution/types.js.map +1 -1
  949. package/lib/dist/resolution/vbnet-receivers.d.ts +92 -0
  950. package/lib/dist/resolution/vbnet-receivers.d.ts.map +1 -0
  951. package/lib/dist/resolution/vbnet-receivers.js +1482 -0
  952. package/lib/dist/resolution/vbnet-receivers.js.map +1 -0
  953. package/lib/dist/resolution/vue-router-synthesizer.js +0 -31
  954. package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -1
  955. package/lib/dist/resolution/workspace-packages.d.ts +206 -15
  956. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
  957. package/lib/dist/resolution/workspace-packages.js +573 -152
  958. package/lib/dist/resolution/workspace-packages.js.map +1 -1
  959. package/lib/dist/search/identifier-segments.js +2 -93
  960. package/lib/dist/search/identifier-segments.js.map +1 -1
  961. package/lib/dist/search/query-parser.js +0 -54
  962. package/lib/dist/search/query-parser.js.map +1 -1
  963. package/lib/dist/search/query-paths.js +0 -167
  964. package/lib/dist/search/query-paths.js.map +1 -1
  965. package/lib/dist/search/query-utils.d.ts +44 -0
  966. package/lib/dist/search/query-utils.d.ts.map +1 -1
  967. package/lib/dist/search/query-utils.js +120 -198
  968. package/lib/dist/search/query-utils.js.map +1 -1
  969. package/lib/dist/sync/git-hooks.d.ts +14 -5
  970. package/lib/dist/sync/git-hooks.d.ts.map +1 -1
  971. package/lib/dist/sync/git-hooks.js +118 -65
  972. package/lib/dist/sync/git-hooks.js.map +1 -1
  973. package/lib/dist/sync/index.js +0 -14
  974. package/lib/dist/sync/index.js.map +1 -1
  975. package/lib/dist/sync/watch-policy.js +0 -45
  976. package/lib/dist/sync/watch-policy.js.map +1 -1
  977. package/lib/dist/sync/watcher.d.ts +29 -11
  978. package/lib/dist/sync/watcher.d.ts.map +1 -1
  979. package/lib/dist/sync/watcher.js +83 -487
  980. package/lib/dist/sync/watcher.js.map +1 -1
  981. package/lib/dist/sync/worktree.d.ts +7 -2
  982. package/lib/dist/sync/worktree.d.ts.map +1 -1
  983. package/lib/dist/sync/worktree.js +24 -97
  984. package/lib/dist/sync/worktree.js.map +1 -1
  985. package/lib/dist/telemetry/index.d.ts.map +1 -1
  986. package/lib/dist/telemetry/index.js +15 -135
  987. package/lib/dist/telemetry/index.js.map +1 -1
  988. package/lib/dist/types.d.ts +46 -0
  989. package/lib/dist/types.d.ts.map +1 -1
  990. package/lib/dist/types.js +15 -44
  991. package/lib/dist/types.js.map +1 -1
  992. package/lib/dist/ui/color.js +0 -19
  993. package/lib/dist/ui/color.js.map +1 -1
  994. package/lib/dist/ui/glyphs.js +2 -45
  995. package/lib/dist/ui/glyphs.js.map +1 -1
  996. package/lib/dist/ui/shimmer-progress.js +0 -21
  997. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  998. package/lib/dist/ui/shimmer-worker.js +0 -22
  999. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  1000. package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -1
  1001. package/lib/dist/ui-server/api/deadcode.js +2 -31
  1002. package/lib/dist/ui-server/api/deadcode.js.map +1 -1
  1003. package/lib/dist/ui-server/api/effects.js +0 -111
  1004. package/lib/dist/ui-server/api/effects.js.map +1 -1
  1005. package/lib/dist/ui-server/api/entrypoints.js +0 -142
  1006. package/lib/dist/ui-server/api/entrypoints.js.map +1 -1
  1007. package/lib/dist/ui-server/api/events.js +0 -145
  1008. package/lib/dist/ui-server/api/events.js.map +1 -1
  1009. package/lib/dist/ui-server/api/file.js +0 -80
  1010. package/lib/dist/ui-server/api/file.js.map +1 -1
  1011. package/lib/dist/ui-server/api/filecode.js +0 -95
  1012. package/lib/dist/ui-server/api/filecode.js.map +1 -1
  1013. package/lib/dist/ui-server/api/flow.js +0 -149
  1014. package/lib/dist/ui-server/api/flow.js.map +1 -1
  1015. package/lib/dist/ui-server/api/hierarchy.js +0 -28
  1016. package/lib/dist/ui-server/api/hierarchy.js.map +1 -1
  1017. package/lib/dist/ui-server/api/index.js +0 -88
  1018. package/lib/dist/ui-server/api/index.js.map +1 -1
  1019. package/lib/dist/ui-server/api/map.d.ts.map +1 -1
  1020. package/lib/dist/ui-server/api/map.js +4 -317
  1021. package/lib/dist/ui-server/api/map.js.map +1 -1
  1022. package/lib/dist/ui-server/api/node.js +0 -111
  1023. package/lib/dist/ui-server/api/node.js.map +1 -1
  1024. package/lib/dist/ui-server/api/nodes.js +0 -16
  1025. package/lib/dist/ui-server/api/nodes.js.map +1 -1
  1026. package/lib/dist/ui-server/api/program.js +0 -90
  1027. package/lib/dist/ui-server/api/program.js.map +1 -1
  1028. package/lib/dist/ui-server/api/respond.js +0 -60
  1029. package/lib/dist/ui-server/api/respond.js.map +1 -1
  1030. package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
  1031. package/lib/dist/ui-server/api/route-roots.js +2 -44
  1032. package/lib/dist/ui-server/api/route-roots.js.map +1 -1
  1033. package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
  1034. package/lib/dist/ui-server/api/routes.js +4 -60
  1035. package/lib/dist/ui-server/api/routes.js.map +1 -1
  1036. package/lib/dist/ui-server/api/screens.d.ts.map +1 -1
  1037. package/lib/dist/ui-server/api/screens.js +4 -174
  1038. package/lib/dist/ui-server/api/screens.js.map +1 -1
  1039. package/lib/dist/ui-server/api/search.js +0 -62
  1040. package/lib/dist/ui-server/api/search.js.map +1 -1
  1041. package/lib/dist/ui-server/api/session.js +0 -58
  1042. package/lib/dist/ui-server/api/session.js.map +1 -1
  1043. package/lib/dist/ui-server/api/source.d.ts.map +1 -1
  1044. package/lib/dist/ui-server/api/source.js +0 -161
  1045. package/lib/dist/ui-server/api/source.js.map +1 -1
  1046. package/lib/dist/ui-server/api/stats.js +0 -58
  1047. package/lib/dist/ui-server/api/stats.js.map +1 -1
  1048. package/lib/dist/ui-server/api/steps.d.ts.map +1 -1
  1049. package/lib/dist/ui-server/api/steps.js +5 -381
  1050. package/lib/dist/ui-server/api/steps.js.map +1 -1
  1051. package/lib/dist/ui-server/api/trail-store.d.ts +3 -3
  1052. package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -1
  1053. package/lib/dist/ui-server/api/trail-store.js +24 -106
  1054. package/lib/dist/ui-server/api/trail-store.js.map +1 -1
  1055. package/lib/dist/ui-server/api/trails.d.ts.map +1 -1
  1056. package/lib/dist/ui-server/api/trails.js +19 -94
  1057. package/lib/dist/ui-server/api/trails.js.map +1 -1
  1058. package/lib/dist/ui-server/api/when.js +0 -36
  1059. package/lib/dist/ui-server/api/when.js.map +1 -1
  1060. package/lib/dist/ui-server/api/wire.js +0 -58
  1061. package/lib/dist/ui-server/api/wire.js.map +1 -1
  1062. package/lib/dist/ui-server/assets.js +0 -35
  1063. package/lib/dist/ui-server/assets.js.map +1 -1
  1064. package/lib/dist/ui-server/constants.js +0 -26
  1065. package/lib/dist/ui-server/constants.js.map +1 -1
  1066. package/lib/dist/ui-server/highlight/bounded-tokenize.js +0 -25
  1067. package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -1
  1068. package/lib/dist/ui-server/highlight/index.js +1 -132
  1069. package/lib/dist/ui-server/highlight/index.js.map +1 -1
  1070. package/lib/dist/ui-server/highlight/languages.d.ts +3 -3
  1071. package/lib/dist/ui-server/highlight/languages.js +0 -31
  1072. package/lib/dist/ui-server/highlight/languages.js.map +1 -1
  1073. package/lib/dist/ui-server/highlight/tokenize-worker.js +0 -5
  1074. package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -1
  1075. package/lib/dist/ui-server/index.d.ts +25 -0
  1076. package/lib/dist/ui-server/index.d.ts.map +1 -1
  1077. package/lib/dist/ui-server/index.js +35 -103
  1078. package/lib/dist/ui-server/index.js.map +1 -1
  1079. package/lib/dist/ui-server/open-browser.js +0 -34
  1080. package/lib/dist/ui-server/open-browser.js.map +1 -1
  1081. package/lib/dist/ui-server/security.d.ts +5 -0
  1082. package/lib/dist/ui-server/security.d.ts.map +1 -1
  1083. package/lib/dist/ui-server/security.js +11 -147
  1084. package/lib/dist/ui-server/security.js.map +1 -1
  1085. package/lib/dist/ui-server/static.js +0 -41
  1086. package/lib/dist/ui-server/static.js.map +1 -1
  1087. package/lib/dist/upgrade/index.d.ts +18 -5
  1088. package/lib/dist/upgrade/index.d.ts.map +1 -1
  1089. package/lib/dist/upgrade/index.js +73 -229
  1090. package/lib/dist/upgrade/index.js.map +1 -1
  1091. package/lib/dist/upgrade/remove-binary.js +2 -67
  1092. package/lib/dist/upgrade/remove-binary.js.map +1 -1
  1093. package/lib/dist/upgrade/update-check.js +1 -81
  1094. package/lib/dist/upgrade/update-check.js.map +1 -1
  1095. package/lib/dist/utils.d.ts +69 -1
  1096. package/lib/dist/utils.d.ts.map +1 -1
  1097. package/lib/dist/utils.js +224 -266
  1098. package/lib/dist/utils.js.map +1 -1
  1099. package/lib/dist/worker-teardown.js +0 -47
  1100. package/lib/dist/worker-teardown.js.map +1 -1
  1101. package/lib/kernel/codegraph-kernel.node +2 -2
  1102. package/lib/node_modules/.package-lock.json +4 -4
  1103. package/lib/node_modules/ignore/README.md +138 -8
  1104. package/lib/node_modules/ignore/index.d.ts +56 -20
  1105. package/lib/node_modules/ignore/index.js +1033 -221
  1106. package/lib/node_modules/ignore/legacy.js +871 -178
  1107. package/lib/node_modules/ignore/package.json +10 -4
  1108. package/lib/package.json +14 -8
  1109. package/node.exe +2 -2
  1110. package/package.json +1 -1
@@ -1,29 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- /**
4
- * CodeGraph CLI
5
- *
6
- * Command-line interface for CodeGraph code intelligence.
7
- *
8
- * Usage:
9
- * codegraph Run interactive installer (when no args)
10
- * codegraph install Run interactive installer
11
- * codegraph uninstall Remove CodeGraph from your agents
12
- * codegraph init [path] Initialize CodeGraph in a project
13
- * codegraph uninit [path] Remove CodeGraph from a project
14
- * codegraph index [path] Index all files in the project
15
- * codegraph sync [path] Sync changes since last index
16
- * codegraph status [path] Show index status
17
- * codegraph query <search> Search for symbols
18
- * codegraph files [options] Show project file structure
19
- * codegraph context <task> Build context for a task
20
- * codegraph callers <symbol> Find what calls a function/method
21
- * codegraph callees <symbol> Find what a function/method calls
22
- * codegraph impact <symbol> Analyze what code is affected by changing a symbol
23
- * codegraph affected [files] Find test files affected by changes
24
- * codegraph ui [path] Open the browser viewer (alias: web; not released yet — needs CODEGRAPH_UI=1)
25
- * codegraph upgrade [version] Update CodeGraph to the latest release
26
- */
27
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
28
4
  if (k2 === undefined) k2 = k;
29
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -58,13 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
58
34
  };
59
35
  })();
60
36
  Object.defineProperty(exports, "__esModule", { value: true });
61
- // FIRST import, before anything else loads: capture process.ppid while our
62
- // launcher is (almost certainly) still alive. A launcher killed mid-startup
63
- // otherwise blinds the PPID watchdog forever (#1185) — see early-ppid.ts.
64
37
  require("../mcp/early-ppid");
65
- // The browser viewer is not part of a release yet (see viewer-gate). Refuse
66
- // `ui` / `web` — also as `help ui` or `ui --help` — before any startup work,
67
- // unless CODEGRAPH_UI=1 opts in.
68
38
  const viewer_gate_1 = require("./viewer-gate");
69
39
  {
70
40
  const viewerCommand = (0, viewer_gate_1.requestedViewerCommand)(process.argv.slice(2));
@@ -73,15 +43,7 @@ const viewer_gate_1 = require("./viewer-gate");
73
43
  process.exit(1);
74
44
  }
75
45
  }
76
- // Persist V8 compile artifacts across runs (Node ≥22.8). Every invocation —
77
- // and every worker thread, which re-requires the whole extraction module
78
- // graph — skips recompiling unchanged sources. Worth hundreds of ms of
79
- // worker-boot latency per bulk index; harmless no-op when unavailable.
80
- try {
81
- // eslint-disable-next-line @typescript-eslint/no-require-imports
82
- require('node:module').enableCompileCache?.();
83
- }
84
- catch { /* cache is best-effort */ }
46
+ require("../compile-cache");
85
47
  const commander_1 = require("commander");
86
48
  const path = __importStar(require("path"));
87
49
  const fs = __importStar(require("fs"));
@@ -97,16 +59,15 @@ const wasm_runtime_flags_1 = require("../extraction/wasm-runtime-flags");
97
59
  const command_supervision_1 = require("./command-supervision");
98
60
  const extraction_version_1 = require("../extraction/extraction-version");
99
61
  const telemetry_1 = require("../telemetry");
100
- // Value import, but dependency-free by design so `--help` text can name the
101
- // default port without dragging node:http into every other subcommand; the
102
- // server itself is loaded lazily inside the `ui` action. See ui-server/constants.
103
62
  const constants_1 = require("../ui-server/constants");
104
63
  const symbol_lookup_1 = require("../graph/symbol-lookup");
64
+ const call_sites_1 = require("../graph/call-sites");
65
+ const go_package_1 = require("../graph/go-package");
66
+ const owning_package_1 = require("../graph/owning-package");
67
+ const type_hierarchy_1 = require("../graph/type-hierarchy");
68
+ const test_code_1 = require("../graph/test-code");
105
69
  const query_utils_1 = require("../search/query-utils");
106
- // Decided once, before `--color`/`--no-color` are stripped from argv below
107
- // (#1281). Piped/redirected stdout, NO_COLOR, or --no-color -> plain output.
108
70
  const COLORS_ENABLED = (0, color_1.ansiColorsEnabled)();
109
- // Lazy-load heavy modules (CodeGraph, runInstaller) to keep CLI startup fast.
110
71
  async function loadCodeGraph() {
111
72
  try {
112
73
  return await Promise.resolve().then(() => __importStar(require('../index')));
@@ -121,17 +82,7 @@ async function loadCodeGraph() {
121
82
  process.exit(1);
122
83
  }
123
84
  }
124
- // Dynamic import helper — tsc compiles import() to require() in CJS mode,
125
- // which fails for ESM-only packages. This bypasses the transformation.
126
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
127
85
  const importESM = new Function('specifier', 'return import(specifier)');
128
- // Block CodeGraph on Node.js 25.x — V8's turboshaft WASM JIT has a Zone
129
- // allocator bug that reliably crashes when compiling tree-sitter
130
- // grammars (see #54, #81, #140). The previous behaviour was a soft
131
- // console.warn that scrolls off-screen before the OOM crash 30 seconds
132
- // later, leading to a steady stream of "what is this OOM" reports.
133
- // Hard-exit before any WASM work; allow override via env var for users
134
- // who patched V8 themselves or want to test a future fix.
135
86
  const nodeVersion = process.versions.node;
136
87
  const nodeMajor = parseInt(nodeVersion.split('.')[0] ?? '0', 10);
137
88
  if (nodeMajor >= 25) {
@@ -139,31 +90,15 @@ if (nodeMajor >= 25) {
139
90
  if (!process.env.CODEGRAPH_ALLOW_UNSAFE_NODE) {
140
91
  process.exit(1);
141
92
  }
142
- // Override active — banner shown for visibility, continuing.
143
93
  }
144
- // Enforce the supported Node floor. `engines` in package.json only *warns* on
145
- // install (unless engine-strict), so hard-block here to actually keep users off
146
- // unsupported versions. Mirrors the 25+ block above. See package.json `engines`.
147
94
  if (nodeMajor < node_version_check_1.MIN_NODE_MAJOR) {
148
95
  process.stderr.write((0, node_version_check_1.buildNodeTooOldBanner)(nodeVersion) + '\n');
149
96
  if (!process.env.CODEGRAPH_ALLOW_UNSAFE_NODE) {
150
97
  process.exit(1);
151
98
  }
152
- // Override active — banner shown for visibility, continuing.
153
99
  }
154
- // Re-exec with V8's `--liftoff-only` if it isn't already set, so tree-sitter's
155
- // large WASM grammars never hit the turboshaft Zone OOM (`Fatal process out of
156
- // memory: Zone`) on Node >= 22. No-op under the bundled launcher, which already
157
- // passes the flag. Must run before any grammar (in the parse worker, which
158
- // inherits this process's flags) is compiled. See ../extraction/wasm-runtime-flags.
159
100
  (0, wasm_runtime_flags_1.relaunchWithWasmRuntimeFlagsIfNeeded)(__filename);
160
- // Last-resort fatal handlers: log a bounded line and exit non-zero. A fault
161
- // that reaches here escaped every boundary, so the process is in an undefined
162
- // state — keeping it alive is what let the detached MCP daemon orphan and pin a
163
- // CPU core with no recovery (#799, #850). Installed before the command branch
164
- // so it also covers a synchronous throw during startup. See ./fatal-handler.
165
101
  (0, fatal_handler_1.installFatalHandlers)();
166
- // Check if running with no arguments - run installer
167
102
  if (process.argv.length === 2) {
168
103
  Promise.resolve().then(() => __importStar(require('../installer'))).then(({ runInstaller }) => runInstaller()).catch((err) => {
169
104
  console.error('Installation failed:', err instanceof Error ? err.message : String(err));
@@ -171,30 +106,16 @@ if (process.argv.length === 2) {
171
106
  });
172
107
  }
173
108
  else {
174
- // Normal CLI flow
175
109
  main();
176
110
  }
177
111
  function main() {
178
112
  const program = new commander_1.Command();
179
- // Version from package.json
180
113
  const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'package.json'), 'utf-8'));
181
- // Make the version trivial to reach. commander's `.version()` (below) wires up
182
- // `--version` and `-V`; intercept the spellings it can't — lowercase `-v` and
183
- // single-dash `-version` — before any parsing. (commander's version short flag
184
- // is the capital `-V`, and its parser rejects a multi-character single-dash
185
- // flag.) The bare `codegraph version` subcommand is registered further down so
186
- // the affordance also shows up in `codegraph --help`.
187
114
  const firstArg = process.argv[2];
188
115
  if (firstArg === '-v' || firstArg === '-version') {
189
116
  console.log(packageJson.version);
190
117
  return;
191
118
  }
192
- // =============================================================================
193
- // ANSI Color Helpers (avoid chalk ESM issues)
194
- // =============================================================================
195
- // `--color` / `--no-color` are global and position-independent — they were
196
- // already read by ansiColorsEnabled() at module load, so strip them before
197
- // commander parses (a subcommand would otherwise reject the unknown flag).
198
119
  process.argv = process.argv.filter((a) => a !== '--color' && a !== '--no-color');
199
120
  const colors = COLORS_ENABLED
200
121
  ? {
@@ -236,51 +157,28 @@ function main() {
236
157
  .name('codegraph')
237
158
  .description('Code intelligence and knowledge graph for any codebase')
238
159
  .version(packageJson.version)
239
- // Parsed manually before commander runs (any argv position works); declared
240
- // here so they show up in --help. NO_COLOR / FORCE_COLOR env vars are also
241
- // honored, and piped output defaults to no color (#1281).
242
160
  .option('--color', 'force ANSI colors even when stdout is not a TTY')
243
161
  .option('--no-color', 'disable ANSI colors (NO_COLOR env is also honored)');
244
- // Anonymous usage telemetry (see TELEMETRY.md): record the invoked subcommand
245
- // NAME only — never arguments or paths. Counts buffer locally; network sends
246
- // piggyback on commands that run long anyway (quick commands only append to
247
- // the local buffer at exit, costing nothing).
248
- // install/uninstall are absent on purpose: the installer flushes at its own
249
- // end, AFTER its consent prompt — a flush here would fire the first-run
250
- // notice before the user ever sees the toggle.
251
162
  const TELEMETRY_FLUSH_COMMANDS = new Set(['init', 'uninit', 'index', 'sync', 'upgrade']);
252
163
  program.hook('preAction', (_thisCommand, actionCommand) => {
253
164
  try {
254
- // The detached daemon re-invokes `serve --mcp` internally — not a user action.
255
165
  if (process.env.CODEGRAPH_DAEMON_INTERNAL)
256
166
  return;
257
167
  const name = actionCommand.name();
258
168
  if (name === 'telemetry')
259
- return; // managing telemetry is not usage
169
+ return;
260
170
  (0, telemetry_1.getTelemetry)().recordUsage('cli_command', name, true);
261
171
  if (TELEMETRY_FLUSH_COMMANDS.has(name))
262
172
  (0, telemetry_1.getTelemetry)().maybeFlush();
263
173
  }
264
174
  catch {
265
- /* telemetry must never break the CLI */
266
175
  }
267
176
  });
268
- // =============================================================================
269
- // Helper Functions
270
- // =============================================================================
271
- /**
272
- * Resolve project path from argument or current directory
273
- * Walks up parent directories to find nearest initialized CodeGraph project
274
- * (must have .codegraph/codegraph.db, not just .codegraph/lessons.db)
275
- */
276
177
  function resolveProjectPath(pathArg) {
277
178
  const absolutePath = path.resolve(pathArg || process.cwd());
278
- // If exact path is initialized (has codegraph.db), use it
279
179
  if ((0, directory_1.isInitialized)(absolutePath)) {
280
180
  return absolutePath;
281
181
  }
282
- // Walk up to find nearest parent with CodeGraph initialized
283
- // Note: findNearestCodeGraphRoot finds any .codegraph folder, but we need one with codegraph.db
284
182
  let current = absolutePath;
285
183
  const root = path.parse(current).root;
286
184
  while (current !== root) {
@@ -292,18 +190,11 @@ function main() {
292
190
  return current;
293
191
  }
294
192
  }
295
- // Not found - return original path (will fail later with helpful error)
296
193
  return absolutePath;
297
194
  }
298
- /**
299
- * Format a number with commas
300
- */
301
195
  function formatNumber(n) {
302
196
  return n.toLocaleString();
303
197
  }
304
- /**
305
- * Format duration in milliseconds to human readable
306
- */
307
198
  function formatDuration(ms) {
308
199
  if (ms < 1000) {
309
200
  return `${ms}ms`;
@@ -316,12 +207,6 @@ function main() {
316
207
  const remainingSeconds = seconds % 60;
317
208
  return `${minutes}m ${remainingSeconds.toFixed(0)}s`;
318
209
  }
319
- // Shimmer progress renderer (runs in a worker thread for smooth animation)
320
- // Imported at top of file from '../ui/shimmer-progress'
321
- /**
322
- * Create a plain-text progress callback for --verbose mode.
323
- * No animations, no ANSI tricks — just timestamped lines to stdout.
324
- */
325
210
  function createVerboseProgress() {
326
211
  let lastPhase = '';
327
212
  let lastPct = -1;
@@ -335,56 +220,61 @@ function main() {
335
220
  }
336
221
  if (progress.total > 0) {
337
222
  const pct = Math.floor((progress.current / progress.total) * 100);
338
- // Log every 5% to keep output manageable
339
223
  if (pct >= lastPct + 5 || progress.current === progress.total) {
340
224
  lastPct = pct;
341
225
  console.log(`[${elapsed}s] ${progress.current}/${progress.total} (${pct}%)${progress.currentFile ? ` ${(0, glyphs_1.getGlyphs)().dash} ${progress.currentFile}` : ''}`);
342
226
  }
343
227
  }
344
228
  else if (progress.current > 0) {
345
- // Scanning phase (no total yet) — log periodically
346
229
  if (progress.current % 1000 === 0 || progress.current === 1) {
347
230
  console.log(`[${elapsed}s] ${formatNumber(progress.current)} files found`);
348
231
  }
349
232
  }
350
233
  };
351
234
  }
352
- /**
353
- * Print success message
354
- */
355
235
  function success(message) {
356
236
  console.log(chalk.green((0, glyphs_1.getGlyphs)().ok) + ' ' + message);
357
237
  }
358
- /**
359
- * Print error message
360
- */
361
238
  function error(message) {
362
239
  console.error(chalk.red((0, glyphs_1.getGlyphs)().err) + ' ' + message);
363
240
  }
364
- /**
365
- * Print info message
366
- */
367
241
  function info(message) {
368
242
  console.log(chalk.blue((0, glyphs_1.getGlyphs)().info) + ' ' + message);
369
243
  }
370
- /**
371
- * Print warning message
372
- */
373
244
  function warn(message) {
374
245
  console.log(chalk.yellow((0, glyphs_1.getGlyphs)().warn) + ' ' + message);
375
246
  }
376
- /** "not found" (+ optional did-you-mean) when no exact symbol matches. */
247
+ async function openIndexToRead(projectPath) {
248
+ const { default: CodeGraph } = await loadCodeGraph();
249
+ const cg = await CodeGraph.open(projectPath, { readOnly: true });
250
+ const { isRebuildInProgress } = await Promise.resolve().then(() => __importStar(require('../mcp/writer-lock')));
251
+ if (isRebuildInProgress(projectPath)) {
252
+ console.error(`${chalk.yellow((0, glyphs_1.getGlyphs)().warn)} An index rebuild ("codegraph index") is running in another process — this answer comes from the part of the index it has rebuilt so far.`);
253
+ }
254
+ return cg;
255
+ }
256
+ function warnChangedOnDisk(changed, json) {
257
+ if (changed.length === 0)
258
+ return;
259
+ const named = changed.slice(0, 5).join(', ') + (changed.length > 5 ? ` and ${changed.length - 5} more` : '');
260
+ const message = changed.length === 1
261
+ ? `${named} changed on disk after it was last indexed, so line numbers from it may be off. Run "codegraph sync" to update the index.`
262
+ : `${changed.length} files changed on disk after they were last indexed (${named}), so line numbers from them may be off. Run "codegraph sync" to update the index.`;
263
+ if (json)
264
+ console.error(`${chalk.yellow((0, glyphs_1.getGlyphs)().warn)} ${message}`);
265
+ else
266
+ warn(message);
267
+ }
377
268
  function formatSymbolNotFound(symbol, fuzzyNames) {
378
269
  const suggestions = [...new Set(fuzzyNames.filter((n) => n !== symbol))].slice(0, 3);
379
270
  if (suggestions.length === 0)
380
271
  return `Symbol "${symbol}" not found`;
381
272
  return `Symbol "${symbol}" not found — did you mean: ${suggestions.join(', ')}?`;
382
273
  }
383
- /** Compact node shape retained by the CLI's existing JSON lists. */
384
274
  function cliNode(node) {
385
275
  return { name: node.name, kind: node.kind, filePath: node.filePath, startLine: node.startLine };
386
276
  }
387
- /** Attribute a group's edges to every overload of this definition. */
277
+ const CLI_CALL_SITES_SHOWN = 10;
388
278
  function cliDefinition(group) {
389
279
  const head = group[0];
390
280
  return {
@@ -392,23 +282,9 @@ function main() {
392
282
  roots: group.map((node) => node.id),
393
283
  };
394
284
  }
395
- /**
396
- * Print indexing results using clack log methods
397
- */
398
285
  function printIndexResult(clack, result, projectPath) {
399
286
  const hasErrors = result.filesErrored > 0;
400
287
  const parseWarnings = result.errors.filter((e) => e.code === 'parse_error' && e.severity === 'warning');
401
- // Surface non-file-level failures (e.g. lock-acquisition failure
402
- // when another indexer is running) before the file-count branches.
403
- // Without this the CLI falls through to "No files found to index",
404
- // which is actively misleading — the index DID run, it just couldn't
405
- // get the lock.
406
- //
407
- // If success is false but no severity:'error' entry exists in
408
- // `result.errors` (degenerate case — shouldn't happen in practice
409
- // but worth guarding because the result shape is plumbed through
410
- // multiple call sites), fall back to a generic message rather than
411
- // continuing to the misleading "No files found" branch or throwing.
412
288
  if (!result.success && !hasErrors && result.filesIndexed === 0) {
413
289
  const generic = result.errors.find((e) => e.severity === 'error');
414
290
  clack.log.error(generic?.message ?? `Indexing failed ${(0, glyphs_1.getGlyphs)().dash} no further details available`);
@@ -422,22 +298,12 @@ function main() {
422
298
  clack.log.success(`Indexed ${formatNumber(result.filesIndexed)} files`);
423
299
  }
424
300
  clack.log.info(`${formatNumber(result.nodesCreated)} nodes, ${formatNumber(result.edgesCreated)} edges in ${formatDuration(result.durationMs)}`);
425
- // Warning-only parse failures keep indexing successful, but must be visible.
426
301
  for (const warning of parseWarnings) {
427
302
  clack.log.warn(warning.message);
428
303
  }
429
- // A PARTIAL index (files silently dropped mid-pipeline) must not pass
430
- // as a clean run — it's the difference between "indexed the repo" and
431
- // "indexed most of the repo, quietly". Only the completeness
432
- // reconciliation warning; per-file extractor warnings stay in the
433
- // error-code summary below.
434
304
  for (const w of result.errors.filter((e) => e.code === 'index_partial')) {
435
305
  clack.log.warn(w.message);
436
306
  }
437
- // Files salvaged from comment-stripped source after repeated parser
438
- // failures are indexed but possibly incomplete — say so here, or the run
439
- // reads as fully clean and the index quietly disagrees with a later
440
- // re-parse of the same bytes (#1565).
441
307
  const salvaged = result.errors.filter((e) => e.code === 'salvaged_stripped');
442
308
  if (salvaged.length > 0) {
443
309
  const sample = salvaged.slice(0, 3).map((e) => e.filePath).filter(Boolean).join(', ');
@@ -449,11 +315,6 @@ function main() {
449
315
  clack.log.error(`Indexing failed ${(0, glyphs_1.getGlyphs)().dash} all ${formatNumber(result.filesErrored)} files had errors`);
450
316
  }
451
317
  else if (result.filesSkippedUnsupported) {
452
- // A project CodeGraph has no grammar for used to be indistinguishable from
453
- // an empty one: same message, same `complete` state, same exit 0. Say which
454
- // files were there and that the graph is empty on purpose, so nobody — and
455
- // no agent trusting the graph — reads silence as "this code doesn't exist"
456
- // (#1502).
457
318
  const top = (result.topUnsupportedExtensions ?? [])
458
319
  .map(e => `${e.ext} (${formatNumber(e.count)})`)
459
320
  .join(', ');
@@ -493,8 +354,6 @@ function main() {
493
354
  }
494
355
  }
495
356
  else if (projectPath) {
496
- // No hard errors. Salvaged-file warnings still belong in the log — it
497
- // carries the per-file detail behind the one-line summary above.
498
357
  if (result.errors.some((e) => e.code === 'salvaged_stripped')) {
499
358
  writeErrorLog(projectPath, result.errors);
500
359
  clack.log.info('See .codegraph/errors.log for details');
@@ -507,26 +366,16 @@ function main() {
507
366
  }
508
367
  }
509
368
  }
510
- /**
511
- * When an `init`/`index` produced an EMPTY graph and the reason is that the
512
- * project's own `.gitignore` excludes nested git repositories — the "super-repo
513
- * gitignores its child repos" layout (#1156), where `init` at the parent
514
- * correctly indexes ~nothing while `init` inside each child works — name those
515
- * repos and offer to index them. An interactive terminal gets a yes/no prompt
516
- * that writes `includeIgnored` to codegraph.json and re-indexes; a
517
- * non-interactive run just prints the one-line opt-in snippet. The caller gates
518
- * this on `nodesCreated === 0`, so a project that DID index real content is
519
- * never nagged about the gitignored reference clones it deliberately keeps out
520
- * (#970, #1065). Best-effort throughout: detection never breaks the command.
521
- */
522
369
  async function offerIndexIgnoredRepos(clack, projectPath, reindex, opts) {
523
370
  let repos;
371
+ let patterns;
524
372
  try {
525
- const { findUnindexedIgnoredRepos } = await Promise.resolve().then(() => __importStar(require('../extraction')));
373
+ const { findUnindexedIgnoredRepos, includeIgnoredPatternFor } = await Promise.resolve().then(() => __importStar(require('../extraction')));
526
374
  repos = findUnindexedIgnoredRepos(projectPath);
375
+ patterns = repos.map(includeIgnoredPatternFor);
527
376
  }
528
377
  catch {
529
- return; // detection is advisory — never let it break the command
378
+ return;
530
379
  }
531
380
  if (repos.length === 0)
532
381
  return;
@@ -535,7 +384,7 @@ function main() {
535
384
  const SHOWN = 6;
536
385
  const names = repos.slice(0, SHOWN).map((r) => r.replace(/\/$/, ''));
537
386
  const extra = repos.length > SHOWN ? ` (+${formatNumber(repos.length - SHOWN)} more)` : '';
538
- const snippet = `{ "includeIgnored": [${repos.map((p) => JSON.stringify(p)).join(', ')}] }`;
387
+ const snippet = `{ "includeIgnored": [${patterns.map((p) => JSON.stringify(p)).join(', ')}] }`;
539
388
  clack.log.warn(`Your .gitignore excludes ${isOne ? 'a nested git repository' : `${formatNumber(repos.length)} nested git repositories`} here, ` +
540
389
  `so ${isOne ? 'it was' : 'they were'} not indexed: ${names.join(', ')}${extra}.`);
541
390
  const manualHint = () => {
@@ -557,7 +406,7 @@ function main() {
557
406
  let added;
558
407
  try {
559
408
  const { addIncludeIgnoredPatterns } = await Promise.resolve().then(() => __importStar(require('../project-config')));
560
- added = addIncludeIgnoredPatterns(projectPath, repos);
409
+ added = addIncludeIgnoredPatterns(projectPath, patterns);
561
410
  }
562
411
  catch (err) {
563
412
  clack.log.error(`Could not update ${PROJECT_CONFIG_FILENAME}: ${err instanceof Error ? err.message : String(err)}`);
@@ -569,15 +418,11 @@ function main() {
569
418
  printIndexResult(clack, result, projectPath);
570
419
  return result;
571
420
  }
572
- /**
573
- * Write detailed error log to .codegraph/errors.log
574
- */
575
421
  function writeErrorLog(projectPath, errors) {
576
422
  const cgDir = (0, directory_1.getCodeGraphDir)(projectPath);
577
423
  if (!fs.existsSync(cgDir))
578
424
  return;
579
425
  const logPath = path.join(cgDir, 'errors.log');
580
- // Group errors by file path
581
426
  const errorsByFile = new Map();
582
427
  const noFileErrors = [];
583
428
  for (const err of errors) {
@@ -610,33 +455,62 @@ function main() {
610
455
  }
611
456
  fs.writeFileSync(logPath, lines.join('\n') + '\n');
612
457
  }
613
- /**
614
- * Telemetry for a completed full index (see TELEMETRY.md). The bounded flush
615
- * keeps init/index responsive (these commands just ran for seconds anyway)
616
- * while delivering the event promptly.
617
- */
618
458
  async function recordIndexTelemetry(cg, result) {
619
459
  (0, telemetry_1.recordIndexEvent)(cg, result);
620
460
  await (0, telemetry_1.getTelemetry)().flushNow();
621
461
  }
622
- // =============================================================================
623
- // Commands
624
- // =============================================================================
625
- /**
626
- * The `init` flow — shared by `codegraph init` and `codegraph install --init`
627
- * (#1578): refuse an unsafe root, create `.codegraph/`, build the initial
628
- * index under supervision, then the post-index offers. `yes` makes every
629
- * offer non-interactive (defaults only), so a container / CI bootstrap never
630
- * blocks on a prompt. An unsafe root sets `process.exitCode = 1` and returns
631
- * (no `--force` is implied by any caller); an index failure exits 1.
632
- */
462
+ function applyLocalOnlyGitignore(clack, projectPath) {
463
+ const file = `${path.basename((0, directory_1.getCodeGraphDir)(projectPath))}/.gitignore`;
464
+ switch ((0, directory_1.makeGitignoreLocalOnly)(projectPath)) {
465
+ case 'written':
466
+ clack.log.success(`${file} now ignores itself, so nothing of CodeGraph's shows in git.`);
467
+ break;
468
+ case 'unchanged':
469
+ clack.log.info(`${file} already ignores itself.`);
470
+ break;
471
+ case 'customized':
472
+ clack.log.warn(`Left ${file} as it is because it has your own rules. A lone * in it would keep the whole folder out of git.`);
473
+ break;
474
+ case 'tracked':
475
+ clack.log.warn(`Left ${file} as it is because it is committed to this repository, so changing it would show up in git.`);
476
+ break;
477
+ }
478
+ }
479
+ function unfinishedIndexWarning(indexState, rebuildInProgress) {
480
+ if (rebuildInProgress)
481
+ return null;
482
+ switch (indexState) {
483
+ case 'indexing':
484
+ return 'The last index run never finished (killed mid-index?) — the index is truncated. Re-run "codegraph index".';
485
+ case 'partial':
486
+ return 'The last index run silently dropped files — the index is partial. Re-run "codegraph index".';
487
+ case 'failed':
488
+ return 'The last index run failed — results may be incomplete. Re-run "codegraph index".';
489
+ default:
490
+ return null;
491
+ }
492
+ }
493
+ async function readLastIndexRun(projectPath) {
494
+ const { isRebuildInProgress } = await Promise.resolve().then(() => __importStar(require('../mcp/writer-lock')));
495
+ const rebuildInProgress = isRebuildInProgress(projectPath);
496
+ let indexState = null;
497
+ try {
498
+ const { default: CodeGraph } = await loadCodeGraph();
499
+ const cg = await CodeGraph.open(projectPath, { readOnly: true });
500
+ try {
501
+ indexState = cg.getIndexState();
502
+ }
503
+ finally {
504
+ cg.destroy();
505
+ }
506
+ }
507
+ catch { }
508
+ return { unfinished: unfinishedIndexWarning(indexState, rebuildInProgress), rebuildInProgress };
509
+ }
633
510
  async function runInit(projectPath, options) {
634
511
  const clack = await importESM('@clack/prompts');
635
512
  clack.intro('Initializing CodeGraph');
636
513
  try {
637
- // Refuse to index your home directory / a filesystem root — it pulls in
638
- // caches, other projects, and your whole tree (a multi-GB index + watcher
639
- // churn, and on pre-1.0 macOS a machine-crashing fd blowup, #845).
640
514
  const unsafe = (0, directory_1.unsafeIndexRootReason)(projectPath);
641
515
  if (unsafe && !options.force) {
642
516
  clack.log.error(`Refusing to initialize in ${projectPath} — it looks like ${unsafe}.`);
@@ -646,13 +520,24 @@ function main() {
646
520
  return;
647
521
  }
648
522
  if ((0, directory_1.isInitialized)(projectPath)) {
649
- clack.log.warn(`Already initialized in ${projectPath}`);
650
- clack.log.info('Use "codegraph index" to re-index or "codegraph sync" to update');
523
+ const { unfinished, rebuildInProgress } = await readLastIndexRun(projectPath);
524
+ if (unfinished) {
525
+ clack.log.warn(`Initialized in ${projectPath}, but its index is incomplete.`);
526
+ clack.log.warn(unfinished);
527
+ }
528
+ else {
529
+ clack.log.warn(`Already initialized in ${projectPath}`);
530
+ clack.log.info(rebuildInProgress
531
+ ? 'An index rebuild ("codegraph index") is running in another process.'
532
+ : 'Use "codegraph index" to re-index or "codegraph sync" to update');
533
+ }
534
+ if (options.localOnly)
535
+ applyLocalOnlyGitignore(clack, projectPath);
651
536
  try {
652
537
  const { offerWatchFallback } = await Promise.resolve().then(() => __importStar(require('../installer')));
653
538
  await offerWatchFallback(clack, projectPath, { yes: options.yes });
654
539
  }
655
- catch { /* non-fatal */ }
540
+ catch { }
656
541
  clack.outro('');
657
542
  return;
658
543
  }
@@ -670,21 +555,13 @@ function main() {
670
555
  const { default: CodeGraph, getDatabasePath } = await loadCodeGraph();
671
556
  const cg = await CodeGraph.init(projectPath, { index: false });
672
557
  clack.log.success(`Initialized in ${projectPath}`);
673
- // A fresh index on a Windows drive under WSL gets its own directory (#995).
674
- // It isn't the documented name, so say where it went and why.
558
+ if (options.localOnly)
559
+ applyLocalOnlyGitignore(clack, projectPath);
675
560
  const dataDir = path.basename((0, directory_1.getCodeGraphDir)(projectPath));
676
561
  if (dataDir !== (0, directory_1.codeGraphDirName)()) {
677
562
  clack.log.info(`The index is in ${dataDir}/: this project is on a Windows drive, so WSL keeps its own index ` +
678
563
  `rather than share ${directory_1.DEFAULT_CODEGRAPH_DIR}/ with CodeGraph on Windows. Set CODEGRAPH_DIR to choose the name yourself.`);
679
564
  }
680
- // Indexing runs by default now. The legacy -i/--index flag is still
681
- // accepted (so existing muscle memory and scripts don't break) but is a
682
- // no-op — initializing always builds the initial index.
683
- // Supervise the index: self-terminate if orphaned or wedged (#999).
684
- // The DB + WAL paths let the liveness watchdog tell a slow store on
685
- // degraded storage from a true wedge (#1231).
686
- // A closure so we can re-run the exact same supervised, progress-rendered
687
- // index if the user opts gitignored child repos in below (#1156).
688
565
  const dbPath = getDatabasePath(projectPath);
689
566
  const runIndex = async () => {
690
567
  const supervision = (0, command_supervision_1.installCommandSupervision)('init', { progressPaths: [dbPath, `${dbPath}-wal`] });
@@ -705,11 +582,6 @@ function main() {
705
582
  const result = await runIndex();
706
583
  printIndexResult(clack, result, projectPath);
707
584
  await recordIndexTelemetry(cg, result);
708
- // An empty graph at a git super-repo usually means `.gitignore` excludes
709
- // the child repos that hold the code — surface them and offer to opt in
710
- // rather than leaving the user with a silent 0-node "Done". (#1156)
711
- // Under --yes the offer prints its one-line opt-in snippet instead of
712
- // prompting (same as a non-TTY run).
713
585
  if (result.nodesCreated === 0) {
714
586
  await offerIndexIgnoredRepos(clack, projectPath, runIndex, { interactive: !options.yes });
715
587
  }
@@ -717,7 +589,7 @@ function main() {
717
589
  const { offerWatchFallback } = await Promise.resolve().then(() => __importStar(require('../installer')));
718
590
  await offerWatchFallback(clack, projectPath, { yes: options.yes });
719
591
  }
720
- catch { /* non-fatal */ }
592
+ catch { }
721
593
  clack.outro('Done');
722
594
  cg.destroy();
723
595
  }
@@ -726,9 +598,6 @@ function main() {
726
598
  process.exit(1);
727
599
  }
728
600
  }
729
- /**
730
- * codegraph init [path]
731
- */
732
601
  program
733
602
  .command('init [path]')
734
603
  .description('Initialize CodeGraph in a project directory and build the initial index')
@@ -736,12 +605,10 @@ function main() {
736
605
  .option('-f, --force', 'Initialize even if the path looks like your home directory or a filesystem root')
737
606
  .option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
738
607
  .option('-y, --yes', 'Non-interactive: skip every prompt and take the defaults (for scripts / CI / container bootstraps)')
608
+ .option('--local-only', 'Keep .codegraph/ out of git entirely: its .gitignore ignores itself too. Also converts an initialized project')
739
609
  .action(async (pathArg, options) => {
740
610
  await runInit(path.resolve(pathArg || process.cwd()), options);
741
611
  });
742
- /**
743
- * codegraph uninit [path]
744
- */
745
612
  program
746
613
  .command('uninit [path]')
747
614
  .description('Remove CodeGraph from a project (deletes .codegraph/ directory)')
@@ -754,7 +621,6 @@ function main() {
754
621
  return;
755
622
  }
756
623
  if (!options.force) {
757
- // Confirm with user
758
624
  const readline = await Promise.resolve().then(() => __importStar(require('readline')));
759
625
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
760
626
  const answer = await new Promise((resolve) => {
@@ -769,7 +635,6 @@ function main() {
769
635
  const { default: CodeGraph } = await loadCodeGraph();
770
636
  const cg = CodeGraph.openSync(projectPath);
771
637
  cg.uninitialize();
772
- // Clean up any git sync hooks we installed (no-op if none / not a repo).
773
638
  try {
774
639
  const { removeGitSyncHook } = await Promise.resolve().then(() => __importStar(require('../sync/git-hooks')));
775
640
  const removed = removeGitSyncHook(projectPath);
@@ -777,24 +642,19 @@ function main() {
777
642
  info(`Removed git ${removed.installed.join(', ')} sync hook${removed.installed.length > 1 ? 's' : ''}`);
778
643
  }
779
644
  }
780
- catch { /* non-fatal */ }
645
+ catch { }
781
646
  success(`Removed CodeGraph from ${projectPath}`);
782
- // Churn signal — and flush now, since after an uninit there may be no
783
- // "next run" to deliver it.
784
647
  try {
785
648
  (0, telemetry_1.getTelemetry)().recordLifecycle('uninstall', {});
786
649
  await (0, telemetry_1.getTelemetry)().flushNow();
787
650
  }
788
- catch { /* non-fatal */ }
651
+ catch { }
789
652
  }
790
653
  catch (err) {
791
654
  error(`Failed to uninitialize: ${err instanceof Error ? err.message : String(err)}`);
792
655
  process.exit(1);
793
656
  }
794
657
  });
795
- /**
796
- * codegraph index [path]
797
- */
798
658
  program
799
659
  .command('index [path]')
800
660
  .description('Rebuild the full index from scratch (same result as a fresh init)')
@@ -802,16 +662,8 @@ function main() {
802
662
  .option('-q, --quiet', 'Suppress progress output')
803
663
  .option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
804
664
  .action(async (pathArg, options) => {
805
- // An EXPLICIT path names the project to rebuild — it is never a hint to go
806
- // looking for one. resolveProjectPath walks up to the nearest initialized
807
- // ancestor, which is right for `codegraph query` run from a subdirectory,
808
- // but for a full re-index it silently rebuilt the parent's graph under a
809
- // normal "Done" when <path> had no index of its own (#1524). Only a bare
810
- // `codegraph index` (cwd) may resolve upward.
811
665
  const projectPath = pathArg ? path.resolve(pathArg) : resolveProjectPath();
812
666
  try {
813
- // Don't (re)index your home directory / a filesystem root (#845). --force
814
- // doubles as the override.
815
667
  const unsafe = (0, directory_1.unsafeIndexRootReason)(projectPath);
816
668
  if (unsafe && !options.force) {
817
669
  error(`Refusing to index ${projectPath} — it looks like ${unsafe}. Pass --force to override.`);
@@ -833,39 +685,22 @@ function main() {
833
685
  if (rebuild.kind === 'taken')
834
686
  throw new Error('Another index rebuild is already in progress.');
835
687
  try {
836
- // A live MCP daemon keeps SQLite handles open. Verify it by its socket
837
- // before stopping it so a stale pidfile can never signal another process.
838
- const { stopDaemonAt } = await Promise.resolve().then(() => __importStar(require('../mcp/daemon-registry')));
839
- const daemonStop = await stopDaemonAt(fs.realpathSync(projectPath), { preserveUnverified: true });
688
+ const { stopDaemonAt, daemonStopFailureMessage } = await Promise.resolve().then(() => __importStar(require('../mcp/daemon-registry')));
689
+ const realRoot = fs.realpathSync(projectPath);
690
+ const daemonStop = await stopDaemonAt(realRoot, { preserveUnverified: true });
840
691
  if (daemonStop.outcome === 'unverified' || daemonStop.outcome === 'still-running') {
841
- throw new Error('Could not verify that the active CodeGraph daemon has stopped. Run `codegraph daemon stop` to stop it, then retry `codegraph index`.');
692
+ throw new Error(await daemonStopFailureMessage(realRoot, daemonStop));
842
693
  }
843
- // Keep the writer slot through recreation AND indexing. A reconnecting
844
- // proxy/daemon must not open the replacement database halfway through.
845
694
  const writer = tryAcquireWriterLock(projectPath, 'rebuild');
846
695
  if (writer.kind === 'taken')
847
696
  throw new Error(writerLockHeldMessage(writer.existing, writer.pidPath));
848
697
  try {
849
698
  const { default: CodeGraph, getDatabasePath } = await loadCodeGraph();
850
- // `index` is a FULL re-index — identical to a fresh `init`. RECREATE the
851
- // database from scratch (discard .codegraph/codegraph.db + its WAL) rather
852
- // than opening the old graph and DELETE-ing every row. The clear-then-index
853
- // approach reported "0 nodes" without the clear (#874); the recreate keeps
854
- // that fixed AND avoids the failure mode where, on a large or pre-fix
855
- // poisoned index, the per-row FTS delete churn wedged the main thread long
856
- // enough to trip the liveness watchdog before scanning even began (#1067).
857
- // recreate() hands back a fresh, empty instance — no clear() needed. For
858
- // fast incremental updates use `sync`.
859
699
  const cg = await CodeGraph.recreate(projectPath);
860
- // Supervise the indexer: self-terminate if orphaned (parent shim killed)
861
- // or if the main thread wedges — neither was guarded on this path (#999).
862
- // The DB + WAL paths let the liveness watchdog tell a slow store on
863
- // degraded storage from a true wedge (#1231).
864
700
  const dbPath = getDatabasePath(projectPath);
865
701
  const supervision = (0, command_supervision_1.installCommandSupervision)('index', { progressPaths: [dbPath, `${dbPath}-wal`] });
866
702
  try {
867
703
  if (options.quiet) {
868
- // Quiet mode: no UI, just run against the freshly-recreated graph.
869
704
  const result = await cg.indexAll();
870
705
  if (!result.success)
871
706
  process.exit(1);
@@ -873,8 +708,6 @@ function main() {
873
708
  }
874
709
  const clack = await importESM('@clack/prompts');
875
710
  clack.intro('Indexing project');
876
- // A closure so a re-index (after opting gitignored child repos in, #1156)
877
- // renders identically. Supervision already wraps the whole command.
878
711
  const renderIndex = async () => {
879
712
  if (options.verbose) {
880
713
  return await cg.indexAll({ onProgress: createVerboseProgress(), verbose: true });
@@ -888,8 +721,6 @@ function main() {
888
721
  const result = await renderIndex();
889
722
  printIndexResult(clack, result, projectPath);
890
723
  await recordIndexTelemetry(cg, result);
891
- // Empty graph at a git super-repo → likely `.gitignore`d child repos;
892
- // name them and offer to opt in instead of a silent 0-node result (#1156).
893
724
  let finalResult = result;
894
725
  if (result.nodesCreated === 0) {
895
726
  finalResult = (await offerIndexIgnoredRepos(clack, projectPath, renderIndex, { interactive: true })) ?? result;
@@ -917,9 +748,6 @@ function main() {
917
748
  process.exit(1);
918
749
  }
919
750
  });
920
- /**
921
- * codegraph sync [path]
922
- */
923
751
  program
924
752
  .command('sync [path]')
925
753
  .description('Sync changes since last index')
@@ -948,8 +776,9 @@ function main() {
948
776
  onProgress: progress.onProgress,
949
777
  }).finally(() => progress.stop());
950
778
  const totalChanges = result.filesAdded + result.filesModified + result.filesRemoved;
779
+ const staleIndex = cg.isIndexStale();
951
780
  if (totalChanges === 0 && !result.pendingRefsProcessed) {
952
- clack.log.info('Already up to date');
781
+ clack.log.info(staleIndex ? 'No files changed' : 'Already up to date');
953
782
  }
954
783
  else if (totalChanges > 0) {
955
784
  clack.log.success(`Synced ${formatNumber(totalChanges)} changed files`);
@@ -967,6 +796,9 @@ function main() {
967
796
  ? ` (${formatNumber(result.pendingRefsUnresolved)} unresolved)` : '';
968
797
  clack.log.info(`Resolved ${formatNumber(result.pendingRefsResolved ?? 0)} pending references${unresolved}`);
969
798
  }
799
+ if (staleIndex) {
800
+ clack.log.warn('This index was built by an older CodeGraph engine, and sync only re-reads changed files. Run "codegraph index" for a full rebuild.');
801
+ }
970
802
  clack.outro('Done');
971
803
  }
972
804
  finally {
@@ -980,22 +812,37 @@ function main() {
980
812
  process.exit(1);
981
813
  }
982
814
  });
983
- /**
984
- * codegraph status [path]
985
- */
815
+ function samplePaths(paths) {
816
+ return paths.slice(0, 3).join(', ') + (paths.length > 3 ? ` (+${formatNumber(paths.length - 3)} more)` : '');
817
+ }
818
+ function describeFilesMissingSymbols(health) {
819
+ const dash = (0, glyphs_1.getGlyphs)().dash;
820
+ const lines = [];
821
+ const reindex = health.needsReindex.length;
822
+ if (reindex > 0) {
823
+ lines.push(`${formatNumber(reindex)} ${reindex === 1 ? 'file is missing its' : 'files are missing their'} symbols ${dash} ` +
824
+ `run "codegraph sync" to re-index ${reindex === 1 ? 'it' : 'them'}: ${samplePaths(health.needsReindex)}`);
825
+ }
826
+ const unparsed = health.parseErrors.length;
827
+ if (unparsed > 0) {
828
+ lines.push(`${formatNumber(unparsed)} ${unparsed === 1 ? 'file could not be parsed, so its symbols are' : 'files could not be parsed, so their symbols are'} ` +
829
+ `missing: ${samplePaths(health.parseErrors)} ${dash} "codegraph files --json" shows the errors`);
830
+ }
831
+ return lines;
832
+ }
986
833
  program
987
834
  .command('status [path]')
988
835
  .description('Show index status and statistics')
989
836
  .option('-j, --json', 'Output as JSON')
837
+ .option('--strict', 'Exit 1 unless the index is finished, up to date, and every language that should yield symbols did')
990
838
  .action(async (pathArg, options) => {
991
839
  const projectPath = resolveProjectPath(pathArg);
992
- // The directory the user actually ran from, before walking up to the index
993
- // root. Used to detect when the resolved index lives in a different git
994
- // working tree (e.g. a nested worktree borrowing the main checkout's index).
995
840
  const startPath = path.resolve(pathArg || process.cwd());
996
841
  const worktreeMismatch = (0, worktree_1.detectWorktreeIndexMismatch)(startPath, projectPath);
997
842
  try {
998
843
  if (!(0, directory_1.isInitialized)(projectPath)) {
844
+ if (options.strict)
845
+ process.exitCode = 1;
999
846
  if (options.json) {
1000
847
  console.log(JSON.stringify({
1001
848
  initialized: false,
@@ -1013,18 +860,28 @@ function main() {
1013
860
  return;
1014
861
  }
1015
862
  const { default: CodeGraph } = await loadCodeGraph();
1016
- const cg = await CodeGraph.open(projectPath);
863
+ const cg = await CodeGraph.open(projectPath, { readOnly: true });
864
+ const { isRebuildInProgress } = await Promise.resolve().then(() => __importStar(require('../mcp/writer-lock')));
865
+ const rebuildInProgress = isRebuildInProgress(projectPath);
1017
866
  const stats = cg.getStats();
1018
867
  const changes = cg.getChangedFiles();
1019
868
  const backend = cg.getBackend();
1020
869
  const journalMode = cg.getJournalMode();
1021
870
  const buildInfo = cg.getIndexBuildInfo();
1022
871
  const reindexRecommended = cg.isIndexStale();
872
+ const frameworkChanges = cg.getFrameworkChangesSinceIndex();
1023
873
  const indexState = cg.getIndexState();
1024
- // Zero on a healthy index; non-zero at rest means a resolution pass was
1025
- // interrupted, so some files' call edges are missing (#1187).
1026
874
  const pendingRefs = cg.getPendingReferenceCount();
1027
- // JSON output mode
875
+ const health = cg.getIndexHealth();
876
+ const coverage = cg.getLanguageCoverage();
877
+ const totalChanges = changes.added.length + changes.modified.length + changes.removed.length;
878
+ if (options.strict && (rebuildInProgress ||
879
+ indexState === 'indexing' || indexState === 'partial' || indexState === 'failed' ||
880
+ totalChanges > 0 ||
881
+ health.needsReindex.length > 0 ||
882
+ coverage.unparsedLanguages.length > 0)) {
883
+ process.exitCode = 1;
884
+ }
1028
885
  if (options.json) {
1029
886
  const lastIndexedMs = cg.getLastIndexedAt();
1030
887
  console.log(JSON.stringify({
@@ -1042,6 +899,9 @@ function main() {
1042
899
  journalMode,
1043
900
  nodesByKind: stats.nodesByKind,
1044
901
  languages: Object.entries(stats.filesByLanguage).filter(([, count]) => count > 0).map(([lang]) => lang),
902
+ filesByLanguage: stats.filesByLanguage,
903
+ parsedFilesByLanguage: coverage.parsedFilesByLanguage,
904
+ unparsedLanguages: coverage.unparsedLanguages,
1045
905
  pendingChanges: {
1046
906
  added: changes.added.length,
1047
907
  modified: changes.modified.length,
@@ -1050,76 +910,59 @@ function main() {
1050
910
  worktreeMismatch: worktreeMismatch
1051
911
  ? { worktreeRoot: worktreeMismatch.worktreeRoot, indexRoot: worktreeMismatch.indexRoot }
1052
912
  : null,
913
+ rebuildInProgress,
1053
914
  index: {
1054
915
  builtWithVersion: buildInfo.version,
1055
916
  builtWithExtractionVersion: buildInfo.extractionVersion,
1056
917
  currentExtractionVersion: extraction_version_1.EXTRACTION_VERSION,
1057
- reindexRecommended,
1058
- // 'complete' | 'partial' (files silently dropped) | 'indexing'
1059
- // (a run was killed mid-index — the index is truncated) |
1060
- // 'failed' | null (predates the marker).
918
+ reindexRecommended: reindexRecommended || frameworkChanges !== null,
919
+ frameworksChangedSinceIndex: frameworkChanges,
1061
920
  state: indexState,
1062
- // References awaiting resolution. Non-zero at rest means an
1063
- // interrupted resolution pass left edges missing; the next
1064
- // sync sweeps them (#1187).
1065
921
  pendingRefs,
922
+ filesNeedingReindex: health.needsReindex.length,
923
+ filesWithParseErrors: health.parseErrors.length,
1066
924
  },
1067
925
  }));
1068
926
  cg.destroy();
1069
927
  return;
1070
928
  }
1071
929
  console.log(chalk.bold('\nCodeGraph Status\n'));
1072
- // Project info
1073
930
  console.log(chalk.cyan('Project:'), projectPath);
1074
931
  if (worktreeMismatch) {
1075
932
  warn((0, worktree_1.worktreeMismatchWarning)(worktreeMismatch));
1076
933
  }
1077
- if (indexState === 'indexing') {
1078
- warn('The last index run never finished (killed mid-index?) — the index is truncated. Re-run "codegraph index".');
934
+ const unfinished = unfinishedIndexWarning(indexState, rebuildInProgress);
935
+ if (rebuildInProgress) {
936
+ warn('An index rebuild ("codegraph index") is running in another process — the statistics below are a snapshot of it.');
1079
937
  }
1080
- else if (indexState === 'partial') {
1081
- warn('The last index run silently dropped files — the index is partial. Re-run "codegraph index".');
938
+ else if (unfinished) {
939
+ warn(unfinished);
1082
940
  }
1083
- else if (indexState === 'failed') {
1084
- warn('The last index run failed — results may be incomplete. Re-run "codegraph index".');
1085
- }
1086
- if (pendingRefs > 0) {
941
+ if (pendingRefs > 0 && !rebuildInProgress) {
1087
942
  warn(`${formatNumber(pendingRefs)} references from an interrupted run are awaiting resolution — some callers/impact edges are missing. Run "codegraph sync" to resolve them.`);
1088
943
  }
1089
944
  console.log();
1090
- // Index stats
1091
945
  console.log(chalk.bold('Index Statistics:'));
1092
946
  console.log(` Files: ${formatNumber(stats.fileCount)}`);
1093
947
  console.log(` Nodes: ${formatNumber(stats.nodeCount)}`);
1094
948
  console.log(` Edges: ${formatNumber(stats.edgeCount)}`);
1095
949
  console.log(` DB Size: ${(stats.dbSizeBytes / 1024 / 1024).toFixed(2)} MB`);
1096
- // Surface the WAL sidecar (#1431): a WAL that dwarfs the DB at rest is
1097
- // the killed-session leak — invisible before this line, it only showed
1098
- // up as a mysteriously full disk. open() above already kicked off the
1099
- // automatic heal for the oversized case.
1100
950
  if (stats.walSizeBytes > 0) {
1101
951
  const { WAL_HEAL_THRESHOLD_BYTES } = await Promise.resolve().then(() => __importStar(require('../db/index')));
1102
952
  const oversized = stats.walSizeBytes > Math.max(WAL_HEAL_THRESHOLD_BYTES, stats.dbSizeBytes);
1103
953
  const walLabel = `${(stats.walSizeBytes / 1024 / 1024).toFixed(2)} MB`;
1104
954
  console.log(` WAL Size: ${oversized ? chalk.yellow(walLabel) : walLabel}`);
1105
- if (oversized) {
1106
- 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.');
955
+ if (oversized && !rebuildInProgress) {
956
+ warn('The write-ahead log is larger than the database — killed sessions left it behind. The next "codegraph sync" reclaims it; if it persists after that, another live CodeGraph process is holding it.');
1107
957
  }
1108
958
  }
1109
- // Surface the active SQLite backend (node:sqlite — Node's built-in real
1110
- // SQLite, full WAL + FTS5, no native build).
1111
959
  const backendLabel = chalk.green(`node:sqlite ${(0, glyphs_1.getGlyphs)().dash} built-in (full WAL)`);
1112
960
  console.log(` Backend: ${backendLabel}`);
1113
- // Effective journal mode: 'wal' means concurrent reads never block on a
1114
- // writer; anything else means they can ("database is locked"). node:sqlite
1115
- // supports WAL everywhere, so a non-wal mode means the filesystem can't
1116
- // (network mounts, WSL2 /mnt). See issue #238.
1117
961
  const journalLabel = journalMode === 'wal'
1118
962
  ? chalk.green('wal')
1119
963
  : chalk.yellow(`${journalMode || 'unknown'} ${(0, glyphs_1.getGlyphs)().dash} WAL inactive; reads can block on writes`);
1120
964
  console.log(` Journal: ${journalLabel}`);
1121
965
  console.log();
1122
- // Node breakdown
1123
966
  console.log(chalk.bold('Nodes by Kind:'));
1124
967
  const nodesByKind = Object.entries(stats.nodesByKind)
1125
968
  .filter(([, count]) => count > 0)
@@ -1128,17 +971,28 @@ function main() {
1128
971
  console.log(` ${kind.padEnd(15)} ${formatNumber(count)}`);
1129
972
  }
1130
973
  console.log();
1131
- // Language breakdown
1132
974
  console.log(chalk.bold('Files by Language:'));
1133
975
  const filesByLang = Object.entries(stats.filesByLanguage)
1134
976
  .filter(([, count]) => count > 0)
1135
977
  .sort((a, b) => b[1] - a[1]);
1136
978
  for (const [lang, count] of filesByLang) {
1137
- console.log(` ${lang.padEnd(15)} ${formatNumber(count)}`);
979
+ const parsed = coverage.parsedFilesByLanguage[lang];
980
+ const withSymbols = parsed === undefined || parsed === count ? '' : ` (${formatNumber(parsed)} with symbols)`;
981
+ console.log(` ${lang.padEnd(15)} ${formatNumber(count)}${chalk.dim(withSymbols)}`);
1138
982
  }
1139
983
  console.log();
1140
- // Pending changes
1141
- const totalChanges = changes.added.length + changes.modified.length + changes.removed.length;
984
+ if (rebuildInProgress) {
985
+ cg.destroy();
986
+ return;
987
+ }
988
+ if (coverage.unparsedLanguages.length > 0) {
989
+ const files = cg.getFiles();
990
+ for (const language of coverage.unparsedLanguages) {
991
+ const paths = files.filter((file) => file.language === language).map((file) => file.path);
992
+ warn(`No symbols came from any ${language} file ${(0, glyphs_1.getGlyphs)().dash} fine if they hold no code, otherwise its parser isn't working: ${samplePaths(paths)}`);
993
+ }
994
+ console.log();
995
+ }
1142
996
  if (totalChanges > 0) {
1143
997
  console.log(chalk.bold('Pending Changes:'));
1144
998
  if (changes.added.length > 0) {
@@ -1152,16 +1006,26 @@ function main() {
1152
1006
  }
1153
1007
  info('Run "codegraph sync" to update the index');
1154
1008
  }
1155
- else {
1009
+ const missingSymbols = describeFilesMissingSymbols(health);
1010
+ for (const line of missingSymbols)
1011
+ warn(line);
1012
+ if (totalChanges === 0 && missingSymbols.length === 0) {
1156
1013
  success('Index is up to date');
1157
1014
  }
1158
1015
  console.log();
1159
- // Re-index hint: the index was built by an older engine than the one now
1160
- // running, so a rebuild would add data a migration can't backfill.
1161
1016
  if (reindexRecommended) {
1162
1017
  const builtWith = buildInfo.version ? `v${buildInfo.version.replace(/^v/, '')}` : 'an earlier version';
1163
1018
  warn(`Index was built by ${builtWith}; re-index to pick up this engine's improvements.`);
1164
- info('Run "codegraph index" (full rebuild) or "codegraph sync"');
1019
+ info('Run "codegraph index" for a full rebuild');
1020
+ console.log();
1021
+ }
1022
+ if (frameworkChanges) {
1023
+ const changed = [
1024
+ ...(frameworkChanges.added.length > 0 ? [`added ${frameworkChanges.added.join(', ')}`] : []),
1025
+ ...(frameworkChanges.removed.length > 0 ? [`removed ${frameworkChanges.removed.join(', ')}`] : []),
1026
+ ].join('; ');
1027
+ warn(`Frameworks changed since the last full index (${changed}); files indexed before then were read without the change.`);
1028
+ info('Run "codegraph index" to re-index every file with them');
1165
1029
  console.log();
1166
1030
  }
1167
1031
  cg.destroy();
@@ -1171,9 +1035,6 @@ function main() {
1171
1035
  process.exit(1);
1172
1036
  }
1173
1037
  });
1174
- /**
1175
- * codegraph query <search>
1176
- */
1177
1038
  program
1178
1039
  .command('query <search>')
1179
1040
  .description('Search for symbols in the codebase')
@@ -1188,18 +1049,12 @@ function main() {
1188
1049
  error(`CodeGraph not initialized in ${projectPath}`);
1189
1050
  process.exit(1);
1190
1051
  }
1191
- const { default: CodeGraph } = await loadCodeGraph();
1192
- const cg = await CodeGraph.open(projectPath);
1052
+ const cg = await openIndexToRead(projectPath);
1193
1053
  const limit = parseInt(options.limit || '10', 10);
1194
1054
  const rawResults = cg.searchNodes(search, {
1195
- // Fetch one extra row so the CLI can report a cut without changing the
1196
- // long-standing bare-array contract of `query --json` (#1639).
1197
1055
  limit: limit + 1,
1198
1056
  kinds: options.kind ? [options.kind] : undefined,
1199
1057
  });
1200
- // Mirror the MCP search down-rank so the CLI also surfaces the
1201
- // hand-written implementation before protobuf/gRPC scaffolding
1202
- // when both share a name. See extraction/generated-detection.ts.
1203
1058
  const isGen = cg.generatedFilePredicate(rawResults.map((r) => r.node.filePath));
1204
1059
  const rankedResults = [...rawResults].sort((a, b) => {
1205
1060
  const aGen = isGen(a.node.filePath) ? 1 : 0;
@@ -1220,11 +1075,6 @@ function main() {
1220
1075
  }
1221
1076
  else {
1222
1077
  console.log(chalk.bold(`\nSearch Results for "${search}":\n`));
1223
- // Results arrive already ranked by relevance, so the order conveys
1224
- // it. We don't print the raw score: it's an unbounded BM25/FTS value
1225
- // (relative-ranking only), and the old `(score * 100)%` rendered it
1226
- // as nonsensical percentages like "12042%" (#1045). The MCP search
1227
- // tool likewise shows no score. Raw `score` stays in --json output.
1228
1078
  for (const result of results) {
1229
1079
  const node = result.node;
1230
1080
  const location = `${node.filePath}:${node.startLine}`;
@@ -1247,15 +1097,6 @@ function main() {
1247
1097
  process.exit(1);
1248
1098
  }
1249
1099
  });
1250
- /**
1251
- * codegraph explore <query...>
1252
- *
1253
- * The CLI face of the MCP codegraph_explore tool — same handler, same
1254
- * output (source of the relevant symbols grouped by file + the call path
1255
- * among them). Exists so agents WITHOUT the MCP tools — Task-tool
1256
- * subagents (which don't inherit MCP tools, #704) and non-MCP harnesses —
1257
- * can reach the graph through a plain shell command.
1258
- */
1259
1100
  program
1260
1101
  .command('explore <query...>')
1261
1102
  .description('Explore an area: relevant symbols\' source + call paths in one shot (same output as the codegraph_explore MCP tool)')
@@ -1268,8 +1109,7 @@ function main() {
1268
1109
  error(`CodeGraph isn't available here — no .codegraph/ index exists in ${projectPath}. If you are an AI agent: continue with your usual tools; indexing is the user's decision, do not run it yourself. (The project owner can enable CodeGraph with 'codegraph init'.)`);
1269
1110
  process.exit(1);
1270
1111
  }
1271
- const { default: CodeGraph } = await loadCodeGraph();
1272
- const cg = await CodeGraph.open(projectPath);
1112
+ const cg = await openIndexToRead(projectPath);
1273
1113
  const { ToolHandler } = await Promise.resolve().then(() => __importStar(require('../mcp/tools')));
1274
1114
  const handler = new ToolHandler(cg);
1275
1115
  const args = { query: queryParts.join(' ') };
@@ -1286,15 +1126,6 @@ function main() {
1286
1126
  process.exit(1);
1287
1127
  }
1288
1128
  });
1289
- /**
1290
- * codegraph context <task...>
1291
- *
1292
- * The CLI face of the public `buildContext` API (ContextBuilder): FTS entry
1293
- * points + graph expansion + code blocks, formatted as markdown or JSON.
1294
- * Advertised in the usage header since the first release but never actually
1295
- * registered (#1611); external integrations (e.g. Memorix) invoke it as
1296
- * `codegraph context --path <root> --format json --max-nodes 8 --no-code <task>`.
1297
- */
1298
1129
  program
1299
1130
  .command('context <task...>')
1300
1131
  .description('Build context for a task: relevant symbols, relationships, and code blocks')
@@ -1322,16 +1153,12 @@ function main() {
1322
1153
  error(`CodeGraph not initialized in ${projectPath}`);
1323
1154
  process.exit(1);
1324
1155
  }
1325
- const { default: CodeGraph } = await loadCodeGraph();
1326
- const cg = await CodeGraph.open(projectPath);
1156
+ const cg = await openIndexToRead(projectPath);
1327
1157
  const result = await cg.buildContext(taskParts.join(' '), {
1328
1158
  format,
1329
1159
  includeCode: options.code !== false,
1330
1160
  ...(maxNodes !== undefined ? { maxNodes } : {}),
1331
1161
  });
1332
- // Both supported formats return a formatted string; print it verbatim so
1333
- // `--format json` stays machine-parseable on stdout (error()/warnings go
1334
- // to stderr only).
1335
1162
  console.log(typeof result === 'string' ? result : JSON.stringify(result, null, 2));
1336
1163
  cg.destroy();
1337
1164
  }
@@ -1340,31 +1167,15 @@ function main() {
1340
1167
  process.exit(1);
1341
1168
  }
1342
1169
  });
1343
- /**
1344
- * codegraph prompt-hook (hidden)
1345
- *
1346
- * A Claude Code `UserPromptSubmit` hook entry point. Reads `{prompt, cwd}` JSON
1347
- * on stdin; for a structural/flow/impact prompt it runs `codegraph_explore` on
1348
- * the indexed project and prints the result to stdout, which Claude injects into
1349
- * the agent's context — so the agent's reflex grep/read has nothing left to find
1350
- * and reliably uses CodeGraph (the adoption problem). Installed by the installer
1351
- * into Claude's settings.json (opt-in, default-yes).
1352
- *
1353
- * LOAD-BEARING: this must NEVER break the user's prompt. Every failure path —
1354
- * kill-switch, non-structural prompt, no index, engine error — exits 0 with no
1355
- * output. The only effect is additive context when it can confidently provide it.
1356
- */
1357
1170
  program
1358
1171
  .command('prompt-hook', { hidden: true })
1359
1172
  .description('Claude UserPromptSubmit hook: inject CodeGraph context for structural prompts (reads {prompt,cwd} JSON on stdin)')
1360
1173
  .action(async () => {
1361
1174
  try {
1362
- // Kill-switch: lets a user disable the nudge without uninstalling /
1363
- // editing settings.json (CI, low-power machines, personal preference).
1364
1175
  if (process.env.CODEGRAPH_NO_PROMPT_HOOK === '1' || process.env.CODEGRAPH_PROMPT_HOOK === '0')
1365
1176
  return;
1366
1177
  if (process.stdin.isTTY)
1367
- return; // invoked by hand, no piped payload
1178
+ return;
1368
1179
  const raw = await new Promise((resolve) => {
1369
1180
  let data = '';
1370
1181
  process.stdin.setEncoding('utf8');
@@ -1379,34 +1190,15 @@ function main() {
1379
1190
  catch {
1380
1191
  return;
1381
1192
  }
1382
- const prompt = String(input.prompt || '');
1383
- // System-injected task notifications and subagent hand-backs are not
1384
- // user prompts: exit before any project lookup or explore work (#1832,
1385
- // #2184).
1386
- if ((0, directory_1.isTaskNotification)(prompt) || (0, directory_1.isAgentMessage)(prompt))
1193
+ const prompt = (0, directory_1.stripSystemReminders)(String(input.prompt || ''));
1194
+ if (!prompt || (0, directory_1.isTaskNotification)(prompt) || (0, directory_1.isAgentMessage)(prompt) || (0, directory_1.isCrossSessionMessage)(prompt))
1387
1195
  return;
1388
- // Gate telemetry: how often each tier fires vs. no-ops — counter names
1389
- // only, NEVER prompt content (see TELEMETRY.md). This is the data that
1390
- // turns "is the gate any good" from vibes into a measured recall rate.
1391
1196
  const gate = (outcome) => {
1392
1197
  try {
1393
1198
  (0, telemetry_1.getTelemetry)().recordUsage('cli_command', `prompt-hook-gate-${outcome}`, true);
1394
1199
  }
1395
- catch { /* never break the hook */ }
1200
+ catch { }
1396
1201
  };
1397
- // Gate, tiered by confidence (#994, #1126):
1398
- // HIGH — a structural keyword (any covered language), or a code-shaped
1399
- // token verified in the index → full explore injection.
1400
- // MEDIUM — no keyword/token, but prose words match indexed symbol-name
1401
- // SEGMENTS ("state machine" → OrderStateMachine, in any
1402
- // language): inject a short list of the matching symbols and
1403
- // let the AGENT write the explore query — the graph-derived
1404
- // tier, no vocabulary involved.
1405
- // silent — nothing verified. Every other prompt ("fix this typo")
1406
- // stays a zero-cost no-op.
1407
- // Keywords fire on their own; a token or prose word is only a CANDIDATE
1408
- // verified against the graph below, so a tech brand ("JavaScript") that
1409
- // merely looks like code doesn't inject spurious context.
1410
1202
  const keyworded = (0, directory_1.hasStructuralKeyword)(prompt);
1411
1203
  const codeTokens = keyworded ? [] : (0, directory_1.extractCodeTokens)(prompt);
1412
1204
  const proseWords = keyworded ? [] : (0, identifier_segments_1.extractProseCandidates)(prompt);
@@ -1414,47 +1206,37 @@ function main() {
1414
1206
  gate('noop-shape');
1415
1207
  return;
1416
1208
  }
1417
- // Decide what to inject, shaped by WHERE the index(es) are: the nearest
1418
- // indexed ancestor of cwd, or — when cwd is an un-indexed workspace root
1419
- // whose indexed project(s) live in sub-dirs (the monorepo case, #964) —
1420
- // the sub-project the prompt points at, plus a `projectPath` nudge for any
1421
- // others. Without the down-scan the hook injected nothing at a monorepo
1422
- // root (it only walked up), so the validated adoption lever never fired
1423
- // exactly where the agent most needs it.
1424
1209
  const plan = (0, directory_1.planFrontload)(String(input.cwd || process.cwd()), prompt);
1425
1210
  if (!plan.exploreRoot && plan.nudgeProjects.length === 0) {
1426
1211
  gate('noop-no-index');
1427
1212
  return;
1428
- } // nothing reachable — the agent's normal tools apply
1429
- // A "pass projectPath" line for indexed sub-projects we did NOT front-load.
1430
- // Follow-up codegraph_explore calls against a sub-project (cwd isn't its
1431
- // index root) need an explicit projectPath, so spell it out.
1213
+ }
1432
1214
  const nudge = (projects, lead) => `${lead}\n${projects.map((p) => ` - projectPath: "${p}"`).join('\n')}\n`;
1433
1215
  if (plan.exploreRoot) {
1434
- const { default: CodeGraph } = await loadCodeGraph();
1435
- const cg = await CodeGraph.open(plan.exploreRoot);
1216
+ const { isRebuildInProgress } = await Promise.resolve().then(() => __importStar(require('../mcp/writer-lock')));
1217
+ if (isRebuildInProgress(plan.exploreRoot)) {
1218
+ gate('noop-rebuild');
1219
+ return;
1220
+ }
1221
+ const cg = await openIndexToRead(plan.exploreRoot);
1436
1222
  try {
1437
1223
  const others = plan.nudgeProjects.length
1438
1224
  ? `\n${nudge(plan.nudgeProjects, 'Other indexed projects in this workspace — pass projectPath to query them:')}`
1439
1225
  : '';
1440
- // Tier decision against THIS index (issue #994 follow-up: candidates
1441
- // must be real here — a brand name or prose about another domain
1442
- // must not inject). Keyword-bearing prompts skip verification — the
1443
- // keyword is signal enough.
1444
1226
  const tokenVerified = !keyworded && codeTokens.some((t) => cg.getNodesByName(t).length > 0);
1445
1227
  if (keyworded || tokenVerified) {
1446
- const { ToolHandler } = await Promise.resolve().then(() => __importStar(require('../mcp/tools')));
1447
- const handler = new ToolHandler(cg);
1448
- const result = await handler.execute('codegraph_explore', { query: prompt });
1449
- const text = result.content[0]?.text ?? '';
1450
- if (!result.isError && text.trim()) {
1451
- // Cap the injection so a large-repo explore can't flood the prompt.
1452
- // Claude Code shows hook stdout inline only up to 10,000 characters;
1453
- // above that it persists the output to a file and the model sees a
1454
- // 2 KB preview (#1694). PROMPT_HOOK_INJECTION_MAX (9,000) leaves
1455
- // room for the wrapper and the projectPath nudge lines below.
1228
+ const exploreHere = async () => {
1229
+ const { ToolHandler } = await Promise.resolve().then(() => __importStar(require('../mcp/tools')));
1230
+ const result = await new ToolHandler(cg).execute('codegraph_explore', { query: prompt });
1231
+ return result.isError ? '' : result.content[0]?.text ?? '';
1232
+ };
1233
+ const { exploreViaDaemon, promptHookDaemonTimeoutMs } = await Promise.resolve().then(() => __importStar(require('../mcp/hook-client')));
1234
+ const viaDaemon = await exploreViaDaemon(plan.exploreRoot, prompt, promptHookDaemonTimeoutMs());
1235
+ const text = viaDaemon.status === 'answered' ? viaDaemon.text
1236
+ : viaDaemon.status === 'unavailable' ? await exploreHere()
1237
+ : '';
1238
+ if (text.trim()) {
1456
1239
  const body = (0, directory_1.capPromptHookInjection)(text);
1457
- // For a front-loaded SUB-project, a follow-up explore needs its path.
1458
1240
  const more = plan.viaSubScan
1459
1241
  ? `call codegraph_explore with projectPath: "${plan.exploreRoot}" for more`
1460
1242
  : 'call codegraph_explore for more';
@@ -1462,26 +1244,10 @@ function main() {
1462
1244
  gate(keyworded ? 'high-keyword' : 'high-token');
1463
1245
  }
1464
1246
  else {
1465
- // A high-* outcome must mean context was actually delivered —
1466
- // the funnel's noop-vs-high split is how gate recall is
1467
- // measured (#1143). An explore error or empty result is a
1468
- // delivery failure, not a gate success.
1469
1247
  gate(keyworded ? 'noop-explore-keyword' : 'noop-explore-token');
1470
1248
  }
1471
1249
  return;
1472
1250
  }
1473
- // MEDIUM: prose words → symbol-name segments, co-occurrence/rarity
1474
- // scored, each hit re-verified to exist (see getSegmentMatches). The
1475
- // payload names the symbols but does NOT run explore — the agent owns
1476
- // the query where the hook's confidence is only "these are related".
1477
- //
1478
- // A database indexed before the vocab table existed starts with it
1479
- // EMPTY, and only sync() backfills it — which this hook never runs
1480
- // (#1142). Heal it here: on a populated vocab this is one SELECT;
1481
- // the actual backfill is a one-time batched pass whose cost the MCP
1482
- // server's own catch-up sync usually pays first (it runs at every
1483
- // session start). A distinct noop outcome keeps a dormant vocab
1484
- // from polluting the noop-unverified recall signal.
1485
1251
  const vocabReady = await cg.healSegmentVocabIfEmpty().catch(() => false);
1486
1252
  if (!vocabReady) {
1487
1253
  gate('noop-vocab-empty');
@@ -1509,8 +1275,6 @@ function main() {
1509
1275
  }
1510
1276
  }
1511
1277
  else {
1512
- // Several indexed sub-projects, none a clear match — don't guess; tell
1513
- // the agent they exist and how to query one.
1514
1278
  process.stdout.write(`<codegraph_context note="CodeGraph is available for this workspace's indexed sub-projects — query one by passing projectPath to codegraph_explore.">\n` +
1515
1279
  nudge(plan.nudgeProjects, "This workspace's CodeGraph indexes live in sub-projects. To use CodeGraph, call codegraph_explore with the projectPath of the relevant one:") +
1516
1280
  `</codegraph_context>\n`);
@@ -1518,19 +1282,8 @@ function main() {
1518
1282
  }
1519
1283
  }
1520
1284
  catch {
1521
- // Degradable by contract: never surface an error to the prompt pipeline.
1522
1285
  }
1523
1286
  });
1524
- /**
1525
- * codegraph node [name]
1526
- *
1527
- * The CLI face of the MCP codegraph_node tool: one symbol's source +
1528
- * caller/callee trail, or a whole file with line numbers + dependents
1529
- * (Read-parity). Same subagent/non-MCP rationale as `explore`.
1530
- *
1531
- * `name` is OPTIONAL because `--file` (file-read mode) carries no symbol —
1532
- * a required `<name>` made `codegraph node -f <file>` unreachable (#1044).
1533
- */
1534
1287
  program
1535
1288
  .command('node [name]')
1536
1289
  .description('One symbol\'s source + caller/callee trail, or read a file with line numbers + dependents (same output as the codegraph_node MCP tool)')
@@ -1540,9 +1293,6 @@ function main() {
1540
1293
  .option('--limit <number>', 'File mode: maximum lines')
1541
1294
  .option('--symbols-only', 'File mode: just the symbol map + dependents')
1542
1295
  .action(async (name, options) => {
1543
- // Need a symbol (positional) OR a file (--file / a path-like positional).
1544
- // With [name] optional, a bare `codegraph node` reaches here with neither
1545
- // and must be told what to pass, rather than crashing downstream.
1546
1296
  if (!name && !options.file) {
1547
1297
  error("Pass a symbol name (e.g. 'codegraph node parseToken') or a file (e.g. 'codegraph node -f src/auth.ts', or 'codegraph node src/auth.ts').");
1548
1298
  process.exit(1);
@@ -1553,24 +1303,14 @@ function main() {
1553
1303
  error(`CodeGraph isn't available here — no .codegraph/ index exists in ${projectPath}. If you are an AI agent: continue with your usual tools; indexing is the user's decision, do not run it yourself. (The project owner can enable CodeGraph with 'codegraph init'.)`);
1554
1304
  process.exit(1);
1555
1305
  }
1556
- const { default: CodeGraph } = await loadCodeGraph();
1557
- const cg = await CodeGraph.open(projectPath);
1306
+ const cg = await openIndexToRead(projectPath);
1558
1307
  const { ToolHandler } = await Promise.resolve().then(() => __importStar(require('../mcp/tools')));
1559
1308
  const handler = new ToolHandler(cg);
1560
- // A name with a path separator is a file read; otherwise a symbol
1561
- // (use --file for basename-only file reads or to pin an overload).
1562
- // Both separators: Windows users type src\auth\session.ts. Symbols
1563
- // never contain either ('/' isn't an identifier char anywhere we
1564
- // index; C++ scope is '::', JS members '.').
1565
1309
  const args = {};
1566
1310
  if (options.file) {
1567
1311
  args.file = options.file;
1568
1312
  if (name && name !== options.file) {
1569
1313
  args.symbol = name;
1570
- // Symbol mode pinned to a file is still symbol mode — the CLI
1571
- // always wants the body, exactly like the bare-symbol branch
1572
- // below. Omitting this printed location + trail with no source
1573
- // (#1284).
1574
1314
  args.includeCode = true;
1575
1315
  }
1576
1316
  }
@@ -1598,16 +1338,15 @@ function main() {
1598
1338
  process.exit(1);
1599
1339
  }
1600
1340
  });
1601
- /**
1602
- * codegraph files [path]
1603
- */
1604
1341
  program
1605
1342
  .command('files')
1606
1343
  .description('Show project file structure from the index')
1607
1344
  .option('-p, --path <path>', 'Project path')
1608
1345
  .option('--filter <dir>', 'Filter to files under this directory')
1609
1346
  .option('--pattern <glob>', 'Filter files matching this glob pattern')
1610
- .option('--format <format>', 'Output format (tree, flat, grouped)', 'tree')
1347
+ .option('--tests', 'Show only test files')
1348
+ .option('--no-tests', 'Exclude test files')
1349
+ .option('--format <format>', 'Output format (tree, flat, grouped, package)', 'tree')
1611
1350
  .option('--max-depth <number>', 'Maximum directory depth for tree format')
1612
1351
  .option('--no-metadata', 'Hide file metadata (language, symbol count)')
1613
1352
  .option('-j, --json', 'Output as JSON')
@@ -1618,36 +1357,42 @@ function main() {
1618
1357
  error(`CodeGraph not initialized in ${projectPath}`);
1619
1358
  process.exit(1);
1620
1359
  }
1621
- const { default: CodeGraph } = await loadCodeGraph();
1622
- const cg = await CodeGraph.open(projectPath);
1360
+ const cg = await openIndexToRead(projectPath);
1623
1361
  let files = cg.getFiles();
1624
1362
  if (files.length === 0) {
1625
1363
  info('No files indexed. Run "codegraph index" first.');
1626
1364
  cg.destroy();
1627
1365
  return;
1628
1366
  }
1629
- // Filter by path prefix
1630
1367
  if (options.filter) {
1631
1368
  const filter = options.filter;
1632
1369
  files = files.filter(f => f.path.startsWith(filter) || f.path.startsWith('./' + filter));
1633
1370
  }
1634
- // Filter by glob pattern
1635
1371
  if (options.pattern) {
1636
1372
  const regex = globToRegex(options.pattern);
1637
1373
  files = files.filter(f => regex.test(f.path));
1638
1374
  }
1375
+ if (options.tests !== undefined) {
1376
+ files = files.filter(f => (0, query_utils_1.isTestPath)(f.path) === options.tests);
1377
+ }
1639
1378
  if (files.length === 0) {
1640
1379
  info('No files found matching the criteria.');
1641
1380
  cg.destroy();
1642
1381
  return;
1643
1382
  }
1644
- // JSON output
1645
1383
  if (options.json) {
1646
1384
  const output = files.map(f => ({
1647
1385
  path: f.path,
1386
+ isTest: (0, query_utils_1.isTestPath)(f.path),
1648
1387
  language: f.language,
1649
1388
  nodeCount: f.nodeCount,
1650
1389
  size: f.size,
1390
+ errors: (f.errors ?? []).map((e) => ({
1391
+ severity: e.severity,
1392
+ code: e.code,
1393
+ message: e.message,
1394
+ line: e.line,
1395
+ })),
1651
1396
  }));
1652
1397
  console.log(JSON.stringify(output, null, 2));
1653
1398
  cg.destroy();
@@ -1656,7 +1401,6 @@ function main() {
1656
1401
  const includeMetadata = options.metadata !== false;
1657
1402
  const format = options.format || 'tree';
1658
1403
  const maxDepth = options.maxDepth ? parseInt(options.maxDepth, 10) : undefined;
1659
- // Format output
1660
1404
  switch (format) {
1661
1405
  case 'flat':
1662
1406
  console.log(chalk.bold(`\nFiles (${files.length}):\n`));
@@ -1691,6 +1435,23 @@ function main() {
1691
1435
  console.log();
1692
1436
  }
1693
1437
  break;
1438
+ case 'package': {
1439
+ const groups = (0, owning_package_1.groupFilesByPackage)(projectPath, files);
1440
+ console.log(chalk.bold(`\n${(0, owning_package_1.packageListingTitle)(groups)}:\n`));
1441
+ for (const group of groups) {
1442
+ console.log(chalk.cyan(`${(0, owning_package_1.packageGroupTitle)(group)}:`));
1443
+ for (const file of group.files) {
1444
+ if (includeMetadata) {
1445
+ console.log(` ${file.path} ${chalk.dim(`(${file.language}, ${file.nodeCount} symbols)`)}`);
1446
+ }
1447
+ else {
1448
+ console.log(` ${file.path}`);
1449
+ }
1450
+ }
1451
+ console.log();
1452
+ }
1453
+ break;
1454
+ }
1694
1455
  case 'tree':
1695
1456
  default:
1696
1457
  console.log(chalk.bold(`\nProject Structure (${files.length} files):\n`));
@@ -1705,27 +1466,15 @@ function main() {
1705
1466
  process.exit(1);
1706
1467
  }
1707
1468
  });
1708
- /**
1709
- * Normalize a user-supplied file path to the project-relative, forward-slash
1710
- * form CodeGraph stores in the index. Accepts an absolute path, a `./`-prefixed
1711
- * path, or Windows back-slashes; an empty string when the input is blank. Used
1712
- * by `codegraph affected` so `./src/x.ts`, `/abs/repo/src/x.ts`, and
1713
- * `src/x.ts` all match the same indexed file. (#825)
1714
- */
1715
1469
  function normalizeIndexPath(filePath, projectPath) {
1716
1470
  let f = filePath.trim();
1717
1471
  if (!f)
1718
1472
  return '';
1719
1473
  if (path.isAbsolute(f))
1720
1474
  f = path.relative(projectPath, f);
1721
- // Collapse `.`/`..` segments, then force forward slashes and drop a leading
1722
- // `./` (path.normalize already strips it on POSIX; explicit for Windows).
1723
1475
  f = path.normalize(f).replace(/\\/g, '/').replace(/^\.\//, '');
1724
1476
  return f;
1725
1477
  }
1726
- /**
1727
- * Convert glob pattern to regex
1728
- */
1729
1478
  function globToRegex(pattern) {
1730
1479
  const escaped = pattern
1731
1480
  .replace(/[.+^${}()|[\]\\]/g, '\\$&')
@@ -1735,9 +1484,6 @@ function main() {
1735
1484
  .replace(/\{\{GLOBSTAR\}\}/g, '.*');
1736
1485
  return new RegExp(escaped);
1737
1486
  }
1738
- /**
1739
- * Print files as a tree
1740
- */
1741
1487
  function printFileTree(files, includeMetadata, maxDepth, chalk) {
1742
1488
  const root = { name: '', children: new Map() };
1743
1489
  for (const file of files) {
@@ -1785,11 +1531,6 @@ function main() {
1785
1531
  };
1786
1532
  renderNode(root, '', true, 0);
1787
1533
  }
1788
- /**
1789
- * codegraph daemon — interactive manager for the background daemons. Arrow keys
1790
- * to pick one (the current project's daemon floats to the top, auto-selected),
1791
- * enter to stop it. Falls back to a plain list when output isn't a TTY.
1792
- */
1793
1534
  program
1794
1535
  .command('daemon')
1795
1536
  .aliases(['daemons'])
@@ -1802,15 +1543,12 @@ function main() {
1802
1543
  info('No CodeGraph daemons running.');
1803
1544
  return;
1804
1545
  }
1805
- // No TTY (piped / CI / non-interactive) — can't do arrow-key selection, so
1806
- // just print what's running instead of crashing on a prompt with no input.
1807
1546
  if (!process.stdout.isTTY || !process.stdin.isTTY) {
1808
1547
  for (const d of daemons) {
1809
1548
  console.log(`pid ${d.pid} v${d.version} up ${formatDuration(Date.now() - d.startedAt)} ${d.root}`);
1810
1549
  }
1811
1550
  return;
1812
1551
  }
1813
- // The current project's daemon floats to the top and is pre-selected.
1814
1552
  let cwdRoot = null;
1815
1553
  const found = (0, directory_1.findNearestCodeGraphRoot)(process.cwd());
1816
1554
  if (found) {
@@ -1835,19 +1573,9 @@ function main() {
1835
1573
  done: (m) => clack.outro(m),
1836
1574
  });
1837
1575
  });
1838
- /**
1839
- * Print the "no index here" guidance.
1840
- *
1841
- * The viewer READS an index; it never builds one — indexing stays the user's
1842
- * decision, exactly as it is for the MCP tools. So a missing index is normal
1843
- * input, not a failure to apologize for: say what is missing, say the one
1844
- * command that fixes it, and never print a stack trace.
1845
- */
1846
1576
  function printNoIndexGuidance(projectPath) {
1847
1577
  error(`No CodeGraph index found for ${projectPath}`);
1848
1578
  console.error('');
1849
- // getGlyphs() (not a literal em dash): a legacy Windows console decodes raw
1850
- // UTF-8 with its OEM codepage and renders one as mojibake (#168).
1851
1579
  console.error(` The viewer reads an index that already exists ${(0, glyphs_1.getGlyphs)().dash} it never creates one.`);
1852
1580
  console.error(' To index this project:');
1853
1581
  console.error('');
@@ -1858,20 +1586,6 @@ function main() {
1858
1586
  console.error(` ${chalk.cyan('codegraph ui /path/to/indexed/project')}`);
1859
1587
  console.error('');
1860
1588
  }
1861
- /**
1862
- * codegraph ui [path] (alias: web)
1863
- *
1864
- * The browser reader: serves the built viewer (`dist/viewer/`) over loopback
1865
- * and opens it. It opens the index for reading and never writes to it, never
1866
- * indexes, and never changes a line of the project's code. The single thing it
1867
- * writes is a trail the reader saved, as JSON under `.codegraph/ui/trails/`;
1868
- * `--read-only` turns even that off.
1869
- *
1870
- * Deliberately absent from TELEMETRY_FLUSH_COMMANDS above: the command's own
1871
- * banner tells the user nothing leaves their machine, so it must not be the
1872
- * thing that triggers a telemetry send. The usage count still buffers locally
1873
- * like every other quick command.
1874
- */
1875
1589
  program
1876
1590
  .command('ui [path]', { hidden: !(0, viewer_gate_1.viewerEnabled)() })
1877
1591
  .alias('web')
@@ -1922,9 +1636,6 @@ Set ${constants_1.BROWSER_ENV}=<command> to choose which browser opens, or
1922
1636
  ${constants_1.BROWSER_ENV}=none to never open one.
1923
1637
  `)
1924
1638
  .action(async (pathArg, options) => {
1925
- // An explicit --port stays explicit: a scripted `--port 8080` that quietly
1926
- // lands on 8081 is worse than one that says the port is busy. The default
1927
- // port is the only one we're free to walk away from.
1928
1639
  let requestedPort;
1929
1640
  if (options.port !== undefined) {
1930
1641
  requestedPort = Number(options.port);
@@ -1934,9 +1645,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
1934
1645
  }
1935
1646
  }
1936
1647
  const projectPath = resolveProjectPath(pathArg);
1937
- // Sensitive-directory refusal before anything opens: the same guard the MCP
1938
- // entry points use, so `codegraph ui /etc` is turned away here rather than
1939
- // becoming a browsable view of the system.
1940
1648
  const { validateProjectPath } = await Promise.resolve().then(() => __importStar(require('../utils')));
1941
1649
  const rootError = validateProjectPath(projectPath);
1942
1650
  if (rootError) {
@@ -1948,9 +1656,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
1948
1656
  process.exit(1);
1949
1657
  }
1950
1658
  const { startUiServer, openBrowser, createGraphApi, ViewerMissingError } = await Promise.resolve().then(() => __importStar(require('../ui-server')));
1951
- // The JSON API the viewer reads its screens from. It opens the index lazily
1952
- // on the first request, so a slow first paint is the only cost of mounting
1953
- // it here rather than after the browser connects.
1954
1659
  const readOnly = options.readOnly === true;
1955
1660
  const api = createGraphApi({
1956
1661
  projectRoot: projectPath,
@@ -1970,8 +1675,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
1970
1675
  }
1971
1676
  catch (err) {
1972
1677
  api.close();
1973
- // Both failure modes here (viewer assets missing, no port available) carry
1974
- // their own remediation — print it plainly, never a stack trace.
1975
1678
  error(err instanceof ViewerMissingError || err instanceof Error ? err.message : String(err));
1976
1679
  process.exit(1);
1977
1680
  }
@@ -1990,50 +1693,31 @@ ${constants_1.BROWSER_ENV}=none to never open one.
1990
1693
  ? chalk.dim(' Opening your browser... press Ctrl+C to stop.')
1991
1694
  : chalk.dim(' Open that URL in a browser. Press Ctrl+C to stop.'));
1992
1695
  console.log('');
1993
- // The http server keeps the event loop alive on its own; these just make
1994
- // Ctrl-C hang up live sockets instead of waiting on browser keep-alives.
1995
1696
  const shutdown = () => {
1996
- // Release the SQLite handle before the socket: the process should never
1997
- // exit with a live connection to the user's index.
1998
1697
  api.close();
1999
1698
  void handle.close().then(() => process.exit(0));
2000
1699
  };
2001
1700
  process.once('SIGINT', shutdown);
2002
1701
  process.once('SIGTERM', shutdown);
2003
- // Killing the command the user started (its pid, not Ctrl+C's process
2004
- // group) leaves this re-exec'd server with no parent to forward the
2005
- // signal: shut down the same way instead of serving the port forever.
2006
1702
  (0, command_supervision_1.watchParent)(shutdown);
2007
1703
  });
2008
- /**
2009
- * codegraph serve
2010
- */
2011
1704
  program
2012
- // Hidden from `--help`: this is the stdio entry point an AI agent launches
2013
- // for itself (the installer wires `args: ['serve','--mcp']` into every
2014
- // agent's MCP config), not a command a human runs. It still works when
2015
- // invoked — hiding only removes it from the listing. See the interactive-TTY
2016
- // guard below, which explains this to anyone who runs it by hand.
2017
1705
  .command('serve', { hidden: true })
2018
1706
  .description('Start CodeGraph as an MCP server for AI assistants')
2019
1707
  .option('-p, --path <path>', 'Project path (optional for MCP mode, uses rootUri from client)')
2020
1708
  .option('--mcp', 'Run as MCP server (stdio transport)')
2021
1709
  .option('--no-watch', 'Disable the file watcher (no auto-sync; useful on slow filesystems like WSL2 /mnt drives)')
1710
+ .option('--no-telemetry', 'Send no usage telemetry from this server (same as CODEGRAPH_TELEMETRY=0)')
2022
1711
  .action(async (options) => {
2023
1712
  const projectPath = options.path ? resolveProjectPath(options.path) : undefined;
2024
- // Commander sets watch=false when --no-watch is passed. Route it through
2025
- // the same env-var chokepoint the watcher and MCP server already honor.
2026
1713
  if (options.watch === false) {
2027
1714
  process.env.CODEGRAPH_NO_WATCH = '1';
2028
1715
  }
1716
+ if (options.telemetry === false) {
1717
+ process.env.CODEGRAPH_TELEMETRY = '0';
1718
+ }
2029
1719
  try {
2030
1720
  if (options.mcp) {
2031
- // `serve --mcp` is the stdio MCP server an AI agent launches for itself,
2032
- // not a command to run by hand. A human in a terminal would otherwise
2033
- // see it hang waiting for JSON-RPC on stdin, which reads as broken. If
2034
- // stdin is an interactive TTY, explain instead of hanging. The agent's
2035
- // pipe and the detached daemon both have a non-TTY stdin, so this only
2036
- // ever fires for a person who typed it.
2037
1721
  if (process.stdin.isTTY && !process.env.CODEGRAPH_DAEMON_INTERNAL) {
2038
1722
  console.error(chalk.bold('\nCodeGraph MCP server\n'));
2039
1723
  console.error("This is the MCP server your AI agent (Claude Code, Cursor, Codex, opencode, …)");
@@ -2044,15 +1728,11 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2044
1728
  console.error(chalk.dim('\n(Running it directly only does something when an MCP client drives it over stdin.)'));
2045
1729
  return;
2046
1730
  }
2047
- // Start MCP server - it handles initialization lazily based on rootUri from client
2048
1731
  const { MCPServer } = await Promise.resolve().then(() => __importStar(require('../mcp/index')));
2049
1732
  const server = new MCPServer(projectPath);
2050
1733
  await server.start();
2051
- // Server will run until terminated
2052
1734
  }
2053
1735
  else {
2054
- // Default: show info about MCP mode.
2055
- // Use stderr so stdout stays clean for any piped/stdio usage.
2056
1736
  console.error(chalk.bold('\nCodeGraph MCP Server\n'));
2057
1737
  console.error(chalk.blue((0, glyphs_1.getGlyphs)().info) + ' Use --mcp flag to start the MCP server');
2058
1738
  console.error('\nTo use with Claude Code, add to your MCP configuration:');
@@ -2082,9 +1762,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2082
1762
  process.exit(1);
2083
1763
  }
2084
1764
  });
2085
- /**
2086
- * codegraph unlock [path]
2087
- */
2088
1765
  program
2089
1766
  .command('unlock [path]')
2090
1767
  .description('Remove a stale lock file that is blocking indexing')
@@ -2113,11 +1790,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2113
1790
  process.exit(1);
2114
1791
  }
2115
1792
  });
2116
- /**
2117
- * CLI parity with MCP callers/callees: resolve once, then collect and limit
2118
- * within each definition. The legacy JSON list remains an explicitly labeled
2119
- * union, with its original total/limit/truncated contract (#1674).
2120
- */
2121
1793
  for (const direction of ['callers', 'callees']) {
2122
1794
  const title = direction === 'callers' ? 'Callers' : 'Callees';
2123
1795
  program
@@ -2136,11 +1808,10 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2136
1808
  error(`CodeGraph not initialized in ${projectPath}`);
2137
1809
  process.exit(1);
2138
1810
  }
2139
- const { default: CodeGraph } = await loadCodeGraph();
2140
- const cg = await CodeGraph.open(projectPath);
1811
+ const cg = await openIndexToRead(projectPath);
2141
1812
  try {
2142
1813
  const limit = parseInt(options.limit || '20', 10);
2143
- const { nodes: targets } = (0, symbol_lookup_1.lookupSymbolNodes)(cg, symbol);
1814
+ const { nodes: targets } = (0, symbol_lookup_1.lookupSymbolNodes)(cg, symbol, (0, go_package_1.goPackageReaderFor)(cg));
2144
1815
  if (targets.length === 0) {
2145
1816
  info(formatSymbolNotFound(symbol, cg.searchNodes(symbol, { limit: 5 }).map((m) => m.node.name)));
2146
1817
  return;
@@ -2153,25 +1824,46 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2153
1824
  const collected = groups.map((group) => {
2154
1825
  const nodes = new Map();
2155
1826
  const edges = new Map();
1827
+ const recursive = new Set();
2156
1828
  for (const target of group) {
2157
- const connections = direction === 'callers' ? cg.getCallers(target.id) : cg.getCallees(target.id);
2158
- for (const { node, edge } of connections) {
2159
- nodes.set(node.id, node);
2160
- edges.set(`${edge.source}->${edge.target}:${edge.kind}`, edge);
1829
+ for (const row of cg.getCallSites(target.id, direction)) {
1830
+ nodes.set(row.node.id, row.node);
1831
+ if (row.recursive)
1832
+ recursive.add(row.node.id);
1833
+ for (const edge of row.edges) {
1834
+ edges.set(`${edge.source}|${edge.target}|${edge.kind}|${edge.line ?? -1}|${edge.column ?? -1}`, edge);
1835
+ }
2161
1836
  }
2162
1837
  }
2163
- return { group, nodes: [...nodes.values()], edges: [...edges.values()] };
1838
+ return { group, nodes: [...nodes.values()], edges: [...edges.values()], recursive };
1839
+ });
1840
+ const ownEdges = (node, edges) => edges.filter((edge) => (direction === 'callers' ? edge.source : edge.target) === node.id);
1841
+ const relationships = (node, edges) => [...new Set(ownEdges(node, edges).map((edge) => edge.kind))];
1842
+ const location = (node, edges) => {
1843
+ const lines = direction === 'callers' ? (0, call_sites_1.callSiteLines)(ownEdges(node, edges)) : [];
1844
+ if (lines.length > 0)
1845
+ return `:${(0, call_sites_1.formatCallSiteLines)(lines, CLI_CALL_SITES_SHOWN)}`;
1846
+ return node.startLine ? `:${node.startLine}` : '';
1847
+ };
1848
+ const row = (node, edges, recursive) => ({
1849
+ ...cliNode(node),
1850
+ relationships: relationships(node, edges),
1851
+ lines: (0, call_sites_1.callSiteLines)(ownEdges(node, edges)),
1852
+ recursive,
2164
1853
  });
2165
- const relationships = (node, edges) => [...new Set(edges
2166
- .filter((edge) => (direction === 'callers' ? edge.source : edge.target) === node.id)
2167
- .map((edge) => edge.kind))];
1854
+ const { filesChangedSinceIndexed } = await Promise.resolve().then(() => __importStar(require('../graph/file-drift')));
1855
+ const changedOnDisk = filesChangedSinceIndexed(cg, [
1856
+ ...groups.flat().map((node) => node.filePath),
1857
+ ...collected.flatMap(({ nodes }) => nodes.slice(0, limit).map((node) => node.filePath)),
1858
+ ]);
1859
+ warnChangedOnDisk(changedOnDisk, options.json);
2168
1860
  if (options.json) {
2169
- const definitions = collected.map(({ group, nodes, edges }) => {
1861
+ const definitions = collected.map(({ group, nodes, edges, recursive }) => {
2170
1862
  const limited = nodes.slice(0, limit);
2171
1863
  const shown = new Set(limited.map((node) => node.id));
2172
1864
  return {
2173
1865
  ...cliDefinition(group),
2174
- [direction]: limited.map((node) => ({ id: node.id, ...cliNode(node), relationships: relationships(node, edges) })),
1866
+ [direction]: limited.map((node) => ({ id: node.id, ...row(node, edges, recursive.has(node.id)) })),
2175
1867
  edges: edges.filter((edge) => shown.has(direction === 'callers' ? edge.source : edge.target)),
2176
1868
  total: nodes.length,
2177
1869
  limit,
@@ -2184,6 +1876,7 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2184
1876
  union.set(node.id, node);
2185
1877
  }
2186
1878
  const total = union.size;
1879
+ const allEdges = collected.flatMap((entry) => entry.edges);
2187
1880
  console.log(JSON.stringify({
2188
1881
  symbol,
2189
1882
  targets: groups.flat().map((node) => cliDefinition([node]).definition),
@@ -2192,9 +1885,9 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2192
1885
  file: options.file,
2193
1886
  filteredOut,
2194
1887
  note,
1888
+ ...(changedOnDisk.length > 0 ? { changedOnDisk } : {}),
2195
1889
  definitions,
2196
- [direction]: [...union.values()].slice(0, limit).map((node) => ({ ...cliNode(node),
2197
- relationships: relationships(node, collected.flatMap((entry) => entry.edges)) })),
1890
+ [direction]: [...union.values()].slice(0, limit).map((node) => row(node, allEdges, collected.some((entry) => entry.recursive.has(node.id)))),
2198
1891
  total,
2199
1892
  limit,
2200
1893
  truncated: total > limit,
@@ -2206,7 +1899,7 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2206
1899
  if (ambiguous) {
2207
1900
  console.log(chalk.bold(`\n${title} of "${symbol}" — ${groups.length} distinct definitions (narrow with --file):`));
2208
1901
  }
2209
- for (const { group, nodes, edges } of collected) {
1902
+ for (const { group, nodes, edges, recursive } of collected) {
2210
1903
  const limited = nodes.slice(0, limit);
2211
1904
  const total = nodes.length;
2212
1905
  const truncated = total > limit;
@@ -2225,11 +1918,11 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2225
1918
  info(`No ${direction} found for "${symbol}"`);
2226
1919
  }
2227
1920
  for (const node of limited) {
2228
- const loc = node.startLine ? `:${node.startLine}` : '';
2229
1921
  const kinds = relationships(node, edges).filter((kind) => kind !== 'calls');
2230
1922
  const relation = kinds.length ? ` [${kinds.join(', ')}]` : '';
2231
- console.log(chalk.cyan(node.kind.padEnd(12)) + chalk.white(node.name) + chalk.dim(relation));
2232
- console.log(chalk.dim(` ${node.filePath}${loc}`));
1923
+ const itself = recursive.has(node.id) ? ' (calls itself)' : '';
1924
+ console.log(chalk.cyan(node.kind.padEnd(12)) + chalk.white(node.name) + chalk.dim(itself + relation));
1925
+ console.log(chalk.dim(` ${node.filePath}${location(node, edges)}`));
2233
1926
  console.log();
2234
1927
  }
2235
1928
  if (truncated)
@@ -2247,9 +1940,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2247
1940
  }
2248
1941
  });
2249
1942
  }
2250
- /**
2251
- * codegraph impact <symbol> — one blast radius per distinct definition.
2252
- */
2253
1943
  program
2254
1944
  .command('impact <symbol>')
2255
1945
  .description('Analyze what code is affected by changing a symbol')
@@ -2264,11 +1954,10 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2264
1954
  error(`CodeGraph not initialized in ${projectPath}`);
2265
1955
  process.exit(1);
2266
1956
  }
2267
- const { default: CodeGraph } = await loadCodeGraph();
2268
- const cg = await CodeGraph.open(projectPath);
1957
+ const cg = await openIndexToRead(projectPath);
2269
1958
  try {
2270
1959
  const depth = Math.min(Math.max(parseInt(options.depth || '2', 10), 1), 10);
2271
- const { nodes: targets } = (0, symbol_lookup_1.lookupSymbolNodes)(cg, symbol);
1960
+ const { nodes: targets } = (0, symbol_lookup_1.lookupSymbolNodes)(cg, symbol, (0, go_package_1.goPackageReaderFor)(cg));
2272
1961
  if (targets.length === 0) {
2273
1962
  info(formatSymbolNotFound(symbol, cg.searchNodes(symbol, { limit: 5 }).map((m) => m.node.name)));
2274
1963
  return;
@@ -2281,19 +1970,28 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2281
1970
  const collected = groups.map((group) => {
2282
1971
  const nodes = new Map();
2283
1972
  const edges = new Map();
1973
+ let truncated = false;
2284
1974
  for (const target of group) {
2285
1975
  const impact = cg.getImpactRadius(target.id, depth);
1976
+ truncated ||= impact.truncated === true;
2286
1977
  for (const [id, node] of impact.nodes)
2287
1978
  nodes.set(id, node);
2288
1979
  for (const edge of impact.edges)
2289
1980
  edges.set(`${edge.source}->${edge.target}:${edge.kind}`, edge);
2290
1981
  }
2291
- return { group, nodes, edges };
1982
+ return { group, nodes, edges, truncated };
2292
1983
  });
1984
+ const truncated = collected.some((c) => c.truncated);
1985
+ const { filesChangedSinceIndexed } = await Promise.resolve().then(() => __importStar(require('../graph/file-drift')));
1986
+ const changedOnDisk = filesChangedSinceIndexed(cg, [
1987
+ ...groups.flat().map((node) => node.filePath),
1988
+ ...collected.flatMap(({ nodes }) => [...nodes.values()].map((node) => node.filePath)),
1989
+ ]);
1990
+ warnChangedOnDisk(changedOnDisk, options.json);
2293
1991
  if (options.json) {
2294
1992
  const unionNodes = new Map();
2295
1993
  const unionEdges = new Map();
2296
- const definitions = collected.map(({ group, nodes, edges }) => {
1994
+ const definitions = collected.map(({ group, nodes, edges, truncated }) => {
2297
1995
  for (const [id, node] of nodes)
2298
1996
  unionNodes.set(id, node);
2299
1997
  for (const [key, edge] of edges)
@@ -2302,6 +2000,7 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2302
2000
  ...cliDefinition(group),
2303
2001
  nodeCount: nodes.size,
2304
2002
  edgeCount: edges.size,
2003
+ ...(truncated ? { truncated } : {}),
2305
2004
  affected: [...nodes.values()].map((node) => ({ id: node.id, ...cliNode(node) })),
2306
2005
  edges: [...edges.values()],
2307
2006
  };
@@ -2315,9 +2014,11 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2315
2014
  file: options.file,
2316
2015
  filteredOut,
2317
2016
  note,
2017
+ ...(changedOnDisk.length > 0 ? { changedOnDisk } : {}),
2318
2018
  definitions,
2319
2019
  nodeCount: unionNodes.size,
2320
2020
  edgeCount: unionEdges.size,
2021
+ ...(truncated ? { truncated } : {}),
2321
2022
  affected: [...unionNodes.values()].map(cliNode),
2322
2023
  }, null, 2));
2323
2024
  }
@@ -2350,6 +2051,8 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2350
2051
  console.log();
2351
2052
  }
2352
2053
  }
2054
+ if (truncated)
2055
+ warn('Result truncated at the safety limit. Narrow it with --file or a smaller --depth.');
2353
2056
  }
2354
2057
  }
2355
2058
  finally {
@@ -2361,25 +2064,140 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2361
2064
  process.exit(1);
2362
2065
  }
2363
2066
  });
2364
- /**
2365
- * codegraph affected [files...]
2366
- *
2367
- * Find test files affected by the given source files.
2368
- * Traces dependency edges transitively to find test files that depend on changed code.
2369
- *
2370
- * Usage:
2371
- * git diff --name-only | codegraph affected --stdin
2372
- * codegraph affected src/lib/components/Editor.svelte src/routes/+page.svelte
2373
- */
2067
+ async function affectedFilterMatcher(pattern) {
2068
+ const { default: picomatch } = await Promise.resolve().then(() => __importStar(require('picomatch')));
2069
+ const options = { dot: true, windows: false };
2070
+ let glob = pattern.trim();
2071
+ if (glob.endsWith('/'))
2072
+ glob += '**';
2073
+ if (!glob.includes('/')) {
2074
+ const matchName = picomatch(glob, options);
2075
+ return (filePath) => matchName(path.posix.basename(filePath));
2076
+ }
2077
+ const anchored = /^\.?\//.test(glob);
2078
+ glob = glob.replace(/^\.?\/+/, '');
2079
+ if (!anchored && !glob.startsWith('**/'))
2080
+ glob = `**/${glob}`;
2081
+ return picomatch(glob, options);
2082
+ }
2083
+ program
2084
+ .command('implementations <symbol>')
2085
+ .description('List the types that implement or extend a trait, interface or class')
2086
+ .option('-p, --path <path>', 'Project path')
2087
+ .option('-f, --file <path>', 'Narrow definitions by file path or suffix (no match: show all with a note)')
2088
+ .option('-d, --depth <number>', `Levels of subtypes to list, 1-${type_hierarchy_1.MAX_DESCENDANT_DEPTH} (1: direct implementors only)`, '1')
2089
+ .option('-j, --json', 'Output as JSON')
2090
+ .action(async (symbol, options) => {
2091
+ const projectPath = resolveProjectPath(options.path);
2092
+ try {
2093
+ if (!(0, directory_1.isInitialized)(projectPath)) {
2094
+ error(`CodeGraph not initialized in ${projectPath}`);
2095
+ process.exit(1);
2096
+ }
2097
+ const cg = await openIndexToRead(projectPath);
2098
+ try {
2099
+ const depth = Math.min(Math.max(parseInt(options.depth || '1', 10) || 1, 1), type_hierarchy_1.MAX_DESCENDANT_DEPTH);
2100
+ const { nodes: found } = (0, symbol_lookup_1.lookupSymbolNodes)(cg, symbol, (0, go_package_1.goPackageReaderFor)(cg));
2101
+ if (found.length === 0) {
2102
+ info(formatSymbolNotFound(symbol, cg.searchNodes(symbol, { limit: 5 }).map((m) => m.node.name)));
2103
+ return;
2104
+ }
2105
+ const targets = found.filter(type_hierarchy_1.canHaveHierarchy);
2106
+ if (targets.length === 0) {
2107
+ info(`"${symbol}" is ${(0, symbol_lookup_1.describeSymbolNode)(found[0])} — not a type something can implement or extend.`);
2108
+ return;
2109
+ }
2110
+ const { groups, filteredOut } = (0, symbol_lookup_1.groupDefinitions)(targets, options.file);
2111
+ const ambiguous = groups.length > 1;
2112
+ const note = filteredOut
2113
+ ? `no definition of "${symbol}" matches file "${options.file}" — showing all definitions instead.`
2114
+ : undefined;
2115
+ const sources = new Map();
2116
+ const sourceOf = (filePath) => {
2117
+ if (!sources.has(filePath)) {
2118
+ try {
2119
+ sources.set(filePath, fs.readFileSync(path.join(projectPath, filePath), 'utf-8'));
2120
+ }
2121
+ catch {
2122
+ sources.set(filePath, undefined);
2123
+ }
2124
+ }
2125
+ return sources.get(filePath);
2126
+ };
2127
+ const collected = groups.map((group) => {
2128
+ const focus = group[0];
2129
+ const hierarchy = (0, type_hierarchy_1.buildTypeHierarchy)(cg, focus, { overrides: false });
2130
+ const entries = (hierarchy?.descendants ?? []).filter((e) => e.depth <= depth);
2131
+ const nameOf = new Map([[focus.id, focus.name]]);
2132
+ for (const e of entries)
2133
+ nameOf.set(e.node.id, e.node.name);
2134
+ const implementations = entries.map((e) => ({
2135
+ ...cliNode(e.node),
2136
+ qualifiedName: e.node.qualifiedName,
2137
+ language: e.node.language,
2138
+ relation: e.relation,
2139
+ depth: e.depth,
2140
+ via: e.depth > 1 ? nameOf.get(e.parentId) : undefined,
2141
+ test: (0, test_code_1.isTestCode)(e.node, sourceOf),
2142
+ synthesized: e.synthesized,
2143
+ }));
2144
+ return { group, implementations, directSubtypes: hierarchy?.directSubtypes ?? 0, bounded: hierarchy?.bounded ?? false };
2145
+ });
2146
+ if (options.json) {
2147
+ console.log(JSON.stringify({
2148
+ symbol,
2149
+ depth,
2150
+ targets: groups.flat().map((node) => cliDefinition([node]).definition),
2151
+ ambiguous,
2152
+ file: options.file,
2153
+ filteredOut,
2154
+ note,
2155
+ definitions: collected.map(({ group, implementations, directSubtypes, bounded }) => ({
2156
+ ...cliDefinition(group),
2157
+ directSubtypes,
2158
+ bounded,
2159
+ implementations,
2160
+ })),
2161
+ }, null, 2));
2162
+ }
2163
+ else {
2164
+ if (note)
2165
+ warn(note);
2166
+ for (const { group, implementations, directSubtypes, bounded } of collected) {
2167
+ const deeper = depth > 1 ? `, ${implementations.length} within ${depth} levels` : '';
2168
+ console.log(chalk.bold(`\nImplementations of ${(0, symbol_lookup_1.describeSymbolNode)(group[0])} — ${directSubtypes} direct${deeper}:\n`));
2169
+ if (implementations.length === 0)
2170
+ console.log(chalk.dim(' (none in the index)'));
2171
+ for (const r of implementations) {
2172
+ const tags = [r.test ? '[test]' : '', r.synthesized ? '[synthesized]' : ''].filter(Boolean).join(' ');
2173
+ const via = r.via ? ` ${r.via}` : '';
2174
+ console.log(` ${' '.repeat(r.depth - 1)}${chalk.dim(r.kind.padEnd(10))}${r.name} ${chalk.dim(r.relation + via)} ${chalk.cyan(`${r.filePath}:${r.startLine}`)}${tags ? ` ${chalk.dim(tags)}` : ''}`);
2175
+ }
2176
+ if (bounded)
2177
+ console.log(chalk.dim(`\n …the walk stops at ${type_hierarchy_1.MAX_DESCENDANTS} subtypes or ${type_hierarchy_1.MAX_DESCENDANT_DEPTH} levels; more exist.`));
2178
+ console.log();
2179
+ }
2180
+ }
2181
+ }
2182
+ finally {
2183
+ cg.destroy();
2184
+ }
2185
+ }
2186
+ catch (err) {
2187
+ error(`implementations failed: ${err instanceof Error ? err.message : String(err)}`);
2188
+ process.exit(1);
2189
+ }
2190
+ });
2374
2191
  program
2375
2192
  .command('affected [files...]')
2376
2193
  .description('Find test files affected by changed source files')
2377
2194
  .option('-p, --path <path>', 'Project path')
2378
2195
  .option('--stdin', 'Read file list from stdin (one per line)')
2379
2196
  .option('-d, --depth <number>', 'Max dependency traversal depth', '5')
2380
- .option('-f, --filter <glob>', 'Custom glob filter for test files (e.g. "e2e/*.spec.ts")')
2197
+ .option('-f, --filter <glob>', 'Glob for the files that count as tests, matched against the whole name: "*_test.go" matches the file name at any depth, "e2e/*.spec.ts" that folder at any depth, "/tests/**/*.py" from the project root only')
2381
2198
  .option('-j, --json', 'Output as JSON')
2382
2199
  .option('-q, --quiet', 'Only output file paths, no decoration')
2200
+ .option('--cross-tier', "Also follow links across a process boundary: a client's HTTP call to its server's route, a queue job to its consumer, an event to its handler")
2383
2201
  .action(async (fileArgs, options) => {
2384
2202
  const projectPath = resolveProjectPath(options.path);
2385
2203
  try {
@@ -2387,17 +2205,12 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2387
2205
  error(`CodeGraph not initialized in ${projectPath}`);
2388
2206
  process.exit(1);
2389
2207
  }
2390
- // Collect changed files from args or stdin
2391
2208
  let changedFiles = [...(fileArgs || [])];
2392
2209
  if (options.stdin) {
2393
2210
  const stdinData = fs.readFileSync(0, 'utf-8');
2394
2211
  const stdinFiles = stdinData.split('\n').map(f => f.trim()).filter(Boolean);
2395
2212
  changedFiles.push(...stdinFiles);
2396
2213
  }
2397
- // Normalize inputs to the project-relative, forward-slash form the index
2398
- // stores. Without this, `affected ./src/x.ts`, an absolute path (what a
2399
- // wrapping script often passes), or a Windows back-slash path silently
2400
- // matches nothing and reports 0 affected tests. (#825)
2401
2214
  changedFiles = changedFiles
2402
2215
  .map((f) => normalizeIndexPath(f, projectPath))
2403
2216
  .filter(Boolean);
@@ -2406,40 +2219,30 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2406
2219
  info('No files provided. Use file arguments or --stdin.');
2407
2220
  process.exit(0);
2408
2221
  }
2409
- const { default: CodeGraph } = await loadCodeGraph();
2410
- const cg = await CodeGraph.open(projectPath);
2411
- const maxDepth = parseInt(options.depth || '5', 10);
2412
- // Custom filter pattern
2413
2222
  let customFilter = null;
2414
2223
  if (options.filter) {
2415
- // Convert glob to regex: ** → .+, * → [^/]*, . → \.
2416
- const regex = options.filter
2417
- .replace(/[+[\]{}()^$|\\]/g, '\\$&')
2418
- .replace(/\./g, '\\.')
2419
- .replace(/\*\*/g, '.+')
2420
- .replace(/\*/g, '[^/]*');
2421
- customFilter = new RegExp(regex);
2422
- }
2423
- // One notion of "a test" for the whole tool (#1507): the CLI used to keep
2424
- // its own six regexes here, which knew `.test.` and `/tests/` but not Go's
2425
- // `_test.go`, Python's `test_x.py` or the JVM's `FooTest.kt` — so
2426
- // `affected` reported "no tests" for whole ecosystems while `search` and
2427
- // the MCP tools counted those very files as tests.
2224
+ try {
2225
+ customFilter = await affectedFilterMatcher(options.filter);
2226
+ }
2227
+ catch (err) {
2228
+ error(`Invalid --filter pattern "${options.filter}": ${err instanceof Error ? err.message : String(err)}`);
2229
+ process.exit(1);
2230
+ }
2231
+ }
2232
+ const cg = await openIndexToRead(projectPath);
2233
+ const maxDepth = parseInt(options.depth || '5', 10);
2428
2234
  function isTestFile(filePath) {
2429
2235
  if (customFilter)
2430
- return customFilter.test(filePath);
2236
+ return customFilter(filePath);
2431
2237
  return (0, query_utils_1.isTestPath)(filePath);
2432
2238
  }
2433
- // BFS to find all transitive dependents of changed files, filtered to test files
2434
2239
  const affectedTests = new Set();
2435
2240
  const allDependents = new Set();
2436
2241
  for (const file of changedFiles) {
2437
- // If the changed file is itself a test file, include it
2438
2242
  if (isTestFile(file)) {
2439
2243
  affectedTests.add(file);
2440
2244
  continue;
2441
2245
  }
2442
- // BFS through dependents
2443
2246
  const queue = [{ file, depth: 0 }];
2444
2247
  const visited = new Set();
2445
2248
  visited.add(file);
@@ -2447,7 +2250,7 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2447
2250
  const current = queue.shift();
2448
2251
  if (current.depth >= maxDepth)
2449
2252
  continue;
2450
- const dependents = cg.getFileDependents(current.file);
2253
+ const dependents = cg.getFileDependents(current.file, { skipTiers: !options.crossTier });
2451
2254
  for (const dep of dependents) {
2452
2255
  if (visited.has(dep))
2453
2256
  continue;
@@ -2463,7 +2266,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2463
2266
  }
2464
2267
  }
2465
2268
  const sortedTests = Array.from(affectedTests).sort();
2466
- // Output
2467
2269
  if (options.json) {
2468
2270
  console.log(JSON.stringify({
2469
2271
  changedFiles,
@@ -2494,17 +2296,60 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2494
2296
  process.exit(1);
2495
2297
  }
2496
2298
  });
2497
- /**
2498
- * codegraph install
2499
- */
2299
+ const CLI_CYCLE_FILES_SHOWN = 12;
2300
+ program
2301
+ .command('cycles [path]')
2302
+ .description('List circular imports between files (exits 1 when there are any)')
2303
+ .option('-j, --json', 'Output as JSON')
2304
+ .action(async (pathArg, options) => {
2305
+ const projectPath = resolveProjectPath(pathArg);
2306
+ try {
2307
+ if (!(0, directory_1.isInitialized)(projectPath)) {
2308
+ error(`CodeGraph not initialized in ${projectPath}`);
2309
+ process.exit(1);
2310
+ }
2311
+ const cg = await openIndexToRead(projectPath);
2312
+ try {
2313
+ const cycles = cg.findCircularDependencies();
2314
+ if (options.json) {
2315
+ console.log(JSON.stringify({ count: cycles.length, cycles }, null, 2));
2316
+ }
2317
+ else if (cycles.length === 0) {
2318
+ success('No circular imports found');
2319
+ }
2320
+ else {
2321
+ const files = cycles.reduce((sum, group) => sum + group.length, 0);
2322
+ console.log(chalk.bold(`\nCircular imports: ${cycles.length} group${cycles.length === 1 ? '' : 's'}, ${files} files\n`));
2323
+ cycles.forEach((group, i) => {
2324
+ console.log(chalk.cyan(`${i + 1}. ${group.length} files`));
2325
+ for (const file of group.slice(0, CLI_CYCLE_FILES_SHOWN))
2326
+ console.log(` ${file}`);
2327
+ if (group.length > CLI_CYCLE_FILES_SHOWN) {
2328
+ console.log(chalk.dim(` ... and ${group.length - CLI_CYCLE_FILES_SHOWN} more (--json lists them all)`));
2329
+ }
2330
+ console.log();
2331
+ });
2332
+ }
2333
+ if (cycles.length > 0)
2334
+ process.exitCode = 1;
2335
+ }
2336
+ finally {
2337
+ cg.destroy();
2338
+ }
2339
+ }
2340
+ catch (err) {
2341
+ error(`cycles failed: ${err instanceof Error ? err.message : String(err)}`);
2342
+ process.exit(1);
2343
+ }
2344
+ });
2500
2345
  program
2501
2346
  .command('install')
2502
- .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)')
2347
+ .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, IBM Bob, Factory Droid, Windsurf, Qwen Code, DeepSeek Harness, Grok Build, Kimi Code, Qoder CLI, Pi)')
2503
2348
  .option('-t, --target <ids>', 'Target agent(s): comma-separated ids, or "auto"|"all"|"none". Default: prompt')
2504
2349
  .option('-l, --location <where>', 'Install location: "global" or "local". Default: prompt')
2505
2350
  .option('-y, --yes', 'Non-interactive: defaults to --location=global --target=auto, auto-allow on')
2506
2351
  .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)')
2507
- .option('--no-permissions', 'Skip writing the auto-allow permissions list (Claude Code only)')
2352
+ .option('--no-permissions', 'Skip writing the auto-allow permissions list (Claude Code and Qwen Code only)')
2508
2353
  .option('--print-config <id>', 'Print MCP config snippet for the named agent and exit (no file writes)')
2509
2354
  .option('--refresh', 'Rewrite what previous installs configured, for already-configured agents only (never adds new ones). Run automatically by `codegraph upgrade`')
2510
2355
  .action(async (opts) => {
@@ -2520,12 +2365,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2520
2365
  process.stdout.write(target.printConfig(loc));
2521
2366
  return;
2522
2367
  }
2523
- // --refresh: non-interactive sweep that re-writes what previous
2524
- // installs configured (instructions section, MCP entry, legacy-hook
2525
- // cleanups) for already-configured agents, so those surfaces match
2526
- // THIS binary's templates. Skips everything else — never a first
2527
- // install, never touches permissions or the prompt hook. Sweeps both
2528
- // locations unless --location narrows it.
2529
2368
  if (opts.refresh) {
2530
2369
  const { refreshTargets } = await Promise.resolve().then(() => __importStar(require('../installer')));
2531
2370
  const { ALL_TARGETS } = await Promise.resolve().then(() => __importStar(require('../installer/targets/registry')));
@@ -2537,17 +2376,24 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2537
2376
  ? [opts.location]
2538
2377
  : ['global', 'local'];
2539
2378
  let changed = 0;
2379
+ let failed = 0;
2540
2380
  for (const loc of locs) {
2541
2381
  for (const report of refreshTargets(ALL_TARGETS, loc)) {
2382
+ if (report.status === 'failed') {
2383
+ failed += 1;
2384
+ error(`${report.displayName}: could not refresh — ${report.error}`);
2385
+ }
2542
2386
  for (const p of report.changedPaths) {
2543
2387
  changed += 1;
2544
2388
  console.log(` ${report.displayName}: refreshed ${p}`);
2545
2389
  }
2546
2390
  }
2547
2391
  }
2548
- if (changed === 0) {
2392
+ if (changed === 0 && failed === 0) {
2549
2393
  console.log('All configured agent surfaces are already current.');
2550
2394
  }
2395
+ if (failed > 0)
2396
+ process.exitCode = 1;
2551
2397
  return;
2552
2398
  }
2553
2399
  const { runInstallerWithOptions } = await Promise.resolve().then(() => __importStar(require('../installer')));
@@ -2556,12 +2402,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2556
2402
  process.exit(1);
2557
2403
  }
2558
2404
  try {
2559
- // Commander's `--no-permissions` makes `opts.permissions === false`;
2560
- // omitting the flag leaves it `true` (the positive-form default).
2561
- // We MUST treat the default-true as "user did not override — let
2562
- // the orchestrator prompt" and only forward an explicit `false`
2563
- // (or `true` when --yes implies it). Otherwise the auto-allow
2564
- // prompt is silently skipped on every interactive run.
2565
2405
  const explicitNoPermissions = opts.permissions === false;
2566
2406
  const autoAllow = explicitNoPermissions
2567
2407
  ? false
@@ -2579,29 +2419,13 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2579
2419
  error(err instanceof Error ? err.message : String(err));
2580
2420
  process.exit(1);
2581
2421
  }
2582
- // --init: the one-shot "wire agents AND build this project's index"
2583
- // bootstrap (#1578). The installer itself never indexes implicitly (a
2584
- // surprise index of $HOME is the thing we refuse) — an explicit flag is
2585
- // the user choosing. Runs after a successful install, including the
2586
- // `--target none` / nothing-detected case (the installer returns normally
2587
- // there), and shares every guard with `codegraph init`: an unsafe root
2588
- // is refused (exit 1, no implied --force), an already-initialized
2589
- // project just says so. `--yes` flows through so no offer prompts.
2590
2422
  if (opts.init) {
2591
2423
  await runInit(process.cwd(), { yes: opts.yes });
2592
2424
  }
2593
2425
  });
2594
- /**
2595
- * codegraph uninstall
2596
- *
2597
- * Inverse of `install`. Removes the codegraph MCP server entry,
2598
- * instructions block, and permissions from every agent (or a
2599
- * `--target` subset). Prompts global-vs-local when not given. Does NOT
2600
- * delete the `.codegraph/` index — that's `codegraph uninit`.
2601
- */
2602
2426
  program
2603
2427
  .command('uninstall')
2604
- .description('Remove codegraph from your agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, Kiro, GitHub Copilot)')
2428
+ .description('Remove codegraph from your agents (Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, Kiro, GitHub Copilot, IBM Bob, Factory Droid, Windsurf, Qwen Code, DeepSeek Harness, Grok Build, Kimi Code, Qoder CLI, Pi)')
2605
2429
  .option('-t, --target <ids>', 'Target agent(s): comma-separated ids, or "all". Default: all')
2606
2430
  .option('-l, --location <where>', 'Uninstall location: "global" or "local". Default: prompt')
2607
2431
  .option('-y, --yes', 'Non-interactive: defaults to --location=global --target=all')
@@ -2626,9 +2450,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2626
2450
  process.exit(1);
2627
2451
  }
2628
2452
  });
2629
- /**
2630
- * codegraph telemetry [on|off|status]
2631
- */
2632
2453
  program
2633
2454
  .command('telemetry [action]')
2634
2455
  .description('Show or change anonymous usage telemetry (status, on, off)')
@@ -2665,13 +2486,6 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2665
2486
  console.log(`Config: ${s.configPath}`);
2666
2487
  console.log(chalk.dim(`\nExactly what is collected (and never collected): ${telemetry_1.TELEMETRY_DOCS}\n`));
2667
2488
  });
2668
- /**
2669
- * codegraph upgrade [version]
2670
- *
2671
- * Self-update, however CodeGraph was installed (bundle via install.sh/.ps1,
2672
- * npm-global, npx, or a source checkout). See ../upgrade for the detection and
2673
- * per-method upgrade logic.
2674
- */
2675
2489
  program
2676
2490
  .command('upgrade [version]')
2677
2491
  .description('Update CodeGraph to the latest release (or a specific version)')
@@ -2704,21 +2518,12 @@ ${constants_1.BROWSER_ENV}=none to never open one.
2704
2518
  });
2705
2519
  process.exit(code);
2706
2520
  });
2707
- /**
2708
- * codegraph version
2709
- *
2710
- * The bare-noun form of `--version`. commander already provides `--version`
2711
- * and `-V`, and the `-v` / `-version` spellings are intercepted before parse
2712
- * (see top of main). This subcommand makes `codegraph version` work and lists
2713
- * the version affordance in `codegraph --help`.
2714
- */
2715
2521
  program
2716
2522
  .command('version')
2717
2523
  .description('Print the installed CodeGraph version (also: -v, --version)')
2718
2524
  .action(() => {
2719
2525
  console.log(packageJson.version);
2720
2526
  });
2721
- // Parse and run
2722
2527
  program.parse();
2723
- } // end main()
2528
+ }
2724
2529
  //# sourceMappingURL=codegraph.js.map