codebaseiq 0.1.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 (432) hide show
  1. package/CHANGELOG.md +481 -0
  2. package/LICENSE +202 -0
  3. package/README.md +349 -0
  4. package/dist/augment-vue-worker.js +2 -0
  5. package/dist/call-graph-evidence-gNsxjCW8.d.ts +16 -0
  6. package/dist/change-analysis-types-CCtoCHbC.d.ts +9 -0
  7. package/dist/chunk-2Q2LW5JW.js +14 -0
  8. package/dist/chunk-2X7V4HS4.js +88 -0
  9. package/dist/chunk-34WBMAYK.js +2 -0
  10. package/dist/chunk-35NLDRZC.js +2 -0
  11. package/dist/chunk-362QOSFD.js +3 -0
  12. package/dist/chunk-3IER7Q6H.js +12 -0
  13. package/dist/chunk-3JSXXYTZ.js +345 -0
  14. package/dist/chunk-3LCDIREB.js +4 -0
  15. package/dist/chunk-476NR5B7.js +2 -0
  16. package/dist/chunk-4FC325IF.js +30 -0
  17. package/dist/chunk-4WKDMDEW.js +9 -0
  18. package/dist/chunk-4XTAUQFD.js +2 -0
  19. package/dist/chunk-5PUWMSDU.js +26 -0
  20. package/dist/chunk-5VKBFZZU.js +3 -0
  21. package/dist/chunk-6BQ3DSPK.js +2 -0
  22. package/dist/chunk-6CS3UQTN.js +3 -0
  23. package/dist/chunk-6MUIJMVL.js +6 -0
  24. package/dist/chunk-6NW7MU72.js +40 -0
  25. package/dist/chunk-6OAHRI2D.js +6 -0
  26. package/dist/chunk-6YTSKJJ3.js +2 -0
  27. package/dist/chunk-7FND7D7N.js +2 -0
  28. package/dist/chunk-7MGU3HPH.js +2 -0
  29. package/dist/chunk-7NVGT435.js +2 -0
  30. package/dist/chunk-7XAN6GKB.js +2 -0
  31. package/dist/chunk-AAQQPKCU.js +2 -0
  32. package/dist/chunk-ADTBPVUZ.js +21 -0
  33. package/dist/chunk-AKB7V7TV.js +2 -0
  34. package/dist/chunk-ANFVSJWQ.js +11 -0
  35. package/dist/chunk-B2OB55RR.js +3 -0
  36. package/dist/chunk-B3UYV66Z.js +4 -0
  37. package/dist/chunk-B75HZHUP.js +2 -0
  38. package/dist/chunk-BFFZDZQV.js +2 -0
  39. package/dist/chunk-BGBBVSH4.js +2 -0
  40. package/dist/chunk-BH5F2Q4O.js +2 -0
  41. package/dist/chunk-BJ6SQAEN.js +2 -0
  42. package/dist/chunk-BMYOV5GP.js +77 -0
  43. package/dist/chunk-BVAJLC5A.js +7 -0
  44. package/dist/chunk-C6SBF2WH.js +4 -0
  45. package/dist/chunk-C74PPYLA.js +3 -0
  46. package/dist/chunk-C7QOQX32.js +8 -0
  47. package/dist/chunk-CAUCPUOF.js +7 -0
  48. package/dist/chunk-CO5R3UNA.js +2 -0
  49. package/dist/chunk-CQP3THUZ.js +7 -0
  50. package/dist/chunk-CVYSU6BX.js +16 -0
  51. package/dist/chunk-CWONGW6P.js +3 -0
  52. package/dist/chunk-DDZ7VHWV.js +20 -0
  53. package/dist/chunk-DGXRDLV5.js +2 -0
  54. package/dist/chunk-DO6WQD2T.js +3 -0
  55. package/dist/chunk-DQMDCD24.js +2 -0
  56. package/dist/chunk-DR2LURYU.js +3 -0
  57. package/dist/chunk-DRENNWRG.js +2 -0
  58. package/dist/chunk-ECQBG7PW.js +564 -0
  59. package/dist/chunk-EF2R3WNQ.js +2 -0
  60. package/dist/chunk-ELNRLMC5.js +29 -0
  61. package/dist/chunk-EMNIHCRB.js +18 -0
  62. package/dist/chunk-ENCCHKM6.js +5 -0
  63. package/dist/chunk-EZNMUY67.js +5 -0
  64. package/dist/chunk-FAJQ7LWY.js +3 -0
  65. package/dist/chunk-FDGD5AB5.js +2 -0
  66. package/dist/chunk-FETNQCFO.js +117 -0
  67. package/dist/chunk-FM5BPL4V.js +60 -0
  68. package/dist/chunk-FQKZWM4L.js +49 -0
  69. package/dist/chunk-FW53T7EB.js +2 -0
  70. package/dist/chunk-G6XFR4ZL.js +4 -0
  71. package/dist/chunk-GCHRX4YW.js +4 -0
  72. package/dist/chunk-GTIYTDRE.js +562 -0
  73. package/dist/chunk-GTXSJDCO.js +2 -0
  74. package/dist/chunk-GW6Z3WGY.js +2 -0
  75. package/dist/chunk-H3LGFZVK.js +2 -0
  76. package/dist/chunk-HKQUXIFO.js +2 -0
  77. package/dist/chunk-HOA5YGOH.js +3 -0
  78. package/dist/chunk-HPJRBHVT.js +3 -0
  79. package/dist/chunk-HRWGYWRJ.js +49 -0
  80. package/dist/chunk-I2T2LLK2.js +4 -0
  81. package/dist/chunk-ICFDQHAM.js +3 -0
  82. package/dist/chunk-ID63777H.js +4 -0
  83. package/dist/chunk-IJ4HMYBE.js +3 -0
  84. package/dist/chunk-ILMHV3KM.js +2 -0
  85. package/dist/chunk-IOP6FWIM.js +2 -0
  86. package/dist/chunk-IRQOAM5G.js +2 -0
  87. package/dist/chunk-J77SU6VA.js +38 -0
  88. package/dist/chunk-JE3WZ6II.js +2 -0
  89. package/dist/chunk-JEJLSICM.js +4 -0
  90. package/dist/chunk-JOIRNPPY.js +2 -0
  91. package/dist/chunk-JSOYNVWH.js +3 -0
  92. package/dist/chunk-KMITESMT.js +2 -0
  93. package/dist/chunk-KUW32IRO.js +2 -0
  94. package/dist/chunk-KWVHSKHK.js +31 -0
  95. package/dist/chunk-L4NRUAGJ.js +18 -0
  96. package/dist/chunk-L57ZKWVG.js +6 -0
  97. package/dist/chunk-LTA3BRZX.js +2 -0
  98. package/dist/chunk-LU3BMVH2.js +10 -0
  99. package/dist/chunk-LZYFLFEH.js +2 -0
  100. package/dist/chunk-MOVBWNIP.js +16 -0
  101. package/dist/chunk-MVB3DAEY.js +3 -0
  102. package/dist/chunk-N3IQCBCF.js +29 -0
  103. package/dist/chunk-NAUD7LCA.js +2 -0
  104. package/dist/chunk-NCZUNH3E.js +109 -0
  105. package/dist/chunk-NE6IU5ZD.js +5 -0
  106. package/dist/chunk-NEDP5RFQ.js +60 -0
  107. package/dist/chunk-NMTSZXCL.js +2 -0
  108. package/dist/chunk-NNJ2KZZG.js +4 -0
  109. package/dist/chunk-NNO6A2PO.js +2 -0
  110. package/dist/chunk-NNOKTMZT.js +20 -0
  111. package/dist/chunk-O6QTXQPJ.js +13 -0
  112. package/dist/chunk-OANDYLJQ.js +2 -0
  113. package/dist/chunk-OFBE4NGP.js +2 -0
  114. package/dist/chunk-OGTFJ3XD.js +2 -0
  115. package/dist/chunk-OL6KJP3N.js +16 -0
  116. package/dist/chunk-OLF4MA5W.js +8 -0
  117. package/dist/chunk-OTOKVOJ3.js +2 -0
  118. package/dist/chunk-OVTS4DKB.js +2 -0
  119. package/dist/chunk-OZYRSMSH.js +3 -0
  120. package/dist/chunk-P5XHIJHI.js +2 -0
  121. package/dist/chunk-PBI2LFKH.js +2 -0
  122. package/dist/chunk-PIOMTC27.js +2 -0
  123. package/dist/chunk-PTAWHLVJ.js +6 -0
  124. package/dist/chunk-PX4RYAAK.js +2 -0
  125. package/dist/chunk-PYAB5SM6.js +7 -0
  126. package/dist/chunk-Q5ELPRKQ.js +2 -0
  127. package/dist/chunk-Q65CQ4XL.js +2 -0
  128. package/dist/chunk-Q72QSKXC.js +308 -0
  129. package/dist/chunk-QCN62RTF.js +3 -0
  130. package/dist/chunk-QDCCHMVZ.js +2 -0
  131. package/dist/chunk-QHRNXP3C.js +3 -0
  132. package/dist/chunk-QKPLA6IC.js +2 -0
  133. package/dist/chunk-QOKYJ33H.js +2 -0
  134. package/dist/chunk-QW7EP6WI.js +21 -0
  135. package/dist/chunk-R2NOK63J.js +4 -0
  136. package/dist/chunk-RBAS5ZHI.js +2 -0
  137. package/dist/chunk-RDBI2RXU.js +9 -0
  138. package/dist/chunk-RKEJ6VTF.js +73 -0
  139. package/dist/chunk-RR7SX44N.js +35 -0
  140. package/dist/chunk-RU65DDUP.js +215 -0
  141. package/dist/chunk-SELM5MER.js +2 -0
  142. package/dist/chunk-SGX43S2L.js +2 -0
  143. package/dist/chunk-SMRBZ6EC.js +2 -0
  144. package/dist/chunk-SNNWPCN7.js +4 -0
  145. package/dist/chunk-ST7V3SKN.js +2 -0
  146. package/dist/chunk-SWHMHUKF.js +2 -0
  147. package/dist/chunk-SYDJMPES.js +2 -0
  148. package/dist/chunk-SZD2KF7Q.js +2 -0
  149. package/dist/chunk-T3DGWPXM.js +3 -0
  150. package/dist/chunk-TFZB6XTM.js +239 -0
  151. package/dist/chunk-TIIC3ZE7.js +2 -0
  152. package/dist/chunk-TRRC4ZJ7.js +2 -0
  153. package/dist/chunk-TXXOEMZJ.js +2 -0
  154. package/dist/chunk-UBGWN7I4.js +2 -0
  155. package/dist/chunk-UCD3H3UZ.js +5 -0
  156. package/dist/chunk-UDS562V4.js +5 -0
  157. package/dist/chunk-UNBY47BC.js +3 -0
  158. package/dist/chunk-UP3BUZR5.js +74 -0
  159. package/dist/chunk-UXM43C7T.js +3 -0
  160. package/dist/chunk-UZGZB3VB.js +3 -0
  161. package/dist/chunk-VE5AVNMP.js +2 -0
  162. package/dist/chunk-VEXUL62T.js +2 -0
  163. package/dist/chunk-VFY6Y2H6.js +61 -0
  164. package/dist/chunk-VUIYB2V3.js +2 -0
  165. package/dist/chunk-VXYS3FZD.js +23 -0
  166. package/dist/chunk-WE5RZHZ7.js +5 -0
  167. package/dist/chunk-WMPRTGH2.js +2 -0
  168. package/dist/chunk-WOQBZPIF.js +2 -0
  169. package/dist/chunk-XLQ3GLWZ.js +2 -0
  170. package/dist/chunk-XME3HPXZ.js +2 -0
  171. package/dist/chunk-XMQ23E27.js +2 -0
  172. package/dist/chunk-XWUOUWYI.js +2 -0
  173. package/dist/chunk-XZEE23VG.js +5 -0
  174. package/dist/chunk-Y6KHROC3.js +7 -0
  175. package/dist/chunk-YESXMKX3.js +3 -0
  176. package/dist/chunk-YMGZZEW4.js +2 -0
  177. package/dist/chunk-YSNONTJ2.js +2 -0
  178. package/dist/chunk-YUKYB54I.js +1 -0
  179. package/dist/chunk-YVCIMIOC.js +12 -0
  180. package/dist/chunk-Z54RD7VL.js +3 -0
  181. package/dist/chunk-ZKX2FRS6.js +15 -0
  182. package/dist/chunk-ZMI2JSX2.js +2 -0
  183. package/dist/chunk-ZV3JV5G5.js +8 -0
  184. package/dist/chunk-ZZ3MWF33.js +4 -0
  185. package/dist/chunk-ZZXSWSN6.js +2 -0
  186. package/dist/cli-context-3SNLDYBM.js +3 -0
  187. package/dist/cli-context-T3B7W6GG.js +2 -0
  188. package/dist/cli-program-YNOXO72B.js +7 -0
  189. package/dist/cli.js +3 -0
  190. package/dist/code-DlqpBDd0.d.ts +121 -0
  191. package/dist/command-descriptors-6AOUKWW7.js +346 -0
  192. package/dist/command-descriptors-ZFKJSRUP.js +344 -0
  193. package/dist/command-panels-SZONPMLJ.js +3 -0
  194. package/dist/config-types-BNoC96J3.d.ts +560 -0
  195. package/dist/db-D7sauVFH.d.ts +95 -0
  196. package/dist/direct-navigation-DP4LVMRX.js +3 -0
  197. package/dist/direct-navigation-FLUS3BT6.js +2 -0
  198. package/dist/exploration-topology-BG4v30HZ.d.ts +256 -0
  199. package/dist/file-dep-graph-Bqg3t3Px.d.ts +4 -0
  200. package/dist/file-kind-BKCVMNUf.d.ts +10 -0
  201. package/dist/frontend-behavior-evidence-EfM4_9bc.d.ts +4 -0
  202. package/dist/git-history-ChNHbfZQ.d.ts +13 -0
  203. package/dist/graph-evidence-BIFqyisO.d.ts +131 -0
  204. package/dist/health-DJaZXg8I.d.ts +340 -0
  205. package/dist/index.d.ts +183 -0
  206. package/dist/index.js +2 -0
  207. package/dist/invocation-command-descriptors-QT2JMY5J.js +3 -0
  208. package/dist/invocation-command-descriptors-YN4QJEAX.js +2 -0
  209. package/dist/next-anchor-candidates-BwMczMvX.d.ts +90 -0
  210. package/dist/output-continuation-command-2V2SL4TD.js +2 -0
  211. package/dist/output-continuation-command-65J5IP3O.js +3 -0
  212. package/dist/postinstall.js +3 -0
  213. package/dist/project-reindex-5JOKXAXT.js +2 -0
  214. package/dist/project-reindex-UQBIKO4M.js +3 -0
  215. package/dist/queries/affected.d.ts +40 -0
  216. package/dist/queries/affected.js +2 -0
  217. package/dist/queries/anchors.d.ts +123 -0
  218. package/dist/queries/anchors.js +2 -0
  219. package/dist/queries/architecture.d.ts +166 -0
  220. package/dist/queries/architecture.js +2 -0
  221. package/dist/queries/bottlenecks.d.ts +68 -0
  222. package/dist/queries/bottlenecks.js +2 -0
  223. package/dist/queries/by-kind.d.ts +27 -0
  224. package/dist/queries/by-kind.js +2 -0
  225. package/dist/queries/call-graph.d.ts +52 -0
  226. package/dist/queries/call-graph.js +2 -0
  227. package/dist/queries/change-surface.d.ts +55 -0
  228. package/dist/queries/change-surface.js +2 -0
  229. package/dist/queries/cleanup-plan.d.ts +66 -0
  230. package/dist/queries/cleanup-plan.js +2 -0
  231. package/dist/queries/co-change.d.ts +90 -0
  232. package/dist/queries/co-change.js +2 -0
  233. package/dist/queries/code.d.ts +6 -0
  234. package/dist/queries/code.js +2 -0
  235. package/dist/queries/complexity-hotspots.d.ts +61 -0
  236. package/dist/queries/complexity-hotspots.js +2 -0
  237. package/dist/queries/complexity.d.ts +74 -0
  238. package/dist/queries/complexity.js +2 -0
  239. package/dist/queries/context.d.ts +146 -0
  240. package/dist/queries/context.js +2 -0
  241. package/dist/queries/convergence.d.ts +33 -0
  242. package/dist/queries/convergence.js +2 -0
  243. package/dist/queries/coupling.d.ts +32 -0
  244. package/dist/queries/coupling.js +2 -0
  245. package/dist/queries/cycles.d.ts +66 -0
  246. package/dist/queries/cycles.js +2 -0
  247. package/dist/queries/dataflow.d.ts +77 -0
  248. package/dist/queries/dataflow.js +2 -0
  249. package/dist/queries/dead.d.ts +58 -0
  250. package/dist/queries/dead.js +2 -0
  251. package/dist/queries/decorative-checkers.d.ts +34 -0
  252. package/dist/queries/decorative-checkers.js +2 -0
  253. package/dist/queries/deep-chains.d.ts +5 -0
  254. package/dist/queries/deep-chains.js +2 -0
  255. package/dist/queries/dependence-slice.d.ts +46 -0
  256. package/dist/queries/dependence-slice.js +2 -0
  257. package/dist/queries/dependency-depth.d.ts +49 -0
  258. package/dist/queries/dependency-depth.js +2 -0
  259. package/dist/queries/deps.d.ts +15 -0
  260. package/dist/queries/deps.js +2 -0
  261. package/dist/queries/diff-impact.d.ts +165 -0
  262. package/dist/queries/diff-impact.js +2 -0
  263. package/dist/queries/doc-drift.d.ts +115 -0
  264. package/dist/queries/doc-drift.js +2 -0
  265. package/dist/queries/drift.d.ts +79 -0
  266. package/dist/queries/drift.js +2 -0
  267. package/dist/queries/duplicate-bodies.d.ts +55 -0
  268. package/dist/queries/duplicate-bodies.js +2 -0
  269. package/dist/queries/entry-map.d.ts +121 -0
  270. package/dist/queries/entry-map.js +2 -0
  271. package/dist/queries/evidence.d.ts +70 -0
  272. package/dist/queries/evidence.js +2 -0
  273. package/dist/queries/extract-candidates.d.ts +52 -0
  274. package/dist/queries/extract-candidates.js +2 -0
  275. package/dist/queries/fan.d.ts +53 -0
  276. package/dist/queries/fan.js +2 -0
  277. package/dist/queries/files.d.ts +20 -0
  278. package/dist/queries/files.js +2 -0
  279. package/dist/queries/health.d.ts +8 -0
  280. package/dist/queries/health.js +2 -0
  281. package/dist/queries/hierarchy.d.ts +21 -0
  282. package/dist/queries/hierarchy.js +2 -0
  283. package/dist/queries/hotspots.d.ts +42 -0
  284. package/dist/queries/hotspots.js +2 -0
  285. package/dist/queries/imports.d.ts +34 -0
  286. package/dist/queries/imports.js +2 -0
  287. package/dist/queries/incomplete-migration.d.ts +90 -0
  288. package/dist/queries/incomplete-migration.js +2 -0
  289. package/dist/queries/index.d.ts +180 -0
  290. package/dist/queries/index.js +2 -0
  291. package/dist/queries/isolated.d.ts +24 -0
  292. package/dist/queries/isolated.js +2 -0
  293. package/dist/queries/locality-candidates.d.ts +51 -0
  294. package/dist/queries/locality-candidates.js +2 -0
  295. package/dist/queries/members.d.ts +21 -0
  296. package/dist/queries/members.js +2 -0
  297. package/dist/queries/methods.d.ts +43 -0
  298. package/dist/queries/methods.js +2 -0
  299. package/dist/queries/not-implemented.d.ts +33 -0
  300. package/dist/queries/not-implemented.js +2 -0
  301. package/dist/queries/outline.d.ts +22 -0
  302. package/dist/queries/outline.js +2 -0
  303. package/dist/queries/passthrough-candidates.d.ts +41 -0
  304. package/dist/queries/passthrough-candidates.js +2 -0
  305. package/dist/queries/plan-context.d.ts +33 -0
  306. package/dist/queries/plan-context.js +2 -0
  307. package/dist/queries/react-component-duplicates.d.ts +39 -0
  308. package/dist/queries/react-component-duplicates.js +2 -0
  309. package/dist/queries/react-hook-candidates.d.ts +44 -0
  310. package/dist/queries/react-hook-candidates.js +2 -0
  311. package/dist/queries/react-large-component-pressure.d.ts +34 -0
  312. package/dist/queries/react-large-component-pressure.js +2 -0
  313. package/dist/queries/recent-duplicates.d.ts +79 -0
  314. package/dist/queries/recent-duplicates.js +2 -0
  315. package/dist/queries/redundant-reexports.d.ts +37 -0
  316. package/dist/queries/redundant-reexports.js +2 -0
  317. package/dist/queries/reference-neighborhood.d.ts +4 -0
  318. package/dist/queries/reference-neighborhood.js +2 -0
  319. package/dist/queries/reference-reachability.d.ts +48 -0
  320. package/dist/queries/reference-reachability.js +2 -0
  321. package/dist/queries/refs.d.ts +13 -0
  322. package/dist/queries/refs.js +2 -0
  323. package/dist/queries/self-audit.d.ts +65 -0
  324. package/dist/queries/self-audit.js +2 -0
  325. package/dist/queries/similar-chains.d.ts +48 -0
  326. package/dist/queries/similar-chains.js +2 -0
  327. package/dist/queries/similar-files.d.ts +35 -0
  328. package/dist/queries/similar-files.js +2 -0
  329. package/dist/queries/similar-signatures.d.ts +46 -0
  330. package/dist/queries/similar-signatures.js +2 -0
  331. package/dist/queries/similar.d.ts +187 -0
  332. package/dist/queries/similar.js +2 -0
  333. package/dist/queries/slice.d.ts +4 -0
  334. package/dist/queries/slice.js +2 -0
  335. package/dist/queries/source-inspection.d.ts +209 -0
  336. package/dist/queries/source-inspection.js +2 -0
  337. package/dist/queries/source-search.d.ts +85 -0
  338. package/dist/queries/source-search.js +2 -0
  339. package/dist/queries/stale-abstractions.d.ts +72 -0
  340. package/dist/queries/stale-abstractions.js +2 -0
  341. package/dist/queries/stats.d.ts +15 -0
  342. package/dist/queries/stats.js +2 -0
  343. package/dist/queries/surface.d.ts +22 -0
  344. package/dist/queries/surface.js +2 -0
  345. package/dist/queries/symbols.d.ts +14 -0
  346. package/dist/queries/symbols.js +2 -0
  347. package/dist/queries/system-map.d.ts +449 -0
  348. package/dist/queries/system-map.js +2 -0
  349. package/dist/queries/system.d.ts +21 -0
  350. package/dist/queries/system.js +2 -0
  351. package/dist/queries/test-quality.d.ts +56 -0
  352. package/dist/queries/test-quality.js +2 -0
  353. package/dist/queries/trace.d.ts +68 -0
  354. package/dist/queries/trace.js +2 -0
  355. package/dist/queries/twin-ab.d.ts +66 -0
  356. package/dist/queries/twin-ab.js +2 -0
  357. package/dist/queries/twin-drift.d.ts +119 -0
  358. package/dist/queries/twin-drift.js +2 -0
  359. package/dist/queries/unused-imports.d.ts +4 -0
  360. package/dist/queries/unused-imports.js +2 -0
  361. package/dist/queries/unused-params.d.ts +38 -0
  362. package/dist/queries/unused-params.js +2 -0
  363. package/dist/queries/value-flow.d.ts +42 -0
  364. package/dist/queries/value-flow.js +2 -0
  365. package/dist/queries/vue-component-duplicates.d.ts +43 -0
  366. package/dist/queries/vue-component-duplicates.js +2 -0
  367. package/dist/queries/vue-composable-candidates.d.ts +44 -0
  368. package/dist/queries/vue-composable-candidates.js +2 -0
  369. package/dist/queries/vue-large-view-pressure.d.ts +41 -0
  370. package/dist/queries/vue-large-view-pressure.js +2 -0
  371. package/dist/queries/wrapper-candidates.d.ts +34 -0
  372. package/dist/queries/wrapper-candidates.js +2 -0
  373. package/dist/reindex-worker.js +3 -0
  374. package/dist/reindex.d.ts +254 -0
  375. package/dist/reindex.js +298 -0
  376. package/dist/repository-text-C0Q8VYdN.d.ts +19 -0
  377. package/dist/runtime.d.ts +555 -0
  378. package/dist/runtime.js +4 -0
  379. package/dist/rust-semantic-session-server.js +2 -0
  380. package/dist/rust-semantic-session-worker.js +2 -0
  381. package/dist/rust-semantic-worker.js +2 -0
  382. package/dist/scip-cli-B7N3haxa.d.ts +67 -0
  383. package/dist/source-snippet-_wrcgmZc.d.ts +15 -0
  384. package/dist/symbol-types-BIQwfoAx.d.ts +74 -0
  385. package/dist/typescript-mailbox-worker.js +2 -0
  386. package/dist/watch-server.js +8 -0
  387. package/docs/AGENT_GUIDE.md +148 -0
  388. package/docs/AI_FAILURE_MODES.md +43 -0
  389. package/docs/API.md +40 -0
  390. package/docs/API_EVOLUTION.md +77 -0
  391. package/docs/CLI_JSON_OUTPUT.md +389 -0
  392. package/docs/COMMAND_REFERENCE.md +294 -0
  393. package/docs/CONFIGURATION_WRITE_SAFETY.md +131 -0
  394. package/docs/DETECTOR_GUIDE.md +46 -0
  395. package/docs/DURABILITY.md +159 -0
  396. package/docs/INDEX_GENERATIONS.md +167 -0
  397. package/docs/LOCK_PROTOCOL.md +133 -0
  398. package/docs/MAILBOX_LIFECYCLE.md +224 -0
  399. package/docs/REGEX_POLICY.md +36 -0
  400. package/docs/REINDEX_METADATA_COMPATIBILITY.md +104 -0
  401. package/docs/RUST_DURABLE_SESSION_PROTOCOL.md +126 -0
  402. package/docs/SECURITY_MODEL.md +125 -0
  403. package/docs/TELEMETRY_RETENTION.md +84 -0
  404. package/docs/TIME_SEMANTICS.md +77 -0
  405. package/docs/WATCH_REFRESH_REQUESTS.md +123 -0
  406. package/docs/WINDOWS_SIDECAR_RELEASE.md +424 -0
  407. package/docs/accuracy-audit-checklist.md +304 -0
  408. package/docs/accuracy-hardening-goal.md +500 -0
  409. package/docs/analyzer-inventory.md +78 -0
  410. package/docs/analyzer-validation-protocol.md +84 -0
  411. package/docs/architecture-coherence-vision.md +254 -0
  412. package/docs/assets/codebaseiq-logo-dark.svg +21 -0
  413. package/docs/assets/codebaseiq-logo.svg +24 -0
  414. package/docs/locality-analyzer-design.md +193 -0
  415. package/docs/schemas/cli-json-envelope.schema.json +237 -0
  416. package/docs/schemas/cli-output-page.schema.json +104 -0
  417. package/docs/schemas/npm-release-state.schema.json +146 -0
  418. package/docs/schemas/observation-receipt.schema.json +164 -0
  419. package/docs/schemas/project-config.schema.json +318 -0
  420. package/docs/schemas/suppression-record.schema.json +79 -0
  421. package/docs/schemas/windows-sidecar-provenance.schema.json +137 -0
  422. package/package.json +482 -0
  423. package/scripts/build-codebaseiq-windows.mjs +197 -0
  424. package/scripts/codebaseiq-windows-provenance.mjs +364 -0
  425. package/scripts/evidence-product-contract.mjs +197 -0
  426. package/scripts/verify-codebaseiq-windows.mjs +29 -0
  427. package/skills/codebaseiq/SKILL.md +75 -0
  428. package/skills/codebaseiq/agents/openai.yaml +4 -0
  429. package/skills/codebaseiq-explore/SKILL.md +34 -0
  430. package/skills/codebaseiq-explore/agents/openai.yaml +4 -0
  431. package/skills/concrete-plan/SKILL.md +79 -0
  432. package/skills/concrete-plan/agents/openai.yaml +4 -0
