@colbymchenry/codegraph-win32-arm64 1.6.0 → 1.6.1

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 (622) hide show
  1. package/bin/codegraph +5 -0
  2. package/lib/dist/.test-build-engine.json +1 -0
  3. package/lib/dist/.test-build-viewer.json +1 -0
  4. package/lib/dist/bin/codegraph.d.ts +1 -0
  5. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  6. package/lib/dist/bin/codegraph.js +599 -291
  7. package/lib/dist/bin/codegraph.js.map +1 -1
  8. package/lib/dist/bin/viewer-gate.d.ts +17 -0
  9. package/lib/dist/bin/viewer-gate.d.ts.map +1 -0
  10. package/lib/dist/bin/viewer-gate.js +31 -0
  11. package/lib/dist/bin/viewer-gate.js.map +1 -0
  12. package/lib/dist/context/index.d.ts.map +1 -1
  13. package/lib/dist/context/index.js +43 -2
  14. package/lib/dist/context/index.js.map +1 -1
  15. package/lib/dist/db/index.d.ts +21 -2
  16. package/lib/dist/db/index.d.ts.map +1 -1
  17. package/lib/dist/db/index.js +86 -31
  18. package/lib/dist/db/index.js.map +1 -1
  19. package/lib/dist/db/migrations.d.ts +1 -1
  20. package/lib/dist/db/migrations.d.ts.map +1 -1
  21. package/lib/dist/db/migrations.js +40 -1
  22. package/lib/dist/db/migrations.js.map +1 -1
  23. package/lib/dist/db/queries.d.ts +423 -3
  24. package/lib/dist/db/queries.d.ts.map +1 -1
  25. package/lib/dist/db/queries.js +1026 -33
  26. package/lib/dist/db/queries.js.map +1 -1
  27. package/lib/dist/db/schema.sql +11 -1
  28. package/lib/dist/db/sqlite-adapter.d.ts +2 -0
  29. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  30. package/lib/dist/db/sqlite-adapter.js +56 -7
  31. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  32. package/lib/dist/db/synthesis-stage.d.ts +12 -0
  33. package/lib/dist/db/synthesis-stage.d.ts.map +1 -0
  34. package/lib/dist/db/synthesis-stage.js +89 -0
  35. package/lib/dist/db/synthesis-stage.js.map +1 -0
  36. package/lib/dist/db/wal-valve.d.ts +32 -12
  37. package/lib/dist/db/wal-valve.d.ts.map +1 -1
  38. package/lib/dist/db/wal-valve.js +65 -22
  39. package/lib/dist/db/wal-valve.js.map +1 -1
  40. package/lib/dist/db/wsl-shared-index.d.ts +53 -0
  41. package/lib/dist/db/wsl-shared-index.d.ts.map +1 -0
  42. package/lib/dist/db/wsl-shared-index.js +121 -0
  43. package/lib/dist/db/wsl-shared-index.js.map +1 -0
  44. package/lib/dist/directory.d.ts +101 -2
  45. package/lib/dist/directory.d.ts.map +1 -1
  46. package/lib/dist/directory.js +254 -23
  47. package/lib/dist/directory.js.map +1 -1
  48. package/lib/dist/errors.d.ts +14 -0
  49. package/lib/dist/errors.d.ts.map +1 -1
  50. package/lib/dist/errors.js +16 -1
  51. package/lib/dist/errors.js.map +1 -1
  52. package/lib/dist/extraction/cfml-extractor.d.ts +1 -0
  53. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
  54. package/lib/dist/extraction/cfml-extractor.js +15 -3
  55. package/lib/dist/extraction/cfml-extractor.js.map +1 -1
  56. package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -1
  57. package/lib/dist/extraction/dfm-extractor.js +14 -10
  58. package/lib/dist/extraction/dfm-extractor.js.map +1 -1
  59. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  60. package/lib/dist/extraction/extraction-version.js +1 -1
  61. package/lib/dist/extraction/function-ref.d.ts +6 -4
  62. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  63. package/lib/dist/extraction/function-ref.js +35 -14
  64. package/lib/dist/extraction/function-ref.js.map +1 -1
  65. package/lib/dist/extraction/grammars.d.ts +38 -0
  66. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  67. package/lib/dist/extraction/grammars.js +77 -1
  68. package/lib/dist/extraction/grammars.js.map +1 -1
  69. package/lib/dist/extraction/index.d.ts +113 -15
  70. package/lib/dist/extraction/index.d.ts.map +1 -1
  71. package/lib/dist/extraction/index.js +599 -132
  72. package/lib/dist/extraction/index.js.map +1 -1
  73. package/lib/dist/extraction/languages/c-cpp.d.ts +58 -0
  74. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  75. package/lib/dist/extraction/languages/c-cpp.js +291 -15
  76. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  77. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  78. package/lib/dist/extraction/languages/dart.js +8 -3
  79. package/lib/dist/extraction/languages/dart.js.map +1 -1
  80. package/lib/dist/extraction/languages/javascript.js +1 -1
  81. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  82. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  83. package/lib/dist/extraction/languages/kotlin.js +169 -36
  84. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  85. package/lib/dist/extraction/languages/lua.d.ts.map +1 -1
  86. package/lib/dist/extraction/languages/lua.js +4 -1
  87. package/lib/dist/extraction/languages/lua.js.map +1 -1
  88. package/lib/dist/extraction/languages/python.d.ts.map +1 -1
  89. package/lib/dist/extraction/languages/python.js +71 -0
  90. package/lib/dist/extraction/languages/python.js.map +1 -1
  91. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  92. package/lib/dist/extraction/languages/rust.js +3 -0
  93. package/lib/dist/extraction/languages/rust.js.map +1 -1
  94. package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
  95. package/lib/dist/extraction/languages/scala.js +18 -3
  96. package/lib/dist/extraction/languages/scala.js.map +1 -1
  97. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  98. package/lib/dist/extraction/languages/typescript.js +9 -2
  99. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  100. package/lib/dist/extraction/liquid-extractor.d.ts +18 -0
  101. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  102. package/lib/dist/extraction/liquid-extractor.js +98 -22
  103. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  104. package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
  105. package/lib/dist/extraction/mybatis-extractor.js +6 -4
  106. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  107. package/lib/dist/extraction/syntax-tokens.d.ts +103 -0
  108. package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -0
  109. package/lib/dist/extraction/syntax-tokens.js +381 -0
  110. package/lib/dist/extraction/syntax-tokens.js.map +1 -0
  111. package/lib/dist/extraction/tree-sitter-helpers.d.ts +5 -0
  112. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  113. package/lib/dist/extraction/tree-sitter-helpers.js +17 -0
  114. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  115. package/lib/dist/extraction/tree-sitter-types.d.ts +29 -3
  116. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  117. package/lib/dist/extraction/tree-sitter.d.ts +96 -17
  118. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  119. package/lib/dist/extraction/tree-sitter.js +820 -82
  120. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  121. package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  122. package/lib/dist/file-limits.d.ts +40 -0
  123. package/lib/dist/file-limits.d.ts.map +1 -0
  124. package/lib/dist/file-limits.js +147 -0
  125. package/lib/dist/file-limits.js.map +1 -0
  126. package/lib/dist/graph/branch-guards.d.ts +248 -0
  127. package/lib/dist/graph/branch-guards.d.ts.map +1 -0
  128. package/lib/dist/graph/branch-guards.js +2231 -0
  129. package/lib/dist/graph/branch-guards.js.map +1 -0
  130. package/lib/dist/graph/dead-code.d.ts +251 -0
  131. package/lib/dist/graph/dead-code.d.ts.map +1 -0
  132. package/lib/dist/graph/dead-code.js +776 -0
  133. package/lib/dist/graph/dead-code.js.map +1 -0
  134. package/lib/dist/graph/dynamic-boundary-report.d.ts +121 -0
  135. package/lib/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
  136. package/lib/dist/graph/dynamic-boundary-report.js +283 -0
  137. package/lib/dist/graph/dynamic-boundary-report.js.map +1 -0
  138. package/lib/dist/graph/index.d.ts +4 -0
  139. package/lib/dist/graph/index.d.ts.map +1 -1
  140. package/lib/dist/graph/index.js +16 -1
  141. package/lib/dist/graph/index.js.map +1 -1
  142. package/lib/dist/graph/named-symbol-flow.d.ts +125 -0
  143. package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -0
  144. package/lib/dist/graph/named-symbol-flow.js +552 -0
  145. package/lib/dist/graph/named-symbol-flow.js.map +1 -0
  146. package/lib/dist/graph/symbol-lookup.d.ts +83 -0
  147. package/lib/dist/graph/symbol-lookup.d.ts.map +1 -0
  148. package/lib/dist/graph/symbol-lookup.js +181 -0
  149. package/lib/dist/graph/symbol-lookup.js.map +1 -0
  150. package/lib/dist/graph/traversal.d.ts +9 -0
  151. package/lib/dist/graph/traversal.d.ts.map +1 -1
  152. package/lib/dist/graph/traversal.js +61 -35
  153. package/lib/dist/graph/traversal.js.map +1 -1
  154. package/lib/dist/graph/type-hierarchy.d.ts +155 -0
  155. package/lib/dist/graph/type-hierarchy.d.ts.map +1 -0
  156. package/lib/dist/graph/type-hierarchy.js +382 -0
  157. package/lib/dist/graph/type-hierarchy.js.map +1 -0
  158. package/lib/dist/index.d.ts +251 -11
  159. package/lib/dist/index.d.ts.map +1 -1
  160. package/lib/dist/index.js +395 -34
  161. package/lib/dist/index.js.map +1 -1
  162. package/lib/dist/installer/index.d.ts.map +1 -1
  163. package/lib/dist/installer/index.js +3 -2
  164. package/lib/dist/installer/index.js.map +1 -1
  165. package/lib/dist/installer/targets/antigravity.d.ts.map +1 -1
  166. package/lib/dist/installer/targets/antigravity.js +14 -2
  167. package/lib/dist/installer/targets/antigravity.js.map +1 -1
  168. package/lib/dist/installer/targets/claude.d.ts +3 -0
  169. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  170. package/lib/dist/installer/targets/claude.js +35 -7
  171. package/lib/dist/installer/targets/claude.js.map +1 -1
  172. package/lib/dist/installer/targets/codex.d.ts +2 -1
  173. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  174. package/lib/dist/installer/targets/codex.js +14 -4
  175. package/lib/dist/installer/targets/codex.js.map +1 -1
  176. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
  177. package/lib/dist/installer/targets/copilot-cli.js +7 -1
  178. package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
  179. package/lib/dist/installer/targets/opencode.d.ts +16 -5
  180. package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
  181. package/lib/dist/installer/targets/opencode.js +73 -22
  182. package/lib/dist/installer/targets/opencode.js.map +1 -1
  183. package/lib/dist/installer/targets/shared.d.ts +14 -3
  184. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  185. package/lib/dist/installer/targets/shared.js +39 -11
  186. package/lib/dist/installer/targets/shared.js.map +1 -1
  187. package/lib/dist/installer/targets/types.d.ts +7 -0
  188. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  189. package/lib/dist/mcp/answer-freshness.d.ts +10 -0
  190. package/lib/dist/mcp/answer-freshness.d.ts.map +1 -0
  191. package/lib/dist/mcp/answer-freshness.js +68 -0
  192. package/lib/dist/mcp/answer-freshness.js.map +1 -0
  193. package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
  194. package/lib/dist/mcp/daemon-manager.js +16 -0
  195. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  196. package/lib/dist/mcp/daemon-paths.d.ts +2 -0
  197. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  198. package/lib/dist/mcp/daemon-paths.js +12 -3
  199. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  200. package/lib/dist/mcp/daemon-registry.d.ts +7 -4
  201. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  202. package/lib/dist/mcp/daemon-registry.js +91 -29
  203. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  204. package/lib/dist/mcp/daemon.d.ts +17 -7
  205. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  206. package/lib/dist/mcp/daemon.js +116 -24
  207. package/lib/dist/mcp/daemon.js.map +1 -1
  208. package/lib/dist/mcp/dynamic-boundaries.d.ts +1 -10
  209. package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
  210. package/lib/dist/mcp/dynamic-boundaries.js +46 -42
  211. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  212. package/lib/dist/mcp/engine.d.ts +28 -9
  213. package/lib/dist/mcp/engine.d.ts.map +1 -1
  214. package/lib/dist/mcp/engine.js +146 -62
  215. package/lib/dist/mcp/engine.js.map +1 -1
  216. package/lib/dist/mcp/explore-dedup.d.ts +5 -2
  217. package/lib/dist/mcp/explore-dedup.d.ts.map +1 -1
  218. package/lib/dist/mcp/explore-dedup.js +8 -5
  219. package/lib/dist/mcp/explore-dedup.js.map +1 -1
  220. package/lib/dist/mcp/index-freshness-worker.d.ts +2 -0
  221. package/lib/dist/mcp/index-freshness-worker.d.ts.map +1 -0
  222. package/lib/dist/mcp/index-freshness-worker.js +30 -0
  223. package/lib/dist/mcp/index-freshness-worker.js.map +1 -0
  224. package/lib/dist/mcp/index-freshness.d.ts +7 -0
  225. package/lib/dist/mcp/index-freshness.d.ts.map +1 -0
  226. package/lib/dist/mcp/index-freshness.js +94 -0
  227. package/lib/dist/mcp/index-freshness.js.map +1 -0
  228. package/lib/dist/mcp/index.d.ts +3 -1
  229. package/lib/dist/mcp/index.d.ts.map +1 -1
  230. package/lib/dist/mcp/index.js +95 -11
  231. package/lib/dist/mcp/index.js.map +1 -1
  232. package/lib/dist/mcp/liveness-watchdog.d.ts +4 -1
  233. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  234. package/lib/dist/mcp/liveness-watchdog.js +11 -2
  235. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  236. package/lib/dist/mcp/project-lifecycle.d.ts +9 -0
  237. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -0
  238. package/lib/dist/mcp/project-lifecycle.js +181 -0
  239. package/lib/dist/mcp/project-lifecycle.js.map +1 -0
  240. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  241. package/lib/dist/mcp/proxy.js +9 -0
  242. package/lib/dist/mcp/proxy.js.map +1 -1
  243. package/lib/dist/mcp/query-pool.d.ts +2 -2
  244. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  245. package/lib/dist/mcp/query-pool.js +9 -7
  246. package/lib/dist/mcp/query-pool.js.map +1 -1
  247. package/lib/dist/mcp/query-worker.js +2 -2
  248. package/lib/dist/mcp/query-worker.js.map +1 -1
  249. package/lib/dist/mcp/server-instructions.d.ts +1 -1
  250. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  251. package/lib/dist/mcp/server-instructions.js +6 -3
  252. package/lib/dist/mcp/server-instructions.js.map +1 -1
  253. package/lib/dist/mcp/startup-handshake.d.ts +3 -1
  254. package/lib/dist/mcp/startup-handshake.d.ts.map +1 -1
  255. package/lib/dist/mcp/startup-handshake.js +10 -2
  256. package/lib/dist/mcp/startup-handshake.js.map +1 -1
  257. package/lib/dist/mcp/tools.d.ts +276 -36
  258. package/lib/dist/mcp/tools.d.ts.map +1 -1
  259. package/lib/dist/mcp/tools.js +2295 -980
  260. package/lib/dist/mcp/tools.js.map +1 -1
  261. package/lib/dist/mcp/writer-lock.d.ts +61 -0
  262. package/lib/dist/mcp/writer-lock.d.ts.map +1 -0
  263. package/lib/dist/mcp/writer-lock.js +260 -0
  264. package/lib/dist/mcp/writer-lock.js.map +1 -0
  265. package/lib/dist/resolution/alias-binding.d.ts +56 -0
  266. package/lib/dist/resolution/alias-binding.d.ts.map +1 -0
  267. package/lib/dist/resolution/alias-binding.js +127 -0
  268. package/lib/dist/resolution/alias-binding.js.map +1 -0
  269. package/lib/dist/resolution/callback-synthesizer.d.ts +23 -1
  270. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  271. package/lib/dist/resolution/callback-synthesizer.js +291 -143
  272. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  273. package/lib/dist/resolution/cpp-constructor.d.ts +4 -0
  274. package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -0
  275. package/lib/dist/resolution/cpp-constructor.js +123 -0
  276. package/lib/dist/resolution/cpp-constructor.js.map +1 -0
  277. package/lib/dist/resolution/cpp-macro-visibility.d.ts +12 -0
  278. package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -0
  279. package/lib/dist/resolution/cpp-macro-visibility.js +342 -0
  280. package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -0
  281. package/lib/dist/resolution/expo-router-synthesizer.d.ts +32 -0
  282. package/lib/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
  283. package/lib/dist/resolution/expo-router-synthesizer.js +189 -0
  284. package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -0
  285. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  286. package/lib/dist/resolution/frameworks/csharp.js +96 -2
  287. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  288. package/lib/dist/resolution/frameworks/expo-router.d.ts +189 -0
  289. package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
  290. package/lib/dist/resolution/frameworks/expo-router.js +785 -0
  291. package/lib/dist/resolution/frameworks/expo-router.js.map +1 -0
  292. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  293. package/lib/dist/resolution/frameworks/express.js +251 -16
  294. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  295. package/lib/dist/resolution/frameworks/index.d.ts +5 -0
  296. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  297. package/lib/dist/resolution/frameworks/index.js +29 -1
  298. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  299. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  300. package/lib/dist/resolution/frameworks/java.js +79 -47
  301. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  302. package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
  303. package/lib/dist/resolution/frameworks/nestjs.js +6 -14
  304. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
  305. package/lib/dist/resolution/frameworks/nextjs.d.ts +76 -0
  306. package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
  307. package/lib/dist/resolution/frameworks/nextjs.js +328 -0
  308. package/lib/dist/resolution/frameworks/nextjs.js.map +1 -0
  309. package/lib/dist/resolution/frameworks/object-literal.d.ts +32 -0
  310. package/lib/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
  311. package/lib/dist/resolution/frameworks/object-literal.js +139 -0
  312. package/lib/dist/resolution/frameworks/object-literal.js.map +1 -0
  313. package/lib/dist/resolution/frameworks/package-deps.d.ts +14 -0
  314. package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
  315. package/lib/dist/resolution/frameworks/package-deps.js +78 -0
  316. package/lib/dist/resolution/frameworks/package-deps.js.map +1 -0
  317. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
  318. package/lib/dist/resolution/frameworks/python.js +166 -0
  319. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  320. package/lib/dist/resolution/frameworks/react-native.d.ts +26 -0
  321. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  322. package/lib/dist/resolution/frameworks/react-native.js +153 -14
  323. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  324. package/lib/dist/resolution/frameworks/react-router.d.ts +46 -0
  325. package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -0
  326. package/lib/dist/resolution/frameworks/react-router.js +187 -0
  327. package/lib/dist/resolution/frameworks/react-router.js.map +1 -0
  328. package/lib/dist/resolution/frameworks/react.d.ts +2 -1
  329. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  330. package/lib/dist/resolution/frameworks/react.js +188 -139
  331. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  332. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  333. package/lib/dist/resolution/frameworks/svelte.js +6 -1
  334. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  335. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
  336. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
  337. package/lib/dist/resolution/frameworks/sveltekit-router.js +156 -0
  338. package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
  339. package/lib/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
  340. package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
  341. package/lib/dist/resolution/frameworks/tanstack-router.js +437 -0
  342. package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -0
  343. package/lib/dist/resolution/frameworks/vue-router.d.ts +82 -0
  344. package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
  345. package/lib/dist/resolution/frameworks/vue-router.js +377 -0
  346. package/lib/dist/resolution/frameworks/vue-router.js.map +1 -0
  347. package/lib/dist/resolution/import-resolver.d.ts +38 -0
  348. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  349. package/lib/dist/resolution/import-resolver.js +376 -26
  350. package/lib/dist/resolution/import-resolver.js.map +1 -1
  351. package/lib/dist/resolution/index.d.ts +89 -25
  352. package/lib/dist/resolution/index.d.ts.map +1 -1
  353. package/lib/dist/resolution/index.js +552 -145
  354. package/lib/dist/resolution/index.js.map +1 -1
  355. package/lib/dist/resolution/js-builtins.d.ts +13 -0
  356. package/lib/dist/resolution/js-builtins.d.ts.map +1 -0
  357. package/lib/dist/resolution/js-builtins.js +46 -0
  358. package/lib/dist/resolution/js-builtins.js.map +1 -0
  359. package/lib/dist/resolution/name-matcher.d.ts +69 -22
  360. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  361. package/lib/dist/resolution/name-matcher.js +1902 -87
  362. package/lib/dist/resolution/name-matcher.js.map +1 -1
  363. package/lib/dist/resolution/next-router-synthesizer.d.ts +27 -0
  364. package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
  365. package/lib/dist/resolution/next-router-synthesizer.js +113 -0
  366. package/lib/dist/resolution/next-router-synthesizer.js.map +1 -0
  367. package/lib/dist/resolution/react-router-synthesizer.d.ts +33 -0
  368. package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
  369. package/lib/dist/resolution/react-router-synthesizer.js +126 -0
  370. package/lib/dist/resolution/react-router-synthesizer.js.map +1 -0
  371. package/lib/dist/resolution/resolver-pool.d.ts +2 -0
  372. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
  373. package/lib/dist/resolution/resolver-pool.js +4 -0
  374. package/lib/dist/resolution/resolver-pool.js.map +1 -1
  375. package/lib/dist/resolution/strip-comments.d.ts +6 -0
  376. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  377. package/lib/dist/resolution/strip-comments.js +58 -0
  378. package/lib/dist/resolution/strip-comments.js.map +1 -1
  379. package/lib/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
  380. package/lib/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
  381. package/lib/dist/resolution/sveltekit-synthesizer.js +173 -0
  382. package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -0
  383. package/lib/dist/resolution/synth-utils.d.ts +26 -0
  384. package/lib/dist/resolution/synth-utils.d.ts.map +1 -0
  385. package/lib/dist/resolution/synth-utils.js +75 -0
  386. package/lib/dist/resolution/synth-utils.js.map +1 -0
  387. package/lib/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
  388. package/lib/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
  389. package/lib/dist/resolution/tanstack-router-synthesizer.js +114 -0
  390. package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
  391. package/lib/dist/resolution/tier-synthesizer.d.ts +49 -0
  392. package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -0
  393. package/lib/dist/resolution/tier-synthesizer.js +931 -0
  394. package/lib/dist/resolution/tier-synthesizer.js.map +1 -0
  395. package/lib/dist/resolution/types.d.ts +78 -2
  396. package/lib/dist/resolution/types.d.ts.map +1 -1
  397. package/lib/dist/resolution/types.js +64 -0
  398. package/lib/dist/resolution/types.js.map +1 -1
  399. package/lib/dist/resolution/vue-router-synthesizer.d.ts +30 -0
  400. package/lib/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
  401. package/lib/dist/resolution/vue-router-synthesizer.js +115 -0
  402. package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -0
  403. package/lib/dist/search/query-paths.d.ts +50 -1
  404. package/lib/dist/search/query-paths.d.ts.map +1 -1
  405. package/lib/dist/search/query-paths.js +227 -12
  406. package/lib/dist/search/query-paths.js.map +1 -1
  407. package/lib/dist/search/query-utils.d.ts +15 -0
  408. package/lib/dist/search/query-utils.d.ts.map +1 -1
  409. package/lib/dist/search/query-utils.js +35 -7
  410. package/lib/dist/search/query-utils.js.map +1 -1
  411. package/lib/dist/sync/watch-policy.d.ts +14 -0
  412. package/lib/dist/sync/watch-policy.d.ts.map +1 -1
  413. package/lib/dist/sync/watch-policy.js +19 -0
  414. package/lib/dist/sync/watch-policy.js.map +1 -1
  415. package/lib/dist/sync/watcher.d.ts +52 -35
  416. package/lib/dist/sync/watcher.d.ts.map +1 -1
  417. package/lib/dist/sync/watcher.js +236 -100
  418. package/lib/dist/sync/watcher.js.map +1 -1
  419. package/lib/dist/telemetry/index.d.ts +4 -2
  420. package/lib/dist/telemetry/index.d.ts.map +1 -1
  421. package/lib/dist/telemetry/index.js +92 -41
  422. package/lib/dist/telemetry/index.js.map +1 -1
  423. package/lib/dist/types.d.ts +1 -1
  424. package/lib/dist/types.d.ts.map +1 -1
  425. package/lib/dist/types.js +1 -0
  426. package/lib/dist/types.js.map +1 -1
  427. package/lib/dist/ui-server/api/deadcode.d.ts +84 -0
  428. package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -0
  429. package/lib/dist/ui-server/api/deadcode.js +136 -0
  430. package/lib/dist/ui-server/api/deadcode.js.map +1 -0
  431. package/lib/dist/ui-server/api/effects.d.ts +87 -0
  432. package/lib/dist/ui-server/api/effects.d.ts.map +1 -0
  433. package/lib/dist/ui-server/api/effects.js +499 -0
  434. package/lib/dist/ui-server/api/effects.js.map +1 -0
  435. package/lib/dist/ui-server/api/entrypoints.d.ts +86 -0
  436. package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -0
  437. package/lib/dist/ui-server/api/entrypoints.js +279 -0
  438. package/lib/dist/ui-server/api/entrypoints.js.map +1 -0
  439. package/lib/dist/ui-server/api/events.d.ts +183 -0
  440. package/lib/dist/ui-server/api/events.d.ts.map +1 -0
  441. package/lib/dist/ui-server/api/events.js +430 -0
  442. package/lib/dist/ui-server/api/events.js.map +1 -0
  443. package/lib/dist/ui-server/api/file.d.ts +66 -0
  444. package/lib/dist/ui-server/api/file.d.ts.map +1 -0
  445. package/lib/dist/ui-server/api/file.js +235 -0
  446. package/lib/dist/ui-server/api/file.js.map +1 -0
  447. package/lib/dist/ui-server/api/filecode.d.ts +126 -0
  448. package/lib/dist/ui-server/api/filecode.d.ts.map +1 -0
  449. package/lib/dist/ui-server/api/filecode.js +205 -0
  450. package/lib/dist/ui-server/api/filecode.js.map +1 -0
  451. package/lib/dist/ui-server/api/flow.d.ts +226 -0
  452. package/lib/dist/ui-server/api/flow.d.ts.map +1 -0
  453. package/lib/dist/ui-server/api/flow.js +612 -0
  454. package/lib/dist/ui-server/api/flow.js.map +1 -0
  455. package/lib/dist/ui-server/api/hierarchy.d.ts +81 -0
  456. package/lib/dist/ui-server/api/hierarchy.d.ts.map +1 -0
  457. package/lib/dist/ui-server/api/hierarchy.js +92 -0
  458. package/lib/dist/ui-server/api/hierarchy.js.map +1 -0
  459. package/lib/dist/ui-server/api/index.d.ts +90 -0
  460. package/lib/dist/ui-server/api/index.d.ts.map +1 -0
  461. package/lib/dist/ui-server/api/index.js +332 -0
  462. package/lib/dist/ui-server/api/index.js.map +1 -0
  463. package/lib/dist/ui-server/api/map.d.ts +238 -0
  464. package/lib/dist/ui-server/api/map.d.ts.map +1 -0
  465. package/lib/dist/ui-server/api/map.js +681 -0
  466. package/lib/dist/ui-server/api/map.js.map +1 -0
  467. package/lib/dist/ui-server/api/node.d.ts +81 -0
  468. package/lib/dist/ui-server/api/node.d.ts.map +1 -0
  469. package/lib/dist/ui-server/api/node.js +388 -0
  470. package/lib/dist/ui-server/api/node.js.map +1 -0
  471. package/lib/dist/ui-server/api/nodes.d.ts +25 -0
  472. package/lib/dist/ui-server/api/nodes.d.ts.map +1 -0
  473. package/lib/dist/ui-server/api/nodes.js +45 -0
  474. package/lib/dist/ui-server/api/nodes.js.map +1 -0
  475. package/lib/dist/ui-server/api/program.d.ts +139 -0
  476. package/lib/dist/ui-server/api/program.d.ts.map +1 -0
  477. package/lib/dist/ui-server/api/program.js +315 -0
  478. package/lib/dist/ui-server/api/program.js.map +1 -0
  479. package/lib/dist/ui-server/api/respond.d.ts +76 -0
  480. package/lib/dist/ui-server/api/respond.d.ts.map +1 -0
  481. package/lib/dist/ui-server/api/respond.js +186 -0
  482. package/lib/dist/ui-server/api/respond.js.map +1 -0
  483. package/lib/dist/ui-server/api/route-roots.d.ts +39 -0
  484. package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -0
  485. package/lib/dist/ui-server/api/route-roots.js +96 -0
  486. package/lib/dist/ui-server/api/route-roots.js.map +1 -0
  487. package/lib/dist/ui-server/api/routes.d.ts +59 -0
  488. package/lib/dist/ui-server/api/routes.d.ts.map +1 -0
  489. package/lib/dist/ui-server/api/routes.js +108 -0
  490. package/lib/dist/ui-server/api/routes.js.map +1 -0
  491. package/lib/dist/ui-server/api/screens.d.ts +117 -0
  492. package/lib/dist/ui-server/api/screens.d.ts.map +1 -0
  493. package/lib/dist/ui-server/api/screens.js +611 -0
  494. package/lib/dist/ui-server/api/screens.js.map +1 -0
  495. package/lib/dist/ui-server/api/search.d.ts +29 -0
  496. package/lib/dist/ui-server/api/search.d.ts.map +1 -0
  497. package/lib/dist/ui-server/api/search.js +232 -0
  498. package/lib/dist/ui-server/api/search.js.map +1 -0
  499. package/lib/dist/ui-server/api/session.d.ts +52 -0
  500. package/lib/dist/ui-server/api/session.d.ts.map +1 -0
  501. package/lib/dist/ui-server/api/session.js +196 -0
  502. package/lib/dist/ui-server/api/session.js.map +1 -0
  503. package/lib/dist/ui-server/api/source.d.ts +200 -0
  504. package/lib/dist/ui-server/api/source.d.ts.map +1 -0
  505. package/lib/dist/ui-server/api/source.js +422 -0
  506. package/lib/dist/ui-server/api/source.js.map +1 -0
  507. package/lib/dist/ui-server/api/stats.d.ts +27 -0
  508. package/lib/dist/ui-server/api/stats.d.ts.map +1 -0
  509. package/lib/dist/ui-server/api/stats.js +164 -0
  510. package/lib/dist/ui-server/api/stats.js.map +1 -0
  511. package/lib/dist/ui-server/api/steps.d.ts +274 -0
  512. package/lib/dist/ui-server/api/steps.d.ts.map +1 -0
  513. package/lib/dist/ui-server/api/steps.js +1446 -0
  514. package/lib/dist/ui-server/api/steps.js.map +1 -0
  515. package/lib/dist/ui-server/api/trail-store.d.ts +142 -0
  516. package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -0
  517. package/lib/dist/ui-server/api/trail-store.js +323 -0
  518. package/lib/dist/ui-server/api/trail-store.js.map +1 -0
  519. package/lib/dist/ui-server/api/trails.d.ts +163 -0
  520. package/lib/dist/ui-server/api/trails.d.ts.map +1 -0
  521. package/lib/dist/ui-server/api/trails.js +369 -0
  522. package/lib/dist/ui-server/api/trails.js.map +1 -0
  523. package/lib/dist/ui-server/api/when.d.ts +125 -0
  524. package/lib/dist/ui-server/api/when.d.ts.map +1 -0
  525. package/lib/dist/ui-server/api/when.js +251 -0
  526. package/lib/dist/ui-server/api/when.js.map +1 -0
  527. package/lib/dist/ui-server/api/wire.d.ts +179 -0
  528. package/lib/dist/ui-server/api/wire.d.ts.map +1 -0
  529. package/lib/dist/ui-server/api/wire.js +231 -0
  530. package/lib/dist/ui-server/api/wire.js.map +1 -0
  531. package/lib/dist/ui-server/assets.d.ts +40 -0
  532. package/lib/dist/ui-server/assets.d.ts.map +1 -0
  533. package/lib/dist/ui-server/assets.js +110 -0
  534. package/lib/dist/ui-server/assets.js.map +1 -0
  535. package/lib/dist/ui-server/constants.d.ts +32 -0
  536. package/lib/dist/ui-server/constants.d.ts.map +1 -0
  537. package/lib/dist/ui-server/constants.js +35 -0
  538. package/lib/dist/ui-server/constants.js.map +1 -0
  539. package/lib/dist/ui-server/highlight/index.d.ts +113 -0
  540. package/lib/dist/ui-server/highlight/index.d.ts.map +1 -0
  541. package/lib/dist/ui-server/highlight/index.js +307 -0
  542. package/lib/dist/ui-server/highlight/index.js.map +1 -0
  543. package/lib/dist/ui-server/highlight/languages.d.ts +36 -0
  544. package/lib/dist/ui-server/highlight/languages.d.ts.map +1 -0
  545. package/lib/dist/ui-server/highlight/languages.js +50 -0
  546. package/lib/dist/ui-server/highlight/languages.js.map +1 -0
  547. package/lib/dist/ui-server/index.d.ts +92 -0
  548. package/lib/dist/ui-server/index.d.ts.map +1 -0
  549. package/lib/dist/ui-server/index.js +399 -0
  550. package/lib/dist/ui-server/index.js.map +1 -0
  551. package/lib/dist/ui-server/open-browser.d.ts +31 -0
  552. package/lib/dist/ui-server/open-browser.d.ts.map +1 -0
  553. package/lib/dist/ui-server/open-browser.js +79 -0
  554. package/lib/dist/ui-server/open-browser.js.map +1 -0
  555. package/lib/dist/ui-server/security.d.ts +127 -0
  556. package/lib/dist/ui-server/security.d.ts.map +1 -0
  557. package/lib/dist/ui-server/security.js +332 -0
  558. package/lib/dist/ui-server/security.js.map +1 -0
  559. package/lib/dist/ui-server/static.d.ts +45 -0
  560. package/lib/dist/ui-server/static.d.ts.map +1 -0
  561. package/lib/dist/ui-server/static.js +165 -0
  562. package/lib/dist/ui-server/static.js.map +1 -0
  563. package/lib/dist/utils.d.ts +14 -2
  564. package/lib/dist/utils.d.ts.map +1 -1
  565. package/lib/dist/utils.js +25 -10
  566. package/lib/dist/utils.js.map +1 -1
  567. package/lib/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  568. package/lib/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  569. package/lib/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  570. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
  571. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
  572. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  573. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  574. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  575. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  576. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  577. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  578. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
  579. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
  580. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  581. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  582. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  583. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  584. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  585. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  586. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
  587. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
  588. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  589. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  590. package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  591. package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  592. package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  593. package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  594. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
  595. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
  596. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  597. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  598. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  599. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  600. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  601. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  602. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
  603. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
  604. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  605. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  606. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  607. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  608. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  609. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  610. package/lib/dist/viewer/assets/index-CF9yvio6.css +1 -0
  611. package/lib/dist/viewer/assets/index-D4S7YUPf.js +97 -0
  612. package/lib/dist/viewer/index.html +16 -0
  613. package/lib/kernel/codegraph-kernel.node +2 -2
  614. package/lib/node_modules/.package-lock.json +4 -4
  615. package/lib/node_modules/picomatch/README.md +56 -51
  616. package/lib/node_modules/picomatch/lib/constants.js +4 -0
  617. package/lib/node_modules/picomatch/lib/parse.js +341 -1
  618. package/lib/node_modules/picomatch/lib/picomatch.js +25 -5
  619. package/lib/node_modules/picomatch/lib/scan.js +30 -18
  620. package/lib/node_modules/picomatch/package.json +4 -4
  621. package/lib/package.json +9 -2
  622. package/package.json +1 -1
