@colbymchenry/codegraph-darwin-arm64 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (569) hide show
  1. package/bin/codegraph +3 -0
  2. package/lib/dist/bin/codegraph.d.ts +21 -0
  3. package/lib/dist/bin/codegraph.d.ts.map +1 -0
  4. package/lib/dist/bin/codegraph.js +1273 -0
  5. package/lib/dist/bin/codegraph.js.map +1 -0
  6. package/lib/dist/bin/node-version-check.d.ts +37 -0
  7. package/lib/dist/bin/node-version-check.d.ts.map +1 -0
  8. package/lib/dist/bin/node-version-check.js +79 -0
  9. package/lib/dist/bin/node-version-check.js.map +1 -0
  10. package/lib/dist/bin/uninstall.d.ts +14 -0
  11. package/lib/dist/bin/uninstall.d.ts.map +1 -0
  12. package/lib/dist/bin/uninstall.js +36 -0
  13. package/lib/dist/bin/uninstall.js.map +1 -0
  14. package/lib/dist/config.d.ts +51 -0
  15. package/lib/dist/config.d.ts.map +1 -0
  16. package/lib/dist/config.js +321 -0
  17. package/lib/dist/config.js.map +1 -0
  18. package/lib/dist/context/formatter.d.ts +30 -0
  19. package/lib/dist/context/formatter.d.ts.map +1 -0
  20. package/lib/dist/context/formatter.js +244 -0
  21. package/lib/dist/context/formatter.js.map +1 -0
  22. package/lib/dist/context/index.d.ts +97 -0
  23. package/lib/dist/context/index.d.ts.map +1 -0
  24. package/lib/dist/context/index.js +1050 -0
  25. package/lib/dist/context/index.js.map +1 -0
  26. package/lib/dist/db/index.d.ts +83 -0
  27. package/lib/dist/db/index.d.ts.map +1 -0
  28. package/lib/dist/db/index.js +219 -0
  29. package/lib/dist/db/index.js.map +1 -0
  30. package/lib/dist/db/migrations.d.ts +44 -0
  31. package/lib/dist/db/migrations.d.ts.map +1 -0
  32. package/lib/dist/db/migrations.js +131 -0
  33. package/lib/dist/db/migrations.js.map +1 -0
  34. package/lib/dist/db/queries.d.ts +253 -0
  35. package/lib/dist/db/queries.d.ts.map +1 -0
  36. package/lib/dist/db/queries.js +1207 -0
  37. package/lib/dist/db/queries.js.map +1 -0
  38. package/lib/dist/db/schema.sql +151 -0
  39. package/lib/dist/db/sqlite-adapter.d.ts +46 -0
  40. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -0
  41. package/lib/dist/db/sqlite-adapter.js +114 -0
  42. package/lib/dist/db/sqlite-adapter.js.map +1 -0
  43. package/lib/dist/directory.d.ts +57 -0
  44. package/lib/dist/directory.d.ts.map +1 -0
  45. package/lib/dist/directory.js +264 -0
  46. package/lib/dist/directory.js.map +1 -0
  47. package/lib/dist/errors.d.ts +136 -0
  48. package/lib/dist/errors.d.ts.map +1 -0
  49. package/lib/dist/errors.js +219 -0
  50. package/lib/dist/errors.js.map +1 -0
  51. package/lib/dist/extraction/dfm-extractor.d.ts +31 -0
  52. package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -0
  53. package/lib/dist/extraction/dfm-extractor.js +151 -0
  54. package/lib/dist/extraction/dfm-extractor.js.map +1 -0
  55. package/lib/dist/extraction/grammars.d.ts +78 -0
  56. package/lib/dist/extraction/grammars.d.ts.map +1 -0
  57. package/lib/dist/extraction/grammars.js +332 -0
  58. package/lib/dist/extraction/grammars.js.map +1 -0
  59. package/lib/dist/extraction/index.d.ts +130 -0
  60. package/lib/dist/extraction/index.d.ts.map +1 -0
  61. package/lib/dist/extraction/index.js +1305 -0
  62. package/lib/dist/extraction/index.js.map +1 -0
  63. package/lib/dist/extraction/languages/c-cpp.d.ts +4 -0
  64. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  65. package/lib/dist/extraction/languages/c-cpp.js +126 -0
  66. package/lib/dist/extraction/languages/c-cpp.js.map +1 -0
  67. package/lib/dist/extraction/languages/csharp.d.ts +3 -0
  68. package/lib/dist/extraction/languages/csharp.d.ts.map +1 -0
  69. package/lib/dist/extraction/languages/csharp.js +72 -0
  70. package/lib/dist/extraction/languages/csharp.js.map +1 -0
  71. package/lib/dist/extraction/languages/dart.d.ts +3 -0
  72. package/lib/dist/extraction/languages/dart.d.ts.map +1 -0
  73. package/lib/dist/extraction/languages/dart.js +192 -0
  74. package/lib/dist/extraction/languages/dart.js.map +1 -0
  75. package/lib/dist/extraction/languages/go.d.ts +3 -0
  76. package/lib/dist/extraction/languages/go.d.ts.map +1 -0
  77. package/lib/dist/extraction/languages/go.js +58 -0
  78. package/lib/dist/extraction/languages/go.js.map +1 -0
  79. package/lib/dist/extraction/languages/index.d.ts +10 -0
  80. package/lib/dist/extraction/languages/index.d.ts.map +1 -0
  81. package/lib/dist/extraction/languages/index.js +49 -0
  82. package/lib/dist/extraction/languages/index.js.map +1 -0
  83. package/lib/dist/extraction/languages/java.d.ts +3 -0
  84. package/lib/dist/extraction/languages/java.d.ts.map +1 -0
  85. package/lib/dist/extraction/languages/java.js +64 -0
  86. package/lib/dist/extraction/languages/java.js.map +1 -0
  87. package/lib/dist/extraction/languages/javascript.d.ts +3 -0
  88. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -0
  89. package/lib/dist/extraction/languages/javascript.js +90 -0
  90. package/lib/dist/extraction/languages/javascript.js.map +1 -0
  91. package/lib/dist/extraction/languages/kotlin.d.ts +3 -0
  92. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -0
  93. package/lib/dist/extraction/languages/kotlin.js +253 -0
  94. package/lib/dist/extraction/languages/kotlin.js.map +1 -0
  95. package/lib/dist/extraction/languages/lua.d.ts +3 -0
  96. package/lib/dist/extraction/languages/lua.d.ts.map +1 -0
  97. package/lib/dist/extraction/languages/lua.js +150 -0
  98. package/lib/dist/extraction/languages/lua.js.map +1 -0
  99. package/lib/dist/extraction/languages/luau.d.ts +3 -0
  100. package/lib/dist/extraction/languages/luau.d.ts.map +1 -0
  101. package/lib/dist/extraction/languages/luau.js +37 -0
  102. package/lib/dist/extraction/languages/luau.js.map +1 -0
  103. package/lib/dist/extraction/languages/pascal.d.ts +3 -0
  104. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -0
  105. package/lib/dist/extraction/languages/pascal.js +66 -0
  106. package/lib/dist/extraction/languages/pascal.js.map +1 -0
  107. package/lib/dist/extraction/languages/php.d.ts +3 -0
  108. package/lib/dist/extraction/languages/php.d.ts.map +1 -0
  109. package/lib/dist/extraction/languages/php.js +107 -0
  110. package/lib/dist/extraction/languages/php.js.map +1 -0
  111. package/lib/dist/extraction/languages/python.d.ts +3 -0
  112. package/lib/dist/extraction/languages/python.d.ts.map +1 -0
  113. package/lib/dist/extraction/languages/python.js +56 -0
  114. package/lib/dist/extraction/languages/python.js.map +1 -0
  115. package/lib/dist/extraction/languages/ruby.d.ts +3 -0
  116. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -0
  117. package/lib/dist/extraction/languages/ruby.js +114 -0
  118. package/lib/dist/extraction/languages/ruby.js.map +1 -0
  119. package/lib/dist/extraction/languages/rust.d.ts +3 -0
  120. package/lib/dist/extraction/languages/rust.d.ts.map +1 -0
  121. package/lib/dist/extraction/languages/rust.js +109 -0
  122. package/lib/dist/extraction/languages/rust.js.map +1 -0
  123. package/lib/dist/extraction/languages/scala.d.ts +3 -0
  124. package/lib/dist/extraction/languages/scala.d.ts.map +1 -0
  125. package/lib/dist/extraction/languages/scala.js +139 -0
  126. package/lib/dist/extraction/languages/scala.js.map +1 -0
  127. package/lib/dist/extraction/languages/swift.d.ts +3 -0
  128. package/lib/dist/extraction/languages/swift.d.ts.map +1 -0
  129. package/lib/dist/extraction/languages/swift.js +91 -0
  130. package/lib/dist/extraction/languages/swift.js.map +1 -0
  131. package/lib/dist/extraction/languages/typescript.d.ts +3 -0
  132. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -0
  133. package/lib/dist/extraction/languages/typescript.js +129 -0
  134. package/lib/dist/extraction/languages/typescript.js.map +1 -0
  135. package/lib/dist/extraction/liquid-extractor.d.ts +52 -0
  136. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -0
  137. package/lib/dist/extraction/liquid-extractor.js +313 -0
  138. package/lib/dist/extraction/liquid-extractor.js.map +1 -0
  139. package/lib/dist/extraction/parse-worker.d.ts +8 -0
  140. package/lib/dist/extraction/parse-worker.d.ts.map +1 -0
  141. package/lib/dist/extraction/parse-worker.js +94 -0
  142. package/lib/dist/extraction/parse-worker.js.map +1 -0
  143. package/lib/dist/extraction/svelte-extractor.d.ts +56 -0
  144. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -0
  145. package/lib/dist/extraction/svelte-extractor.js +272 -0
  146. package/lib/dist/extraction/svelte-extractor.js.map +1 -0
  147. package/lib/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  148. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  149. package/lib/dist/extraction/tree-sitter-helpers.js +103 -0
  150. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -0
  151. package/lib/dist/extraction/tree-sitter-types.d.ts +179 -0
  152. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  153. package/lib/dist/extraction/tree-sitter-types.js +10 -0
  154. package/lib/dist/extraction/tree-sitter-types.js.map +1 -0
  155. package/lib/dist/extraction/tree-sitter.d.ts +233 -0
  156. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -0
  157. package/lib/dist/extraction/tree-sitter.js +2425 -0
  158. package/lib/dist/extraction/tree-sitter.js.map +1 -0
  159. package/lib/dist/extraction/vue-extractor.d.ts +36 -0
  160. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -0
  161. package/lib/dist/extraction/vue-extractor.js +163 -0
  162. package/lib/dist/extraction/vue-extractor.js.map +1 -0
  163. package/lib/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  164. package/lib/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  165. package/lib/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  166. package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  167. package/lib/dist/graph/index.d.ts +8 -0
  168. package/lib/dist/graph/index.d.ts.map +1 -0
  169. package/lib/dist/graph/index.js +13 -0
  170. package/lib/dist/graph/index.js.map +1 -0
  171. package/lib/dist/graph/queries.d.ts +106 -0
  172. package/lib/dist/graph/queries.d.ts.map +1 -0
  173. package/lib/dist/graph/queries.js +366 -0
  174. package/lib/dist/graph/queries.js.map +1 -0
  175. package/lib/dist/graph/traversal.d.ts +127 -0
  176. package/lib/dist/graph/traversal.d.ts.map +1 -0
  177. package/lib/dist/graph/traversal.js +493 -0
  178. package/lib/dist/graph/traversal.js.map +1 -0
  179. package/lib/dist/index.d.ts +453 -0
  180. package/lib/dist/index.d.ts.map +1 -0
  181. package/lib/dist/index.js +833 -0
  182. package/lib/dist/index.js.map +1 -0
  183. package/lib/dist/installer/claude-md-template.d.ts +14 -0
  184. package/lib/dist/installer/claude-md-template.d.ts.map +1 -0
  185. package/lib/dist/installer/claude-md-template.js +21 -0
  186. package/lib/dist/installer/claude-md-template.js.map +1 -0
  187. package/lib/dist/installer/config-writer.d.ts +29 -0
  188. package/lib/dist/installer/config-writer.d.ts.map +1 -0
  189. package/lib/dist/installer/config-writer.js +111 -0
  190. package/lib/dist/installer/config-writer.js.map +1 -0
  191. package/lib/dist/installer/index.d.ts +65 -0
  192. package/lib/dist/installer/index.d.ts.map +1 -0
  193. package/lib/dist/installer/index.js +406 -0
  194. package/lib/dist/installer/index.js.map +1 -0
  195. package/lib/dist/installer/instructions-template.d.ts +28 -0
  196. package/lib/dist/installer/instructions-template.d.ts.map +1 -0
  197. package/lib/dist/installer/instructions-template.js +64 -0
  198. package/lib/dist/installer/instructions-template.js.map +1 -0
  199. package/lib/dist/installer/targets/claude.d.ts +47 -0
  200. package/lib/dist/installer/targets/claude.d.ts.map +1 -0
  201. package/lib/dist/installer/targets/claude.js +401 -0
  202. package/lib/dist/installer/targets/claude.js.map +1 -0
  203. package/lib/dist/installer/targets/codex.d.ts +18 -0
  204. package/lib/dist/installer/targets/codex.d.ts.map +1 -0
  205. package/lib/dist/installer/targets/codex.js +185 -0
  206. package/lib/dist/installer/targets/codex.js.map +1 -0
  207. package/lib/dist/installer/targets/cursor.d.ts +35 -0
  208. package/lib/dist/installer/targets/cursor.d.ts.map +1 -0
  209. package/lib/dist/installer/targets/cursor.js +229 -0
  210. package/lib/dist/installer/targets/cursor.js.map +1 -0
  211. package/lib/dist/installer/targets/opencode.d.ts +30 -0
  212. package/lib/dist/installer/targets/opencode.d.ts.map +1 -0
  213. package/lib/dist/installer/targets/opencode.js +235 -0
  214. package/lib/dist/installer/targets/opencode.js.map +1 -0
  215. package/lib/dist/installer/targets/registry.d.ts +35 -0
  216. package/lib/dist/installer/targets/registry.d.ts.map +1 -0
  217. package/lib/dist/installer/targets/registry.js +83 -0
  218. package/lib/dist/installer/targets/registry.js.map +1 -0
  219. package/lib/dist/installer/targets/shared.d.ts +77 -0
  220. package/lib/dist/installer/targets/shared.d.ts.map +1 -0
  221. package/lib/dist/installer/targets/shared.js +246 -0
  222. package/lib/dist/installer/targets/shared.js.map +1 -0
  223. package/lib/dist/installer/targets/toml.d.ts +52 -0
  224. package/lib/dist/installer/targets/toml.d.ts.map +1 -0
  225. package/lib/dist/installer/targets/toml.js +147 -0
  226. package/lib/dist/installer/targets/toml.js.map +1 -0
  227. package/lib/dist/installer/targets/types.d.ts +116 -0
  228. package/lib/dist/installer/targets/types.d.ts.map +1 -0
  229. package/lib/dist/installer/targets/types.js +16 -0
  230. package/lib/dist/installer/targets/types.js.map +1 -0
  231. package/lib/dist/mcp/index.d.ts +94 -0
  232. package/lib/dist/mcp/index.d.ts.map +1 -0
  233. package/lib/dist/mcp/index.js +453 -0
  234. package/lib/dist/mcp/index.js.map +1 -0
  235. package/lib/dist/mcp/server-instructions.d.ts +19 -0
  236. package/lib/dist/mcp/server-instructions.d.ts.map +1 -0
  237. package/lib/dist/mcp/server-instructions.js +71 -0
  238. package/lib/dist/mcp/server-instructions.js.map +1 -0
  239. package/lib/dist/mcp/tools.d.ts +257 -0
  240. package/lib/dist/mcp/tools.d.ts.map +1 -0
  241. package/lib/dist/mcp/tools.js +1646 -0
  242. package/lib/dist/mcp/tools.js.map +1 -0
  243. package/lib/dist/mcp/transport.d.ts +106 -0
  244. package/lib/dist/mcp/transport.d.ts.map +1 -0
  245. package/lib/dist/mcp/transport.js +233 -0
  246. package/lib/dist/mcp/transport.js.map +1 -0
  247. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  248. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  249. package/lib/dist/resolution/frameworks/cargo-workspace.js +225 -0
  250. package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  251. package/lib/dist/resolution/frameworks/csharp.d.ts +8 -0
  252. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  253. package/lib/dist/resolution/frameworks/csharp.js +213 -0
  254. package/lib/dist/resolution/frameworks/csharp.js.map +1 -0
  255. package/lib/dist/resolution/frameworks/express.d.ts +8 -0
  256. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -0
  257. package/lib/dist/resolution/frameworks/express.js +225 -0
  258. package/lib/dist/resolution/frameworks/express.js.map +1 -0
  259. package/lib/dist/resolution/frameworks/go.d.ts +8 -0
  260. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -0
  261. package/lib/dist/resolution/frameworks/go.js +158 -0
  262. package/lib/dist/resolution/frameworks/go.js.map +1 -0
  263. package/lib/dist/resolution/frameworks/index.d.ts +42 -0
  264. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -0
  265. package/lib/dist/resolution/frameworks/index.js +133 -0
  266. package/lib/dist/resolution/frameworks/index.js.map +1 -0
  267. package/lib/dist/resolution/frameworks/java.d.ts +8 -0
  268. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -0
  269. package/lib/dist/resolution/frameworks/java.js +177 -0
  270. package/lib/dist/resolution/frameworks/java.js.map +1 -0
  271. package/lib/dist/resolution/frameworks/laravel.d.ts +13 -0
  272. package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  273. package/lib/dist/resolution/frameworks/laravel.js +248 -0
  274. package/lib/dist/resolution/frameworks/laravel.js.map +1 -0
  275. package/lib/dist/resolution/frameworks/nestjs.d.ts +26 -0
  276. package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  277. package/lib/dist/resolution/frameworks/nestjs.js +374 -0
  278. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -0
  279. package/lib/dist/resolution/frameworks/python.d.ts +10 -0
  280. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -0
  281. package/lib/dist/resolution/frameworks/python.js +278 -0
  282. package/lib/dist/resolution/frameworks/python.js.map +1 -0
  283. package/lib/dist/resolution/frameworks/react.d.ts +8 -0
  284. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -0
  285. package/lib/dist/resolution/frameworks/react.js +272 -0
  286. package/lib/dist/resolution/frameworks/react.js.map +1 -0
  287. package/lib/dist/resolution/frameworks/ruby.d.ts +8 -0
  288. package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  289. package/lib/dist/resolution/frameworks/ruby.js +198 -0
  290. package/lib/dist/resolution/frameworks/ruby.js.map +1 -0
  291. package/lib/dist/resolution/frameworks/rust.d.ts +8 -0
  292. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -0
  293. package/lib/dist/resolution/frameworks/rust.js +207 -0
  294. package/lib/dist/resolution/frameworks/rust.js.map +1 -0
  295. package/lib/dist/resolution/frameworks/svelte.d.ts +9 -0
  296. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  297. package/lib/dist/resolution/frameworks/svelte.js +249 -0
  298. package/lib/dist/resolution/frameworks/svelte.js.map +1 -0
  299. package/lib/dist/resolution/frameworks/swift.d.ts +10 -0
  300. package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -0
  301. package/lib/dist/resolution/frameworks/swift.js +376 -0
  302. package/lib/dist/resolution/frameworks/swift.js.map +1 -0
  303. package/lib/dist/resolution/frameworks/vue.d.ts +9 -0
  304. package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -0
  305. package/lib/dist/resolution/frameworks/vue.js +306 -0
  306. package/lib/dist/resolution/frameworks/vue.js.map +1 -0
  307. package/lib/dist/resolution/import-resolver.d.ts +40 -0
  308. package/lib/dist/resolution/import-resolver.d.ts.map +1 -0
  309. package/lib/dist/resolution/import-resolver.js +663 -0
  310. package/lib/dist/resolution/import-resolver.js.map +1 -0
  311. package/lib/dist/resolution/index.d.ts +106 -0
  312. package/lib/dist/resolution/index.d.ts.map +1 -0
  313. package/lib/dist/resolution/index.js +709 -0
  314. package/lib/dist/resolution/index.js.map +1 -0
  315. package/lib/dist/resolution/name-matcher.d.ts +32 -0
  316. package/lib/dist/resolution/name-matcher.d.ts.map +1 -0
  317. package/lib/dist/resolution/name-matcher.js +384 -0
  318. package/lib/dist/resolution/name-matcher.js.map +1 -0
  319. package/lib/dist/resolution/path-aliases.d.ts +68 -0
  320. package/lib/dist/resolution/path-aliases.d.ts.map +1 -0
  321. package/lib/dist/resolution/path-aliases.js +238 -0
  322. package/lib/dist/resolution/path-aliases.js.map +1 -0
  323. package/lib/dist/resolution/strip-comments.d.ts +27 -0
  324. package/lib/dist/resolution/strip-comments.d.ts.map +1 -0
  325. package/lib/dist/resolution/strip-comments.js +441 -0
  326. package/lib/dist/resolution/strip-comments.js.map +1 -0
  327. package/lib/dist/resolution/types.d.ts +172 -0
  328. package/lib/dist/resolution/types.d.ts.map +1 -0
  329. package/lib/dist/resolution/types.js +8 -0
  330. package/lib/dist/resolution/types.js.map +1 -0
  331. package/lib/dist/search/query-parser.d.ts +57 -0
  332. package/lib/dist/search/query-parser.d.ts.map +1 -0
  333. package/lib/dist/search/query-parser.js +177 -0
  334. package/lib/dist/search/query-parser.js.map +1 -0
  335. package/lib/dist/search/query-utils.d.ts +53 -0
  336. package/lib/dist/search/query-utils.d.ts.map +1 -0
  337. package/lib/dist/search/query-utils.js +350 -0
  338. package/lib/dist/search/query-utils.js.map +1 -0
  339. package/lib/dist/sync/git-hooks.d.ts +45 -0
  340. package/lib/dist/sync/git-hooks.d.ts.map +1 -0
  341. package/lib/dist/sync/git-hooks.js +223 -0
  342. package/lib/dist/sync/git-hooks.js.map +1 -0
  343. package/lib/dist/sync/index.d.ts +17 -0
  344. package/lib/dist/sync/index.d.ts.map +1 -0
  345. package/lib/dist/sync/index.js +28 -0
  346. package/lib/dist/sync/index.js.map +1 -0
  347. package/lib/dist/sync/watch-policy.d.ts +48 -0
  348. package/lib/dist/sync/watch-policy.d.ts.map +1 -0
  349. package/lib/dist/sync/watch-policy.js +124 -0
  350. package/lib/dist/sync/watch-policy.js.map +1 -0
  351. package/lib/dist/sync/watcher.d.ts +81 -0
  352. package/lib/dist/sync/watcher.d.ts.map +1 -0
  353. package/lib/dist/sync/watcher.js +194 -0
  354. package/lib/dist/sync/watcher.js.map +1 -0
  355. package/lib/dist/types.d.ts +423 -0
  356. package/lib/dist/types.d.ts.map +1 -0
  357. package/lib/dist/types.js +262 -0
  358. package/lib/dist/types.js.map +1 -0
  359. package/lib/dist/ui/glyphs.d.ts +42 -0
  360. package/lib/dist/ui/glyphs.d.ts.map +1 -0
  361. package/lib/dist/ui/glyphs.js +78 -0
  362. package/lib/dist/ui/glyphs.js.map +1 -0
  363. package/lib/dist/ui/shimmer-progress.d.ts +11 -0
  364. package/lib/dist/ui/shimmer-progress.d.ts.map +1 -0
  365. package/lib/dist/ui/shimmer-progress.js +90 -0
  366. package/lib/dist/ui/shimmer-progress.js.map +1 -0
  367. package/lib/dist/ui/shimmer-worker.d.ts +2 -0
  368. package/lib/dist/ui/shimmer-worker.d.ts.map +1 -0
  369. package/lib/dist/ui/shimmer-worker.js +118 -0
  370. package/lib/dist/ui/shimmer-worker.js.map +1 -0
  371. package/lib/dist/ui/types.d.ts +17 -0
  372. package/lib/dist/ui/types.d.ts.map +1 -0
  373. package/lib/dist/ui/types.js +3 -0
  374. package/lib/dist/ui/types.js.map +1 -0
  375. package/lib/dist/utils.d.ts +205 -0
  376. package/lib/dist/utils.d.ts.map +1 -0
  377. package/lib/dist/utils.js +549 -0
  378. package/lib/dist/utils.js.map +1 -0
  379. package/lib/node_modules/.package-lock.json +116 -0
  380. package/lib/node_modules/@clack/core/CHANGELOG.md +348 -0
  381. package/lib/node_modules/@clack/core/LICENSE +9 -0
  382. package/lib/node_modules/@clack/core/README.md +22 -0
  383. package/lib/node_modules/@clack/core/dist/index.d.mts +363 -0
  384. package/lib/node_modules/@clack/core/dist/index.mjs +17 -0
  385. package/lib/node_modules/@clack/core/dist/index.mjs.map +1 -0
  386. package/lib/node_modules/@clack/core/package.json +63 -0
  387. package/lib/node_modules/@clack/prompts/CHANGELOG.md +591 -0
  388. package/lib/node_modules/@clack/prompts/LICENSE +9 -0
  389. package/lib/node_modules/@clack/prompts/README.md +375 -0
  390. package/lib/node_modules/@clack/prompts/dist/index.d.mts +396 -0
  391. package/lib/node_modules/@clack/prompts/dist/index.mjs +144 -0
  392. package/lib/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
  393. package/lib/node_modules/@clack/prompts/package.json +68 -0
  394. package/lib/node_modules/commander/LICENSE +22 -0
  395. package/lib/node_modules/commander/Readme.md +1176 -0
  396. package/lib/node_modules/commander/esm.mjs +16 -0
  397. package/lib/node_modules/commander/index.js +24 -0
  398. package/lib/node_modules/commander/lib/argument.js +150 -0
  399. package/lib/node_modules/commander/lib/command.js +2777 -0
  400. package/lib/node_modules/commander/lib/error.js +39 -0
  401. package/lib/node_modules/commander/lib/help.js +747 -0
  402. package/lib/node_modules/commander/lib/option.js +380 -0
  403. package/lib/node_modules/commander/lib/suggestSimilar.js +101 -0
  404. package/lib/node_modules/commander/package-support.json +19 -0
  405. package/lib/node_modules/commander/package.json +82 -0
  406. package/lib/node_modules/commander/typings/esm.d.mts +3 -0
  407. package/lib/node_modules/commander/typings/index.d.ts +1113 -0
  408. package/lib/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  409. package/lib/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  410. package/lib/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  411. package/lib/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  412. package/lib/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  413. package/lib/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  414. package/lib/node_modules/fast-string-truncated-width/license +21 -0
  415. package/lib/node_modules/fast-string-truncated-width/package.json +35 -0
  416. package/lib/node_modules/fast-string-truncated-width/readme.md +59 -0
  417. package/lib/node_modules/fast-string-width/dist/index.d.ts +4 -0
  418. package/lib/node_modules/fast-string-width/dist/index.js +14 -0
  419. package/lib/node_modules/fast-string-width/license +21 -0
  420. package/lib/node_modules/fast-string-width/package.json +34 -0
  421. package/lib/node_modules/fast-string-width/readme.md +42 -0
  422. package/lib/node_modules/fast-wrap-ansi/LICENSE +23 -0
  423. package/lib/node_modules/fast-wrap-ansi/README.md +26 -0
  424. package/lib/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  425. package/lib/node_modules/fast-wrap-ansi/lib/main.js +219 -0
  426. package/lib/node_modules/fast-wrap-ansi/lib/main.js.map +1 -0
  427. package/lib/node_modules/fast-wrap-ansi/package.json +51 -0
  428. package/lib/node_modules/jsonc-parser/CHANGELOG.md +76 -0
  429. package/lib/node_modules/jsonc-parser/LICENSE.md +21 -0
  430. package/lib/node_modules/jsonc-parser/README.md +364 -0
  431. package/lib/node_modules/jsonc-parser/SECURITY.md +41 -0
  432. package/lib/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
  433. package/lib/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
  434. package/lib/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
  435. package/lib/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
  436. package/lib/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
  437. package/lib/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
  438. package/lib/node_modules/jsonc-parser/lib/esm/main.js +178 -0
  439. package/lib/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
  440. package/lib/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
  441. package/lib/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
  442. package/lib/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
  443. package/lib/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
  444. package/lib/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
  445. package/lib/node_modules/jsonc-parser/lib/umd/main.js +194 -0
  446. package/lib/node_modules/jsonc-parser/package.json +37 -0
  447. package/lib/node_modules/picomatch/LICENSE +21 -0
  448. package/lib/node_modules/picomatch/README.md +738 -0
  449. package/lib/node_modules/picomatch/index.js +17 -0
  450. package/lib/node_modules/picomatch/lib/constants.js +180 -0
  451. package/lib/node_modules/picomatch/lib/parse.js +1085 -0
  452. package/lib/node_modules/picomatch/lib/picomatch.js +341 -0
  453. package/lib/node_modules/picomatch/lib/scan.js +391 -0
  454. package/lib/node_modules/picomatch/lib/utils.js +72 -0
  455. package/lib/node_modules/picomatch/package.json +83 -0
  456. package/lib/node_modules/picomatch/posix.js +3 -0
  457. package/lib/node_modules/sisteransi/license +21 -0
  458. package/lib/node_modules/sisteransi/package.json +34 -0
  459. package/lib/node_modules/sisteransi/readme.md +113 -0
  460. package/lib/node_modules/sisteransi/src/index.js +58 -0
  461. package/lib/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
  462. package/lib/node_modules/tree-sitter-wasms/LICENSE +24 -0
  463. package/lib/node_modules/tree-sitter-wasms/README.md +23 -0
  464. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-bash.wasm +0 -0
  465. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c.wasm +0 -0
  466. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c_sharp.wasm +0 -0
  467. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-cpp.wasm +0 -0
  468. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-css.wasm +0 -0
  469. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-dart.wasm +0 -0
  470. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elisp.wasm +0 -0
  471. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elixir.wasm +0 -0
  472. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elm.wasm +0 -0
  473. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-embedded_template.wasm +0 -0
  474. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-go.wasm +0 -0
  475. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-html.wasm +0 -0
  476. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-java.wasm +0 -0
  477. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-javascript.wasm +0 -0
  478. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-json.wasm +0 -0
  479. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-kotlin.wasm +0 -0
  480. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-lua.wasm +0 -0
  481. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-objc.wasm +0 -0
  482. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ocaml.wasm +0 -0
  483. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-php.wasm +0 -0
  484. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm +0 -0
  485. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ql.wasm +0 -0
  486. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rescript.wasm +0 -0
  487. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ruby.wasm +0 -0
  488. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rust.wasm +0 -0
  489. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-scala.wasm +0 -0
  490. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-solidity.wasm +0 -0
  491. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-swift.wasm +0 -0
  492. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-systemrdl.wasm +0 -0
  493. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tlaplus.wasm +0 -0
  494. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-toml.wasm +0 -0
  495. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tsx.wasm +0 -0
  496. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-typescript.wasm +0 -0
  497. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-vue.wasm +0 -0
  498. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-yaml.wasm +0 -0
  499. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-zig.wasm +0 -0
  500. package/lib/node_modules/tree-sitter-wasms/package.json +64 -0
  501. package/lib/node_modules/web-tree-sitter/LICENSE +21 -0
  502. package/lib/node_modules/web-tree-sitter/README.md +269 -0
  503. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs +4558 -0
  504. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs.map +7 -0
  505. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js +4516 -0
  506. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js.map +7 -0
  507. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm +0 -0
  508. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm.map +31 -0
  509. package/lib/node_modules/web-tree-sitter/lib/alloc.c +48 -0
  510. package/lib/node_modules/web-tree-sitter/lib/alloc.h +41 -0
  511. package/lib/node_modules/web-tree-sitter/lib/array.h +291 -0
  512. package/lib/node_modules/web-tree-sitter/lib/atomic.h +68 -0
  513. package/lib/node_modules/web-tree-sitter/lib/clock.h +146 -0
  514. package/lib/node_modules/web-tree-sitter/lib/error_costs.h +11 -0
  515. package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.c +523 -0
  516. package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.h +36 -0
  517. package/lib/node_modules/web-tree-sitter/lib/host.h +21 -0
  518. package/lib/node_modules/web-tree-sitter/lib/language.c +293 -0
  519. package/lib/node_modules/web-tree-sitter/lib/language.h +293 -0
  520. package/lib/node_modules/web-tree-sitter/lib/length.h +52 -0
  521. package/lib/node_modules/web-tree-sitter/lib/lexer.c +483 -0
  522. package/lib/node_modules/web-tree-sitter/lib/lexer.h +54 -0
  523. package/lib/node_modules/web-tree-sitter/lib/lib.c +12 -0
  524. package/lib/node_modules/web-tree-sitter/lib/node.c +875 -0
  525. package/lib/node_modules/web-tree-sitter/lib/parser.c +2297 -0
  526. package/lib/node_modules/web-tree-sitter/lib/parser.h +286 -0
  527. package/lib/node_modules/web-tree-sitter/lib/point.h +48 -0
  528. package/lib/node_modules/web-tree-sitter/lib/query.c +4347 -0
  529. package/lib/node_modules/web-tree-sitter/lib/reduce_action.h +34 -0
  530. package/lib/node_modules/web-tree-sitter/lib/reusable_node.h +95 -0
  531. package/lib/node_modules/web-tree-sitter/lib/stack.c +912 -0
  532. package/lib/node_modules/web-tree-sitter/lib/stack.h +133 -0
  533. package/lib/node_modules/web-tree-sitter/lib/subtree.c +1034 -0
  534. package/lib/node_modules/web-tree-sitter/lib/subtree.h +399 -0
  535. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.c +987 -0
  536. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.cjs +2988 -0
  537. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm +0 -0
  538. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm.map +1 -0
  539. package/lib/node_modules/web-tree-sitter/lib/tree.c +170 -0
  540. package/lib/node_modules/web-tree-sitter/lib/tree.h +31 -0
  541. package/lib/node_modules/web-tree-sitter/lib/tree_cursor.c +716 -0
  542. package/lib/node_modules/web-tree-sitter/lib/tree_cursor.h +48 -0
  543. package/lib/node_modules/web-tree-sitter/lib/ts_assert.h +11 -0
  544. package/lib/node_modules/web-tree-sitter/lib/unicode.h +75 -0
  545. package/lib/node_modules/web-tree-sitter/lib/wasm_store.c +1937 -0
  546. package/lib/node_modules/web-tree-sitter/lib/wasm_store.h +31 -0
  547. package/lib/node_modules/web-tree-sitter/package.json +98 -0
  548. package/lib/node_modules/web-tree-sitter/src/bindings.ts +26 -0
  549. package/lib/node_modules/web-tree-sitter/src/constants.ts +133 -0
  550. package/lib/node_modules/web-tree-sitter/src/index.ts +31 -0
  551. package/lib/node_modules/web-tree-sitter/src/language.ts +291 -0
  552. package/lib/node_modules/web-tree-sitter/src/lookahead_iterator.ts +75 -0
  553. package/lib/node_modules/web-tree-sitter/src/marshal.ts +176 -0
  554. package/lib/node_modules/web-tree-sitter/src/node.ts +646 -0
  555. package/lib/node_modules/web-tree-sitter/src/parser.ts +325 -0
  556. package/lib/node_modules/web-tree-sitter/src/query.ts +973 -0
  557. package/lib/node_modules/web-tree-sitter/src/tree.ts +145 -0
  558. package/lib/node_modules/web-tree-sitter/src/tree_cursor.ts +318 -0
  559. package/lib/node_modules/web-tree-sitter/tree-sitter.cjs +4031 -0
  560. package/lib/node_modules/web-tree-sitter/tree-sitter.cjs.map +7 -0
  561. package/lib/node_modules/web-tree-sitter/tree-sitter.js +3980 -0
  562. package/lib/node_modules/web-tree-sitter/tree-sitter.js.map +7 -0
  563. package/lib/node_modules/web-tree-sitter/tree-sitter.wasm +0 -0
  564. package/lib/node_modules/web-tree-sitter/tree-sitter.wasm.map +30 -0
  565. package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1030 -0
  566. package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +56 -0
  567. package/lib/package.json +55 -0
  568. package/node +0 -0
  569. package/package.json +17 -0
