@ltm-alpha/alpha-cs 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +972 -0
  3. package/dist/bin/command-supervision.d.ts +49 -0
  4. package/dist/bin/command-supervision.d.ts.map +1 -0
  5. package/dist/bin/command-supervision.js +95 -0
  6. package/dist/bin/command-supervision.js.map +1 -0
  7. package/dist/bin/fatal-handler.d.ts +20 -0
  8. package/dist/bin/fatal-handler.d.ts.map +1 -0
  9. package/dist/bin/fatal-handler.js +118 -0
  10. package/dist/bin/fatal-handler.js.map +1 -0
  11. package/dist/bin/ltm-alpha-cs.d.ts +27 -0
  12. package/dist/bin/ltm-alpha-cs.d.ts.map +1 -0
  13. package/dist/bin/ltm-alpha-cs.js +2643 -0
  14. package/dist/bin/ltm-alpha-cs.js.map +1 -0
  15. package/dist/bin/node-version-check.d.ts +37 -0
  16. package/dist/bin/node-version-check.d.ts.map +1 -0
  17. package/dist/bin/node-version-check.js +79 -0
  18. package/dist/bin/node-version-check.js.map +1 -0
  19. package/dist/bin/uninstall.d.ts +14 -0
  20. package/dist/bin/uninstall.d.ts.map +1 -0
  21. package/dist/bin/uninstall.js +36 -0
  22. package/dist/bin/uninstall.js.map +1 -0
  23. package/dist/context/formatter.d.ts +36 -0
  24. package/dist/context/formatter.d.ts.map +1 -0
  25. package/dist/context/formatter.js +269 -0
  26. package/dist/context/formatter.js.map +1 -0
  27. package/dist/context/index.d.ts +131 -0
  28. package/dist/context/index.d.ts.map +1 -0
  29. package/dist/context/index.js +1378 -0
  30. package/dist/context/index.js.map +1 -0
  31. package/dist/context/markers.d.ts +19 -0
  32. package/dist/context/markers.d.ts.map +1 -0
  33. package/dist/context/markers.js +22 -0
  34. package/dist/context/markers.js.map +1 -0
  35. package/dist/db/index.d.ts +385 -0
  36. package/dist/db/index.d.ts.map +1 -0
  37. package/dist/db/index.js +902 -0
  38. package/dist/db/index.js.map +1 -0
  39. package/dist/db/migrations.d.ts +44 -0
  40. package/dist/db/migrations.d.ts.map +1 -0
  41. package/dist/db/migrations.js +236 -0
  42. package/dist/db/migrations.js.map +1 -0
  43. package/dist/db/queries.d.ts +1095 -0
  44. package/dist/db/queries.d.ts.map +1 -0
  45. package/dist/db/queries.js +3285 -0
  46. package/dist/db/queries.js.map +1 -0
  47. package/dist/db/schema.sql +207 -0
  48. package/dist/db/sqlite-adapter.d.ts +55 -0
  49. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  50. package/dist/db/sqlite-adapter.js +135 -0
  51. package/dist/db/sqlite-adapter.js.map +1 -0
  52. package/dist/db/wal-valve.d.ts +139 -0
  53. package/dist/db/wal-valve.d.ts.map +1 -0
  54. package/dist/db/wal-valve.js +333 -0
  55. package/dist/db/wal-valve.js.map +1 -0
  56. package/dist/directory.d.ts +232 -0
  57. package/dist/directory.d.ts.map +1 -0
  58. package/dist/directory.js +877 -0
  59. package/dist/directory.js.map +1 -0
  60. package/dist/errors.d.ts +150 -0
  61. package/dist/errors.d.ts.map +1 -0
  62. package/dist/errors.js +234 -0
  63. package/dist/errors.js.map +1 -0
  64. package/dist/extraction/astro-extractor.d.ts +79 -0
  65. package/dist/extraction/astro-extractor.d.ts.map +1 -0
  66. package/dist/extraction/astro-extractor.js +320 -0
  67. package/dist/extraction/astro-extractor.js.map +1 -0
  68. package/dist/extraction/cfml-extractor.d.ts +107 -0
  69. package/dist/extraction/cfml-extractor.d.ts.map +1 -0
  70. package/dist/extraction/cfml-extractor.js +505 -0
  71. package/dist/extraction/cfml-extractor.js.map +1 -0
  72. package/dist/extraction/dfm-extractor.d.ts +31 -0
  73. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  74. package/dist/extraction/dfm-extractor.js +151 -0
  75. package/dist/extraction/dfm-extractor.js.map +1 -0
  76. package/dist/extraction/extraction-version.d.ts +25 -0
  77. package/dist/extraction/extraction-version.d.ts.map +1 -0
  78. package/dist/extraction/extraction-version.js +28 -0
  79. package/dist/extraction/extraction-version.js.map +1 -0
  80. package/dist/extraction/function-ref.d.ts +118 -0
  81. package/dist/extraction/function-ref.d.ts.map +1 -0
  82. package/dist/extraction/function-ref.js +746 -0
  83. package/dist/extraction/function-ref.js.map +1 -0
  84. package/dist/extraction/generated-detection.d.ts +66 -0
  85. package/dist/extraction/generated-detection.d.ts.map +1 -0
  86. package/dist/extraction/generated-detection.js +248 -0
  87. package/dist/extraction/generated-detection.js.map +1 -0
  88. package/dist/extraction/grammars.d.ts +148 -0
  89. package/dist/extraction/grammars.d.ts.map +1 -0
  90. package/dist/extraction/grammars.js +743 -0
  91. package/dist/extraction/grammars.js.map +1 -0
  92. package/dist/extraction/index.d.ts +455 -0
  93. package/dist/extraction/index.d.ts.map +1 -0
  94. package/dist/extraction/index.js +3208 -0
  95. package/dist/extraction/index.js.map +1 -0
  96. package/dist/extraction/kernel/decode.d.ts +9 -0
  97. package/dist/extraction/kernel/decode.d.ts.map +1 -0
  98. package/dist/extraction/kernel/decode.js +162 -0
  99. package/dist/extraction/kernel/decode.js.map +1 -0
  100. package/dist/extraction/kernel/index.d.ts +64 -0
  101. package/dist/extraction/kernel/index.d.ts.map +1 -0
  102. package/dist/extraction/kernel/index.js +279 -0
  103. package/dist/extraction/kernel/index.js.map +1 -0
  104. package/dist/extraction/kernel/layout.d.ts +101 -0
  105. package/dist/extraction/kernel/layout.d.ts.map +1 -0
  106. package/dist/extraction/kernel/layout.js +104 -0
  107. package/dist/extraction/kernel/layout.js.map +1 -0
  108. package/dist/extraction/kernel/loader.d.ts +103 -0
  109. package/dist/extraction/kernel/loader.d.ts.map +1 -0
  110. package/dist/extraction/kernel/loader.js +146 -0
  111. package/dist/extraction/kernel/loader.js.map +1 -0
  112. package/dist/extraction/languages/arkts.d.ts +3 -0
  113. package/dist/extraction/languages/arkts.d.ts.map +1 -0
  114. package/dist/extraction/languages/arkts.js +127 -0
  115. package/dist/extraction/languages/arkts.js.map +1 -0
  116. package/dist/extraction/languages/c-cpp.d.ts +167 -0
  117. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  118. package/dist/extraction/languages/c-cpp.js +1850 -0
  119. package/dist/extraction/languages/c-cpp.js.map +1 -0
  120. package/dist/extraction/languages/cfquery.d.ts +12 -0
  121. package/dist/extraction/languages/cfquery.d.ts.map +1 -0
  122. package/dist/extraction/languages/cfquery.js +28 -0
  123. package/dist/extraction/languages/cfquery.js.map +1 -0
  124. package/dist/extraction/languages/cfscript.d.ts +3 -0
  125. package/dist/extraction/languages/cfscript.d.ts.map +1 -0
  126. package/dist/extraction/languages/cfscript.js +73 -0
  127. package/dist/extraction/languages/cfscript.js.map +1 -0
  128. package/dist/extraction/languages/cobol.d.ts +33 -0
  129. package/dist/extraction/languages/cobol.d.ts.map +1 -0
  130. package/dist/extraction/languages/cobol.js +499 -0
  131. package/dist/extraction/languages/cobol.js.map +1 -0
  132. package/dist/extraction/languages/csharp.d.ts +25 -0
  133. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  134. package/dist/extraction/languages/csharp.js +175 -0
  135. package/dist/extraction/languages/csharp.js.map +1 -0
  136. package/dist/extraction/languages/dart.d.ts +3 -0
  137. package/dist/extraction/languages/dart.d.ts.map +1 -0
  138. package/dist/extraction/languages/dart.js +374 -0
  139. package/dist/extraction/languages/dart.js.map +1 -0
  140. package/dist/extraction/languages/erlang.d.ts +3 -0
  141. package/dist/extraction/languages/erlang.d.ts.map +1 -0
  142. package/dist/extraction/languages/erlang.js +386 -0
  143. package/dist/extraction/languages/erlang.js.map +1 -0
  144. package/dist/extraction/languages/go.d.ts +3 -0
  145. package/dist/extraction/languages/go.d.ts.map +1 -0
  146. package/dist/extraction/languages/go.js +111 -0
  147. package/dist/extraction/languages/go.js.map +1 -0
  148. package/dist/extraction/languages/index.d.ts +10 -0
  149. package/dist/extraction/languages/index.d.ts.map +1 -0
  150. package/dist/extraction/languages/index.js +71 -0
  151. package/dist/extraction/languages/index.js.map +1 -0
  152. package/dist/extraction/languages/java.d.ts +3 -0
  153. package/dist/extraction/languages/java.d.ts.map +1 -0
  154. package/dist/extraction/languages/java.js +315 -0
  155. package/dist/extraction/languages/java.js.map +1 -0
  156. package/dist/extraction/languages/javascript.d.ts +3 -0
  157. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  158. package/dist/extraction/languages/javascript.js +106 -0
  159. package/dist/extraction/languages/javascript.js.map +1 -0
  160. package/dist/extraction/languages/kotlin.d.ts +3 -0
  161. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  162. package/dist/extraction/languages/kotlin.js +512 -0
  163. package/dist/extraction/languages/kotlin.js.map +1 -0
  164. package/dist/extraction/languages/lua.d.ts +3 -0
  165. package/dist/extraction/languages/lua.d.ts.map +1 -0
  166. package/dist/extraction/languages/lua.js +153 -0
  167. package/dist/extraction/languages/lua.js.map +1 -0
  168. package/dist/extraction/languages/luau.d.ts +3 -0
  169. package/dist/extraction/languages/luau.d.ts.map +1 -0
  170. package/dist/extraction/languages/luau.js +37 -0
  171. package/dist/extraction/languages/luau.js.map +1 -0
  172. package/dist/extraction/languages/nix.d.ts +3 -0
  173. package/dist/extraction/languages/nix.d.ts.map +1 -0
  174. package/dist/extraction/languages/nix.js +294 -0
  175. package/dist/extraction/languages/nix.js.map +1 -0
  176. package/dist/extraction/languages/objc.d.ts +3 -0
  177. package/dist/extraction/languages/objc.d.ts.map +1 -0
  178. package/dist/extraction/languages/objc.js +179 -0
  179. package/dist/extraction/languages/objc.js.map +1 -0
  180. package/dist/extraction/languages/pascal.d.ts +3 -0
  181. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  182. package/dist/extraction/languages/pascal.js +77 -0
  183. package/dist/extraction/languages/pascal.js.map +1 -0
  184. package/dist/extraction/languages/php.d.ts +3 -0
  185. package/dist/extraction/languages/php.d.ts.map +1 -0
  186. package/dist/extraction/languages/php.js +196 -0
  187. package/dist/extraction/languages/php.js.map +1 -0
  188. package/dist/extraction/languages/python.d.ts +3 -0
  189. package/dist/extraction/languages/python.d.ts.map +1 -0
  190. package/dist/extraction/languages/python.js +56 -0
  191. package/dist/extraction/languages/python.js.map +1 -0
  192. package/dist/extraction/languages/r.d.ts +3 -0
  193. package/dist/extraction/languages/r.d.ts.map +1 -0
  194. package/dist/extraction/languages/r.js +314 -0
  195. package/dist/extraction/languages/r.js.map +1 -0
  196. package/dist/extraction/languages/ruby.d.ts +3 -0
  197. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  198. package/dist/extraction/languages/ruby.js +149 -0
  199. package/dist/extraction/languages/ruby.js.map +1 -0
  200. package/dist/extraction/languages/rust.d.ts +23 -0
  201. package/dist/extraction/languages/rust.d.ts.map +1 -0
  202. package/dist/extraction/languages/rust.js +172 -0
  203. package/dist/extraction/languages/rust.js.map +1 -0
  204. package/dist/extraction/languages/scala.d.ts +3 -0
  205. package/dist/extraction/languages/scala.d.ts.map +1 -0
  206. package/dist/extraction/languages/scala.js +219 -0
  207. package/dist/extraction/languages/scala.js.map +1 -0
  208. package/dist/extraction/languages/solidity.d.ts +3 -0
  209. package/dist/extraction/languages/solidity.d.ts.map +1 -0
  210. package/dist/extraction/languages/solidity.js +293 -0
  211. package/dist/extraction/languages/solidity.js.map +1 -0
  212. package/dist/extraction/languages/swift.d.ts +3 -0
  213. package/dist/extraction/languages/swift.d.ts.map +1 -0
  214. package/dist/extraction/languages/swift.js +152 -0
  215. package/dist/extraction/languages/swift.js.map +1 -0
  216. package/dist/extraction/languages/terraform.d.ts +3 -0
  217. package/dist/extraction/languages/terraform.d.ts.map +1 -0
  218. package/dist/extraction/languages/terraform.js +641 -0
  219. package/dist/extraction/languages/terraform.js.map +1 -0
  220. package/dist/extraction/languages/typescript.d.ts +16 -0
  221. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  222. package/dist/extraction/languages/typescript.js +174 -0
  223. package/dist/extraction/languages/typescript.js.map +1 -0
  224. package/dist/extraction/languages/vbnet.d.ts +11 -0
  225. package/dist/extraction/languages/vbnet.d.ts.map +1 -0
  226. package/dist/extraction/languages/vbnet.js +141 -0
  227. package/dist/extraction/languages/vbnet.js.map +1 -0
  228. package/dist/extraction/liquid-extractor.d.ts +59 -0
  229. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  230. package/dist/extraction/liquid-extractor.js +357 -0
  231. package/dist/extraction/liquid-extractor.js.map +1 -0
  232. package/dist/extraction/mybatis-extractor.d.ts +68 -0
  233. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  234. package/dist/extraction/mybatis-extractor.js +300 -0
  235. package/dist/extraction/mybatis-extractor.js.map +1 -0
  236. package/dist/extraction/parse-pool.d.ts +167 -0
  237. package/dist/extraction/parse-pool.d.ts.map +1 -0
  238. package/dist/extraction/parse-pool.js +421 -0
  239. package/dist/extraction/parse-pool.js.map +1 -0
  240. package/dist/extraction/parse-worker.d.ts +8 -0
  241. package/dist/extraction/parse-worker.d.ts.map +1 -0
  242. package/dist/extraction/parse-worker.js +138 -0
  243. package/dist/extraction/parse-worker.js.map +1 -0
  244. package/dist/extraction/razor-extractor.d.ts +42 -0
  245. package/dist/extraction/razor-extractor.d.ts.map +1 -0
  246. package/dist/extraction/razor-extractor.js +285 -0
  247. package/dist/extraction/razor-extractor.js.map +1 -0
  248. package/dist/extraction/store-worker.d.ts +24 -0
  249. package/dist/extraction/store-worker.d.ts.map +1 -0
  250. package/dist/extraction/store-worker.js +139 -0
  251. package/dist/extraction/store-worker.js.map +1 -0
  252. package/dist/extraction/store-writer.d.ts +63 -0
  253. package/dist/extraction/store-writer.d.ts.map +1 -0
  254. package/dist/extraction/store-writer.js +174 -0
  255. package/dist/extraction/store-writer.js.map +1 -0
  256. package/dist/extraction/svelte-extractor.d.ts +56 -0
  257. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  258. package/dist/extraction/svelte-extractor.js +275 -0
  259. package/dist/extraction/svelte-extractor.js.map +1 -0
  260. package/dist/extraction/syntax-tokens.d.ts +103 -0
  261. package/dist/extraction/syntax-tokens.d.ts.map +1 -0
  262. package/dist/extraction/syntax-tokens.js +381 -0
  263. package/dist/extraction/syntax-tokens.js.map +1 -0
  264. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  265. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  266. package/dist/extraction/tree-sitter-helpers.js +153 -0
  267. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  268. package/dist/extraction/tree-sitter-types.d.ts +279 -0
  269. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  270. package/dist/extraction/tree-sitter-types.js +10 -0
  271. package/dist/extraction/tree-sitter-types.js.map +1 -0
  272. package/dist/extraction/tree-sitter.d.ts +766 -0
  273. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  274. package/dist/extraction/tree-sitter.js +7138 -0
  275. package/dist/extraction/tree-sitter.js.map +1 -0
  276. package/dist/extraction/vue-extractor.d.ts +51 -0
  277. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  278. package/dist/extraction/vue-extractor.js +254 -0
  279. package/dist/extraction/vue-extractor.js.map +1 -0
  280. package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  281. package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  282. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  283. package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  284. package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  285. package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  286. package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  287. package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  288. package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  289. package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  290. package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  291. package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  292. package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  293. package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  294. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  295. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  296. package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  297. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  298. package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  299. package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  300. package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  301. package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  302. package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  303. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  304. package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  305. package/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
  306. package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  307. package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  308. package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  309. package/dist/extraction/wasm-runtime-flags.d.ts +53 -0
  310. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  311. package/dist/extraction/wasm-runtime-flags.js +130 -0
  312. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  313. package/dist/graph/branch-guards.d.ts +248 -0
  314. package/dist/graph/branch-guards.d.ts.map +1 -0
  315. package/dist/graph/branch-guards.js +2231 -0
  316. package/dist/graph/branch-guards.js.map +1 -0
  317. package/dist/graph/dead-code.d.ts +251 -0
  318. package/dist/graph/dead-code.d.ts.map +1 -0
  319. package/dist/graph/dead-code.js +756 -0
  320. package/dist/graph/dead-code.js.map +1 -0
  321. package/dist/graph/dynamic-boundary-report.d.ts +121 -0
  322. package/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
  323. package/dist/graph/dynamic-boundary-report.js +283 -0
  324. package/dist/graph/dynamic-boundary-report.js.map +1 -0
  325. package/dist/graph/index.d.ts +12 -0
  326. package/dist/graph/index.d.ts.map +1 -0
  327. package/dist/graph/index.js +28 -0
  328. package/dist/graph/index.js.map +1 -0
  329. package/dist/graph/named-symbol-flow.d.ts +125 -0
  330. package/dist/graph/named-symbol-flow.d.ts.map +1 -0
  331. package/dist/graph/named-symbol-flow.js +552 -0
  332. package/dist/graph/named-symbol-flow.js.map +1 -0
  333. package/dist/graph/queries.d.ts +106 -0
  334. package/dist/graph/queries.d.ts.map +1 -0
  335. package/dist/graph/queries.js +341 -0
  336. package/dist/graph/queries.js.map +1 -0
  337. package/dist/graph/symbol-lookup.d.ts +83 -0
  338. package/dist/graph/symbol-lookup.d.ts.map +1 -0
  339. package/dist/graph/symbol-lookup.js +181 -0
  340. package/dist/graph/symbol-lookup.js.map +1 -0
  341. package/dist/graph/traversal.d.ts +127 -0
  342. package/dist/graph/traversal.d.ts.map +1 -0
  343. package/dist/graph/traversal.js +599 -0
  344. package/dist/graph/traversal.js.map +1 -0
  345. package/dist/graph/type-hierarchy.d.ts +155 -0
  346. package/dist/graph/type-hierarchy.d.ts.map +1 -0
  347. package/dist/graph/type-hierarchy.js +382 -0
  348. package/dist/graph/type-hierarchy.js.map +1 -0
  349. package/dist/index.d.ts +874 -0
  350. package/dist/index.d.ts.map +1 -0
  351. package/dist/index.js +2005 -0
  352. package/dist/index.js.map +1 -0
  353. package/dist/installer/config-writer.d.ts +28 -0
  354. package/dist/installer/config-writer.d.ts.map +1 -0
  355. package/dist/installer/config-writer.js +91 -0
  356. package/dist/installer/config-writer.js.map +1 -0
  357. package/dist/installer/index.d.ts +143 -0
  358. package/dist/installer/index.d.ts.map +1 -0
  359. package/dist/installer/index.js +621 -0
  360. package/dist/installer/index.js.map +1 -0
  361. package/dist/installer/instructions-template.d.ts +41 -0
  362. package/dist/installer/instructions-template.d.ts.map +1 -0
  363. package/dist/installer/instructions-template.js +53 -0
  364. package/dist/installer/instructions-template.js.map +1 -0
  365. package/dist/installer/targets/antigravity.d.ts +57 -0
  366. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  367. package/dist/installer/targets/antigravity.js +308 -0
  368. package/dist/installer/targets/antigravity.js.map +1 -0
  369. package/dist/installer/targets/claude.d.ts +65 -0
  370. package/dist/installer/targets/claude.d.ts.map +1 -0
  371. package/dist/installer/targets/claude.js +514 -0
  372. package/dist/installer/targets/claude.js.map +1 -0
  373. package/dist/installer/targets/codex.d.ts +33 -0
  374. package/dist/installer/targets/codex.d.ts.map +1 -0
  375. package/dist/installer/targets/codex.js +212 -0
  376. package/dist/installer/targets/codex.js.map +1 -0
  377. package/dist/installer/targets/copilot-cli.d.ts +32 -0
  378. package/dist/installer/targets/copilot-cli.d.ts.map +1 -0
  379. package/dist/installer/targets/copilot-cli.js +215 -0
  380. package/dist/installer/targets/copilot-cli.js.map +1 -0
  381. package/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
  382. package/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
  383. package/dist/installer/targets/copilot-jetbrains.js +238 -0
  384. package/dist/installer/targets/copilot-jetbrains.js.map +1 -0
  385. package/dist/installer/targets/copilot-vscode.d.ts +47 -0
  386. package/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
  387. package/dist/installer/targets/copilot-vscode.js +219 -0
  388. package/dist/installer/targets/copilot-vscode.js.map +1 -0
  389. package/dist/installer/targets/cursor.d.ts +35 -0
  390. package/dist/installer/targets/cursor.d.ts.map +1 -0
  391. package/dist/installer/targets/cursor.js +254 -0
  392. package/dist/installer/targets/cursor.js.map +1 -0
  393. package/dist/installer/targets/gemini.d.ts +26 -0
  394. package/dist/installer/targets/gemini.d.ts.map +1 -0
  395. package/dist/installer/targets/gemini.js +165 -0
  396. package/dist/installer/targets/gemini.js.map +1 -0
  397. package/dist/installer/targets/hermes.d.ts +18 -0
  398. package/dist/installer/targets/hermes.d.ts.map +1 -0
  399. package/dist/installer/targets/hermes.js +359 -0
  400. package/dist/installer/targets/hermes.js.map +1 -0
  401. package/dist/installer/targets/kiro.d.ts +27 -0
  402. package/dist/installer/targets/kiro.d.ts.map +1 -0
  403. package/dist/installer/targets/kiro.js +178 -0
  404. package/dist/installer/targets/kiro.js.map +1 -0
  405. package/dist/installer/targets/opencode.d.ts +49 -0
  406. package/dist/installer/targets/opencode.d.ts.map +1 -0
  407. package/dist/installer/targets/opencode.js +339 -0
  408. package/dist/installer/targets/opencode.js.map +1 -0
  409. package/dist/installer/targets/registry.d.ts +35 -0
  410. package/dist/installer/targets/registry.d.ts.map +1 -0
  411. package/dist/installer/targets/registry.js +97 -0
  412. package/dist/installer/targets/registry.js.map +1 -0
  413. package/dist/installer/targets/shared.d.ts +101 -0
  414. package/dist/installer/targets/shared.d.ts.map +1 -0
  415. package/dist/installer/targets/shared.js +264 -0
  416. package/dist/installer/targets/shared.js.map +1 -0
  417. package/dist/installer/targets/toml.d.ts +53 -0
  418. package/dist/installer/targets/toml.d.ts.map +1 -0
  419. package/dist/installer/targets/toml.js +226 -0
  420. package/dist/installer/targets/toml.js.map +1 -0
  421. package/dist/installer/targets/types.d.ts +108 -0
  422. package/dist/installer/targets/types.d.ts.map +1 -0
  423. package/dist/installer/targets/types.js +16 -0
  424. package/dist/installer/targets/types.js.map +1 -0
  425. package/dist/mcp/daemon-manager.d.ts +42 -0
  426. package/dist/mcp/daemon-manager.d.ts.map +1 -0
  427. package/dist/mcp/daemon-manager.js +141 -0
  428. package/dist/mcp/daemon-manager.js.map +1 -0
  429. package/dist/mcp/daemon-paths.d.ts +81 -0
  430. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  431. package/dist/mcp/daemon-paths.js +228 -0
  432. package/dist/mcp/daemon-paths.js.map +1 -0
  433. package/dist/mcp/daemon-registry.d.ts +57 -0
  434. package/dist/mcp/daemon-registry.d.ts.map +1 -0
  435. package/dist/mcp/daemon-registry.js +323 -0
  436. package/dist/mcp/daemon-registry.js.map +1 -0
  437. package/dist/mcp/daemon.d.ts +294 -0
  438. package/dist/mcp/daemon.d.ts.map +1 -0
  439. package/dist/mcp/daemon.js +897 -0
  440. package/dist/mcp/daemon.js.map +1 -0
  441. package/dist/mcp/dynamic-boundaries.d.ts +32 -0
  442. package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  443. package/dist/mcp/dynamic-boundaries.js +323 -0
  444. package/dist/mcp/dynamic-boundaries.js.map +1 -0
  445. package/dist/mcp/early-ppid.d.ts +26 -0
  446. package/dist/mcp/early-ppid.d.ts.map +1 -0
  447. package/dist/mcp/early-ppid.js +29 -0
  448. package/dist/mcp/early-ppid.js.map +1 -0
  449. package/dist/mcp/engine.d.ts +133 -0
  450. package/dist/mcp/engine.d.ts.map +1 -0
  451. package/dist/mcp/engine.js +421 -0
  452. package/dist/mcp/engine.js.map +1 -0
  453. package/dist/mcp/explore-dedup.d.ts +140 -0
  454. package/dist/mcp/explore-dedup.d.ts.map +1 -0
  455. package/dist/mcp/explore-dedup.js +239 -0
  456. package/dist/mcp/explore-dedup.js.map +1 -0
  457. package/dist/mcp/explore-diagnostics.d.ts +289 -0
  458. package/dist/mcp/explore-diagnostics.d.ts.map +1 -0
  459. package/dist/mcp/explore-diagnostics.js +558 -0
  460. package/dist/mcp/explore-diagnostics.js.map +1 -0
  461. package/dist/mcp/explore-session-state.d.ts +217 -0
  462. package/dist/mcp/explore-session-state.d.ts.map +1 -0
  463. package/dist/mcp/explore-session-state.js +322 -0
  464. package/dist/mcp/explore-session-state.js.map +1 -0
  465. package/dist/mcp/index.d.ts +139 -0
  466. package/dist/mcp/index.d.ts.map +1 -0
  467. package/dist/mcp/index.js +636 -0
  468. package/dist/mcp/index.js.map +1 -0
  469. package/dist/mcp/liveness-watchdog.d.ts +35 -0
  470. package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  471. package/dist/mcp/liveness-watchdog.js +269 -0
  472. package/dist/mcp/liveness-watchdog.js.map +1 -0
  473. package/dist/mcp/ppid-watchdog.d.ts +62 -0
  474. package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  475. package/dist/mcp/ppid-watchdog.js +64 -0
  476. package/dist/mcp/ppid-watchdog.js.map +1 -0
  477. package/dist/mcp/proxy.d.ts +87 -0
  478. package/dist/mcp/proxy.d.ts.map +1 -0
  479. package/dist/mcp/proxy.js +672 -0
  480. package/dist/mcp/proxy.js.map +1 -0
  481. package/dist/mcp/query-pool.d.ts +108 -0
  482. package/dist/mcp/query-pool.d.ts.map +1 -0
  483. package/dist/mcp/query-pool.js +315 -0
  484. package/dist/mcp/query-pool.js.map +1 -0
  485. package/dist/mcp/query-worker.d.ts +24 -0
  486. package/dist/mcp/query-worker.d.ts.map +1 -0
  487. package/dist/mcp/query-worker.js +87 -0
  488. package/dist/mcp/query-worker.js.map +1 -0
  489. package/dist/mcp/server-instructions.d.ts +34 -0
  490. package/dist/mcp/server-instructions.d.ts.map +1 -0
  491. package/dist/mcp/server-instructions.js +113 -0
  492. package/dist/mcp/server-instructions.js.map +1 -0
  493. package/dist/mcp/session.d.ts +109 -0
  494. package/dist/mcp/session.d.ts.map +1 -0
  495. package/dist/mcp/session.js +380 -0
  496. package/dist/mcp/session.js.map +1 -0
  497. package/dist/mcp/startup-handshake.d.ts +44 -0
  498. package/dist/mcp/startup-handshake.d.ts.map +1 -0
  499. package/dist/mcp/startup-handshake.js +73 -0
  500. package/dist/mcp/startup-handshake.js.map +1 -0
  501. package/dist/mcp/stdin-teardown.d.ts +27 -0
  502. package/dist/mcp/stdin-teardown.d.ts.map +1 -0
  503. package/dist/mcp/stdin-teardown.js +49 -0
  504. package/dist/mcp/stdin-teardown.js.map +1 -0
  505. package/dist/mcp/tools.d.ts +936 -0
  506. package/dist/mcp/tools.d.ts.map +1 -0
  507. package/dist/mcp/tools.js +6611 -0
  508. package/dist/mcp/tools.js.map +1 -0
  509. package/dist/mcp/transport.d.ts +188 -0
  510. package/dist/mcp/transport.d.ts.map +1 -0
  511. package/dist/mcp/transport.js +377 -0
  512. package/dist/mcp/transport.js.map +1 -0
  513. package/dist/mcp/version.d.ts +19 -0
  514. package/dist/mcp/version.d.ts.map +1 -0
  515. package/dist/mcp/version.js +71 -0
  516. package/dist/mcp/version.js.map +1 -0
  517. package/dist/mcp/writer-lock.d.ts +47 -0
  518. package/dist/mcp/writer-lock.d.ts.map +1 -0
  519. package/dist/mcp/writer-lock.js +218 -0
  520. package/dist/mcp/writer-lock.js.map +1 -0
  521. package/dist/project-config.d.ts +117 -0
  522. package/dist/project-config.d.ts.map +1 -0
  523. package/dist/project-config.js +409 -0
  524. package/dist/project-config.js.map +1 -0
  525. package/dist/resolution/alias-binding.d.ts +56 -0
  526. package/dist/resolution/alias-binding.d.ts.map +1 -0
  527. package/dist/resolution/alias-binding.js +118 -0
  528. package/dist/resolution/alias-binding.js.map +1 -0
  529. package/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
  530. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  531. package/dist/resolution/c-fnptr-synthesizer.js +1506 -0
  532. package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  533. package/dist/resolution/callback-synthesizer.d.ts +78 -0
  534. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  535. package/dist/resolution/callback-synthesizer.js +4105 -0
  536. package/dist/resolution/callback-synthesizer.js.map +1 -0
  537. package/dist/resolution/cooperative-yield.d.ts +40 -0
  538. package/dist/resolution/cooperative-yield.d.ts.map +1 -0
  539. package/dist/resolution/cooperative-yield.js +44 -0
  540. package/dist/resolution/cooperative-yield.js.map +1 -0
  541. package/dist/resolution/expo-router-synthesizer.d.ts +32 -0
  542. package/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
  543. package/dist/resolution/expo-router-synthesizer.js +189 -0
  544. package/dist/resolution/expo-router-synthesizer.js.map +1 -0
  545. package/dist/resolution/frameworks/astro.d.ts +9 -0
  546. package/dist/resolution/frameworks/astro.d.ts.map +1 -0
  547. package/dist/resolution/frameworks/astro.js +169 -0
  548. package/dist/resolution/frameworks/astro.js.map +1 -0
  549. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  550. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  551. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  552. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  553. package/dist/resolution/frameworks/cics.d.ts +20 -0
  554. package/dist/resolution/frameworks/cics.d.ts.map +1 -0
  555. package/dist/resolution/frameworks/cics.js +90 -0
  556. package/dist/resolution/frameworks/cics.js.map +1 -0
  557. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  558. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  559. package/dist/resolution/frameworks/csharp.js +335 -0
  560. package/dist/resolution/frameworks/csharp.js.map +1 -0
  561. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  562. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  563. package/dist/resolution/frameworks/drupal.js +367 -0
  564. package/dist/resolution/frameworks/drupal.js.map +1 -0
  565. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  566. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  567. package/dist/resolution/frameworks/expo-modules.js +148 -0
  568. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  569. package/dist/resolution/frameworks/expo-router.d.ts +189 -0
  570. package/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
  571. package/dist/resolution/frameworks/expo-router.js +785 -0
  572. package/dist/resolution/frameworks/expo-router.js.map +1 -0
  573. package/dist/resolution/frameworks/express.d.ts +8 -0
  574. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  575. package/dist/resolution/frameworks/express.js +540 -0
  576. package/dist/resolution/frameworks/express.js.map +1 -0
  577. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  578. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  579. package/dist/resolution/frameworks/fabric.js +354 -0
  580. package/dist/resolution/frameworks/fabric.js.map +1 -0
  581. package/dist/resolution/frameworks/go.d.ts +8 -0
  582. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  583. package/dist/resolution/frameworks/go.js +184 -0
  584. package/dist/resolution/frameworks/go.js.map +1 -0
  585. package/dist/resolution/frameworks/goframe.d.ts +41 -0
  586. package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  587. package/dist/resolution/frameworks/goframe.js +112 -0
  588. package/dist/resolution/frameworks/goframe.js.map +1 -0
  589. package/dist/resolution/frameworks/index.d.ts +55 -0
  590. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  591. package/dist/resolution/frameworks/index.js +203 -0
  592. package/dist/resolution/frameworks/index.js.map +1 -0
  593. package/dist/resolution/frameworks/java.d.ts +8 -0
  594. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  595. package/dist/resolution/frameworks/java.js +539 -0
  596. package/dist/resolution/frameworks/java.js.map +1 -0
  597. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  598. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  599. package/dist/resolution/frameworks/laravel.js +257 -0
  600. package/dist/resolution/frameworks/laravel.js.map +1 -0
  601. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  602. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  603. package/dist/resolution/frameworks/nestjs.js +690 -0
  604. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  605. package/dist/resolution/frameworks/nextjs.d.ts +76 -0
  606. package/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
  607. package/dist/resolution/frameworks/nextjs.js +328 -0
  608. package/dist/resolution/frameworks/nextjs.js.map +1 -0
  609. package/dist/resolution/frameworks/object-literal.d.ts +32 -0
  610. package/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
  611. package/dist/resolution/frameworks/object-literal.js +139 -0
  612. package/dist/resolution/frameworks/object-literal.js.map +1 -0
  613. package/dist/resolution/frameworks/package-deps.d.ts +14 -0
  614. package/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
  615. package/dist/resolution/frameworks/package-deps.js +78 -0
  616. package/dist/resolution/frameworks/package-deps.js.map +1 -0
  617. package/dist/resolution/frameworks/play.d.ts +19 -0
  618. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  619. package/dist/resolution/frameworks/play.js +111 -0
  620. package/dist/resolution/frameworks/play.js.map +1 -0
  621. package/dist/resolution/frameworks/python.d.ts +10 -0
  622. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  623. package/dist/resolution/frameworks/python.js +566 -0
  624. package/dist/resolution/frameworks/python.js.map +1 -0
  625. package/dist/resolution/frameworks/react-native.d.ts +29 -0
  626. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  627. package/dist/resolution/frameworks/react-native.js +549 -0
  628. package/dist/resolution/frameworks/react-native.js.map +1 -0
  629. package/dist/resolution/frameworks/react-router.d.ts +46 -0
  630. package/dist/resolution/frameworks/react-router.d.ts.map +1 -0
  631. package/dist/resolution/frameworks/react-router.js +187 -0
  632. package/dist/resolution/frameworks/react-router.js.map +1 -0
  633. package/dist/resolution/frameworks/react.d.ts +9 -0
  634. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  635. package/dist/resolution/frameworks/react.js +257 -0
  636. package/dist/resolution/frameworks/react.js.map +1 -0
  637. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  638. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  639. package/dist/resolution/frameworks/ruby.js +302 -0
  640. package/dist/resolution/frameworks/ruby.js.map +1 -0
  641. package/dist/resolution/frameworks/rust.d.ts +8 -0
  642. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  643. package/dist/resolution/frameworks/rust.js +304 -0
  644. package/dist/resolution/frameworks/rust.js.map +1 -0
  645. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  646. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  647. package/dist/resolution/frameworks/svelte.js +258 -0
  648. package/dist/resolution/frameworks/svelte.js.map +1 -0
  649. package/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
  650. package/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
  651. package/dist/resolution/frameworks/sveltekit-router.js +156 -0
  652. package/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
  653. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  654. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  655. package/dist/resolution/frameworks/swift-objc.js +252 -0
  656. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  657. package/dist/resolution/frameworks/swift.d.ts +10 -0
  658. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  659. package/dist/resolution/frameworks/swift.js +410 -0
  660. package/dist/resolution/frameworks/swift.js.map +1 -0
  661. package/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
  662. package/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
  663. package/dist/resolution/frameworks/tanstack-router.js +437 -0
  664. package/dist/resolution/frameworks/tanstack-router.js.map +1 -0
  665. package/dist/resolution/frameworks/terraform.d.ts +38 -0
  666. package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
  667. package/dist/resolution/frameworks/terraform.js +277 -0
  668. package/dist/resolution/frameworks/terraform.js.map +1 -0
  669. package/dist/resolution/frameworks/vue-router.d.ts +82 -0
  670. package/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
  671. package/dist/resolution/frameworks/vue-router.js +377 -0
  672. package/dist/resolution/frameworks/vue-router.js.map +1 -0
  673. package/dist/resolution/frameworks/vue.d.ts +9 -0
  674. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  675. package/dist/resolution/frameworks/vue.js +303 -0
  676. package/dist/resolution/frameworks/vue.js.map +1 -0
  677. package/dist/resolution/go-module.d.ts +26 -0
  678. package/dist/resolution/go-module.d.ts.map +1 -0
  679. package/dist/resolution/go-module.js +78 -0
  680. package/dist/resolution/go-module.js.map +1 -0
  681. package/dist/resolution/goframe-synthesizer.d.ts +29 -0
  682. package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  683. package/dist/resolution/goframe-synthesizer.js +163 -0
  684. package/dist/resolution/goframe-synthesizer.js.map +1 -0
  685. package/dist/resolution/import-resolver.d.ts +122 -0
  686. package/dist/resolution/import-resolver.d.ts.map +1 -0
  687. package/dist/resolution/import-resolver.js +2490 -0
  688. package/dist/resolution/import-resolver.js.map +1 -0
  689. package/dist/resolution/index.d.ts +402 -0
  690. package/dist/resolution/index.d.ts.map +1 -0
  691. package/dist/resolution/index.js +2581 -0
  692. package/dist/resolution/index.js.map +1 -0
  693. package/dist/resolution/js-builtins.d.ts +11 -0
  694. package/dist/resolution/js-builtins.d.ts.map +1 -0
  695. package/dist/resolution/js-builtins.js +23 -0
  696. package/dist/resolution/js-builtins.js.map +1 -0
  697. package/dist/resolution/lru-cache.d.ts +24 -0
  698. package/dist/resolution/lru-cache.d.ts.map +1 -0
  699. package/dist/resolution/lru-cache.js +62 -0
  700. package/dist/resolution/lru-cache.js.map +1 -0
  701. package/dist/resolution/memory-budget.d.ts +48 -0
  702. package/dist/resolution/memory-budget.d.ts.map +1 -0
  703. package/dist/resolution/memory-budget.js +162 -0
  704. package/dist/resolution/memory-budget.js.map +1 -0
  705. package/dist/resolution/name-matcher.d.ts +196 -0
  706. package/dist/resolution/name-matcher.d.ts.map +1 -0
  707. package/dist/resolution/name-matcher.js +3484 -0
  708. package/dist/resolution/name-matcher.js.map +1 -0
  709. package/dist/resolution/next-router-synthesizer.d.ts +27 -0
  710. package/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
  711. package/dist/resolution/next-router-synthesizer.js +113 -0
  712. package/dist/resolution/next-router-synthesizer.js.map +1 -0
  713. package/dist/resolution/path-aliases.d.ts +70 -0
  714. package/dist/resolution/path-aliases.d.ts.map +1 -0
  715. package/dist/resolution/path-aliases.js +346 -0
  716. package/dist/resolution/path-aliases.js.map +1 -0
  717. package/dist/resolution/react-router-synthesizer.d.ts +33 -0
  718. package/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
  719. package/dist/resolution/react-router-synthesizer.js +126 -0
  720. package/dist/resolution/react-router-synthesizer.js.map +1 -0
  721. package/dist/resolution/resolver-pool.d.ts +106 -0
  722. package/dist/resolution/resolver-pool.d.ts.map +1 -0
  723. package/dist/resolution/resolver-pool.js +344 -0
  724. package/dist/resolution/resolver-pool.js.map +1 -0
  725. package/dist/resolution/resolver-worker.d.ts +17 -0
  726. package/dist/resolution/resolver-worker.d.ts.map +1 -0
  727. package/dist/resolution/resolver-worker.js +141 -0
  728. package/dist/resolution/resolver-worker.js.map +1 -0
  729. package/dist/resolution/strip-comments.d.ts +33 -0
  730. package/dist/resolution/strip-comments.d.ts.map +1 -0
  731. package/dist/resolution/strip-comments.js +550 -0
  732. package/dist/resolution/strip-comments.js.map +1 -0
  733. package/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
  734. package/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
  735. package/dist/resolution/sveltekit-synthesizer.js +173 -0
  736. package/dist/resolution/sveltekit-synthesizer.js.map +1 -0
  737. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  738. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  739. package/dist/resolution/swift-objc-bridge.js +256 -0
  740. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  741. package/dist/resolution/synth-utils.d.ts +26 -0
  742. package/dist/resolution/synth-utils.d.ts.map +1 -0
  743. package/dist/resolution/synth-utils.js +75 -0
  744. package/dist/resolution/synth-utils.js.map +1 -0
  745. package/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
  746. package/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
  747. package/dist/resolution/tanstack-router-synthesizer.js +114 -0
  748. package/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
  749. package/dist/resolution/tier-synthesizer.d.ts +48 -0
  750. package/dist/resolution/tier-synthesizer.d.ts.map +1 -0
  751. package/dist/resolution/tier-synthesizer.js +907 -0
  752. package/dist/resolution/tier-synthesizer.js.map +1 -0
  753. package/dist/resolution/types.d.ts +323 -0
  754. package/dist/resolution/types.d.ts.map +1 -0
  755. package/dist/resolution/types.js +58 -0
  756. package/dist/resolution/types.js.map +1 -0
  757. package/dist/resolution/vue-router-synthesizer.d.ts +30 -0
  758. package/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
  759. package/dist/resolution/vue-router-synthesizer.js +115 -0
  760. package/dist/resolution/vue-router-synthesizer.js.map +1 -0
  761. package/dist/resolution/workspace-packages.d.ts +58 -0
  762. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  763. package/dist/resolution/workspace-packages.js +346 -0
  764. package/dist/resolution/workspace-packages.js.map +1 -0
  765. package/dist/search/identifier-segments.d.ts +70 -0
  766. package/dist/search/identifier-segments.d.ts.map +1 -0
  767. package/dist/search/identifier-segments.js +205 -0
  768. package/dist/search/identifier-segments.js.map +1 -0
  769. package/dist/search/query-parser.d.ts +57 -0
  770. package/dist/search/query-parser.d.ts.map +1 -0
  771. package/dist/search/query-parser.js +177 -0
  772. package/dist/search/query-parser.js.map +1 -0
  773. package/dist/search/query-paths.d.ts +57 -0
  774. package/dist/search/query-paths.d.ts.map +1 -0
  775. package/dist/search/query-paths.js +298 -0
  776. package/dist/search/query-paths.js.map +1 -0
  777. package/dist/search/query-utils.d.ts +102 -0
  778. package/dist/search/query-utils.d.ts.map +1 -0
  779. package/dist/search/query-utils.js +487 -0
  780. package/dist/search/query-utils.js.map +1 -0
  781. package/dist/sync/git-hooks.d.ts +45 -0
  782. package/dist/sync/git-hooks.d.ts.map +1 -0
  783. package/dist/sync/git-hooks.js +227 -0
  784. package/dist/sync/git-hooks.js.map +1 -0
  785. package/dist/sync/index.d.ts +19 -0
  786. package/dist/sync/index.d.ts.map +1 -0
  787. package/dist/sync/index.js +35 -0
  788. package/dist/sync/index.js.map +1 -0
  789. package/dist/sync/watch-policy.d.ts +48 -0
  790. package/dist/sync/watch-policy.d.ts.map +1 -0
  791. package/dist/sync/watch-policy.js +124 -0
  792. package/dist/sync/watch-policy.js.map +1 -0
  793. package/dist/sync/watcher.d.ts +402 -0
  794. package/dist/sync/watcher.d.ts.map +1 -0
  795. package/dist/sync/watcher.js +978 -0
  796. package/dist/sync/watcher.js.map +1 -0
  797. package/dist/sync/worktree.d.ts +63 -0
  798. package/dist/sync/worktree.d.ts.map +1 -0
  799. package/dist/sync/worktree.js +182 -0
  800. package/dist/sync/worktree.js.map +1 -0
  801. package/dist/telemetry/index.d.ts +145 -0
  802. package/dist/telemetry/index.d.ts.map +1 -0
  803. package/dist/telemetry/index.js +592 -0
  804. package/dist/telemetry/index.js.map +1 -0
  805. package/dist/types.d.ts +473 -0
  806. package/dist/types.d.ts.map +1 -0
  807. package/dist/types.js +118 -0
  808. package/dist/types.js.map +1 -0
  809. package/dist/ui/color.d.ts +21 -0
  810. package/dist/ui/color.d.ts.map +1 -0
  811. package/dist/ui/color.js +42 -0
  812. package/dist/ui/color.js.map +1 -0
  813. package/dist/ui/glyphs.d.ts +67 -0
  814. package/dist/ui/glyphs.d.ts.map +1 -0
  815. package/dist/ui/glyphs.js +125 -0
  816. package/dist/ui/glyphs.js.map +1 -0
  817. package/dist/ui/shimmer-progress.d.ts +11 -0
  818. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  819. package/dist/ui/shimmer-progress.js +164 -0
  820. package/dist/ui/shimmer-progress.js.map +1 -0
  821. package/dist/ui/shimmer-worker.d.ts +2 -0
  822. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  823. package/dist/ui/shimmer-worker.js +126 -0
  824. package/dist/ui/shimmer-worker.js.map +1 -0
  825. package/dist/ui/types.d.ts +15 -0
  826. package/dist/ui/types.d.ts.map +1 -0
  827. package/dist/ui/types.js +3 -0
  828. package/dist/ui/types.js.map +1 -0
  829. package/dist/ui-server/api/deadcode.d.ts +84 -0
  830. package/dist/ui-server/api/deadcode.d.ts.map +1 -0
  831. package/dist/ui-server/api/deadcode.js +136 -0
  832. package/dist/ui-server/api/deadcode.js.map +1 -0
  833. package/dist/ui-server/api/effects.d.ts +87 -0
  834. package/dist/ui-server/api/effects.d.ts.map +1 -0
  835. package/dist/ui-server/api/effects.js +499 -0
  836. package/dist/ui-server/api/effects.js.map +1 -0
  837. package/dist/ui-server/api/entrypoints.d.ts +86 -0
  838. package/dist/ui-server/api/entrypoints.d.ts.map +1 -0
  839. package/dist/ui-server/api/entrypoints.js +279 -0
  840. package/dist/ui-server/api/entrypoints.js.map +1 -0
  841. package/dist/ui-server/api/events.d.ts +183 -0
  842. package/dist/ui-server/api/events.d.ts.map +1 -0
  843. package/dist/ui-server/api/events.js +430 -0
  844. package/dist/ui-server/api/events.js.map +1 -0
  845. package/dist/ui-server/api/file.d.ts +66 -0
  846. package/dist/ui-server/api/file.d.ts.map +1 -0
  847. package/dist/ui-server/api/file.js +235 -0
  848. package/dist/ui-server/api/file.js.map +1 -0
  849. package/dist/ui-server/api/filecode.d.ts +126 -0
  850. package/dist/ui-server/api/filecode.d.ts.map +1 -0
  851. package/dist/ui-server/api/filecode.js +205 -0
  852. package/dist/ui-server/api/filecode.js.map +1 -0
  853. package/dist/ui-server/api/flow.d.ts +226 -0
  854. package/dist/ui-server/api/flow.d.ts.map +1 -0
  855. package/dist/ui-server/api/flow.js +611 -0
  856. package/dist/ui-server/api/flow.js.map +1 -0
  857. package/dist/ui-server/api/hierarchy.d.ts +81 -0
  858. package/dist/ui-server/api/hierarchy.d.ts.map +1 -0
  859. package/dist/ui-server/api/hierarchy.js +92 -0
  860. package/dist/ui-server/api/hierarchy.js.map +1 -0
  861. package/dist/ui-server/api/index.d.ts +90 -0
  862. package/dist/ui-server/api/index.d.ts.map +1 -0
  863. package/dist/ui-server/api/index.js +332 -0
  864. package/dist/ui-server/api/index.js.map +1 -0
  865. package/dist/ui-server/api/map.d.ts +238 -0
  866. package/dist/ui-server/api/map.d.ts.map +1 -0
  867. package/dist/ui-server/api/map.js +681 -0
  868. package/dist/ui-server/api/map.js.map +1 -0
  869. package/dist/ui-server/api/node.d.ts +81 -0
  870. package/dist/ui-server/api/node.d.ts.map +1 -0
  871. package/dist/ui-server/api/node.js +388 -0
  872. package/dist/ui-server/api/node.js.map +1 -0
  873. package/dist/ui-server/api/nodes.d.ts +25 -0
  874. package/dist/ui-server/api/nodes.d.ts.map +1 -0
  875. package/dist/ui-server/api/nodes.js +45 -0
  876. package/dist/ui-server/api/nodes.js.map +1 -0
  877. package/dist/ui-server/api/program.d.ts +139 -0
  878. package/dist/ui-server/api/program.d.ts.map +1 -0
  879. package/dist/ui-server/api/program.js +315 -0
  880. package/dist/ui-server/api/program.js.map +1 -0
  881. package/dist/ui-server/api/respond.d.ts +76 -0
  882. package/dist/ui-server/api/respond.d.ts.map +1 -0
  883. package/dist/ui-server/api/respond.js +186 -0
  884. package/dist/ui-server/api/respond.js.map +1 -0
  885. package/dist/ui-server/api/route-roots.d.ts +39 -0
  886. package/dist/ui-server/api/route-roots.d.ts.map +1 -0
  887. package/dist/ui-server/api/route-roots.js +96 -0
  888. package/dist/ui-server/api/route-roots.js.map +1 -0
  889. package/dist/ui-server/api/routes.d.ts +59 -0
  890. package/dist/ui-server/api/routes.d.ts.map +1 -0
  891. package/dist/ui-server/api/routes.js +112 -0
  892. package/dist/ui-server/api/routes.js.map +1 -0
  893. package/dist/ui-server/api/screens.d.ts +117 -0
  894. package/dist/ui-server/api/screens.d.ts.map +1 -0
  895. package/dist/ui-server/api/screens.js +611 -0
  896. package/dist/ui-server/api/screens.js.map +1 -0
  897. package/dist/ui-server/api/search.d.ts +29 -0
  898. package/dist/ui-server/api/search.d.ts.map +1 -0
  899. package/dist/ui-server/api/search.js +232 -0
  900. package/dist/ui-server/api/search.js.map +1 -0
  901. package/dist/ui-server/api/session.d.ts +52 -0
  902. package/dist/ui-server/api/session.d.ts.map +1 -0
  903. package/dist/ui-server/api/session.js +199 -0
  904. package/dist/ui-server/api/session.js.map +1 -0
  905. package/dist/ui-server/api/source.d.ts +200 -0
  906. package/dist/ui-server/api/source.d.ts.map +1 -0
  907. package/dist/ui-server/api/source.js +419 -0
  908. package/dist/ui-server/api/source.js.map +1 -0
  909. package/dist/ui-server/api/stats.d.ts +27 -0
  910. package/dist/ui-server/api/stats.d.ts.map +1 -0
  911. package/dist/ui-server/api/stats.js +164 -0
  912. package/dist/ui-server/api/stats.js.map +1 -0
  913. package/dist/ui-server/api/steps.d.ts +274 -0
  914. package/dist/ui-server/api/steps.d.ts.map +1 -0
  915. package/dist/ui-server/api/steps.js +1446 -0
  916. package/dist/ui-server/api/steps.js.map +1 -0
  917. package/dist/ui-server/api/trail-store.d.ts +142 -0
  918. package/dist/ui-server/api/trail-store.d.ts.map +1 -0
  919. package/dist/ui-server/api/trail-store.js +323 -0
  920. package/dist/ui-server/api/trail-store.js.map +1 -0
  921. package/dist/ui-server/api/trails.d.ts +163 -0
  922. package/dist/ui-server/api/trails.d.ts.map +1 -0
  923. package/dist/ui-server/api/trails.js +369 -0
  924. package/dist/ui-server/api/trails.js.map +1 -0
  925. package/dist/ui-server/api/when.d.ts +125 -0
  926. package/dist/ui-server/api/when.d.ts.map +1 -0
  927. package/dist/ui-server/api/when.js +251 -0
  928. package/dist/ui-server/api/when.js.map +1 -0
  929. package/dist/ui-server/api/wire.d.ts +179 -0
  930. package/dist/ui-server/api/wire.d.ts.map +1 -0
  931. package/dist/ui-server/api/wire.js +231 -0
  932. package/dist/ui-server/api/wire.js.map +1 -0
  933. package/dist/ui-server/assets.d.ts +40 -0
  934. package/dist/ui-server/assets.d.ts.map +1 -0
  935. package/dist/ui-server/assets.js +110 -0
  936. package/dist/ui-server/assets.js.map +1 -0
  937. package/dist/ui-server/constants.d.ts +32 -0
  938. package/dist/ui-server/constants.d.ts.map +1 -0
  939. package/dist/ui-server/constants.js +35 -0
  940. package/dist/ui-server/constants.js.map +1 -0
  941. package/dist/ui-server/highlight/index.d.ts +113 -0
  942. package/dist/ui-server/highlight/index.d.ts.map +1 -0
  943. package/dist/ui-server/highlight/index.js +307 -0
  944. package/dist/ui-server/highlight/index.js.map +1 -0
  945. package/dist/ui-server/highlight/languages.d.ts +36 -0
  946. package/dist/ui-server/highlight/languages.d.ts.map +1 -0
  947. package/dist/ui-server/highlight/languages.js +50 -0
  948. package/dist/ui-server/highlight/languages.js.map +1 -0
  949. package/dist/ui-server/index.d.ts +92 -0
  950. package/dist/ui-server/index.d.ts.map +1 -0
  951. package/dist/ui-server/index.js +399 -0
  952. package/dist/ui-server/index.js.map +1 -0
  953. package/dist/ui-server/open-browser.d.ts +31 -0
  954. package/dist/ui-server/open-browser.d.ts.map +1 -0
  955. package/dist/ui-server/open-browser.js +79 -0
  956. package/dist/ui-server/open-browser.js.map +1 -0
  957. package/dist/ui-server/security.d.ts +127 -0
  958. package/dist/ui-server/security.d.ts.map +1 -0
  959. package/dist/ui-server/security.js +332 -0
  960. package/dist/ui-server/security.js.map +1 -0
  961. package/dist/ui-server/static.d.ts +45 -0
  962. package/dist/ui-server/static.d.ts.map +1 -0
  963. package/dist/ui-server/static.js +165 -0
  964. package/dist/ui-server/static.js.map +1 -0
  965. package/dist/upgrade/index.d.ts +164 -0
  966. package/dist/upgrade/index.d.ts.map +1 -0
  967. package/dist/upgrade/index.js +649 -0
  968. package/dist/upgrade/index.js.map +1 -0
  969. package/dist/upgrade/remove-binary.d.ts +87 -0
  970. package/dist/upgrade/remove-binary.d.ts.map +1 -0
  971. package/dist/upgrade/remove-binary.js +289 -0
  972. package/dist/upgrade/remove-binary.js.map +1 -0
  973. package/dist/upgrade/update-check.d.ts +92 -0
  974. package/dist/upgrade/update-check.d.ts.map +1 -0
  975. package/dist/upgrade/update-check.js +258 -0
  976. package/dist/upgrade/update-check.js.map +1 -0
  977. package/dist/utils.d.ts +238 -0
  978. package/dist/utils.d.ts.map +1 -0
  979. package/dist/utils.js +601 -0
  980. package/dist/utils.js.map +1 -0
  981. package/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  982. package/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  983. package/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  984. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
  985. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
  986. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  987. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  988. package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  989. package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  990. package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  991. package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  992. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
  993. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
  994. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  995. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  996. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  997. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  998. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  999. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  1000. package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
  1001. package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
  1002. package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  1003. package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  1004. package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  1005. package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  1006. package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  1007. package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  1008. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
  1009. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
  1010. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  1011. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  1012. package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  1013. package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  1014. package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  1015. package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  1016. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
  1017. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
  1018. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  1019. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  1020. package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  1021. package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  1022. package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  1023. package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  1024. package/dist/viewer/assets/index-2LG7iXtP.js +97 -0
  1025. package/dist/viewer/assets/index-AtMBttuU.css +1 -0
  1026. package/dist/viewer/index.html +16 -0
  1027. package/package.json +69 -0
  1028. package/scripts/add-lang/bench.sh +60 -0
  1029. package/scripts/add-lang/check-grammar.mjs +75 -0
  1030. package/scripts/add-lang/dump-ast.mjs +103 -0
  1031. package/scripts/add-lang/verify-extraction.mjs +70 -0
  1032. package/scripts/agent-eval/ab-adoption.sh +91 -0
  1033. package/scripts/agent-eval/ab-hook.sh +86 -0
  1034. package/scripts/agent-eval/ab-impl.sh +78 -0
  1035. package/scripts/agent-eval/ab-new-vs-baseline.sh +161 -0
  1036. package/scripts/agent-eval/ab-sufficiency.sh +78 -0
  1037. package/scripts/agent-eval/allocation-fixtures.json +344 -0
  1038. package/scripts/agent-eval/arms-F.sh +21 -0
  1039. package/scripts/agent-eval/arms-matrix.sh +37 -0
  1040. package/scripts/agent-eval/audit.sh +68 -0
  1041. package/scripts/agent-eval/bench-readme.sh +48 -0
  1042. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  1043. package/scripts/agent-eval/block-read-hook.sh +19 -0
  1044. package/scripts/agent-eval/compare-arms.mjs +209 -0
  1045. package/scripts/agent-eval/diff-index-drift.mjs +102 -0
  1046. package/scripts/agent-eval/hook-settings.json +15 -0
  1047. package/scripts/agent-eval/itrun.sh +120 -0
  1048. package/scripts/agent-eval/no-cli-shim.sh +96 -0
  1049. package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
  1050. package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
  1051. package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
  1052. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
  1053. package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
  1054. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
  1055. package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
  1056. package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
  1057. package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
  1058. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
  1059. package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
  1060. package/scripts/agent-eval/offload-eval-setup.sh +24 -0
  1061. package/scripts/agent-eval/offload-eval-styles.sh +72 -0
  1062. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
  1063. package/scripts/agent-eval/offload-eval.md +76 -0
  1064. package/scripts/agent-eval/parse-arms.mjs +116 -0
  1065. package/scripts/agent-eval/parse-bench-readme.mjs +238 -0
  1066. package/scripts/agent-eval/parse-run.mjs +1401 -0
  1067. package/scripts/agent-eval/parse-session.mjs +130 -0
  1068. package/scripts/agent-eval/probe-allocation.mjs +335 -0
  1069. package/scripts/agent-eval/probe-context.mjs +21 -0
  1070. package/scripts/agent-eval/probe-decl-only.mjs +198 -0
  1071. package/scripts/agent-eval/probe-explore.mjs +40 -0
  1072. package/scripts/agent-eval/probe-factory-closure.mjs +147 -0
  1073. package/scripts/agent-eval/probe-file-spend.mjs +195 -0
  1074. package/scripts/agent-eval/probe-named-symbol.mjs +163 -0
  1075. package/scripts/agent-eval/probe-node.mjs +20 -0
  1076. package/scripts/agent-eval/probe-suite-envelope.mjs +124 -0
  1077. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  1078. package/scripts/agent-eval/probe-trace.mjs +20 -0
  1079. package/scripts/agent-eval/redirect-read-hook.sh +38 -0
  1080. package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
  1081. package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
  1082. package/scripts/agent-eval/run-agent.sh +34 -0
  1083. package/scripts/agent-eval/run-all.sh +149 -0
  1084. package/scripts/agent-eval/run-arms.sh +56 -0
  1085. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  1086. package/scripts/benchmarks/measure-index.cjs +128 -0
  1087. package/scripts/benchmarks/observe-index.py +91 -0
  1088. package/scripts/build-bundle.sh +154 -0
  1089. package/scripts/build-kernel.sh +87 -0
  1090. package/scripts/check-ui-build.mjs +157 -0
  1091. package/scripts/check-ui-package.mjs +192 -0
  1092. package/scripts/clean-remaining.mjs +243 -0
  1093. package/scripts/count-codegraph.mjs +26 -0
  1094. package/scripts/deep-clean.mjs +66 -0
  1095. package/scripts/dump-graph.mjs +57 -0
  1096. package/scripts/extract-release-notes.mjs +130 -0
  1097. package/scripts/final-codegraph-cleanup.mjs +57 -0
  1098. package/scripts/go-rebrand.mjs +114 -0
  1099. package/scripts/kernel-parity.mjs +283 -0
  1100. package/scripts/local-install.sh +41 -0
  1101. package/scripts/npm-sdk.js +75 -0
  1102. package/scripts/npm-shim.js +279 -0
  1103. package/scripts/pack-npm.sh +123 -0
  1104. package/scripts/prepare-release.mjs +270 -0
  1105. package/scripts/rebrand.mjs +129 -0
  1106. package/scripts/sync-ui-version.mjs +47 -0
  1107. package/scripts/try-repo.sh +112 -0