@@ -21,6 +21,7 @@
21
21
  * codegraph callees <symbol> Find what a function/method calls
22
22
  * codegraph impact <symbol> Analyze what code is affected by changing a symbol
23
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)
24
25
  * codegraph upgrade [version] Update CodeGraph to the latest release
25
26
  */
26
27
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -61,6 +62,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
61
62
  // launcher is (almost certainly) still alive. A launcher killed mid-startup
62
63
  // otherwise blinds the PPID watchdog forever (#1185) — see early-ppid.ts.
63
64
  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
+ const viewer_gate_1 = require("./viewer-gate");
69
+ {
70
+ const viewerCommand = (0, viewer_gate_1.requestedViewerCommand)(process.argv.slice(2));
71
+ if (viewerCommand && !(0, viewer_gate_1.viewerEnabled)()) {
72
+ process.stderr.write(`error: 'codegraph ${viewerCommand}' is not in this release yet. The browser viewer is coming in an upcoming release.\n`);
73
+ process.exit(1);
74
+ }
75
+ }
64
76
  // Persist V8 compile artifacts across runs (Node ≥22.8). Every invocation —
65
77
  // and every worker thread, which re-requires the whole extraction module
66
78
  // graph — skips recompiling unchanged sources. Worth hundreds of ms of