@@ -0,0 +1,1273 @@
1
+ #!/usr/bin/env node
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 init [path] Initialize CodeGraph in a project
12
+ * codegraph uninit [path] Remove CodeGraph from a project
13
+ * codegraph index [path] Index all files in the project
14
+ * codegraph sync [path] Sync changes since last index
15
+ * codegraph status [path] Show index status
16
+ * codegraph query <search> Search for symbols
17
+ * codegraph files [options] Show project file structure
18
+ * codegraph context <task> Build context for a task
19
+ * codegraph affected [files] Find test files affected by changes
20
+ */
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || (function () {
38
+ var ownKeys = function(o) {
39
+ ownKeys = Object.getOwnPropertyNames || function (o) {
40
+ var ar = [];
41
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
42
+ return ar;
43
+ };
44
+ return ownKeys(o);
45
+ };
46
+ return function (mod) {
47
+ if (mod && mod.__esModule) return mod;
48
+ var result = {};
49
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
50
+ __setModuleDefault(result, mod);
51
+ return result;
52
+ };
53
+ })();
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ const commander_1 = require("commander");
56
+ const path = __importStar(require("path"));
57
+ const fs = __importStar(require("fs"));
58
+ const directory_1 = require("../directory");
59
+ const shimmer_progress_1 = require("../ui/shimmer-progress");
60
+ const glyphs_1 = require("../ui/glyphs");
61
+ const node_version_check_1 = require("./node-version-check");
62
+ // Lazy-load heavy modules (CodeGraph, runInstaller) to keep CLI startup fast.
63
+ async function loadCodeGraph() {
64
+ try {
65
+ return await Promise.resolve().then(() => __importStar(require('../index')));
66
+ }
67
+ catch (err) {
68
+ const msg = err instanceof Error ? err.message : String(err);
69
+ console.error(`\x1b[31m${(0, glyphs_1.getGlyphs)().err}\x1b[0m Failed to load CodeGraph modules.`);
70
+ console.error(`\n Node: ${process.version} Platform: ${process.platform} ${process.arch}`);
71
+ console.error(`\n Error: ${msg}`);
72
+ console.error('\n Try reinstalling with: npm install -g @colbymchenry/codegraph\n');
73
+ process.exit(1);
74
+ }
75
+ }
76
+ // Dynamic import helper — tsc compiles import() to require() in CJS mode,
77
+ // which fails for ESM-only packages. This bypasses the transformation.
78
+ // eslint-disable-next-line @typescript-eslint/no-implied-eval
79
+ const importESM = new Function('specifier', 'return import(specifier)');
80
+ // Block CodeGraph on Node.js 25.x — V8's turboshaft WASM JIT has a Zone
81
+ // allocator bug that reliably crashes when compiling tree-sitter
82
+ // grammars (see #54, #81, #140). The previous behaviour was a soft
83
+ // console.warn that scrolls off-screen before the OOM crash 30 seconds
84
+ // later, leading to a steady stream of "what is this OOM" reports.
85
+ // Hard-exit before any WASM work; allow override via env var for users
86
+ // who patched V8 themselves or want to test a future fix.
87
+ const nodeVersion = process.versions.node;
88
+ const nodeMajor = parseInt(nodeVersion.split('.')[0] ?? '0', 10);
89
+ if (nodeMajor >= 25) {
90
+ process.stderr.write((0, node_version_check_1.buildNode25BlockBanner)(nodeVersion) + '\n');
91
+ if (!process.env.CODEGRAPH_ALLOW_UNSAFE_NODE) {
92
+ process.exit(1);
93
+ }
94
+ // Override active — banner shown for visibility, continuing.
95
+ }
96
+ // Enforce the supported Node floor. `engines` in package.json only *warns* on
97
+ // install (unless engine-strict), so hard-block here to actually keep users off
98
+ // unsupported versions. Mirrors the 25+ block above. See package.json `engines`.
99
+ if (nodeMajor < node_version_check_1.MIN_NODE_MAJOR) {
100
+ process.stderr.write((0, node_version_check_1.buildNodeTooOldBanner)(nodeVersion) + '\n');
101
+ if (!process.env.CODEGRAPH_ALLOW_UNSAFE_NODE) {
102
+ process.exit(1);
103
+ }
104
+ // Override active — banner shown for visibility, continuing.
105
+ }
106
+ // Check if running with no arguments - run installer
107
+ if (process.argv.length === 2) {
108
+ Promise.resolve().then(() => __importStar(require('../installer'))).then(({ runInstaller }) => runInstaller()).catch((err) => {
109
+ console.error('Installation failed:', err instanceof Error ? err.message : String(err));
110
+ process.exit(1);
111
+ });
112
+ }
113
+ else {
114
+ // Normal CLI flow
115
+ main();
116
+ }
117
+ process.on('uncaughtException', (error) => {
118
+ console.error('[CodeGraph] Uncaught exception:', error);
119
+ });
120
+ process.on('unhandledRejection', (reason) => {
121
+ console.error('[CodeGraph] Unhandled rejection:', reason);
122
+ });
123
+ function main() {
124
+ const program = new commander_1.Command();
125
+ // Version from package.json
126
+ const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'package.json'), 'utf-8'));
127
+ // =============================================================================
128
+ // ANSI Color Helpers (avoid chalk ESM issues)
129
+ // =============================================================================
130
+ const colors = {
131
+ reset: '\x1b[0m',
132
+ bold: '\x1b[1m',
133
+ dim: '\x1b[2m',
134
+ red: '\x1b[31m',
135
+ green: '\x1b[32m',
136
+ yellow: '\x1b[33m',
137
+ blue: '\x1b[34m',
138
+ cyan: '\x1b[36m',
139
+ white: '\x1b[37m',
140
+ gray: '\x1b[90m',
141
+ };
142
+ const chalk = {
143
+ bold: (s) => `${colors.bold}${s}${colors.reset}`,
144
+ dim: (s) => `${colors.dim}${s}${colors.reset}`,
145
+ red: (s) => `${colors.red}${s}${colors.reset}`,
146
+ green: (s) => `${colors.green}${s}${colors.reset}`,
147
+ yellow: (s) => `${colors.yellow}${s}${colors.reset}`,
148
+ blue: (s) => `${colors.blue}${s}${colors.reset}`,
149
+ cyan: (s) => `${colors.cyan}${s}${colors.reset}`,
150
+ white: (s) => `${colors.white}${s}${colors.reset}`,
151
+ gray: (s) => `${colors.gray}${s}${colors.reset}`,
152
+ };
153
+ program
154
+ .name('codegraph')
155
+ .description('Code intelligence and knowledge graph for any codebase')
156
+ .version(packageJson.version);
157
+ // =============================================================================
158
+ // Helper Functions
159
+ // =============================================================================
160
+ /**
161
+ * Resolve project path from argument or current directory
162
+ * Walks up parent directories to find nearest initialized CodeGraph project
163
+ * (must have .codegraph/codegraph.db, not just .codegraph/lessons.db)
164
+ */
165
+ function resolveProjectPath(pathArg) {
166
+ const absolutePath = path.resolve(pathArg || process.cwd());
167
+ // If exact path is initialized (has codegraph.db), use it
168
+ if ((0, directory_1.isInitialized)(absolutePath)) {
169
+ return absolutePath;
170
+ }
171
+ // Walk up to find nearest parent with CodeGraph initialized
172
+ // Note: findNearestCodeGraphRoot finds any .codegraph folder, but we need one with codegraph.db
173
+ let current = absolutePath;
174
+ const root = path.parse(current).root;
175
+ while (current !== root) {
176
+ const parent = path.dirname(current);
177
+ if (parent === current)
178
+ break;
179
+ current = parent;
180
+ if ((0, directory_1.isInitialized)(current)) {
181
+ return current;
182
+ }
183
+ }
184
+ // Not found - return original path (will fail later with helpful error)
185
+ return absolutePath;
186
+ }
187
+ /**
188
+ * Format a number with commas
189
+ */
190
+ function formatNumber(n) {
191
+ return n.toLocaleString();
192
+ }
193
+ /**
194
+ * Format duration in milliseconds to human readable
195
+ */
196
+ function formatDuration(ms) {
197
+ if (ms < 1000) {
198
+ return `${ms}ms`;
199
+ }
200
+ const seconds = ms / 1000;
201
+ if (seconds < 60) {
202
+ return `${seconds.toFixed(1)}s`;
203
+ }
204
+ const minutes = Math.floor(seconds / 60);
205
+ const remainingSeconds = seconds % 60;
206
+ return `${minutes}m ${remainingSeconds.toFixed(0)}s`;
207
+ }
208
+ // Shimmer progress renderer (runs in a worker thread for smooth animation)
209
+ // Imported at top of file from '../ui/shimmer-progress'
210
+ /**
211
+ * Create a plain-text progress callback for --verbose mode.
212
+ * No animations, no ANSI tricks — just timestamped lines to stdout.
213
+ */
214
+ function createVerboseProgress() {
215
+ let lastPhase = '';
216
+ let lastPct = -1;
217
+ const startTime = Date.now();
218
+ return (progress) => {
219
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
220
+ if (progress.phase !== lastPhase) {
221
+ lastPhase = progress.phase;
222
+ lastPct = -1;
223
+ console.log(`[${elapsed}s] Phase: ${progress.phase}`);
224
+ }
225
+ if (progress.total > 0) {
226
+ const pct = Math.floor((progress.current / progress.total) * 100);
227
+ // Log every 5% to keep output manageable
228
+ if (pct >= lastPct + 5 || progress.current === progress.total) {
229
+ lastPct = pct;
230
+ console.log(`[${elapsed}s] ${progress.current}/${progress.total} (${pct}%)${progress.currentFile ? ` ${(0, glyphs_1.getGlyphs)().dash} ${progress.currentFile}` : ''}`);
231
+ }
232
+ }
233
+ else if (progress.current > 0) {
234
+ // Scanning phase (no total yet) — log periodically
235
+ if (progress.current % 1000 === 0 || progress.current === 1) {
236
+ console.log(`[${elapsed}s] ${formatNumber(progress.current)} files found`);
237
+ }
238
+ }
239
+ };
240
+ }
241
+ /**
242
+ * Print success message
243
+ */
244
+ function success(message) {
245
+ console.log(chalk.green((0, glyphs_1.getGlyphs)().ok) + ' ' + message);
246
+ }
247
+ /**
248
+ * Print error message
249
+ */
250
+ function error(message) {
251
+ console.error(chalk.red((0, glyphs_1.getGlyphs)().err) + ' ' + message);
252
+ }
253
+ /**
254
+ * Print info message
255
+ */
256
+ function info(message) {
257
+ console.log(chalk.blue((0, glyphs_1.getGlyphs)().info) + ' ' + message);
258
+ }
259
+ /**
260
+ * Print warning message
261
+ */
262
+ function warn(message) {
263
+ console.log(chalk.yellow((0, glyphs_1.getGlyphs)().warn) + ' ' + message);
264
+ }
265
+ /**
266
+ * Print indexing results using clack log methods
267
+ */
268
+ function printIndexResult(clack, result, projectPath) {
269
+ const hasErrors = result.filesErrored > 0;
270
+ // Surface non-file-level failures (e.g. lock-acquisition failure
271
+ // when another indexer is running) before the file-count branches.
272
+ // Without this the CLI falls through to "No files found to index",
273
+ // which is actively misleading — the index DID run, it just couldn't
274
+ // get the lock.
275
+ //
276
+ // If success is false but no severity:'error' entry exists in
277
+ // `result.errors` (degenerate case — shouldn't happen in practice
278
+ // but worth guarding because the result shape is plumbed through
279
+ // multiple call sites), fall back to a generic message rather than
280
+ // continuing to the misleading "No files found" branch or throwing.
281
+ if (!result.success && !hasErrors && result.filesIndexed === 0) {
282
+ const generic = result.errors.find((e) => e.severity === 'error');
283
+ clack.log.error(generic?.message ?? `Indexing failed ${(0, glyphs_1.getGlyphs)().dash} no further details available`);
284
+ return;
285
+ }
286
+ if (result.filesIndexed > 0) {
287
+ if (hasErrors) {
288
+ clack.log.success(`Indexed ${formatNumber(result.filesIndexed)} files (${formatNumber(result.filesErrored)} could not be parsed)`);
289
+ }
290
+ else {
291
+ clack.log.success(`Indexed ${formatNumber(result.filesIndexed)} files`);
292
+ }
293
+ clack.log.info(`${formatNumber(result.nodesCreated)} nodes, ${formatNumber(result.edgesCreated)} edges in ${formatDuration(result.durationMs)}`);
294
+ }
295
+ else if (hasErrors) {
296
+ clack.log.error(`Indexing failed ${(0, glyphs_1.getGlyphs)().dash} all ${formatNumber(result.filesErrored)} files had errors`);
297
+ }
298
+ else {
299
+ clack.log.warn('No files found to index');
300
+ }
301
+ if (hasErrors) {
302
+ const errorsByCode = new Map();
303
+ for (const err of result.errors) {
304
+ if (err.severity === 'error') {
305
+ const code = err.code || 'unknown';
306
+ errorsByCode.set(code, (errorsByCode.get(code) || 0) + 1);
307
+ }
308
+ }
309
+ const codeLabels = {
310
+ parse_error: 'files failed to parse',
311
+ read_error: 'files could not be read',
312
+ size_exceeded: 'files exceeded size limit',
313
+ path_traversal: 'blocked paths',
314
+ unsupported_language: 'unsupported language',
315
+ parser_error: 'parser initialization failures',
316
+ };
317
+ const breakdown = Array.from(errorsByCode)
318
+ .map(([code, count]) => `${formatNumber(count)} ${codeLabels[code] || code}`)
319
+ .join('\n');
320
+ clack.note(breakdown, 'Error breakdown');
321
+ if (projectPath) {
322
+ writeErrorLog(projectPath, result.errors);
323
+ clack.log.info('See .codegraph/errors.log for details');
324
+ }
325
+ if (result.filesIndexed > 0) {
326
+ clack.log.info(`The index is fully usable ${(0, glyphs_1.getGlyphs)().dash} only the failed files are missing.`);
327
+ }
328
+ }
329
+ else if (projectPath) {
330
+ const logPath = path.join(projectPath, '.codegraph', 'errors.log');
331
+ if (fs.existsSync(logPath)) {
332
+ fs.unlinkSync(logPath);
333
+ }
334
+ }
335
+ }
336
+ /**
337
+ * Write detailed error log to .codegraph/errors.log
338
+ */
339
+ function writeErrorLog(projectPath, errors) {
340
+ const cgDir = path.join(projectPath, '.codegraph');
341
+ if (!fs.existsSync(cgDir))
342
+ return;
343
+ const logPath = path.join(cgDir, 'errors.log');
344
+ // Group errors by file path
345
+ const errorsByFile = new Map();
346
+ const noFileErrors = [];
347
+ for (const err of errors) {
348
+ if (err.severity !== 'error')
349
+ continue;
350
+ if (err.filePath) {
351
+ let list = errorsByFile.get(err.filePath);
352
+ if (!list) {
353
+ list = [];
354
+ errorsByFile.set(err.filePath, list);
355
+ }
356
+ list.push({ message: err.message, code: err.code });
357
+ }
358
+ else {
359
+ noFileErrors.push({ message: err.message, code: err.code });
360
+ }
361
+ }
362
+ const lines = [
363
+ `CodeGraph Error Log - ${new Date().toISOString()}`,
364
+ `${errorsByFile.size} files with errors`,
365
+ '',
366
+ ];
367
+ for (const [filePath, fileErrors] of errorsByFile) {
368
+ for (const err of fileErrors) {
369
+ lines.push(`${filePath}: ${err.message}`);
370
+ }
371
+ }
372
+ for (const err of noFileErrors) {
373
+ lines.push(err.message);
374
+ }
375
+ fs.writeFileSync(logPath, lines.join('\n') + '\n');
376
+ }
377
+ // =============================================================================
378
+ // Commands
379
+ // =============================================================================
380
+ /**
381
+ * codegraph init [path]
382
+ */
383
+ program
384
+ .command('init [path]')
385
+ .description('Initialize CodeGraph in a project directory')
386
+ .option('-i, --index', 'Run initial indexing after initialization')
387
+ .option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
388
+ .action(async (pathArg, options) => {
389
+ const projectPath = path.resolve(pathArg || process.cwd());
390
+ const clack = await importESM('@clack/prompts');
391
+ clack.intro('Initializing CodeGraph');
392
+ try {
393
+ if ((0, directory_1.isInitialized)(projectPath)) {
394
+ clack.log.warn(`Already initialized in ${projectPath}`);
395
+ clack.log.info('Use "codegraph index" to re-index or "codegraph sync" to update');
396
+ // Re-run agent surface wiring so re-running `init` is the
397
+ // documented way to recover a project that's missing its
398
+ // Cursor rules file (or future per-agent project surfaces).
399
+ try {
400
+ const { wireProjectSurfacesForGlobalAgents } = await Promise.resolve().then(() => __importStar(require('../installer')));
401
+ for (const { target, file } of wireProjectSurfacesForGlobalAgents()) {
402
+ clack.log.success(`${target.displayName}: ${file.action} ${file.path}`);
403
+ }
404
+ }
405
+ catch { /* non-fatal */ }
406
+ try {
407
+ const { offerWatchFallback } = await Promise.resolve().then(() => __importStar(require('../installer')));
408
+ await offerWatchFallback(clack, projectPath);
409
+ }
410
+ catch { /* non-fatal */ }
411
+ clack.outro('');
412
+ return;
413
+ }
414
+ const { default: CodeGraph } = await loadCodeGraph();
415
+ const cg = await CodeGraph.init(projectPath, { index: false });
416
+ clack.log.success(`Initialized in ${projectPath}`);
417
+ // Bootstrap project-local surfaces for any agent that's
418
+ // configured globally (Cursor needs ./.cursor/rules/codegraph.mdc
419
+ // to actually prefer codegraph over native grep). Silent when
420
+ // there's nothing to write.
421
+ try {
422
+ const { wireProjectSurfacesForGlobalAgents } = await Promise.resolve().then(() => __importStar(require('../installer')));
423
+ for (const { target, file } of wireProjectSurfacesForGlobalAgents()) {
424
+ clack.log.success(`${target.displayName}: ${file.action} ${file.path}`);
425
+ }
426
+ }
427
+ catch (err) {
428
+ const msg = err instanceof Error ? err.message : String(err);
429
+ clack.log.warn(`Skipped wiring project-local agent surfaces: ${msg}`);
430
+ }
431
+ if (options.index) {
432
+ let result;
433
+ if (options.verbose) {
434
+ result = await cg.indexAll({
435
+ onProgress: createVerboseProgress(),
436
+ verbose: true,
437
+ });
438
+ }
439
+ else {
440
+ process.stdout.write(`${colors.dim}${(0, glyphs_1.getGlyphs)().rail}${colors.reset}\n`);
441
+ const progress = (0, shimmer_progress_1.createShimmerProgress)();
442
+ result = await cg.indexAll({
443
+ onProgress: progress.onProgress,
444
+ });
445
+ await progress.stop();
446
+ }
447
+ printIndexResult(clack, result, projectPath);
448
+ }
449
+ else {
450
+ clack.log.info('Run "codegraph index" to index the project');
451
+ }
452
+ try {
453
+ const { offerWatchFallback } = await Promise.resolve().then(() => __importStar(require('../installer')));
454
+ await offerWatchFallback(clack, projectPath);
455
+ }
456
+ catch { /* non-fatal */ }
457
+ clack.outro('Done');
458
+ cg.destroy();
459
+ }
460
+ catch (err) {
461
+ clack.log.error(`Failed: ${err instanceof Error ? err.message : String(err)}`);
462
+ process.exit(1);
463
+ }
464
+ });
465
+ /**
466
+ * codegraph uninit [path]
467
+ */
468
+ program
469
+ .command('uninit [path]')
470
+ .description('Remove CodeGraph from a project (deletes .codegraph/ directory)')
471
+ .option('-f, --force', 'Skip confirmation prompt')
472
+ .action(async (pathArg, options) => {
473
+ const projectPath = resolveProjectPath(pathArg);
474
+ try {
475
+ if (!(0, directory_1.isInitialized)(projectPath)) {
476
+ warn(`CodeGraph is not initialized in ${projectPath}`);
477
+ return;
478
+ }
479
+ if (!options.force) {
480
+ // Confirm with user
481
+ const readline = await Promise.resolve().then(() => __importStar(require('readline')));
482
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
483
+ const answer = await new Promise((resolve) => {
484
+ rl.question(chalk.yellow(`${(0, glyphs_1.getGlyphs)().warn} This will permanently delete all CodeGraph data. Continue? (y/N) `), resolve);
485
+ });
486
+ rl.close();
487
+ if (answer.toLowerCase() !== 'y') {
488
+ info('Cancelled');
489
+ return;
490
+ }
491
+ }
492
+ const { default: CodeGraph } = await loadCodeGraph();
493
+ const cg = CodeGraph.openSync(projectPath);
494
+ cg.uninitialize();
495
+ // Clean up any git sync hooks we installed (no-op if none / not a repo).
496
+ try {
497
+ const { removeGitSyncHook } = await Promise.resolve().then(() => __importStar(require('../sync/git-hooks')));
498
+ const removed = removeGitSyncHook(projectPath);
499
+ if (removed.installed.length > 0) {
500
+ info(`Removed git ${removed.installed.join(', ')} sync hook${removed.installed.length > 1 ? 's' : ''}`);
501
+ }
502
+ }
503
+ catch { /* non-fatal */ }
504
+ success(`Removed CodeGraph from ${projectPath}`);
505
+ }
506
+ catch (err) {
507
+ error(`Failed to uninitialize: ${err instanceof Error ? err.message : String(err)}`);
508
+ process.exit(1);
509
+ }
510
+ });
511
+ /**
512
+ * codegraph index [path]
513
+ */
514
+ program
515
+ .command('index [path]')
516
+ .description('Index all files in the project')
517
+ .option('-f, --force', 'Force full re-index even if already indexed')
518
+ .option('-q, --quiet', 'Suppress progress output')
519
+ .option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
520
+ .action(async (pathArg, options) => {
521
+ const projectPath = resolveProjectPath(pathArg);
522
+ try {
523
+ if (!(0, directory_1.isInitialized)(projectPath)) {
524
+ error(`CodeGraph not initialized in ${projectPath}`);
525
+ info('Run "codegraph init" first');
526
+ process.exit(1);
527
+ }
528
+ const { default: CodeGraph } = await loadCodeGraph();
529
+ const cg = await CodeGraph.open(projectPath);
530
+ if (options.quiet) {
531
+ // Quiet mode: no UI, just run
532
+ if (options.force)
533
+ cg.clear();
534
+ const result = await cg.indexAll();
535
+ if (!result.success)
536
+ process.exit(1);
537
+ cg.destroy();
538
+ return;
539
+ }
540
+ const clack = await importESM('@clack/prompts');
541
+ clack.intro('Indexing project');
542
+ if (options.force) {
543
+ cg.clear();
544
+ clack.log.info('Cleared existing index');
545
+ }
546
+ let result;
547
+ if (options.verbose) {
548
+ result = await cg.indexAll({
549
+ onProgress: createVerboseProgress(),
550
+ verbose: true,
551
+ });
552
+ }
553
+ else {
554
+ process.stdout.write(`${colors.dim}${(0, glyphs_1.getGlyphs)().rail}${colors.reset}\n`);
555
+ const progress = (0, shimmer_progress_1.createShimmerProgress)();
556
+ result = await cg.indexAll({
557
+ onProgress: progress.onProgress,
558
+ });
559
+ await progress.stop();
560
+ }
561
+ printIndexResult(clack, result, projectPath);
562
+ if (!result.success) {
563
+ process.exit(1);
564
+ }
565
+ clack.outro('Done');
566
+ cg.destroy();
567
+ }
568
+ catch (err) {
569
+ error(`Failed to index: ${err instanceof Error ? err.message : String(err)}`);
570
+ process.exit(1);
571
+ }
572
+ });
573
+ /**
574
+ * codegraph sync [path]
575
+ */
576
+ program
577
+ .command('sync [path]')
578
+ .description('Sync changes since last index')
579
+ .option('-q, --quiet', 'Suppress output (for git hooks)')
580
+ .action(async (pathArg, options) => {
581
+ const projectPath = resolveProjectPath(pathArg);
582
+ try {
583
+ if (!(0, directory_1.isInitialized)(projectPath)) {
584
+ if (!options.quiet) {
585
+ error(`CodeGraph not initialized in ${projectPath}`);
586
+ }
587
+ process.exit(1);
588
+ }
589
+ const { default: CodeGraph } = await loadCodeGraph();
590
+ const cg = await CodeGraph.open(projectPath);
591
+ if (options.quiet) {
592
+ await cg.sync();
593
+ cg.destroy();
594
+ return;
595
+ }
596
+ const clack = await importESM('@clack/prompts');
597
+ clack.intro('Syncing CodeGraph');
598
+ process.stdout.write(`${colors.dim}${(0, glyphs_1.getGlyphs)().rail}${colors.reset}\n`);
599
+ const progress = (0, shimmer_progress_1.createShimmerProgress)();
600
+ const result = await cg.sync({
601
+ onProgress: progress.onProgress,
602
+ });
603
+ await progress.stop();
604
+ const totalChanges = result.filesAdded + result.filesModified + result.filesRemoved;
605
+ if (totalChanges === 0) {
606
+ clack.log.info('Already up to date');
607
+ }
608
+ else {
609
+ clack.log.success(`Synced ${formatNumber(totalChanges)} changed files`);
610
+ const details = [];
611
+ if (result.filesAdded > 0)
612
+ details.push(`Added: ${result.filesAdded}`);
613
+ if (result.filesModified > 0)
614
+ details.push(`Modified: ${result.filesModified}`);
615
+ if (result.filesRemoved > 0)
616
+ details.push(`Removed: ${result.filesRemoved}`);
617
+ clack.log.info(`${details.join(', ')} ${(0, glyphs_1.getGlyphs)().dash} ${formatNumber(result.nodesUpdated)} nodes in ${formatDuration(result.durationMs)}`);
618
+ }
619
+ clack.outro('Done');
620
+ cg.destroy();
621
+ }
622
+ catch (err) {
623
+ if (!options.quiet) {
624
+ error(`Failed to sync: ${err instanceof Error ? err.message : String(err)}`);
625
+ }
626
+ process.exit(1);
627
+ }
628
+ });
629
+ /**
630
+ * codegraph status [path]
631
+ */
632
+ program
633
+ .command('status [path]')
634
+ .description('Show index status and statistics')
635
+ .option('-j, --json', 'Output as JSON')
636
+ .action(async (pathArg, options) => {
637
+ const projectPath = resolveProjectPath(pathArg);
638
+ try {
639
+ if (!(0, directory_1.isInitialized)(projectPath)) {
640
+ if (options.json) {
641
+ console.log(JSON.stringify({ initialized: false, projectPath }));
642
+ return;
643
+ }
644
+ console.log(chalk.bold('\nCodeGraph Status\n'));
645
+ info(`Project: ${projectPath}`);
646
+ warn('Not initialized');
647
+ info('Run "codegraph init" to initialize');
648
+ return;
649
+ }
650
+ const { default: CodeGraph } = await loadCodeGraph();
651
+ const cg = await CodeGraph.open(projectPath);
652
+ const stats = cg.getStats();
653
+ const changes = cg.getChangedFiles();
654
+ const backend = cg.getBackend();
655
+ const journalMode = cg.getJournalMode();
656
+ // JSON output mode
657
+ if (options.json) {
658
+ console.log(JSON.stringify({
659
+ initialized: true,
660
+ projectPath,
661
+ fileCount: stats.fileCount,
662
+ nodeCount: stats.nodeCount,
663
+ edgeCount: stats.edgeCount,
664
+ dbSizeBytes: stats.dbSizeBytes,
665
+ backend,
666
+ journalMode,
667
+ nodesByKind: stats.nodesByKind,
668
+ languages: Object.entries(stats.filesByLanguage).filter(([, count]) => count > 0).map(([lang]) => lang),
669
+ pendingChanges: {
670
+ added: changes.added.length,
671
+ modified: changes.modified.length,
672
+ removed: changes.removed.length,
673
+ },
674
+ }));
675
+ cg.destroy();
676
+ return;
677
+ }
678
+ console.log(chalk.bold('\nCodeGraph Status\n'));
679
+ // Project info
680
+ console.log(chalk.cyan('Project:'), projectPath);
681
+ console.log();
682
+ // Index stats
683
+ console.log(chalk.bold('Index Statistics:'));
684
+ console.log(` Files: ${formatNumber(stats.fileCount)}`);
685
+ console.log(` Nodes: ${formatNumber(stats.nodeCount)}`);
686
+ console.log(` Edges: ${formatNumber(stats.edgeCount)}`);
687
+ console.log(` DB Size: ${(stats.dbSizeBytes / 1024 / 1024).toFixed(2)} MB`);
688
+ // Surface the active SQLite backend (node:sqlite — Node's built-in real
689
+ // SQLite, full WAL + FTS5, no native build).
690
+ const backendLabel = chalk.green(`node:sqlite ${(0, glyphs_1.getGlyphs)().dash} built-in (full WAL)`);
691
+ console.log(` Backend: ${backendLabel}`);
692
+ // Effective journal mode: 'wal' means concurrent reads never block on a
693
+ // writer; anything else means they can ("database is locked"). node:sqlite
694
+ // supports WAL everywhere, so a non-wal mode means the filesystem can't
695
+ // (network mounts, WSL2 /mnt). See issue #238.
696
+ const journalLabel = journalMode === 'wal'
697
+ ? chalk.green('wal')
698
+ : chalk.yellow(`${journalMode || 'unknown'} ${(0, glyphs_1.getGlyphs)().dash} WAL inactive; reads can block on writes`);
699
+ console.log(` Journal: ${journalLabel}`);
700
+ console.log();
701
+ // Node breakdown
702
+ console.log(chalk.bold('Nodes by Kind:'));
703
+ const nodesByKind = Object.entries(stats.nodesByKind)
704
+ .filter(([, count]) => count > 0)
705
+ .sort((a, b) => b[1] - a[1]);
706
+ for (const [kind, count] of nodesByKind) {
707
+ console.log(` ${kind.padEnd(15)} ${formatNumber(count)}`);
708
+ }
709
+ console.log();
710
+ // Language breakdown
711
+ console.log(chalk.bold('Files by Language:'));
712
+ const filesByLang = Object.entries(stats.filesByLanguage)
713
+ .filter(([, count]) => count > 0)
714
+ .sort((a, b) => b[1] - a[1]);
715
+ for (const [lang, count] of filesByLang) {
716
+ console.log(` ${lang.padEnd(15)} ${formatNumber(count)}`);
717
+ }
718
+ console.log();
719
+ // Pending changes
720
+ const totalChanges = changes.added.length + changes.modified.length + changes.removed.length;
721
+ if (totalChanges > 0) {
722
+ console.log(chalk.bold('Pending Changes:'));
723
+ if (changes.added.length > 0) {
724
+ console.log(` Added: ${changes.added.length} files`);
725
+ }
726
+ if (changes.modified.length > 0) {
727
+ console.log(` Modified: ${changes.modified.length} files`);
728
+ }
729
+ if (changes.removed.length > 0) {
730
+ console.log(` Removed: ${changes.removed.length} files`);
731
+ }
732
+ info('Run "codegraph sync" to update the index');
733
+ }
734
+ else {
735
+ success('Index is up to date');
736
+ }
737
+ console.log();
738
+ cg.destroy();
739
+ }
740
+ catch (err) {
741
+ error(`Failed to get status: ${err instanceof Error ? err.message : String(err)}`);
742
+ process.exit(1);
743
+ }
744
+ });
745
+ /**
746
+ * codegraph query <search>
747
+ */
748
+ program
749
+ .command('query <search>')
750
+ .description('Search for symbols in the codebase')
751
+ .option('-p, --path <path>', 'Project path')
752
+ .option('-l, --limit <number>', 'Maximum results', '10')
753
+ .option('-k, --kind <kind>', 'Filter by node kind (function, class, etc.)')
754
+ .option('-j, --json', 'Output as JSON')
755
+ .action(async (search, options) => {
756
+ const projectPath = resolveProjectPath(options.path);
757
+ try {
758
+ if (!(0, directory_1.isInitialized)(projectPath)) {
759
+ error(`CodeGraph not initialized in ${projectPath}`);
760
+ process.exit(1);
761
+ }
762
+ const { default: CodeGraph } = await loadCodeGraph();
763
+ const cg = await CodeGraph.open(projectPath);
764
+ const limit = parseInt(options.limit || '10', 10);
765
+ const results = cg.searchNodes(search, {
766
+ limit,
767
+ kinds: options.kind ? [options.kind] : undefined,
768
+ });
769
+ if (options.json) {
770
+ console.log(JSON.stringify(results, null, 2));
771
+ }
772
+ else {
773
+ if (results.length === 0) {
774
+ info(`No results found for "${search}"`);
775
+ }
776
+ else {
777
+ console.log(chalk.bold(`\nSearch Results for "${search}":\n`));
778
+ for (const result of results) {
779
+ const node = result.node;
780
+ const location = `${node.filePath}:${node.startLine}`;
781
+ const score = chalk.dim(`(${(result.score * 100).toFixed(0)}%)`);
782
+ console.log(chalk.cyan(node.kind.padEnd(12)) +
783
+ chalk.white(node.name) +
784
+ ' ' + score);
785
+ console.log(chalk.dim(` ${location}`));
786
+ if (node.signature) {
787
+ console.log(chalk.dim(` ${node.signature}`));
788
+ }
789
+ console.log();
790
+ }
791
+ }
792
+ }
793
+ cg.destroy();
794
+ }
795
+ catch (err) {
796
+ error(`Search failed: ${err instanceof Error ? err.message : String(err)}`);
797
+ process.exit(1);
798
+ }
799
+ });
800
+ /**
801
+ * codegraph files [path]
802
+ */
803
+ program
804
+ .command('files')
805
+ .description('Show project file structure from the index')
806
+ .option('-p, --path <path>', 'Project path')
807
+ .option('--filter <dir>', 'Filter to files under this directory')
808
+ .option('--pattern <glob>', 'Filter files matching this glob pattern')
809
+ .option('--format <format>', 'Output format (tree, flat, grouped)', 'tree')
810
+ .option('--max-depth <number>', 'Maximum directory depth for tree format')
811
+ .option('--no-metadata', 'Hide file metadata (language, symbol count)')
812
+ .option('-j, --json', 'Output as JSON')
813
+ .action(async (options) => {
814
+ const projectPath = resolveProjectPath(options.path);
815
+ try {
816
+ if (!(0, directory_1.isInitialized)(projectPath)) {
817
+ error(`CodeGraph not initialized in ${projectPath}`);
818
+ process.exit(1);
819
+ }
820
+ const { default: CodeGraph } = await loadCodeGraph();
821
+ const cg = await CodeGraph.open(projectPath);
822
+ let files = cg.getFiles();
823
+ if (files.length === 0) {
824
+ info('No files indexed. Run "codegraph index" first.');
825
+ cg.destroy();
826
+ return;
827
+ }
828
+ // Filter by path prefix
829
+ if (options.filter) {
830
+ const filter = options.filter;
831
+ files = files.filter(f => f.path.startsWith(filter) || f.path.startsWith('./' + filter));
832
+ }
833
+ // Filter by glob pattern
834
+ if (options.pattern) {
835
+ const regex = globToRegex(options.pattern);
836
+ files = files.filter(f => regex.test(f.path));
837
+ }
838
+ if (files.length === 0) {
839
+ info('No files found matching the criteria.');
840
+ cg.destroy();
841
+ return;
842
+ }
843
+ // JSON output
844
+ if (options.json) {
845
+ const output = files.map(f => ({
846
+ path: f.path,
847
+ language: f.language,
848
+ nodeCount: f.nodeCount,
849
+ size: f.size,
850
+ }));
851
+ console.log(JSON.stringify(output, null, 2));
852
+ cg.destroy();
853
+ return;
854
+ }
855
+ const includeMetadata = options.metadata !== false;
856
+ const format = options.format || 'tree';
857
+ const maxDepth = options.maxDepth ? parseInt(options.maxDepth, 10) : undefined;
858
+ // Format output
859
+ switch (format) {
860
+ case 'flat':
861
+ console.log(chalk.bold(`\nFiles (${files.length}):\n`));
862
+ for (const file of files.sort((a, b) => a.path.localeCompare(b.path))) {
863
+ if (includeMetadata) {
864
+ console.log(` ${file.path} ${chalk.dim(`(${file.language}, ${file.nodeCount} symbols)`)}`);
865
+ }
866
+ else {
867
+ console.log(` ${file.path}`);
868
+ }
869
+ }
870
+ break;
871
+ case 'grouped':
872
+ console.log(chalk.bold(`\nFiles by Language (${files.length} total):\n`));
873
+ const byLang = new Map();
874
+ for (const file of files) {
875
+ const existing = byLang.get(file.language) || [];
876
+ existing.push(file);
877
+ byLang.set(file.language, existing);
878
+ }
879
+ const sortedLangs = [...byLang.entries()].sort((a, b) => b[1].length - a[1].length);
880
+ for (const [lang, langFiles] of sortedLangs) {
881
+ console.log(chalk.cyan(`${lang} (${langFiles.length}):`));
882
+ for (const file of langFiles.sort((a, b) => a.path.localeCompare(b.path))) {
883
+ if (includeMetadata) {
884
+ console.log(` ${file.path} ${chalk.dim(`(${file.nodeCount} symbols)`)}`);
885
+ }
886
+ else {
887
+ console.log(` ${file.path}`);
888
+ }
889
+ }
890
+ console.log();
891
+ }
892
+ break;
893
+ case 'tree':
894
+ default:
895
+ console.log(chalk.bold(`\nProject Structure (${files.length} files):\n`));
896
+ printFileTree(files, includeMetadata, maxDepth, chalk);
897
+ break;
898
+ }
899
+ console.log();
900
+ cg.destroy();
901
+ }
902
+ catch (err) {
903
+ error(`Failed to list files: ${err instanceof Error ? err.message : String(err)}`);
904
+ process.exit(1);
905
+ }
906
+ });
907
+ /**
908
+ * Convert glob pattern to regex
909
+ */
910
+ function globToRegex(pattern) {
911
+ const escaped = pattern
912
+ .replace(/[.+^${}()|[\]\\]/g, '\\$&')
913
+ .replace(/\*\*/g, '{{GLOBSTAR}}')
914
+ .replace(/\*/g, '[^/]*')
915
+ .replace(/\?/g, '[^/]')
916
+ .replace(/\{\{GLOBSTAR\}\}/g, '.*');
917
+ return new RegExp(escaped);
918
+ }
919
+ /**
920
+ * Print files as a tree
921
+ */
922
+ function printFileTree(files, includeMetadata, maxDepth, chalk) {
923
+ const root = { name: '', children: new Map() };
924
+ for (const file of files) {
925
+ const parts = file.path.split('/');
926
+ let current = root;
927
+ for (let i = 0; i < parts.length; i++) {
928
+ const part = parts[i];
929
+ if (!part)
930
+ continue;
931
+ if (!current.children.has(part)) {
932
+ current.children.set(part, { name: part, children: new Map() });
933
+ }
934
+ current = current.children.get(part);
935
+ if (i === parts.length - 1) {
936
+ current.file = { language: file.language, nodeCount: file.nodeCount };
937
+ }
938
+ }
939
+ }
940
+ const renderNode = (node, prefix, isLast, depth) => {
941
+ if (maxDepth !== undefined && depth > maxDepth)
942
+ return;
943
+ const glyphs = (0, glyphs_1.getGlyphs)();
944
+ const connector = isLast ? glyphs.treeLast : glyphs.treeBranch;
945
+ const childPrefix = isLast ? ' ' : glyphs.treePipe;
946
+ if (node.name) {
947
+ let line = prefix + connector + node.name;
948
+ if (node.file && includeMetadata) {
949
+ line += chalk.dim(` (${node.file.language}, ${node.file.nodeCount} symbols)`);
950
+ }
951
+ console.log(line);
952
+ }
953
+ const children = [...node.children.values()];
954
+ children.sort((a, b) => {
955
+ const aIsDir = a.children.size > 0 && !a.file;
956
+ const bIsDir = b.children.size > 0 && !b.file;
957
+ if (aIsDir !== bIsDir)
958
+ return aIsDir ? -1 : 1;
959
+ return a.name.localeCompare(b.name);
960
+ });
961
+ for (let i = 0; i < children.length; i++) {
962
+ const child = children[i];
963
+ const nextPrefix = node.name ? prefix + childPrefix : prefix;
964
+ renderNode(child, nextPrefix, i === children.length - 1, depth + 1);
965
+ }
966
+ };
967
+ renderNode(root, '', true, 0);
968
+ }
969
+ /**
970
+ * codegraph context <task>
971
+ */
972
+ program
973
+ .command('context <task>')
974
+ .description('Build context for a task (outputs markdown)')
975
+ .option('-p, --path <path>', 'Project path')
976
+ .option('-n, --max-nodes <number>', 'Maximum nodes to include', '50')
977
+ .option('-c, --max-code <number>', 'Maximum code blocks', '10')
978
+ .option('--no-code', 'Exclude code blocks')
979
+ .option('-f, --format <format>', 'Output format (markdown, json)', 'markdown')
980
+ .action(async (task, options) => {
981
+ const projectPath = resolveProjectPath(options.path);
982
+ try {
983
+ if (!(0, directory_1.isInitialized)(projectPath)) {
984
+ error(`CodeGraph not initialized in ${projectPath}`);
985
+ process.exit(1);
986
+ }
987
+ const { default: CodeGraph } = await loadCodeGraph();
988
+ const cg = await CodeGraph.open(projectPath);
989
+ const context = await cg.buildContext(task, {
990
+ maxNodes: parseInt(options.maxNodes || '50', 10),
991
+ maxCodeBlocks: parseInt(options.maxCode || '10', 10),
992
+ includeCode: options.code !== false,
993
+ format: options.format,
994
+ });
995
+ // Output the context
996
+ console.log(context);
997
+ cg.destroy();
998
+ }
999
+ catch (err) {
1000
+ error(`Failed to build context: ${err instanceof Error ? err.message : String(err)}`);
1001
+ process.exit(1);
1002
+ }
1003
+ });
1004
+ /**
1005
+ * codegraph serve
1006
+ */
1007
+ program
1008
+ .command('serve')
1009
+ .description('Start CodeGraph as an MCP server for AI assistants')
1010
+ .option('-p, --path <path>', 'Project path (optional for MCP mode, uses rootUri from client)')
1011
+ .option('--mcp', 'Run as MCP server (stdio transport)')
1012
+ .option('--no-watch', 'Disable the file watcher (no auto-sync; useful on slow filesystems like WSL2 /mnt drives)')
1013
+ .action(async (options) => {
1014
+ const projectPath = options.path ? resolveProjectPath(options.path) : undefined;
1015
+ // Commander sets watch=false when --no-watch is passed. Route it through
1016
+ // the same env-var chokepoint the watcher and MCP server already honor.
1017
+ if (options.watch === false) {
1018
+ process.env.CODEGRAPH_NO_WATCH = '1';
1019
+ }
1020
+ try {
1021
+ if (options.mcp) {
1022
+ // Start MCP server - it handles initialization lazily based on rootUri from client
1023
+ const { MCPServer } = await Promise.resolve().then(() => __importStar(require('../mcp/index')));
1024
+ const server = new MCPServer(projectPath);
1025
+ await server.start();
1026
+ // Server will run until terminated
1027
+ }
1028
+ else {
1029
+ // Default: show info about MCP mode.
1030
+ // Use stderr so stdout stays clean for any piped/stdio usage.
1031
+ console.error(chalk.bold('\nCodeGraph MCP Server\n'));
1032
+ console.error(chalk.blue((0, glyphs_1.getGlyphs)().info) + ' Use --mcp flag to start the MCP server');
1033
+ console.error('\nTo use with Claude Code, add to your MCP configuration:');
1034
+ console.error(chalk.dim(`
1035
+ {
1036
+ "mcpServers": {
1037
+ "codegraph": {
1038
+ "command": "codegraph",
1039
+ "args": ["serve", "--mcp"]
1040
+ }
1041
+ }
1042
+ }
1043
+ `));
1044
+ console.error('Available tools:');
1045
+ console.error(chalk.cyan(' codegraph_search') + ' - Search for code symbols');
1046
+ console.error(chalk.cyan(' codegraph_context') + ' - Build context for a task');
1047
+ console.error(chalk.cyan(' codegraph_callers') + ' - Find callers of a symbol');
1048
+ console.error(chalk.cyan(' codegraph_callees') + ' - Find what a symbol calls');
1049
+ console.error(chalk.cyan(' codegraph_impact') + ' - Analyze impact of changes');
1050
+ console.error(chalk.cyan(' codegraph_node') + ' - Get symbol details');
1051
+ console.error(chalk.cyan(' codegraph_files') + ' - Get project file structure');
1052
+ console.error(chalk.cyan(' codegraph_status') + ' - Get index status');
1053
+ }
1054
+ }
1055
+ catch (err) {
1056
+ error(`Failed to start server: ${err instanceof Error ? err.message : String(err)}`);
1057
+ process.exit(1);
1058
+ }
1059
+ });
1060
+ /**
1061
+ * codegraph unlock [path]
1062
+ */
1063
+ program
1064
+ .command('unlock [path]')
1065
+ .description('Remove a stale lock file that is blocking indexing')
1066
+ .action(async (pathArg) => {
1067
+ const projectPath = resolveProjectPath(pathArg);
1068
+ try {
1069
+ if (!(0, directory_1.isInitialized)(projectPath)) {
1070
+ error(`CodeGraph not initialized in ${projectPath}`);
1071
+ return;
1072
+ }
1073
+ const lockPath = path.join((0, directory_1.getCodeGraphDir)(projectPath), 'codegraph.lock');
1074
+ if (!fs.existsSync(lockPath)) {
1075
+ info(`No lock file found ${(0, glyphs_1.getGlyphs)().dash} nothing to do`);
1076
+ return;
1077
+ }
1078
+ fs.unlinkSync(lockPath);
1079
+ success('Removed lock file. You can now run indexing again.');
1080
+ }
1081
+ catch (err) {
1082
+ error(`Failed to remove lock: ${err instanceof Error ? err.message : String(err)}`);
1083
+ process.exit(1);
1084
+ }
1085
+ });
1086
+ /**
1087
+ * codegraph affected [files...]
1088
+ *
1089
+ * Find test files affected by the given source files.
1090
+ * Traces dependency edges transitively to find test files that depend on changed code.
1091
+ *
1092
+ * Usage:
1093
+ * git diff --name-only | codegraph affected --stdin
1094
+ * codegraph affected src/lib/components/Editor.svelte src/routes/+page.svelte
1095
+ */
1096
+ program
1097
+ .command('affected [files...]')
1098
+ .description('Find test files affected by changed source files')
1099
+ .option('-p, --path <path>', 'Project path')
1100
+ .option('--stdin', 'Read file list from stdin (one per line)')
1101
+ .option('-d, --depth <number>', 'Max dependency traversal depth', '5')
1102
+ .option('-f, --filter <glob>', 'Custom glob filter for test files (e.g. "e2e/*.spec.ts")')
1103
+ .option('-j, --json', 'Output as JSON')
1104
+ .option('-q, --quiet', 'Only output file paths, no decoration')
1105
+ .action(async (fileArgs, options) => {
1106
+ const projectPath = resolveProjectPath(options.path);
1107
+ try {
1108
+ if (!(0, directory_1.isInitialized)(projectPath)) {
1109
+ error(`CodeGraph not initialized in ${projectPath}`);
1110
+ process.exit(1);
1111
+ }
1112
+ // Collect changed files from args or stdin
1113
+ let changedFiles = [...(fileArgs || [])];
1114
+ if (options.stdin) {
1115
+ const stdinData = fs.readFileSync(0, 'utf-8');
1116
+ const stdinFiles = stdinData.split('\n').map(f => f.trim()).filter(Boolean);
1117
+ changedFiles.push(...stdinFiles);
1118
+ }
1119
+ if (changedFiles.length === 0) {
1120
+ if (!options.quiet)
1121
+ info('No files provided. Use file arguments or --stdin.');
1122
+ process.exit(0);
1123
+ }
1124
+ const { default: CodeGraph } = await loadCodeGraph();
1125
+ const cg = await CodeGraph.open(projectPath);
1126
+ const maxDepth = parseInt(options.depth || '5', 10);
1127
+ // Common test file patterns
1128
+ const defaultTestPatterns = [
1129
+ /\.spec\./,
1130
+ /\.test\./,
1131
+ /\/__tests__\//,
1132
+ /\/tests?\//,
1133
+ /\/e2e\//,
1134
+ /\/spec\//,
1135
+ ];
1136
+ // Custom filter pattern
1137
+ let customFilter = null;
1138
+ if (options.filter) {
1139
+ // Convert glob to regex: ** → .+, * → [^/]*, . → \.
1140
+ const regex = options.filter
1141
+ .replace(/[+[\]{}()^$|\\]/g, '\\$&')
1142
+ .replace(/\./g, '\\.')
1143
+ .replace(/\*\*/g, '.+')
1144
+ .replace(/\*/g, '[^/]*');
1145
+ customFilter = new RegExp(regex);
1146
+ }
1147
+ function isTestFile(filePath) {
1148
+ if (customFilter)
1149
+ return customFilter.test(filePath);
1150
+ return defaultTestPatterns.some(p => p.test(filePath));
1151
+ }
1152
+ // BFS to find all transitive dependents of changed files, filtered to test files
1153
+ const affectedTests = new Set();
1154
+ const allDependents = new Set();
1155
+ for (const file of changedFiles) {
1156
+ // If the changed file is itself a test file, include it
1157
+ if (isTestFile(file)) {
1158
+ affectedTests.add(file);
1159
+ continue;
1160
+ }
1161
+ // BFS through dependents
1162
+ const queue = [{ file, depth: 0 }];
1163
+ const visited = new Set();
1164
+ visited.add(file);
1165
+ while (queue.length > 0) {
1166
+ const current = queue.shift();
1167
+ if (current.depth >= maxDepth)
1168
+ continue;
1169
+ const dependents = cg.getFileDependents(current.file);
1170
+ for (const dep of dependents) {
1171
+ if (visited.has(dep))
1172
+ continue;
1173
+ visited.add(dep);
1174
+ allDependents.add(dep);
1175
+ if (isTestFile(dep)) {
1176
+ affectedTests.add(dep);
1177
+ }
1178
+ else {
1179
+ queue.push({ file: dep, depth: current.depth + 1 });
1180
+ }
1181
+ }
1182
+ }
1183
+ }
1184
+ const sortedTests = Array.from(affectedTests).sort();
1185
+ // Output
1186
+ if (options.json) {
1187
+ console.log(JSON.stringify({
1188
+ changedFiles,
1189
+ affectedTests: sortedTests,
1190
+ totalDependentsTraversed: allDependents.size,
1191
+ }, null, 2));
1192
+ }
1193
+ else if (options.quiet) {
1194
+ for (const t of sortedTests)
1195
+ console.log(t);
1196
+ }
1197
+ else {
1198
+ if (sortedTests.length === 0) {
1199
+ info('No test files affected by the changed files.');
1200
+ }
1201
+ else {
1202
+ console.log(chalk.bold(`\nAffected test files (${sortedTests.length}):\n`));
1203
+ for (const t of sortedTests) {
1204
+ console.log(' ' + chalk.cyan(t));
1205
+ }
1206
+ console.log();
1207
+ }
1208
+ }
1209
+ cg.destroy();
1210
+ }
1211
+ catch (err) {
1212
+ error(`Affected analysis failed: ${err instanceof Error ? err.message : String(err)}`);
1213
+ process.exit(1);
1214
+ }
1215
+ });
1216
+ /**
1217
+ * codegraph install
1218
+ */
1219
+ program
1220
+ .command('install')
1221
+ .description('Install codegraph MCP server into one or more agents (Claude Code, Cursor, Codex CLI, opencode)')
1222
+ .option('-t, --target <ids>', 'Target agent(s): comma-separated ids, or "auto"|"all"|"none". Default: prompt')
1223
+ .option('-l, --location <where>', 'Install location: "global" or "local". Default: prompt')
1224
+ .option('-y, --yes', 'Non-interactive: defaults to --location=global --target=auto, auto-allow on')
1225
+ .option('--no-permissions', 'Skip writing the auto-allow permissions list (Claude Code only)')
1226
+ .option('--print-config <id>', 'Print MCP config snippet for the named agent and exit (no file writes)')
1227
+ .action(async (opts) => {
1228
+ if (opts.printConfig) {
1229
+ const { getTarget, listTargetIds } = await Promise.resolve().then(() => __importStar(require('../installer/targets/registry')));
1230
+ const target = getTarget(opts.printConfig);
1231
+ if (!target) {
1232
+ const known = listTargetIds().join(', ');
1233
+ error(`Unknown target "${opts.printConfig}". Known: ${known}.`);
1234
+ process.exit(1);
1235
+ }
1236
+ const loc = (opts.location === 'local' ? 'local' : 'global');
1237
+ process.stdout.write(target.printConfig(loc));
1238
+ return;
1239
+ }
1240
+ const { runInstallerWithOptions } = await Promise.resolve().then(() => __importStar(require('../installer')));
1241
+ if (opts.location && opts.location !== 'global' && opts.location !== 'local') {
1242
+ error(`--location must be "global" or "local" (got "${opts.location}").`);
1243
+ process.exit(1);
1244
+ }
1245
+ try {
1246
+ // Commander's `--no-permissions` makes `opts.permissions === false`;
1247
+ // omitting the flag leaves it `true` (the positive-form default).
1248
+ // We MUST treat the default-true as "user did not override — let
1249
+ // the orchestrator prompt" and only forward an explicit `false`
1250
+ // (or `true` when --yes implies it). Otherwise the auto-allow
1251
+ // prompt is silently skipped on every interactive run.
1252
+ const explicitNoPermissions = opts.permissions === false;
1253
+ const autoAllow = explicitNoPermissions
1254
+ ? false
1255
+ : opts.yes
1256
+ ? true
1257
+ : undefined;
1258
+ await runInstallerWithOptions({
1259
+ target: opts.target,
1260
+ location: opts.location,
1261
+ autoAllow,
1262
+ yes: opts.yes,
1263
+ });
1264
+ }
1265
+ catch (err) {
1266
+ error(err instanceof Error ? err.message : String(err));
1267
+ process.exit(1);
1268
+ }
1269
+ });
1270
+ // Parse and run
1271
+ program.parse();
1272
+ } // end main()
1273
+ //# sourceMappingURL=codegraph.js.map