package/dist/index.js ADDED
@@ -0,0 +1,2005 @@
1
+ "use strict";
2
+ /**
3
+ * Alpha Code Sense
4
+ *
5
+ * A local-first code intelligence system that builds a semantic
6
+ * knowledge graph from any codebase.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
42
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.AlphaCodeSense = exports.MCPServer = exports.LockUnavailableError = exports.FileWatcher = exports.MemoryMonitor = exports.throttle = exports.debounce = exports.processInBatches = exports.FileLock = exports.Mutex = exports.defaultLogger = exports.silentLogger = exports.getLogger = exports.setLogger = exports.ConfigError = exports.VectorError = exports.SearchError = exports.DatabaseError = exports.ParseError = exports.FileError = exports.AlphaCodeSenseError = exports.loadAllGrammars = exports.loadGrammarsForLanguages = exports.initGrammars = exports.getSupportedLanguages = exports.isGrammarLoaded = exports.isLanguageSupported = exports.detectLanguage = exports.CODEGRAPH_DIR = exports.findNearestAlphaCsRoot = exports.isInitialized = exports.getAlphaCsDir = exports.QueryBuilder = exports.DatabaseConnection = exports.getDatabasePath = void 0;
49
+ const path = __importStar(require("path"));
50
+ const db_1 = require("./db");
51
+ const wal_valve_1 = require("./db/wal-valve");
52
+ const queries_1 = require("./db/queries");
53
+ const directory_1 = require("./directory");
54
+ const extraction_1 = require("./extraction");
55
+ const resolution_1 = require("./resolution");
56
+ const graph_1 = require("./graph");
57
+ const context_1 = require("./context");
58
+ const utils_1 = require("./utils");
59
+ const sync_1 = require("./sync");
60
+ const extraction_version_1 = require("./extraction/extraction-version");
61
+ const directory_2 = require("./directory");
62
+ const query_utils_1 = require("./search/query-utils");
63
+ const ignore_1 = __importDefault(require("ignore"));
64
+ const project_config_1 = require("./project-config");
65
+ const version_1 = require("./mcp/version");
66
+ const identifier_segments_1 = require("./search/identifier-segments");
67
+ const cooperative_yield_1 = require("./resolution/cooperative-yield");
68
+ const resolver_pool_1 = require("./resolution/resolver-pool");
69
+ // Re-export types for consumers
70
+ __exportStar(require("./types"), exports);
71
+ // Storage building blocks for embedded/SDK consumers that drive the graph
72
+ // directly (open a DB, run prepared queries) rather than through the Alpha Code Sense
73
+ // facade. Exposed from the package entry so they no longer require deep imports
74
+ // into dist/ (issue #354).
75
+ var db_2 = require("./db");
76
+ Object.defineProperty(exports, "getDatabasePath", { enumerable: true, get: function () { return db_2.getDatabasePath; } });
77
+ Object.defineProperty(exports, "DatabaseConnection", { enumerable: true, get: function () { return db_2.DatabaseConnection; } });
78
+ var queries_2 = require("./db/queries");
79
+ Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return queries_2.QueryBuilder; } });
80
+ var directory_3 = require("./directory");
81
+ Object.defineProperty(exports, "getAlphaCsDir", { enumerable: true, get: function () { return directory_3.getAlphaCsDir; } });
82
+ Object.defineProperty(exports, "isInitialized", { enumerable: true, get: function () { return directory_3.isInitialized; } });
83
+ Object.defineProperty(exports, "findNearestAlphaCsRoot", { enumerable: true, get: function () { return directory_3.findNearestAlphaCsRoot; } });
84
+ Object.defineProperty(exports, "CODEGRAPH_DIR", { enumerable: true, get: function () { return directory_3.CODEGRAPH_DIR; } });
85
+ var extraction_2 = require("./extraction");
86
+ Object.defineProperty(exports, "detectLanguage", { enumerable: true, get: function () { return extraction_2.detectLanguage; } });
87
+ Object.defineProperty(exports, "isLanguageSupported", { enumerable: true, get: function () { return extraction_2.isLanguageSupported; } });
88
+ Object.defineProperty(exports, "isGrammarLoaded", { enumerable: true, get: function () { return extraction_2.isGrammarLoaded; } });
89
+ Object.defineProperty(exports, "getSupportedLanguages", { enumerable: true, get: function () { return extraction_2.getSupportedLanguages; } });
90
+ Object.defineProperty(exports, "initGrammars", { enumerable: true, get: function () { return extraction_2.initGrammars; } });
91
+ Object.defineProperty(exports, "loadGrammarsForLanguages", { enumerable: true, get: function () { return extraction_2.loadGrammarsForLanguages; } });
92
+ Object.defineProperty(exports, "loadAllGrammars", { enumerable: true, get: function () { return extraction_2.loadAllGrammars; } });
93
+ var errors_1 = require("./errors");
94
+ Object.defineProperty(exports, "AlphaCodeSenseError", { enumerable: true, get: function () { return errors_1.AlphaCodeSenseError; } });
95
+ Object.defineProperty(exports, "FileError", { enumerable: true, get: function () { return errors_1.FileError; } });
96
+ Object.defineProperty(exports, "ParseError", { enumerable: true, get: function () { return errors_1.ParseError; } });
97
+ Object.defineProperty(exports, "DatabaseError", { enumerable: true, get: function () { return errors_1.DatabaseError; } });
98
+ Object.defineProperty(exports, "SearchError", { enumerable: true, get: function () { return errors_1.SearchError; } });
99
+ Object.defineProperty(exports, "VectorError", { enumerable: true, get: function () { return errors_1.VectorError; } });
100
+ Object.defineProperty(exports, "ConfigError", { enumerable: true, get: function () { return errors_1.ConfigError; } });
101
+ Object.defineProperty(exports, "setLogger", { enumerable: true, get: function () { return errors_1.setLogger; } });
102
+ Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return errors_1.getLogger; } });
103
+ Object.defineProperty(exports, "silentLogger", { enumerable: true, get: function () { return errors_1.silentLogger; } });
104
+ Object.defineProperty(exports, "defaultLogger", { enumerable: true, get: function () { return errors_1.defaultLogger; } });
105
+ var utils_2 = require("./utils");
106
+ Object.defineProperty(exports, "Mutex", { enumerable: true, get: function () { return utils_2.Mutex; } });
107
+ Object.defineProperty(exports, "FileLock", { enumerable: true, get: function () { return utils_2.FileLock; } });
108
+ Object.defineProperty(exports, "processInBatches", { enumerable: true, get: function () { return utils_2.processInBatches; } });
109
+ Object.defineProperty(exports, "debounce", { enumerable: true, get: function () { return utils_2.debounce; } });
110
+ Object.defineProperty(exports, "throttle", { enumerable: true, get: function () { return utils_2.throttle; } });
111
+ Object.defineProperty(exports, "MemoryMonitor", { enumerable: true, get: function () { return utils_2.MemoryMonitor; } });
112
+ var sync_2 = require("./sync");
113
+ Object.defineProperty(exports, "FileWatcher", { enumerable: true, get: function () { return sync_2.FileWatcher; } });
114
+ Object.defineProperty(exports, "LockUnavailableError", { enumerable: true, get: function () { return sync_2.LockUnavailableError; } });
115
+ var mcp_1 = require("./mcp");
116
+ Object.defineProperty(exports, "MCPServer", { enumerable: true, get: function () { return mcp_1.MCPServer; } });
117
+ /**
118
+ * Main Alpha Code Sense class
119
+ *
120
+ * Provides the primary interface for interacting with the code knowledge graph.
121
+ */
122
+ class AlphaCodeSense {
123
+ db;
124
+ queries;
125
+ projectRoot;
126
+ // Assigned via wireLayers() from the constructor (and again on reopen) — the
127
+ // `!` tells TS these are definitely set even though the assignment is one
128
+ // method call away from the constructor body.
129
+ orchestrator;
130
+ resolver;
131
+ graphManager;
132
+ traverser;
133
+ contextBuilder;
134
+ // Mutex for preventing concurrent indexing operations (in-process)
135
+ indexMutex = new utils_1.Mutex();
136
+ // File lock for preventing concurrent writes across processes (CLI, MCP, git hooks)
137
+ fileLock;
138
+ // File watcher for auto-sync on file changes
139
+ watcher = null;
140
+ constructor(db, queries, projectRoot) {
141
+ this.db = db;
142
+ this.queries = queries;
143
+ this.projectRoot = projectRoot;
144
+ this.fileLock = new utils_1.FileLock(path.join((0, directory_2.getAlphaCsDir)(projectRoot), 'codegraph.lock'));
145
+ this.wireLayers();
146
+ }
147
+ /**
148
+ * (Re)build the query/extraction/graph layers over the current `this.queries`
149
+ * (which wraps `this.db`). Factored out of the constructor so `reopenIfReplaced`
150
+ * can rebuild them against a fresh connection without duplicating the wiring.
151
+ * The path-based `fileLock` is independent of the DB handle, so it stays put.
152
+ */
153
+ wireLayers() {
154
+ // Down-weight the project name as a query term in search ranking — it names
155
+ // the whole repo, not a symbol, so it has no discriminative value (#720).
156
+ try {
157
+ this.queries.setProjectNameTokens((0, query_utils_1.deriveProjectNameTokens)(this.projectRoot));
158
+ }
159
+ catch {
160
+ // Best-effort: ranking still works without it.
161
+ }
162
+ // Down-weight the peripheral trees the project named in `codegraph.json`
163
+ // `deprioritize` — indexed and findable, but never outranking real code
164
+ // (#982). Ranking-only, so a bad pattern costs relevance, never recall.
165
+ //
166
+ // Read LAZILY, not once here: `wireLayers` runs from the constructor and
167
+ // from `reopenIfReplaced`, so a matcher built here would freeze at whatever
168
+ // the config said when the project opened. The MCP server caches one
169
+ // Alpha Code Sense per root for its whole lifetime, so editing `codegraph.json`
170
+ // would appear to do nothing until the process restarted — `exclude` and
171
+ // `include` do not behave that way. `loadDeprioritizePatterns` is
172
+ // mtime-cached, so this costs one `stat`; the compiled matcher is memoized
173
+ // on the pattern array's identity, which the cache keeps stable.
174
+ let cachedPatterns;
175
+ let cachedMatcher;
176
+ this.queries.setDeprioritizedPathMatcher((filePath) => {
177
+ try {
178
+ const patterns = (0, project_config_1.loadDeprioritizePatterns)(this.projectRoot);
179
+ if (patterns.length === 0)
180
+ return false;
181
+ if (patterns !== cachedPatterns) {
182
+ cachedPatterns = patterns;
183
+ cachedMatcher = (0, ignore_1.default)().add(patterns);
184
+ }
185
+ const rel = path.isAbsolute(filePath)
186
+ ? path.relative(this.projectRoot, filePath)
187
+ : filePath;
188
+ if (!rel || rel.startsWith('..'))
189
+ return false;
190
+ return cachedMatcher.ignores(rel.split(path.sep).join('/'));
191
+ }
192
+ catch {
193
+ // Ranking must never take the search down with it.
194
+ return false;
195
+ }
196
+ });
197
+ this.orchestrator = new extraction_1.ExtractionOrchestrator(this.projectRoot, this.queries);
198
+ this.resolver = (0, resolution_1.createResolver)(this.projectRoot, this.queries);
199
+ this.graphManager = new graph_1.GraphQueryManager(this.queries);
200
+ this.traverser = new graph_1.GraphTraverser(this.queries);
201
+ this.contextBuilder = (0, context_1.createContextBuilder)(this.projectRoot, this.queries, this.traverser);
202
+ }
203
+ /**
204
+ * Heal a stale database handle in place. If `.alpha-cs/` was removed and
205
+ * recreated at the SAME path while this instance held the DB open — a git
206
+ * worktree removed and re-added, or `rm -rf .codegraph` + `codegraph init` —
207
+ * our open fd points at the now-unlinked inode and can never see the new
208
+ * index, so every query returns the pre-removal snapshot until the process
209
+ * restarts (#925). When that's detected, open the live file at the same path,
210
+ * rebuild the query layers, and swap them IN PLACE, so every holder of this
211
+ * instance (the MCP daemon's default project, cached projectPath connections)
212
+ * heals without a restart. Returns true iff it reopened.
213
+ *
214
+ * POSIX-only in practice: `isReplacedOnDisk` never fires on Windows (an open
215
+ * file can't be unlinked there, and st_ino is unreliable).
216
+ */
217
+ reopenIfReplaced() {
218
+ if (!this.db.isReplacedOnDisk())
219
+ return false;
220
+ const dbPath = this.db.getPath();
221
+ // Open the live file FIRST — if that throws (e.g. mid-recreate), the old
222
+ // handle stays in place and the caller retries on the next query, rather
223
+ // than leaving this instance with no connection at all.
224
+ const fresh = db_1.DatabaseConnection.open(dbPath);
225
+ const stale = this.db;
226
+ this.db = fresh;
227
+ this.queries = new queries_1.QueryBuilder(fresh.getDb());
228
+ this.wireLayers();
229
+ // Releasing the dead handle also frees the leaked db/-wal/-shm fds that were
230
+ // pinning the unlinked inode (#925).
231
+ try {
232
+ stale.close();
233
+ }
234
+ catch { /* the old inode is gone; closing just frees fds */ }
235
+ return true;
236
+ }
237
+ // ===========================================================================
238
+ // Lifecycle Methods
239
+ // ===========================================================================
240
+ /**
241
+ * Initialize a new AlphaCodeSense project
242
+ *
243
+ * Creates the .Alpha Code Sense directory, database, and configuration.
244
+ *
245
+ * @param projectRoot - Path to the project root directory
246
+ * @param options - Initialization options
247
+ * @returns A new AlphaCodeSense instance
248
+ */
249
+ static async init(projectRoot, options = {}) {
250
+ await (0, extraction_1.initGrammars)();
251
+ const resolvedRoot = path.resolve(projectRoot);
252
+ // Check if already initialized
253
+ if ((0, directory_1.isInitialized)(resolvedRoot)) {
254
+ throw new Error(`Alpha Code Sense already initialized in ${resolvedRoot}`);
255
+ }
256
+ // Create directory structure
257
+ (0, directory_1.createDirectory)(resolvedRoot);
258
+ // Initialize database
259
+ const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
260
+ const db = db_1.DatabaseConnection.initialize(dbPath);
261
+ const queries = new queries_1.QueryBuilder(db.getDb());
262
+ const instance = new AlphaCodeSense(db, queries, resolvedRoot);
263
+ // Run initial indexing if requested
264
+ if (options.index) {
265
+ await instance.indexAll({ onProgress: options.onProgress });
266
+ }
267
+ return instance;
268
+ }
269
+ /**
270
+ * Initialize synchronously (without indexing)
271
+ */
272
+ static initSync(projectRoot) {
273
+ const resolvedRoot = path.resolve(projectRoot);
274
+ // Check if already initialized
275
+ if ((0, directory_1.isInitialized)(resolvedRoot)) {
276
+ throw new Error(`Alpha Code Sense already initialized in ${resolvedRoot}`);
277
+ }
278
+ // Create directory structure
279
+ (0, directory_1.createDirectory)(resolvedRoot);
280
+ // Initialize database
281
+ const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
282
+ const db = db_1.DatabaseConnection.initialize(dbPath);
283
+ const queries = new queries_1.QueryBuilder(db.getDb());
284
+ return new AlphaCodeSense(db, queries, resolvedRoot);
285
+ }
286
+ /**
287
+ * Open an existing Alpha Code Sense project
288
+ *
289
+ * @param projectRoot - Path to the project root directory
290
+ * @param options - Open options
291
+ * @returns A Alpha Code Sense instance
292
+ */
293
+ static async open(projectRoot, options = {}) {
294
+ await (0, extraction_1.initGrammars)();
295
+ const resolvedRoot = path.resolve(projectRoot);
296
+ // Check if initialized
297
+ if (!(0, directory_1.isInitialized)(resolvedRoot)) {
298
+ throw new Error(`Alpha Code Sense not initialized in ${resolvedRoot}. Run init() first.`);
299
+ }
300
+ // Validate directory structure
301
+ const validation = (0, directory_1.validateDirectory)(resolvedRoot);
302
+ if (!validation.valid) {
303
+ throw new Error(`Invalid Alpha Code Sense directory: ${validation.errors.join(', ')}`);
304
+ }
305
+ // Open database
306
+ const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
307
+ const db = db_1.DatabaseConnection.open(dbPath);
308
+ const queries = new queries_1.QueryBuilder(db.getDb());
309
+ const instance = new AlphaCodeSense(db, queries, resolvedRoot);
310
+ // Sync if requested
311
+ if (options.sync) {
312
+ await instance.sync();
313
+ }
314
+ return instance;
315
+ }
316
+ /**
317
+ * Rebuild the project's database from scratch and return a fresh, empty
318
+ * instance — the "same result as a fresh init" semantics that `codegraph
319
+ * index` documents.
320
+ *
321
+ * Unlike `open()` followed by `clear()`, this DISCARDS the existing
322
+ * `.alpha-cs/codegraph.db` (and its `-wal`/`-shm` sidecars) before
323
+ * re-initializing, instead of opening the old database and DELETE-ing every
324
+ * row. On a large or pre-fix poisoned index — e.g. an old graph that scanned
325
+ * an ignored gitlink corpus (#1065) into ~1.6M nodes with a multi-GB WAL —
326
+ * the per-row `nodes_fts` delete-trigger churn blocks the main thread long
327
+ * enough to trip the #850 liveness watchdog before indexing even starts, so a
328
+ * full re-index could never recover the bad state (#1067). Discarding the
329
+ * files is O(1) regardless of size, reclaims the disk, and sidesteps opening
330
+ * (and running migrations against) the poisoned database entirely.
331
+ */
332
+ static async recreate(projectRoot) {
333
+ await (0, extraction_1.initGrammars)();
334
+ const resolvedRoot = path.resolve(projectRoot);
335
+ // Check if initialized — recreate REBUILDS an existing project; it is not a
336
+ // first-time `init`.
337
+ if (!(0, directory_1.isInitialized)(resolvedRoot)) {
338
+ throw new Error(`Alpha Code Sense not initialized in ${resolvedRoot}. Run init() first.`);
339
+ }
340
+ const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
341
+ try {
342
+ (0, db_1.removeDatabaseFiles)(dbPath);
343
+ }
344
+ catch (err) {
345
+ // POSIX unlinks an open file fine; this fires mainly on Windows when a
346
+ // live daemon/MCP server still holds the database. Turn the raw EBUSY into
347
+ // an actionable instruction instead of a generic failure.
348
+ const reason = err instanceof Error ? err.message : String(err);
349
+ throw new Error(`Could not rebuild the index — the database file is in use (${reason}). ` +
350
+ `Stop any running Alpha Code Sense MCP server/daemon for this project and retry, ` +
351
+ `or remove the ${(0, directory_2.getAlphaCsDir)(resolvedRoot)} directory and run "codegraph init".`);
352
+ }
353
+ // Re-create an empty, freshly-schema'd database at the same path.
354
+ const db = db_1.DatabaseConnection.initialize(dbPath);
355
+ const queries = new queries_1.QueryBuilder(db.getDb());
356
+ return new AlphaCodeSense(db, queries, resolvedRoot);
357
+ }
358
+ /**
359
+ * Open synchronously (without sync)
360
+ */
361
+ static openSync(projectRoot) {
362
+ const resolvedRoot = path.resolve(projectRoot);
363
+ // Check if initialized
364
+ if (!(0, directory_1.isInitialized)(resolvedRoot)) {
365
+ throw new Error(`Alpha Code Sense not initialized in ${resolvedRoot}. Run init() first.`);
366
+ }
367
+ // Validate directory structure
368
+ const validation = (0, directory_1.validateDirectory)(resolvedRoot);
369
+ if (!validation.valid) {
370
+ throw new Error(`Invalid Alpha Code Sense directory: ${validation.errors.join(', ')}`);
371
+ }
372
+ // Open database
373
+ const dbPath = (0, db_1.getDatabasePath)(resolvedRoot);
374
+ const db = db_1.DatabaseConnection.open(dbPath);
375
+ const queries = new queries_1.QueryBuilder(db.getDb());
376
+ return new AlphaCodeSense(db, queries, resolvedRoot);
377
+ }
378
+ /**
379
+ * Check if a directory has been initialized as a Alpha Code Sense project
380
+ */
381
+ static isInitialized(projectRoot) {
382
+ return (0, directory_1.isInitialized)(path.resolve(projectRoot));
383
+ }
384
+ /**
385
+ * Close the Alpha Code Sense instance and release resources
386
+ */
387
+ close() {
388
+ this.unwatch();
389
+ // Release file lock if held
390
+ this.fileLock.release();
391
+ this.db.close();
392
+ }
393
+ /**
394
+ * Get the project root directory
395
+ */
396
+ getProjectRoot() {
397
+ return this.projectRoot;
398
+ }
399
+ // ===========================================================================
400
+ // Indexing
401
+ // ===========================================================================
402
+ /**
403
+ * Index all files in the project
404
+ *
405
+ * Uses a mutex to prevent concurrent indexing operations.
406
+ */
407
+ async indexAll(options = {}) {
408
+ return this.indexMutex.withLock(async () => {
409
+ try {
410
+ this.fileLock.acquire();
411
+ }
412
+ catch {
413
+ return { success: false, filesIndexed: 0, filesSkipped: 0, filesErrored: 0, nodesCreated: 0, edgesCreated: 0, errors: [{ message: 'Could not acquire file lock - another process may be indexing', severity: 'error' }], durationMs: 0 };
414
+ }
415
+ // Defer WAL auto-checkpointing for the whole bulk run (#1231): the
416
+ // default 1000-page interval re-writes hot pages into the main DB file
417
+ // over and over — ~95% of all disk I/O during a bulk index, and a
418
+ // 19+min → 45s difference on HDD-class storage. The valve bounds WAL
419
+ // growth by backfilling PASSIVEly on a worker thread (never blocking
420
+ // the writer or the #850 watchdog heartbeat); runMaintenance below does
421
+ // the final fold-up before the interval is restored in the finally.
422
+ // Kill switch: CODEGRAPH_NO_WAL_DEFER=1. Non-WAL journal modes (some
423
+ // network filesystems) have no WAL to defer — skip.
424
+ // Fast-init: on a COMPLETELY fresh DB, trade crash-durability for speed
425
+ // during the bulk build (journal in memory, no fsync). Safe because the
426
+ // DB is disposable until the index completes — index_state stays
427
+ // 'indexing' and a crashed init is re-run from scratch; existing DBs
428
+ // (re-index/sync) never take this path. Kill switch:
429
+ // CODEGRAPH_NO_FAST_INIT=1 (same pattern as CODEGRAPH_NO_WAL_DEFER).
430
+ const freshDb = this.queries.getNodeAndEdgeCount().nodes === 0;
431
+ const fastInit = process.env.CODEGRAPH_NO_FAST_INIT !== '1' && freshDb;
432
+ if (fastInit) {
433
+ try {
434
+ this.db.getDb().pragma('journal_mode = MEMORY');
435
+ this.db.getDb().pragma('synchronous = OFF');
436
+ }
437
+ catch { /* keep WAL */ }
438
+ }
439
+ const deferWal = !fastInit && process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
440
+ let walValve = null;
441
+ let priorAutocheckpoint = 1000;
442
+ // Set when the fastInit+pool path below defers autocheckpointing, so the
443
+ // finally knows to restore the interval on that path too.
444
+ let restoreAutocheckpoint = false;
445
+ if (deferWal) {
446
+ priorAutocheckpoint = this.db.getWalAutocheckpoint();
447
+ this.db.setWalAutocheckpoint(0);
448
+ walValve = new wal_valve_1.WalCheckpointValve(this.db, (0, wal_valve_1.resolveWalValveMb)(process.env.CODEGRAPH_WAL_VALVE_MB, this.db.getDbFileSizeBytes()), undefined, options.verbose ? (m) => console.log(`[wal-valve] ${m}`) : undefined);
449
+ walValve.start();
450
+ }
451
+ try {
452
+ const gitState = this.orchestrator.beginGitIndexState(true);
453
+ const before = this.queries.getNodeAndEdgeCount();
454
+ // Mark the index as in-flight BEFORE any writes: a run killed
455
+ // mid-index (OOM, SIGKILL, the #850 liveness watchdog) leaves this
456
+ // marker behind, so `ltm-alpha-cs status` can tell a truncated index
457
+ // from a completed one instead of silently serving partial results.
458
+ try {
459
+ this.queries.setMetadata('index_state', 'indexing');
460
+ }
461
+ catch { /* metadata is advisory */ }
462
+ // Segment vocabulary starts empty and is repopulated by the node write
463
+ // path as every file (re-)indexes below — so a full index is also the
464
+ // orphan-cleanup pass for names deleted since the last one.
465
+ try {
466
+ this.queries.clearNameSegmentVocab();
467
+ }
468
+ catch { /* vocab is advisory — never fail an index over it */ }
469
+ // Bulk FTS mode for the mass-insert phase: drop the per-row FTS sync
470
+ // triggers, rebuild nodes_fts once from the nodes table afterwards.
471
+ // Crash inside the window is healed on the next DatabaseConnection.open.
472
+ this.db.beginBulkNodeLoad();
473
+ // Fresh-init only: also drop the parse-lane secondary indexes for the
474
+ // mass insert (the store-writer's B-tree-maintenance floor, plan §4d)
475
+ // and rebuild each in one scan afterwards. Incremental runs keep them
476
+ // — they delete per-file rows mid-phase through the file_path indexes.
477
+ if (freshDb)
478
+ this.db.beginBulkParseLoad();
479
+ let result;
480
+ try {
481
+ result = await this.orchestrator.indexAll(options.onProgress, options.signal, options.verbose, walValve ? () => walValve.backpressure() : undefined,
482
+ // Store-writer offload is fresh-DB-only: with any pre-existing
483
+ // data the store path must read (existing-file checks, cross-file
484
+ // edge snapshots) and delete, which belongs on one thread.
485
+ freshDb ? { dbPath: this.db.getPath(), fastInit } : null);
486
+ }
487
+ finally {
488
+ if (freshDb) {
489
+ const tIdx = Date.now();
490
+ await this.db.endBulkParseLoad();
491
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
492
+ console.error(`[phase-timing] parse-index-rebuild: ${Date.now() - tIdx}ms`);
493
+ }
494
+ const tFts = Date.now();
495
+ this.db.endBulkNodeLoad();
496
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
497
+ console.error(`[phase-timing] fts-rebuild: ${Date.now() - tFts}ms`);
498
+ }
499
+ // Fold the parse phase's WAL BEFORE the first post-parse reads
500
+ // (resolver re-init and resolution both read on the main thread):
501
+ // paging a bulk-write-sized WAL there is what blew the #850
502
+ // watchdog's 60s window in the #1231 repro. Off-thread + awaited,
503
+ // so the event loop keeps turning.
504
+ if (walValve)
505
+ await walValve.foldNow();
506
+ // Re-detect frameworks now that the index is populated. The resolver
507
+ // is constructed with createResolver() before any files exist, so
508
+ // framework resolvers whose detect() consults the indexed file list
509
+ // (e.g. UIKit/SwiftUI scanning for imports, swift-objc-bridge looking
510
+ // for both Swift and ObjC files) all return false on that initial pass
511
+ // and silently drop themselves. Re-initializing here gives them a
512
+ // chance to see the actual project before resolution runs.
513
+ if (result.success && result.filesIndexed > 0) {
514
+ const tReinit = Date.now();
515
+ this.resolver.initialize();
516
+ // Cross-file finalization (e.g. NestJS RouterModule prefixes). Runs
517
+ // before resolution so updated names show up in subsequent reads.
518
+ this.resolver.runPostExtract();
519
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
520
+ console.error(`[phase-timing] resolver-reinit: ${Date.now() - tReinit}ms`);
521
+ }
522
+ // Resolve references to create call/import/extends edges
523
+ if (result.success && result.filesIndexed > 0) {
524
+ // Get count without loading all refs into memory
525
+ const unresolvedCount = this.queries.getUnresolvedReferencesCount();
526
+ // Fast-init leaves the DB in memory-journal (rollback) mode, where
527
+ // the parallel resolver pool's read connections would contend with
528
+ // the main writer's exclusive commits. When the pool will actually
529
+ // run (enough pending refs), restore WAL BEFORE resolution so
530
+ // readers never block the writer; otherwise stay in the fast mode
531
+ // until the finally — sequential resolution has no readers.
532
+ if (fastInit && unresolvedCount >= (0, resolver_pool_1.minRefsForPool)()) {
533
+ try {
534
+ this.db.getDb().pragma('synchronous = NORMAL');
535
+ this.db.getDb().pragma('journal_mode = WAL');
536
+ // Defer auto-checkpointing for the resolution phase, same
537
+ // rationale as the deferWal path above: at the default 1000-page
538
+ // interval, the persist loop's edge inserts + ref deletes make
539
+ // SQLite re-write hot B-tree pages into the main DB file inline
540
+ // on the writer over and over (#1231's pathology — measured as
541
+ // ~58% of the resolution phase on a 255k-ref repo). The valve
542
+ // bounds WAL growth off-thread; runMaintenance does the final
543
+ // fold and the finally restores the interval.
544
+ priorAutocheckpoint = this.db.getWalAutocheckpoint();
545
+ this.db.setWalAutocheckpoint(0);
546
+ restoreAutocheckpoint = true;
547
+ walValve = new wal_valve_1.WalCheckpointValve(this.db, undefined, undefined, options.verbose ? (m) => console.log(`[wal-valve] ${m}`) : undefined);
548
+ walValve.start();
549
+ }
550
+ catch { /* keep current mode; resolution still works sequentially */ }
551
+ }
552
+ options.onProgress?.({
553
+ phase: 'resolving',
554
+ current: 0,
555
+ total: unresolvedCount,
556
+ });
557
+ const tResolve = Date.now();
558
+ await this.resolveReferencesBatched((current, total) => {
559
+ options.onProgress?.({
560
+ phase: 'resolving',
561
+ current,
562
+ total,
563
+ });
564
+ }, (done, totalPasses) => {
565
+ options.onProgress?.({
566
+ phase: 'linking',
567
+ current: done,
568
+ total: totalPasses,
569
+ });
570
+ }, walValve ? () => walValve.backpressure() : undefined);
571
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
572
+ console.error(`[phase-timing] resolution: ${Date.now() - tResolve}ms`);
573
+ // Second pass: chained calls whose method lives on a supertype the
574
+ // receiver conforms to (protocol-extension / inherited / default-
575
+ // interface). Needs the implements/extends edges the main pass just
576
+ // built, so it runs after resolution (#750).
577
+ const tChained = Date.now();
578
+ await this.resolver.resolveChainedCallsViaConformance();
579
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
580
+ console.error(`[synth-timing] chainedConformance: ${Date.now() - tChained}ms`);
581
+ // Same lifecycle for `this.<member>` callback registrations whose
582
+ // member is inherited from a supertype (#808).
583
+ const tDeferred = Date.now();
584
+ await this.resolver.resolveDeferredThisMemberRefs();
585
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
586
+ console.error(`[synth-timing] deferredThisMember: ${Date.now() - tDeferred}ms`);
587
+ }
588
+ // Refresh planner stats + checkpoint the WAL after bulk writes.
589
+ // Off-thread (worker connection): on a multi-GB index this is minutes
590
+ // of IO, and inline it starved the #850 watchdog AFTER a fully
591
+ // successful index. Never load-bearing for correctness.
592
+ if (result.success && result.filesIndexed > 0) {
593
+ const tMaint = Date.now();
594
+ // Quiesce the valve first so its in-flight checkpoint and the
595
+ // maintenance checkpoint don't contend for the checkpointer lock
596
+ // (the loser would silently no-op and leave the WAL unfolded).
597
+ if (walValve) {
598
+ walValve.stop();
599
+ await walValve.drain();
600
+ }
601
+ await this.db.runMaintenance();
602
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
603
+ console.error(`[phase-timing] maintenance: ${Date.now() - tMaint}ms`);
604
+ }
605
+ // The orchestrator only sees extraction-phase counts; resolution and
606
+ // synthesizer edges (often >50% of the graph on JVM repos) come later.
607
+ // Recompute against the DB so the CLI summary reports the true totals.
608
+ if (result.success && result.filesIndexed > 0) {
609
+ const tCount = Date.now();
610
+ const after = this.queries.getNodeAndEdgeCount();
611
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
612
+ console.error(`[phase-timing] count-recompute: ${Date.now() - tCount}ms`);
613
+ result.nodesCreated = after.nodes - before.nodes;
614
+ result.edgesCreated = after.edges - before.edges;
615
+ }
616
+ // Stamp the index with the engine that built it, so `ltm-alpha-cs status`
617
+ // and `ltm-alpha-cs upgrade` can recommend a re-index when the running
618
+ // engine produces richer extraction than the one on disk. Only on a
619
+ // real full index — a sync touches a subset, so it must NOT advance the
620
+ // extraction stamp (the bulk would still be stale). See extraction-version.ts.
621
+ if (result.success && result.filesIndexed > 0) {
622
+ try {
623
+ this.queries.setMetadata('indexed_with_version', version_1.AlphaCodeSensePackageVersion);
624
+ this.queries.setMetadata('indexed_with_extraction_version', String(extraction_version_1.EXTRACTION_VERSION));
625
+ }
626
+ catch { /* metadata is advisory — never fail an index over it */ }
627
+ }
628
+ if (result.success && result.filesErrored === 0 &&
629
+ (result.filesDiscovered === undefined || result.filesIndexed + result.filesSkipped >= result.filesDiscovered)) {
630
+ this.orchestrator.finishGitIndexState(gitState, true);
631
+ }
632
+ // Reconcile the scan's ground truth against what the pipeline
633
+ // accounted for. A shortfall means files were silently dropped
634
+ // (observed in the wild: a run under heavy load came up 37 files
635
+ // short with no error) — record it and tell the user, don't let the
636
+ // index pass as complete.
637
+ try {
638
+ if (!result.success) {
639
+ this.queries.setMetadata('index_state', 'failed');
640
+ }
641
+ else {
642
+ const accounted = result.filesIndexed + result.filesSkipped + result.filesErrored;
643
+ const discovered = result.filesDiscovered;
644
+ const shortfall = discovered !== undefined ? discovered - accounted : 0;
645
+ if (discovered !== undefined && shortfall > 0) {
646
+ this.queries.setMetadata('index_state', 'partial');
647
+ this.queries.setMetadata('index_files_discovered', String(discovered));
648
+ this.queries.setMetadata('index_files_accounted', String(accounted));
649
+ result.errors.push({
650
+ message: `Index is missing ${shortfall} of ${discovered} discovered files (indexed ${result.filesIndexed}, skipped ${result.filesSkipped}, errored ${result.filesErrored}). The index is PARTIAL — re-run \`codegraph index\`.`,
651
+ severity: 'warning',
652
+ code: 'index_partial',
653
+ });
654
+ }
655
+ else {
656
+ this.queries.setMetadata('index_state', 'complete');
657
+ if (discovered !== undefined) {
658
+ this.queries.setMetadata('index_files_discovered', String(discovered));
659
+ this.queries.setMetadata('index_files_accounted', String(accounted));
660
+ }
661
+ }
662
+ }
663
+ }
664
+ catch { /* metadata is advisory — never fail an index over it */ }
665
+ return result;
666
+ }
667
+ finally {
668
+ // Restore the auto-checkpoint interval AFTER the fold-up above so the
669
+ // next ordinary write doesn't inherit a giant inline checkpoint. On
670
+ // the error path the WAL may still be large; correctness is unchanged
671
+ // (SQLite replays the WAL on the next open) and the follow-up write
672
+ // that folds it is the known cost of a failed run.
673
+ if (walValve) {
674
+ walValve.stop();
675
+ await walValve.drain();
676
+ }
677
+ if (deferWal || restoreAutocheckpoint) {
678
+ try {
679
+ this.db.setWalAutocheckpoint(priorAutocheckpoint);
680
+ }
681
+ catch { /* connection may be closing */ }
682
+ }
683
+ if (fastInit) {
684
+ // Back to the durable defaults; journal_mode=WAL folds the MEMORY
685
+ // journal state into a normal WAL-mode database file.
686
+ try {
687
+ this.db.getDb().pragma('synchronous = NORMAL');
688
+ this.db.getDb().pragma('journal_mode = WAL');
689
+ }
690
+ catch { /* connection may be closing */ }
691
+ }
692
+ this.fileLock.release();
693
+ }
694
+ });
695
+ }
696
+ /**
697
+ * Index specific files
698
+ *
699
+ * Uses a mutex to prevent concurrent indexing operations.
700
+ */
701
+ async indexFiles(filePaths) {
702
+ return this.indexMutex.withLock(async () => {
703
+ try {
704
+ this.fileLock.acquire();
705
+ }
706
+ catch {
707
+ return { success: false, filesIndexed: 0, filesSkipped: 0, filesErrored: 0, nodesCreated: 0, edgesCreated: 0, errors: [{ message: 'Could not acquire file lock - another process may be indexing', severity: 'error' }], durationMs: 0 };
708
+ }
709
+ try {
710
+ return this.orchestrator.indexFiles(filePaths);
711
+ }
712
+ finally {
713
+ this.fileLock.release();
714
+ }
715
+ });
716
+ }
717
+ /**
718
+ * Sync with current file state (incremental update)
719
+ *
720
+ * Uses a mutex to prevent concurrent indexing operations.
721
+ */
722
+ async sync(options = {}) {
723
+ return this.indexMutex.withLock(async () => {
724
+ try {
725
+ this.fileLock.acquire();
726
+ }
727
+ catch {
728
+ return { filesChecked: 0, filesAdded: 0, filesModified: 0, filesRemoved: 0, nodesUpdated: 0, durationMs: 0 };
729
+ }
730
+ // Defer WAL auto-checkpointing for the whole incremental run, exactly
731
+ // as indexAll does for the bulk path (#1231): sync's store loop and its
732
+ // resolution passes churn the same FTS + secondary-index hot pages, and
733
+ // at the default 1000-page cadence the inline checkpoints re-write them
734
+ // over and over — on HDD-class storage a 7-file sync took 2 minutes at
735
+ // 0-2% CPU (#1248). The cost scales with the EXISTING database size,
736
+ // not the change size, so small syncs on big indexes hurt most. The
737
+ // valve bounds WAL growth off-thread; runMaintenance at the end does
738
+ // the final fold-up before the interval is restored in the finally.
739
+ // Same kill switch as indexAll: CODEGRAPH_NO_WAL_DEFER=1. Idle valve
740
+ // cost is one timer, so watcher-frequency syncs stay cheap.
741
+ const deferWal = process.env.CODEGRAPH_NO_WAL_DEFER !== '1' && this.db.getJournalMode() === 'wal';
742
+ let walValve = null;
743
+ let priorAutocheckpoint = 1000;
744
+ if (deferWal) {
745
+ priorAutocheckpoint = this.db.getWalAutocheckpoint();
746
+ this.db.setWalAutocheckpoint(0);
747
+ walValve = new wal_valve_1.WalCheckpointValve(this.db, (0, wal_valve_1.resolveWalValveMb)(process.env.CODEGRAPH_WAL_VALVE_MB, this.db.getDbFileSizeBytes()), undefined, options.verbose ? (m) => console.log(`[wal-valve] ${m}`) : undefined);
748
+ walValve.start();
749
+ }
750
+ try {
751
+ // Captured BEFORE the sync runs: the sync's own incremental writes
752
+ // populate vocab rows for the files it touches, so an end-of-sync
753
+ // emptiness check would see "non-empty" and skip the backfill forever,
754
+ // leaving every unchanged file's names unsegmented.
755
+ const vocabWasEmpty = (() => {
756
+ try {
757
+ return this.queries.isNameSegmentVocabEmpty();
758
+ }
759
+ catch {
760
+ return false;
761
+ }
762
+ })();
763
+ // Writer-side backstop for deferred WAL checkpointing (#1539): sync
764
+ // previously armed the valve but never called backpressure(), so the
765
+ // hard/file caps were never enforced during daemon catch-up — only
766
+ // timer-driven PASSIVE checkpoints ran, and a query-pool reader could
767
+ // pin frames while the WAL grew without a bound.
768
+ const backpressure = walValve ? () => walValve.backpressure() : undefined;
769
+ const fullReconcile = !options.paths || options.paths.length === 0;
770
+ const gitState = this.orchestrator.beginGitIndexState(fullReconcile);
771
+ const result = await this.orchestrator.sync(options.onProgress, options.paths, backpressure);
772
+ // Fold the store phase's WAL BEFORE the post-store reads below
773
+ // (resolution reads on the main thread) — same rationale as
774
+ // indexAll's fold between store and resolution.
775
+ if (walValve)
776
+ await walValve.foldNow();
777
+ // Cross-file finalization (e.g. NestJS RouterModule prefixes). Run on
778
+ // every sync that touched files so edits to `app.module.ts` propagate
779
+ // to controllers in unchanged files. The pass is idempotent and cheap
780
+ // (regex over *.module.ts only).
781
+ if (result.filesAdded > 0 || result.filesModified > 0) {
782
+ this.resolver.runPostExtract();
783
+ }
784
+ else if (result.filesRemoved > 0) {
785
+ // A pure-removal sync still resolves refs below — the deletion path
786
+ // resurrects the removed file's incoming edges as pending refs
787
+ // (#1240 removal case) and the orphan sweep consumes them. In a
788
+ // long-lived process (daemon) the resolver's name caches were
789
+ // warmed against the pre-removal graph; drop them so resolution
790
+ // sees the post-removal state. (runPostExtract above clears caches
791
+ // itself, so the changed-files branch is already covered.)
792
+ this.resolver.clearCaches();
793
+ }
794
+ // Resolve references if files were updated
795
+ const filesChanged = result.filesAdded > 0 || result.filesModified > 0;
796
+ if (filesChanged) {
797
+ if (result.changedFilePaths) {
798
+ // Scope resolution to changed files (git fast path — bounded set)
799
+ const tRefLoad = Date.now();
800
+ const unresolvedRefs = this.queries.getUnresolvedReferencesByFiles(result.changedFilePaths);
801
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
802
+ console.error(`[phase-timing] sync-ref-load: ${Date.now() - tRefLoad}ms (${unresolvedRefs.length} refs)`);
803
+ options.onProgress?.({
804
+ phase: 'resolving',
805
+ current: 0,
806
+ total: unresolvedRefs.length,
807
+ });
808
+ this.resolver.resolveAndPersist(unresolvedRefs, (current, total) => {
809
+ options.onProgress?.({
810
+ phase: 'resolving',
811
+ current,
812
+ total,
813
+ });
814
+ });
815
+ // Retry previously-failed refs the changed files may now satisfy
816
+ // (#1240). Scoped resolution above only re-resolves refs FROM the
817
+ // changed files — but when a changed file gains an export/symbol,
818
+ // refs in UNCHANGED files that failed against the old graph can
819
+ // now resolve, and nothing else ever revisits them (their rows
820
+ // were parked as status='failed' by an earlier completed pass).
821
+ // Look them up by the symbol names the changed files now carry
822
+ // and re-resolve just that set. On a sync where no failed ref
823
+ // matches, this is one indexed lookup.
824
+ const tRetry = Date.now();
825
+ const retryable = this.queries.getRetryableFailedReferences(this.queries.getNodeNamesByFiles(result.changedFilePaths));
826
+ if (retryable.length > 0) {
827
+ options.onProgress?.({
828
+ phase: 'resolving',
829
+ current: 0,
830
+ total: retryable.length,
831
+ });
832
+ await this.resolver.resolveAndPersistListYielding(retryable);
833
+ options.onProgress?.({
834
+ phase: 'resolving',
835
+ current: retryable.length,
836
+ total: retryable.length,
837
+ });
838
+ }
839
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
840
+ console.error(`[phase-timing] sync-failed-ref-retry: ${Date.now() - tRetry}ms (${retryable.length} refs)`);
841
+ }
842
+ else {
843
+ // No git info — use batched resolution to avoid OOM
844
+ const unresolvedCount = this.queries.getUnresolvedReferencesCount();
845
+ options.onProgress?.({
846
+ phase: 'resolving',
847
+ current: 0,
848
+ total: unresolvedCount,
849
+ });
850
+ await this.resolveReferencesBatched((current, total) => {
851
+ options.onProgress?.({
852
+ phase: 'resolving',
853
+ current,
854
+ total,
855
+ });
856
+ }, (done, totalPasses) => {
857
+ options.onProgress?.({
858
+ phase: 'linking',
859
+ current: done,
860
+ total: totalPasses,
861
+ });
862
+ }, backpressure);
863
+ }
864
+ }
865
+ // Re-open resolution edges this sync may have invalidated ELSEWHERE in
866
+ // the repo (CG-33). Everything above re-resolves references in the
867
+ // changed files; this covers the opposite direction — references in
868
+ // files the sync never touched whose answer depended on a definition
869
+ // that just appeared or disappeared. Without it a synced index never
870
+ // converges to a full rebuild: measured at 4.3% of distinct edges wrong
871
+ // on codegraph's own index, in both directions, mostly `calls`. The
872
+ // resurrected refs are pending rows, so the orphan sweep immediately
873
+ // below is what resolves them — batched, yielding, multi-pass, exactly
874
+ // as a full index resolves.
875
+ //
876
+ // `definitionDelta` is empty for a body-only edit, so the overwhelmingly
877
+ // common sync pays one branch. CODEGRAPH_NO_REBIND=1 disables it.
878
+ if (result.definitionDelta && process.env.CODEGRAPH_NO_REBIND !== '1') {
879
+ const tRebind = Date.now();
880
+ const rebound = this.orchestrator.resurrectStaleResolutionEdges(result.definitionDelta, result.changedFilePaths ?? []);
881
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
882
+ console.error(`[phase-timing] sync-rebind: ${Date.now() - tRebind}ms (${result.definitionDelta.length} changed names, ${rebound} edges re-opened)`);
883
+ }
884
+ }
885
+ // Orphan sweep (#1187). A resolution pass that dies mid-run — the #850
886
+ // daemon liveness watchdog's SIGKILL (#1122), Ctrl-C, a crash — leaves
887
+ // the refs it never reached in unresolved_refs, and the git-scoped fast
888
+ // path above never revisits them (it reads only the changed files'
889
+ // rows). Those files' call edges were then missing PERMANENTLY, with
890
+ // nothing to see except a too-small blast radius, until a full
891
+ // re-index. A completed pass takes every row it processed out of the
892
+ // PENDING set (resolved rows are deleted, unresolvable ones parked as
893
+ // status='failed' for the #1240 retry above), so any pending row now
894
+ // is such an orphan — or a row from an older engine's scoped pass.
895
+ // Grind them down with the batched resolver; this also makes a bare
896
+ // `codegraph sync` the recovery command for a wedged index. On a
897
+ // healthy index this is one COUNT query.
898
+ const orphanCount = this.queries.getUnresolvedReferencesCount();
899
+ if (orphanCount > 0) {
900
+ options.onProgress?.({
901
+ phase: 'resolving',
902
+ current: 0,
903
+ total: orphanCount,
904
+ });
905
+ await this.resolveReferencesBatched((current, total) => {
906
+ options.onProgress?.({
907
+ phase: 'resolving',
908
+ current,
909
+ total,
910
+ });
911
+ }, (done, totalPasses) => {
912
+ options.onProgress?.({
913
+ phase: 'linking',
914
+ current: done,
915
+ total: totalPasses,
916
+ });
917
+ }, backpressure);
918
+ }
919
+ if (filesChanged || orphanCount > 0) {
920
+ // Second pass: chained calls whose method lives on a supertype the
921
+ // receiver conforms to (protocol-extension / inherited). Needs the
922
+ // implements/extends edges built above (#750).
923
+ await this.resolver.resolveChainedCallsViaConformance();
924
+ // Same lifecycle for `this.<member>` callback registrations whose
925
+ // member is inherited from a supertype (#808).
926
+ await this.resolver.resolveDeferredThisMemberRefs();
927
+ }
928
+ // Refresh planner stats + checkpoint the WAL after bulk writes.
929
+ // Off-thread — see indexAll's call site.
930
+ if (filesChanged || result.filesRemoved > 0 || orphanCount > 0) {
931
+ await this.db.runMaintenance();
932
+ }
933
+ // Heal the segment vocabulary on indexes built before the table
934
+ // existed (upgrade path): incremental writes above only cover changed
935
+ // files, so a vocab that was empty when this sync STARTED means the
936
+ // bulk was never segmented — backfill it (INSERT OR IGNORE, so the
937
+ // rows the sync just wrote are fine). Batched + yielding — sync can
938
+ // run on the daemon's liveness-watchdog thread (#850/#1091).
939
+ try {
940
+ if (vocabWasEmpty && this.queries.getNodeAndEdgeCount().nodes > 0) {
941
+ await this.rebuildNameSegmentVocab();
942
+ }
943
+ }
944
+ catch { /* vocab is advisory — never fail a sync over it */ }
945
+ // A killed full index leaves this marker at `indexing`. Sync repairs
946
+ // missing files, pending refs, and (on open) dropped indexes, so a
947
+ // successful recovery must also close the metadata state (#1556).
948
+ if (fullReconcile && this.getIndexState() === 'indexing') {
949
+ try {
950
+ this.queries.setMetadata('index_state', 'complete');
951
+ }
952
+ catch { /* advisory */ }
953
+ }
954
+ this.orchestrator.finishGitIndexState(gitState, fullReconcile, result.failedFilePaths);
955
+ return result;
956
+ }
957
+ finally {
958
+ // Mirror indexAll's teardown: stop the valve, then restore the
959
+ // auto-checkpoint interval (runMaintenance above already folded the
960
+ // WAL on the success path; on the error path SQLite replays it on
961
+ // the next open).
962
+ if (walValve) {
963
+ walValve.stop();
964
+ await walValve.drain();
965
+ }
966
+ if (deferWal) {
967
+ try {
968
+ this.db.setWalAutocheckpoint(priorAutocheckpoint);
969
+ }
970
+ catch { /* connection may be closing */ }
971
+ }
972
+ this.fileLock.release();
973
+ }
974
+ });
975
+ }
976
+ /**
977
+ * Check if an indexing operation is currently in progress
978
+ */
979
+ isIndexing() {
980
+ return this.indexMutex.isLocked();
981
+ }
982
+ // ===========================================================================
983
+ // File Watching
984
+ // ===========================================================================
985
+ /**
986
+ * Start watching for file changes and auto-syncing.
987
+ *
988
+ * Uses native OS file events (FSEvents on macOS, inotify on Linux 19+,
989
+ * ReadDirectoryChangesW on Windows) with debouncing to avoid thrashing.
990
+ *
991
+ * @param options - Watch options (debounce delay, callbacks)
992
+ * @returns true if watching started successfully
993
+ */
994
+ watch(options = {}) {
995
+ if (this.watcher?.isActive())
996
+ return true;
997
+ this.watcher = new sync_1.FileWatcher(this.projectRoot, async (paths) => {
998
+ const result = await this.sync({ paths });
999
+ // sync() returns this exact zero-shape iff it failed to acquire the
1000
+ // file lock (a real empty sync always has filesChecked > 0 because
1001
+ // scanDirectory ran). Surface that to the watcher as a typed error
1002
+ // so it keeps pendingFiles + reschedules instead of clearing them
1003
+ // (#449).
1004
+ if (result.filesChecked === 0 && result.durationMs === 0) {
1005
+ throw new sync_1.LockUnavailableError();
1006
+ }
1007
+ const filesChanged = result.filesAdded + result.filesModified + result.filesRemoved;
1008
+ return { filesChanged, durationMs: result.durationMs };
1009
+ }, options);
1010
+ return this.watcher.start();
1011
+ }
1012
+ /**
1013
+ * Stop watching for file changes.
1014
+ */
1015
+ unwatch() {
1016
+ if (this.watcher) {
1017
+ this.watcher.stop();
1018
+ this.watcher = null;
1019
+ }
1020
+ }
1021
+ /**
1022
+ * Check if the file watcher is active.
1023
+ */
1024
+ isWatching() {
1025
+ return this.watcher?.isActive() ?? false;
1026
+ }
1027
+ /**
1028
+ * True once live watching has permanently degraded (OS watch-resource
1029
+ * exhaustion, or a write lock held past the retry budget) and auto-sync is
1030
+ * disabled until the next {@link watch} call. Distinct from `!isWatching()`:
1031
+ * a stopped/never-started watcher is inactive but NOT degraded. MCP tools use
1032
+ * this to surface a whole-index "results may be stale" notice, since
1033
+ * `getPendingFiles()` goes empty once watching stops (#876).
1034
+ */
1035
+ isWatcherDegraded() {
1036
+ return this.watcher?.isDegraded() ?? false;
1037
+ }
1038
+ /** The reason live watching degraded, or null if it is healthy (#876). */
1039
+ getWatcherDegradedReason() {
1040
+ return this.watcher?.getDegradedReason() ?? null;
1041
+ }
1042
+ /**
1043
+ * Files seen by the file watcher since the last successful sync —
1044
+ * the per-file "stale" signal MCP tools attach to responses so an agent
1045
+ * can fall back to {@link Read} for just the affected file without
1046
+ * waiting for a debounced sync to complete (issue #403).
1047
+ *
1048
+ * Returns an empty list when the watcher isn't active, or no events have
1049
+ * arrived. Each entry includes `firstSeenMs` and `lastSeenMs` (wall-clock
1050
+ * `Date.now()` values) so callers can render "edited Nms ago", plus an
1051
+ * `indexing` flag indicating whether the in-flight sync (if any) will
1052
+ * absorb that file.
1053
+ */
1054
+ getPendingFiles() {
1055
+ return this.watcher?.getPendingFiles() ?? [];
1056
+ }
1057
+ /**
1058
+ * Resolves once the file watcher has installed its watch set. Useful for
1059
+ * tests that need a deterministic boundary before asserting on
1060
+ * `getPendingFiles()`. Resolves immediately when no watcher is active.
1061
+ */
1062
+ waitUntilWatcherReady(timeoutMs) {
1063
+ return this.watcher ? this.watcher.waitUntilReady(timeoutMs) : Promise.resolve();
1064
+ }
1065
+ /**
1066
+ * Get files that have changed since last index
1067
+ */
1068
+ getChangedFiles() {
1069
+ return this.orchestrator.getChangedFiles();
1070
+ }
1071
+ /**
1072
+ * Most recent index timestamp (ms since epoch) across all tracked files, or
1073
+ * null when nothing is indexed yet. Lets library consumers check index
1074
+ * freshness without shelling out to `ltm-alpha-cs status --json`. (#329)
1075
+ */
1076
+ getLastIndexedAt() {
1077
+ return this.queries.getLastIndexedAt();
1078
+ }
1079
+ /**
1080
+ * How far the last sync got and how many files it left behind — the cheapest
1081
+ * marker of "has this index moved". One query; safe to call on every
1082
+ * filesystem event a live viewer sees.
1083
+ */
1084
+ getIndexRevision() {
1085
+ return this.queries.getIndexRevision();
1086
+ }
1087
+ /**
1088
+ * Files re-indexed strictly after `since`, newest first — what a sync just
1089
+ * picked up. `total` is the real count, `paths` is capped at `limit`.
1090
+ */
1091
+ getFilesIndexedSince(since, limit) {
1092
+ return this.queries.getFilesIndexedSince(since, limit);
1093
+ }
1094
+ /**
1095
+ * Forget everything held in memory about rows another process may have
1096
+ * changed.
1097
+ *
1098
+ * The query layer keeps an LRU of nodes by id, invalidated by writes made
1099
+ * through THIS instance — which is exactly right for a process that owns the
1100
+ * index, and wrong for one that is only reading a database somebody else is
1101
+ * writing. A long-lived reader (the `codegraph ui` server, a daemon holding a
1102
+ * graph open across an agent's edits) will otherwise answer `getNode(id)`
1103
+ * with a row a sync deleted minutes ago, while every SQL-backed query beside
1104
+ * it reports the truth — a disagreement that reads as a bug in whichever
1105
+ * screen shows both.
1106
+ *
1107
+ * Cheap (clearing a bounded Map) and safe to call whenever the database file
1108
+ * looks like it moved.
1109
+ */
1110
+ dropReadCaches() {
1111
+ this.queries.clearCache();
1112
+ }
1113
+ /**
1114
+ * Completeness of the last full index run. `'complete'` is the only good
1115
+ * state. `'indexing'` after the fact means a run was killed mid-index (OOM,
1116
+ * SIGKILL, liveness watchdog) and the on-disk index is truncated;
1117
+ * `'partial'` means the run finished but silently dropped files
1118
+ * (discovered > indexed+skipped+errored); `'failed'` means it reported
1119
+ * failure. `null` = index predates this marker. Surfaced by
1120
+ * `ltm-alpha-cs status`.
1121
+ */
1122
+ getIndexState() {
1123
+ const raw = this.queries.getMetadata('index_state');
1124
+ return raw === 'indexing' || raw === 'complete' || raw === 'partial' || raw === 'failed'
1125
+ ? raw
1126
+ : null;
1127
+ }
1128
+ /**
1129
+ * Which engine built the current index: the package version + extraction
1130
+ * version stamped at the last full `indexAll`. Either field is null for an
1131
+ * index built before stamping existed (treated as stale). See
1132
+ * `extraction-version.ts` and `isIndexStale()`.
1133
+ */
1134
+ getIndexBuildInfo() {
1135
+ const version = this.queries.getMetadata('indexed_with_version');
1136
+ const ev = this.queries.getMetadata('indexed_with_extraction_version');
1137
+ const parsed = ev != null ? parseInt(ev, 10) : NaN;
1138
+ return { version, extractionVersion: Number.isFinite(parsed) ? parsed : null };
1139
+ }
1140
+ /**
1141
+ * True when the on-disk index was built by an engine whose extraction is
1142
+ * older than the one now running — i.e. a re-index would add data a migration
1143
+ * can't backfill. False when there's no index yet (nothing to refresh) or the
1144
+ * stamp is current. This is the signal behind `ltm-alpha-cs status`'s re-index
1145
+ * hint and `ltm-alpha-cs upgrade`'s reminder.
1146
+ */
1147
+ isIndexStale() {
1148
+ if (this.queries.getLastIndexedAt() == null)
1149
+ return false;
1150
+ const { extractionVersion } = this.getIndexBuildInfo();
1151
+ return extractionVersion == null || extractionVersion < extraction_version_1.EXTRACTION_VERSION;
1152
+ }
1153
+ /**
1154
+ * Extract nodes and edges from source code (without storing)
1155
+ */
1156
+ extractFromSource(filePath, source) {
1157
+ return (0, extraction_1.extractFromSource)(filePath, source);
1158
+ }
1159
+ // ===========================================================================
1160
+ // Reference Resolution
1161
+ // ===========================================================================
1162
+ /**
1163
+ * Resolve unresolved references and create edges
1164
+ *
1165
+ * This method takes unresolved references from extraction and attempts
1166
+ * to resolve them using multiple strategies:
1167
+ * - Framework-specific patterns (React, Express, Laravel)
1168
+ * - Import-based resolution
1169
+ * - Name-based symbol matching
1170
+ */
1171
+ resolveReferences(onProgress) {
1172
+ // Get all unresolved references from the database
1173
+ const unresolvedRefs = this.queries.getUnresolvedReferences();
1174
+ return this.resolver.resolveAndPersist(unresolvedRefs, onProgress);
1175
+ }
1176
+ /**
1177
+ * Resolve references in batches to keep memory bounded on large codebases.
1178
+ * Processes chunks of unresolved refs, persisting results after each batch.
1179
+ */
1180
+ async resolveReferencesBatched(onProgress, onSynthesisProgress,
1181
+ // The WAL valve's writer-side backstop, threaded into the batch loop's
1182
+ // pool-idle boundaries. Without it the valve's only lever during
1183
+ // resolution is timer-driven passive checkpoints, which the pool's
1184
+ // continuous reads keep perpetually partial — the WAL then accretes the
1185
+ // whole phase's write volume (22GB on a 4.6GB DB at kernel scale).
1186
+ backpressure) {
1187
+ return this.resolver.resolveAndPersistBatched(onProgress, undefined, onSynthesisProgress, {
1188
+ dbPath: this.db.getPath(),
1189
+ // Bulk-edge-load hooks: on big runs the resolver drops the non-unique
1190
+ // edge indexes for the batch loop and recreates them before synthesis
1191
+ // (which reads kind-keyed). Concurrent readers (a daemon serving this
1192
+ // project mid-index) stay CORRECT during the window — target/kind reads
1193
+ // just degrade to scans until the recreate.
1194
+ bulkEdgeLoad: {
1195
+ begin: () => this.db.beginBulkEdgeLoad(),
1196
+ end: () => this.db.endBulkEdgeLoad(),
1197
+ },
1198
+ refIndexLoad: {
1199
+ begin: () => this.db.beginBulkRefLoad(),
1200
+ end: () => this.db.endBulkRefLoad(),
1201
+ },
1202
+ backpressure,
1203
+ });
1204
+ }
1205
+ /**
1206
+ * References extracted but never attempted by a resolution pass. Zero on a
1207
+ * healthy index — a completed pass consumes every pending row (resolving it
1208
+ * or parking it as failed, #1240). Non-zero at rest means a pass was
1209
+ * interrupted mid-run (killed indexer, crash — #1187), so some files' call
1210
+ * edges are missing; the next `sync` sweeps them.
1211
+ */
1212
+ getPendingReferenceCount() {
1213
+ return this.queries.getUnresolvedReferencesCount();
1214
+ }
1215
+ /**
1216
+ * Get detected frameworks in the project
1217
+ */
1218
+ getDetectedFrameworks() {
1219
+ return this.resolver.getDetectedFrameworks();
1220
+ }
1221
+ /**
1222
+ * Re-initialize the resolver (useful after adding new files)
1223
+ */
1224
+ reinitializeResolver() {
1225
+ this.resolver.initialize();
1226
+ }
1227
+ // ===========================================================================
1228
+ // Graph Statistics
1229
+ // ===========================================================================
1230
+ /**
1231
+ * Get statistics about the knowledge graph
1232
+ */
1233
+ getStats() {
1234
+ const stats = this.queries.getStats();
1235
+ stats.dbSizeBytes = this.db.getSize();
1236
+ stats.walSizeBytes = this.db.getWalSizeBytes();
1237
+ return stats;
1238
+ }
1239
+ /**
1240
+ * Active SQLite backend for this project's connection (`node-sqlite` — Node's
1241
+ * built-in real-SQLite module). Surfaced via `ltm-alpha-cs status` and the
1242
+ * `codegraph_status` MCP tool alongside the effective journal mode.
1243
+ */
1244
+ getBackend() {
1245
+ return this.db.getBackend();
1246
+ }
1247
+ /**
1248
+ * The journal mode actually in effect ('wal', 'delete', …). 'wal' means
1249
+ * readers never block on a concurrent writer; anything else means they can,
1250
+ * which is the precondition for the "database is locked" failures in issue
1251
+ * #238. Surfaced via `ltm-alpha-cs status` and the `codegraph_status` MCP tool.
1252
+ */
1253
+ getJournalMode() {
1254
+ return this.db.getJournalMode();
1255
+ }
1256
+ // ===========================================================================
1257
+ // Node Operations
1258
+ // ===========================================================================
1259
+ /**
1260
+ * Get a node by ID
1261
+ */
1262
+ getNode(id) {
1263
+ return this.queries.getNodeById(id);
1264
+ }
1265
+ /**
1266
+ * Get many nodes by id in ONE round-trip (LRU-cache aware).
1267
+ *
1268
+ * The batch form of {@link getNode}. Anything resolving a list of edges to
1269
+ * their endpoints — a caller list, a callee rail, an impact set — must use
1270
+ * this rather than a `getNode` per edge: a symbol with 500 callers is 500
1271
+ * queries otherwise. Ids that name nothing are simply absent from the map.
1272
+ */
1273
+ getNodesByIds(ids) {
1274
+ return this.queries.getNodesByIds(ids);
1275
+ }
1276
+ /**
1277
+ * Every symbol carrying an exact qualified name.
1278
+ *
1279
+ * The identity that survives a re-index. A node's id contains its start line,
1280
+ * so any edit ABOVE a symbol gives it a different id — anything that has to
1281
+ * name the same symbol across two indexes (a saved trail, a bookmark, a
1282
+ * review comment) has to key on this instead, and then disambiguate the
1283
+ * result by kind and file. Index-backed; unlike
1284
+ * {@link GraphQueryManager.findByQualifiedName} it takes no pattern and scans
1285
+ * nothing.
1286
+ */
1287
+ getNodesByQualifiedName(qualifiedName) {
1288
+ return this.queries.getNodesByQualifiedNameExact(qualifiedName);
1289
+ }
1290
+ /**
1291
+ * Outgoing edges for many source nodes at once — the batch form of
1292
+ * {@link getOutgoingEdges}. See {@link QueryBuilder.getOutgoingEdgesFrom}.
1293
+ */
1294
+ getOutgoingEdgesFrom(nodeIds, kinds) {
1295
+ return this.queries.getOutgoingEdgesFrom(nodeIds, kinds);
1296
+ }
1297
+ /**
1298
+ * Fan-in (incoming edge count) for many nodes at once — the "hub" signal,
1299
+ * without a query per node. See {@link QueryBuilder.countIncomingEdges}.
1300
+ */
1301
+ getFanIn(ids) {
1302
+ return this.queries.countIncomingEdges(ids);
1303
+ }
1304
+ /**
1305
+ * Incoming edges for many target nodes at once — the mirror of
1306
+ * {@link getOutgoingEdgesFrom}. See {@link QueryBuilder.getIncomingEdgesTo}.
1307
+ */
1308
+ getIncomingEdgesTo(nodeIds, kinds) {
1309
+ return this.queries.getIncomingEdgesTo(nodeIds, kinds);
1310
+ }
1311
+ /**
1312
+ * Fan-out (outgoing edge count) for many nodes at once — the mirror of
1313
+ * {@link getFanIn}. See {@link QueryBuilder.countOutgoingEdges}.
1314
+ */
1315
+ getFanOut(ids) {
1316
+ return this.queries.countOutgoingEdges(ids);
1317
+ }
1318
+ /**
1319
+ * Symbols nothing in the index points at, by kind — the candidate set the
1320
+ * dead code report (`src/graph/dead-code.ts`) applies its exclusions to.
1321
+ *
1322
+ * Every edge kind except `contains` counts as a reference, so a method is
1323
+ * not "reached" by the class that holds it. An unreferenced symbol is not
1324
+ * yet a dead one: see {@link buildDeadCodeReport}.
1325
+ */
1326
+ getUnreferencedNodes(kinds, limit) {
1327
+ return this.queries.getUnreferencedNodes(kinds, limit);
1328
+ }
1329
+ /**
1330
+ * Which of the given names are carried by more than one symbol, at least one
1331
+ * of which something references — the names a "nothing reaches this" claim
1332
+ * must not be made about, because the resolver may have picked the twin.
1333
+ */
1334
+ getAmbiguousReferencedNames(names) {
1335
+ return this.queries.getAmbiguousReferencedNames(names);
1336
+ }
1337
+ /**
1338
+ * Which of the given languages this index records an export marker for. A
1339
+ * language with none has no "reachable from outside" signal at all.
1340
+ */
1341
+ getLanguagesWithExports(languages) {
1342
+ return this.queries.getLanguagesWithExports(languages);
1343
+ }
1344
+ /**
1345
+ * Which of the given names the index holds an unresolved reference to — the
1346
+ * resolver saw the name and could not decide what it meant. A symbol with
1347
+ * such a name can never be called unreferenced.
1348
+ */
1349
+ getUnresolvedNamesAmong(names) {
1350
+ return this.queries.getUnresolvedNamesAmong(names);
1351
+ }
1352
+ /**
1353
+ * The symbols with the most distinct dependents, most first — the index's
1354
+ * hubs. Distinct dependents, not edges: a helper called forty times from one
1355
+ * function has one dependent, and it is dependents a blast radius grows from.
1356
+ */
1357
+ getTopDependedOn(limit) {
1358
+ return this.queries.getTopDependedOn(limit);
1359
+ }
1360
+ /**
1361
+ * The graph's executable roots — files that run something at module level (a
1362
+ * CLI, a worker entry, a script), ranked by calls x the number of other files
1363
+ * they reach. A statement at the top level of a file is recorded as an edge
1364
+ * out of the *file* node, which is what makes these visible at all.
1365
+ */
1366
+ getTopCallingFiles(limit) {
1367
+ return this.queries.getTopCallingFiles(limit);
1368
+ }
1369
+ /**
1370
+ * How many other files depend on each of the given files, counted through
1371
+ * their symbols (an `imports` edge points at the symbol, not the file).
1372
+ * A zero means nothing else in the index reaches into that file.
1373
+ */
1374
+ getFileDependentCounts(filePaths) {
1375
+ return new Map(this.queries.getFileDependentCounts(filePaths).map((row) => [row.filePath, row.dependents]));
1376
+ }
1377
+ /**
1378
+ * How far each of the given files reaches out: distinct other files their
1379
+ * symbols touch, and how many references that is. The mirror of
1380
+ * {@link getFileDependentCounts}; a test file's reach is what it exercises.
1381
+ */
1382
+ getFileReachCounts(filePaths) {
1383
+ return new Map(this.queries
1384
+ .getFileReachCounts(filePaths)
1385
+ .map((row) => [row.filePath, { reaches: row.reaches, refs: row.refs }]));
1386
+ }
1387
+ /** The `file` nodes for the given paths, in one query. */
1388
+ getFileNodes(filePaths) {
1389
+ return this.queries.getFileNodes(filePaths);
1390
+ }
1391
+ /**
1392
+ * Roll the edge table up to module granularity, for a file → module
1393
+ * assignment the caller decides.
1394
+ *
1395
+ * The architecture map's single query: cross-module edge counts by kind,
1396
+ * the `declared` subset of each (see {@link QueryBuilder.aggregateModuleGraph}),
1397
+ * and the busiest symbol pairs behind each link. Read-only, and bounded by
1398
+ * the number of modules rather than the number of edges.
1399
+ */
1400
+ getModuleAggregation(assignments, options) {
1401
+ return this.queries.aggregateModuleGraph(assignments, options);
1402
+ }
1403
+ /**
1404
+ * Every ordered pair of files where one reaches into the other — the edge
1405
+ * list a cycle finder runs on. See {@link QueryBuilder.getCrossFileDependencyPairs}.
1406
+ */
1407
+ getFileDependencyPairs(minConfidence = 0) {
1408
+ return this.queries.getCrossFileDependencyPairs(minConfidence);
1409
+ }
1410
+ /**
1411
+ * References from a symbol that never resolved to an indexed node — the
1412
+ * calls and type mentions that leave the index. Lets a reader account for
1413
+ * the call sites that have no callee row instead of implying there are none.
1414
+ */
1415
+ getUnresolvedReferencesFrom(nodeId) {
1416
+ return this.queries.getUnresolvedReferencesFrom(nodeId);
1417
+ }
1418
+ /**
1419
+ * The same, for every symbol in a FILE at once, in line order.
1420
+ *
1421
+ * One indexed lookup instead of one per symbol — the whole-file reader needs
1422
+ * it for every line it draws. See
1423
+ * {@link QueryBuilder.getUnresolvedReferencesInFile}.
1424
+ */
1425
+ getUnresolvedReferencesInFile(filePath, limit) {
1426
+ return this.queries.getUnresolvedReferencesInFile(filePath, limit);
1427
+ }
1428
+ /**
1429
+ * Get all nodes in a file
1430
+ */
1431
+ getNodesInFile(filePath) {
1432
+ return this.queries.getNodesByFile(filePath);
1433
+ }
1434
+ /**
1435
+ * Get all nodes of a specific kind
1436
+ */
1437
+ getNodesByKind(kind) {
1438
+ return this.queries.getNodesByKind(kind);
1439
+ }
1440
+ /**
1441
+ * Get ALL nodes with an exact name (direct index lookup, not FTS-ranked/capped).
1442
+ * Used to enumerate every overload of a heavily-overloaded name so the specific
1443
+ * definition the caller wants is never dropped below a search cut.
1444
+ */
1445
+ getNodesByName(name) {
1446
+ return this.queries.getNodesByName(name);
1447
+ }
1448
+ /** Nodes whose name starts with `prefix` (index range scan, capped). */
1449
+ getNodesByNamePrefix(prefix, limit = 20) {
1450
+ return this.queries.getNodesByNamePrefix(prefix, limit);
1451
+ }
1452
+ /**
1453
+ * Nodes whose name CONTAINS `substring` (LIKE scan, ASCII-case-insensitive,
1454
+ * shortest-first). The camel-infix lookup FTS can't do — `profileInfo`
1455
+ * inside `getProfileInfoV2` is one FTS token (#1196).
1456
+ */
1457
+ getNodesByNameSubstring(substring, options = {}) {
1458
+ return this.queries
1459
+ .findNodesByNameSubstring(substring, options)
1460
+ .map((r) => r.node);
1461
+ }
1462
+ /**
1463
+ * Search nodes by text
1464
+ */
1465
+ searchNodes(query, options) {
1466
+ return this.queries.searchNodes(query, options);
1467
+ }
1468
+ /**
1469
+ * Graph-derived prompt matching for the front-load hook's MEDIUM tier:
1470
+ * which indexed symbols do these prose words name? "state machine des
1471
+ * commandes" → `OrderStateMachine`, in any human language whose technical
1472
+ * nouns are Latin script — no keyword list involved.
1473
+ *
1474
+ * Precision comes from the repo's own naming statistics, not vocabulary:
1475
+ * - CO-OCCURRENCE: ≥2 words that are segments of the SAME name ("state" +
1476
+ * "machine" → OrderStateMachine) is strong evidence and always qualifies.
1477
+ * - RARITY: a single matched word qualifies only when its segment is
1478
+ * discriminative here (≤ {@link SEGMENT_RARITY_CEILING} distinct names) —
1479
+ * "checkout" in a shop backend yes, "state" in a react app no.
1480
+ * Every candidate is re-verified against `nodes` before being returned
1481
+ * (vocab rows are proposals; deletions leave orphans by design), so a
1482
+ * returned symbol is guaranteed to exist right now.
1483
+ */
1484
+ getSegmentMatches(words, limit = 6) {
1485
+ if (words.length === 0)
1486
+ return [];
1487
+ // Variant → original word (plural folding), for coverage accounting.
1488
+ const variantToWord = new Map();
1489
+ for (const word of words) {
1490
+ for (const variant of (0, identifier_segments_1.segmentLookupVariants)(word)) {
1491
+ if (!variantToWord.has(variant))
1492
+ variantToWord.set(variant, word);
1493
+ }
1494
+ }
1495
+ const variants = [...variantToWord.keys()];
1496
+ // Tier A: co-occurrence. The SQL folds variants back to their original
1497
+ // word (#1146), so minWords=2 means two distinct PROMPT WORDS — a name
1498
+ // matching both `service` and `services` can't tie with (or crowd past
1499
+ // the LIMIT) a genuine two-word match. The JS re-check below recomputes
1500
+ // the fold from live segments as the honesty layer.
1501
+ const variantPairs = [...variantToWord.entries()].map(([segment, word]) => ({ segment, word }));
1502
+ const candidates = [];
1503
+ for (const hit of this.queries.getSegmentCoOccurrence(variantPairs, 2, 24)) {
1504
+ const matched = this.wordsMatchingName(hit.name, variantToWord);
1505
+ if (matched.size >= 2)
1506
+ candidates.push({ name: hit.name, matchedWords: matched });
1507
+ }
1508
+ // Tier B: single rare word. Only when co-occurrence found nothing — a
1509
+ // co-occurring name is categorically stronger evidence — and under
1510
+ // stricter rules, because one word is thin: the word must be ≥5 chars
1511
+ // (measured FPs: "this", "typo"); the segment must appear in AT LEAST TWO
1512
+ // names (a concept the codebase is about clusters across names —
1513
+ // CheckoutService/CheckoutController — while a prose coincidence is a
1514
+ // singleton: measured FP "deploy to PRODUCTION" → the one name
1515
+ // matchesNonProductionDir); and the candidate name must have ≥2 segments
1516
+ // (a bare common verb matching a bare function name — "write" → `write` —
1517
+ // is prose coincidence, not the user naming a symbol).
1518
+ if (candidates.length === 0) {
1519
+ const singleWordVariants = variants.filter((v) => variantToWord.get(v).length >= 5);
1520
+ const counts = this.queries.getSegmentNameCounts(singleWordVariants);
1521
+ const rare = [...counts.entries()]
1522
+ .filter(([, n]) => n >= 2 && n <= AlphaCodeSense.SEGMENT_RARITY_CEILING)
1523
+ .sort((a, b) => a[1] - b[1])
1524
+ .slice(0, 2);
1525
+ for (const [variant] of rare) {
1526
+ const word = variantToWord.get(variant);
1527
+ for (const name of this.queries.getNamesForSegment(variant, 12)) {
1528
+ if ((0, identifier_segments_1.splitIdentifierSegments)(name).length < 2)
1529
+ continue;
1530
+ candidates.push({ name, matchedWords: new Set([word]) });
1531
+ }
1532
+ }
1533
+ }
1534
+ // Verify against nodes (the honesty gate) and pick a representative
1535
+ // definition per name. A name whose only nodes are file/import kind has
1536
+ // no real definition to point at — surfacing the import statement instead
1537
+ // reads as a matched symbol but isn't one (#1144) — so it's skipped, the
1538
+ // same way an orphaned vocab row is. (Import names no longer enter the
1539
+ // vocab at write time, but rows written before that exclusion persist
1540
+ // until the next full index.)
1541
+ const out = [];
1542
+ const seen = new Set();
1543
+ candidates.sort((a, b) => b.matchedWords.size - a.matchedWords.size || a.name.length - b.name.length);
1544
+ for (const candidate of candidates) {
1545
+ if (out.length >= limit)
1546
+ break;
1547
+ if (seen.has(candidate.name))
1548
+ continue;
1549
+ seen.add(candidate.name);
1550
+ const nodes = this.queries.getNodesByName(candidate.name);
1551
+ if (nodes.length === 0)
1552
+ continue; // orphaned vocab row — name no longer exists
1553
+ const rep = nodes.find((n) => n.kind !== 'file' && n.kind !== 'import');
1554
+ if (!rep)
1555
+ continue; // no real definition — don't surface an import/file as one
1556
+ out.push({
1557
+ name: candidate.name,
1558
+ kind: rep.kind,
1559
+ filePath: rep.filePath,
1560
+ startLine: rep.startLine ?? 0,
1561
+ matchedWords: [...candidate.matchedWords].sort(),
1562
+ });
1563
+ }
1564
+ return out;
1565
+ }
1566
+ /** A single word ("state") can match hundreds of names in a big repo — that
1567
+ * is noise, not signal. Ceiling for the single-word tier; co-occurrence is
1568
+ * exempt because two words on one name is already discriminative. */
1569
+ static SEGMENT_RARITY_CEILING = 25;
1570
+ /** Which of the prompt's original words match `name`'s segments (via
1571
+ * variants). Segments are recomputed in JS — a name-keyed vocab lookup
1572
+ * would scan the (segment, name) primary key. */
1573
+ wordsMatchingName(name, variantToWord) {
1574
+ const segments = new Set((0, identifier_segments_1.splitIdentifierSegments)(name));
1575
+ const matched = new Set();
1576
+ for (const [variant, word] of variantToWord) {
1577
+ if (segments.has(variant))
1578
+ matched.add(word);
1579
+ }
1580
+ return matched;
1581
+ }
1582
+ /**
1583
+ * One-shot upgrade heal for callers that open the graph WITHOUT syncing —
1584
+ * concretely the prompt hook, whose MEDIUM tier reads the segment
1585
+ * vocabulary: a database migrated from before the vocab table existed
1586
+ * starts with it empty, and the only other backfill lives inside `sync()`,
1587
+ * which such callers never run (#1142). Returns true when the vocab is
1588
+ * usable (already populated — the overwhelmingly common one-SELECT case —
1589
+ * or healed here); false when it isn't (empty graph, or another process
1590
+ * holds the index lock — that process's own sync heals it).
1591
+ */
1592
+ async healSegmentVocabIfEmpty() {
1593
+ const empty = (() => {
1594
+ try {
1595
+ return this.queries.isNameSegmentVocabEmpty();
1596
+ }
1597
+ catch {
1598
+ return false;
1599
+ }
1600
+ })();
1601
+ if (!empty)
1602
+ return true;
1603
+ if (this.queries.getNodeAndEdgeCount().nodes === 0)
1604
+ return false;
1605
+ return this.indexMutex.withLock(async () => {
1606
+ try {
1607
+ this.fileLock.acquire();
1608
+ }
1609
+ catch {
1610
+ return false; // an index/sync is running — it backfills the vocab itself
1611
+ }
1612
+ try {
1613
+ if (!this.queries.isNameSegmentVocabEmpty())
1614
+ return true; // raced: healed meanwhile
1615
+ await this.rebuildNameSegmentVocab();
1616
+ return true;
1617
+ }
1618
+ finally {
1619
+ this.fileLock.release();
1620
+ }
1621
+ });
1622
+ }
1623
+ /**
1624
+ * Rebuild the segment vocabulary from the current graph, batched and
1625
+ * yielding — the upgrade-heal path for indexes built before the vocab table
1626
+ * existed. Runs inside the index mutex/lock (sync and
1627
+ * healSegmentVocabIfEmpty hold them).
1628
+ */
1629
+ async rebuildNameSegmentVocab() {
1630
+ const maybeYield = (0, cooperative_yield_1.createYielder)();
1631
+ const BATCH = 2000;
1632
+ for (let offset = 0;; offset += BATCH) {
1633
+ const names = this.queries.getDistinctNodeNames(BATCH, offset);
1634
+ if (names.length === 0)
1635
+ break;
1636
+ this.queries.insertNameSegmentsBatch(names);
1637
+ await maybeYield();
1638
+ }
1639
+ }
1640
+ /**
1641
+ * Normalized project-name tokens (go.mod / package.json / repo dir) used to
1642
+ * down-weight the non-discriminative project name in search ranking (#720).
1643
+ * Exposed so explore can exclude it from the PascalCase type-disambiguation
1644
+ * bias, which would otherwise pull overloaded tokens toward whichever stack
1645
+ * embeds the project name.
1646
+ */
1647
+ getProjectNameTokens() {
1648
+ return this.queries.getProjectNameTokens();
1649
+ }
1650
+ /**
1651
+ * Find the project's "primary route file" — the file with the densest
1652
+ * concentration of framework-emitted `route` nodes (≥3 routes, ≥30%
1653
+ * of all non-test routes). Used to inline the routing config in
1654
+ * `codegraph_explore` responses on small realworld template repos
1655
+ * (rails-realworld, laravel-realworld, drupal-admintoolbar, …) where
1656
+ * Glob+Read of `routes.rb`/`urls.py`/etc. otherwise beats codegraph.
1657
+ */
1658
+ getTopRouteFile() {
1659
+ return this.queries.getTopRouteFile();
1660
+ }
1661
+ /**
1662
+ * Build a URL → handler routing manifest from the index. Each entry
1663
+ * pairs a route node (URL + method) with its handler function/method
1664
+ * via the `references` edge that framework resolvers emit. Returns
1665
+ * null when fewer than 3 valid (non-test) routes exist.
1666
+ */
1667
+ getRoutingManifest(limit) {
1668
+ return this.queries.getRoutingManifest(limit);
1669
+ }
1670
+ // ===========================================================================
1671
+ // Edge Operations
1672
+ // ===========================================================================
1673
+ /**
1674
+ * Get outgoing edges from a node
1675
+ */
1676
+ getOutgoingEdges(nodeId) {
1677
+ return this.queries.getOutgoingEdges(nodeId);
1678
+ }
1679
+ /**
1680
+ * Get incoming edges to a node
1681
+ */
1682
+ getIncomingEdges(nodeId) {
1683
+ return this.queries.getIncomingEdges(nodeId);
1684
+ }
1685
+ // ===========================================================================
1686
+ // File Operations
1687
+ // ===========================================================================
1688
+ /**
1689
+ * Get a file record by path
1690
+ */
1691
+ getFile(filePath) {
1692
+ return this.queries.getFileByPath(filePath);
1693
+ }
1694
+ /**
1695
+ * Get all tracked files
1696
+ */
1697
+ getFiles() {
1698
+ return this.queries.getAllFiles();
1699
+ }
1700
+ /**
1701
+ * A `(path) => boolean` generated-file test over a BOUNDED candidate list,
1702
+ * unioning the index-time content-banner flag with the filename convention
1703
+ * (#1500). One query up front, O(1) per call after — built for use inside a
1704
+ * ranking comparator, where re-querying per comparison would be quadratic.
1705
+ *
1706
+ * Pass every path you might ask about; a path outside the list falls back to
1707
+ * the filename check alone.
1708
+ */
1709
+ generatedFilePredicate(filePaths) {
1710
+ return this.queries.generatedPredicateFor(filePaths);
1711
+ }
1712
+ /**
1713
+ * A `(path) => boolean` ambient-declaration test over a BOUNDED candidate
1714
+ * list: true for a file that declares nothing but types, originates no call
1715
+ * edge, and that nothing in the index depends on — an ambient `.d.ts` of
1716
+ * global shims, vendored typings, module augmentation (CG-28). Structural
1717
+ * rather than extension-based, and deliberately narrow: see
1718
+ * `QueryBuilder.getAmbientDeclarationPathsAmong` for why each condition is
1719
+ * there, in particular why a `types.ts` the codebase imports is NOT flagged.
1720
+ */
1721
+ ambientDeclarationFilePredicate(filePaths) {
1722
+ return this.queries.ambientDeclarationPredicateFor(filePaths);
1723
+ }
1724
+ /** How many indexed files are flagged tool-generated. Reported by `status`. */
1725
+ getGeneratedFileCount() {
1726
+ return this.queries.countGeneratedFiles();
1727
+ }
1728
+ // ===========================================================================
1729
+ // Graph Query Methods
1730
+ // ===========================================================================
1731
+ /**
1732
+ * Get the context for a node (ancestors, children, references)
1733
+ *
1734
+ * Returns comprehensive context about a node including its containment
1735
+ * hierarchy, children, incoming/outgoing references, type information,
1736
+ * and relevant imports.
1737
+ *
1738
+ * @param nodeId - ID of the focal node
1739
+ * @returns Context object with all related information
1740
+ */
1741
+ getContext(nodeId) {
1742
+ return this.graphManager.getContext(nodeId);
1743
+ }
1744
+ /**
1745
+ * Traverse the graph from a starting node
1746
+ *
1747
+ * Uses breadth-first search by default. Supports filtering by edge types,
1748
+ * node types, and traversal direction.
1749
+ *
1750
+ * @param startId - Starting node ID
1751
+ * @param options - Traversal options
1752
+ * @returns Subgraph containing traversed nodes and edges
1753
+ */
1754
+ traverse(startId, options) {
1755
+ return this.traverser.traverseBFS(startId, options);
1756
+ }
1757
+ /**
1758
+ * Get the call graph for a function
1759
+ *
1760
+ * Returns both callers (functions that call this function) and
1761
+ * callees (functions called by this function) up to the specified depth.
1762
+ *
1763
+ * @param nodeId - ID of the function/method node
1764
+ * @param depth - Maximum depth in each direction (default: 2)
1765
+ * @returns Subgraph containing the call graph
1766
+ */
1767
+ getCallGraph(nodeId, depth = 2) {
1768
+ return this.traverser.getCallGraph(nodeId, depth);
1769
+ }
1770
+ /**
1771
+ * Get the type hierarchy for a class/interface
1772
+ *
1773
+ * Returns both ancestors (types this extends/implements) and
1774
+ * descendants (types that extend/implement this).
1775
+ *
1776
+ * @param nodeId - ID of the class/interface node
1777
+ * @returns Subgraph containing the type hierarchy
1778
+ */
1779
+ getTypeHierarchy(nodeId) {
1780
+ return this.traverser.getTypeHierarchy(nodeId);
1781
+ }
1782
+ /**
1783
+ * Find all usages of a symbol
1784
+ *
1785
+ * Returns all nodes that reference the specified symbol through
1786
+ * any edge type (calls, references, type_of, etc.).
1787
+ *
1788
+ * @param nodeId - ID of the symbol node
1789
+ * @returns Array of nodes and edges that reference this symbol
1790
+ */
1791
+ findUsages(nodeId) {
1792
+ return this.traverser.findUsages(nodeId);
1793
+ }
1794
+ /**
1795
+ * Get callers of a function/method
1796
+ *
1797
+ * @param nodeId - ID of the function/method node
1798
+ * @param maxDepth - Maximum depth to traverse (default: 1)
1799
+ * @returns Array of nodes that call this function
1800
+ */
1801
+ getCallers(nodeId, maxDepth = 1) {
1802
+ return this.traverser.getCallers(nodeId, maxDepth);
1803
+ }
1804
+ /**
1805
+ * Get callees of a function/method
1806
+ *
1807
+ * @param nodeId - ID of the function/method node
1808
+ * @param maxDepth - Maximum depth to traverse (default: 1)
1809
+ * @returns Array of nodes called by this function
1810
+ */
1811
+ getCallees(nodeId, maxDepth = 1) {
1812
+ return this.traverser.getCallees(nodeId, maxDepth);
1813
+ }
1814
+ /**
1815
+ * Calculate the impact radius of a node
1816
+ *
1817
+ * Returns all nodes that could be affected by changes to this node.
1818
+ *
1819
+ * @param nodeId - ID of the node
1820
+ * @param maxDepth - Maximum depth to traverse (default: 3)
1821
+ * @returns Subgraph containing potentially impacted nodes
1822
+ */
1823
+ getImpactRadius(nodeId, maxDepth = 3) {
1824
+ return this.traverser.getImpactRadius(nodeId, maxDepth);
1825
+ }
1826
+ /**
1827
+ * Find the shortest path between two nodes
1828
+ *
1829
+ * @param fromId - Starting node ID
1830
+ * @param toId - Target node ID
1831
+ * @param edgeKinds - Edge types to consider (all if empty)
1832
+ * @returns Array of nodes and edges forming the path, or null if no path exists
1833
+ */
1834
+ findPath(fromId, toId, edgeKinds) {
1835
+ return this.traverser.findPath(fromId, toId, edgeKinds);
1836
+ }
1837
+ /**
1838
+ * Get ancestors of a node in the containment hierarchy
1839
+ *
1840
+ * @param nodeId - ID of the node
1841
+ * @returns Array of ancestor nodes from immediate parent to root
1842
+ */
1843
+ getAncestors(nodeId) {
1844
+ return this.traverser.getAncestors(nodeId);
1845
+ }
1846
+ /**
1847
+ * Get immediate children of a node
1848
+ *
1849
+ * @param nodeId - ID of the node
1850
+ * @returns Array of child nodes
1851
+ */
1852
+ getChildren(nodeId) {
1853
+ return this.traverser.getChildren(nodeId);
1854
+ }
1855
+ /**
1856
+ * Get dependencies of a file
1857
+ *
1858
+ * @param filePath - Path to the file
1859
+ * @returns Array of file paths this file depends on
1860
+ */
1861
+ getFileDependencies(filePath) {
1862
+ return this.graphManager.getFileDependencies(filePath);
1863
+ }
1864
+ /**
1865
+ * Get dependents of a file
1866
+ *
1867
+ * @param filePath - Path to the file
1868
+ * @returns Array of file paths that depend on this file
1869
+ */
1870
+ getFileDependents(filePath) {
1871
+ return this.graphManager.getFileDependents(filePath);
1872
+ }
1873
+ /**
1874
+ * Find circular dependencies in the codebase
1875
+ *
1876
+ * @returns Array of cycles, each cycle is an array of file paths
1877
+ */
1878
+ findCircularDependencies() {
1879
+ return this.graphManager.findCircularDependencies();
1880
+ }
1881
+ /**
1882
+ * Find unreferenced symbols — the RAW candidate set.
1883
+ *
1884
+ * Non-exported symbols of the given kinds with no incoming edge but
1885
+ * `contains`. That is a fact, not a claim: on this engine's own index it
1886
+ * returns ~2 500 symbols, of which about 20 are actually unreachable. The
1887
+ * rest are overrides, framework registrations, mis-resolved twins and
1888
+ * references the extractor never recorded.
1889
+ *
1890
+ * For a list anybody should act on, use `buildDeadCodeReport` from
1891
+ * `src/graph/dead-code.ts`, which applies the exclusions and counts every one
1892
+ * of them. This method is kept as-is because it is a published API.
1893
+ *
1894
+ * @param kinds - Node kinds to check (default: functions, methods, classes)
1895
+ * @returns Array of unreferenced nodes
1896
+ */
1897
+ findDeadCode(kinds) {
1898
+ return this.graphManager.findDeadCode(kinds);
1899
+ }
1900
+ /**
1901
+ * Get complexity metrics for a node
1902
+ *
1903
+ * @param nodeId - ID of the node
1904
+ * @returns Object containing various complexity metrics
1905
+ */
1906
+ getNodeMetrics(nodeId) {
1907
+ return this.graphManager.getNodeMetrics(nodeId);
1908
+ }
1909
+ // ===========================================================================
1910
+ // Context Building
1911
+ // ===========================================================================
1912
+ /**
1913
+ * Get the source code for a node
1914
+ *
1915
+ * Reads the file and extracts the code between startLine and endLine.
1916
+ *
1917
+ * @param nodeId - ID of the node
1918
+ * @returns Code string or null if not found
1919
+ */
1920
+ async getCode(nodeId) {
1921
+ return this.contextBuilder.getCode(nodeId);
1922
+ }
1923
+ /**
1924
+ * Find relevant subgraph for a query
1925
+ *
1926
+ * Combines semantic search with graph traversal to find the most
1927
+ * relevant nodes and their relationships for a given query.
1928
+ *
1929
+ * @param query - Natural language query describing the task
1930
+ * @param options - Search and traversal options
1931
+ * @returns Subgraph of relevant nodes and edges
1932
+ */
1933
+ async findRelevantContext(query, options) {
1934
+ // Segment-vocab supplement: FTS keeps camelCase names as single tokens,
1935
+ // so a word-level query ("auto-scroll to bottom") can never reach
1936
+ // `pinFeedIfNearBottom` through search alone. Resolve the query's words
1937
+ // against name_segment_vocab (same precision rules as the prompt hook:
1938
+ // co-occurrence, else rare singles, verified against live nodes) and hand
1939
+ // the names down as dampened exact-name seeds. Callers that pass their
1940
+ // own seedNames keep them; failures degrade to no supplement.
1941
+ let seedNames = options?.seedNames;
1942
+ if (seedNames === undefined) {
1943
+ try {
1944
+ seedNames = this.getSegmentMatches((0, identifier_segments_1.extractSegmentSearchWords)(query), 8)
1945
+ .map((m) => m.name);
1946
+ }
1947
+ catch {
1948
+ seedNames = [];
1949
+ }
1950
+ }
1951
+ return this.contextBuilder.findRelevantContext(query, { ...options, seedNames });
1952
+ }
1953
+ /**
1954
+ * Build context for a task
1955
+ *
1956
+ * Creates comprehensive context by:
1957
+ * 1. Running FTS search to find entry points
1958
+ * 2. Expanding the graph around entry points
1959
+ * 3. Extracting code blocks for key nodes
1960
+ * 4. Formatting output for Claude
1961
+ *
1962
+ * @param input - Task description (string or {title, description})
1963
+ * @param options - Build options (maxNodes, includeCode, format, etc.)
1964
+ * @returns TaskContext object or formatted string (markdown/JSON)
1965
+ */
1966
+ async buildContext(input, options) {
1967
+ return this.contextBuilder.buildContext(input, options);
1968
+ }
1969
+ // ===========================================================================
1970
+ // Database Management
1971
+ // ===========================================================================
1972
+ /**
1973
+ * Optimize the database (vacuum and analyze)
1974
+ */
1975
+ optimize() {
1976
+ this.db.optimize();
1977
+ }
1978
+ /**
1979
+ * Clear all data from the graph
1980
+ */
1981
+ clear() {
1982
+ this.queries.clear();
1983
+ }
1984
+ /**
1985
+ * Alias for close() for backwards compatibility.
1986
+ * @deprecated Use close() instead
1987
+ */
1988
+ destroy() {
1989
+ this.close();
1990
+ }
1991
+ /**
1992
+ * Completely remove Alpha Code Sense from the project.
1993
+ * This closes the database and deletes the .Alpha Code Sense directory.
1994
+ *
1995
+ * WARNING: This permanently deletes all Alpha Code Sense data for the project.
1996
+ */
1997
+ uninitialize() {
1998
+ this.close();
1999
+ (0, directory_1.removeDirectory)(this.projectRoot);
2000
+ }
2001
+ }
2002
+ exports.AlphaCodeSense = AlphaCodeSense;
2003
+ // Default export
2004
+ exports.default = AlphaCodeSense;
2005
+ //# sourceMappingURL=index.js.map