@@ -85,6 +97,12 @@ const wasm_runtime_flags_1 = require("../extraction/wasm-runtime-flags");
85
97
  const command_supervision_1 = require("./command-supervision");
86
98
  const extraction_version_1 = require("../extraction/extraction-version");
87
99
  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
+ const constants_1 = require("../ui-server/constants");
104
+ const symbol_lookup_1 = require("../graph/symbol-lookup");
105
+ const query_utils_1 = require("../search/query-utils");
88
106
  // Decided once, before `--color`/`--no-color` are stripped from argv below
89
107
  // (#1281). Piped/redirected stdout, NO_COLOR, or --no-color -> plain output.
90
108
  const COLORS_ENABLED = (0, color_1.ansiColorsEnabled)();
@@ -355,11 +373,31 @@ function main() {
355
373
  function warn(message) {
356
374
  console.log(chalk.yellow((0, glyphs_1.getGlyphs)().warn) + ' ' + message);
357
375
  }
376
+ /** "not found" (+ optional did-you-mean) when no exact symbol matches. */
377
+ function formatSymbolNotFound(symbol, fuzzyNames) {
378
+ const suggestions = [...new Set(fuzzyNames.filter((n) => n !== symbol))].slice(0, 3);
379
+ if (suggestions.length === 0)
380
+ return `Symbol "${symbol}" not found`;
381
+ return `Symbol "${symbol}" not found — did you mean: ${suggestions.join(', ')}?`;
382
+ }
383
+ /** Compact node shape retained by the CLI's existing JSON lists. */
384
+ function cliNode(node) {
385
+ return { name: node.name, kind: node.kind, filePath: node.filePath, startLine: node.startLine };
386
+ }
387
+ /** Attribute a group's edges to every overload of this definition. */
388
+ function cliDefinition(group) {
389
+ const head = group[0];
390
+ return {
391
+ definition: { ...cliNode(head), id: head.id, qualifiedName: head.qualifiedName, language: head.language },
392
+ roots: group.map((node) => node.id),
393
+ };
394
+ }
358
395
  /**
359
396
  * Print indexing results using clack log methods
360
397
  */
361
398
  function printIndexResult(clack, result, projectPath) {
362
399
  const hasErrors = result.filesErrored > 0;
400
+ const parseWarnings = result.errors.filter((e) => e.code === 'parse_error' && e.severity === 'warning');
363
401
  // Surface non-file-level failures (e.g. lock-acquisition failure
364
402
  // when another indexer is running) before the file-count branches.
365
403
  // Without this the CLI falls through to "No files found to index",
@@ -384,6 +422,10 @@ function main() {
384
422
  clack.log.success(`Indexed ${formatNumber(result.filesIndexed)} files`);
385
423
  }
386
424
  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
+ for (const warning of parseWarnings) {
427
+ clack.log.warn(warning.message);
428
+ }
387
429
  // A PARTIAL index (files silently dropped mid-pipeline) must not pass
388
430
  // as a clean run — it's the difference between "indexed the repo" and
389
431
  // "indexed most of the repo, quietly". Only the completeness
@@ -406,6 +448,19 @@ function main() {
406
448
  else if (hasErrors) {
407
449
  clack.log.error(`Indexing failed ${(0, glyphs_1.getGlyphs)().dash} all ${formatNumber(result.filesErrored)} files had errors`);
408
450
  }
451
+ 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
+ const top = (result.topUnsupportedExtensions ?? [])
458
+ .map(e => `${e.ext} (${formatNumber(e.count)})`)
459
+ .join(', ');
460
+ clack.log.warn(`No supported source files found ${(0, glyphs_1.getGlyphs)().dash} ${formatNumber(result.filesSkippedUnsupported)} file(s) present, none in a language CodeGraph indexes`
461
+ + (top ? `: ${top}` : ''));
462
+ clack.log.info('CodeGraph is inactive for this workspace — searches will return nothing. Use your own file tools here.');
463
+ }
409
464
  else {
410
465
  clack.log.warn('No files found to index');
411
466
  }
@@ -601,9 +656,27 @@ function main() {
601
656
  clack.outro('');
602
657
  return;
603
658
  }
659
+ if ((0, directory_1.hasForeignDbFile)(projectPath)) {
660
+ const dbFile = path.join((0, directory_1.getCodeGraphDir)(projectPath), 'codegraph.db');
661
+ clack.log.error(`${dbFile} is not a SQLite database, so it cannot be rebuilt in place.`);
662
+ clack.log.info('Move or delete that file, then run "codegraph init" again.');
663
+ clack.outro('');
664
+ process.exitCode = 1;
665
+ return;
666
+ }
667
+ if ((0, directory_1.hasSchemalessDb)(projectPath)) {
668
+ clack.log.warn(`Found a codegraph.db without the codegraph schema in ${(0, directory_1.getCodeGraphDir)(projectPath)} (left by an interrupted init?) — rebuilding it.`);
669
+ }
604
670
  const { default: CodeGraph, getDatabasePath } = await loadCodeGraph();
605
671
  const cg = await CodeGraph.init(projectPath, { index: false });
606
672
  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.
675
+ const dataDir = path.basename((0, directory_1.getCodeGraphDir)(projectPath));
676
+ if (dataDir !== (0, directory_1.codeGraphDirName)()) {
677
+ clack.log.info(`The index is in ${dataDir}/: this project is on a Windows drive, so WSL keeps its own index ` +
678
+ `rather than share ${directory_1.DEFAULT_CODEGRAPH_DIR}/ with CodeGraph on Windows. Set CODEGRAPH_DIR to choose the name yourself.`);
679
+ }
607
680
  // Indexing runs by default now. The legacy -i/--index flag is still
608
681
  // accepted (so existing muscle memory and scripts don't break) but is a
609
682
  // no-op — initializing always builds the initial index.
@@ -729,7 +802,13 @@ function main() {
729
802
  .option('-q, --quiet', 'Suppress progress output')
730
803
  .option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
731
804
  .action(async (pathArg, options) => {
732
- const projectPath = resolveProjectPath(pathArg);
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
+ const projectPath = pathArg ? path.resolve(pathArg) : resolveProjectPath();
733
812
  try {
734
813
  // Don't (re)index your home directory / a filesystem root (#845). --force
735
814
  // doubles as the override.
@@ -740,66 +819,97 @@ function main() {
740
819
  }
741
820
  if (!(0, directory_1.isInitialized)(projectPath)) {
742
821
  error(`CodeGraph not initialized in ${projectPath}`);
743
- info('Run "codegraph init" first');
822
+ const ancestor = pathArg ? resolveProjectPath(pathArg) : projectPath;
823
+ if (ancestor !== projectPath) {
824
+ info(`The nearest initialized project is ${ancestor} — pass that path to rebuild it, or run "codegraph init" in ${projectPath} to index it on its own.`);
825
+ }
826
+ else {
827
+ info('Run "codegraph init" first');
828
+ }
744
829
  process.exit(1);
745
830
  }
746
- const { default: CodeGraph, getDatabasePath } = await loadCodeGraph();
747
- // `index` is a FULL re-index — identical to a fresh `init`. RECREATE the
748
- // database from scratch (discard .codegraph/codegraph.db + its WAL) rather
749
- // than opening the old graph and DELETE-ing every row. The clear-then-index
750
- // approach reported "0 nodes" without the clear (#874); the recreate keeps
751
- // that fixed AND avoids the failure mode where, on a large or pre-fix
752
- // poisoned index, the per-row FTS delete churn wedged the main thread long
753
- // enough to trip the liveness watchdog before scanning even began (#1067).
754
- // recreate() hands back a fresh, empty instance — no clear() needed. For
755
- // fast incremental updates use `sync`.
756
- const cg = await CodeGraph.recreate(projectPath);
757
- // Supervise the indexer: self-terminate if orphaned (parent shim killed)
758
- // or if the main thread wedges — neither was guarded on this path (#999).
759
- // The DB + WAL paths let the liveness watchdog tell a slow store on
760
- // degraded storage from a true wedge (#1231).
761
- const dbPath = getDatabasePath(projectPath);
762
- const supervision = (0, command_supervision_1.installCommandSupervision)('index', { progressPaths: [dbPath, `${dbPath}-wal`] });
831
+ const { tryAcquireWriterLock, releaseWriterLock, writerLockHeldMessage } = await Promise.resolve().then(() => __importStar(require('../mcp/writer-lock')));
832
+ const rebuild = tryAcquireWriterLock(projectPath, 'rebuild', 'rebuild.pid');
833
+ if (rebuild.kind === 'taken')
834
+ throw new Error('Another index rebuild is already in progress.');
763
835
  try {
764
- if (options.quiet) {
765
- // Quiet mode: no UI, just run against the freshly-recreated graph.
766
- const result = await cg.indexAll();
767
- if (!result.success)
768
- process.exit(1);
769
- cg.destroy();
770
- return;
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 });
840
+ 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`.');
771
842
  }
772
- const clack = await importESM('@clack/prompts');
773
- clack.intro('Indexing project');
774
- // A closure so a re-index (after opting gitignored child repos in, #1156)
775
- // renders identically. Supervision already wraps the whole command.
776
- const renderIndex = async () => {
777
- if (options.verbose) {
778
- return await cg.indexAll({ onProgress: createVerboseProgress(), verbose: true });
843
+ // Keep the writer slot through recreation AND indexing. A reconnecting
844
+ // proxy/daemon must not open the replacement database halfway through.
845
+ const writer = tryAcquireWriterLock(projectPath, 'rebuild');
846
+ if (writer.kind === 'taken')
847
+ throw new Error(writerLockHeldMessage(writer.existing, writer.pidPath));
848
+ try {
849
+ 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
+ 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
+ const dbPath = getDatabasePath(projectPath);
865
+ const supervision = (0, command_supervision_1.installCommandSupervision)('index', { progressPaths: [dbPath, `${dbPath}-wal`] });
866
+ try {
867
+ if (options.quiet) {
868
+ // Quiet mode: no UI, just run against the freshly-recreated graph.
869
+ const result = await cg.indexAll();
870
+ if (!result.success)
871
+ process.exit(1);
872
+ return;
873
+ }
874
+ const clack = await importESM('@clack/prompts');
875
+ 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
+ const renderIndex = async () => {
879
+ if (options.verbose) {
880
+ return await cg.indexAll({ onProgress: createVerboseProgress(), verbose: true });
881
+ }
882
+ process.stdout.write(`${colors.dim}${(0, glyphs_1.getGlyphs)().rail}${colors.reset}\n`);
883
+ const progress = (0, shimmer_progress_1.createShimmerProgress)();
884
+ const r = await cg.indexAll({ onProgress: progress.onProgress });
885
+ await progress.stop();
886
+ return r;
887
+ };
888
+ const result = await renderIndex();
889
+ printIndexResult(clack, result, projectPath);
890
+ 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
+ let finalResult = result;
894
+ if (result.nodesCreated === 0) {
895
+ finalResult = (await offerIndexIgnoredRepos(clack, projectPath, renderIndex, { interactive: true })) ?? result;
896
+ }
897
+ if (!finalResult.success) {
898
+ process.exit(1);
899
+ }
900
+ clack.outro('Done');
901
+ }
902
+ finally {
903
+ supervision.stop();
904
+ cg.destroy();
779
905
  }
780
- process.stdout.write(`${colors.dim}${(0, glyphs_1.getGlyphs)().rail}${colors.reset}\n`);
781
- const progress = (0, shimmer_progress_1.createShimmerProgress)();
782
- const r = await cg.indexAll({ onProgress: progress.onProgress });
783
- await progress.stop();
784
- return r;
785
- };
786
- const result = await renderIndex();
787
- printIndexResult(clack, result, projectPath);
788
- await recordIndexTelemetry(cg, result);
789
- // Empty graph at a git super-repo → likely `.gitignore`d child repos;
790
- // name them and offer to opt in instead of a silent 0-node result (#1156).
791
- let finalResult = result;
792
- if (result.nodesCreated === 0) {
793
- finalResult = (await offerIndexIgnoredRepos(clack, projectPath, renderIndex, { interactive: true })) ?? result;
794
906
  }
795
- if (!finalResult.success) {
796
- process.exit(1);
907
+ finally {
908
+ releaseWriterLock(projectPath);
797
909
  }
798
- clack.outro('Done');
799
- cg.destroy();
800
910
  }
801
911
  finally {
802
- supervision.stop();
912
+ releaseWriterLock(projectPath, 'rebuild.pid');
803
913
  }
804
914
  }
805
915
  catch (err) {
@@ -825,36 +935,43 @@ function main() {
825
935
  }
826
936
  const { default: CodeGraph } = await loadCodeGraph();
827
937
  const cg = await CodeGraph.open(projectPath);
828
- if (options.quiet) {
829
- await cg.sync();
830
- cg.destroy();
831
- return;
832
- }
833
- const clack = await importESM('@clack/prompts');
834
- clack.intro('Syncing CodeGraph');
835
- process.stdout.write(`${colors.dim}${(0, glyphs_1.getGlyphs)().rail}${colors.reset}\n`);
836
- const progress = (0, shimmer_progress_1.createShimmerProgress)();
837
- const result = await cg.sync({
838
- onProgress: progress.onProgress,
839
- });
840
- await progress.stop();
841
- const totalChanges = result.filesAdded + result.filesModified + result.filesRemoved;
842
- if (totalChanges === 0) {
843
- clack.log.info('Already up to date');
938
+ try {
939
+ if (options.quiet) {
940
+ await cg.sync();
941
+ return;
942
+ }
943
+ const clack = await importESM('@clack/prompts');
944
+ clack.intro('Syncing CodeGraph');
945
+ process.stdout.write(`${colors.dim}${(0, glyphs_1.getGlyphs)().rail}${colors.reset}\n`);
946
+ const progress = (0, shimmer_progress_1.createShimmerProgress)();
947
+ const result = await cg.sync({
948
+ onProgress: progress.onProgress,
949
+ }).finally(() => progress.stop());
950
+ const totalChanges = result.filesAdded + result.filesModified + result.filesRemoved;
951
+ if (totalChanges === 0 && !result.pendingRefsProcessed) {
952
+ clack.log.info('Already up to date');
953
+ }
954
+ else if (totalChanges > 0) {
955
+ clack.log.success(`Synced ${formatNumber(totalChanges)} changed files`);
956
+ const details = [];
957
+ if (result.filesAdded > 0)
958
+ details.push(`Added: ${result.filesAdded}`);
959
+ if (result.filesModified > 0)
960
+ details.push(`Modified: ${result.filesModified}`);
961
+ if (result.filesRemoved > 0)
962
+ details.push(`Removed: ${result.filesRemoved}`);
963
+ clack.log.info(`${details.join(', ')} ${(0, glyphs_1.getGlyphs)().dash} ${formatNumber(result.nodesUpdated)} nodes in ${formatDuration(result.durationMs)}`);
964
+ }
965
+ if (result.pendingRefsProcessed) {
966
+ const unresolved = result.pendingRefsUnresolved
967
+ ? ` (${formatNumber(result.pendingRefsUnresolved)} unresolved)` : '';
968
+ clack.log.info(`Resolved ${formatNumber(result.pendingRefsResolved ?? 0)} pending references${unresolved}`);
969
+ }
970
+ clack.outro('Done');
844
971
  }
845
- else {
846
- clack.log.success(`Synced ${formatNumber(totalChanges)} changed files`);
847
- const details = [];
848
- if (result.filesAdded > 0)
849
- details.push(`Added: ${result.filesAdded}`);
850
- if (result.filesModified > 0)
851
- details.push(`Modified: ${result.filesModified}`);
852
- if (result.filesRemoved > 0)
853
- details.push(`Removed: ${result.filesRemoved}`);
854
- clack.log.info(`${details.join(', ')} ${(0, glyphs_1.getGlyphs)().dash} ${formatNumber(result.nodesUpdated)} nodes in ${formatDuration(result.durationMs)}`);
972
+ finally {
973
+ cg.destroy();
855
974
  }
856
- clack.outro('Done');
857
- cg.destroy();
858
975
  }
859
976
  catch (err) {
860
977
  if (!options.quiet) {
@@ -1075,20 +1192,27 @@ function main() {
1075
1192
  const cg = await CodeGraph.open(projectPath);
1076
1193
  const limit = parseInt(options.limit || '10', 10);
1077
1194
  const rawResults = cg.searchNodes(search, {
1078
- limit,
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
+ limit: limit + 1,
1079
1198
  kinds: options.kind ? [options.kind] : undefined,
1080
1199
  });
1081
1200
  // Mirror the MCP search down-rank so the CLI also surfaces the
1082
1201
  // hand-written implementation before protobuf/gRPC scaffolding
1083
1202
  // when both share a name. See extraction/generated-detection.ts.
1084
1203
  const isGen = cg.generatedFilePredicate(rawResults.map((r) => r.node.filePath));
1085
- const results = [...rawResults].sort((a, b) => {
1204
+ const rankedResults = [...rawResults].sort((a, b) => {
1086
1205
  const aGen = isGen(a.node.filePath) ? 1 : 0;
1087
1206
  const bGen = isGen(b.node.filePath) ? 1 : 0;
1088
1207
  return aGen - bGen;
1089
1208
  });
1209
+ const truncated = rankedResults.length > limit;
1210
+ const results = rankedResults.slice(0, limit);
1211
+ const truncationMessage = `Results truncated at ${limit}; pass --limit to widen.`;
1090
1212
  if (options.json) {
1091
1213
  console.log(JSON.stringify(results, null, 2));
1214
+ if (truncated)
1215
+ console.error(truncationMessage);
1092
1216
  }
1093
1217
  else {
1094
1218
  if (results.length === 0) {
@@ -1112,6 +1236,8 @@ function main() {
1112
1236
  }
1113
1237
  console.log();
1114
1238
  }
1239
+ if (truncated)
1240
+ console.log(chalk.dim(truncationMessage));
1115
1241
  }
1116
1242
  }
1117
1243
  cg.destroy();
@@ -1254,6 +1380,10 @@ function main() {
1254
1380
  return;
1255
1381
  }
1256
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))
1386
+ return;
1257
1387
  // Gate telemetry: how often each tier fires vs. no-ops — counter names
1258
1388
  // only, NEVER prompt content (see TELEMETRY.md). This is the data that
1259
1389
  // turns "is the gate any good" from vibes into a measured recall rate.
@@ -1318,8 +1448,11 @@ function main() {
1318
1448
  const text = result.content[0]?.text ?? '';
1319
1449
  if (!result.isError && text.trim()) {
1320
1450
  // Cap the injection so a large-repo explore can't flood the prompt.
1321
- const MAX = 16000;
1322
- const body = text.length > MAX ? `${text.slice(0, MAX)}\n…(truncated; call codegraph_explore for the rest)` : text;
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
+ const body = (0, directory_1.capPromptHookInjection)(text);
1323
1456
  // For a front-loaded SUB-project, a follow-up explore needs its path.
1324
1457
  const more = plan.viaSubScan
1325
1458
  ? `call codegraph_explore with projectPath: "${plan.exploreRoot}" for more`
@@ -1701,6 +1834,172 @@ function main() {
1701
1834
  done: (m) => clack.outro(m),
1702
1835
  });
1703
1836
  });
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
+ function printNoIndexGuidance(projectPath) {
1846
+ error(`No CodeGraph index found for ${projectPath}`);
1847
+ 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
+ console.error(` The viewer reads an index that already exists ${(0, glyphs_1.getGlyphs)().dash} it never creates one.`);
1851
+ console.error(' To index this project:');
1852
+ console.error('');
1853
+ console.error(` ${chalk.cyan('codegraph init')}`);
1854
+ console.error('');
1855
+ console.error(' Already indexed somewhere else? Point the viewer at it:');
1856
+ console.error('');
1857
+ console.error(` ${chalk.cyan('codegraph ui /path/to/indexed/project')}`);
1858
+ console.error('');
1859
+ }
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
+ program
1875
+ .command('ui [path]', { hidden: !(0, viewer_gate_1.viewerEnabled)() })
1876
+ .alias('web')
1877
+ .description('Open the CodeGraph viewer in your browser — read your indexed project as a graph')
1878
+ .option('--port <number>', `Port to listen on (default: ${constants_1.DEFAULT_UI_PORT}, or the next free one)`)
1879
+ .option('--no-open', 'Print the URL instead of opening a browser')
1880
+ .option('--read-only', 'Refuse every write — saved trails can be opened but not saved or deleted')
1881
+ .addHelpText('after', `
1882
+ Examples:
1883
+ $ codegraph ui Read the project you're standing in
1884
+ $ codegraph ui ~/code/my-app Read a specific indexed project
1885
+ $ codegraph ui --port 8080 Use one specific port (fails if it's taken)
1886
+ $ codegraph ui --no-open Just print the URL (headless boxes, SSH)
1887
+ $ codegraph web Same command under its alias
1888
+
1889
+ Pick a symbol and you see who calls it on the left, its source in the middle,
1890
+ and what it calls on the right at the height of the line that calls it. Search
1891
+ with / (or Cmd-K), click a file path for the file's outline and its imports.
1892
+
1893
+ Ask "how does execute reach getFile" (or "execute -> getFile") in the search
1894
+ box for the flow between two symbols: one card per hop, opened at the line that
1895
+ makes the next call, with dynamic-dispatch hops drawn dashed and named. The Map
1896
+ tab draws the whole project by module, with dependencies pointing down.
1897
+
1898
+ Never opened this codebase before? The Entry points tab lists the routes with
1899
+ the symbols that serve them, the files that run something when they load, the
1900
+ tests, and what the most code depends on — and starts a flow from any of them.
1901
+
1902
+ The page keeps up with the project while it is open: save a file and it says so
1903
+ within about a third of a second, and whatever is on screen re-reads the graph
1904
+ when something re-indexes it. It watches for that; it never polls.
1905
+
1906
+ Save a walk you want to keep: name the trail and it is written to
1907
+ .codegraph/ui/trails/ (already gitignored) as plain JSON, listed on the empty
1908
+ screen, and reopened at the symbol you left. Hops are remembered by name rather
1909
+ than by position, so a saved trail survives re-indexing and says which hop moved
1910
+ when one does. Pass --read-only to refuse every write.
1911
+
1912
+ The viewer listens on 127.0.0.1 only, so nothing on your network can reach it.
1913
+ It opens an index that already exists, never indexes, and never changes a line
1914
+ of your code — the one thing it writes is a trail you asked it to save.
1915
+ Requests from any other host are refused, and nothing is sent anywhere: no code,
1916
+ no paths, no analytics.
1917
+
1918
+ Without --port it takes ${constants_1.DEFAULT_UI_PORT}, or the next free port if that one is busy.
1919
+
1920
+ Set ${constants_1.BROWSER_ENV}=<command> to choose which browser opens, or
1921
+ ${constants_1.BROWSER_ENV}=none to never open one.
1922
+ `)
1923
+ .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
+ let requestedPort;
1928
+ if (options.port !== undefined) {
1929
+ requestedPort = Number(options.port);
1930
+ if (!Number.isInteger(requestedPort) || requestedPort < 0 || requestedPort > 65535) {
1931
+ error(`--port must be a whole number between 0 and 65535 (got "${options.port}").`);
1932
+ process.exit(1);
1933
+ }
1934
+ }
1935
+ 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
+ const { validateProjectPath } = await Promise.resolve().then(() => __importStar(require('../utils')));
1940
+ const rootError = validateProjectPath(projectPath);
1941
+ if (rootError) {
1942
+ error(rootError);
1943
+ process.exit(1);
1944
+ }
1945
+ if (!(0, directory_1.isInitialized)(projectPath)) {
1946
+ printNoIndexGuidance(projectPath);
1947
+ process.exit(1);
1948
+ }
1949
+ 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
+ const readOnly = options.readOnly === true;
1954
+ const api = createGraphApi({
1955
+ projectRoot: projectPath,
1956
+ readOnly,
1957
+ readOnlyReason: readOnly
1958
+ ? 'This viewer was started with --read-only, so trails cannot be saved.'
1959
+ : undefined,
1960
+ });
1961
+ let handle;
1962
+ try {
1963
+ handle = await startUiServer({
1964
+ projectRoot: projectPath,
1965
+ port: requestedPort,
1966
+ portFallback: requestedPort === undefined,
1967
+ api: api.handler,
1968
+ });
1969
+ }
1970
+ catch (err) {
1971
+ 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
+ error(err instanceof ViewerMissingError || err instanceof Error ? err.message : String(err));
1975
+ process.exit(1);
1976
+ }
1977
+ console.log('');
1978
+ console.log(chalk.bold('CodeGraph viewer'));
1979
+ console.log('');
1980
+ console.log(` ${chalk.dim('Reading')} ${projectPath}`);
1981
+ console.log(` ${chalk.dim('URL')} ${chalk.cyan(handle.url)}`);
1982
+ console.log(` ${chalk.dim('Access')} this machine only ${(0, glyphs_1.getGlyphs)().dash} ` +
1983
+ (readOnly
1984
+ ? 'read-only, nothing leaves your computer'
1985
+ : 'nothing leaves your computer; saved trails are the only thing written'));
1986
+ console.log('');
1987
+ const opened = options.open === false ? false : openBrowser(handle.url);
1988
+ console.log(opened
1989
+ ? chalk.dim(' Opening your browser... press Ctrl+C to stop.')
1990
+ : chalk.dim(' Open that URL in a browser. Press Ctrl+C to stop.'));
1991
+ 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
+ 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
+ api.close();
1998
+ void handle.close().then(() => process.exit(0));
1999
+ };
2000
+ process.once('SIGINT', shutdown);
2001
+ process.once('SIGTERM', shutdown);
2002
+ });
1704
2003
  /**
1705
2004
  * codegraph serve
1706
2005
  */
@@ -1810,157 +2109,147 @@ function main() {
1810
2109
  }
1811
2110
  });
1812
2111
  /**
1813
- * codegraph callers <symbol>
1814
- *
1815
- * CLI parity with the MCP graph tools (codegraph_callers/callees/impact) so the
1816
- * traversal queries work in scripts, CI, and git hooks without a running MCP
1817
- * server.
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).
1818
2115
  */
1819
- program
1820
- .command('callers <symbol>')
1821
- .description('Find all functions/methods that call a specific symbol')
1822
- .option('-p, --path <path>', 'Project path')
1823
- .option('-l, --limit <number>', 'Maximum results', '20')
1824
- .option('-j, --json', 'Output as JSON')
1825
- .action(async (symbol, options) => {
1826
- const projectPath = resolveProjectPath(options.path);
1827
- try {
1828
- if (!(0, directory_1.isInitialized)(projectPath)) {
1829
- error(`CodeGraph not initialized in ${projectPath}`);
1830
- process.exit(1);
1831
- }
1832
- const { default: CodeGraph } = await loadCodeGraph();
1833
- const cg = await CodeGraph.open(projectPath);
1834
- const limit = parseInt(options.limit || '20', 10);
1835
- const matches = cg.searchNodes(symbol, { limit: 50 });
1836
- if (matches.length === 0) {
1837
- info(`Symbol "${symbol}" not found`);
1838
- cg.destroy();
1839
- return;
1840
- }
1841
- const seen = new Set();
1842
- const allCallers = [];
1843
- for (const match of matches) {
1844
- const exactMatch = match.node.name === symbol || match.node.name.endsWith(`.${symbol}`) || match.node.name.endsWith(`::${symbol}`);
1845
- if (!exactMatch && matches.length > 1)
1846
- continue;
1847
- for (const c of cg.getCallers(match.node.id)) {
1848
- if (!seen.has(c.node.id)) {
1849
- seen.add(c.node.id);
1850
- allCallers.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine });
1851
- }
2116
+ for (const direction of ['callers', 'callees']) {
2117
+ const title = direction === 'callers' ? 'Callers' : 'Callees';
2118
+ program
2119
+ .command(`${direction} <symbol>`)
2120
+ .description(direction === 'callers'
2121
+ ? 'Find all functions/methods that call a specific symbol'
2122
+ : 'Find all functions/methods called by a specific symbol')
2123
+ .option('-p, --path <path>', 'Project path')
2124
+ .option('-f, --file <path>', 'Narrow definitions by file path or suffix (no match: show all with a note)')
2125
+ .option('-l, --limit <number>', 'Maximum results per definition (also caps the JSON union)', '20')
2126
+ .option('-j, --json', 'Output as JSON')
2127
+ .action(async (symbol, options) => {
2128
+ const projectPath = resolveProjectPath(options.path);
2129
+ try {
2130
+ if (!(0, directory_1.isInitialized)(projectPath)) {
2131
+ error(`CodeGraph not initialized in ${projectPath}`);
2132
+ process.exit(1);
1852
2133
  }
1853
- }
1854
- // Fallback: if exact filter removed everything, use the top match
1855
- if (allCallers.length === 0 && matches[0]) {
1856
- for (const c of cg.getCallers(matches[0].node.id)) {
1857
- if (!seen.has(c.node.id)) {
1858
- seen.add(c.node.id);
1859
- allCallers.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine });
2134
+ const { default: CodeGraph } = await loadCodeGraph();
2135
+ const cg = await CodeGraph.open(projectPath);
2136
+ try {
2137
+ const limit = parseInt(options.limit || '20', 10);
2138
+ const { nodes: targets } = (0, symbol_lookup_1.lookupSymbolNodes)(cg, symbol);
2139
+ if (targets.length === 0) {
2140
+ info(formatSymbolNotFound(symbol, cg.searchNodes(symbol, { limit: 5 }).map((m) => m.node.name)));
2141
+ return;
1860
2142
  }
1861
- }
1862
- }
1863
- const limited = allCallers.slice(0, limit);
1864
- if (options.json) {
1865
- console.log(JSON.stringify({ symbol, callers: limited }, null, 2));
1866
- }
1867
- else if (limited.length === 0) {
1868
- info(`No callers found for "${symbol}"`);
1869
- }
1870
- else {
1871
- console.log(chalk.bold(`\nCallers of "${symbol}" (${limited.length}):\n`));
1872
- for (const node of limited) {
1873
- const loc = node.startLine ? `:${node.startLine}` : '';
1874
- console.log(chalk.cyan(node.kind.padEnd(12)) +
1875
- chalk.white(node.name));
1876
- console.log(chalk.dim(` ${node.filePath}${loc}`));
1877
- console.log();
1878
- }
1879
- }
1880
- cg.destroy();
1881
- }
1882
- catch (err) {
1883
- error(`callers failed: ${err instanceof Error ? err.message : String(err)}`);
1884
- process.exit(1);
1885
- }
1886
- });
1887
- /**
1888
- * codegraph callees <symbol>
1889
- */
1890
- program
1891
- .command('callees <symbol>')
1892
- .description('Find all functions/methods that a specific symbol calls')
1893
- .option('-p, --path <path>', 'Project path')
1894
- .option('-l, --limit <number>', 'Maximum results', '20')
1895
- .option('-j, --json', 'Output as JSON')
1896
- .action(async (symbol, options) => {
1897
- const projectPath = resolveProjectPath(options.path);
1898
- try {
1899
- if (!(0, directory_1.isInitialized)(projectPath)) {
1900
- error(`CodeGraph not initialized in ${projectPath}`);
1901
- process.exit(1);
1902
- }
1903
- const { default: CodeGraph } = await loadCodeGraph();
1904
- const cg = await CodeGraph.open(projectPath);
1905
- const limit = parseInt(options.limit || '20', 10);
1906
- const matches = cg.searchNodes(symbol, { limit: 50 });
1907
- if (matches.length === 0) {
1908
- info(`Symbol "${symbol}" not found`);
1909
- cg.destroy();
1910
- return;
1911
- }
1912
- const seen = new Set();
1913
- const allCallees = [];
1914
- for (const match of matches) {
1915
- const exactMatch = match.node.name === symbol || match.node.name.endsWith(`.${symbol}`) || match.node.name.endsWith(`::${symbol}`);
1916
- if (!exactMatch && matches.length > 1)
1917
- continue;
1918
- for (const c of cg.getCallees(match.node.id)) {
1919
- if (!seen.has(c.node.id)) {
1920
- seen.add(c.node.id);
1921
- allCallees.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine });
2143
+ const { groups, filteredOut } = (0, symbol_lookup_1.groupDefinitions)(targets, options.file);
2144
+ const ambiguous = groups.length > 1;
2145
+ const note = filteredOut
2146
+ ? `no definition of "${symbol}" matches file "${options.file}" — showing all definitions instead.`
2147
+ : undefined;
2148
+ const collected = groups.map((group) => {
2149
+ const nodes = new Map();
2150
+ const edges = new Map();
2151
+ 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);
2156
+ }
2157
+ }
2158
+ return { group, nodes: [...nodes.values()], edges: [...edges.values()] };
2159
+ });
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
+ if (options.json) {
2164
+ const definitions = collected.map(({ group, nodes, edges }) => {
2165
+ const limited = nodes.slice(0, limit);
2166
+ const shown = new Set(limited.map((node) => node.id));
2167
+ return {
2168
+ ...cliDefinition(group),
2169
+ [direction]: limited.map((node) => ({ id: node.id, ...cliNode(node), relationships: relationships(node, edges) })),
2170
+ edges: edges.filter((edge) => shown.has(direction === 'callers' ? edge.source : edge.target)),
2171
+ total: nodes.length,
2172
+ limit,
2173
+ truncated: nodes.length > limit,
2174
+ };
2175
+ });
2176
+ const union = new Map();
2177
+ for (const { nodes } of collected) {
2178
+ for (const node of nodes)
2179
+ union.set(node.id, node);
2180
+ }
2181
+ const total = union.size;
2182
+ console.log(JSON.stringify({
2183
+ symbol,
2184
+ targets: groups.flat().map((node) => cliDefinition([node]).definition),
2185
+ ambiguous,
2186
+ aggregation: ambiguous ? 'union' : 'definition',
2187
+ file: options.file,
2188
+ filteredOut,
2189
+ note,
2190
+ definitions,
2191
+ [direction]: [...union.values()].slice(0, limit).map((node) => ({ ...cliNode(node),
2192
+ relationships: relationships(node, collected.flatMap((entry) => entry.edges)) })),
2193
+ total,
2194
+ limit,
2195
+ truncated: total > limit,
2196
+ }, null, 2));
1922
2197
  }
1923
- }
1924
- }
1925
- if (allCallees.length === 0 && matches[0]) {
1926
- for (const c of cg.getCallees(matches[0].node.id)) {
1927
- if (!seen.has(c.node.id)) {
1928
- seen.add(c.node.id);
1929
- allCallees.push({ name: c.node.name, kind: c.node.kind, filePath: c.node.filePath, startLine: c.node.startLine });
2198
+ else {
2199
+ if (note)
2200
+ warn(note);
2201
+ if (ambiguous) {
2202
+ console.log(chalk.bold(`\n${title} of "${symbol}" — ${groups.length} distinct definitions (narrow with --file):`));
2203
+ }
2204
+ for (const { group, nodes, edges } of collected) {
2205
+ const limited = nodes.slice(0, limit);
2206
+ const total = nodes.length;
2207
+ const truncated = total > limit;
2208
+ const count = truncated ? `${limited.length} of ${total}` : String(total);
2209
+ if (ambiguous) {
2210
+ console.log(chalk.bold(`\n${(0, symbol_lookup_1.describeSymbolNode)(group[0])} (${count}):\n`));
2211
+ }
2212
+ else {
2213
+ console.log(chalk.bold(`\n${title} of "${symbol}" (${count}):\n`));
2214
+ console.log(chalk.dim((0, symbol_lookup_1.describeSymbolNode)(group[0])));
2215
+ }
2216
+ if (total === 0) {
2217
+ if (ambiguous)
2218
+ console.log(chalk.dim(` (no ${direction})`));
2219
+ else
2220
+ info(`No ${direction} found for "${symbol}"`);
2221
+ }
2222
+ for (const node of limited) {
2223
+ const loc = node.startLine ? `:${node.startLine}` : '';
2224
+ const kinds = relationships(node, edges).filter((kind) => kind !== 'calls');
2225
+ 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}`));
2228
+ console.log();
2229
+ }
2230
+ if (truncated)
2231
+ console.log(chalk.dim(`Showing ${limited.length} of ${total}; pass --limit to widen.`));
2232
+ }
1930
2233
  }
1931
2234
  }
1932
- }
1933
- const limited = allCallees.slice(0, limit);
1934
- if (options.json) {
1935
- console.log(JSON.stringify({ symbol, callees: limited }, null, 2));
1936
- }
1937
- else if (limited.length === 0) {
1938
- info(`No callees found for "${symbol}"`);
1939
- }
1940
- else {
1941
- console.log(chalk.bold(`\nCallees of "${symbol}" (${limited.length}):\n`));
1942
- for (const node of limited) {
1943
- const loc = node.startLine ? `:${node.startLine}` : '';
1944
- console.log(chalk.cyan(node.kind.padEnd(12)) +
1945
- chalk.white(node.name));
1946
- console.log(chalk.dim(` ${node.filePath}${loc}`));
1947
- console.log();
2235
+ finally {
2236
+ cg.destroy();
1948
2237
  }
1949
2238
  }
1950
- cg.destroy();
1951
- }
1952
- catch (err) {
1953
- error(`callees failed: ${err instanceof Error ? err.message : String(err)}`);
1954
- process.exit(1);
1955
- }
1956
- });
2239
+ catch (err) {
2240
+ error(`${direction} failed: ${err instanceof Error ? err.message : String(err)}`);
2241
+ process.exit(1);
2242
+ }
2243
+ });
2244
+ }
1957
2245
  /**
1958
- * codegraph impact <symbol>
2246
+ * codegraph impact <symbol> — one blast radius per distinct definition.
1959
2247
  */
