@colbymchenry/codegraph-win32-arm64 1.6.1 → 1.6.3

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