@@ -0,0 +1,2 @@
1
+ import{a as i}from"./chunk-UZGZB3VB.js";import{b as a}from"./chunk-ADTBPVUZ.js";import{existsSync as c}from"fs";import{isAbsolute as p,join as u}from"path";function g(e,t){let o=l(e,t,{allowMultiple:!1})[0]?.relativePath;return o||s(e,t)}function x(e,t){return l(e,t,{allowMultiple:!0}).map(o=>o.relativePath)}function s(e,t){if(!t)return null;let o=t.replace(/\\/g,"/").replace(/^\.\//,""),r=p(o)&&o.startsWith(e.config.projectRoot)?o.slice(e.config.projectRoot.length).replace(/^\/+/,""):o,n=u(e.config.projectRoot,r);return c(n)?r:null}function l(e,t,o){let r=a(e,t,o);if(r.length===0){if(s(e,t))return[];let n=i(e,t);return!n||e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,score:700}]}return r}export{g as a,x as b};
2
+ //# sourceMappingURL=chunk-GTXSJDCO.js.map
@@ -0,0 +1,2 @@
1
+ import{a as s}from"./chunk-NNOKTMZT.js";function l(d,c,o){if(o.length===0)return[];let e=new Set(o),n=s(d),r=new Set;if(c==="forward")for(let t of e)for(let i of n.get(t)??[])e.has(i)||r.add(i);else for(let[t,i]of n)if(!e.has(t))for(let _ of e)i.has(_)&&r.add(t);return[...r].sort()}export{l as a};
2
+ //# sourceMappingURL=chunk-GW6Z3WGY.js.map
@@ -0,0 +1,2 @@
1
+ import{a as R}from"./chunk-DQMDCD24.js";import{a as D}from"./chunk-RBAS5ZHI.js";import{a as g}from"./chunk-XWUOUWYI.js";import{a as F}from"./chunk-SYDJMPES.js";import{a as y}from"./chunk-4WKDMDEW.js";import{e as f}from"./chunk-UDS562V4.js";import{j as d}from"./chunk-FETNQCFO.js";import{L as h}from"./chunk-ADTBPVUZ.js";var A=.7,S=.62,C=.45;function J(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=y(i,{historyMode:t.historyMode}).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let r=P(s,e);if(r.size===0)return{available:!0,windowCommits:e,findings:[]};let b=B(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:r}).map(l=>O(l,s,e)).filter(l=>l!==null);b.sort((l,c)=>(l.kind===c.kind?0:l.kind==="echo"?-1:1)||c.similarity-l.similarity||l.echoFile.localeCompare(c.echoFile)||l.echoSymbol.localeCompare(c.echoSymbol)||l.domain.localeCompare(c.domain));let p=b.slice(0,n).map(M);return{available:!0,windowCommits:e,findings:p,rootCauseGroups:N(p)}}function B(i,t){let e=K(t.limit),n=[...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??A,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=h(i,{scope:t.scope});return a.react&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...T(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function k(i,t){return f(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).filter(e=>!d(e.symbolA)&&!d(e.symbolB)).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function E(i,t){return u(i,t,{query:g,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).filter(n=>e.acceptPair?.(n)??!0).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:G(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:F,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,acceptPair:w,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}var I=new Set(["useCallback","useEffect","useLayoutEffect","useMemo","useMutation","useQueries","useQuery","useQueryClient","useReducer","useRef","useState"]);function w(i){return i.sharedHooks.some(t=>!I.has(t))||i.sharedState.length>0||i.sharedHandlers.length>0||i.sharedHandlerVerbs.length>=2}function x(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function T(i,t){return u(i,t,{query:R,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function P(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function O(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let r=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:r?i.symbolA:i.symbolB,echoFile:r?i.fileA:i.fileB,echoAgeCommits:(r?n:a)??0,establishedSymbol:r?i.symbolB:i.symbolA,establishedFile:r?i.fileB:i.fileA,establishedAgeCommits:r?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function M(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:H(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let r of n.sharedEvidence)s.sharedEvidence.add(r)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function H(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function G(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{J as a};
2
+ //# sourceMappingURL=chunk-H3LGFZVK.js.map
@@ -0,0 +1,2 @@
1
+ import{a as de}from"./chunk-ZZXSWSN6.js";import{a as me}from"./chunk-CAUCPUOF.js";import{a as he}from"./chunk-I2T2LLK2.js";import{a as ge}from"./chunk-6YTSKJJ3.js";import{a as fe}from"./chunk-BFFZDZQV.js";import{a as ce}from"./chunk-7NVGT435.js";import{a as le}from"./chunk-DQMDCD24.js";import{a as ue}from"./chunk-RBAS5ZHI.js";import{a as ae}from"./chunk-XWUOUWYI.js";import{a as se}from"./chunk-SYDJMPES.js";import{a as ne}from"./chunk-PIOMTC27.js";import{a as pe}from"./chunk-JE3WZ6II.js";import{a as oe}from"./chunk-OFBE4NGP.js";import{a as ie}from"./chunk-EMNIHCRB.js";import{a as ee}from"./chunk-PX4RYAAK.js";import{b as re}from"./chunk-WOQBZPIF.js";import{a as te}from"./chunk-T3DGWPXM.js";import{a as T,b as Y}from"./chunk-OZYRSMSH.js";import{b as Q}from"./chunk-SWHMHUKF.js";import{a as X}from"./chunk-4WKDMDEW.js";import{b as J}from"./chunk-C6SBF2WH.js";import{f as Z}from"./chunk-UDS562V4.js";import{b as K}from"./chunk-QDCCHMVZ.js";import{d as q,e as U}from"./chunk-6CS3UQTN.js";import{f as M,h as A}from"./chunk-C7QOQX32.js";import{a as j}from"./chunk-O6QTXQPJ.js";import{C as W,z as G}from"./chunk-ADTBPVUZ.js";import{u as k}from"./chunk-BMYOV5GP.js";import{f as z,g as O}from"./chunk-CWONGW6P.js";import{readdirSync as Ye}from"fs";import{basename as Xe,join as Ce}from"path";function Qe(e,r,t={}){let i=new Set(e),o=new Set(r),n=[...o].filter(s=>!i.has(s)).sort(),a=t.allowExtra?[]:[...i].filter(s=>!o.has(s)).sort();return{missing:n,extra:a}}function Je(e,r){let t=Ze(e,r.file,r.keys);if(!t.ok)return{name:r.name,file:r.file,status:"unavailable",missing:[],extra:[],unavailableReason:t.reason};let i=nt(e.config.projectRoot,r.mustEqual),o=Qe(t.keys,i,{allowExtra:r.allowExtra??!1}),n=o.missing.length>0||o.extra.length>0?"violated":"ok";return{name:r.name,file:r.file,status:n,missing:o.missing,extra:o.extra}}function be(e,r){return r.map(t=>Je(e,t))}function Ze(e,r,t){return t.type==="markdown-list"?ot(e,r,t.marker):et(e,r,t)}function et(e,r,t){if(!k(e,r))return{ok:!1,reason:`file not found: ${r}`};let o=G(r);if(!o)return{ok:!1,reason:`unsupported file type for ${t.type} extraction: ${r}`};let n=W(e,r);if(!n)return{ok:!1,reason:`tree-sitter parser unavailable for ${o} (${r}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:o,reason:"parser-unavailable"}};let a=t.type==="object-literal-keys"?tt(n,t.identifier):it(n,t.identifier);return a===null?{ok:!1,reason:`no ${t.type==="object-literal-keys"?"object literal":"string array"} named "${t.identifier}" found in ${r}`}:{ok:!0,keys:a}}function Se(e){let r=e.childForFieldName("value");return r?r.type==="as_expression"||r.type==="satisfies_expression"?r.namedChild(0):r:null}function tt(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type==="object")return rt(o)}return null}function rt(e){let r=new Set;for(let t of e.namedChildren)if(t.type==="pair"){let i=t.childForFieldName("key");i&&r.add(ye(i.text))}else t.type==="shorthand_property_identifier"&&r.add(t.text);return[...r].sort()}function it(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type!=="array")continue;let n=new Set;for(let a of o.namedChildren)a.type==="string"&&n.add(ye(a.text));return[...n].sort()}return null}function ye(e){return e.length>=2&&(e[0]==="'"&&e.endsWith("'")||e[0]==='"'&&e.endsWith('"'))?e.slice(1,-1):e}function ot(e,r,t){let i=k(e,r);if(!i)return{ok:!1,reason:`file not found: ${r}`};let o=xe(i,t);return o===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${t} --> ... <!-- END GENERATED ${t} --> block in ${r}`}:{ok:!0,keys:we(o)}}function xe(e,r){let t=j(r),o=new RegExp(`<!--\\s*BEGIN GENERATED ${t}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${t}\\s*-->`).exec(e);return o?o[1]:null}function we(e){let r=new Set;for(let t of e.matchAll(/`([a-z][a-z0-9-]*)`/g))r.add(t[1]);for(let t of e.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))r.add(t[1]);return[...r].sort()}function nt(e,r){switch(r.type){case"top-level-dirs":return ve(Ce(e,r.path));case"file-glob":return[...new Set(K(e,r.pattern).map(t=>Xe(t)))].sort();case"registered-commands":return at(e);case"builtin-skills":return ve(Ce(e,"skills"))}}function ve(e){let r;try{r=Ye(e,{withFileTypes:!0})}catch{return[]}return r.filter(t=>t.isDirectory()&&!t.name.startsWith(".")).map(t=>t.name).sort()}function at(e){let r;try{r=z(e,"docs/COMMAND_REFERENCE.md",{maxBytes:8*1024*1024,inputKind:"generated command reference"})}catch(i){if(!O(i))throw i;return[]}let t=xe(r,"COMMAND REFERENCE");return t?we(t):[]}function g(e){return e.scoreCount??e.count}function B(e){let r=dt(e),{breakdown:t,pressure:i}=mt(e),o=Le(t,"risk"),n=Le(t,"hygiene"),a=st(e),s=[...e.warnings];e.complexity.coverage.semanticEvidence.excludedSymbolCount>0&&s.push(`Complexity scoring excluded ${e.complexity.coverage.semanticEvidence.excludedSymbolCount} symbol(s) with incomplete or unavailable compiler evidence.`);let l=e.evidenceCoverage.filter(d=>d.semanticEvidence.status!=="complete"&&d.semanticEvidence.status!=="disabled");return l.length>0&&s.push(`Compiler-resolved evidence was incomplete or unavailable in health phase(s): ${l.map(d=>d.phase).join(", ")}.`),{score:Math.min(o,n),riskScore:o,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,duplicateBodyGroups:e.duplicateBodies.count,duplicateBodyLoc:e.duplicateBodies.loc,twinDriftGroups:e.twinDrift.count,twinDriftLoc:e.twinDrift.loc,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:g(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:g(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:g(e.wrappers),passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null,hiddenCouplingScoreCount:e.gitEvidence?.hiddenCoupling.scoreCount??null,coverageContractViolations:e.coverageContracts.count},axes:ct(e),validation:lt(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,coverage:a,warnings:s.length>0?s:void 0}}function st(e){let r=e.complexity.coverage.semanticEvidence.status;return{status:e.evidenceCoverage.some(i=>i.semanticEvidence.status!=="complete"&&i.semanticEvidence.status!=="disabled")?"incomplete":r==="disabled"?"semantic-disabled":r==="complete"?"complete":"incomplete",complexity:e.complexity.coverage,phases:e.evidenceCoverage}}function ct(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:ut(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.duplicateBodies.count+e.twinDrift.count+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function ut(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:h(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function lt(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],twinDrift:e.twinDrift.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),o=0,n=0,a=0;for(let[b,f]of Object.entries(r))i.has(b)?o+=f.fixChanges:(n+=f.fixChanges,a+=1);let s=i.size>0?h(o/i.size):0,l=a>0?h(n/a):0,d={};for(let[b,f]of Object.entries(t)){let C=new Set(f);if(C.size===0)continue;let S=0;for(let D of C)S+=r[D]?.fixChanges??0;let x=h(S/C.size);d[b]={flaggedFiles:C.size,fixDensity:x,lift:l>0?h(x/l):null}}return{flaggedFiles:i.size,flaggedFixDensity:s,baselineFixDensity:l,ratio:i.size>0&&l>0?h(s/l):null,byCategory:d,validationBasis:{method:"subject-regex",commitsScanned:e.gitEvidence?.commitsScanned??0}}}function h(e){return Math.round(e*100)/100}function Ee(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function L(e,r="existing shared infrastructure discount"){let t=g(e);return Math.abs(t-e.count)<.01?"":` (${Ee(t)} score-weighted after ${r})`}function y(e,r){let t=g(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${Ee(t)} score-weighted)`}function dt(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} indexed symbols with no visible repository references \u2014 review runtime/framework roots and the capability disclosure, then verify any deletion with cleanup-plan --verify`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} indexed dependency cycle(s) \u2014 inspect ownership and runtime order before choosing whether or how to break them`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs share disclosed call or source-token evidence beyond imports \u2014 review domain identity before considering consolidation`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.duplicateBodies.count>0&&r.push({category:"Duplicate function bodies",evidence:"heuristic",description:`${e.duplicateBodies.count} exact small-body group(s) across files \u2014 consolidate only when the domain concept matches`,effort:"low",impact:"medium",count:e.duplicateBodies.count,locRecoverable:e.duplicateBodies.loc}),e.twinDrift.count>0&&r.push({category:"Drifted twin implementations",evidence:"heuristic",description:`${e.twinDrift.count} same-name (or near-name) function group(s) across files with diverged or identical bodies \u2014 determine whether they represent the same concept before acting`,effort:"medium",impact:"medium",count:e.twinDrift.count,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${L(e.reactHookCandidates)} \u2014 review whether a common hook would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${L(e.vueComposableCandidates)} \u2014 review whether a common composable would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 review same-file or feature-local extraction seams`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols${L(e.wrappers,"boundary-evidence discount")} \u2014 inspect whether each is indirection or an intentional API, framework, or ownership boundary`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that literally forward to one callee \u2014 inspect whether each is unnecessary indirection or an intentional boundary`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let o=[];e.stale.unused>0&&o.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&o.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${o.join(", ")} \u2014 review public, runtime-registration, and ownership evidence before removing, moving, or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let o=[];e.drift.unusedImports>0&&o.push(`${e.drift.unusedImports} unused imports`),e.drift.architectureViolations>0&&o.push(`${e.drift.architectureViolations} declared architecture violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${o.join(", ")} \u2014 repair direct dependency-rule breaks; inspect boundary signals with \`drift --architecture\``,effort:e.drift.architectureViolations>0?"medium":"low",impact:e.drift.architectureViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.coverageContracts.count>0&&r.push({category:"Coverage contract drift",evidence:"graph-fact",description:`${e.coverageContracts.count} configured coverage contract(s) drifted from their ground-truth source (enumeration rot) \u2014 run \`codebaseiq health --json\` for the missing/extra keys`,effort:"low",impact:"medium",count:e.coverageContracts.count,locRecoverable:0}),e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let o=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+L({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(o?` (e.g. ${o.fileA} \u2194 ${o.fileB})`:"")+" \u2014 inspect whether a shared concept, generated artifact, or coordinated contract explains the history",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((o,n)=>{let a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var He={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","duplicate-bodies":"hygiene","twin-drift":"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","duplicate-bodies-pressure":"hygiene","twin-drift-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function Le(e,r){let t=e.filter(i=>i.kind===r).reduce((i,o)=>i+o.points,0);return Math.max(0,Math.min(100,100-t))}function mt(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(m,w,v)=>{w>0&&i.push({axis:m,points:w,detail:v,kind:He[m]??"hygiene"})},a=(m,w,v,Ge,We,qe,Ue)=>{let H=Math.max(Ge,1);if(v<=H)return;let P=v/H,R=Math.min(We,Math.ceil(Math.log2(P)*qe));if(R<=0)return;let Ke=He[m]??"hygiene";o.push({axis:m,category:w,kind:Ke,count:v,threshold:h(H),ratio:h(P),extraPenalty:R}),n(m,R,`${v} ${Ue} exceed pressure threshold ${h(H)} (${h(P)}x)`)},s=e.dead.count/t;n("dead-code",Math.min(20,Math.round(s*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let l=e.isolated.count/t;n("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let d=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(d)),`${e.similarCount} similar function pair(s)`);let b=e.duplicateBodies.count/t*1e3;n("duplicate-bodies",Math.min(10,Math.round(b*2)),`${e.duplicateBodies.count} exact duplicate small-body group(s) (${e.duplicateBodies.loc} duplicate LOC)`);let f=e.twinDrift.count/t*1e3;n("twin-drift",Math.min(10,Math.round(f*2)),`${e.twinDrift.count} drifted twin implementation group(s) (same or near-same name, diverged or identical bodies)`);let C=e.reactComponentDuplicates.count/r*1e3;n("react-component-duplicates",Math.min(10,Math.round(C)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let S=g(e.reactHookCandidates),x=S/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(x)),y(e.reactHookCandidates,"duplicated React behavior pair(s)"));let D=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(D/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Ie=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(Ie)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let _=g(e.vueComposableCandidates),ze=_/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(ze)),y(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Oe=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(Oe/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let F=g(e.wrappers);n("wrappers",Math.min(3,F),y(e.wrappers,"wrapper candidate(s)"));let I=g(e.passthroughs);n("passthroughs",Math.min(3,I),y(e.passthroughs,"passthrough candidate(s)")),n("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let je=e.drift.direct/r;if(n("drift",Math.min(5,Math.round(je*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling",Math.min(5,Math.ceil(m/10)),y({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:m},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",m,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("duplicate-bodies-pressure","Duplicate function bodies",e.duplicateBodies.count,Math.max(20,t*.005),8,4,"exact duplicate small-body group(s)"),a("twin-drift-pressure","Drifted twin implementations",e.twinDrift.count,Math.max(20,t*.005),8,4,"drifted twin implementation group(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",S,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",_,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",F,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",I,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("drift-pressure","Structural drift signals",e.drift.signal,Math.max(10,r*.1),4,2,"signal drift finding(s)"),{breakdown:i,pressure:o}}var p={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0},isolated:{minLoc:3},similar:{minSimilarity:.6,limit:50,minCallees:4},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50},wrappers:{maxLoc:15,limit:50},passthroughs:{maxLoc:15,limit:50},stale:{minLoc:3,limit:50},drift:{},twinDrift:{minSimilarity:.3}};import{getHeapStatistics as pt}from"v8";var ht=64*1024*1024;function $(){let e=globalThis.gc;if(!e)return;let r=pt();r.heap_size_limit-r.used_heap_size<ht||e()}var gt=50,ft=25e3,Ct=2500,De=2500,Pe=50,vt=10,bt=["overview","dead","isolated","cycles","similar","duplicate-bodies","twin-drift","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions","coverage-contracts"],St={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:wt(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:Ht(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:Lt(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:Et(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:Pt(e,r,t)}),"twin-drift":(e,r,t)=>({phase:"twin-drift",twinDrift:Rt(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:kt(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Mt(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:At(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Tt(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Bt(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:$t(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Dt(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:Vt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:Nt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:_t(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:Ot(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:jt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:Ft(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:It(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:zt(e,t)})};function Or(e,r={}){return Me(e,r.full!==!1,(t,i)=>{let o=xt(e,r.scope,t,i);return B(o)})}function jr(e,r,t={}){return yt(e,[r],t)[0]}function yt(e,r,t={}){return Me(e,t.full!==!1,(i,o)=>{let n={...o,releaseCachesBetweenPhases:!1};return r.map(a=>Te(e,a,t.scope,n,i))})}function Me(e,r,t){let i=ge(e),o=Gt(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),$()}}function Gr(e){return B(Ae(e))}function Ae(e){let r=u(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,evidenceCoverage:e.map(i=>({phase:i.phase,semanticEvidence:i.evidenceCoverage})),dead:u(e,"dead").dead,isolated:u(e,"isolated").isolated,realCycleCount:u(e,"cycles").realCycleCount,similarCount:u(e,"similar").similarCount,duplicateBodies:u(e,"duplicate-bodies").duplicateBodies,twinDrift:u(e,"twin-drift").twinDrift,reactComponentDuplicates:u(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:u(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:u(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:u(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:u(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:u(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:u(e,"extract-candidates").extractCount,wrappers:u(e,"wrapper-candidates").wrappers,passthroughs:u(e,"passthrough-candidates").passthroughs,stale:u(e,"stale-abstractions").stale,drift:u(e,"drift").drift,complexity:u(e,"complexity-hotspots").complexity,gitEvidence:Re(e,"git-evidence")?.gitEvidence??null,suppressions:Re(e,"suppressions")?.suppressions??null,coverageContracts:u(e,"coverage-contracts").coverageContracts}}function Re(e,r){return e.find(t=>t.phase===r)}function u(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function xt(e,r,t,i){return Ae(bt.map(o=>Te(e,o,r,i,t)))}function Te(e,r,t,i,o){q(e);let n=St[r](e,t,i,o),a=U(e),s=a.incompleteSymbolIds.size,l=a.unavailableSymbolIds.size,d=i.semantic?s>0&&l>0?"incomplete-and-unavailable":s>0?"incomplete":l>0?"unavailable":"complete":"disabled";return{...n,evidenceCoverage:{enabled:i.semantic,status:d,incompleteSymbolCount:s,unavailableSymbolCount:l}}}function wt(e,r,t){return c(e,t,"dead",()=>{let i=Y(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Ut(e,i.symbols))})}function Ht(e,r,t){return c(e,t,"isolated",()=>{let i=ne(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Kt(e,i))})}function Lt(e,r,t){return c(e,t,"cycles",()=>ee(e,{scope:r}).filter(o=>o.kind==="real").length)}function Et(e,r,t){let i=c(e,t,"similar",()=>Z(e,{scope:r,...p.similar,scanLimit:t.candidateScanLimit,semantic:t.semantic}));return Math.min(i,t.candidateResultLimit)}function Dt(e,r,t){return c(e,t,"extract-candidates",()=>oe(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}).length)}function Pt(e,r,t){return c(e,t,"duplicate-bodies",()=>{let i=te(e,{scope:r,...p.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=new Set,n=0;for(let a of i)for(let s of a.functions.slice(1))o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o]}})}function Rt(e,r,t){return c(e,t,"twin-drift",()=>{let i=re(e,{scope:r,...p.twinDrift,scanLimit:t.candidateScanLimit}).filter(a=>a.relationship==="divergent"||a.relationship==="identical"),o=new Set,n=0;for(let a of i)for(let s of a.members)o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o].sort()}})}function kt(e,r,t){return c(e,t,"react-component-duplicates",()=>{let i=ae(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Mt(e,r,t){return c(e,t,"react-hook-candidates",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Xt)})}function At(e,r,t){return c(e,t,"react-large-component-pressure",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Yt(i)})}function Tt(e,r,t){return c(e,t,"vue-component-duplicates",()=>{let i=ue(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Bt(e,r,t){return c(e,t,"vue-composable-candidates",()=>{let i=le(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Qt)})}function $t(e,r,t){return c(e,t,"vue-large-view-pressure",()=>{let i=de(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return E(i)})}function Vt(e,r,t){return c(e,t,"wrapper-candidates",()=>{let i=me(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Jt)})}function Nt(e,r,t){return c(e,t,"passthrough-candidates",()=>{let i=pe(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Zt)})}function _t(e,r,t){return c(e,t,"stale-abstractions",()=>{let i=he(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function Ft(e,r){return c(e,r,"git-evidence",()=>{let t=X(e,{historyMode:r.gitHistoryMode}),i=t.fileChurn();if(!i)return null;let o=t.commitHistory(),n=Q(e,void 0,{limit:r.candidateResultLimit,historyMode:r.gitHistoryMode}),a={};for(let[s,l]of i)a[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:n.findings.length,scoreCount:N(n.findings.reduce((s,l)=>s+ke(l),0)),top:n.findings.slice(0,5).map(s=>({fileA:s.fileA,fileB:s.fileB,together:s.together,confidence:s.confidence,focusedTogether:s.focusedTogether,broadTogether:s.broadTogether,broadCommitRatio:s.broadCommitRatio,lastTogetherAt:s.lastTogetherAt,recentTogether:s.recentTogether,commitScope:s.commitScope,recency:s.recency,scoreWeight:ke(s),subjectContext:s.subjectContext}))},fileStats:a,commitsScanned:o?.commits.length??0}})}function It(e,r){return c(e,r,"suppressions",()=>{let t=fe(e);return{total:t.total,byCategory:{...t.byCategory}}})}function zt(e,r){return c(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],o=be(e,t).filter(n=>n.status!=="ok");return{count:o.length,loc:0,files:[...new Set(o.map(n=>n.file))].sort()}})}function Ot(e,r,t){return c(e,t,"drift",()=>{let i=ie(e,{scope:r,...p.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY,semantic:t.semantic}),o=i.results.filter(s=>s.kind!=="pattern-deviation"),n=o.filter(s=>s.actionTier==="direct").length,a=o.length-n;return{count:o.length,unusedImports:i.unusedImports,architectureViolations:i.architectureViolations,layerViolations:i.layerViolations,direct:n,signal:a}})}function jt(e,r,t){return c(e,t,"complexity-hotspots",()=>{let i=J(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return{top:i.rows.slice(0,5).map(o=>({symbol:o.shortName,score:o.score,file:o.file})),extremeCount:i.rows.filter(o=>o.score>gt).length,coverage:i.coverage}})}function Gt(e,r){let t=e.symbols>=ft||e.documents>=Ct,i=r?Number.POSITIVE_INFINITY:Pe,o=r?Number.POSITIVE_INFINITY:vt;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:o,semantic:!0,gitHistoryMode:r?"full":"bounded",releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because full mode is enabled."]:[]}:{candidateScanLimit:De,candidateResultLimit:i,complexityResultLimit:o,semantic:!1,gitHistoryMode:"bounded",releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${De} symbols and reported their top ${Pe} findings. Enable full mode for unbounded candidate counts.`]}}function Wt(e,r){r.releaseCachesBetweenPhases&&(T(e),$())}function c(e,r,t,i){qt(t);try{return i()}finally{Wt(e,r)}}function qt(e){process.env.CODEBASEIQ_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Ut(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function Kt(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath))}function E(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function Be(e,r){return{...E(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Yt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function V(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function $e(e,r){return{...V(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Xt(e){let r=e.sharedHooks.length>0,t=Ve({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:Ne(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Qt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=Ve({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:Ne(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function Ve(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Fe.has(_e(r))).length+Math.min(e.functions.length,3)}function Ne(e,r,t){let i=[...e,...r,...t].map(_e);return i.length>0&&i.every(o=>Fe.has(o))}function _e(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Jt(e){return e.actionTier==="signal"?.25:1}function Zt(e){return e.actionTier==="signal"?.25:1}function ke(e){return e.commitScope==="broad-sweep"?e.recency==="recent"?.25:0:e.commitScope==="mixed"?e.recency==="recent"?.5:.25:e.recency==="recent"?1:.5}function N(e){return Math.round(e*100)/100}var Fe=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{p as a,bt as b,Or as c,jr as d,yt as e,Gr as f};
2
+ //# sourceMappingURL=chunk-HKQUXIFO.js.map
@@ -0,0 +1,3 @@
1
+ import{u as fe,v as et}from"./chunk-GTIYTDRE.js";import{c as Ye,h as ze}from"./chunk-PYAB5SM6.js";import{U as ue,V as pe,X as b,Y as A,Z as z,b as Ae,c as _e}from"./chunk-NCZUNH3E.js";import{h as he,j as Ze}from"./chunk-Z54RD7VL.js";import{d as Ve}from"./chunk-RU65DDUP.js";import{K as Je,L as Ke,V as Xe,a as oe,k as Qe,l as N}from"./chunk-QW7EP6WI.js";import{e as He}from"./chunk-FM5BPL4V.js";import{b as q,j as S,k as de,l as Be,m as le,n as Ue,r as I,s as Y}from"./chunk-RDBI2RXU.js";import{a as V,b as ie,c as M,d as W}from"./chunk-EF2R3WNQ.js";import{H as De,I as Me,J as w,K as qe,M as je,N as Ge,P as j,Q as Ne,S as ae,T as $e,U as Fe,V as G,W as H,X as ce,h as R,n as Oe,v as se,w as T,x as Le}from"./chunk-WE5RZHZ7.js";import{statSync as tt}from"fs";import{basename as Xt,isAbsolute as Zt,join as $,relative as er}from"path";import{fileURLToPath as tr}from"url";import{watch as rr}from"chokidar";import nr from"ignore";var dt=5e3,rt=class{projectRoot;config;watchConfig;outputDb;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onReindexError;onRefreshSuppressed;onError;reindexRunner;subscriptionFactory;budgetInspector;clock;activeOperation=null;stopPromise=null;stopInProgress=!1;status={state:"idle"};debounceTimer=null;cooldownTimer=null;budgetTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];sourcePollingFallbackStarted=!1;gitPollTimer=null;lastGitState=null;gitignoreFilter;extraIgnore;stopped=!1;observationEpoch=0;changeSequence=0;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=Ze(e.config),this.outputDb=e.outputDb??$(Me(this.projectRoot,e.config),"index.db"),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.clojureConfigPath=e.config.indexer?.clojure?.configPath,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onReindexError=e.onReindexError??(()=>{}),this.onRefreshSuppressed=e.onRefreshSuppressed??(()=>{});let r=e.onError??(n=>console.error(n.message));this.onError=n=>{this.observationEpoch+=1,r(n)},this.clock=e.clock??cr,lt.set(this,mr(e.stopTimeoutMs??dt,"watcher stop timeout")),this.reindexRunner=e.reindexRunner??fr(),this.subscriptionFactory=e.subscriptionFactory??dr,this.budgetInspector=e.budgetInspector??ze,ut.set(this,{gitReader:e.gitReader??Ne,languages:pt(e.languages??e.config.languages),stagedIndexEntries:null,gitSignalPaths:null,lastGitSignal:null}),this.gitignoreFilter=He(e.projectRoot),this.extraIgnore=nr(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){if(this.stopInProgress)throw new Error("Cannot restart a watcher while its previous ownership is still draining.");this.stopped=!1,this.stopPromise=null,J(this).errors=[],this.sourcePollingFallbackStarted=!1,this.observationEpoch+=1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{this.startSourceWatcher()}catch(e){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(e)}`))}}stop(){if(this.stopPromise)return this.stopPromise;this.stopped=!0,this.stopInProgress=!0;let e=this.fsWatchers;this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearBudgetTimer(),this.clearGitPollTimer();let r=this.activeOperation;r&&this.setStatus({state:"draining",startedAt:this.wallNow(),reason:"waiting for the active reindex worker to exit"});let n=[...J(this).closures],i=or(this),o=this.clock.now()+i;return this.stopPromise=this.finishStop(e,n,r,o,i).catch(s=>{throw this.stopInProgress=!1,s}),this.stopPromise}observation(){return{epoch:this.observationEpoch,changeSequence:this.changeSequence}}requestRefresh(e,r={}){if(!this.stopped){if(!r.immediate||this.reindexInFlight||this.status.state==="cooldown"||this.status.state==="budget-paused"){this.scheduleReindex(e);return}this.pendingTrigger=ot(this.pendingTrigger,e),this.changedFiles+=1,this.changeSequence+=1,this.clearDebounceTimer(),this.triggerReindex()}}startSourceWatcher(e=!1){let r=this.subscriptionFactory(this.projectRoot,{ignoreInitial:!0,ignored:(n,i)=>this.isIgnoredWatchPath(n,i?.isDirectory()??!1),usePolling:e,...e?{interval:500,binaryInterval:1e3}:{}});r.on("all",(n,i)=>{!this.stopped&&n!=="addDir"&&n!=="unlinkDir"&&this.handleFileChange(i)}),r.on("error",n=>this.handleSourceWatcherError(r,n,e)),this.fsWatchers.push(r)}handleSourceWatcherError(e,r,n){if(n||this.sourcePollingFallbackStarted||!gr(r)||this.stopped){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(r)}`));return}this.observationEpoch+=1,this.sourcePollingFallbackStarted=!0,this.fsWatchers=this.fsWatchers.filter(i=>i!==e),sr(J(this),e,i=>this.onError(i));try{this.startSourceWatcher(!0)}catch(i){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(i)}`))}}isIgnoredWatchPath(e,r){let n=this.relativeWatchPath(e);if(!n)return!1;let i=r?`${n}/`:n;return i===".git/"||i.startsWith(".git/")?!0:this.gitignoreFilter.isIgnored(i)||this.extraIgnore.ignores(i)}handleFileChange(e){let r=this.relativeWatchPath(e);!r||r===".."||r.startsWith("../")||r===".git"||r.startsWith(".git/")||this.gitignoreFilter.isIgnored(r)||this.extraIgnore.ignores(r)||r.endsWith("index.db")||r.endsWith("index.scip")||r.endsWith("index.db.tmp")||Xt(r).startsWith(Ye)||(r===".codebaseiq.json"&&st(this,this.projectRoot),at(this,r)&&this.scheduleReindex({kind:"watch-source",detail:r}))}relativeWatchPath(e){let r=Zt(e)?e:$(this.projectRoot,e);return er(this.projectRoot,r).replaceAll("\\","/")}scheduleReindex(e){if(this.pendingTrigger=ot(this.pendingTrigger,e),this.changedFiles++,this.changeSequence+=1,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}if(this.status.state==="budget-paused"){this.dirty=!0,this.setStatus({...this.status,dirty:!0});return}this.clearDebounceTimer();let r=this.wallNow()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:r}),this.debounceTimer=this.clock.setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let e=this.inspectBudget();if(e.state==="paused"){this.dirty=!0;let s=Math.max(this.wallNow()+1,e.until);this.setStatus({state:"budget-paused",until:s,dirty:!0,reason:e.detail,rebuilt:e.rebuilt,estimatedWriteBytes:e.estimatedWriteBytes}),this.clearBudgetTimer(),this.budgetTimer=this.clock.setTimeout(()=>{this.budgetTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},Math.min(2147483647,Math.max(1,s-this.wallNow())));return}let r=this.clock.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&r<this.watchConfig.cooldownMs){let s=this.watchConfig.cooldownMs-r;this.dirty=!0;let a=this.wallNow()+s;this.setStatus({state:"cooldown",until:a,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},s);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let n=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let i=this.wallNow();this.setStatus({state:"indexing",startedAt:i});let o=this.reindexRunner.start(this.reindexRequest(n));this.activeOperation=o,o.completion.then(s=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let a=!1;try{a=this.onReindexComplete(s,n)===!0}catch(c){this.onError(c instanceof Error?c:new Error(String(c)))}if(this.dirty&&!this.stopped){if(a){let d=this.pendingTrigger??{kind:"unknown"};this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.onRefreshSuppressed(d),this.setStatus({state:"idle"});return}let c=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:c,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(s=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let a=s instanceof Error?s:new Error(String(s));this.onReindexError(a,n),this.onError(a),this.setStatus({state:"idle"})}).finally(()=>{this.activeOperation===o&&(this.activeOperation=null)})}async finishStop(e,r,n,i,o){let s=[],a=e.map(async p=>{try{await p.close()}catch(m){s.push(`watch subscription close failed: ${String(m)}`)}});a.push(...r),n&&a.push((async()=>{try{let p=await n.cancel();p.state==="degraded"&&s.push(p.reason)}catch(p){s.push(`reindex cancellation failed: ${p instanceof Error?p.message:String(p)}`)}})());let c=a.length,d=a.map(p=>p.finally(()=>{c-=1})),u=await ir(d,i,this.clock),l=J(this);return s.push(...l.errors),l.errors=[],u?this.stopInProgress=!1:(s.push(`watch shutdown exceeded the ${o}ms deadline with ${c} operation(s) still pending`),Promise.all(d).then(()=>{this.stopInProgress=!1})),s.length>0?(this.setStatus({state:"draining",startedAt:this.wallNow(),reason:s.join("; ")}),{state:"degraded",reasons:s}):(this.setStatus({state:"idle"}),{state:"stopped"})}wallNow(){return this.clock.wallNow?.()??this.clock.now()}inspectBudget(){try{return this.budgetInspector(this.outputDb,this.watchConfig.resourceBudget,new Date(this.wallNow()))}catch(e){return{state:"paused",reason:"activity-evidence",until:this.wallNow()+this.watchConfig.resourceBudget.windowMs,rebuilt:0,estimatedWriteBytes:0,detail:`reindex activity evidence could not be read: ${e instanceof Error?e.message:String(e)}`}}}reindexRequest(e){return{projectRoot:this.projectRoot,config:this.config,languages:this.languages,pnpmWorkspaces:this.pnpmWorkspaces,typescriptProjectMode:this.typescriptProjectMode,typescriptProjects:this.typescriptProjects,clojureConfigPath:this.clojureConfigPath,indexerConcurrency:this.indexerConcurrency,trigger:e}}setStatus(e){this.status=e,this.onStatus(e)}clearDebounceTimer(){this.debounceTimer&&(this.clock.clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(this.clock.clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}clearBudgetTimer(){this.budgetTimer&&(this.clock.clearTimeout(this.budgetTimer),this.budgetTimer=null)}startGitStatePolling(){if(this.lastGitState=this.readGitState(),!this.lastGitState)return;let e=v(this);e.gitSignalPaths=this.resolveGitSignalPaths(),e.lastGitSignal=this.gitActivitySignal(),e.stagedIndexEntries=ct(this.projectRoot,e.gitReader),this.gitPollTimer=this.clock.setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.()}resolveGitSignalPaths(){let e=v(this).gitReader,r=G(this.projectRoot,["rev-parse","--git-dir"],e),n=G(this.projectRoot,["rev-parse","--git-common-dir"],e);if(!r)return null;let i=H(this.projectRoot,r),o=n?H(this.projectRoot,n):i,s=this.lastGitState?.indexPath;return[$(i,"HEAD"),$(o,"packed-refs"),$(o,"refs","heads"),...s?[s]:[]]}gitActivitySignal(){let e=v(this).gitSignalPaths;if(!e)return null;let r="";for(let n of e)try{let i=tt(n);r+=`${n}:${i.mtimeMs}:${i.size};`}catch{r+=`${n}:absent;`}return r}pollGitState(){let e=this.gitActivitySignal();if(e!==null){if(e===v(this).lastGitSignal)return;v(this).lastGitSignal=e}let r=this.lastGitState,n=this.readGitState();if(!r||!n||this.stopped){this.lastGitState=n;return}this.lastGitState=n;let i=r.head!==n.head,o=r.indexPath!==n.indexPath||r.indexMtimeMs!==n.indexMtimeMs||r.indexSize!==n.indexSize;if(!i&&!o)return;let s=v(this),a=s.stagedIndexEntries,c=ct(this.projectRoot,s.gitReader);s.stagedIndexEntries=c;let d=yr(this.projectRoot,s.gitReader,r,n,a,c,i,o),u=null;d!==null&&(d.includes(".codebaseiq.json")&&st(this,this.projectRoot),u=d.filter(l=>at(this,l)),u.length===0)||(i&&o?this.scheduleReindex({kind:"watch-git-state",detail:ge("HEAD and index changed",u)}):i?this.scheduleReindex({kind:"watch-git-head",detail:ge("HEAD changed",u)}):o&&this.scheduleReindex({kind:"watch-git-index",detail:ge(n.indexPath??"index changed",u)}))}readGitState(){let e=v(this).gitReader,r=G(this.projectRoot,["rev-parse","--git-path","index"],e);if(!r)return null;let n=H(this.projectRoot,r),i={head:G(this.projectRoot,["rev-parse","--verify","HEAD"],e),indexPath:n};try{let o=tt(n);i.indexMtimeMs=o.mtimeMs,i.indexSize=o.size}catch{i.indexMtimeMs=void 0,i.indexSize=void 0}return i}clearGitPollTimer(){this.gitPollTimer&&(this.clock.clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};async function ir(t,e,r){if(t.length===0)return!0;let n=Promise.all(t).then(()=>!0),i=Math.max(0,e-r.now()),o=null,s=new Promise(c=>{o=r.setTimeout(()=>c(!1),i)}),a=await Promise.race([n,s]);return a&&o&&r.clearTimeout(o),a}var nt=new WeakMap,lt=new WeakMap,ut=new WeakMap;function J(t){let e=nt.get(t);if(e)return e;let r={closures:new Set,errors:[]};return nt.set(t,r),r}function or(t){return lt.get(t)??dt}function v(t){let e=ut.get(t);if(!e)throw new Error("Watcher input state was not initialized.");return e}function sr(t,e,r){let n=Promise.resolve().then(()=>e.close()).catch(i=>{let o=`watch subscription close failed during polling fallback: ${String(i)}`;t.errors.push(o),r(new Error(o))});t.closures.add(n),n.then(()=>t.closures.delete(n))}function ar(t,e=M){let{projectRoot:r,config:n,languages:i,pnpmWorkspaces:o,typescriptProjectMode:s,typescriptProjects:a,clojureConfigPath:c,indexerConcurrency:d,trigger:u}=t,l=he(r),p=Object.keys(l).length>0?l:n,m=Ge(r,p),g=p.indexer?.typescript,f=p.indexer?.clojure,D=e(process.pid);if(!D)throw new Error(`Could not establish watcher process identity for reindex worker ownership (pid ${process.pid}).`);return{workerPath:tr(new URL("./reindex-worker.js",import.meta.url)),env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:r,SCIP_REINDEX_OUTPUT_SCIP:m.indexPath,SCIP_REINDEX_OUTPUT_DB:m.dbPath,SCIP_REINDEX_LANGUAGES:(p.languages??i)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(p.indexerConcurrency??d??""),SCIP_REINDEX_PNPM_WORKSPACES:g?.pnpmWorkspaces??o?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:g?.projectMode??s,projects:g?.projects??a??[]}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:f?.configPath??c??"",SCIP_REINDEX_TRIGGER_KIND:u.kind,SCIP_REINDEX_TRIGGER_DETAIL:u.detail??"",SCIP_REINDEX_PROCESS_GROUP_LEADER:"1",SCIP_REINDEX_PARENT_IDENTITY:JSON.stringify(D)}}}var cr={now:W,wallNow:()=>Date.now(),setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},dr=(t,e)=>rr(t,e),lr=15*6e4,ur=1e3,pr=64*1024;function hr(){return{stdoutTail:"",stderrTail:"",stdoutTruncated:!1,stderrTruncated:!1}}function it(t,e){let r=t instanceof Error?t.message:String(t),n=e.stderrTail.trim()||e.stdoutTail.trim();return n?`${r}
2
+ ${n}`:r}function fr(t={}){let e=t.timeoutMs??lr,r=t.terminationGraceMs??ur,n=t.maxOutputBytes??pr,i=t.resolveLaunch??ar;return{start(o){let s=i(o),a=new AbortController,c=hr(),d=!1,u=_e({command:process.execPath,args:[...process.execArgv,s.workerPath],label:"watch reindex worker",env:s.env,timeoutMs:e,terminationGraceMs:r,maxStdoutBytes:n,maxStderrBytes:n,outputLimitBehavior:"truncate-tail",signal:a.signal,detached:!0}).then(l=>{if(c={stdoutTail:l.stdout,stderrTail:l.stderr,stdoutTruncated:l.stdoutTruncated,stderrTruncated:l.stderrTruncated},l.status!==0)throw new Error(it(new Error(`Reindex worker exited with ${l.signal?`signal ${l.signal}`:`code ${l.status}`}`),c));return l.durationMs}).catch(l=>{throw l instanceof Ae&&(c={stdoutTail:l.stdout,stderrTail:l.stderr,stdoutTruncated:l.stdoutTruncated,stderrTruncated:l.stderrTruncated}),new Error(it(l,c),{cause:l})}).finally(()=>{d=!0});return{completion:u,async cancel(){d||a.abort();try{await u}catch{}return{state:"exited",diagnostics:c}},diagnostics:()=>c}}}}function ot(t,e){return t?t.kind===e.kind?t.detail===e.detail?t:{kind:t.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${t.kind}, ${e.kind}`}:e}function gr(t){return t instanceof Error&&"code"in t&&t.code==="EMFILE"||String(t).includes("EMFILE: too many open files")}function mr(t,e){if(!Number.isSafeInteger(t)||t<=0)throw new Error(`${e} must be a positive integer.`);return t}function pt(t){return t&&t.length>0?[...t]:oe}function st(t,e){try{v(t).languages=pt(he(e).languages)}catch{v(t).languages=oe}}function at(t,e){return Oe(e,v(t).languages)!=="other"}function yr(t,e,r,n,i,o,s,a){let c=new Set;if(s){if(!r.head||!n.head)return null;let d=e.runResult(t,["diff","--name-only","-z","--no-renames","--relative",r.head,n.head,"--"]);if(d.kind!=="success")return null;for(let u of Rr(d.output))c.add(u)}if(a){if(i===null||o===null)return null;for(let d of Sr(i,o))c.add(d)}return[...c].sort()}function ct(t,e){let r=e.runResult(t,["diff","--cached","--raw","-z","--no-renames","--relative","--"]);return r.kind==="success"?vr(r.output):null}function Rr(t){return t.split("\0").filter(e=>e.length>0)}function vr(t){let e=t.split("\0");if(e.at(-1)===""&&e.pop(),e.length%2!==0)return null;let r=new Map;for(let n=0;n<e.length;n+=2){let i=e[n],o=e[n+1];if(!i.startsWith(":")||!o)return null;r.set(o,i)}return r}function Sr(t,e){return[...new Set([...t.keys(),...e.keys()])].filter(n=>t.get(n)!==e.get(n))}function ge(t,e){return e===null?`${t}; changed paths unavailable`:e.length===0?t:e.length===1?e[0]:`${e.length} compiler inputs changed`}import{spawn as Dr}from"child_process";import{existsSync as Mr,rmSync as Et}from"fs";import{dirname as qr,resolve as ne}from"path";import{fileURLToPath as jr}from"url";import{createHash as br,randomUUID as me}from"crypto";import{existsSync as wr,linkSync as Ir,readdirSync as Er,rmSync as _}from"fs";import{basename as Cr,dirname as xr,join as y}from"path";var E=1,Pr=10*6e4,kr=10080*6e4,X="requests",F="claims",K="completions",ft="staging";function gt(t,e,r={}){let n=r.now?.()??new Date,i=Ar(r.ttlMs),o=_r(r.idempotencyKey),s=o?`key-${br("sha256").update(o).digest("hex")}`:`request-${(r.randomId??me)()}`,a={version:E,requestId:s,...o?{idempotencyKey:o}:{},createdAt:n.toISOString(),deadlineAt:new Date(n.getTime()+i).toISOString(),detail:e.trim().slice(0,2048)||"stale index observed by a command"},c=bt(t,s),d=Re(t,c,a,r.onStage);if(d.published)return{disposition:"accepted",request:a,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let u=ye(c);if(!u)throw new Error(`Watch refresh request identity ${s} exists but is malformed.`);return{disposition:"duplicate",request:u}}function On(t,e={}){let r=e.now?.()??new Date,n=`claim-${(e.randomId??me)()}`,i=Math.max(1,Math.floor(e.limit??64)),o=Rt(t).sort(Or),s=[];for(let a of o){if(s.length>=i)break;if(ht(t,a.requestId))continue;if(Date.parse(a.deadlineAt)<=r.getTime()){yt(t,{version:E,requestId:a.requestId,outcome:"expired",completedAt:r.toISOString()});continue}let c={version:E,requestId:a.requestId,claimId:n,claimedAt:r.toISOString()};if(Re(t,wt(t,a.requestId),c).published){if(ht(t,a.requestId)){vt(t,a.requestId,n);continue}s.push(a)}}return{claimId:n,requests:s}}function Ln(t,e,r=()=>new Date,n){let i=r().toISOString();for(let o of e.requests)yt(t,{version:E,requestId:o.requestId,claimId:e.claimId,outcome:"completed",completedAt:i});n?.("after-completion"),Wr(t,e),n?.("after-claim-release")}function Wr(t,e){for(let r of e.requests)vt(t,r.requestId,e.claimId)}function Dn(t){let e=0;for(let r of C(y(t,F)))_(r,{force:!0}),e++;return e>0&&T(y(t,F)),St(t),e}function Mn(t){let e=Rt(t),r=new Map,n=Tr(y(t,X),ye);for(let c of C(y(t,K))){let d=Z(c);if(!d){n++;continue}r.set(d.requestId,d)}let i=new Set;for(let c of C(y(t,F))){let d=mt(c);if(!d){n++;continue}i.add(d.requestId)}let o=e.filter(c=>!r.has(c.requestId)&&!i.has(c.requestId)),s=[...r.values()].filter(c=>c.outcome==="completed").length,a=[...r.values()].filter(c=>c.outcome==="expired").length;return{pending:o.length,claimed:e.filter(c=>!r.has(c.requestId)&&i.has(c.requestId)).length,completed:s,expired:a,invalid:n,...o.length>0?{oldestPendingAt:o.map(c=>c.createdAt).reduce((c,d)=>Lr(c,d))}:{}}}function qn(t,e={}){let r=(e.now?.()??new Date).getTime(),n=Math.max(0,e.retentionMs??kr),i=0;for(let o of C(y(t,K))){let s=Z(o);!s||r-Date.parse(s.completedAt)<n||(_(o,{force:!0}),_(bt(t,s.requestId),{force:!0}),i++)}return i>0&&(T(y(t,K)),T(y(t,X))),St(t),i}function ye(t){return ve(t,e=>{let r=e;return r.version===E&&B(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&q(r.createdAt)&&q(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function mt(t){return ve(t,e=>{let r=e;return r.version===E&&B(r.requestId)&&B(r.claimId)&&q(r.claimedAt)})}function Z(t){return ve(t,e=>{let r=e;return r.version===E&&B(r.requestId)&&(r.claimId===void 0||B(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&q(r.completedAt)})}function yt(t,e){let r=It(t,e.requestId);if(Re(t,r,e).published)return;let n=Z(r);if(!n||n.requestId!==e.requestId||n.outcome!==e.outcome)throw new Error(`Watch refresh completion ${e.requestId} conflicts with an existing record.`)}function Re(t,e,r,n){let i=y(t,ft),o=xr(e),s=se(i),a=se(o),c=y(i,`${Cr(e)}.${process.pid}.${me()}.tmp`);try{let d=Y(c,r,{spacing:2,trailingNewline:!0});n?.("after-staged");try{Ir(c,e)}catch(l){if(l.code==="EEXIST")return{published:!1};throw l}let u=Le(s,a,d.directorySync,T(o));return n?.("after-published"),{published:!0,achievedDurability:u==="synced"?"directory-durable":"file-flushed",directorySync:u}}finally{_(c,{force:!0})}}function Rt(t){let e=[];for(let r of C(y(t,X))){let n=ye(r);n&&e.push(n)}return e}function vt(t,e,r){let n=wt(t,e),i=mt(n);!i||i.claimId!==r||(_(n,{force:!0}),T(y(t,F)))}function St(t){for(let e of C(y(t,ft),".tmp"))_(e,{force:!0})}function Tr(t,e){return C(t).filter(r=>!e(r)).length}function C(t,e=".json"){return wr(t)?Er(t,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(e)).map(r=>y(t,r.name)).sort():[]}function ve(t,e){try{let r=JSON.parse(R(t,"watch refresh request record"));return e(r)?r:null}catch{return null}}function bt(t,e){return y(t,X,`${e}.json`)}function wt(t,e){return y(t,F,`${e}.json`)}function It(t,e){return y(t,K,`${e}.json`)}function ht(t,e){return Z(It(t,e))!==null}function Ar(t){if(t===void 0)return Pr;if(!Number.isFinite(t)||t<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(t)}function _r(t){let e=t?.trim();return e?e.slice(0,512):void 0}function B(t){return typeof t=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(t)}function Or(t,e){return Date.parse(t.createdAt)-Date.parse(e.createdAt)||t.requestId.localeCompare(e.requestId)}function Lr(t,e){return Date.parse(e)<Date.parse(t)?e:t}var Ct=5e3,Gr=6e3,Nr=1e3,be=10,$r=new Set(["capabilities","check-deps","config-validate","doctor","init","install-skills","reindex","setup","setup-agent","status","suppress","uninstall","watch"]);function ni(t){let e=t.classification;if(e.kind!=="live")return;let{state:r}=e;return r.watcher.state==="idle"&&r.lastError===void 0?r.indexGeneration:void 0}function Fr(t,e=process.env){return e.CODEBASEIQ_SKIP_WATCH_SERVICE!=="1"&&!t.startsWith("__")&&!$r.has(t)}function ii(t){let e=t.env??process.env;if(e.CODEBASEIQ_SKIP_WATCH_SERVICE==="1")return{kind:"skipped",reason:"environment"};if(!Fr(t.commandName,e))return{kind:"skipped",reason:"excluded-command"};if(t.config.watch?.enabled!==!0)return{kind:"skipped",reason:"disabled"};try{let r=Br({projectRoot:t.projectRoot,cacheDir:t.cacheDir,cliVersion:t.cliVersion,gitContext:t.gitContext,runtime:t.runtime});return{kind:r.disposition,state:r.state}}catch(r){return{kind:"failed",message:r instanceof Error?r.message:String(r)}}}function kt(t,e,r){let n=ce(ne(t));if(r&&ce(r.projectRoot)===n)return{projectRoot:n,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:e};let i=$e(n);if(i.kind==="error")throw new Error(`Could not establish Git worktree identity for ${n}: ${i.message}`);return i.kind==="non-git"?{projectRoot:n,worktreeKind:"non-git",cliVersion:e}:{projectRoot:n,worktreeKind:"git",worktreeId:i.identity.worktreeId,cliVersion:e}}function oi(t){return te(t,kt(t.projectRoot,t.cliVersion,t.gitContext))}function te(t,e){let r=t.runtime??Ce,n=b(t.cacheDir),i=A(n.statePath),o=Ee(n.lockPath);return{identity:e,classification:Ur(i,e,r.now(),r.isProcessAlive),lock:o,lockIsLive:o!==null&&r.isProcessAlive(o.pid),paths:n}}function Br(t){let e=t.runtime??Ce,r=kt(t.projectRoot,t.cliVersion,t.gitContext),n=te(t,r),i=we("ensure",n.classification);if(i.kind==="reuse")return ee(n.paths.activityPath,e),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`codebaseiq watch service pid ${i.state.pid} is still alive but its heartbeat is old. Refusing automatic replacement because civil-clock age alone cannot authorize a process signal.`);if(i.kind==="replace")Ie(i.state,t,e),U(n.paths,i.state.pid,e);else if(i.kind==="start"){if(n.lockIsLive){let a=xt(t,r,e,Math.min(t.startupTimeoutMs??1e3,1e3));if(a)return ee(n.paths.activityPath,e),{disposition:"reused",state:a};throw new Error(`codebaseiq watch is already running for ${ne(t.projectRoot)} (pid ${n.lock?.pid}; lock: ${n.paths.lockPath}) without compatible daemon state. Stop the foreground watcher before starting the service.`)}n.classification.kind==="stale"&&U(n.paths,n.classification.state.pid,e)}else throw new Error(`Unexpected ensure action: ${i.kind}`);if(n=te(t,r),i=we("ensure",n.classification),i.kind==="reuse")return ee(n.paths.activityPath,e),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`codebaseiq watch service pid ${i.state.pid} remains alive with an old heartbeat; automatic replacement is not authorized.`);let o=t.serverPath??jr(new URL("./watch-server.js",import.meta.url));e.spawnServer(o,r.projectRoot,t.cliVersion,t.watchOverrides??{});let s=xt(t,r,e,t.startupTimeoutMs??Ct);if(!s)throw new Error(`codebaseiq watch service did not become ready within ${t.startupTimeoutMs??Ct}ms.`);return ee(n.paths.activityPath,e),{disposition:"started",state:s}}function Wt(t){let e=t.runtime??Ce,r=b(t.cacheDir),n=A(r.statePath),i=n?e.isProcessAlive(n.pid)?{kind:"live",state:n}:{kind:"stale",state:n,reason:"dead-process"}:{kind:"stopped"},o=we("stop",i);if(o.kind==="signal-stop")return Ie(o.state,t,e),U(r,o.state.pid,e),{disposition:"stopped",pid:o.state.pid};if(o.kind==="clean-stale")return U(r,o.state.pid,e),{disposition:"stopped",pid:o.state.pid};let s=Ee(r.lockPath);return o.kind==="already-stopped"&&s&&e.isProcessAlive(s.pid)?(Ie(s,t,e),U(r,s.pid,e),{disposition:"stopped",pid:s.pid}):{disposition:"already-stopped"}}function si(t,e,r={}){let{durability:n="durable",...i}=r;n==="durable"?Y(t,e,i):I(t,e,i)}function Tt(t,e=Date.now()){I(t,{version:1,at:new Date(e).toISOString()})}function ai(t,e,r=Date.now(),n={}){gt(b(qr(t)).refreshRequestsPath,e,{...n,now:()=>new Date(r)}),Tt(t,r)}function ci(t){try{let e=JSON.parse(R(t,"watch activity record"));return e.version!==1||!z(e.at)||e.refreshRequestedAt!==void 0&&!z(e.refreshRequestedAt)||e.refreshDetail!==void 0&&typeof e.refreshDetail!="string"?null:{atMs:Date.parse(e.at),...e.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(e.refreshRequestedAt)},...e.refreshDetail===void 0?{}:{refreshDetail:e.refreshDetail}}}catch{return null}}function di(t,e,r={}){let n=r.pid??process.pid,i=r.isProcessAlive??S,o=()=>{},s=r.readProcessIdentity??M,a=r.now??(()=>new Date),c={...de,wallNow:()=>a().getTime(),isProcessAlive:i,readProcessIdentity:s},d=Be(t,{kind:"watch",pid:n,processIdentity:s(n),detail:{projectRoot:ne(e)},parseLegacy:re,runtime:c});if(d.kind==="contended"){let u=At(d.observation);return{acquired:!1,lockPath:t,message:Qr(t,e,u),release:o}}return{acquired:!0,lockPath:t,message:"",release:()=>{d.lock.release()}}}function Ee(t){return At(le(t,{parseLegacy:re}))}var re=t=>{let e=_t(t);return e?{pid:e.pid,...e.processIdentity?{processIdentity:e.processIdentity}:{}}:null};function At(t){if(t.state==="valid"&&t.record?.kind==="watch"){let e=t.record.detail?.projectRoot;return typeof e!="string"?null:{version:1,pid:t.record.pid,...t.record.processIdentity?{processIdentity:t.record.processIdentity}:{},projectRoot:e,startedAt:t.record.startedAt}}return _t(t.parsed)}function _t(t){try{let e=t;if(e.version!==1||typeof e.pid!="number"||!Number.isInteger(e.pid)||e.pid<=0||typeof e.projectRoot!="string"||!z(e.startedAt))return null;let r=e.processIdentity===void 0?null:V(e.processIdentity);return e.processIdentity!==void 0&&(!r||r.pid!==e.pid)?null:{version:1,pid:e.pid,...r?{processIdentity:r}:{},projectRoot:e.projectRoot,startedAt:e.startedAt}}catch{return null}}function Ur(t,e,r,n){if(!t)return{kind:"stopped"};if(t.protocolVersion!==ue)return{kind:"incompatible",state:t,reason:"protocol"};if(t.projectRoot!==e.projectRoot)return{kind:"incompatible",state:t,reason:"project"};let i=e.worktreeKind==="git"?e.worktreeId:void 0;if(t.worktreeId!==i)return{kind:"incompatible",state:t,reason:"worktree"};if(t.cliVersion!==e.cliVersion)return{kind:"incompatible",state:t,reason:"cli-version"};if(!n(t.pid))return{kind:"stale",state:t,reason:"dead-process"};let o=Date.parse(t.heartbeatAt);return r-o>pe?{kind:"stale",state:t,reason:"old-heartbeat"}:{kind:"live",state:t}}function we(t,e){switch(t){case"status":return{kind:"report",classification:e};case"ensure":switch(e.kind){case"stopped":return{kind:"start"};case"stale":return e.reason==="old-heartbeat"?{kind:"refuse-replace",state:e.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:e.state};case"incompatible":return{kind:"replace",state:e.state};default:return Se(e)}case"stop":switch(e.kind){case"stopped":return{kind:"already-stopped"};case"stale":return e.reason==="old-heartbeat"?{kind:"signal-stop",state:e.state}:{kind:"clean-stale",state:e.state};case"live":case"incompatible":return{kind:"signal-stop",state:e.state};default:return Se(e)}default:return Se(t)}}function li(t){return t.idleTimeoutMs===0||t.watcher.state!=="idle"?!1:t.nowMs-t.lastActivityAtMs>=t.idleTimeoutMs}function xt(t,e,r,n){let i=r.monotonicNow??W,o=i()+n;for(;i()<=o;){let s=te(t,e).classification;if(s.kind==="live")return s.state;r.sleep(be)}return null}function Ie(t,e,r){let{pid:n}=t;if(!r.isProcessAlive(n))return;Pt(t,r),r.signalProcess(n);let i=e.stopTimeoutMs??Gr,o=r.monotonicNow??W,s=o()+i;for(;o()<=s;){if(!r.isProcessAlive(n))return;r.sleep(be)}if(!r.forceSignalProcess)throw new Error(`codebaseiq watch service pid ${n} did not stop within ${i}ms and forced termination is unavailable.`);Pt(t,r),r.forceSignalProcess(n);let a=e.forceStopTimeoutMs??Nr,c=o()+a;for(;o()<=c;){if(!r.isProcessAlive(n))return;let d=r.readProcessIdentity(n);if(t.processIdentity&&d&&!ie(t.processIdentity,d))return;r.sleep(be)}throw new Error(`codebaseiq watch service pid ${n} remained alive ${a}ms after forced termination.`)}function U(t,e,r){if(Et(t.statePath,{force:!0}),Et(t.activityPath,{force:!0}),Ee(t.lockPath)?.pid===e&&!r.isProcessAlive(e)){let i={...de,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},o=le(t.lockPath,{parseLegacy:re,runtime:i});Ue(t.lockPath,o,{parseLegacy:re,runtime:i})}}function Qr(t,e,r){return`error: codebaseiq watch is already running for ${ne(e)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${t})`:` (lock: ${t})`}. Stop that watcher before starting another.`}function ee(t,e){try{(e.recordActivity??Tt)(t,e.now())}catch(r){let n=Vr(r);if(n!=="EPERM"&&n!=="EACCES"&&n!=="EROFS")throw r}}function Vr(t){return t.code}var Ce={now:Date.now,monotonicNow:W,isProcessAlive:S,readProcessIdentity:M,spawnServer(t,e,r,n){if(!Mr(t))throw new Error(`Watch service helper was not found at ${t}. Run npm run build first.`);Dr(process.execPath,[t,e,r,JSON.stringify(n)],{detached:!0,stdio:"ignore",windowsHide:!0,env:{...process.env,CODEBASEIQ_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(t){process.kill(t,"SIGTERM")},forceSignalProcess(t){process.kill(t,"SIGKILL")},sleep(t){let e=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(e,0,0,t)}};function Pt(t,e){if(!t.processIdentity)throw new Error(`Refusing to signal codebaseiq watch pid ${t.pid}: its ownership record has no process identity.`);let r=e.readProcessIdentity(t.pid);if(!r)throw new Error(`Refusing to signal codebaseiq watch pid ${t.pid}: its process identity is unavailable.`);if(!ie(t.processIdentity,r))throw new Error(`Refusing to signal codebaseiq watch pid ${t.pid}: its process identity does not match the ownership record.`)}function Se(t){throw new Error(`Unhandled watch service value: ${JSON.stringify(t)}`)}import{existsSync as L,lstatSync as P,readdirSync as Dt,realpathSync as Ot,rmSync as x,statSync as Mt}from"fs";import{join as h,resolve as Q,sep as qt}from"path";var Hr=3600*1e3,Yr=2*1024*1024*1024,ke=300*1e3,zr="gc-state.json",Jr="gc.lock",Kr="projects-gc-state.json",Xr="projects-gc.lock",Zr=1440*60*1e3;function en(t){let e=t.leases.filter(a=>a.managed&&!a.live&&!a.busy),r=jt(t.leases,t.locks),n={};for(let a of t.generations)r.has(a.generationId)||(n[a.generationId]=a.unreferencedAt??t.nowMs);let i=t.generations.filter(a=>!r.has(a.generationId)).sort((a,c)=>n[a.generationId]-n[c.generationId]||a.generationId.localeCompare(c.generationId)),o=new Set;for(let a of i)t.nowMs-n[a.generationId]>=t.policy.generationTtlMs&&o.add(a.generationId);let s=t.generations.filter(a=>!o.has(a.generationId)).reduce((a,c)=>a+c.size,0);for(let a of i){if(s<=t.policy.budgetBytes)break;o.has(a.generationId)||(o.add(a.generationId),s-=a.size)}for(let a of o)delete n[a];return{deleteWorktrees:e,deleteGenerations:t.generations.filter(a=>o.has(a.generationId)),deleteLocks:t.locks.filter(a=>!a.live),deleteTemporaries:t.temporaries.filter(a=>!a.live),protectedGenerationIds:[...r].sort(),unreferencedSince:n}}function jt(t,e){let r=new Set(t.filter(n=>n.managed&&(n.live||n.busy)).flatMap(n=>[n.lease.baseGenerationId,n.lease.activeGenerationId]).filter(n=>n!==void 0));for(let n of e)n.live&&r.add(n.generationId);return r}function Ci(t,e,r={}){if(!je())return{kind:"disabled"};let n=ae(t);if(!n)return{kind:"unavailable"};let i=h(w(),"repositories",n.repositoryId),o=(r.now??Date.now)(),s=L(i)?Gt(t,i,n.repositoryId,e,o,r):{kind:"unavailable"};return nn(t,n.repositoryId,e,o,r),tn(o,r),s}function tn(t,e){let r=h(w(),"projects"),n={examined:0,reclaimed:0};if(!L(r))return n;let i=h(r,Kr),o=Ft(i);if(!e.force&&o!==void 0&&t-o<ke)return n;let s=N(h(r,Xr));if(!s)return n;try{for(let a of O(r)){let c=h(r,a),d;try{d=P(c)}catch{continue}if(!(!d.isDirectory()||d.isSymbolicLink())&&(n.examined+=1,!!rn(c,t)))try{x(c,{recursive:!0,force:!0}),n.reclaimed+=1}catch{}}I(i,{version:1,lastSweepAt:new Date(t).toISOString()},{spacing:2,trailingNewline:!0})}finally{s.release()}return n}function rn(t,e){let r=h(t,De),n;try{let s=JSON.parse(R(r,"cache-ownership"));if(typeof s.canonicalProjectRoot!="string"||s.canonicalProjectRoot.length===0)return!1;n=s.canonicalProjectRoot}catch{return!1}if(L(n))return!1;try{if(e-P(t).mtimeMs<Zr)return!1}catch{return!1}let i=A(b(t).statePath);if(i&&S(i.pid))return!1;let o=N(h(t,"cache-lifecycle.lock"));return o===null?!1:(o.release(),!0)}function Gt(t,e,r,n,i,o){let s=h(e,"gc-state.json"),a=$t(s);if(!o.force&&a&&i-Date.parse(a.lastSweepAt)<ke)return{kind:"throttled",sweptAt:a.lastSweepAt};let c=Qe(e,{now:()=>i});if(!c)return{kind:"busy"};try{let d=Nt(t,e,r,a?.unreferencedSince??{}),u=en({nowMs:i,...d,policy:{generationTtlMs:o.policy?.generationTtlMs??Hr,budgetBytes:o.policy?.budgetBytes??Yr}}),l=0,p=0;for(let f of u.deleteWorktrees){if(!We(f.lease))continue;if(!L(f.lease.localCacheDir)){x(f.leasePath,{force:!0}),p+=1;continue}if(!sn(f.lease))continue;let D=N(h(f.lease.localCacheDir,"cache-lifecycle.lock"));if(D)try{if(xe(f.lease,!0))continue;try{Wt({projectRoot:f.lease.projectRoot,cacheDir:f.lease.localCacheDir,cliVersion:n})}catch{continue}if(xe(f.lease,!0))continue;x(f.lease.localCacheDir,{recursive:!0,force:!0}),x(f.leasePath,{force:!0}),p+=1}finally{D.release()}}for(let f of u.deleteLocks)x(f.path,{force:!0});for(let f of u.deleteTemporaries)x(f.path,{recursive:!0,force:!0});for(let f of u.deleteGenerations)x(f.path,{recursive:!0,force:!0}),l+=f.size;Ve(h(e,"evidence.db"));let m={kind:"swept",sweptAt:new Date(i).toISOString(),deletedWorktrees:p,deletedGenerations:u.deleteGenerations.length,deletedBytes:l,protectedGenerations:u.protectedGenerationIds.length},g={version:1,lastSweepAt:m.sweptAt,unreferencedSince:u.unreferencedSince,lastResult:m};return I(s,g,{spacing:2,trailingNewline:!0}),m}catch(d){return{kind:"failed",error:d instanceof Error?d.message:String(d)}}finally{c.release()}}function nn(t,e,r,n,i){let o=h(w(),"repositories");if(!L(o))return;let s=h(o,zr),a=Ft(s);if(!i.force&&a!==void 0&&n-a<ke)return;let c=N(h(o,Jr));if(c)try{for(let d of O(o)){if(d===e||!/^[a-f0-9]{24}$/.test(d))continue;let u=h(o,d),l;try{l=P(u)}catch{continue}if(!l.isDirectory()||l.isSymbolicLink())continue;let p=an(u)??t;Gt(p,u,d,r,n,i)}I(s,{version:1,lastSweepAt:new Date(n).toISOString()},{spacing:2,trailingNewline:!0})}finally{c.release()}}function xi(t,e,r){let n=Je(t,r.dbPath,e);if(n)return{state:"bypassed",reason:n,localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let i=ae(t);if(!i)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let o=h(w(),"repositories",i.repositoryId),s=Te(h(o,"worktrees",`${i.worktreeId}.json`)),a=$t(h(o,"gc-state.json")),c=Nt(t,o,i.repositoryId,a?.unreferencedSince??{}),d=jt(c.leases,c.locks),u=c.generations.filter(g=>!d.has(g.generationId)),l=c.generations.reduce((g,f)=>g+f.size,0),p=Ke(t,e),m=0;return p&&(m=on(p)),{state:"managed",repositoryId:i.repositoryId,worktreeId:i.worktreeId,localCacheDir:r.cacheDir,...s?{baseGenerationId:s.baseGenerationId,activeGenerationId:s.activeGenerationId,lastAction:s.lastAction,reason:s.lastReason,lastSeenAt:s.lastSeenAt}:{},generations:c.generations.length,generationBytes:l,protectedGenerations:c.generations.filter(g=>d.has(g.generationId)).length,unreferencedGenerations:u.length,unreferencedBytes:u.reduce((g,f)=>g+f.size,0),temporaryGenerations:c.temporaries.length,sharedEvidence:{path:p,exists:m>0,bytes:m},cleanup:a?.lastResult}}function on(t){return[t,`${t}-wal`,`${t}-shm`].reduce((e,r)=>{try{return e+Mt(r).size}catch{return e}},0)}function Nt(t,e,r,n){let i=new Set(Fe(t).map(d=>Q(d.path))),o=[];for(let d of O(h(e,"worktrees"))){if(!d.endsWith(".json"))continue;let u=h(e,"worktrees",d),l=Te(u);if(!l)continue;let p=Q(l.projectRoot);o.push({leasePath:u,lease:l,managed:l.repositoryId===r&&We(l),live:i.has(p)||L(p),busy:xe(l)})}let s=[];for(let d of O(h(e,"locks"))){let u=/^([a-f0-9]{64})\.lock$/.exec(d);if(!u)continue;let l=h(e,"locks",d),p=Pe(l),m=p!==void 0&&S(p),g=u[1];s.push({generationId:g,path:l,live:m})}let a=[],c=[];for(let d of O(h(e,"generations"))){let u=/^\.tmp-(\d+)-/.exec(d);if(u){let m=h(e,"generations",d),g=Number(u[1]);try{c.push({path:m,size:Lt(m),live:Number.isSafeInteger(g)&&S(g)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(d))continue;let l=h(e,"generations",d),p;try{p=P(l)}catch{continue}!p.isDirectory()||p.isSymbolicLink()||a.push({generationId:d,path:l,size:Lt(l),...n[d]===void 0?{}:{unreferencedAt:n[d]}})}return{leases:o,generations:a,locks:s,temporaries:c}}function We(t){if(t.ownershipChecksum!==Xe(t)||j(t.localCacheDir)!==j(qe(t.projectRoot)))return!1;let e=j(h(w(),"projects"));return j(t.localCacheDir).startsWith(`${e}${qt}`)}function sn(t){if(!We(t))return!1;let e=Q(w()),r=Q(h(e,"projects")),n=Q(t.localCacheDir);try{let i=P(e),o=P(r),s=P(n);if(!i.isDirectory()||i.isSymbolicLink()||!o.isDirectory()||o.isSymbolicLink()||!s.isDirectory()||s.isSymbolicLink())return!1;let a=Ot(r);return Ot(n).startsWith(`${a}${qt}`)}catch{return!1}}function an(t){for(let e of O(h(t,"worktrees"))){if(!e.endsWith(".json"))continue;let r=Te(h(t,"worktrees",e));if(r)return r.projectRoot}}function xe(t,e=!1){for(let n of e?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let i=Pe(h(t.localCacheDir,n));if(i!==void 0&&S(i))return!0}let r=Pe(b(t.localCacheDir).lockPath);return r!==void 0&&S(r)}function Te(t){try{let e=JSON.parse(R(t,"worktree cache lease"));return e.version!==1||typeof e.repositoryId!="string"||typeof e.worktreeId!="string"||typeof e.projectRoot!="string"||e.treeOid!==void 0&&typeof e.treeOid!="string"||typeof e.localCacheDir!="string"||e.baseGenerationId!==void 0&&typeof e.baseGenerationId!="string"||e.activeGenerationId!==void 0&&typeof e.activeGenerationId!="string"||typeof e.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(e.ownershipChecksum)||typeof e.lastAction!="string"||e.lastReason!==void 0&&typeof e.lastReason!="string"||typeof e.lastSeenAt!="string"?null:e}catch{return null}}function Pe(t){try{let e=JSON.parse(R(t,"watch lock record"));return typeof e.pid=="number"&&Number.isSafeInteger(e.pid)&&e.pid>0?e.pid:void 0}catch{return}}function $t(t){try{let e=JSON.parse(R(t,"repository cache GC state"));return e.version!==1||typeof e.lastSweepAt!="string"||!Number.isFinite(Date.parse(e.lastSweepAt))||!e.unreferencedSince||typeof e.unreferencedSince!="object"||!e.lastResult?null:e}catch{return null}}function Ft(t){try{let e=JSON.parse(R(t,"global repository cache GC state"));if(e.version!==1||typeof e.lastSweepAt!="string")return;let r=Date.parse(e.lastSweepAt);return Number.isFinite(r)?r:void 0}catch{return}}function O(t){try{return Dt(t)}catch{return[]}}function Lt(t){let e=0,r=[t];for(;r.length>0;){let n=r.pop();for(let i of Dt(n,{withFileTypes:!0})){let o=h(n,i.name);i.isDirectory()?r.push(o):i.isFile()&&(e+=Mt(o).size)}}return e}import{createHash as Bt}from"crypto";import{tmpdir as cn,userInfo as dn}from"os";import{join as Ut}from"path";var k=1,_i=1*1024*1024,Oi=64*1024*1024,Li=12e4,Di=["NO_COLOR","FORCE_COLOR","CLICOLOR","CLICOLOR_FORCE","TERM","CODEBASEIQ_DEBUG"];function Mi(t){let e=Qt(),r=Bt("sha256").update(`${e}\0${t}`).digest("hex");return process.platform==="win32"?`\\\\.\\pipe\\codebaseiq-lane-${r.slice(0,32)}`:Ut(ln(),`lane-${r.slice(0,24)}.sock`)}function ln(){let t=Qt(),e=Bt("sha256").update(t).digest("hex").slice(0,16);return Ut(cn(),`codebaseiq-${e}`)}function Qt(){try{return dn().username}catch{return`uid-${typeof process.getuid=="function"?process.getuid():"unknown"}`}}function qi(t,e){let r=Buffer.from(JSON.stringify(t),"utf8");if(r.byteLength>e)throw new Error(`query-lane frame of ${r.byteLength} bytes exceeds the ${e}-byte limit`);let n=Buffer.allocUnsafe(4+r.byteLength);return n.writeUInt32LE(r.byteLength,0),r.copy(n,4),n}function ji(t,e,r){let n=Buffer.alloc(0),i=!1,o=s=>{i||(i=!0,r(new Error(s)))};return{push(s){if(!i)for(n=n.byteLength===0?s:Buffer.concat([n,s]);n.byteLength>=4;){let a=n.readUInt32LE(0);if(a>t){o(`query-lane frame of ${a} bytes exceeds the ${t}-byte limit`);return}if(n.byteLength<4+a)return;let c=n.subarray(4,4+a);n=n.subarray(4+a);let d;try{d=JSON.parse(c.toString("utf8"))}catch{o("query-lane frame carried invalid JSON");return}if(e(d),i)return}}}}function Gi(t){if(!t||typeof t!="object")return null;let e=t;return e.protocolVersion!==k||typeof e.projectRoot!="string"||e.projectRoot.length===0?null:e.kind==="ping"?{protocolVersion:k,kind:"ping",projectRoot:e.projectRoot}:e.kind!=="execute"||!Array.isArray(e.argv)||!e.argv.every(r=>typeof r=="string")||typeof e.cwd!="string"||e.deadlineMs!==void 0&&!Number.isFinite(e.deadlineMs)||e.envAllowlist!==void 0&&(typeof e.envAllowlist!="object"||e.envAllowlist===null||Array.isArray(e.envAllowlist)||!Object.values(e.envAllowlist).every(r=>typeof r=="string"))||e.tty!==void 0&&(typeof e.tty!="object"||e.tty===null||typeof e.tty.isTTY!="boolean"||e.tty.columns!==void 0&&!Number.isFinite(e.tty.columns))||e.clientInvocation!==void 0&&(typeof e.clientInvocation!="object"||e.clientInvocation===null||typeof e.clientInvocation.execPath!="string"||e.clientInvocation.execPath.length===0||e.clientInvocation.scriptPath!==void 0&&typeof e.clientInvocation.scriptPath!="string")?null:{...e,kind:"execute"}}function Ni(t){if(!t||typeof t!="object")return null;let e=t;if(e.protocolVersion!==k)return null;if(e.ok===!1)return e.code!=="unsupported"&&e.code!=="invalid-request"&&e.code!=="wrong-project"&&e.code!=="busy"&&e.code!=="stale-index"&&e.code!=="ineligible-command"&&e.code!=="execution-error"||typeof e.message!="string"?null:{ok:!1,protocolVersion:k,code:e.code,message:e.message};if(e.ok!==!0)return null;if(e.kind==="accepted"){let n=e.serverPid;return typeof n!="number"||!Number.isInteger(n)||n<=0?null:{ok:!0,kind:"accepted",protocolVersion:k,serverPid:n}}if(e.kind==="executed"){let n=e;return typeof n.serverPid!="number"||!Number.isInteger(n.serverPid)||n.serverPid<=0||typeof n.exitCode!="number"||!Number.isInteger(n.exitCode)||typeof n.stdout!="string"||typeof n.stderr!="string"||typeof n.generation!="string"||!/^[a-f0-9]{64}$/.test(n.generation)||typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)?null:{ok:!0,kind:"executed",protocolVersion:k,serverPid:n.serverPid,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr,generation:n.generation,durationMs:n.durationMs}}if(e.kind!=="pong"||typeof e.serverPid!="number"||!Number.isInteger(e.serverPid)||e.serverPid<=0||typeof e.cliVersion!="string"||typeof e.projectRoot!="string"||e.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(e.indexGeneration))return null;let r;if(e.processIdentity!==void 0){let n=V(e.processIdentity);if(!n||n.pid!==e.serverPid)return null;r=n}return{ok:!0,kind:"pong",protocolVersion:k,serverPid:e.serverPid,...r?{processIdentity:r}:{},cliVersion:e.cliVersion,projectRoot:e.projectRoot,...e.indexGeneration!==void 0?{indexGeneration:e.indexGeneration}:{}}}var Vt=[{question:"Who can call or reach this?",family:"execution",direction:"incoming"},{question:"What can this call or reach?",family:"execution",direction:"outgoing"},{question:"Where can this value come from?",family:"dataflow",direction:"incoming"},{question:"Where can this value go?",family:"dataflow",direction:"outgoing"},{question:"Which producer and consumer rendezvous?",family:"runtime",direction:"both"},{question:"What resource is observed or changed?",family:"state",direction:"both"},{question:"What occurs before or after this?",family:"temporal",direction:"both"},{question:"What interface constrains this?",family:"contract",direction:"both"},{question:"Are these observations the same entity?",family:"identity",direction:"both"},{question:"What contains or owns this?",family:"ownership",direction:"both"},{question:"What does this statically rely on?",family:"dependencies",direction:"outgoing"}],Ht={execution:{establishes:"Static may-call reachability between resolved program constructs.",nonClaims:["A may-call edge does not prove that a runtime invocation occurred."]},runtime:{establishes:"A source-grounded handoff between producer and consumer participants through a runtime mechanism.",nonClaims:["An unresolved or candidate join does not prove a runtime handoff."]},dataflow:{establishes:"A value, definition, argument, parameter, return, or statically resolved value may flow to another construct.",nonClaims:["Current partial providers do not establish general interprocedural definition-use coverage."]},state:{establishes:"A construct reads, writes, creates, deletes, or otherwise changes an identified state resource.",nonClaims:["A state edge does not prove transactionality, durability, or exclusive ownership unless qualified."]},temporal:{establishes:"One observed construct is locally ordered before or after another under the reported source evidence.",nonClaims:["Source order does not imply cross-process happens-before or durability."]},contract:{establishes:"A program construct implements, constrains, or is typed by an identified contract.",nonClaims:["Contract identity does not prove runtime invocation or conformance outside reported checks."]},identity:{establishes:"Two observations refer to the same compiler-owned or source-owned program entity.",nonClaims:["Shared identity does not establish execution or value transfer."]},ownership:{establishes:"A source construct, symbol, runtime observation, or state resource is contained or owned by another program entity.",nonClaims:["Structural ownership does not establish lifetime, singleton scope, or runtime execution unless qualified."]},dependencies:{establishes:"A file, module, or symbol statically relies on another indexed entity.",nonClaims:["A dependency edge does not establish that the depended-on code executes."]}};function Yt(t){return fe.flatMap(e=>e.relations.filter(r=>r.family===t).map(r=>({...r,providerId:e.id,providerLabel:e.label})))}function zt(t){return[...new Set(fe.filter(e=>e.relations.some(r=>r.family===t)).map(e=>e.label))]}var Ui=et.map(t=>({family:t,...Ht[t],providers:zt(t),relations:Yt(t)}));function Jt(t){return{family:t,...Ht[t],providers:zt(t),relations:Yt(t)}}var Hi=["search","outline","entrypoints","evidence","inspect","code"];function Yi(){return Vt.map(t=>{let e=Jt(t.family);return{...t,establishes:e.establishes,evidenceStrengths:Kt(e.relations.flatMap(r=>r.evidenceStrengths)),supportCeilings:Kt(e.relations.map(r=>r.supportCeiling)),nonClaim:e.nonClaims.join(" ")}})}function Kt(t){return[...new Set(t)]}export{rt as a,gt as b,On as c,Ln as d,Wr as e,Dn as f,Mn as g,qn as h,ni as i,Fr as j,ii as k,kt as l,oi as m,Br as n,Wt as o,si as p,ai as q,ci as r,di as s,li as t,Ci as u,xi as v,k as w,_i as x,Oi as y,Li as z,Di as A,Mi as B,qi as C,ji as D,Gi as E,Ni as F,Ui as G,Hi as H,Yi as I};
3
+ //# sourceMappingURL=chunk-HOA5YGOH.js.map
@@ -0,0 +1,3 @@
1
+ import{a as f}from"./chunk-UZGZB3VB.js";import{b as d,d as m}from"./chunk-FETNQCFO.js";function u(e,r){let c=f(e,r);if(!c)return[];let t=e.get(`SELECT symbol, enclosing_symbol FROM global_symbols
2
+ WHERE id = ? LIMIT 1`,c.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],n=t.enclosing_symbol,i=1,y=new Set([t.symbol]);for(;n&&!y.has(n)&&i<20;){y.add(n);let s=e.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",n);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:i}),n=s.enclosing_symbol,i++}if(o.length>1)return o;let b=d(t.symbol);if("kind"in b)return o;let l=b.descriptors;if(l.length<=1)return o;let h=[o[0]];for(let s=l.length-2,p=1;s>=0;s--,p++){let g=l.slice(0,s+1).map(a=>a.suffix==="method"?`${a.name}()`:a.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");h.push({symbol:g,shortName:g,depth:p})}return h}function N(e,r){return u(e,r)}export{u as a,N as b};
3
+ //# sourceMappingURL=chunk-HPJRBHVT.js.map
@@ -0,0 +1,49 @@
1
+ import{a as s}from"./chunk-GTXSJDCO.js";var _=`SELECT COUNT(*) AS shared
2
+ FROM (
3
+ SELECT definition_m.symbol_id
4
+ FROM documents definition_d
5
+ JOIN chunks definition_c ON definition_c.document_id = definition_d.id
6
+ JOIN mentions definition_m ON definition_m.chunk_id = definition_c.id
7
+ AND definition_m.role = 1
8
+ JOIN mentions reference_m ON reference_m.symbol_id = definition_m.symbol_id
9
+ AND reference_m.role != 1
10
+ JOIN chunks reference_c ON reference_c.id = reference_m.chunk_id
11
+ JOIN documents reference_d ON reference_d.id = reference_c.document_id
12
+ WHERE definition_d.relative_path = ?
13
+ AND reference_d.relative_path = ?
14
+ UNION
15
+ SELECT definition_m.symbol_id
16
+ FROM documents definition_d
17
+ JOIN chunks definition_c ON definition_c.document_id = definition_d.id
18
+ JOIN mentions definition_m ON definition_m.chunk_id = definition_c.id
19
+ AND definition_m.role = 1
20
+ JOIN mentions reference_m ON reference_m.symbol_id = definition_m.symbol_id
21
+ AND reference_m.role != 1
22
+ JOIN chunks reference_c ON reference_c.id = reference_m.chunk_id
23
+ JOIN documents reference_d ON reference_d.id = reference_c.document_id
24
+ WHERE definition_d.relative_path = ?
25
+ AND reference_d.relative_path = ?
26
+ )`;function l(e,i,n){let r=s(e,i)??i,t=s(e,n)??n,o=e.get(_,r,t,t,r);return{...c(r,t,o?.shared??0)}}function N(e,i,n){return l(e,i,n)}function f(e,i={}){let{limit:n=20,scope:r}=i,t=r?"AND def_d.relative_path LIKE ? AND ref_d.relative_path LIKE ?":"",o=r?[`%${r}%`,`%${r}%`]:[];return e.all(`SELECT
27
+ CASE WHEN def_d.relative_path < ref_d.relative_path THEN def_d.relative_path ELSE ref_d.relative_path END AS file1,
28
+ CASE WHEN def_d.relative_path < ref_d.relative_path THEN ref_d.relative_path ELSE def_d.relative_path END AS file2,
29
+ COUNT(DISTINCT gs.id) AS shared
30
+ FROM mentions m
31
+ JOIN chunks c ON m.chunk_id = c.id
32
+ JOIN documents ref_d ON c.document_id = ref_d.id
33
+ JOIN global_symbols gs ON m.symbol_id = gs.id
34
+ JOIN (
35
+ SELECT m2.symbol_id, c2.document_id
36
+ FROM mentions m2
37
+ JOIN chunks c2 ON m2.chunk_id = c2.id
38
+ WHERE m2.role = 1
39
+ GROUP BY m2.symbol_id
40
+ ) sym_def ON sym_def.symbol_id = gs.id
41
+ JOIN documents def_d ON sym_def.document_id = def_d.id
42
+ WHERE m.role != 1
43
+ AND def_d.id != ref_d.id
44
+ ${e.pathExclusionsFor("def_d","ref_d")}
45
+ ${t}
46
+ GROUP BY file1, file2
47
+ ORDER BY shared DESC, file1, file2
48
+ LIMIT ?`,...o,n).filter(d=>!e.isIgnored(d.file1)&&!e.isIgnored(d.file2)).map(d=>c(d.file1,d.file2,d.shared))}function h(e,i={}){return f(e,i)}function c(e,i,n){return{file1:e,file2:i,sharedSymbols:n,actionTier:"signal",couplingKind:"shared-symbol-coupling",evidenceReasons:[`${n} symbol(s) are defined in one file and referenced by the other`],recommendation:"Review whether the shared symbol surface is an intentional boundary or hidden coordination pressure before moving code."}}export{l as a,N as b,f as c,h as d};
49
+ //# sourceMappingURL=chunk-HRWGYWRJ.js.map
@@ -0,0 +1,4 @@
1
+ import{a as C,b as x,c as K,d as $}from"./chunk-SELM5MER.js";import{a as A}from"./chunk-DGXRDLV5.js";import{b as L,c as R}from"./chunk-7FND7D7N.js";import{a as y}from"./chunk-BGBBVSH4.js";import{h as M}from"./chunk-C7QOQX32.js";import{a as k}from"./chunk-TIIC3ZE7.js";import{b as F,d as P,e as g}from"./chunk-FETNQCFO.js";import{l as T}from"./chunk-O6QTXQPJ.js";import{u as I}from"./chunk-BMYOV5GP.js";function me(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:a=30,includeLowConfidence:c=!1,scanLimit:o}=e??{},f=e?.semantic!==!1,r=new R(t),d=r.scopedDefinitions(n),b=Q(r,n),l={high:0,medium:1,low:2};return A({candidates:()=>U(t,r,d,{minLoc:i,maxLoc:s}),orderCandidates:(u,m)=>y(m)-y(u)||u.relativePath.localeCompare(m.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:u=>{let m=W(u),p=O(t,r,u,m,{semantic:f}),S=u.filter(h=>{if(p.incompleteSymbolIds.has(h.symbolId)||p.unavailableSymbolIds.has(h.symbolId)||r.hasSuppressionComment(h))return!1;let D=v(t,h,p.consumerFileMap,m);return D.realConsumers.length<=1&&!D.transitivelyReachable&&j(h,D.realConsumers.length,b)});return{...p,singletonBackedClassIds:H(t,r,d,S,{semantic:f}),candidateIndex:m}},evaluate:(u,m)=>{if(m.incompleteSymbolIds.has(u.symbolId)||m.unavailableSymbolIds.has(u.symbolId)||r.hasSuppressionComment(u)||m.singletonBackedClassIds.has(u.symbolId))return null;let p=v(t,u,m.consumerFileMap,m.candidateIndex);if(p.transitivelyReachable||p.realConsumers.length>1||p.realConsumers.length===0&&p.barrelConsumers>0||!j(p.definition,p.realConsumers.length,b))return null;let S=V(t,p);return!c&&S.confidence==="low"?null:S},orderResults:(u,m)=>l[u.confidence]-l[m.confidence]||m.loc-u.loc||u.file.localeCompare(m.file)||u.startLine-m.startLine,limit:a})}function U(t,e,n,i){return n.filter(s=>s.isTypeLike&&y(s)>=i.minLoc).filter(s=>y(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!s.relativePath.endsWith(".d.ts")).filter(s=>k(s.relativePath)!=="test").filter(s=>!M(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol))}function B(t,e,n,i){return x(C(t,e).forDefinitions(n,{semantic:i.semantic,sourceFallback:i.sourceFallback}))}function O(t,e,n,i,s){let a=B(t,e,n,{semantic:!1,sourceFallback:!1}),c=n.filter(l=>{let u=v(t,l,a,i);return u.realConsumers.length<=1&&!(u.realConsumers.length>0&&w(l.relativePath))}),o=C(t,e).forDefinitions(c,{semantic:s.semantic,sourceFallback:!1}),f=new Set([...o.values()].filter(l=>l.semanticIncomplete).map(l=>l.definition.symbolId)),r=new Set([...o.values()].filter(l=>l.semanticUnavailable).map(l=>l.definition.symbolId)),d=s.semantic&&c.length>0?L(a,x(o)):a,b=c.filter(l=>v(t,l,d,i).realConsumers.length<=1);return{consumerFileMap:L(d,B(t,e,b,{semantic:!1,sourceFallback:!0})),incompleteSymbolIds:f,unavailableSymbolIds:r}}function W(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=g(n.symbol);s&&i.set(s,n)}return e}function v(t,e,n,i){let a=[...n.get(e.symbolId)??new Set].filter(d=>d!==e.relativePath&&!t.isIgnored(d)),{realConsumers:c,barrelConsumers:o,importOnlyConsumers:f}=K(t,e,a),r=Y(t,e,n,i);return{definition:e,realConsumers:c,barrelConsumers:o+f,transitivelyReachable:r}}function V(t,e){let n=N(t,e.definition.relativePath,e.definition.startLine),i=w(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:a}=ne(e.realConsumers.length,n,i),c=z(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:P(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:y(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:a,actionTier:c.actionTier,stalenessKind:c.stalenessKind,recommendation:c.recommendation}}function z(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let a=_(t,Z(n),i),c=a.map(d=>d.singleton);if(a.length===0)return new Set;let o=C(t,e).forDefinitions(c,{semantic:s.semantic,sourceFallback:!0}),f=x(o),r=new Set;for(let{singleton:d,classId:b}of a){let l=o.get(d.symbolId);(l?.semanticIncomplete||l?.semanticUnavailable||G(t,d,f))&&r.add(b)}return r}function Z(t){let e=new Map;for(let n of t){let i=g(n.symbol);i&&e.set(E(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let a=q(t,e,s);a&&i.push({singleton:a,classId:s.symbolId})}return i}function q(t,e,n){if(N(t,n.relativePath,n.startLine)!=="class")return null;let i=g(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(E(n.relativePath,s))??null:null}function G(t,e,n){let i=g(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(a=>a!==e.relativePath&&!t.isIgnored(a)&&!$(t,a,i))}function E(t,e){return`${t}\0${e}`}function J(t,e,n){let i=I(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(a)?.[1]??null}function Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=F(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function w(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function j(t,e,n){return!(w(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=T(t,e.relativePath),a=g(e.symbol);if(!a)return!1;let c=i.get(e.relativePath);if(!c)return!1;let o=[...s.get(a)??[]],f=new Set;for(;o.length>0;){let r=o.pop();if(f.has(r))continue;f.add(r);let d=c.get(r);if(!d)continue;let b=n.get(d.symbolId);if(b){for(let l of b)if(l!==e.relativePath&&!t.isIgnored(l))return!0}for(let l of s.get(r)??[])o.push(l)}return!1}function N(t,e,n){let i=I(t,e);if(!i)return"other";let s=i.split(`
2
+ `),a=Math.max(0,n-2),c=Math.min(s.length-1,n+2);for(let o=a;o<=c;o++){let r=(s[o]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(r))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(r))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(r))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(r))return"enum"}return"other"}function ee(t,e){let n=I(t,e.relativePath);if(!n)return!1;let i=g(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${s}\\b`),c=n.split(`
3
+ `);for(let o=0;o<c.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&a.test(c[o]??""))return!0;return!1}function ne(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{me as a};
4
+ //# sourceMappingURL=chunk-I2T2LLK2.js.map
@@ -0,0 +1,3 @@
1
+ import{c as S}from"./chunk-ID63777H.js";import{a as y,b as h}from"./chunk-AKB7V7TV.js";import{a as f}from"./chunk-KMITESMT.js";import{d as v}from"./chunk-Y6KHROC3.js";import{c as p}from"./chunk-PTAWHLVJ.js";import{b as d}from"./chunk-UZGZB3VB.js";import{d as l,t as m}from"./chunk-FETNQCFO.js";import{v as u}from"./chunk-BMYOV5GP.js";function B(i,r,c={}){let t=g(i,r,c);if(t.kind!=="matched")return t;let{referenceEvidence:n,claimSupport:e,...s}=t;return s}function g(i,r,c={}){let t=d(i,r);if(!t.match)return{kind:"missing",query:r};if(t.total>1)return{kind:"ambiguous",query:r,total:t.total,candidates:[{symbol:t.match.symbol,shortName:l(t.match.symbol),relativePath:t.match.relativePath,startLine:t.match.startLine},...t.candidates]};let n=t.match,e=R(c.parts),s=e.includes("definition")||e.includes("references")?S(i,n.symbol,{semantic:c.semantic,referenceContext:c.referenceContext}):{definitions:[],referencedBy:[],referenceEvidence:[],claimSupport:null},o=e.includes("callers")||e.includes("callees")?f(i,n.symbol,{semantic:c.semantic}):null,a=c.relatedSourceLines??80;return{kind:"matched",query:r,symbol:n.symbol,shortName:l(n.symbol),file:n.relativePath,parts:e,definition:e.includes("definition")?v(i,n.symbol):null,referenceWindows:e.includes("references")?L(i,s.referencedBy):[],callers:e.includes("callers")?E(i,o?.callers??[],a):[],callees:e.includes("callees")?E(i,o?.callees??[],a):[],dependencies:e.includes("dependencies")?y(i,n.relativePath):[],consumers:e.includes("consumers")?h(i,n.relativePath):[],referenceEvidence:s.referenceEvidence,claimSupport:s.claimSupport}}function L(i,r){let c=r.filter(n=>n.sourceStartLine!==null&&n.sourceEndLine!==null&&n.source!==null).sort((n,e)=>n.relativePath.localeCompare(e.relativePath)||n.sourceStartLine-e.sourceStartLine||n.line-e.line),t=[];for(let n of c){let e=t[t.length-1];if(e&&e.relativePath===n.relativePath&&n.sourceStartLine<=e.endLine+1){e.endLine=Math.max(e.endLine,n.sourceEndLine),e.references.push(b(n)),e.source=u(i,e.relativePath).slice(e.startLine,e.endLine+1).join(`
2
+ `);continue}t.push({relativePath:n.relativePath,startLine:n.sourceStartLine,endLine:n.sourceEndLine,source:n.source,references:[b(n)]})}return t}function b(i){return{line:i.line,enclosingSymbol:i.enclosingSymbol,enclosingShort:i.enclosingShort}}function R(i){let r=i&&i.length>0?i:["definition","references"];return[...new Set(r)]}function E(i,r,c){let t=[],n=new Set;for(let e of r){if(n.has(e.symbol))continue;n.add(e.symbol);let s=(e.file?m(i,e.file).find(a=>a.symbol===e.symbol):void 0)??d(i,e.symbol).match;if(!s)continue;let o=p(i,s.relativePath,s.startLine,s.endLine,c);o&&t.push({...o,symbol:e.symbol,shortName:e.shortName,omittedLines:Math.max(0,s.endLine-o.endLine)})}return t}export{B as a,g as b};
3
+ //# sourceMappingURL=chunk-ICFDQHAM.js.map
@@ -0,0 +1,4 @@
1
+ import{b as y}from"./chunk-PTAWHLVJ.js";import{a as v}from"./chunk-JOIRNPPY.js";import{p as S}from"./chunk-CVYSU6BX.js";import{a as b}from"./chunk-UZGZB3VB.js";import{d as u,e as f,h as m,p,q as g}from"./chunk-FETNQCFO.js";import{u as d}from"./chunk-BMYOV5GP.js";function q(e,t,i={}){let n=T(e,t,i);return{definitions:n.definitions,referencedBy:n.referencedBy.map(r=>({relativePath:r.relativePath,line:r.line,enclosingSymbol:r.enclosingSymbol,enclosingShort:r.enclosingShort}))}}function T(e,t,i={}){let n=R(e,t,i);return{definitions:n.definitions,referencedBy:n.referencedBy}}function R(e,t,i={}){let n=b(e,t);if(!n)return{definitions:[],referencedBy:[],referenceEvidence:[],claimSupport:null};let r=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),c=g(r?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:K(c,r?.display_name??null,n.symbol),source:B(e,n.relativePath,n.startLine,n.endLine)}],h=i.referenceContext??2,s=S(e,n,{semantic:i.semantic,semanticEvidence:v}).map(l=>{let a=y(e,l.file,l.line,h,f(n.symbol));return{relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?u(l.enclosingSymbol):"(top-level)",provenance:l.provenance,sourceStartLine:a?.startLine??null,sourceEndLine:a?.endLine??null,source:a?.source??null,sourceKind:a?.kind??"unavailable"}}),E=s.map(x);return{definitions:o,referencedBy:E,referenceEvidence:s.map(l=>({relativePath:l.relativePath,line:l.line,provenance:l.provenance,sourceKind:l.sourceKind})),claimSupport:P(s)}}function x(e){return{relativePath:e.relativePath,line:e.line,enclosingSymbol:e.enclosingSymbol,enclosingShort:e.enclosingShort,sourceStartLine:e.sourceStartLine,sourceEndLine:e.sourceEndLine,source:e.source}}function P(e){let t="resolved source-attributed or SCIP-indexed references to this exact symbol",i=["Dynamic dispatch, reflection, generated calls, and unindexed source are outside this scope."],n=e.filter(c=>c.sourceKind!=="complete-call-expression"&&c.sourceKind!=="non-call-reference"),r="direct, statically visible call expressions among the resolved reference sites";return{referenceAbsence:{status:"eligible",scope:t,limitations:i},callsitePredicates:n.length===0?{status:"eligible",scope:r,limitations:i}:{status:"ineligible",scope:r,reason:`${n.length} reference site(s) lack one unambiguous complete call expression.`,followup:L(n)}}}function L(e){let t=[...new Set(e.map(i=>`${i.relativePath}:${i.line+1}`))];return t.length===0||t.length>24?null:`codebaseiq inspect ${t.map(i=>`--at ${C(i)}`).join(" ")} --view behavior`}function C(e){return`'${e.replaceAll("'","'\\''")}'`}function B(e,t,i,n){let r=d(e,t);if(!r)return null;let o=r.split(`
2
+ `).slice(i,n+1).join(`
3
+ `).trimEnd();return o.length>0?o:null}function K(e,t,i){let n=p(e);if(n&&!A(n))return n;let r=(t??"").trim();return r?m(i)&&!r.endsWith("()")?`${r}()`:r:u(i)}function A(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{q as a,T as b,R as c};
4
+ //# sourceMappingURL=chunk-ID63777H.js.map
@@ -0,0 +1,3 @@
1
+ import{a as R}from"./chunk-JOIRNPPY.js";import{o as h}from"./chunk-CVYSU6BX.js";import{a as g}from"./chunk-UZGZB3VB.js";import{h as d}from"./chunk-FETNQCFO.js";import{a as m}from"./chunk-ADTBPVUZ.js";import{u as p}from"./chunk-BMYOV5GP.js";function D(t,r,n={}){let e=g(t,r);if(!e)return[];let l=!d(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],c=h(t,e,{semantic:n.semantic,semanticEvidence:R}).map(s=>({relativePath:s.file,line:s.line})),o=b(t,e),f=new Set,a=[];for(let s of[...l,...c,...o]){let u=`${s.relativePath}:${s.line}`;f.has(u)||(f.add(u),a.push(s))}return a}function b(t,r){if(!r.relativePath.endsWith(".rb"))return[];let n=S(r.symbol);if(n.length===0)return[];let e=[];for(let i of m(t,{extensions:[".rb"],includeIgnored:!1})){let l=p(t,i);if(!l)continue;let c=l.split(`
2
+ `);for(let o=0;o<c.length;o++){let f=c[o]??"";n.some(a=>new RegExp(`@${a}\\b|\\b${a}:`).test(f))&&e.push({relativePath:i,line:o})}}return e}function S(t){let n=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),e=n.split("_").filter(Boolean),i=new Set;return n&&i.add(n),e.length>=1&&i.add(e[e.length-1]),e.length>=2&&i.add(e.slice(-2).join("_")),[...i]}export{D as a};
3
+ //# sourceMappingURL=chunk-IJ4HMYBE.js.map
@@ -0,0 +1,2 @@
1
+ var e=Symbol("no-error");async function h(n,r,i){if(n.length===0)return[];let t=new Array(n.length),o=Number.isFinite(r)?Math.max(1,Math.floor(r)):1,a=Math.min(n.length,o),l=0,s=e,u=!0,f=Array.from({length:a},async()=>{for(;u&&l<n.length;){let c=l++;try{t[c]=await i(n[c])}catch(w){s===e&&(s=w),u=!1}}});if(await Promise.all(f),s!==e)throw s;return t}async function m(n){let r=e,i=n.map(o=>o.catch(a=>{throw r===e&&(r=a),a})),t=await Promise.allSettled(i);if(r!==e)throw r;return t.map(o=>o.value)}export{h as a,m as b};
2
+ //# sourceMappingURL=chunk-ILMHV3KM.js.map
@@ -0,0 +1,2 @@
1
+ import{a as g}from"./chunk-DGXRDLV5.js";import{c as d}from"./chunk-7FND7D7N.js";import{b as c}from"./chunk-CVYSU6BX.js";import{d as p}from"./chunk-FETNQCFO.js";import{f as o}from"./chunk-O6QTXQPJ.js";import{z as u}from"./chunk-ADTBPVUZ.js";function F(r,a={}){let{scope:l,limit:s=30,scanLimit:b}=a,f=new d(r);return g({candidates:()=>f.productionCallableDefinitions({scope:l,files:a.files,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}),filterCandidate:e=>y(e.relativePath),scanLimit:b,profile:{name:"unused-params"},evaluate:e=>{let n=o(r,e.relativePath)?.callables.find(t=>t.startLine===e.startLine&&t.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(t=>!t.simple)||n.paramsEndLine>=n.endLine)return null;let L=c(r,e.relativePath),m=[];for(let t=n.params.length-1;t>=0;t--){let i=n.params[t];if(i.name===""||i.name.startsWith("_")||h(L.get(i.name),n.paramsEndLine,n.endLine))break;m.unshift(i.name)}return m.length===0?null:{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,paramCount:n.paramCount,unusedTrailing:m}},orderResults:(e,n)=>n.unusedTrailing.length-e.unusedTrailing.length||e.file.localeCompare(n.file)||e.startLine-n.startLine,limit:s})}function y(r){let a=u(r);return a==="typescript"||a==="tsx"||a==="javascript"}function h(r,a,l){return r?r.some(s=>s>a&&s<=l):!1}export{F as a};
2
+ //# sourceMappingURL=chunk-IOP6FWIM.js.map
@@ -0,0 +1,2 @@
1
+ import{d as u}from"./chunk-3LCDIREB.js";function x(e,i){let l=new Map;return e.forEach((t,f)=>{let o=new Set;for(let r of i(t)){if(o.has(r))continue;o.add(r);let n=l.get(r);n?n.push(f):l.set(r,[f])}}),{candidatesFor:(t,f)=>{let o=new Set;for(let r of i(t)){let n=l.get(r);if(n)for(let a of n)a!==f&&o.add(a)}return[...o].sort((r,n)=>r-n)}}}function R(e){let i=c(e.profile?.name),l=()=>{let t=[];i=c(e.profile?.name,e);let f=(r,n)=>{let a=e.profiles[r],s=e.profiles[n];i.candidatePairs+=1,i.comparedPairs+=1;let d=e.compare(a,s);d&&t.push(d)};if(e.filePattern){let r=e.profiles.findIndex(n=>n.file.includes(e.filePattern));if(r>=0){let n=e.profiles[r];for(let a of m(e,r)){let s=e.profiles[a];e.focusFiles&&!e.focusFiles.has(n.file)&&!e.focusFiles.has(s.file)||f(r,a)}}}else if(e.focusFiles?.size!==0){let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let n=0;n<e.profiles.length;n+=1){let a=e.profiles[n],s=e.focusFiles?.has(a.file)??!1;for(let d of p(e,n))e.focusFiles&&!s&&!e.focusFiles.has(e.profiles[d].file)||f(n,d);if(t.length>r){i.overrunApplied=!0;break}}}t.sort(e.sort??((r,n)=>n.similarity-r.similarity)),i.matchedResults=t.length;let o=t.slice(0,e.limit);return i.emittedResults=o.length,e.onProfile?.({...i}),o};return e.profile?u(`pairwise-profile:${e.profile.name}`,l,()=>({...b(e.profile?.metadata),...i})):l()}function m(e,i){if(e.candidateIndex)return P(e,i,-1);let l=[];for(let t=0;t<e.profiles.length;t+=1)t!==i&&l.push(t);return l}function p(e,i){if(e.candidateIndex)return P(e,i,i);let l=[];for(let t=i+1;t<e.profiles.length;t+=1)l.push(t);return l}function P(e,i,l){let t=e.profiles[i],f=new Set;for(let o of e.candidateIndex?.candidatesFor(t,i,e.profiles)??[])o<=l||o!==i&&(o<0||o>=e.profiles.length||f.add(o));return[...f].sort((o,r)=>o-r)}function c(e,i){return{pipeline:e,profileCount:i?.profiles.length??0,focusedProfileCount:i?.focusFiles?i.profiles.filter(l=>i.focusFiles.has(l.file)).length:0,candidatePairs:0,comparedPairs:0,matchedResults:0,emittedResults:0,candidateIndexApplied:i?.candidateIndex!==void 0,focusApplied:i?.focusFiles!==void 0,filePatternApplied:i?.filePattern!==void 0,overrunApplied:!1}}function b(e){return typeof e=="function"?e():e??{}}export{x as a,R as b};
2
+ //# sourceMappingURL=chunk-IRQOAM5G.js.map
@@ -0,0 +1,38 @@
1
+ import{c as W,d as J,e as K,f as U,n as Q}from"./chunk-CVYSU6BX.js";import{d as z,e as Y}from"./chunk-SGX43S2L.js";import{A as B,e as F,g as G,t as j,u as H,z as $}from"./chunk-FETNQCFO.js";import{k as D,p as x}from"./chunk-O6QTXQPJ.js";import{z as A}from"./chunk-ADTBPVUZ.js";import{f as M}from"./chunk-BMYOV5GP.js";import{d as P}from"./chunk-NNJ2KZZG.js";function _e(o,n,e={}){return ee(o,n,e).rows}function ee(o,n,e={}){let t=N(o,[n],{additive:e.additive,semantic:e.semantic,semanticEvidence:e.semanticEvidence}),a=e.callableOnly?(t.rows.get(n.symbolId)??[]).filter(l=>G(l.symbol)||l.source==="ast-callsite"):t.rows.get(n.symbolId)??[];return{rows:typeof e.limit=="number"?a.slice(0,e.limit):a,semanticIncomplete:t.incompleteSymbolIds.has(n.symbolId),semanticUnavailable:t.unavailableSymbolIds.has(n.symbolId)}}function Le(o,n,e){return ne(o,n,e).rows}function ne(o,n,e){let t=Z(o,[n],e);return{rows:t.rows.get(n.symbolId)??[],semanticIncomplete:t.incompleteSymbolIds.has(n.symbolId),semanticUnavailable:t.unavailableSymbolIds.has(n.symbolId)}}function Ae(o,n,e){return Z(o,n,e).rows}function Z(o,n,e){let t=ae(o)?ce(o,n,{semantic:e.semantic!==!1,semanticEvidence:e.semanticEvidence}):se(o,e.semanticEvidence,{semantic:e.semantic!==!1});return{rows:new Map(n.map(l=>[l.symbolId,typeof e.limit=="number"?(t.rows.get(l.symbolId)??[]).slice(0,e.limit):t.rows.get(l.symbolId)??[]])),incompleteSymbolIds:new Set(n.filter(l=>t.incompleteSymbolIds.has(l.symbolId)).map(l=>l.symbolId)),unavailableSymbolIds:new Set(n.filter(l=>t.unavailableSymbolIds.has(l.symbolId)).map(l=>l.symbolId))}}var oe=M("caller-rows",{clearGroups:["whole-project"]}),te=M("caller-rows-non-semantic",{clearGroups:["whole-project"]}),ie=M("targeted-caller-strategy",{clearGroups:["whole-project"]}),le=2e4;function ae(o){return ie.get(o,()=>(o.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>le)}function se(o,n,e={}){return(e.semantic===!1?te:oe).get(o,()=>{let a=H(o),l=N(o,a,{semantic:e.semantic!==!1,semanticEvidence:n}),m=new Map;for(let c of a)m.set(c.symbol,c.symbolId);let b=new Map,f=new Map;for(let c of a){let s=l.rows.get(c.symbolId);if(!(!s||s.length===0))for(let u of s){let r=m.get(u.symbol);if(r===void 0||r===c.symbolId)continue;let i=b.get(r);i||(i=[],b.set(r,i),f.set(r,new Set));let w=`${c.symbol}|${c.relativePath}`;f.get(r).has(w)||(f.get(r).add(w),i.push({symbol:c.symbol,file:c.relativePath,source:"caller-map-inversion",callEvidence:u.source}))}}return{rows:b,incompleteSymbolIds:l.incompleteSymbolIds.size===0?new Set:new Set(a.map(c=>c.symbolId)),unavailableSymbolIds:l.unavailableSymbolIds.size===0?new Set:new Set(a.map(c=>c.symbolId))}})}function ce(o,n,e){let t=e.semantic&&e.semanticEvidence?n.flatMap(s=>{let u=re(o,s);return u?[u]:[]}):[],a=new Map(t.map(s=>[s.symbolId,s])),l=e.semantic&&e.semanticEvidence?e.semanticEvidence.referenceEvidenceMap(o,t):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},m=Q(o,n),b=new Map;for(let s of n){let u=[],r=new Set,i=d=>{if(d.symbol===s.symbol)return;let p=`${d.symbol}|${d.file}`;r.has(p)||(r.add(p),u.push(d))};for(let d of m.get(s.symbolId)??[])d.file!==s.relativePath&&i({symbol:d.enclosingSymbol??d.file,file:d.file,source:"resolved-reference"});let w=a.get(s.symbolId);if(w)for(let d of l.rows.get(w.symbolId)??[]){if(d.file===s.relativePath||o.isIgnored(d.file))continue;let p=B(j(o,d.file),d.line);i({symbol:p?.symbol??d.file,file:d.file,source:"semantic-reference"})}b.set(s.symbolId,u)}let f=new Set(l.incompleteSymbolIds),c=new Set(l.unavailableSymbolIds);if(e.semantic)for(let s of n)a.has(s.symbolId)||f.add(s.symbolId);return{rows:b,incompleteSymbolIds:f,unavailableSymbolIds:c}}function re(o,n){let e=z().join(", "),t=Y().join(", ");return o.get(`SELECT
2
+ d.id AS documentId,
3
+ gs.id AS symbolId,
4
+ gs.symbol,
5
+ d.relative_path AS relativePath,
6
+ COALESCE(der.start_line, c.start_line) AS startLine,
7
+ COALESCE(der.end_line, c.end_line) AS endLine,
8
+ COALESCE(gs.display_name, '') AS leaf,
9
+ NULL AS parentTypeName,
10
+ CASE WHEN gs.kind IN (${e}) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
11
+ CASE WHEN gs.kind IN (${t}) THEN 1 ELSE 0 END AS isTypeLike,
12
+ gs.kind AS kind,
13
+ gs.documentation AS documentation,
14
+ gs.enclosing_symbol AS enclosingSymbol
15
+ FROM global_symbols gs
16
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
17
+ LEFT JOIN chunks c ON c.document_id = der.document_id
18
+ JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
19
+ WHERE gs.id = ?
20
+ LIMIT 1`,n.symbolId)??null}function De(o,n,e={}){return N(o,n,e).rows}function N(o,n,e={}){if(n.length===0)return{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set};let t=e.additive??!1,a=[],l=[];for(let r of n)A(r.relativePath)&&D(o,r.relativePath)!==null?a.push(r):l.push(r);let m=new Map,b=new Map,f=r=>{for(let[i,w]of r){let d=m.get(i);d||(d=[],m.set(i,d));let p=b.get(i);p||(p=new Set,b.set(i,p));for(let v of w){let I=`${v.symbol}|${v.chunkId}`;p.has(I)||(p.add(I),d.push(v))}}};a.length>0&&f(me(o,a));let c=new Set,s=new Set;if(e.semantic!==!1&&e.semanticEvidence){let r=e.semanticEvidence.calleeEvidenceMap(o,n);f(pe(r.rows));for(let i of r.incompleteSymbolIds)c.add(i);for(let i of r.unavailableSymbolIds)s.add(i)}else if(e.semantic!==!1)for(let r of n)s.add(r.symbolId);let u=t?n:l;return u.length>0&&f(fe(o,u)),{rows:m,incompleteSymbolIds:c,unavailableSymbolIds:s}}function me(o,n){let e=new Map,t=de(n,e),a=U(o);for(let[l,m]of t){let b=D(o,l);if(!b)continue;let f=$(m);for(let c of b){let s=f.get(c.line);if(!s)continue;let u=ue(o,l,a,c);u&&u.symbol!==s.symbol&&e.get(s.symbolId).push({symbol:u.symbol,file:u.file,chunkId:c.line,source:"ast-callsite",callsiteLine:c.line})}}return e}function de(o,n){let e=new Map;for(let t of o){let a=e.get(t.relativePath);a?a.push(t):e.set(t.relativePath,[t]),n.set(t.symbolId,[])}for(let t of e.values())t.sort((a,l)=>a.endLine-a.startLine-(l.endLine-l.startLine));return e}function ue(o,n,e,t){let a=J(n,e.get(t.calleeLeaf)??[]);if(a.length===0)return null;let l=be(o,n,a,t.calleeQualifier);return l||K(o,n,a,t.memberAccess,t.calleeQualifier)}function be(o,n,e,t){if(!t||A(n)!=="clojure")return null;let l=x(o,n).filter(m=>m.kind==="namespace"&&m.localName===t&&m.sourcePath).map(m=>m.sourcePath);for(let m of l){let b=e.find(f=>P(m,f.file));if(b)return b}return e.find(m=>/`([^`]+)`\//.exec(m.symbol)?.[1]===t)??null}function fe(o,n){if(n.length===0)return new Map;let t=k(n.map(i=>i.documentId)).flatMap(i=>o.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
21
+ FROM mentions m
22
+ JOIN chunks c ON m.chunk_id = c.id
23
+ WHERE m.role != 1
24
+ AND c.document_id IN (${i.map(()=>"?").join(",")})`,...i)),a=new Map;for(let i of t)a.has(i.document_id)||a.set(i.document_id,[]),a.get(i.document_id).push(i);let m=k(t.map(i=>i.symbol_id)).flatMap(i=>o.all(`SELECT gs.id AS symbol_id, gs.symbol,
25
+ COALESCE(der.document_id, def_chunk.document_id) AS document_id
26
+ FROM global_symbols gs
27
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
28
+ LEFT JOIN (
29
+ SELECT m.symbol_id, MIN(c.document_id) AS document_id
30
+ FROM mentions m
31
+ JOIN chunks c ON m.chunk_id = c.id
32
+ WHERE m.role = 1
33
+ AND m.symbol_id IN (${i.map(()=>"?").join(",")})
34
+ GROUP BY m.symbol_id
35
+ ) def_chunk ON def_chunk.symbol_id = gs.id
36
+ WHERE gs.id IN (${i.map(()=>"?").join(",")})`,...i,...i)),b=k([...n.map(i=>i.documentId),...m.flatMap(i=>i.document_id===null?[]:[i.document_id])]),f=new Map(b.flatMap(i=>o.all(`SELECT id, relative_path FROM documents
37
+ WHERE id IN (${i.map(()=>"?").join(",")})`,...i).map(w=>[w.id,w.relative_path]))),c=new Map;for(let i of m)c.has(i.symbol_id)||c.set(i.symbol_id,{symbol:i.symbol,file:i.document_id!==null?f.get(i.document_id)??"":""});let s=new Map,u=f,r=ye(n);for(let[i,w]of r){let p=[...a.get(i)??[]].sort((y,g)=>y.start_line-g.start_line||y.end_line-g.end_line),v=[...w].sort((y,g)=>y.startLine-g.startLine||y.endLine-g.endLine),I=new Set,R=0;for(let y of v){for(;R<p.length&&p[R].start_line<=y.endLine;)I.add(p[R]),R+=1;for(let S of I)S.end_line<y.startLine&&I.delete(S);let g=new Set,O=[],_=null,q=()=>{if(_)return _;let S=u.get(y.documentId)??"",E=new Set;if(S){let L=W(o,S),C=Math.max(0,y.startLine),T=Math.min(L.length-1,y.endLine);for(let h=C;h<=T;h+=1)for(let X of L[h])E.add(X)}return _=E,E};for(let S of I){if(S.symbol_id===y.symbolId)continue;let E=c.get(S.symbol_id);if(!E)continue;if(!(S.start_line>=y.startLine&&S.end_line<=y.endLine)){if(!(S.start_line<=y.endLine&&S.end_line>=y.startLine))continue;let h=F(E.symbol);if(!h||!q().has(h))continue}let C=`${E.symbol}|${S.chunk_id}`;g.has(C)||(g.add(C),O.push({...E,chunkId:S.chunk_id,source:"scip-chunk"}))}s.set(y.symbolId,O)}}return s}var V=500;function k(o){let n=[...new Set(o)],e=[];for(let t=0;t<n.length;t+=V)e.push(n.slice(t,t+V));return e}function ye(o){let n=new Map;for(let e of o){let t=n.get(e.documentId);t?t.push(e):n.set(e.documentId,[e])}return n}function pe(o){let n=new Map;for(let[e,t]of o){let a=[];for(let l of t)a.push({symbol:l.symbol,file:l.file,chunkId:-1,source:"semantic-callee",...l.callsiteLine===void 0?{}:{callsiteLine:l.callsiteLine}});n.set(e,a)}return n}export{_e as a,ee as b,Le as c,ne as d,Ae as e,Z as f,De as g,N as h};
38
+ //# sourceMappingURL=chunk-J77SU6VA.js.map
@@ -0,0 +1,2 @@
1
+ import{a as P}from"./chunk-BJ6SQAEN.js";import{a as d}from"./chunk-QHRNXP3C.js";import{a as y}from"./chunk-DGXRDLV5.js";import{a as v}from"./chunk-B75HZHUP.js";import{c as b}from"./chunk-7FND7D7N.js";import{a as p}from"./chunk-BGBBVSH4.js";import{a as g,h}from"./chunk-C7QOQX32.js";import{d as c,h as u}from"./chunk-FETNQCFO.js";import{h as f,i as m}from"./chunk-O6QTXQPJ.js";import{basename as x,extname as S}from"path";function z(i,e){let{scope:r,maxLoc:n=15,limit:o=30,scanLimit:l}=e??{},a=new b(i);return y({candidates:()=>E(i,a,r,n),orderCandidates:v,scanLimit:l,profile:{name:"passthrough-candidates"},prepare:t=>a.calleeEvidenceMap(t,{semantic:e?.semantic!==!1}),evaluate:(t,s)=>s.incompleteSymbolIds.has(t.symbolId)||s.unavailableSymbolIds.has(t.symbolId)?null:L(i,t,s.rows.get(t.symbolId)??[]),orderResults:(t,s)=>t.loc-s.loc||t.file.localeCompare(s.file),limit:o})}function L(i,e,r){let n=C(r);if(n.size!==1||!f(i,e.relativePath,e.startLine,e.endLine))return null;let[,o]=[...n.entries()][0],l=I(i,e,o),a=T(i,e),t=l.length>0||a.length>0?"signal":"direct";return{symbol:e.symbol,shortName:c(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:p(e),forwardsTo:o.symbol,forwardsToShort:c(o.symbol),forwardsToFile:o.file,actionTier:t,boundaryEvidence:l,publicFacadeEvidence:a,recommendation:D(t,l,a)}}function I(i,e,r){return P(i,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:c(e.symbol)},{label:"callee name",value:c(r.symbol)},{label:"passthrough module",value:x(e.relativePath,S(e.relativePath))},{label:"callee module",value:x(r.file,S(r.file))}])}function D(i,e,r){if(i==="signal"){if(r.length>0)return`Review the public API before inlining; public-facade evidence: ${r.slice(0,2).join("; ")}.`;let n=e.filter(w);return n.length>0?`Review the public API before inlining; public-surface evidence: ${n.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(i,e){return d(i,e)?g(i,e.relativePath)?["exported passthrough is declared on the package public surface"]:h(i,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function w(i){return i.includes("public surface")}function C(i){let e=i.some(n=>u(n.symbol))?i.filter(n=>u(n.symbol)):i,r=new Map;for(let n of e)r.has(n.symbol)||r.set(n.symbol,n);return r}function E(i,e,r,n){return e.productionCallableDefinitions({scope:r,minLoc:3,maxLoc:n,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0}).filter(o=>!m(i,o))}export{z as a};
2
+ //# sourceMappingURL=chunk-JE3WZ6II.js.map
@@ -0,0 +1,4 @@
1
+ import{a as me}from"./chunk-TIIC3ZE7.js";import{f as G}from"./chunk-O6QTXQPJ.js";import{C as D}from"./chunk-ADTBPVUZ.js";import{v as W}from"./chunk-BMYOV5GP.js";var Fe=12,Ee=20,re=200,oe=800,Re=.9,ye={if_statement:"branch",conditional_expression:"branch",ternary_expression:"branch",switch_statement:"branch",switch_expression:"branch",switch_case:"branch",case_statement:"branch",match_statement:"branch",match_expression:"branch",match_arm:"branch",for_statement:"loop",for_in_statement:"loop",for_of_statement:"loop",while_statement:"loop",do_statement:"loop",await_expression:"await",return_statement:"return",throw_statement:"throw",raise_statement:"throw",assignment_expression:"mutation",augmented_assignment_expression:"mutation",assignment:"mutation",pair:"shape",field_initializer:"shape",spread_element:"spread",dictionary_splat:"spread",catch_clause:"catch",except_clause:"catch",finally_clause:"finally"},Z=["anchor","signature","binding","branch","loop","call","await","return","throw","mutation","shape","spread","catch","finally"],be=[...Z,"lifecycle"],Se=["loop","await","throw","mutation","spread","catch","finally","lifecycle"],Pe=new Set(["onBeforeMount","onBeforeUnmount","onMounted","onUnmounted","useEffect","useInsertionEffect","useLayoutEffect"]);var ge=new Set(["object","object_pattern","dictionary","field_declaration_list","struct_expression","struct_pattern"]);function at(e,n,t,r,o=[],a={}){let s=D(e,n);if(!s)return null;let f=W(e,n),c=Ce(e,n,t,r,o),u=te(e,n,c.startLine,c.endLine),p=u?.startLine??t,d=u?.endLine??r,b=(u?I(s.rootNode,c.startLine,c.endLine):null)??K(s.rootNode,p,d);if(!b)return null;let m=xe(b,f,p,d,o);if(!m||m.lines.length===0||m.lines.some(S=>S.text.length>oe))return null;let g=Xe(f,p,d),F=Ve(m);if((a.requireSavings??!0)&&F>=g*Re)return null;let N=Z.filter(S=>m.lines.some(v=>v.signals.includes(S)));return{...u?{callable:{name:u.name,startLine:u.startLine,endLine:u.endLine}}:{},representation:"outline",constructKind:m.constructKind,signature:m.signature,lines:m.lines,signals:N,testCases:me(n)==="test"?tt(f,p,d):[],coverage:{sourceStatements:m.sourceStatements,representedStatements:m.sourceStatements,copiedStatements:m.copiedStatements,omittedStatements:0},rawCharacters:g,outlineCharacters:F,candidateLines:m.sourceStatements,omittedLines:0}}function st(e,n,t,r,o){if(o.length===0)return[];let a=D(e,n);if(!a)return[];let s=W(e,n),f=Ce(e,n,t,r,o),c=te(e,n,f.startLine,f.endLine),u=c?.startLine??t,p=c?.endLine??r,d=(c?I(a.rootNode,f.startLine,f.endLine):null)??K(a.rootNode,u,p);if(!d)return[];let b=xe(d,s,u,p,o);return b?b.lines.filter(m=>m.text.length<=oe&&m.signals.some(g=>["branch","loop","catch","finally"].includes(g))&&o.some(g=>g>=m.line&&g<=m.endLine)):[]}function ct(e,n,t,r){let o=D(e,n);if(!o)return null;let a=I(o.rootNode,t,r)??K(o.rootNode,t,r);if(!a)return null;let s=[],f=ae(a),c=[];return se(a,a,u=>{if(k.has(u.type)||Te.has(u.type)){Oe(s,c,u);return}if(ee.has(u.type)){De(s,c,u);return}if(z.has(u.type)){Ie(s,c,u);return}j.has(u.type)&&Me(s,u)}),{facts:ze(s),terminals:ve(f),unsupported:c}}function Ce(e,n,t,r,o=[]){let a=o.filter(d=>d>=t&&d<=r),s=D(e,n);if(a.length>0&&s){let d=[];A(s.rootNode,m=>{je(m)&&m.startPosition.row>=t&&m.endPosition.row<=r&&a.every(g=>m.startPosition.row<=g&&m.endPosition.row>=g)&&d.push(m)});let b=d.sort((m,g)=>m.endPosition.row-m.startPosition.row-(g.endPosition.row-g.startPosition.row)||m.startPosition.row-g.startPosition.row)[0];if(b)return{startLine:b.startPosition.row,endLine:b.endPosition.row}}let f=te(e,n,t,r);if(f)return{startLine:f.startLine,endLine:f.endLine};if(a.length===0)return{startLine:t,endLine:r};let c=(G(e,n)?.callables??[]).filter(d=>d.startLine>=t&&d.endLine<=r&&a.every(b=>d.startLine<=b&&d.endLine>=b)).sort((d,b)=>d.endLine-d.startLine-(b.endLine-b.startLine)||d.startLine-b.startLine)[0];if(!s)return c?{startLine:c.startLine,endLine:c.endLine}:{startLine:t,endLine:r};let u=[];A(s.rootNode,d=>{P.has(d.type)&&d.startPosition.row>=t&&d.endPosition.row<=r&&a.every(b=>d.startPosition.row<=b&&d.endPosition.row>=b)&&u.push(d)});let p=u.sort((d,b)=>d.endPosition.row-d.startPosition.row-(b.endPosition.row-b.startPosition.row)||d.startPosition.row-b.startPosition.row)[0];return p?{startLine:p.startPosition.row,endLine:p.endPosition.row}:c?{startLine:c.startLine,endLine:c.endLine}:{startLine:t,endLine:r}}function lt(e,n,t,r,o={}){if(r-t+1<(o.minimumBodyLines??Ee))return null;let s=Le(e,n,t,r,[],!1);if(!s)return null;let f=s.candidates.map(S=>({...S,signals:S.signals.filter(v=>v!=="anchor"&&v!=="signature")})).filter(S=>S.signals.length>0);if(f.length===0)return null;let c=Ze(f),u=f.filter(S=>S.text.length<=re);if(u.length===0)return null;let p=Se.filter(S=>(c[S]??0)>0),d=p.filter(S=>S!=="await"),b=s.shapes.reduce((S,v)=>S+v.fields.length,0);if(d.length===0&&!((c.await??0)>0&&b>0)&&b<3)return null;let m=et(u,c),g=new Map;for(let S of p){let v=m.find(h=>h.signals.includes(S));v&&g.set(v.line,v)}if(g.size===0){let S=m.find(v=>v.signals.includes("branch"));S&&g.set(S.line,S)}let F=Math.min(10,Math.max(1,o.maxLines??g.size)),N=new Map;for(let S of g.values()){if(N.size>=F)break;N.set(S.line,S)}return N.size>=f.length&&s.shapes.length===0?null:{owner:s.callable?.name??null,startLine:t,endLine:r,lines:[...N.values()].sort((S,v)=>S.line-v.line),shapes:s.shapes,signalCounts:c,candidateLines:f.length,omittedLines:f.length-N.size}}function ut(e,n,t,r){let o=Le(e,n,t,r,[],!1);return o?new Map(o.candidates.map(a=>[a.line,a.signals.filter(s=>s!=="lifecycle")])):new Map}var P=new Set(["arrow_function","constructor_declaration","function_declaration","function_definition","function_expression","generator_function","generator_function_declaration","function_item","lambda","lambda_expression","method","method_declaration","method_definition"]),L=new Set(["block","body","compound_statement","declaration_list","statement_block"]),k=new Set(["if_expression","if_statement","unless","unless_statement"]),Te=new Set(["conditional_expression","ternary_expression"]),ee=new Set(["do_statement","enhanced_for_statement","for_expression","for_in_statement","for_of_statement","for_statement","loop_expression","while_statement"]),z=new Set(["match_expression","match_statement","switch_expression","switch_statement"]),_e=new Set(["case_statement","match_arm","switch_case","switch_default"]),j=new Set(["try_expression","try_statement"]),V=new Set(["catch_clause","except_clause","rescue"]),$=new Set(["ensure","finally_clause"]),Y=new Set(["else","else_clause"]),Ne=new Set(["raise_statement","return_statement","throw_statement"]),Ae=new Set(["block_comment","comment","line_comment"]);function Oe(e,n,t){let r=t.childForFieldName("condition")??le(t),o=t.childForFieldName("consequence")??t.childForFieldName("body")??t.namedChildren.find(c=>L.has(c.type)),a=t.childForFieldName("alternative")??t.namedChildren.find(c=>Y.has(c.type));if(!r||!o){n.push(ce(t,"conditional-fields-unresolved"));return}let s=R(r,"predicate",r.text),f=R(o,pe(o),"consequence");if(E(e,s,f,"predicate-consequence",{branchRole:"consequence"}),J(e,s,o,"consequence"),a){let c=R(a,pe(a),"alternative");E(e,s,c,"predicate-alternative",{branchRole:"alternative"}),J(e,s,a,"alternative");return}E(e,s,ie(s,"otherwise continue"),"predicate-fallthrough",{branchRole:"fallthrough"})}function De(e,n,t){let r=t.childForFieldName("body")??t.namedChildren.find(s=>L.has(s.type));if(!r){n.push(ce(t,"loop-body-unresolved"));return}let o=t.childForFieldName("condition"),a=R(o??t,"predicate",o?.text??B(t,r));E(e,a,R(r,"outcome","iteration"),"loop-iteration",{branchRole:"iteration"}),J(e,a,r,"iteration"),E(e,a,ie(a,"loop exits"),"loop-exit",{branchRole:"exit"})}function Ie(e,n,t){let r=t.childForFieldName("body")??t.namedChildren.find(c=>L.has(c.type)),o=t.childForFieldName("value")??t.childForFieldName("condition")??t.childForFieldName("subject")??le(t),a=Ye(r??t);if(!o||a.length===0){n.push(ce(t,"switch-cases-unresolved"));return}let s=R(o,"predicate",o.text),f=!1;for(let c of a){let u=qe(c);f||=u;let p=B(c,c.namedChildren.find(d=>Q(d)));E(e,s,R(c,"outcome",p||(u?"default":"case")),u?"predicate-default":"predicate-case",{branchRole:u?"default":"case"}),J(e,s,c,u?"default":"case")}f||E(e,s,ie(s,"no case matched"),"predicate-fallthrough",{branchRole:"fallthrough"})}function Me(e,n){let t=R(n,"scope","try");for(let r of $e(n)){let o=$.has(r.type),a=R(r,"handler",o?"finally":B(r,U(r)));E(e,t,a,o?"finally-cleanup":"exception-handler",{branchRole:o?"finally":"catch"}),ke(e,a,r,o?"finally":"catch")}}function ke(e,n,t,r){for(let o of ae(t)){let a=o.label.startsWith("throw")||o.label.startsWith("raise")?"throw":"return";E(e,n,o,a==="throw"?"handler-throw":"handler-return",{branchRole:r,terminalKind:a})}}function J(e,n,t,r){for(let o of ae(t)){let a=o.label.startsWith("throw")||o.label.startsWith("raise")?"throw":"return";E(e,n,o,a==="throw"?"predicate-throw":"predicate-return",{branchRole:r,terminalKind:a})}}function E(e,n,t,r,o){e.push({controller:n,outcome:t,subtype:r,attributes:o})}function R(e,n,t){return{kind:n,label:q(t).slice(0,oe),startLine:e.startPosition.row,endLine:e.endPosition.row,implicit:!1}}function ie(e,n){return{...e,kind:"outcome",label:n,implicit:!0}}function pe(e){return Ne.has(e.type)?"terminal":"outcome"}function ae(e){let n=[];return se(e,e,t=>{Ne.has(t.type)&&n.push(R(t,"terminal",t.text))}),ve(n)}function se(e,n,t){t(n);for(let r of n.namedChildren)r!==e&&P.has(r.type)||se(e,r,t)}function Ye(e){let n=[],t=r=>{for(let o of r.namedChildren)z.has(o.type)||(_e.has(o.type)?n.push(o):t(o))};return t(e),n}function $e(e){let n=[],t=r=>{for(let o of r.namedChildren)j.has(o.type)||(V.has(o.type)||$.has(o.type)?n.push(o):P.has(o.type)||t(o))};return t(e),n}function qe(e){let n=B(e,e.namedChildren.find(t=>Q(t))).trim();return e.type==="switch_default"||/^(?:default\b|_\s*=>)/u.test(n)}function ce(e,n){return{startLine:e.startPosition.row,endLine:e.endPosition.row,reason:n}}function ze(e){let n=new Map;for(let t of e)n.set(`${t.controller.startLine}\0${t.controller.endLine}\0${t.outcome.startLine}\0${t.outcome.endLine}\0${t.subtype}\0${t.outcome.label}`,t);return[...n.values()]}function ve(e){let n=new Map;for(let t of e)n.set(`${t.startLine}\0${t.endLine}\0${t.kind}\0${t.label}`,t);return[...n.values()]}function je(e){return P.has(e.type)||ee.has(e.type)||z.has(e.type)||j.has(e.type)||V.has(e.type)||$.has(e.type)}function xe(e,n,t,r,o){let s=I(e,t,r)??e,f=U(s),c=[],u=0,p=0,d=(i,l,y,C,x=!1,O=!0)=>{let H=x?y.trim():q(y);if(!H)return;let T=Math.max(t,i.startPosition.row),de=Math.min(r,i.endPosition.row);c.push({line:T,endLine:Math.max(T,de),depth:l,signals:Z.filter(he=>C.includes(he)||he==="anchor"&&o.some(fe=>fe>=T&&fe<=de)),text:H,copied:x}),O&&(u+=1,x&&(p+=1))},b=(i,l)=>{for(let y of i.namedChildren)_(y,l)},m=(i,l)=>{if(k.has(i.type)){g(i,l,"else if");return}if(Y.has(i.type)){let y=i.namedChildren.find(x=>k.has(x.type));if(y){g(y,l,"else if");return}d(i,l,"else",["branch"],!1,!1);let C=U(i)??i.namedChildren.find(x=>L.has(x.type));if(C)_(C,l+1);else for(let x of i.namedChildren)_(x,l+1);return}d(i,l,"else",["branch"],!1,!1),_(i,l+1)},g=(i,l,y=i.type.startsWith("unless")?"unless":"if")=>{let C=i.childForFieldName("condition")??le(i),x=i.childForFieldName("consequence")??i.childForFieldName("body")??i.namedChildren.find(T=>L.has(T.type)),O=i.childForFieldName("alternative")??i.namedChildren.find(T=>Y.has(T.type)),H=C?C.text:B(i,x);d(i,l,`${y} ${Ge(H)}`,M(C,["branch"])),x&&_(x,l+1),O&&m(O,l)},F=(i,l)=>{let y=i.childForFieldName("body")??i.namedChildren.find(C=>L.has(C.type));d(i,l,B(i,y),M(i,["loop"])),y&&_(y,l+1)},N=(i,l)=>{let y=i.childForFieldName("body")??i.namedChildren.find(C=>L.has(C.type));d(i,l,B(i,y),M(i,["branch"])),y&&_(y,l+1)},S=(i,l)=>{let y=i.namedChildren.find(C=>Q(C));d(i,l,B(i,y),["branch"],!1,!1);for(let C of i.namedChildren)(C===y||Q(C))&&_(C,l+1)},v=(i,l)=>{d(i,l,"try",[],!1);for(let y of i.namedChildren)L.has(y.type)?_(y,l+1):(V.has(y.type)||$.has(y.type))&&_(y,l)},h=(i,l,y)=>{let C=i.childForFieldName("body")??i.namedChildren.find(O=>L.has(O.type)),x=y==="finally"?"finally":B(i,C);d(i,l,x,[y],!1,!1),C&&_(C,l+1)},w=(i,l)=>{let y=U(i);d(i,l,B(i,y),M(i,["binding"])),y&&_(y,l+1)},_=(i,l)=>{if(i.startPosition.row>r||i.endPosition.row<t||Ae.has(i.type)||i.type==="empty_statement")return;if(L.has(i.type)){b(i,l);return}if(k.has(i.type)){g(i,l);return}if(ee.has(i.type)){F(i,l);return}if(z.has(i.type)){N(i,l);return}if(_e.has(i.type)){S(i,l);return}if(j.has(i.type)){v(i,l);return}if(V.has(i.type)){h(i,l,"catch");return}if($.has(i.type)){h(i,l,"finally");return}if(Y.has(i.type)){m(i,l);return}if(P.has(i.type)){w(i,l);return}let C=!we(i)||Ue(i);d(i,l,i.text,M(i),C)};return _(f&&f!==s?f:s,0),u===0?null:{constructKind:We(s),signature:He(s,f,n,t),lines:c,sourceStatements:u,copiedStatements:p}}function I(e,n,t){let r=e.namedChildren.filter(o=>o.startPosition.row<=n&&o.endPosition.row>=t);for(let o of r.sort(Ke)){let a=I(o,n,t);if(a)return a}return P.has(e.type)&&e.startPosition.row<=n&&e.endPosition.row>=t?e:null}function Ke(e,n){return e.endPosition.row-e.startPosition.row-(n.endPosition.row-n.startPosition.row)||e.startPosition.row-n.startPosition.row}function U(e){return e.childForFieldName("body")??e.childForFieldName("consequence")??e.namedChildren.find(n=>L.has(n.type))??null}function He(e,n,t,r){let o=B(e,n);return o||(t[r]??e.text).trim()}function We(e){return e.type.includes("constructor")?"constructor":e.type.includes("method")||e.type==="method"?ne(e,new Set(["class_body","class_declaration","class_definition"]))?"class method":"object method":e.type==="arrow_function"||e.type==="function_expression"||e.type==="lambda"?ne(e,new Set(["object","pair"]))?"object member":"function value":e.type.includes("function")?ne(e,P)?"nested function":"module function":"source construct"}function ne(e,n){let t=e.parent;for(;t;){if(n.has(t.type))return!0;t=t.parent}return!1}function le(e){return e.namedChildren.find(n=>!L.has(n.type)&&!Y.has(n.type))??null}function B(e,n){if(!n)return q(e.text);let t=Math.max(0,n.startIndex-e.startIndex);return q(e.text.slice(0,t)).replace(/[:{]\s*$/u,"").trim()}function Ge(e){let n=q(e);return n.startsWith("(")&&n.endsWith(")")?n.slice(1,-1).trim():n}function q(e){return e.trim().replace(/\r?\n[\t ]*/gu," ")}function M(e,n=[]){let t=new Set(n);return e&&A(e,r=>{let o=ye[r.type];o&&t.add(o),r.type==="call_expression"&&(t.add("call"),Be(r)&&t.add("shape")),ue.has(r.type)&&t.add("binding")}),Z.filter(r=>t.has(r))}function Ue(e){let n=!1;return A(e,t=>{n||!t.text.includes(`
2
+ `)||/(?:string|template|heredoc|raw_string)/u.test(t.type)&&(n=!0)}),n}function Q(e){return L.has(e.type)||k.has(e.type)||ee.has(e.type)||z.has(e.type)||j.has(e.type)||P.has(e.type)||we(e)}function we(e){return/(?:statement|declaration|expression|assignment|return|throw|raise|break|continue|yield|with_item)$/u.test(e.type)||ue.has(e.type)}function Xe(e,n,t){let r=0;for(let o=n;o<=t;o+=1)r+=(e[o]?.length??0)+10;return r}function Ve(e){return e.constructKind.length+e.signature.length+80+e.lines.reduce((n,t)=>n+t.text.length+t.depth*2+10,0)}function Le(e,n,t,r,o,a){let s=D(e,n);if(!s)return null;let f=W(e,n),c=te(e,n,t,r),u=a?c?.startLine??t:t,p=a?c?.endLine??r:r,b=(c?.startLine===u&&c.endLine===p?I(s.rootNode,u,p):null)??K(s.rootNode,u,p);if(!b)return null;let m=new Map,g=new Map,F=new Map,N=(h,w)=>{if(h<u||h>p)return;let _=m.get(h)??new Set;_.add(w),m.set(h,_)};c&&N(c.startLine,"signature");for(let h of o)N(h,"anchor");A(b,h=>{let w=ye[h.type];if(w&&N(h.startPosition.row,w),w==="shape"&&Je(g,h,b,u,p),h.type==="call_expression"){let i=(h.childForFieldName("function")??h.namedChild(0))?.text.split(".").at(-1);if(Be(h)){N(h.startPosition.row,"shape");let l=X(h.text);l.length<=re&&F.set(h.startPosition.row,l)}if(i&&Pe.has(i)){N(h.startPosition.row,"lifecycle");let l=X(h.text);l.length<=re&&F.set(h.startPosition.row,l)}}ue.has(h.type)&&N(h.startPosition.row,"binding")});let S=G(e,n);for(let h of S?.callSites??[])h.line<u||h.line>p||(N(h.line,"call"),h.calleeLeaf==="catch"&&N(h.line,"catch"));let v=[...m.entries()].sort(([h],[w])=>h-w).map(([h,w])=>({line:h,signals:be.filter(_=>w.has(_)),text:F.get(h)??X(f[h]??"")})).filter(h=>h.text.length>0||h.signals.includes("anchor"));return{...c?{callable:c}:{},rangeStart:u,rangeEnd:p,sourceLines:f,candidates:v,shapes:[...g.values()].sort((h,w)=>h.startLine-w.startLine)}}function Je(e,n,t,r,o){if(n.startPosition.row<r||n.endPosition.row>o)return;let a=n.childForFieldName("key")??n.childForFieldName("name")??n.namedChild(0),s=X(a?.text??"");if(!s||s.includes(`
3
+ `)||s.length>60)return;let f=Qe(n,t);if(f.startPosition.row<r||f.endPosition.row>o)return;let c=`${f.startPosition.row}:${f.endPosition.row}`,u=e.get(c)??{startLine:f.startPosition.row,endLine:f.endPosition.row,fields:[]};u.fields.some(p=>p.name===s&&p.line===n.startPosition.row)||u.fields.push({name:s,line:n.startPosition.row}),e.set(c,u)}function Qe(e,n){let t=e.parent;for(;t&&t!==n.parent;){if(ge.has(t.type))return t;if(t===n)break;t=t.parent}return e.parent??e}function te(e,n,t,r){return G(e,n)?.callables.filter(o=>o.startLine<=t&&o.endLine>=r).sort((o,a)=>o.endLine-o.startLine-(a.endLine-a.startLine)||o.startLine-a.startLine)[0]}function K(e,n,t){if(e.startPosition.row>n||e.endPosition.row<t)return null;for(let r of e.namedChildren){let o=K(r,n,t);if(o)return o}return e}function A(e,n){n(e);for(let t of e.namedChildren)A(t,n)}function X(e){return e.trim().replace(/\s+/gu," ")}function Be(e){if(e.type!=="call_expression")return!1;let n=e.childForFieldName("arguments")??e.namedChildren.find(r=>r.type==="arguments"||r.type==="argument_list");if(!n)return!1;let t=!1;return A(n,r=>{ge.has(r.type)&&(t=!0)}),t}function Ze(e){let n={};for(let t of be){let r=e.filter(o=>o.signals.includes(t)).length;r>0&&(n[t]=r)}return n}function et(e,n){let t=new Map;for(let a of e){let s=a.signals.join(",");t.set(s,(t.get(s)??0)+1)}let r=new Set(Se),o=a=>{let s=t.get(a.signals.join(","))??1,f=Math.min(...a.signals.map(p=>n[p]??1)),c=a.signals.some(p=>r.has(p))?3:1,u=Math.max(0,a.signals.length-1)*1e3;return c*(1e3/s+1e3/f)+u};return[...e].sort((a,s)=>o(s)-o(a)||s.line-a.line)}var ue=new Set(["lexical_declaration","variable_declarator","const_item","static_item","let_declaration","assignment"]);function tt(e,n,t){let r=[],o=/\b(?:describe|it|test)(?:\.(?:only|skip|todo))?\s*\(\s*(['"`])([^'"`]+)\1/u;for(let a=n;a<=t;a+=1){let s=o.exec(e[a]??"")?.[2];if(!(!s||r.includes(s))&&(r.push(s),r.length>=Fe))break}return r}export{at as a,st as b,ct as c,Ce as d,lt as e,ut as f};
4
+ //# sourceMappingURL=chunk-JEJLSICM.js.map
@@ -0,0 +1,2 @@
1
+ import{a as O,b as T,c as y,f as I,g as G,i as $,l as Y,m as q,n as K}from"./chunk-6CS3UQTN.js";import{S as _}from"./chunk-UCD3H3UZ.js";import{a as N}from"./chunk-NNOKTMZT.js";import{e as U,i as P,j as h,l as z,n as E,u as g}from"./chunk-BMYOV5GP.js";import{a as J,d as f}from"./chunk-3LCDIREB.js";var ue={references:$,referenceMap:Y,referenceEvidenceMap:q,callerMap:(e,i)=>I(e).callerMap(i),calleeMap:X,calleeEvidenceMap:Q};function X(e,i,r={}){return Q(e,i,r).rows}function Q(e,i,r={}){let a=J(),o=new Map,l=G(e,i),n=[],c=[],m=0,p=0,d=0,w=0,R=0,H=0,k=0,S=new Set,v=new Set;for(let{definition:t,callees:s}of l.hits)R+=1,o.set(t.symbolId,s),s.length>0&&(H+=1,k+=s.length);let u=Z(e,l.hits);if(u.entries.length>0&&f("semantic.callees.prefetch-cache-write",()=>E(e,u.entries),()=>({entries:u.entries.length,sourceMissing:u.sourceMissing,skippedUnsupportedLanguage:u.skippedUnsupportedLanguage})),f("semantic.callees.cache-scan",()=>{for(let[t,s]of O(l.misses)){if(!y(t)){a&&(m+=s.length);continue}let j=g(e,t);if(!j){a&&(p+=s.length),c.push(...s);continue}let A=h(e,t,j),D=V(e,t);if(!D){c.push(...s);continue}let W=z(e,t,A,D);for(let M of s){let L=W.get(M.symbol)??null;if(L!==null){let B=te(L);if(B){a&&(d+=1),o.set(M.symbolId,B);continue}a&&(w+=1)}n.push({def:M,contentHash:A,depsDigest:D})}}},()=>({definitions:i.length,skippedUnsupportedLanguage:m,sourceMissing:p,cacheHits:d,parseFailures:w,misses:n.length,unkeyed:c.length,inMemoryHits:R,inMemoryRows:H,inMemoryCalleeCount:k,resultRows:o.size})),n.length===0&&c.length===0)return{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v};let x=[...c,...n.map(t=>t.def)],F=0,C=f("semantic.callees.compute-misses",()=>{let t=K(e,x,r.resolveProvider);for(let s of t.incompleteSymbolIds)S.add(s);for(let s of t.unavailableSymbolIds)v.add(s);return F=t.rows.size,t.rows},()=>({definitions:x.length,misses:n.length,unkeyed:c.length,rows:F}));for(let[t,s]of C)o.set(t,s);let b=n.filter(t=>C.has(t.def.symbolId)&&I(e).capability("semantic-callees",t.def.relativePath).available).map(t=>({relativePath:t.def.relativePath,symbol:t.def.symbol,contentHash:t.contentHash,depsDigest:t.depsDigest,payload:JSON.stringify(C.get(t.def.symbolId)??[])}));return b.length>0?f("semantic.callees.cache-write",()=>E(e,b),()=>({entries:b.length})):f("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:n.length})),{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v}}function Z(e,i){let r=[],a=new Map,o=0,l=0;for(let{definition:n,callees:c}of i){if(!y(n.relativePath)){l+=1;continue}if(!a.has(n.relativePath)){let p=g(e,n.relativePath),d=p?V(e,n.relativePath):null;a.set(n.relativePath,p&&d?{contentHash:h(e,n.relativePath,p),depsDigest:d}:null)}let m=a.get(n.relativePath);if(!m){o+=1;continue}r.push({relativePath:n.relativePath,symbol:n.symbol,contentHash:m.contentHash,depsDigest:m.depsDigest,payload:JSON.stringify(c)})}return{entries:r,sourceMissing:o,skippedUnsupportedLanguage:l}}var ee="typescript-callees-v3-incomplete-scan";function V(e,i){let r=y(i);if(r==="typescript")return _(e,i,ee)?.key??null;let a=ie(e,i);return r==="rust"?P(JSON.stringify({kind:"semantic-callees",language:r,engine:T(e.config.projectRoot),positionMapping:"nearby-leaf-v2-callsite-line",depsDigest:a})):a}function te(e){try{return JSON.parse(e)}catch{return null}}var ne=U("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function ie(e,i){return ne.get(e,i,()=>{let a=[...N(e).get(i)??[]].sort().map(o=>`${o}:${h(e,o,g(e,o))}`);return P(a.join("|"))})}export{ue as a};
2
+ //# sourceMappingURL=chunk-JOIRNPPY.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{q as o}from"./chunk-ECQBG7PW.js";import{l as n}from"./chunk-2X7V4HS4.js";async function i(t){if(typeof t!="string"||t.length===0)throw new Error("Output continuation requires a cursor.");await o(t,n)}var u={id:"continue",command:"continue <cursor>",hidden:!0,description:"Continue an immutable output snapshot",renderShape:"custom",handler:i};export{u as a};
3
+ //# sourceMappingURL=chunk-JSOYNVWH.js.map
@@ -0,0 +1,2 @@
1
+ import{c as h}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-JOIRNPPY.js";import{b,d as g}from"./chunk-J77SU6VA.js";import{a as u}from"./chunk-UZGZB3VB.js";import{d as o,h as p}from"./chunk-FETNQCFO.js";function N(n,a,f={}){let i=u(n,a);if(!i)return null;let l=f.semantic!==!1,c=g(n,i,{semantic:l,semanticEvidence:m}),S=c.rows.filter(e=>p(e.symbol)).slice(0,50),t=b(n,i,{limit:50,additive:!0,callableOnly:!0,semantic:l,semanticEvidence:m}),E=h(t.rows),d=S.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file,relationship:e.source!=="caller-map-inversion"?"reference-candidate":e.callEvidence==="scip-chunk"?"chunk-candidate":"resolved-call",evidenceStrength:e.source==="caller-map-inversion"&&e.callEvidence!=="scip-chunk"?"exact":"candidate",evidenceSource:e.callEvidence??e.source})),v=E.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file,relationship:e.source==="scip-chunk"?"chunk-candidate":"resolved-call",evidenceStrength:e.source==="scip-chunk"?"candidate":"exact",evidenceSource:e.source}));return{symbol:i.symbol,shortName:o(i.symbol),callers:d.map(({symbol:e,shortName:s,file:r})=>({symbol:e,shortName:s,file:r})),callees:v.map(({symbol:e,shortName:s,file:r})=>({symbol:e,shortName:s,file:r})),callerEvidence:d,calleeEvidence:v,coverage:{scope:"indexed-static-call-graph",blindSpots:["unresolved dynamic dispatch and reflection","external or unindexed callees without a resolved symbol identity","SCIP chunk co-occurrence is retained only as candidate call evidence",...c.semanticIncomplete?["compiler-resolved incoming evidence was incomplete; known callers are retained"]:[],...c.semanticUnavailable?["compiler-resolved incoming evidence was unavailable; known callers are retained"]:[],...t.semanticIncomplete?["compiler-resolved outgoing evidence was incomplete; known callees are retained"]:[],...t.semanticUnavailable?["compiler-resolved outgoing evidence was unavailable; known callees are retained"]:[]],semanticEvidence:{enabled:l,incoming:y(l,c),outgoing:y(l,t)}}}}function y(n,a){return n?a.semanticIncomplete&&a.semanticUnavailable?"incomplete-and-unavailable":a.semanticIncomplete?"incomplete":a.semanticUnavailable?"unavailable":"complete":"disabled"}export{N as a};
2
+ //# sourceMappingURL=chunk-KMITESMT.js.map
@@ -0,0 +1,2 @@
1
+ import{$ as p,aa as x,h as d}from"./chunk-WE5RZHZ7.js";import{b as g,d as f}from"./chunk-2Q2LW5JW.js";import{execFileSync as b}from"child_process";import{createHash as v}from"crypto";import{existsSync as s,statSync as j}from"fs";import{createRequire as B}from"module";import{platform as N}from"os";import{dirname as m,join as a}from"path";var S=B(import.meta.url),K={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function l(n){return[n.indexerBinary,...n.binaryAliases??[]]}function k(n){let e=l(n);return e.length===1?e[0]:e.join(" or ")}function u(n){for(let e of l(n)){let r=f(e);if(r)return r}return w(n)}function q(n){return u(n)!==null||L(n)}function L(n){return T(n)!==null}function w(n){let e=T(n);if(!e)return null;let t=JSON.parse(d(e,"indexer package manifest")).bin;if(!t)return null;if(typeof t=="string")return a(m(e),t);for(let o of l(n)){let i=t[o];if(i)return a(m(e),i)}return null}function T(n){if(!n.bundledNpmPackage)return null;try{return S.resolve(`${n.bundledNpmPackage}/package.json`)}catch{return null}}function O(n,e){for(let r of n.projectLocalBinaries??[]){let t=a(e,r);if(s(t))return t}return null}function E(n,e){for(let r of n.projectLocalBinaries??[]){let t=a(e,r);if(s(t))return I(e,r,t)}return null}function G(n,e){let r=D(n,e);if(!r||r.canonicalPath!==e.canonicalPath||r.sha256!==e.sha256||r.size!==e.size||r.mtimeMs!==e.mtimeMs||r.device!==e.device||r.inode!==e.inode||r.executable!==e.executable)throw new Error(`refusing changed project-local indexer ${e.relativePath}; review the current file and rerun with --trust-project-tools`)}function D(n,e){try{return I(n,e.relativePath,e.configuredPath)}catch{return null}}function I(n,e,r){let t={maxBytes:268435456,inputKind:"project-local indexer"},o=p(n,e,t),i=x(n,e,t),h=j(o.absolutePath);return{configuredPath:r,canonicalPath:o.absolutePath,relativePath:e,sha256:v("sha256").update(i).digest("hex"),size:o.size,mtimeMs:o.mtimeMs,device:o.device,inode:o.inode,executable:(h.mode&73)!==0}}function R(n,e,r={}){return(r.trustProjectTools?E(n,e)?.canonicalPath:null)??u(n)}function W(n,e=process.env,r=n.indexerBinary){if(n.indexerBinary!=="scip-dotnet"||c(r,e))return e;let t=P(r,e);return t?{...e,DOTNET_ROOT:t}:e}function Y(n,e,r={}){let t=k(n),o=e?R(n,e,r):u(n);if(!o)return{language:n.language,binaryLabel:t,installed:!1,runnable:!1,resolvedBinary:null,installUrl:n.installUrl,...e&&O(n,e)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(n.indexerBinary!=="scip-dotnet")return{language:n.language,binaryLabel:t,installed:!0,runnable:!0,resolvedBinary:o};let i=J(o);return{language:n.language,binaryLabel:t,installed:!0,runnable:i.runnable,resolvedBinary:o,installUrl:n.installUrl,note:i.note}}function J(n){if(c(n,process.env))return{runnable:!0};let e=P(n,process.env);if(e)return{runnable:!0,note:`using .NET 9 runtime from ${e}`};let r=y(process.env);return{runnable:!1,note:r.length>0?`.NET 9 runtime still unavailable after checking ${r.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function P(n,e){for(let r of y(e))if(c(n,{...e,DOTNET_ROOT:r}))return r;return null}function y(n){let e=[],r=n.DOTNET_ROOT;if(r&&s(r)&&e.push(r),N()==="darwin"&&g("brew"))try{let t=b("brew",["--prefix","dotnet@9"],{stdio:"pipe",windowsHide:!0,env:n,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),o=a(t,"libexec");s(o)&&!e.includes(o)&&e.push(o)}catch{}return e}function c(n,e){try{return b(n,["--version"],{stdio:"pipe",windowsHide:!0,env:e,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}export{K as a,k as b,u as c,q as d,O as e,E as f,G as g,W as h,Y as i};
2
+ //# sourceMappingURL=chunk-KUW32IRO.js.map