1960
2248
  program
1961
2249
  .command('impact <symbol>')
1962
2250
  .description('Analyze what code is affected by changing a symbol')
1963
2251
  .option('-p, --path <path>', 'Project path')
2252
+ .option('-f, --file <path>', 'Narrow definitions by file path or suffix (no match: show all with a note)')
1964
2253
  .option('-d, --depth <number>', 'Traversal depth', '2')
1965
2254
  .option('-j, --json', 'Output as JSON')
1966
2255
  .action(async (symbol, options) => {
@@ -1972,72 +2261,95 @@ function main() {
1972
2261
  }
1973
2262
  const { default: CodeGraph } = await loadCodeGraph();
1974
2263
  const cg = await CodeGraph.open(projectPath);
1975
- const depth = Math.min(Math.max(parseInt(options.depth || '2', 10), 1), 10);
1976
- const matches = cg.searchNodes(symbol, { limit: 50 });
1977
- if (matches.length === 0) {
1978
- info(`Symbol "${symbol}" not found`);
1979
- cg.destroy();
1980
- return;
1981
- }
1982
- // Merge impact subgraphs across all exact-matching symbols
1983
- const mergedNodes = new Map();
1984
- const seenEdges = new Set();
1985
- let edgeCount = 0;
1986
- for (const match of matches) {
1987
- const exactMatch = match.node.name === symbol || match.node.name.endsWith(`.${symbol}`) || match.node.name.endsWith(`::${symbol}`);
1988
- if (!exactMatch && matches.length > 1)
1989
- continue;
1990
- const impact = cg.getImpactRadius(match.node.id, depth);
1991
- for (const [id, n] of impact.nodes) {
1992
- mergedNodes.set(id, { name: n.name, kind: n.kind, filePath: n.filePath, startLine: n.startLine });
2264
+ try {
2265
+ const depth = Math.min(Math.max(parseInt(options.depth || '2', 10), 1), 10);
2266
+ const { nodes: targets } = (0, symbol_lookup_1.lookupSymbolNodes)(cg, symbol);
2267
+ if (targets.length === 0) {
2268
+ info(formatSymbolNotFound(symbol, cg.searchNodes(symbol, { limit: 5 }).map((m) => m.node.name)));
2269
+ return;
1993
2270
  }
1994
- for (const e of impact.edges) {
1995
- const key = `${e.source}->${e.target}:${e.kind}`;
1996
- if (!seenEdges.has(key)) {
1997
- seenEdges.add(key);
1998
- edgeCount++;
2271
+ const { groups, filteredOut } = (0, symbol_lookup_1.groupDefinitions)(targets, options.file);
2272
+ const ambiguous = groups.length > 1;
2273
+ const note = filteredOut
2274
+ ? `no definition of "${symbol}" matches file "${options.file}" — showing all definitions instead.`
2275
+ : undefined;
2276
+ const collected = groups.map((group) => {
2277
+ const nodes = new Map();
2278
+ const edges = new Map();
2279
+ for (const target of group) {
2280
+ const impact = cg.getImpactRadius(target.id, depth);
2281
+ for (const [id, node] of impact.nodes)
2282
+ nodes.set(id, node);
2283
+ for (const edge of impact.edges)
2284
+ edges.set(`${edge.source}->${edge.target}:${edge.kind}`, edge);
1999
2285
  }
2286
+ return { group, nodes, edges };
2287
+ });
2288
+ if (options.json) {
2289
+ const unionNodes = new Map();
2290
+ const unionEdges = new Map();
2291
+ const definitions = collected.map(({ group, nodes, edges }) => {
2292
+ for (const [id, node] of nodes)
2293
+ unionNodes.set(id, node);
2294
+ for (const [key, edge] of edges)
2295
+ unionEdges.set(key, edge);
2296
+ return {
2297
+ ...cliDefinition(group),
2298
+ nodeCount: nodes.size,
2299
+ edgeCount: edges.size,
2300
+ affected: [...nodes.values()].map((node) => ({ id: node.id, ...cliNode(node) })),
2301
+ edges: [...edges.values()],
2302
+ };
2303
+ });
2304
+ console.log(JSON.stringify({
2305
+ symbol,
2306
+ depth,
2307
+ targets: groups.flat().map((node) => cliDefinition([node]).definition),
2308
+ ambiguous,
2309
+ aggregation: ambiguous ? 'union' : 'definition',
2310
+ file: options.file,
2311
+ filteredOut,
2312
+ note,
2313
+ definitions,
2314
+ nodeCount: unionNodes.size,
2315
+ edgeCount: unionEdges.size,
2316
+ affected: [...unionNodes.values()].map(cliNode),
2317
+ }, null, 2));
2000
2318
  }
2001
- }
2002
- // Fallback to top match if exact filter removed everything
2003
- if (mergedNodes.size === 0 && matches[0]) {
2004
- const impact = cg.getImpactRadius(matches[0].node.id, depth);
2005
- for (const [id, n] of impact.nodes) {
2006
- mergedNodes.set(id, { name: n.name, kind: n.kind, filePath: n.filePath, startLine: n.startLine });
2007
- }
2008
- edgeCount = impact.edges.length;
2009
- }
2010
- if (options.json) {
2011
- console.log(JSON.stringify({
2012
- symbol,
2013
- depth,
2014
- nodeCount: mergedNodes.size,
2015
- edgeCount,
2016
- affected: Array.from(mergedNodes.values()),
2017
- }, null, 2));
2018
- }
2019
- else if (mergedNodes.size === 0) {
2020
- info(`No affected symbols found for "${symbol}"`);
2021
- }
2022
- else {
2023
- console.log(chalk.bold(`\nImpact of changing "${symbol}" — ${mergedNodes.size} affected symbols:\n`));
2024
- // Group by file
2025
- const byFile = new Map();
2026
- for (const node of mergedNodes.values()) {
2027
- const list = byFile.get(node.filePath) || [];
2028
- list.push({ name: node.name, kind: node.kind, startLine: node.startLine });
2029
- byFile.set(node.filePath, list);
2030
- }
2031
- for (const [file, nodes] of byFile) {
2032
- console.log(chalk.cyan(file));
2033
- for (const node of nodes) {
2034
- const loc = node.startLine ? `:${node.startLine}` : '';
2035
- console.log(` ${chalk.dim(node.kind.padEnd(12))}${node.name}${chalk.dim(loc)}`);
2319
+ else {
2320
+ if (note)
2321
+ warn(note);
2322
+ if (ambiguous) {
2323
+ console.log(chalk.bold(`\nImpact of changing "${symbol}" — ${groups.length} distinct definitions (each with its own blast radius; narrow with --file):`));
2324
+ }
2325
+ for (const { group, nodes } of collected) {
2326
+ if (ambiguous) {
2327
+ console.log(chalk.bold(`\n${(0, symbol_lookup_1.describeSymbolNode)(group[0])} — ${nodes.size} affected symbols:\n`));
2328
+ }
2329
+ else {
2330
+ console.log(chalk.bold(`\nImpact of changing "${symbol}" — ${nodes.size} affected symbols:\n`));
2331
+ console.log(chalk.dim((0, symbol_lookup_1.describeSymbolNode)(group[0])));
2332
+ }
2333
+ const byFile = new Map();
2334
+ for (const node of nodes.values()) {
2335
+ const list = byFile.get(node.filePath) || [];
2336
+ list.push(node);
2337
+ byFile.set(node.filePath, list);
2338
+ }
2339
+ for (const [file, affected] of byFile) {
2340
+ console.log(chalk.cyan(file));
2341
+ for (const node of affected) {
2342
+ const loc = node.startLine ? `:${node.startLine}` : '';
2343
+ console.log(` ${chalk.dim(node.kind.padEnd(12))}${node.name}${chalk.dim(loc)}`);
2344
+ }
2345
+ console.log();
2346
+ }
2036
2347
  }
2037
- console.log();
2038
2348
  }
2039
2349
  }
2040
- cg.destroy();
2350
+ finally {
2351
+ cg.destroy();
2352
+ }
2041
2353
  }
2042
2354
  catch (err) {
2043
2355
  error(`impact failed: ${err instanceof Error ? err.message : String(err)}`);
@@ -2092,15 +2404,6 @@ function main() {
2092
2404
  const { default: CodeGraph } = await loadCodeGraph();
2093
2405
  const cg = await CodeGraph.open(projectPath);
2094
2406
  const maxDepth = parseInt(options.depth || '5', 10);
2095
- // Common test file patterns
2096
- const defaultTestPatterns = [
2097
- /\.spec\./,
2098
- /\.test\./,
2099
- /\/__tests__\//,
2100
- /\/tests?\//,
2101
- /\/e2e\//,
2102
- /\/spec\//,
2103
- ];
2104
2407
  // Custom filter pattern
2105
2408
  let customFilter = null;
2106
2409
  if (options.filter) {
@@ -2112,10 +2415,15 @@ function main() {
2112
2415
  .replace(/\*/g, '[^/]*');
2113
2416
  customFilter = new RegExp(regex);
2114
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.
2115
2423
  function isTestFile(filePath) {
2116
2424
  if (customFilter)
2117
2425
  return customFilter.test(filePath);
2118
- return defaultTestPatterns.some(p => p.test(filePath));
2426
+ return (0, query_utils_1.isTestPath)(filePath);
2119
2427
  }
2120
2428
  // BFS to find all transitive dependents of changed files, filtered to test files
2121
2429
  const affectedTests = new Set();