codebaseiq 0.1.0 → 0.2.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 (422) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-DQMDCD24.js → chunk-27PHVDKL.js} +2 -2
  4. package/dist/{chunk-ZMI2JSX2.js → chunk-2DMVFAY7.js} +2 -2
  5. package/dist/{chunk-5PUWMSDU.js → chunk-2E6BTWER.js} +2 -2
  6. package/dist/{chunk-YESXMKX3.js → chunk-2F5ERMNI.js} +2 -2
  7. package/dist/chunk-2VKB5CMA.js +60 -0
  8. package/dist/{chunk-NNJ2KZZG.js → chunk-327YK6TB.js} +4 -4
  9. package/dist/chunk-347TXATM.js +2 -0
  10. package/dist/{chunk-VEXUL62T.js → chunk-35YYZD3D.js} +2 -2
  11. package/dist/chunk-36WRYYTE.js +3 -0
  12. package/dist/chunk-37TKC6MB.js +2 -0
  13. package/dist/{chunk-FAJQ7LWY.js → chunk-3AC56WAR.js} +2 -2
  14. package/dist/{chunk-JE3WZ6II.js → chunk-3NUZVLR7.js} +2 -2
  15. package/dist/{chunk-UZGZB3VB.js → chunk-3XFJUWJE.js} +2 -2
  16. package/dist/{chunk-OVTS4DKB.js → chunk-4AOOSCZ7.js} +2 -2
  17. package/dist/{chunk-LU3BMVH2.js → chunk-4IFISPQW.js} +2 -2
  18. package/dist/chunk-4NHWNAWQ.js +11 -0
  19. package/dist/chunk-4O52YNKL.js +5 -0
  20. package/dist/{chunk-HPJRBHVT.js → chunk-54K6556S.js} +2 -2
  21. package/dist/{chunk-HRWGYWRJ.js → chunk-57GCCPLS.js} +2 -2
  22. package/dist/{chunk-J77SU6VA.js → chunk-57KEZDPT.js} +2 -2
  23. package/dist/{chunk-OFBE4NGP.js → chunk-57KFVPVZ.js} +2 -2
  24. package/dist/{chunk-WOQBZPIF.js → chunk-5BDK6QC3.js} +2 -2
  25. package/dist/{chunk-7MGU3HPH.js → chunk-5IO2APSS.js} +2 -2
  26. package/dist/chunk-5NJPH3QZ.js +61 -0
  27. package/dist/{chunk-GW6Z3WGY.js → chunk-5WXOEJ4G.js} +2 -2
  28. package/dist/chunk-5XEVXVTK.js +3 -0
  29. package/dist/{chunk-RR7SX44N.js → chunk-6OVNYYY4.js} +2 -2
  30. package/dist/{chunk-ZV3JV5G5.js → chunk-6SDEQTVY.js} +2 -2
  31. package/dist/{chunk-EF2R3WNQ.js → chunk-6URCE5QY.js} +2 -2
  32. package/dist/{chunk-UCD3H3UZ.js → chunk-6ZV5EDUT.js} +2 -2
  33. package/dist/{chunk-C6SBF2WH.js → chunk-77GHPR2R.js} +2 -2
  34. package/dist/{chunk-YVCIMIOC.js → chunk-7R64XY4Y.js} +2 -2
  35. package/dist/{chunk-VXYS3FZD.js → chunk-7Z7HCZ7J.js} +2 -2
  36. package/dist/{chunk-CO5R3UNA.js → chunk-A67HT5FR.js} +2 -2
  37. package/dist/{chunk-UDS562V4.js → chunk-A7XQT7MH.js} +2 -2
  38. package/dist/{chunk-RDBI2RXU.js → chunk-ACZDU5GK.js} +2 -2
  39. package/dist/{chunk-FETNQCFO.js → chunk-AM5SUGHF.js} +2 -2
  40. package/dist/{chunk-NNOKTMZT.js → chunk-B2E3HZ2A.js} +2 -2
  41. package/dist/{chunk-CVYSU6BX.js → chunk-BH5CE4LN.js} +2 -2
  42. package/dist/chunk-BLKYYQ7C.js +543 -0
  43. package/dist/{chunk-4WKDMDEW.js → chunk-BX2U3QQV.js} +2 -2
  44. package/dist/{chunk-ZKX2FRS6.js → chunk-CANBLFVQ.js} +2 -2
  45. package/dist/{chunk-SMRBZ6EC.js → chunk-CCRZLRWJ.js} +2 -2
  46. package/dist/chunk-CDWSLAPN.js +21 -0
  47. package/dist/chunk-CIVYHK7U.js +22 -0
  48. package/dist/{chunk-L57ZKWVG.js → chunk-CMXW7MFV.js} +2 -2
  49. package/dist/{chunk-T3DGWPXM.js → chunk-CSZOQ7YO.js} +2 -2
  50. package/dist/{chunk-ZZXSWSN6.js → chunk-CWMHWD56.js} +2 -2
  51. package/dist/{chunk-6NW7MU72.js → chunk-CZEIHYMP.js} +2 -2
  52. package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
  53. package/dist/{chunk-XWUOUWYI.js → chunk-DFPAZXLU.js} +2 -2
  54. package/dist/{chunk-MOVBWNIP.js → chunk-DKJXK3HA.js} +2 -2
  55. package/dist/{chunk-XMQ23E27.js → chunk-DLC6JDN7.js} +2 -2
  56. package/dist/chunk-DUKHVPU5.js +4 -0
  57. package/dist/{chunk-ID63777H.js → chunk-DVYG3JTA.js} +2 -2
  58. package/dist/{chunk-NE6IU5ZD.js → chunk-EFFMFK7C.js} +2 -2
  59. package/dist/{chunk-I2T2LLK2.js → chunk-EM5UHLAM.js} +2 -2
  60. package/dist/chunk-EN4AHLL3.js +3 -0
  61. package/dist/chunk-EXMVF3JR.js +3 -0
  62. package/dist/{chunk-SWHMHUKF.js → chunk-FEBLLMTL.js} +2 -2
  63. package/dist/chunk-FIXYHQ3W.js +3 -0
  64. package/dist/{chunk-RKEJ6VTF.js → chunk-FLLXYUOL.js} +2 -2
  65. package/dist/{chunk-KWVHSKHK.js → chunk-FPDL2TUB.js} +2 -2
  66. package/dist/chunk-FQA3KIFX.js +17 -0
  67. package/dist/chunk-FWY2PRIF.js +3 -0
  68. package/dist/chunk-FY5V4V4F.js +2 -0
  69. package/dist/chunk-G2XUZCF2.js +88 -0
  70. package/dist/{chunk-QHRNXP3C.js → chunk-GXVDTHFC.js} +2 -2
  71. package/dist/{chunk-6MUIJMVL.js → chunk-H3CKAL6P.js} +2 -2
  72. package/dist/chunk-H5QXP63L.js +2 -0
  73. package/dist/{chunk-VUIYB2V3.js → chunk-HBQGKMM3.js} +2 -2
  74. package/dist/{chunk-PYAB5SM6.js → chunk-HBXZAGY6.js} +2 -2
  75. package/dist/{chunk-NNO6A2PO.js → chunk-HCMQZPEO.js} +2 -2
  76. package/dist/{chunk-Q65CQ4XL.js → chunk-HHBBGWES.js} +2 -2
  77. package/dist/{chunk-GTXSJDCO.js → chunk-HIEXRDJF.js} +2 -2
  78. package/dist/{chunk-4FC325IF.js → chunk-HYKSLTAR.js} +2 -2
  79. package/dist/{chunk-XLQ3GLWZ.js → chunk-I2KP4AGR.js} +2 -2
  80. package/dist/chunk-I5FCDTK2.js +2 -0
  81. package/dist/{chunk-QKPLA6IC.js → chunk-I645ZF75.js} +2 -2
  82. package/dist/{chunk-FDGD5AB5.js → chunk-IBM3F2BJ.js} +2 -2
  83. package/dist/{chunk-Q72QSKXC.js → chunk-IEL6Q5W3.js} +38 -38
  84. package/dist/{chunk-NCZUNH3E.js → chunk-IGQQUENU.js} +12 -12
  85. package/dist/chunk-IGYAZPRX.js +4 -0
  86. package/dist/chunk-IOVPAZWP.js +3 -0
  87. package/dist/{chunk-OL6KJP3N.js → chunk-IVJJNVSX.js} +2 -2
  88. package/dist/{chunk-AKB7V7TV.js → chunk-IWAMYGPN.js} +2 -2
  89. package/dist/chunk-IYBIBMPF.js +90 -0
  90. package/dist/{chunk-IOP6FWIM.js → chunk-J24VICI5.js} +2 -2
  91. package/dist/{chunk-C7QOQX32.js → chunk-JN5LIBT3.js} +2 -2
  92. package/dist/{chunk-O6QTXQPJ.js → chunk-JOALNFY3.js} +2 -2
  93. package/dist/{chunk-GCHRX4YW.js → chunk-JUO3Z644.js} +2 -2
  94. package/dist/{chunk-BJ6SQAEN.js → chunk-JXHLB7TP.js} +2 -2
  95. package/dist/{chunk-IJ4HMYBE.js → chunk-JYX5UZSZ.js} +2 -2
  96. package/dist/chunk-K2O7SBAU.js +2 -0
  97. package/dist/{chunk-OLF4MA5W.js → chunk-K5G7SPAG.js} +2 -2
  98. package/dist/{chunk-YSNONTJ2.js → chunk-KDYQQJ6X.js} +2 -2
  99. package/dist/{chunk-7NVGT435.js → chunk-KM4QRWI5.js} +2 -2
  100. package/dist/{chunk-HKQUXIFO.js → chunk-KNV5VFDV.js} +2 -2
  101. package/dist/chunk-L3YSDLNB.js +2 -0
  102. package/dist/{chunk-EZNMUY67.js → chunk-LAGDJXFY.js} +2 -2
  103. package/dist/{chunk-ENCCHKM6.js → chunk-LY2NB5XR.js} +4 -4
  104. package/dist/chunk-M4EVGA5S.js +14 -0
  105. package/dist/chunk-M7LAIM77.js +127 -0
  106. package/dist/{chunk-BVAJLC5A.js → chunk-MRGTCMDK.js} +2 -2
  107. package/dist/{chunk-OZYRSMSH.js → chunk-MT5W4DUG.js} +2 -2
  108. package/dist/{chunk-VE5AVNMP.js → chunk-MTMF4N7F.js} +2 -2
  109. package/dist/chunk-N3Q3AWGW.js +545 -0
  110. package/dist/{chunk-TXXOEMZJ.js → chunk-NDGTJHQN.js} +2 -2
  111. package/dist/chunk-NIO346UL.js +2 -0
  112. package/dist/chunk-NJA4MMBD.js +2 -0
  113. package/dist/{chunk-7FND7D7N.js → chunk-NK76RSB6.js} +2 -2
  114. package/dist/{chunk-H3LGFZVK.js → chunk-NTRW52UR.js} +2 -2
  115. package/dist/{chunk-JOIRNPPY.js → chunk-OJFLPVBP.js} +2 -2
  116. package/dist/{chunk-KMITESMT.js → chunk-OMBRP7BB.js} +2 -2
  117. package/dist/{chunk-UP3BUZR5.js → chunk-OVKZM2XI.js} +2 -2
  118. package/dist/{chunk-MVB3DAEY.js → chunk-PARCKE3Q.js} +2 -2
  119. package/dist/{chunk-CAUCPUOF.js → chunk-PFPHS4NO.js} +2 -2
  120. package/dist/chunk-PHPQ24UG.js +22 -0
  121. package/dist/chunk-PLZXWZHY.js +77 -0
  122. package/dist/{chunk-34WBMAYK.js → chunk-PNVZIJ57.js} +2 -2
  123. package/dist/{chunk-SYDJMPES.js → chunk-QKVTWODE.js} +2 -2
  124. package/dist/{chunk-FW53T7EB.js → chunk-QLTFXVUI.js} +2 -2
  125. package/dist/{chunk-PBI2LFKH.js → chunk-QMGWSEPL.js} +2 -2
  126. package/dist/{chunk-CQP3THUZ.js → chunk-QVHZB75Z.js} +2 -2
  127. package/dist/{chunk-6BQ3DSPK.js → chunk-QVWDQTMG.js} +2 -2
  128. package/dist/{chunk-ST7V3SKN.js → chunk-RCPZOPV6.js} +2 -2
  129. package/dist/chunk-RJWAB4VR.js +345 -0
  130. package/dist/chunk-RRPK327J.js +20 -0
  131. package/dist/chunk-RVYLJDXC.js +21 -0
  132. package/dist/chunk-RWKEXCHU.js +3 -0
  133. package/dist/{chunk-L4NRUAGJ.js → chunk-S5SKXCND.js} +2 -2
  134. package/dist/{chunk-RBAS5ZHI.js → chunk-S64NCE2Z.js} +2 -2
  135. package/dist/{chunk-WMPRTGH2.js → chunk-SF34QLK2.js} +2 -2
  136. package/dist/{chunk-ANFVSJWQ.js → chunk-SJZQ2PTZ.js} +2 -2
  137. package/dist/{chunk-4XTAUQFD.js → chunk-SRY26ITJ.js} +2 -2
  138. package/dist/chunk-SV2LEFVM.js +2 -0
  139. package/dist/{chunk-7XAN6GKB.js → chunk-T3YFIJ5P.js} +2 -2
  140. package/dist/chunk-T55YPJGB.js +3 -0
  141. package/dist/chunk-TAJ6UGCO.js +21 -0
  142. package/dist/{chunk-PIOMTC27.js → chunk-TUTSO7UZ.js} +2 -2
  143. package/dist/{chunk-FQKZWM4L.js → chunk-U24M5RQM.js} +5 -5
  144. package/dist/{chunk-XME3HPXZ.js → chunk-U2XX3BT4.js} +2 -2
  145. package/dist/{chunk-SZD2KF7Q.js → chunk-UWB5WMC2.js} +2 -2
  146. package/dist/{chunk-6CS3UQTN.js → chunk-VCL7FK3E.js} +2 -2
  147. package/dist/{chunk-N3IQCBCF.js → chunk-VCWAJPXQ.js} +2 -2
  148. package/dist/{chunk-LZYFLFEH.js → chunk-VG55NFXF.js} +2 -2
  149. package/dist/{chunk-PTAWHLVJ.js → chunk-VLTUX4IF.js} +2 -2
  150. package/dist/{chunk-JEJLSICM.js → chunk-VVCBMH5O.js} +2 -2
  151. package/dist/{chunk-JSOYNVWH.js → chunk-VYZQZ4ZN.js} +2 -2
  152. package/dist/chunk-W3FK73MD.js +8 -0
  153. package/dist/{chunk-UNBY47BC.js → chunk-W6C6QTXJ.js} +2 -2
  154. package/dist/chunk-WH5SYOMD.js +2 -0
  155. package/dist/chunk-WJOQC4P7.js +7 -0
  156. package/dist/chunk-WO47BIPY.js +3 -0
  157. package/dist/chunk-WOOTEWQT.js +239 -0
  158. package/dist/{chunk-UBGWN7I4.js → chunk-X5I2BQGX.js} +2 -2
  159. package/dist/{chunk-PX4RYAAK.js → chunk-XNUWRTYM.js} +2 -2
  160. package/dist/{chunk-ICFDQHAM.js → chunk-XUJM6474.js} +2 -2
  161. package/dist/chunk-XYLV727H.js +21 -0
  162. package/dist/{chunk-TRRC4ZJ7.js → chunk-YFQPWKHR.js} +2 -2
  163. package/dist/{chunk-NEDP5RFQ.js → chunk-YIOQJ45A.js} +2 -2
  164. package/dist/{chunk-Y6KHROC3.js → chunk-YXJ4IAHH.js} +2 -2
  165. package/dist/chunk-YYFV32WR.js +3 -0
  166. package/dist/{chunk-BH5F2Q4O.js → chunk-ZB3V5QM7.js} +2 -2
  167. package/dist/chunk-ZJZQ7Q2Q.js +3 -0
  168. package/dist/{chunk-EMNIHCRB.js → chunk-ZNQCR656.js} +2 -2
  169. package/dist/{chunk-TIIC3ZE7.js → chunk-ZOEDRCR4.js} +2 -2
  170. package/dist/cli-context-TSADTXLB.js +2 -0
  171. package/dist/cli-context-XEPPF4RX.js +3 -0
  172. package/dist/cli-program-KJGQEM72.js +7 -0
  173. package/dist/cli.js +1 -1
  174. package/dist/{code-DlqpBDd0.d.ts → code-CDe-mIjx.d.ts} +1 -1
  175. package/dist/code-viewer-YGDON6SY.js +12 -0
  176. package/dist/code-viewer-ZCTHXQ5C.js +11 -0
  177. package/dist/command-descriptors-5VAB2MZX.js +335 -0
  178. package/dist/command-descriptors-EAHKIRAG.js +337 -0
  179. package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
  180. package/dist/{db-D7sauVFH.d.ts → db-DmRNdCtm.d.ts} +1 -1
  181. package/dist/direct-navigation-B3SGOOBW.js +2 -0
  182. package/dist/direct-navigation-ZL362KXF.js +3 -0
  183. package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-Bs54NWws.d.ts} +1 -1
  184. package/dist/{health-DJaZXg8I.d.ts → health-BnzbSLCE.d.ts} +1 -1
  185. package/dist/index.d.ts +2 -2
  186. package/dist/index.js +1 -1
  187. package/dist/invocation-command-descriptors-CSUGUHTT.js +2 -0
  188. package/dist/invocation-command-descriptors-PPVZOIE5.js +3 -0
  189. package/dist/output-continuation-command-FTVVBVSN.js +2 -0
  190. package/dist/output-continuation-command-ITPRC3YV.js +3 -0
  191. package/dist/project-reindex-7HZSLLLY.js +3 -0
  192. package/dist/project-reindex-NGM3DYBN.js +2 -0
  193. package/dist/queries/affected.d.ts +2 -2
  194. package/dist/queries/affected.js +1 -1
  195. package/dist/queries/anchors.d.ts +2 -2
  196. package/dist/queries/anchors.js +1 -1
  197. package/dist/queries/architecture.d.ts +2 -2
  198. package/dist/queries/architecture.js +1 -1
  199. package/dist/queries/bottlenecks.d.ts +2 -2
  200. package/dist/queries/bottlenecks.js +1 -1
  201. package/dist/queries/by-kind.d.ts +2 -2
  202. package/dist/queries/by-kind.js +1 -1
  203. package/dist/queries/call-graph.d.ts +2 -2
  204. package/dist/queries/call-graph.js +1 -1
  205. package/dist/queries/change-surface.d.ts +2 -2
  206. package/dist/queries/change-surface.js +1 -1
  207. package/dist/queries/cleanup-plan.d.ts +2 -2
  208. package/dist/queries/cleanup-plan.js +1 -1
  209. package/dist/queries/co-change.d.ts +2 -2
  210. package/dist/queries/co-change.js +1 -1
  211. package/dist/queries/code.d.ts +3 -3
  212. package/dist/queries/code.js +1 -1
  213. package/dist/queries/complexity-hotspots.d.ts +2 -2
  214. package/dist/queries/complexity-hotspots.js +1 -1
  215. package/dist/queries/complexity.d.ts +2 -2
  216. package/dist/queries/complexity.js +1 -1
  217. package/dist/queries/context.d.ts +2 -2
  218. package/dist/queries/context.js +1 -1
  219. package/dist/queries/convergence.d.ts +2 -2
  220. package/dist/queries/convergence.js +1 -1
  221. package/dist/queries/coupling.d.ts +2 -2
  222. package/dist/queries/coupling.js +1 -1
  223. package/dist/queries/cycles.d.ts +2 -2
  224. package/dist/queries/cycles.js +1 -1
  225. package/dist/queries/dataflow.d.ts +2 -2
  226. package/dist/queries/dataflow.js +1 -1
  227. package/dist/queries/dead.d.ts +2 -2
  228. package/dist/queries/dead.js +1 -1
  229. package/dist/queries/decorative-checkers.d.ts +2 -2
  230. package/dist/queries/decorative-checkers.js +1 -1
  231. package/dist/queries/deep-chains.d.ts +2 -2
  232. package/dist/queries/deep-chains.js +1 -1
  233. package/dist/queries/dependence-slice.d.ts +3 -3
  234. package/dist/queries/dependence-slice.js +1 -1
  235. package/dist/queries/dependency-depth.d.ts +2 -2
  236. package/dist/queries/dependency-depth.js +1 -1
  237. package/dist/queries/deps.d.ts +2 -2
  238. package/dist/queries/deps.js +1 -1
  239. package/dist/queries/diff-impact.d.ts +2 -2
  240. package/dist/queries/diff-impact.js +1 -1
  241. package/dist/queries/doc-drift.d.ts +2 -2
  242. package/dist/queries/doc-drift.js +1 -1
  243. package/dist/queries/drift.d.ts +2 -2
  244. package/dist/queries/drift.js +1 -1
  245. package/dist/queries/duplicate-bodies.d.ts +2 -2
  246. package/dist/queries/duplicate-bodies.js +1 -1
  247. package/dist/queries/entry-map.d.ts +2 -2
  248. package/dist/queries/entry-map.js +1 -1
  249. package/dist/queries/evidence.d.ts +3 -3
  250. package/dist/queries/evidence.js +1 -1
  251. package/dist/queries/extract-candidates.d.ts +2 -2
  252. package/dist/queries/extract-candidates.js +1 -1
  253. package/dist/queries/fan.d.ts +2 -2
  254. package/dist/queries/fan.js +1 -1
  255. package/dist/queries/files.d.ts +2 -2
  256. package/dist/queries/files.js +1 -1
  257. package/dist/queries/health.d.ts +3 -3
  258. package/dist/queries/health.js +1 -1
  259. package/dist/queries/hierarchy.d.ts +2 -2
  260. package/dist/queries/hierarchy.js +1 -1
  261. package/dist/queries/hotspots.d.ts +2 -2
  262. package/dist/queries/hotspots.js +1 -1
  263. package/dist/queries/imports.d.ts +2 -2
  264. package/dist/queries/imports.js +1 -1
  265. package/dist/queries/incomplete-migration.d.ts +2 -2
  266. package/dist/queries/incomplete-migration.js +1 -1
  267. package/dist/queries/index.d.ts +5 -5
  268. package/dist/queries/index.js +1 -1
  269. package/dist/queries/isolated.d.ts +2 -2
  270. package/dist/queries/isolated.js +1 -1
  271. package/dist/queries/locality-candidates.d.ts +2 -2
  272. package/dist/queries/locality-candidates.js +1 -1
  273. package/dist/queries/members.d.ts +2 -2
  274. package/dist/queries/members.js +1 -1
  275. package/dist/queries/methods.d.ts +2 -2
  276. package/dist/queries/methods.js +1 -1
  277. package/dist/queries/not-implemented.d.ts +2 -2
  278. package/dist/queries/not-implemented.js +1 -1
  279. package/dist/queries/outline.d.ts +2 -2
  280. package/dist/queries/outline.js +1 -1
  281. package/dist/queries/passthrough-candidates.d.ts +2 -2
  282. package/dist/queries/passthrough-candidates.js +1 -1
  283. package/dist/queries/plan-context.d.ts +2 -2
  284. package/dist/queries/plan-context.js +1 -1
  285. package/dist/queries/react-component-duplicates.d.ts +2 -2
  286. package/dist/queries/react-component-duplicates.js +1 -1
  287. package/dist/queries/react-hook-candidates.d.ts +2 -2
  288. package/dist/queries/react-hook-candidates.js +1 -1
  289. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  290. package/dist/queries/react-large-component-pressure.js +1 -1
  291. package/dist/queries/recent-duplicates.d.ts +2 -2
  292. package/dist/queries/recent-duplicates.js +1 -1
  293. package/dist/queries/redundant-reexports.d.ts +2 -2
  294. package/dist/queries/redundant-reexports.js +1 -1
  295. package/dist/queries/reference-neighborhood.d.ts +2 -2
  296. package/dist/queries/reference-neighborhood.js +1 -1
  297. package/dist/queries/reference-reachability.d.ts +2 -2
  298. package/dist/queries/reference-reachability.js +1 -1
  299. package/dist/queries/refs.d.ts +2 -2
  300. package/dist/queries/refs.js +1 -1
  301. package/dist/queries/self-audit.d.ts +2 -2
  302. package/dist/queries/self-audit.js +1 -1
  303. package/dist/queries/similar-chains.d.ts +2 -2
  304. package/dist/queries/similar-chains.js +1 -1
  305. package/dist/queries/similar-files.d.ts +2 -2
  306. package/dist/queries/similar-files.js +1 -1
  307. package/dist/queries/similar-signatures.d.ts +2 -2
  308. package/dist/queries/similar-signatures.js +1 -1
  309. package/dist/queries/similar.d.ts +2 -2
  310. package/dist/queries/similar.js +1 -1
  311. package/dist/queries/slice.d.ts +2 -2
  312. package/dist/queries/slice.js +1 -1
  313. package/dist/queries/source-inspection.d.ts +4 -4
  314. package/dist/queries/source-inspection.js +1 -1
  315. package/dist/queries/source-search.d.ts +2 -2
  316. package/dist/queries/source-search.js +1 -1
  317. package/dist/queries/stale-abstractions.d.ts +2 -2
  318. package/dist/queries/stale-abstractions.js +1 -1
  319. package/dist/queries/stats.d.ts +2 -2
  320. package/dist/queries/surface.d.ts +2 -2
  321. package/dist/queries/surface.js +1 -1
  322. package/dist/queries/symbols.d.ts +2 -2
  323. package/dist/queries/symbols.js +1 -1
  324. package/dist/queries/system-map.d.ts +2 -2
  325. package/dist/queries/system-map.js +1 -1
  326. package/dist/queries/system.d.ts +2 -2
  327. package/dist/queries/system.js +1 -1
  328. package/dist/queries/test-quality.d.ts +2 -2
  329. package/dist/queries/test-quality.js +1 -1
  330. package/dist/queries/trace.d.ts +2 -2
  331. package/dist/queries/trace.js +1 -1
  332. package/dist/queries/twin-ab.d.ts +2 -2
  333. package/dist/queries/twin-ab.js +1 -1
  334. package/dist/queries/twin-drift.d.ts +2 -2
  335. package/dist/queries/twin-drift.js +1 -1
  336. package/dist/queries/unused-imports.d.ts +2 -2
  337. package/dist/queries/unused-imports.js +1 -1
  338. package/dist/queries/unused-params.d.ts +2 -2
  339. package/dist/queries/unused-params.js +1 -1
  340. package/dist/queries/value-flow.d.ts +3 -3
  341. package/dist/queries/value-flow.js +1 -1
  342. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  343. package/dist/queries/vue-component-duplicates.js +1 -1
  344. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  345. package/dist/queries/vue-composable-candidates.js +1 -1
  346. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  347. package/dist/queries/vue-large-view-pressure.js +1 -1
  348. package/dist/queries/wrapper-candidates.d.ts +2 -2
  349. package/dist/queries/wrapper-candidates.js +1 -1
  350. package/dist/reindex-worker.js +1 -1
  351. package/dist/reindex.d.ts +3 -3
  352. package/dist/reindex.js +31 -31
  353. package/dist/runtime.d.ts +24 -4
  354. package/dist/runtime.js +3 -3
  355. package/dist/rust-semantic-session-server.js +1 -1
  356. package/dist/rust-semantic-session-worker.js +1 -1
  357. package/dist/rust-semantic-worker.js +1 -1
  358. package/dist/{scip-cli-B7N3haxa.d.ts → scip-cli-BRFKkHQn.d.ts} +1 -1
  359. package/dist/sentinel-ensure-command-KYYULCFU.js +2 -0
  360. package/dist/sentinel-ensure-command-RIZA3RY7.js +3 -0
  361. package/dist/sentinel-hook.js +39 -0
  362. package/dist/sentinel-worker.js +16 -0
  363. package/dist/typescript-mailbox-worker.js +1 -1
  364. package/dist/watch-server.js +6 -6
  365. package/docs/COMMAND_REFERENCE.md +5 -3
  366. package/docs/schemas/project-config.schema.json +159 -0
  367. package/package.json +9 -5
  368. package/skills/codebaseiq/SKILL.md +1 -1
  369. package/skills/concrete-plan/SKILL.md +1 -1
  370. package/ui/view/api.js +450 -0
  371. package/ui/view/app.js +394 -0
  372. package/ui/view/builder.js +323 -0
  373. package/ui/view/file-panel.js +170 -0
  374. package/ui/view/focus.js +379 -0
  375. package/ui/view/index.html +54 -0
  376. package/ui/view/map.js +424 -0
  377. package/ui/view/styles.css +1125 -0
  378. package/dist/chunk-2X7V4HS4.js +0 -88
  379. package/dist/chunk-3IER7Q6H.js +0 -12
  380. package/dist/chunk-3JSXXYTZ.js +0 -345
  381. package/dist/chunk-476NR5B7.js +0 -2
  382. package/dist/chunk-5VKBFZZU.js +0 -3
  383. package/dist/chunk-ADTBPVUZ.js +0 -21
  384. package/dist/chunk-BFFZDZQV.js +0 -2
  385. package/dist/chunk-BMYOV5GP.js +0 -77
  386. package/dist/chunk-C74PPYLA.js +0 -3
  387. package/dist/chunk-CWONGW6P.js +0 -3
  388. package/dist/chunk-DDZ7VHWV.js +0 -20
  389. package/dist/chunk-DR2LURYU.js +0 -3
  390. package/dist/chunk-ECQBG7PW.js +0 -564
  391. package/dist/chunk-FM5BPL4V.js +0 -60
  392. package/dist/chunk-G6XFR4ZL.js +0 -4
  393. package/dist/chunk-GTIYTDRE.js +0 -562
  394. package/dist/chunk-HOA5YGOH.js +0 -3
  395. package/dist/chunk-KUW32IRO.js +0 -2
  396. package/dist/chunk-LTA3BRZX.js +0 -2
  397. package/dist/chunk-NAUD7LCA.js +0 -2
  398. package/dist/chunk-OGTFJ3XD.js +0 -2
  399. package/dist/chunk-Q5ELPRKQ.js +0 -2
  400. package/dist/chunk-QCN62RTF.js +0 -3
  401. package/dist/chunk-QW7EP6WI.js +0 -21
  402. package/dist/chunk-RU65DDUP.js +0 -215
  403. package/dist/chunk-SELM5MER.js +0 -2
  404. package/dist/chunk-SNNWPCN7.js +0 -4
  405. package/dist/chunk-TFZB6XTM.js +0 -239
  406. package/dist/chunk-UXM43C7T.js +0 -3
  407. package/dist/chunk-VFY6Y2H6.js +0 -61
  408. package/dist/chunk-WE5RZHZ7.js +0 -5
  409. package/dist/chunk-Z54RD7VL.js +0 -3
  410. package/dist/cli-context-3SNLDYBM.js +0 -3
  411. package/dist/cli-context-T3B7W6GG.js +0 -2
  412. package/dist/cli-program-YNOXO72B.js +0 -7
  413. package/dist/command-descriptors-6AOUKWW7.js +0 -346
  414. package/dist/command-descriptors-ZFKJSRUP.js +0 -344
  415. package/dist/direct-navigation-DP4LVMRX.js +0 -3
  416. package/dist/direct-navigation-FLUS3BT6.js +0 -2
  417. package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
  418. package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
  419. package/dist/output-continuation-command-2V2SL4TD.js +0 -2
  420. package/dist/output-continuation-command-65J5IP3O.js +0 -3
  421. package/dist/project-reindex-5JOKXAXT.js +0 -2
  422. package/dist/project-reindex-UQBIKO4M.js +0 -3
@@ -1,2 +1,2 @@
1
- import{c as y}from"./chunk-7FND7D7N.js";import{b as h,e as b}from"./chunk-UZGZB3VB.js";import{d as u,e as i,g as c}from"./chunk-FETNQCFO.js";import{f as m}from"./chunk-O6QTXQPJ.js";import{z as l}from"./chunk-ADTBPVUZ.js";import{basename as f}from"path";function g(t,o){let n=o.className,e=h(t,n);return e.match?e.total>1?{kind:"ambiguous",query:n,total:e.total,candidates:[p(e.match),...e.candidates]}:{kind:"matched",query:n,owner:L(e.match),methods:M(t,e.match)}:{kind:"missing",query:n,suggestions:b(t,n,5)}}function j(t,o){let n=g(t,{className:o});if(n.kind==="missing")throw new Error(`No class definition matched '${o}'.`);if(n.kind==="ambiguous"){let e=n.candidates.map(s=>`${s.relativePath}:${s.startLine+1}`).join(", ");throw new Error(`Class '${o}' is ambiguous across ${n.total} definitions (${e}). Qualify it with a path or exact SCIP symbol identity.`)}return n.methods}function M(t,o){let n=i(o.symbol),s=new y(t).definitionsForFile(o.relativePath).filter(r=>c(r.symbol)),a=s.filter(r=>r.parentTypeName===n||r.symbol.includes(n)),d=(a.length>0?a:S(f(o.relativePath))===n?s.filter(r=>r.symbol.includes("<invalid-global-code>")):[]).map(r=>({startLine:r.startLine,endLine:r.endLine,name:i(r.symbol)}));return l(o.relativePath)!=="clojure"?d:R(d,w(t,o))}function p(t){return{symbol:t.symbol,shortName:u(t.symbol),relativePath:t.relativePath,startLine:t.startLine}}function L(t){return{...p(t),endLine:t.endLine}}function S(t){return t.replace(/\.[^.]+$/,"")}function w(t,o){let n=i(o.symbol);return n?(m(t,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===n).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function R(t,o){let n=new Map;for(let e of[...t,...o])n.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...n.values()].sort((e,s)=>e.startLine-s.startLine||e.endLine-s.endLine)}export{g as a,j as b};
2
- //# sourceMappingURL=chunk-XMQ23E27.js.map
1
+ import{c as y}from"./chunk-NK76RSB6.js";import{b as h,e as b}from"./chunk-3XFJUWJE.js";import{d as u,e as i,g as c}from"./chunk-AM5SUGHF.js";import{f as m}from"./chunk-JOALNFY3.js";import{z as l}from"./chunk-RVYLJDXC.js";import{basename as f}from"path";function g(t,o){let n=o.className,e=h(t,n);return e.match?e.total>1?{kind:"ambiguous",query:n,total:e.total,candidates:[p(e.match),...e.candidates]}:{kind:"matched",query:n,owner:L(e.match),methods:M(t,e.match)}:{kind:"missing",query:n,suggestions:b(t,n,5)}}function j(t,o){let n=g(t,{className:o});if(n.kind==="missing")throw new Error(`No class definition matched '${o}'.`);if(n.kind==="ambiguous"){let e=n.candidates.map(s=>`${s.relativePath}:${s.startLine+1}`).join(", ");throw new Error(`Class '${o}' is ambiguous across ${n.total} definitions (${e}). Qualify it with a path or exact SCIP symbol identity.`)}return n.methods}function M(t,o){let n=i(o.symbol),s=new y(t).definitionsForFile(o.relativePath).filter(r=>c(r.symbol)),a=s.filter(r=>r.parentTypeName===n||r.symbol.includes(n)),d=(a.length>0?a:S(f(o.relativePath))===n?s.filter(r=>r.symbol.includes("<invalid-global-code>")):[]).map(r=>({startLine:r.startLine,endLine:r.endLine,name:i(r.symbol)}));return l(o.relativePath)!=="clojure"?d:R(d,w(t,o))}function p(t){return{symbol:t.symbol,shortName:u(t.symbol),relativePath:t.relativePath,startLine:t.startLine}}function L(t){return{...p(t),endLine:t.endLine}}function S(t){return t.replace(/\.[^.]+$/,"")}function w(t,o){let n=i(o.symbol);return n?(m(t,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===n).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function R(t,o){let n=new Map;for(let e of[...t,...o])n.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...n.values()].sort((e,s)=>e.startLine-s.startLine||e.endLine-s.endLine)}export{g as a,j as b};
2
+ //# sourceMappingURL=chunk-DLC6JDN7.js.map
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{spawnSync as F}from"child_process";import{createHash as N}from"crypto";import{existsSync as W,lstatSync as M,realpathSync as j}from"fs";import{dirname as $,isAbsolute as z,join as U,resolve as g}from"path";function K(){return{...process.env,GIT_OPTIONAL_LOCKS:"0",LC_ALL:"C"}}var f={run(t,e){let r=I(t,e);return r.kind==="success"?r.output:void 0},runResult:I},J=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],y=/^[0-9a-f]{40,64}$/;function Ce(t,e,r=f){if(!e||e.startsWith("-")||/[\0\r\n]/.test(e))throw new Error(`Invalid Git revision ${JSON.stringify(e)}.`);let n=r.runResult(t,["rev-parse","--verify","--end-of-options",`${e}^{commit}`]);if(n.kind!=="success"||!y.test(n.output))throw new Error(`Git revision ${JSON.stringify(e)} does not resolve to exactly one commit.`);return n.output}function Se(t,e=f){let r=e.runResult(t,J);if(r.kind==="success"){let n=Y(r.output);if(n)return H(n,e)}return X(t,e)}function Y(t){let e=t.split(`
3
+ `).map(c=>c.trim());if(e.length!==5)return;let[r,n,i,o,s]=e;if(!r||!n||!i||!o||!s||!y.test(o)||!y.test(s))return;let a=u(r);return{root:a,gitDir:u(p(a,n)),commonDir:u(p(a,i)),headCommit:o,treeOid:s}}function H(t,e){let r=e.run(t.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...T(t.root,t.gitDir),commonDir:t.commonDir,repositoryId:x("repository",t.commonDir),headCommit:t.headCommit,treeOid:t.treeOid,clean:r.length===0}}function X(t,e){let r=q(t,e);if(r.kind!=="worktree")return;let n=r.identity,i=n.projectRoot,o=e.run(i,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=u(p(i,o)),a=h(e.run(i,["rev-parse","--verify","HEAD"])),c=h(e.run(i,["rev-parse","--verify","HEAD^{tree}"])),l=e.run(i,["status","--porcelain=v1","-z","--untracked-files=all"]);if(l!==void 0)return{...n,commonDir:s,repositoryId:x("repository",s),headCommit:a,treeOid:c,clean:l.length===0}}function q(t,e=f){let r=e.runResult(t,["rev-parse","--show-toplevel"]);if(r.kind==="not-repository")return{kind:"non-git"};if(r.kind==="error")return r;let n=r.output.trim();if(!n)return{kind:"error",message:"Git returned an empty worktree root."};let i=u(n),o=e.run(i,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=u(p(i,o));return{kind:"worktree",identity:T(i,s)}}function T(t,e){return{projectRoot:t,gitDir:e,worktreeId:x("worktree",`${t}\0${e}`)}}function ke(t,e=f){let r=e.run(t,["worktree","list","--porcelain","-z"]);return r===void 0?[]:V(r)}function V(t){let e=[],r;for(let n of t.split("\0")){if(n===""){r&&e.push(r),r=void 0;continue}let i=n.indexOf(" "),o=i<0?n:n.slice(0,i),s=i<0?"":n.slice(i+1);if(o==="worktree"){r&&e.push(r),r={path:u(s),detached:!1,bare:!1,prunable:!1,locked:!1};continue}r&&(o==="HEAD"?r.head=s:o==="branch"?r.branch=s:o==="detached"?r.detached=!0:o==="bare"?r.bare=!0:o==="prunable"?r.prunable=!0:o==="locked"&&(r.locked=!0))}return r&&e.push(r),e}function Re(t,e,r=f){return h(r.run(t,e))}function p(t,e){return z(e)?e:g(t,e)}function u(t){try{return j(t)}catch{return g(t)}}function x(t,e){return N("sha256").update(`${t}\0${e}`).digest("hex").slice(0,24)}function h(t){return t?.trim()||void 0}function I(t,e){let r=F("git",["-C",t,...e],{encoding:"utf-8",env:K(),maxBuffer:52428800,stdio:["ignore","pipe","pipe"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"});if(r.status===0)return{kind:"success",output:r.stdout.trimEnd()};let i=(typeof r.stderr=="string"?r.stderr.trim():"")||r.error?.message||`git exited with status ${r.status??"unknown"}`,o=r.error?.code;return(/not a git repository/i.test(i)||o==="ENOENT"&&W(g(t)))&&!Q(t)?{kind:"not-repository"}:{kind:"error",message:i}}function Q(t){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let e=g(t);for(;;){try{return M(U(e,".git")),!0}catch(n){let i=n.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let r=$(e);if(r===e)return!1;e=r}}function Ie(t){try{return process.kill(t,0),!0}catch(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EPERM"}}import{closeSync as b,fstatSync as m,openSync as C,readFileSync as Z,readSync as E}from"fs";import{createHash as ee}from"crypto";var v=8*1024*1024,B=64*1024*1024,te=512*1024*1024,re=256*1024*1024,d=class extends Error{constructor(r,n,i,o,s){let a=i==="too-large"?`is ${o} bytes; the safety limit is ${s} bytes`:i==="not-regular"?"is not a regular file":"changed while it was being read";super(`${r} ${JSON.stringify(n)} ${a}`);this.inputKind=r;this.inputPath=n;this.reason=i;this.observedBytes=o;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="CODEBASEIQ_BOUNDED_FILE_READ"};function w(t,e){P(e.maxBytes);let r=String(t),n=C(t,"r");try{let i=m(n);D(i,e,r);let o=Z(n),s=m(n);if(s.dev!==i.dev||s.ino!==i.ino||s.size!==i.size||o.byteLength!==i.size)throw new d(e.inputKind,r,"changed-during-read",s.size,e.maxBytes);return o}finally{b(n)}}function S(t,e,r="utf8"){return w(t,e).toString(r)}function ne(t,e){return S(t,{maxBytes:v,inputKind:e})}function ie(t,e){return S(t,{maxBytes:B,inputKind:e})}function k(t,e){P(e.maxBytes);let r=[],n=Buffer.allocUnsafe(64*1024),i=0;for(;;){let o=E(t,n,0,n.length,null);if(o===0)break;if(i+=o,!Number.isSafeInteger(i)||i>e.maxBytes)throw new d(e.inputKind,`file descriptor ${t}`,"too-large",i,e.maxBytes);r.push(Buffer.from(n.subarray(0,o)))}return Buffer.concat(r,i)}function oe(t,e,r="utf8"){return k(t,e).toString(r)}function A(t,e){let r=C(t,"r");try{return k(r,e)}finally{b(r)}}function R(t,e,r="utf8"){return A(t,e).toString(r)}function O(t,e,r){P(e.maxBytes);let n=String(t),i=C(t,"r");try{let o=m(i);D(o,e,n);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,o.size))),a=0;for(;a<o.size;){let l=E(i,s,0,Math.min(s.length,o.size-a),a);if(l===0)break;r(s.subarray(0,l)),a+=l}let c=m(i);if(c.dev!==o.dev||c.ino!==o.ino||c.size!==o.size||a!==o.size)throw new d(e.inputKind,n,"changed-during-read",c.size,e.maxBytes);return a}finally{b(i)}}function se(t,e){let r=ee("sha256");return O(t,e,n=>r.update(n)),r.digest("hex")}function D(t,e,r){if(!t.isFile())throw new d(e.inputKind,r,"not-regular",Number(t.size),e.maxBytes);if(t.size>e.maxBytes)throw new d(e.inputKind,r,"too-large",Number(t.size),e.maxBytes)}function P(t){if(!Number.isSafeInteger(t)||t<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${t}`)}var ae=new Set(["aix","android","darwin","freebsd","haiku","linux","openbsd","sunos","win32","cygwin","netbsd"]);function ce(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;return e.version!==1||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0||typeof e.platform!="string"||!ae.has(e.platform)||typeof e.startToken!="string"||e.startToken.trim()===""?null:{version:1,pid:e.pid,platform:e.platform,startToken:e.startToken}}function de(t,e){return t.version===e.version&&t.pid===e.pid&&t.platform===e.platform&&t.startToken===e.startToken}import{execFileSync as ue}from"child_process";import{platform as le}from"os";var L=new WeakMap,fe=1e3,G=16*1024;function Fe(t,e=me){if(!Number.isSafeInteger(t)||t<=0)return null;if(t===process.pid){let r=L.get(e);if(r)return r}try{let r=pe(t,e);if(!r)return null;let n={version:1,pid:t,platform:e.platform,startToken:r};return t===process.pid&&L.set(e,n),n}catch{return null}}function pe(t,e){if(e.platform==="linux"||e.platform==="android")return ge(e.readFile(`/proc/${t}/stat`));if(e.platform==="win32"){let r=`([DateTimeOffset](Get-Process -Id ${t} -ErrorAction Stop).StartTime).ToUnixTimeMilliseconds()`;return _(e.run("powershell.exe",["-NoProfile","-NonInteractive","-Command",r]))}return e.platform==="darwin"||e.platform==="freebsd"||e.platform==="openbsd"||e.platform==="netbsd"?_(e.run("ps",["-p",String(t),"-o","lstart="])):null}function ge(t){let e=t.lastIndexOf(")");if(e<0)return null;let n=t.slice(e+1).trim().split(/\s+/)[19];return n&&/^\d+$/.test(n)?n:null}function _(t){let e=t.trim();return e===""?null:e}var me={platform:le(),readFile(t){return R(t,{maxBytes:G,inputKind:"process identity pseudo-file"})},run(t,e){return ue(t,[...e],{encoding:"utf8",timeout:fe,maxBuffer:G,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0})}};var Me=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"],je=["entry-surface","generated-code","compatibility-shim","reflection-or-registration","test-fixture","intentional-twin","historical-coupling-ended","detector-counterexample"];function ze(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ue(t){return typeof t=="string"&&Number.isFinite(Date.parse(t))}function Ke(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>=0}function Je(t){return typeof t=="string"&&t.length>0&&t.length<=256&&!/[\0\r\n]/u.test(t)}function Ye(t){return typeof t=="number"&&Number.isFinite(t)&&t>=0}export{K as a,f as b,Ce as c,Se as d,q as e,ke as f,Re as g,p as h,u as i,Ie as j,v as k,B as l,te as m,re as n,d as o,w as p,S as q,ne as r,ie as s,oe as t,O as u,se as v,ce as w,de as x,Fe as y,Me as z,je as A,ze as B,Ue as C,Ke as D,Je as E,Ye as F};
4
+ //# sourceMappingURL=chunk-DUKHVPU5.js.map
@@ -1,4 +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(`
1
+ import{b as y}from"./chunk-VLTUX4IF.js";import{a as v}from"./chunk-OJFLPVBP.js";import{p as S}from"./chunk-BH5CE4LN.js";import{a as b}from"./chunk-3XFJUWJE.js";import{d as u,e as f,h as m,p,q as g}from"./chunk-AM5SUGHF.js";import{w as d}from"./chunk-PLZXWZHY.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
2
  `).slice(i,n+1).join(`
3
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
4
+ //# sourceMappingURL=chunk-DVYG3JTA.js.map
@@ -1,5 +1,5 @@
1
- import{a as q}from"./chunk-QOKYJ33H.js";import{a as _}from"./chunk-4WKDMDEW.js";import{a as G}from"./chunk-QDCCHMVZ.js";import{j as F,p as O,q as L,r as z,t as $,u as T}from"./chunk-BMYOV5GP.js";import{d as X,f as U,h as S}from"./chunk-CWONGW6P.js";import{a as H,d as K}from"./chunk-3LCDIREB.js";function I(t,n){let e=et(t,n)??it(t,n)??rt(t,n)??ot(t,n);return st(t,e,n)}function et(t,n){let e=-1,i=null;for(let r=0;r<=n;r+=1){let o=N(t[r]??"");o&&(i===null?(i=o,e=r):o===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let r=n+1;r<t.length;r+=1)if(N(t[r]??"")===i)return{start:e,end:r+1};return{start:e,end:t.length}}function N(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function it(t,n){if(!w(t[n]??""))return null;let e=n;for(;e>0&&w(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&w(t[i]??"");)i+=1;return{start:e,end:i}}function w(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function rt(t,n){let e=n;for(;e>=0;){let o=t[e]??"";if(E(o)!==null)break;if(B(o)!==null)return null;e-=1}if(e<0)return null;let i=E(t[e]??"");if(i===null)return null;let r=e+1;for(;r<t.length;){let o=t[r]??"",s=E(o);if(s!==null){if(s<=i)break;r+=1;continue}if(B(o)!==null)break;r+=1}return{start:e,end:r}}function E(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function ot(t,n){let e=t[n]??"";if(W(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&V(t[i-1]??"");)i-=1;let r=n+1;for(;r<t.length&&V(t[r]??"");)r+=1;return{start:i,end:r}}function V(t){return B(t)===null}function B(t){return t.trim().length===0?"blank":W(t)?"heading":N(t)?"fence":w(t)?"table":E(t)!==null?"list":null}function W(t){return/^#{1,6}\s+/.test(t.trim())}function st(t,n,e){let{start:i,end:r}=n;if(r-i>40){let s=Math.floor(20);i=Math.max(i,e-s),r=Math.min(r,i+40),i=Math.max(n.start,r-40)}let o=t.slice(i,r).join(`
1
+ import{a as q}from"./chunk-QOKYJ33H.js";import{a as _}from"./chunk-BX2U3QQV.js";import{a as G}from"./chunk-QDCCHMVZ.js";import{l as F,r as O,s as L,t as z,v as $,w as T}from"./chunk-PLZXWZHY.js";import{d as X,f as U,h as S}from"./chunk-IOVPAZWP.js";import{a as H,d as K}from"./chunk-3LCDIREB.js";function I(t,n){let e=et(t,n)??it(t,n)??rt(t,n)??ot(t,n);return st(t,e,n)}function et(t,n){let e=-1,i=null;for(let r=0;r<=n;r+=1){let o=N(t[r]??"");o&&(i===null?(i=o,e=r):o===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let r=n+1;r<t.length;r+=1)if(N(t[r]??"")===i)return{start:e,end:r+1};return{start:e,end:t.length}}function N(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function it(t,n){if(!w(t[n]??""))return null;let e=n;for(;e>0&&w(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&w(t[i]??"");)i+=1;return{start:e,end:i}}function w(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function rt(t,n){let e=n;for(;e>=0;){let o=t[e]??"";if(E(o)!==null)break;if(B(o)!==null)return null;e-=1}if(e<0)return null;let i=E(t[e]??"");if(i===null)return null;let r=e+1;for(;r<t.length;){let o=t[r]??"",s=E(o);if(s!==null){if(s<=i)break;r+=1;continue}if(B(o)!==null)break;r+=1}return{start:e,end:r}}function E(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function ot(t,n){let e=t[n]??"";if(W(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&V(t[i-1]??"");)i-=1;let r=n+1;for(;r<t.length&&V(t[r]??"");)r+=1;return{start:i,end:r}}function V(t){return B(t)===null}function B(t){return t.trim().length===0?"blank":W(t)?"heading":N(t)?"fence":w(t)?"table":E(t)!==null?"list":null}function W(t){return/^#{1,6}\s+/.test(t.trim())}function st(t,n,e){let{start:i,end:r}=n;if(r-i>40){let s=Math.floor(20);i=Math.max(i,e-s),r=Math.min(r,i+40),i=Math.max(n.start,r-40)}let o=t.slice(i,r).join(`
2
2
  `).trim();return o.length<=2e3?o:`${o.slice(0,2e3).trimEnd()}...`}function A(t,n){return n.filter(e=>t.includes(e))}var ct=/<!--\s*codebaseiq:\s*snapshot\s*-->/i;function Z(t,n){if((t.config.docs?.snapshotPaths??[]).some(r=>G(r,n)))return!0;let i=T(t,n);return i.length>0&&ct.test(i)}var J={classifyCitation:lt,citationContexts:dt,citationKindLabel:ft,citationRemediation:gt,referenceTargets:ht,hasLineAnchoredCitation:at};function at(t){return t.some(n=>(n.lineReferences?.length??0)>0)}function lt(t){let n=t.join(`
3
3
  `).toLowerCase(),e=[],i=A(n,[".codebaseiq","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(i.length>0)return e.push(`configuration/example terms near citation: ${i.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:e};let r=A(n,["accepted","intentional","intentionally","retained","historical"]);if(r.length>0)return e.push(`intentional-record terms near citation: ${r.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:e};let o=A(n,["command","cli","usage","example","run","workflow"]);return o.length>0?(e.push(`guide/reference terms near citation: ${o.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:e}):(e.push(t.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:e})}function dt(t,n,e){let i=T(t,n);if(!i&&!S(t.config.projectRoot,n))return[];let r=i.split(/\r?\n/),o=e.flatMap(ut),s=[];for(let c=0;c<r.length;c+=1){let a=r[c]??"";o.some(d=>a.includes(d))&&s.push(I(r,c))}return s}function ut(t){let n=t.split("/");return[t,`./${t}`,n.slice(-3).join("/"),n.slice(-2).join("/")].filter((e,i,r)=>e.length>0&&r.indexOf(e)===i)}function ft(t){switch(t){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function gt(t,n){switch(t){case"behavioral-claim":return`Re-read ${n} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${n} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${n} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${n} is still meant to name this file.`}}function ht(t,n,e){let i=q(e),r=new Set;for(let o of n)mt(t,o,i.get(o)??[])&&r.add(o);return r}function mt(t,n,e){if(!pt.test(n)||!S(t.config.projectRoot,n))return!0;if(e.length===0)return!1;let i=U(t.config.projectRoot,n,{inputKind:"changed source file"}).split(/\r?\n/),r=yt(i);for(let o of e)for(let s=o.startLine;s<=o.endLine;s+=1)if((i[s]??"").trim()!==""&&!r.has(s))return!0;return!1}var pt=/\.(?:[cm]?[jt]sx?)$/i;function yt(t){let n=new Set,e=!1;for(let i=0;i<t.length;i+=1){let r=t[i].trim();!e&&Ct(r)&&(e=!0),e&&(n.add(i),r.endsWith(";")&&(e=!1))}return n}function Ct(t){return/^import(?:\s|$)/.test(t)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(t)}var Q=z({kind:"doc-path-evidence",invalidation:$("doc-path-evidence"),serialize:jt,deserialize:Lt}),v=/\.(?:md|mdx|rst|txt)$/i;function bt(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var Dt=3,St=/([A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6})(?::([1-9][0-9]*))?\b/g;function en(t,n={}){let{doc:e,limit:i=20,minCoupling:r=Dt,includeSnapshotExcluded:o=!1}=n,s=At(t,n.historyMode??"bounded");if(!s)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let c=[];for(let a of s.docFiles){if(e!==void 0&&!a.includes(e)||e===void 0&&!Y(t,a)||e!==void 0&&!S(t.config.projectRoot,a))continue;let d=Z(t,a);if(d&&!o)continue;let{value:p,estimated:y}=xt(t,a,s.changeTimes.get(a)),g=Rt(t,a),u=new Map,{resolved:l,broken:h,citations:D}=wt(t,a,s.tracked,s.trackedBySuffix,s.everSeenInHistory),x=new Map(D.map(f=>[f.file,f]));for(let f of l){if(f===a||v.test(f))continue;let C=(s.changeTimes.get(f)??[]).filter(b=>b>p).length;if(C===0)continue;let m=x.get(f);u.set(f,{file:f,evidence:"reference",coChanges:0,changesSinceDocUpdate:C,...P("reference",g,m?.contexts),citationContexts:m?.contexts,citedLines:m?.lineReferences})}for(let[f,C]of s.coupling.get(a)??[]){if(C<r||!s.tracked.has(f))continue;let m=(s.changeTimes.get(f)??[]).filter(M=>M>p).length;if(m===0)continue;let b=u.get(f);b?(b.evidence="both",b.coChanges=C,Object.assign(b,P("both",g,b.citationContexts))):u.set(f,{file:f,evidence:"co-change",coChanges:C,changesSinceDocUpdate:m,...P("co-change",g)})}if(u.size===0&&h.length===0)continue;let R=[...u.values()].sort((f,C)=>C.changesSinceDocUpdate-f.changesSinceDocUpdate);c.push({doc:a,docLastChangedAt:p,staleness:R.reduce((f,C)=>f+C.changesSinceDocUpdate,0)+h.length*10,subjects:R.slice(0,8),brokenReferences:h,...d?{snapshotExcluded:!0}:{},...y?{docLastChangedAtEstimated:!0}:{}})}return c.sort((a,d)=>d.staleness-a.staleness),{available:!0,commitsAnalyzed:s.historyCommitCount,docsScanned:s.docFiles.length,findings:c.slice(0,i)}}function xt(t,n,e){if(e&&e.length>0)return{value:Math.max(...e),estimated:!1};try{return{value:Math.floor(X(t.config.projectRoot,n).mtimeMs/1e3),estimated:!0}}catch(i){if(S(t.config.projectRoot,n))throw i;return{value:0,estimated:!1}}}function Rt(t,n){let e=T(t,n).slice(0,6e3);if(!e)return{docIntent:"unknown",reasons:["doc text unavailable"]};let i=`${n}
4
4
  ${e}`.toLowerCase(),r=A(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(r.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${r.join(", ")}`]};let o=A(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return o.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${o.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function P(t,n,e=[]){let i=t==="co-change"||e.length===0?null:J.classifyCitation(e);return{actionTier:Tt(t,n.docIntent,i?.actionTier),docIntent:n.docIntent,docIntentReasons:n.reasons,...i?{citationKind:i.citationKind,citationKindReasons:i.reasons}:{}}}function Tt(t,n,e){return n==="historical-note"?"support":e||(t==="co-change"?"signal":"direct")}function At(t,n){let e=_(t,{historyMode:n}),i=e.commitHistory();if(!i)return null;let r=e.trackedFiles()??new Set,o=new Map,s=new Map,c=new Set;for(let a of i.commits){let d=[...new Set(a.files)],p=d.filter(g=>v.test(g)),y=d.filter(g=>!v.test(g));for(let g of d){c.add(g);let u=o.get(g)??[];u.push(a.timestamp),o.set(g,u)}for(let g of p){let u=s.get(g);u||(u=new Map,s.set(g,u));for(let l of y)u.set(l,(u.get(l)??0)+1)}}return{changeTimes:o,coupling:s,docFiles:[...r].filter(a=>v.test(a)),everSeenInHistory:c,historyCommitCount:i.commits.length,tracked:r,trackedBySuffix:tt(r)}}function rn(t,n){if(n.size===0)return[];let e=H(),i=0,r=0,o=0,s=0,c=0,a=0;return K("doc-reference.docs-citing-files",()=>{let d=_(t).trackedFiles()??new Set;i=d.size;let p=tt(d),y=Mt(n,p),g=[];for(let u of d){if(!Y(t,u))continue;e&&(r+=1);let l=T(t,u);if(!l&&!S(t.config.projectRoot,u)){e&&(o+=1);continue}if(!It(l,y)){e&&(s+=1);continue}let h=nt(t,u,l);if(!h)continue;e&&(c+=1);let D=vt(h.candidates,n,y,d,p);if(D.size===0)continue;let x=[...new Set([...D.values()].flatMap(m=>[...m]))],R=Et(h.contextsByCandidate,x),f=[...D].map(([m,b])=>({file:m,contexts:k([...b].flatMap(M=>R.get(M)??[])).slice(0,3),lineReferences:j([...b].flatMap(M=>h.lineReferencesByCandidate.get(M)??[]))})).filter(m=>m.contexts.length>0),C=[...D.keys()];if(C.length>0){e&&(a+=1);let m=C.sort();g.push({doc:u,cited:m,citations:f,citedClaims:k(f.flatMap(b=>b.contexts)).slice(0,3)})}}return g},()=>({targets:n.size,trackedFiles:i,livingDocs:r,unreadableDocs:o,candidateMisses:s,evidenceDocs:c,citedDocs:a}))}function Y(t,n){return v.test(n)&&!bt(n)&&S(t.config.projectRoot,n)}function tt(t){let n=new Map;for(let e of t){let i=e.split("/");for(let r of[2,3]){if(i.length<r)continue;let o=i.slice(-r).join("/"),s=n.get(o)??[];s.push(e),n.set(o,s)}}return n}function Mt(t,n){let e=new Set(t);for(let i of t){let r=i.split("/");for(let o of[2,3]){if(r.length<o)continue;let s=r.slice(-o).join("/"),c=n.get(s);c?.length===1&&c[0]===i&&e.add(s)}}return e}function vt(t,n,e,i,r){let o=new Map;for(let s of t){if(!e.has(s))continue;let c;if(n.has(s))c=s;else if(i.has(s))c=s;else{let d=r.get(s);d?.length===1&&(c=d[0])}if(!c||!n.has(c))continue;let a=o.get(c)??new Set;a.add(s),o.set(c,a)}return o}function wt(t,n,e,i,r){let o=new Set,s=new Set,c=nt(t,n);if(!c)return{resolved:o,broken:[],citations:[]};let a=c.candidates,d=c.contextsByCandidate,p=c.lineReferencesByCandidate,y=new Map,g=new Map,u=(l,h)=>{let D=d.get(h);if(D&&D.length>0){let R=y.get(l)??[];R.push(...D),y.set(l,k(R).slice(0,3))}let x=p.get(h);x&&x.length>0&&g.set(l,j([...g.get(l)??[],...x]))};for(let l of a){if(e.has(l)){o.add(l),u(l,l);continue}let h=i.get(l);if(h&&h.length===1){o.add(h[0]),u(h[0],l);continue}h&&h.length>1||r.has(l)&&s.add(l)}return{resolved:o,broken:[...s],citations:[...y].map(([l,h])=>({file:l,contexts:h,lineReferences:g.get(l)}))}}function Et(t,n){let e=new Map;for(let i of n){let r=t.get(i);r&&r.length>0&&e.set(i,[...r])}return e}function nt(t,n,e){let i=e;if(i===void 0&&(i=T(t,n),!i&&!S(t.config.projectRoot,n)))return null;let r=F(t,n,i),o=Q.read(t,n,r);if(o)return o;let s=kt(i);return Q.write(t,n,r,s),s}function It(t,n){for(let e of n)if(t.includes(e))return!0;return!1}function kt(t){let n=t.split(/\r?\n/),e=new Set,i=new Map,r=new Map;for(let o=0;o<n.length;o+=1){let s=n[o]??"";for(let c of s.matchAll(St)){let a=(c[1]??"").replace(/^\.?\//,"");if(a.length===0)continue;e.add(a);let d=c[2]?Number(c[2]):null;d!==null&&Number.isSafeInteger(d)&&r.set(a,j([...r.get(a)??[],d]));let p=I(n,o);if(p.length===0)continue;let y=i.get(a)??[];y.push(p),i.set(a,k(y).slice(0,3))}}return{candidates:[...e],contextsByCandidate:i,lineReferencesByCandidate:r}}function jt(t){let n={candidates:t.candidates,contextsByCandidate:[...t.contextsByCandidate.entries()],lineReferencesByCandidate:[...t.lineReferencesByCandidate.entries()]};return JSON.stringify(n)}function Lt(t){try{let n=JSON.parse(t);if(!O(n))return null;let e=L(n.candidates),i=Nt(n.contextsByCandidate),r=_t(n.lineReferencesByCandidate);return!e||!i?null:{candidates:e,contextsByCandidate:new Map(i),lineReferencesByCandidate:new Map(r??[])}}catch{return null}}function _t(t){if(t===void 0)return[];if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string"||!Array.isArray(e[1]))return null;let i=[];for(let r of e[1]){if(typeof r!="number"||!Number.isSafeInteger(r))return null;i.push(r)}n.push([e[0],j(i)])}return n}function Nt(t){if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string")return null;let i=L(e[1]);if(!i)return null;n.push([e[0],i])}return n}function k(t){let n=[];for(let e of new Set(t))n.some(i=>Bt(i,e))||n.push(e);return n}function j(t){return[...new Set(t)].sort((n,e)=>n-e)}function Bt(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),i=n.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),r=Math.min(e.length,i.length);if(r===0)return!1;if(r<3)return t.includes(n)||n.includes(t);let o=new Set(i),s=e.filter(c=>o.has(c)).length;return s>=3&&s/r>=.6}export{bt as a,en as b,rn as c};
5
- //# sourceMappingURL=chunk-NE6IU5ZD.js.map
5
+ //# sourceMappingURL=chunk-EFFMFK7C.js.map
@@ -1,4 +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(`
1
+ import{a as C,b as x,c as K,d as $}from"./chunk-NIO346UL.js";import{a as A}from"./chunk-DGXRDLV5.js";import{b as L,c as R}from"./chunk-NK76RSB6.js";import{a as y}from"./chunk-BGBBVSH4.js";import{h as M}from"./chunk-JN5LIBT3.js";import{a as k}from"./chunk-ZOEDRCR4.js";import{b as F,d as P,e as g}from"./chunk-AM5SUGHF.js";import{l as T}from"./chunk-JOALNFY3.js";import{w as I}from"./chunk-PLZXWZHY.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
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
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
4
+ //# sourceMappingURL=chunk-EM5UHLAM.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ var e=Symbol("no-error");async function h(n,o,l){if(n.length===0)return[];let t=new Array(n.length),u=Number.isFinite(o)?Math.max(1,Math.floor(o)):1,c=Math.min(n.length,u),a=0,r=e,s=!0,f=Array.from({length:c},async()=>{for(;s&&a<n.length;){let i=a++;try{t[i]=await l(n[i])}catch(w){r===e&&(r=w),s=!1}}});if(await Promise.all(f),r!==e)throw r;return t}export{h as a};
3
+ //# sourceMappingURL=chunk-EN4AHLL3.js.map
@@ -0,0 +1,3 @@
1
+ import{b as m}from"./chunk-5IO2APSS.js";import{a as p}from"./chunk-6URCE5QY.js";import{aa as d,ca as P,da as h,g as f}from"./chunk-4O52YNKL.js";import{realpathSync as c}from"fs";import{basename as x,dirname as L,join as T,relative as I,sep as O}from"path";import{fileURLToPath as S,pathToFileURL as y}from"url";function F(n,e){return e==="."||e==="./"?y(c(n)).href:y(d(n,e).absolutePath).href}function b(n,e){let r=S(e);return I(c(n),v(r)).split(O).join("/")}function v(n){try{return c(n)}catch{try{return T(c(L(n)),x(n))}catch{return n}}}function H(n,e,r){return{textDocument:{uri:F(n,e.relativePath)},position:z(n,e),context:{includeDeclaration:r}}}function z(n,e){let r={line:e.startLine,character:e.startChar??0};try{return M(P(n,e.relativePath,{inputKind:"indexed Rust source file"}),e,r)}catch(t){if(!h(t))throw t;return r}}function M(n,e,r={line:e.startLine,character:e.startChar??0}){let t=n.split(/\r?\n/),o=t[e.startLine];if(o===void 0||e.leaf.length===0)return r;let i=Math.max(0,Math.min(r.character,o.length)),s=o.indexOf(e.leaf,i);if(s>=0)return{line:e.startLine,character:u(s,e.leaf)};let a=o.indexOf(e.leaf);if(a>=0)return{line:e.startLine,character:u(a,e.leaf)};let l=D(t,e.startLine,e.leaf);return l||r}function u(n,e){return n+Math.max(0,e.length-2)}function D(n,e,r){for(let t of[-1,1,-2,2]){let o=e+t;if(o<0||o>=n.length)continue;let i=n[o].indexOf(r);if(i>=0)return{line:o,character:u(i,r)}}return null}function K(n,e){return e.map(r=>({file:b(n,r.uri),line:r.range.start.line,column:r.range.start.character}))}function X(n){let e=new Map;for(let r of n)e.set(`${r.file}\0${r.line}\0${r.column}`,r);return[...e.values()].sort((r,t)=>{let o=r.file.localeCompare(t.file);return o!==0?o:r.line!==t.line?r.line-t.line:r.column-t.column})}import{randomUUID as E}from"crypto";import{readdirSync as $,rmSync as j,writeFileSync as A}from"fs";import{join as g}from"path";var R="rust-analyzer-owner-",w=".json",U=16*1024;function Z(n,e){if(!n||!e.rootIdentity)return null;let r=g(n,`${R}${e.rootPid}-${E()}${w}`),t={version:1,rootIdentity:e.rootIdentity,ownsProcessGroup:e.ownsProcessGroup};return A(r,`${JSON.stringify(t)}
2
+ `,{encoding:"utf8",mode:384,flag:"wx"}),r}function ee(n){n&&j(n,{force:!0})}async function re(n,e){if(!n)return[];let r;try{r=$(n)}catch{return[]}let t=r.filter(s=>s.startsWith(R)&&s.endsWith(w)).map(s=>g(n,s)),o=[],i=[];for(let s of t){let a=C(s);a?i.push(a):o.push({reaped:!1,reason:"identity-unavailable",detail:`Rust analyzer ownership record ${s} could not be validated.`})}return o.push(...await Promise.all(i.map(s=>m(s,e)))),o}function C(n){try{let e=f(n,{maxBytes:U,inputKind:"rust-analyzer process ownership record"}),r=JSON.parse(e),t=p(r.rootIdentity);return r.version!==1||!t||typeof r.ownsProcessGroup!="boolean"?null:{rootPid:t.pid,rootIdentity:t,ownsProcessGroup:r.ownsProcessGroup,knownMembers:new Map([[t.pid,t]])}}catch{return null}}export{Z as a,ee as b,re as c,F as d,b as e,H as f,K as g,X as h};
3
+ //# sourceMappingURL=chunk-EXMVF3JR.js.map
@@ -1,2 +1,2 @@
1
- import{a as x}from"./chunk-4WKDMDEW.js";import{a as u}from"./chunk-TIIC3ZE7.js";import{a as p}from"./chunk-NNOKTMZT.js";import{h as y}from"./chunk-CWONGW6P.js";function ee(e){return b.test(e)}var b=/(?:^|\/)(?:package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Cargo\.lock|uv\.lock|poetry\.lock|Pipfile\.lock|bun\.lockb?|\.SRCINFO|CHANGELOG(?:\.[a-z]+)?|.*\.(?:map|tsbuildinfo))$|(?:^|\/)(?:dist|build|out|node_modules|docs\/plans)\//i;function te(e,t,n={}){let{minTogether:s=4,minConfidence:i=.6,limit:a=30,maxFilesPerCommit:l=20}=n,g=x(e,{historyMode:n.historyMode,...n.head?{head:n.head}:{}}),r=g.commitHistory(),c=t!==void 0,d=g.coChangePairs({minTogether:c?Math.min(s,2):s,minConfidence:c?0:i,maxFilesPerCommit:l});if(!r||!d)return{available:!1,commitsAnalyzed:0,findings:[]};let f=typeof n.scanLimit=="number"?d.slice(0,n.scanLimit):d,R=p(e),j=E(e),L=F(e,R,j),v=n.includeLinked===!0||c,h=[];for(let o of f){if(b.test(o.fileA)||b.test(o.fileB)||!P(e,o.fileA)||!P(e,o.fileB)||c&&!o.fileA.includes(t)&&!o.fileB.includes(t)||!c&&(u(o.fileA)==="test"||u(o.fileB)==="test"||O(o.fileA,o.fileB)||I(o.fileA,o.fileB)))continue;let m=L(o.fileA,o.fileB);if(!v&&m)continue;let C=w(o.fileA,o.fileB),S=$(o,C,m);if(h.push({...o,structurallyLinked:m,partnerClass:C.partnerClass,partnerClassReasons:C.reasons,...S?{declaredCouplingSuggestion:S}:{}}),h.length>=a)break}return{available:!0,commitsAnalyzed:r.commits.length,findings:h}}function P(e,t){return y(e.config.projectRoot,t)}function w(e,t){let n=A(e),s=A(t),i=[],a=r=>{i.includes(r)||i.push(r)},l=(r,c)=>n.tags.has(r)&&s.tags.has(c)||n.tags.has(c)&&s.tags.has(r);if(l("doc","code"))return a("one side is documentation and the other is executable source"),{partnerClass:"doc-code",reasons:i};if(n.tags.has("test")||s.tags.has("test"))return a("one side is classified as a test file"),{partnerClass:"test-code",reasons:i};if(l("schema","script"))return a("schema or contract file changes with a script or generated-code path"),{partnerClass:"schema-script",reasons:i};if(l("model","view"))return a("model or state path changes with a view or component path"),{partnerClass:"model-view",reasons:i};if(l("config","code"))return a("configuration file changes with executable source"),{partnerClass:"config-code",reasons:i};let g=K(n.tokens,s.tokens).filter(r=>!Z.has(r));return k(e,t)||g.length>=2?(a(k(e,t)?"both files live in the same directory":`files share feature tokens: ${g.slice(0,4).join(", ")}`),{partnerClass:"same-feature",reasons:i}):(a("no specific relationship pattern matched"),{partnerClass:"unknown",reasons:i})}function $(e,t,n){if(n||e.together<4||e.confidence<.75||e.commitScope==="broad-sweep"||e.recency==="stale"||!W.has(t.partnerClass))return;let s=[e.fileA,e.fileB].sort();return{name:`co-change ${t.partnerClass}: ${U(s)}`,files:s,reason:`${t.partnerClass} pair changed together ${e.together}x with ${Math.round(e.confidence*100)}% confidence; declare it if future edits should require both sides.`}}function F(e,t=p(e),n=E(e)){return(s,i)=>D(t,n,s,i)}var _=/(?:^|\/)(?:locales|i18n)\//i;function T(e){return _.test(e)}function I(e,t){return T(e)&&T(t)?!0:N(e,t)}function N(e,t){if(!e.endsWith(".json")||!t.endsWith(".json"))return!1;let n=e.lastIndexOf("/"),s=t.lastIndexOf("/");if(n<0||s<0)return!1;let i=e.slice(0,n),a=t.slice(0,s);if(i===a)return!1;let l=e.slice(n+1),g=t.slice(s+1);if(l!==g)return!1;let r=i.lastIndexOf("/"),c=a.lastIndexOf("/"),d=r>=0?i.slice(0,r):"",f=c>=0?a.slice(0,c):"";return d===f}function O(e,t){let n=e.lastIndexOf("/"),s=t.lastIndexOf("/");if(e.slice(0,n)!==t.slice(0,s))return!1;let i=e.slice(n+1).split(".")[0],a=t.slice(s+1).split(".")[0];return i!==""&&i===a}function E(e){return(e.config.declaredCouplings??[]).filter(t=>Array.isArray(t.files)&&t.files.length>=2).map(t=>new Set(t.files))}function D(e,t,n,s){return e.get(n)?.has(s)===!0||e.get(s)?.has(n)===!0?!0:t.some(i=>i.has(n)&&i.has(s))}var B=/(?:^|\/)(?:readme|docs?|guides?|adr|architecture|design)(?:\/|$)|\.(?:md|mdx|rst|adoc|txt)$/i,M=/(?:^|\/)(?:\.[a-z0-9-]+rc|config|configs|settings|\.github)(?:\/|$)|(?:^|\/)(?:package\.json|tsconfig(?:\.[^.]+)?\.json|vite\.config\.[cm]?[jt]s|rollup\.config\.[cm]?[jt]s|eslint\.config\.[cm]?[jt]s)$|\.(?:json|ya?ml|toml|ini|env)$/i,z=/(?:^|\/)(?:schemas?|contracts?|migrations?|models?|types?)(?:\/|$)|(?:^|\/)[^/]*(?:schema|contract|migration|model|types?)[^/]*|(?:\.schema)?\.(?:graphql|gql|proto|prisma)$/i,G=/(?:^|\/)(?:scripts?|bin|tools?|tasks?|generators?|codegen|migrations?|seeds?)(?:\/|$)|(?:^|\/)[^/]*(?:generate|codegen|migrate|seed|script)[^/]*\.[cm]?[jt]s$/i,H=/(?:^|\/)(?:models?|entities|domain|state|stores?|reducers?)(?:\/|$)|(?:^|\/)[^/]*(?:model|entity|state|store|reducer|viewmodel)[^/]*\.[^.]+$/i,q=/(?:^|\/)(?:views?|pages?|components?|screens?|routes?|templates?)(?:\/|$)|(?:^|\/)[^/]*(?:view|page|component|screen|template)[^/]*\.[^.]+$|\.(?:vue|svelte|tsx|jsx)$/i,W=new Set(["doc-code","config-code","schema-script","model-view","test-code"]),Z=new Set(["src","lib","app","apps","packages","frontend","backend","examples","python","typescript","javascript","test","tests","spec","index","main","utils","util","types","type","config","docs","doc","package","requirements","ts","tsx","js","jsx","mjs","cjs","vue","py","md","mdx","json","yaml","yml","toml","txt"]);function A(e){let t=e.replace(/\\/g,"/"),n=new Set;return B.test(t)&&n.add("doc"),M.test(t)&&n.add("config"),z.test(t)&&n.add("schema"),G.test(t)&&n.add("script"),H.test(t)&&n.add("model"),q.test(t)&&n.add("view"),u(t)==="test"&&n.add("test"),!n.has("doc")&&!n.has("config")&&n.add("code"),{tags:n,tokens:J(t)}}function k(e,t){let n=e.lastIndexOf("/"),s=t.lastIndexOf("/"),i=n>=0?e.slice(0,n):"",a=s>=0?t.slice(0,s):"";return i!==""&&i===a}function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}function K(e,t){let n=new Set(t);return[...new Set(e.filter(s=>n.has(s)))].sort()}function U(e){return e.map(t=>t.split("/").pop()?.replace(/\.[^.]+$/,"")||t).join(" + ")}export{ee as a,te as b,w as c,$ as d,F as e};
2
- //# sourceMappingURL=chunk-SWHMHUKF.js.map
1
+ import{a as x}from"./chunk-BX2U3QQV.js";import{a as u}from"./chunk-ZOEDRCR4.js";import{a as p}from"./chunk-B2E3HZ2A.js";import{h as y}from"./chunk-IOVPAZWP.js";function ee(e){return b.test(e)}var b=/(?:^|\/)(?:package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Cargo\.lock|uv\.lock|poetry\.lock|Pipfile\.lock|bun\.lockb?|\.SRCINFO|CHANGELOG(?:\.[a-z]+)?|.*\.(?:map|tsbuildinfo))$|(?:^|\/)(?:dist|build|out|node_modules|docs\/plans)\//i;function te(e,t,n={}){let{minTogether:s=4,minConfidence:i=.6,limit:a=30,maxFilesPerCommit:l=20}=n,g=x(e,{historyMode:n.historyMode,...n.head?{head:n.head}:{}}),r=g.commitHistory(),c=t!==void 0,d=g.coChangePairs({minTogether:c?Math.min(s,2):s,minConfidence:c?0:i,maxFilesPerCommit:l});if(!r||!d)return{available:!1,commitsAnalyzed:0,findings:[]};let f=typeof n.scanLimit=="number"?d.slice(0,n.scanLimit):d,R=p(e),j=E(e),L=F(e,R,j),v=n.includeLinked===!0||c,h=[];for(let o of f){if(b.test(o.fileA)||b.test(o.fileB)||!P(e,o.fileA)||!P(e,o.fileB)||c&&!o.fileA.includes(t)&&!o.fileB.includes(t)||!c&&(u(o.fileA)==="test"||u(o.fileB)==="test"||O(o.fileA,o.fileB)||I(o.fileA,o.fileB)))continue;let m=L(o.fileA,o.fileB);if(!v&&m)continue;let C=w(o.fileA,o.fileB),S=$(o,C,m);if(h.push({...o,structurallyLinked:m,partnerClass:C.partnerClass,partnerClassReasons:C.reasons,...S?{declaredCouplingSuggestion:S}:{}}),h.length>=a)break}return{available:!0,commitsAnalyzed:r.commits.length,findings:h}}function P(e,t){return y(e.config.projectRoot,t)}function w(e,t){let n=A(e),s=A(t),i=[],a=r=>{i.includes(r)||i.push(r)},l=(r,c)=>n.tags.has(r)&&s.tags.has(c)||n.tags.has(c)&&s.tags.has(r);if(l("doc","code"))return a("one side is documentation and the other is executable source"),{partnerClass:"doc-code",reasons:i};if(n.tags.has("test")||s.tags.has("test"))return a("one side is classified as a test file"),{partnerClass:"test-code",reasons:i};if(l("schema","script"))return a("schema or contract file changes with a script or generated-code path"),{partnerClass:"schema-script",reasons:i};if(l("model","view"))return a("model or state path changes with a view or component path"),{partnerClass:"model-view",reasons:i};if(l("config","code"))return a("configuration file changes with executable source"),{partnerClass:"config-code",reasons:i};let g=K(n.tokens,s.tokens).filter(r=>!Z.has(r));return k(e,t)||g.length>=2?(a(k(e,t)?"both files live in the same directory":`files share feature tokens: ${g.slice(0,4).join(", ")}`),{partnerClass:"same-feature",reasons:i}):(a("no specific relationship pattern matched"),{partnerClass:"unknown",reasons:i})}function $(e,t,n){if(n||e.together<4||e.confidence<.75||e.commitScope==="broad-sweep"||e.recency==="stale"||!W.has(t.partnerClass))return;let s=[e.fileA,e.fileB].sort();return{name:`co-change ${t.partnerClass}: ${U(s)}`,files:s,reason:`${t.partnerClass} pair changed together ${e.together}x with ${Math.round(e.confidence*100)}% confidence; declare it if future edits should require both sides.`}}function F(e,t=p(e),n=E(e)){return(s,i)=>D(t,n,s,i)}var _=/(?:^|\/)(?:locales|i18n)\//i;function T(e){return _.test(e)}function I(e,t){return T(e)&&T(t)?!0:N(e,t)}function N(e,t){if(!e.endsWith(".json")||!t.endsWith(".json"))return!1;let n=e.lastIndexOf("/"),s=t.lastIndexOf("/");if(n<0||s<0)return!1;let i=e.slice(0,n),a=t.slice(0,s);if(i===a)return!1;let l=e.slice(n+1),g=t.slice(s+1);if(l!==g)return!1;let r=i.lastIndexOf("/"),c=a.lastIndexOf("/"),d=r>=0?i.slice(0,r):"",f=c>=0?a.slice(0,c):"";return d===f}function O(e,t){let n=e.lastIndexOf("/"),s=t.lastIndexOf("/");if(e.slice(0,n)!==t.slice(0,s))return!1;let i=e.slice(n+1).split(".")[0],a=t.slice(s+1).split(".")[0];return i!==""&&i===a}function E(e){return(e.config.declaredCouplings??[]).filter(t=>Array.isArray(t.files)&&t.files.length>=2).map(t=>new Set(t.files))}function D(e,t,n,s){return e.get(n)?.has(s)===!0||e.get(s)?.has(n)===!0?!0:t.some(i=>i.has(n)&&i.has(s))}var B=/(?:^|\/)(?:readme|docs?|guides?|adr|architecture|design)(?:\/|$)|\.(?:md|mdx|rst|adoc|txt)$/i,M=/(?:^|\/)(?:\.[a-z0-9-]+rc|config|configs|settings|\.github)(?:\/|$)|(?:^|\/)(?:package\.json|tsconfig(?:\.[^.]+)?\.json|vite\.config\.[cm]?[jt]s|rollup\.config\.[cm]?[jt]s|eslint\.config\.[cm]?[jt]s)$|\.(?:json|ya?ml|toml|ini|env)$/i,z=/(?:^|\/)(?:schemas?|contracts?|migrations?|models?|types?)(?:\/|$)|(?:^|\/)[^/]*(?:schema|contract|migration|model|types?)[^/]*|(?:\.schema)?\.(?:graphql|gql|proto|prisma)$/i,G=/(?:^|\/)(?:scripts?|bin|tools?|tasks?|generators?|codegen|migrations?|seeds?)(?:\/|$)|(?:^|\/)[^/]*(?:generate|codegen|migrate|seed|script)[^/]*\.[cm]?[jt]s$/i,H=/(?:^|\/)(?:models?|entities|domain|state|stores?|reducers?)(?:\/|$)|(?:^|\/)[^/]*(?:model|entity|state|store|reducer|viewmodel)[^/]*\.[^.]+$/i,q=/(?:^|\/)(?:views?|pages?|components?|screens?|routes?|templates?)(?:\/|$)|(?:^|\/)[^/]*(?:view|page|component|screen|template)[^/]*\.[^.]+$|\.(?:vue|svelte|tsx|jsx)$/i,W=new Set(["doc-code","config-code","schema-script","model-view","test-code"]),Z=new Set(["src","lib","app","apps","packages","frontend","backend","examples","python","typescript","javascript","test","tests","spec","index","main","utils","util","types","type","config","docs","doc","package","requirements","ts","tsx","js","jsx","mjs","cjs","vue","py","md","mdx","json","yaml","yml","toml","txt"]);function A(e){let t=e.replace(/\\/g,"/"),n=new Set;return B.test(t)&&n.add("doc"),M.test(t)&&n.add("config"),z.test(t)&&n.add("schema"),G.test(t)&&n.add("script"),H.test(t)&&n.add("model"),q.test(t)&&n.add("view"),u(t)==="test"&&n.add("test"),!n.has("doc")&&!n.has("config")&&n.add("code"),{tags:n,tokens:J(t)}}function k(e,t){let n=e.lastIndexOf("/"),s=t.lastIndexOf("/"),i=n>=0?e.slice(0,n):"",a=s>=0?t.slice(0,s):"";return i!==""&&i===a}function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}function K(e,t){let n=new Set(t);return[...new Set(e.filter(s=>n.has(s)))].sort()}function U(e){return e.map(t=>t.split("/").pop()?.replace(/\.[^.]+$/,"")||t).join(" + ")}export{ee as a,te as b,w as c,$ as d,F as e};
2
+ //# sourceMappingURL=chunk-FEBLLMTL.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{b as v}from"./chunk-PHPQ24UG.js";import{e as s,fb as E,kb as V,lb as I}from"./chunk-N3Q3AWGW.js";import{c as y}from"./chunk-XZEE23VG.js";import{aa as h,ka as S,t as w}from"./chunk-W3FK73MD.js";import{l as x}from"./chunk-G2XUZCF2.js";var ce={defaultRole:"repository-observation"};function pe(e,n=[]){return{defaultRole:e,...n.length>0?{rules:n}:{}}}function k(e,n){for(let t of e.rules??[]){if(t.when.kind==="option-present"){let r=n.options[t.when.name];if(r!==void 0&&r!==!1)return t.role;continue}if((t.when.kind==="argument"?n.args[t.when.index]:n.options[t.when.name])===t.when.equals)return t.role}return e.defaultRole}function fe(e){return[...new Set([e.defaultRole,...(e.rules??[]).map(n=>n.role)])]}function A(e){return e==="repository-observation"||e==="repository-preview"||e==="composite"}import{AsyncLocalStorage as z}from"async_hooks";var U=1,j=1;var F={policyId:"codebaseiq:unresolved-repository-policy",policyVersion:j,permission:"not-established",reasons:["No repository action policy was supplied for this claim."]};function N(e){return{schemaVersion:U,origin:e.contract.origin,coverage:$(e.coverage),producerValidation:e.contract.producerValidation,stateAuthority:w(e.receipt,e.receipt),repositoryPolicy:e.repositoryPolicy??F,...e.contract.families?{families:e.contract.families}:{}}}function $(e){return e?e.complete===!0?{state:"complete",returned:e.returned,totalKnown:!0,total:e.total??e.returned,omitted:0}:e.totalKnown?{state:"partial",returned:e.returned,totalKnown:!0,...e.total===void 0?{}:{total:e.total},...e.omitted===void 0?{}:{omitted:e.omitted}}:{state:"unknown",returned:e.returned,totalKnown:!1}:{state:"unknown",returned:0,totalKnown:!1}}var W="codebaseiq-result";var G=1,Y=1,_=1,L=1;function M(e){let n=e.resultSchemaVersion??Y;if(!X(n))throw new Error("CLI result schema version must be a positive safe integer.");let{producerVersion:t,...o}=e;return{kind:W,schemaVersion:G,producer:{name:"codebaseiq",version:t},resultSchemaVersion:n,...o}}function J(e,n){return JSON.stringify(e,null,n?0:2)}function X(e){return Number.isSafeInteger(e)&&Number(e)>0}var P=Symbol("option-value-source"),T=new Map,D=new Map,B=new Map,H=new z;function Ie(e,n){return H.run(e,n)}function ke(e){T=new Map(e)}function Ae(e){D=new Map(e)}function Ne(e){B=new Map(e)}function m(e){return(...n)=>{let{args:t,opts:o}=le(n);S(r=>{v(r.generation.identity),e({db:r,args:t,opts:o})})}}function R(e,n){return m(t=>{let o=I(t.db,e,d(t.opts,"full"),{quiet:d(t.opts,"json")});n({...t,budget:o})})}function _e(e){return m(n=>c(n,e,{kind:"list"}))}function Le(e){return m(n=>c(n,e,{kind:"table",headers:e.headers,dashWidths:e.dashWidths}))}function Me(e){return m(n=>c(n,e,{kind:"grouped",key:e.key}))}function Z(e){return m(n=>b(n,e))}function Je(e){return Z({commandName:e.commandName,query:e.query,emptyMessage:e.emptyMessage,heuristicLabel:e.heuristicLabel,before:e.before,render:(n,t)=>s.sectionedReport(e.sections(n,t)),toJson:e.toJson,coverage:e.coverage,agentResult:e.agentResult,after:e.after})}function ee(e,n){return R(e,t=>b(t,{...n,commandName:n.commandName??e}))}function Pe(e,n){return ee(e,{commandName:n.commandName??e,query:n.query,emptyMessage:n.emptyMessage,heuristicLabel:n.heuristicLabel,before:n.before,render:(t,o)=>s.sectionedReport(n.sections(t,o)),toJson:n.toJson,coverage:n.coverage,agentResult:n.agentResult,after:n.after})}function Te(e,n){return R(e,t=>c(t,{...n,commandName:e},{kind:"list"}))}function De(e,n){return R(e,t=>c(t,{...n,commandName:e},{kind:"grouped",key:n.key}))}function Be(e,n){return String(e[n])}function He(e,n){let t=e[n];return typeof t=="string"?[t]:Array.isArray(t)&&t.every(o=>typeof o=="string")?t:[]}function Qe(e,n){let t=e[n];return typeof t=="string"?t:void 0}function qe(e,n){let t=e[n];return typeof t=="string"?t:void 0}function Q(e,n){let t=e[n];return typeof t=="number"?t:void 0}function d(e,n){return!!e[n]}function Ke(e,n){let t=e[n];return Array.isArray(t)&&t.every(o=>typeof o=="string")?t:[]}function Ue(e,n,t){return Q(e,n)??t}function je(e,n,t){let o=Q(e,n),r=o!==void 0&&ne(e,n)!=="default";if(d(e,"full")){if(r)throw new Error("--full cannot be combined with --limit. Use --full for all findings, or --limit N for a capped report.");return Number.MAX_SAFE_INTEGER}return o??t}function ne(e,n){return e[P]?.(n)}function c(e,n,t){b(e,{commandName:n.commandName,query:n.query,emptyMessage:(o,r)=>o.length===0&&n.emptyMessage?n.emptyMessage(r):void 0,heuristicLabel:n.heuristicLabel,render:(o,r)=>{t.kind==="list"?s.list(o,i=>n.format(i,r)):t.kind==="table"?s.table(t.headers,o.map(i=>n.format(i,r)),t.dashWidths):s.groupedByFile(o,i=>n.format(i,r),t.key?i=>t.key(i,r):void 0)},toJson:n.toJson,coverage:n.coverage,agentResult:n.agentResult,before:n.before,after:n.after})}function b(e,n){let t=n.query(e);if(d(e.opts,"json")){if(!n.commandName)throw new Error("JSON output requires a command name so its result contract can be identified.");oe(n.commandName,e.args,e.opts,n.toJson?n.toJson(t,e):t,{analysisBudget:te(e),coverage:n.coverage?.(t,e),agentResult:n.agentResult?.(t,e),resultSchemaVersion:n.resultSchemaVersion});return}let o=n.emptyMessage?.(t,e);if(o){s.empty(o);return}n.heuristicLabel&&V(n.heuristicLabel),n.before?.(t,e),n.render(t,e),n.after?.(t,e)}function te(e){return e.budget?.analysisBudget}function oe(e,n,t,o,r={}){let i=T.get(e),a=D.get(e),u=B.get(e),p=a?k(a.operation,{args:n,options:t}):void 0,f=H.getStore();if(f!==void 0&&p!==void 0&&f!==p)throw new Error(`Command ${e} changed operation role during execution: selected ${f}, rendered ${p}.`);let g=f??p,O=de(o),C=r.coverage??ae(a,o,r.analysisBudget),l=C&&O&&!C.resolution?{...C,resolution:O}:C;if(l&&ie(l),d(t,"resultOnly")){let K=Object.hasOwn(r,"resultOnly")?r.resultOnly:o;y(JSON.stringify(K,null,d(t,"compact")?0:2));return}let q=M({producerVersion:x,command:e,...g?{operationRole:g}:{},...i?{evidence:i}:{},...r.analysisBudget?{analysisBudget:r.analysisBudget}:{},args:ue(n),options:t,result:o,...l?{coverage:l}:{},...r.agentResult!==void 0?{agentResult:r.agentResult}:{},...re(g,i,r.analysisBudget,l,u,r.observationReceipt),...r.resultSchemaVersion===void 0?{}:{resultSchemaVersion:r.resultSchemaVersion}});y(J(q,d(t,"compact")))}function re(e,n,t,o,r,i){if(!e||!A(e))return{};let a=h(),u=i??(a?E({projectRoot:a.config.projectRoot,db:a,...r?{observedSourceKinds:r.observedSources}:{}}):void 0);return u?{evidenceContext:{schemaVersion:_,operationRole:e,receipt:u,analysisManifest:{schemaVersion:L,...n?{evidence:n}:{},...t?{analysisBudget:t}:{},...o?{coverage:o}:{},...r?{claimQualification:N({contract:r,receipt:u,...o?{coverage:o}:{}})}:{}}}}:{}}function ie(e){if(!Number.isSafeInteger(e.returned)||e.returned<0)throw new Error("Invocation coverage returned count must be a non-negative safe integer.");if(e.complete!==!0&&e.complete!==!1&&e.complete!==null)throw new Error("Invocation coverage complete must be true, false, or null.");if(e.complete===!0){if(!e.totalKnown)throw new Error("Complete invocation coverage must know its total.");if(!Number.isSafeInteger(e.total)||e.total!==e.returned)throw new Error("Complete invocation coverage total must equal returned.");if(e.omitted!==0)throw new Error("Complete invocation coverage cannot omit results.");if(e.omittedIdentities!==void 0)throw new Error("Complete invocation coverage cannot name omitted identities.");if(e.continuation!==void 0)throw new Error("Complete invocation coverage cannot provide a continuation.")}else if(e.totalKnown){if(e.complete!==!1)throw new Error("Known incomplete invocation coverage must set complete to false.");if(!Number.isSafeInteger(e.total)||e.total<e.returned)throw new Error("Known invocation coverage total must be a safe integer at least as large as returned.");let n=e.total-e.returned;if(e.omitted!==n)throw new Error("Known invocation coverage omitted count must equal total minus returned.");if(n===0)throw new Error("Known incomplete invocation coverage must omit at least one result.");if(e.omittedIdentities&&e.omittedIdentities.length!==n)throw new Error("Omitted identity count must equal the disclosed omitted count.")}else{if(e.total!==void 0||e.omitted!==void 0)throw new Error("Unknown invocation coverage cannot claim a total or omitted count.");if(e.omittedIdentities!==void 0)throw new Error("Unknown invocation coverage cannot claim omitted identities.")}if(e.continuation&&(e.continuation.cursor.length===0||e.continuation.indexGeneration.length===0))throw new Error("Invocation coverage continuation requires a cursor and index generation.");if(e.resolution){if(!Number.isSafeInteger(e.resolution.totalCandidates)||e.resolution.totalCandidates<0)throw new Error("Invocation resolution candidate count must be a non-negative safe integer.");if(e.resolution.state==="exact"&&e.resolution.totalCandidates!==1)throw new Error("Exact invocation resolution must name exactly one candidate.");if(e.resolution.state==="missing"&&e.resolution.totalCandidates!==0)throw new Error("Missing invocation resolution cannot name candidates.");if(e.resolution.state==="ambiguous"&&e.resolution.totalCandidates<2)throw new Error("Ambiguous invocation resolution must name at least two candidates.")}}function ae(e,n,t){if(!e)return;let o=se(e,n);return e.coverage==="complete"?{complete:!0,totalKnown:!0,returned:o,total:o,omitted:0}:e.coverage==="sampled"?{complete:!1,totalKnown:!1,returned:o}:e.coverage==="bounded"&&t?{complete:!1,totalKnown:!1,returned:o}:{complete:null,totalKnown:!1,returned:o}}function se(e,n){let t=e.resultUnits??{kind:"report"};if(t.kind==="rows")return Array.isArray(n)?n.length:0;if(t.kind==="field"){if(!n||typeof n!="object")return 0;let o=n[t.field];return Array.isArray(o)?o.length:o==null?0:1}return n==null?0:1}function de(e){if(!e||typeof e!="object"||Array.isArray(e))return;let n=e;if(n.matched===!1)return{state:"missing",totalCandidates:0};if(n.matched!==!0||!Number.isSafeInteger(n.totalMatches))return;let t=n.totalMatches;return t<=0?{state:"missing",totalCandidates:0}:t===1?{state:"exact",totalCandidates:t}:{state:"ambiguous",totalCandidates:t}}function ue(e){return e.filter(n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean")}function le(e){if(e.length===0)return{args:[],opts:{}};let n=e[e.length-1];return{args:e.slice(0,-1),opts:me(n)}}function me(e){if(!e||typeof e!="object")return{};let n=e,t=typeof n.optsWithGlobals=="function"?n.optsWithGlobals.bind(n):typeof n.opts=="function"?n.opts.bind(n):null;if(t){let o=t();return!o||typeof o!="object"?{}:(typeof n.getOptionValueSource=="function"&&Object.defineProperty(o,P,{value:r=>n.getOptionValueSource(r),enumerable:!1}),o)}return e}export{ce as a,pe as b,k as c,fe as d,Ie as e,ke as f,Ae as g,Ne as h,m as i,R as j,_e as k,Le as l,Me as m,Z as n,Je as o,ee as p,Pe as q,Te as r,De as s,Be as t,He as u,Qe as v,qe as w,Q as x,d as y,Ke as z,Ue as A,je as B,ne as C,oe as D,le as E,me as F};
3
+ //# sourceMappingURL=chunk-FIXYHQ3W.js.map
@@ -1,4 +1,4 @@
1
- import{a as c}from"./chunk-GTXSJDCO.js";import{a as r}from"./chunk-UZGZB3VB.js";import{a as l}from"./chunk-NNOKTMZT.js";import{d as m}from"./chunk-FETNQCFO.js";function N(n,t){let e=r(n,t);if(!e)return[];let s=n.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
1
+ import{a as c}from"./chunk-HIEXRDJF.js";import{a as r}from"./chunk-3XFJUWJE.js";import{a as l}from"./chunk-B2E3HZ2A.js";import{d as m}from"./chunk-AM5SUGHF.js";function N(n,t){let e=r(n,t);if(!e)return[];let s=n.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN (
@@ -70,4 +70,4 @@ import{a as c}from"./chunk-GTXSJDCO.js";import{a as r}from"./chunk-UZGZB3VB.js";
70
70
  GROUP BY d.id
71
71
  ORDER BY symbol_count DESC
72
72
  LIMIT ?`,...i,e).filter(d=>!n.isIgnored(d.relative_path)).map(d=>({name:d.relative_path,count:d.symbol_count}))}export{N as a,a as b,u as c,g as d,I as e,R as f};
73
- //# sourceMappingURL=chunk-RKEJ6VTF.js.map
73
+ //# sourceMappingURL=chunk-FLLXYUOL.js.map
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{A as G,D as P,a as y,b as ce,i as k,j as le,t as B,u as de,w as j,x as ue,y as b}from"./chunk-UXM43C7T.js";import{E as se,F as ae,M as E,a as g,b as Q,c as C,e as S,g as Y,h as H,i as Z,k as X,m as ee,o as x}from"./chunk-ECQBG7PW.js";import{O as W}from"./chunk-G6XFR4ZL.js";import{Ba as N,Ca as L,Ea as M,Q as te,Ra as oe,Sa as re,Ua as ie,ba as T,fa as ne}from"./chunk-3JSXXYTZ.js";function ge(e,n,t){if(!Number.isSafeInteger(t.limit)||t.limit<=0)throw new Error("Reference page limit must be a positive safe integer.");let o=N(e,n);if(!o)return{rows:[],hasMore:!1,producer:t.producer??"source-keyset",semanticEnrichment:!1};if(t.producer==="complete-only"||t.semantic===!0||o.relativePath.endsWith(".rb"))return F(e,n,t);let i=oe(e,o);if(!i)return F(e,n,t);let s=fe(e,o),c=Te(e,s),a=[],l=t.producer==="source-keyset";for(let u of c){if(t.after&&u<t.after.relativePath)continue;t.instrumentation?.fileScanned?.(u);let f=re(e,i,u);f.length>0&&(l=!0);let d=new Set(f);s?.relativePath===u&&d.add(s.line);for(let m of[...d].sort((p,Ae)=>p-Ae)){let p={relativePath:u,line:m};if(!(t.after&&R(p,t.after)<=0)&&(a.push(p),t.instrumentation?.rowAccepted?.(p),l&&a.length>t.limit))return me(a,t.limit)}}return l?me(a,t.limit):F(e,n,t,s)}function R(e,n){return(e.relativePath<n.relativePath?-1:e.relativePath>n.relativePath?1:0)||e.line-n.line}function me(e,n){return{rows:e.slice(0,n),hasMore:e.length>n,producer:"source-keyset",semanticEnrichment:!1}}function F(e,n,t,o){let r=N(e,n),i=t.semantic===!0||r?.relativePath.endsWith(".rb")?E(e,n,{semantic:t.semantic}):De(e,n,o),s=Me(i).filter(c=>!t.after||R(c,t.after)>0);for(let c of s.slice(0,t.limit+1))t.instrumentation?.rowAccepted?.(c);return{rows:s.slice(0,t.limit),hasMore:s.length>t.limit,producer:"complete-only",semanticEnrichment:t.semantic===!0}}function De(e,n,t){let o=N(e,n);if(!o)return[];let r=t===void 0?fe(e,o):t,i=ie(e,o).map(s=>({relativePath:s.file,line:s.line}));return r?[r,...i]:i}function fe(e,n){return!ne(n.symbol)&&!e.isIgnored(n.relativePath)?{relativePath:n.relativePath,line:n.startLine}:null}function Te(e,n){let t=te(e);return!n||t.includes(n.relativePath)?t:[...t,n.relativePath].sort((o,r)=>o<r?-1:o>r?1:0)}function Me(e){let n=new Map;for(let t of e)n.set(`${t.relativePath}\0${t.line}`,t);return[...n.values()].sort(R)}import{InvalidArgumentError as v}from"commander";var St=W,Be=/^[+-]?\d+$/u,je=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,xt=(e=>V(e,"an integer")),pe=(e=>{let n=V(e,"a non-negative integer");if(n<0)throw new v(`Expected a non-negative integer, got "${e}".`);return n}),he=(e=>{let n=V(e,"a positive integer");if(n<1)throw new v(`Expected a positive integer, got "${e}".`);return n}),Et=(e=>{if(!je.test(e))throw new v(`Expected a number, got "${e}".`);let n=Number(e);if(!Number.isFinite(n))throw new v(`Expected a finite number, got "${e}".`);return n});function V(e,n){if(!Be.test(e))throw new v(`Expected ${n}, got "${e}".`);let t=Number(e);if(!Number.isSafeInteger(t))throw new v(`Expected ${n}, got "${e}".`);return t}function h(e,n,t,...o){return o.length>0?{flags:e,description:n,parser:t,defaultValue:o[0]}:{flags:e,description:n,parser:t}}function Ge(){return h("--json","Output as JSON for programmatic consumption")}function Fe(){return h("--compact","Emit minified one-line JSON (use with --json)")}function Ve(){return h("--result-only","Emit only the command-owned result (use with --json)")}function Ce(e=[]){return I(e)}function I(e=[]){let n=[Ge(),Ve(),Fe()],t=new Set(n.map(o=>o.flags));return[...e.filter(o=>!t.has(o.flags)),...n]}function $(e,n=[]){return{category:e,examples:n}}function Pt(e,n){return{origin:"mixed",observedSources:e,producerValidation:{status:"not-evaluated"},families:n}}function $t(e,n){return{origin:e,observedSources:n,producerValidation:{status:"not-evaluated"}}}function wt(e,n,t){return{id:e,selector:n,origin:{kind:"fixed",origin:t}}}function Ot(e,n,t,o){return{id:e,selector:n,origin:{kind:"result-field",field:t,values:o}}}function w(e,n,t,o,r,i,s){return{answers:typeof e=="string"?[e]:e,returns:typeof n=="string"?[n]:n,inputs:t,coverage:o,operation:i,semantic:s,...r?{scope:r}:{}}}function Nt(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,K(s.join(" "),c.join("; "),["This command establishes only its declared result units and evidence contract."],void 0,{outputCost:o==="complete"?"bounded":"variable"}))}function ye(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,Ke(c.join("; "),["This command does not establish repository graph relationships unless its result says so explicitly."]))}function be(e,n,t={ranking:"identity-only"}){return{kind:"locator",locates:e,nonClaims:n,outputCost:"small",frontierClosure:["evidence","inspect","code"],...t}}function Lt(e){return{kind:"graph-projection",outputCost:"bounded",frontierClosure:["inspect","code"],...e}}function Re(e,n,t,o={}){return{kind:"source-read",reads:e,nonClaims:n,outputCost:"potentially-large",frontierClosure:[],...t?{compatibility:t}:{},...o}}function K(e,n,t,o,r={}){return{kind:"analysis",analysis:e,resultMeaning:n,nonClaims:t,outputCost:"bounded",frontierClosure:["inspect","code"],...o?{compatibility:o}:{},...r}}function Ke(e,n,t,o={}){return{kind:"maintenance",effect:e,nonClaims:n,outputCost:"variable",frontierClosure:[],...t?{compatibility:t}:{},...o}}function J(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64url")}function A(e){return e.generation.identity}function U(e){return"after"in e?J({version:2,...e}):J({version:1,...e})}function ve(e,n){let t=_e(e);if(!Je(t)&&!Ue(t))throw new Error("Invalid result cursor. Run the command again without --cursor.");return ze(t,n),t}function Je(e){if(!e||typeof e!="object")return!1;let n=e;return n.version===1&&typeof n.command=="string"&&typeof n.target=="string"&&Number.isSafeInteger(n.offset)&&(n.offset??-1)>=0&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function Ue(e){if(!e||typeof e!="object")return!1;let n=e,t=n.after;return n.version===2&&typeof n.command=="string"&&typeof n.target=="string"&&!!t&&typeof t.relativePath=="string"&&t.relativePath.length>0&&Number.isSafeInteger(t.line)&&(t.line??-1)>=0&&(n.producer==="source-keyset"||n.producer==="complete-only")&&typeof n.semanticEnrichment=="boolean"&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function _e(e){try{return JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{throw new Error("Invalid result cursor. Run the command again without --cursor.")}}function ze(e,n){if(e.command!==n.command||e.target!==n.target)throw new Error("This cursor belongs to a different command or target. Run again without --cursor.");if(e.indexGeneration!==n.indexGeneration)throw new Error("The index changed after this cursor was issued. Run again without --cursor.")}function Se(e,n){let t=L(e,n),o=qe(t);for(let r of o)console.log(r)}function xe(e,n,t="No results found for resolved symbol."){return L(e,n).match?t:z(n,M(e,n,5))}function _(e,n,t,o){return{...D(e,n),[o]:t}}function D(e,n){let t=L(e,n);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:T(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(o=>({shortName:o.shortName,relativePath:o.relativePath,startLine:o.startLine})),totalMatches:t.total}:{matched:!1,suggestions:M(e,n,5)}}function z(e,n){let t=`No definition matched '${e}'.`;return n.length>0?`${t} Suggestions: ${n.join(", ")}`:t}function qe(e){if(!e.match||e.total<=1)return[];let n=e.match,t=Math.max(0,e.total-1),o=[`Resolved: ${T(n.symbol)} (${n.relativePath}) -- ${t} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=e.candidates.slice(0,3);return r.length>0&&o.push(`Alternates: ${r.map(i=>`${i.shortName} (${i.relativePath}:${g(i.startLine)})`).join("; ")}`),o.push(""),o}var We=k(({db:e,args:n,opts:t})=>{let o=B(n,0),r=b(t,"signatures"),i=se(e,o);if(b(t,"json")){P("outline",n,t,i);return}if(console.log(`\u2550\u2550\u2550 REQUEST \u2550\u2550\u2550
2
+ import{A as G,D as P,a as y,b as ce,i as k,j as le,t as B,u as de,w as j,x as ue,y as b}from"./chunk-FIXYHQ3W.js";import{c as Y,d as H,e as Z,g as X,i as ee,k as x}from"./chunk-PHPQ24UG.js";import{E,a as g,b as Q,c as C,e as S,v as se,x as ae}from"./chunk-N3Q3AWGW.js";import{la as W}from"./chunk-W3FK73MD.js";import{Ga as N,Ha as L,Ja as M,V as te,Wa as oe,Xa as re,Za as ie,ga as T,ka as ne}from"./chunk-RJWAB4VR.js";function ge(e,n,t){if(!Number.isSafeInteger(t.limit)||t.limit<=0)throw new Error("Reference page limit must be a positive safe integer.");let o=N(e,n);if(!o)return{rows:[],hasMore:!1,producer:t.producer??"source-keyset",semanticEnrichment:!1};if(t.producer==="complete-only"||t.semantic===!0||o.relativePath.endsWith(".rb"))return F(e,n,t);let i=oe(e,o);if(!i)return F(e,n,t);let s=fe(e,o),c=Te(e,s),a=[],l=t.producer==="source-keyset";for(let u of c){if(t.after&&u<t.after.relativePath)continue;t.instrumentation?.fileScanned?.(u);let f=re(e,i,u);f.length>0&&(l=!0);let d=new Set(f);s?.relativePath===u&&d.add(s.line);for(let m of[...d].sort((p,Ae)=>p-Ae)){let p={relativePath:u,line:m};if(!(t.after&&R(p,t.after)<=0)&&(a.push(p),t.instrumentation?.rowAccepted?.(p),l&&a.length>t.limit))return me(a,t.limit)}}return l?me(a,t.limit):F(e,n,t,s)}function R(e,n){return(e.relativePath<n.relativePath?-1:e.relativePath>n.relativePath?1:0)||e.line-n.line}function me(e,n){return{rows:e.slice(0,n),hasMore:e.length>n,producer:"source-keyset",semanticEnrichment:!1}}function F(e,n,t,o){let r=N(e,n),i=t.semantic===!0||r?.relativePath.endsWith(".rb")?E(e,n,{semantic:t.semantic}):De(e,n,o),s=Me(i).filter(c=>!t.after||R(c,t.after)>0);for(let c of s.slice(0,t.limit+1))t.instrumentation?.rowAccepted?.(c);return{rows:s.slice(0,t.limit),hasMore:s.length>t.limit,producer:"complete-only",semanticEnrichment:t.semantic===!0}}function De(e,n,t){let o=N(e,n);if(!o)return[];let r=t===void 0?fe(e,o):t,i=ie(e,o).map(s=>({relativePath:s.file,line:s.line}));return r?[r,...i]:i}function fe(e,n){return!ne(n.symbol)&&!e.isIgnored(n.relativePath)?{relativePath:n.relativePath,line:n.startLine}:null}function Te(e,n){let t=te(e);return!n||t.includes(n.relativePath)?t:[...t,n.relativePath].sort((o,r)=>o<r?-1:o>r?1:0)}function Me(e){let n=new Map;for(let t of e)n.set(`${t.relativePath}\0${t.line}`,t);return[...n.values()].sort(R)}import{InvalidArgumentError as v}from"commander";var St=W,Be=/^[+-]?\d+$/u,je=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,xt=(e=>V(e,"an integer")),pe=(e=>{let n=V(e,"a non-negative integer");if(n<0)throw new v(`Expected a non-negative integer, got "${e}".`);return n}),he=(e=>{let n=V(e,"a positive integer");if(n<1)throw new v(`Expected a positive integer, got "${e}".`);return n}),Et=(e=>{if(!je.test(e))throw new v(`Expected a number, got "${e}".`);let n=Number(e);if(!Number.isFinite(n))throw new v(`Expected a finite number, got "${e}".`);return n});function V(e,n){if(!Be.test(e))throw new v(`Expected ${n}, got "${e}".`);let t=Number(e);if(!Number.isSafeInteger(t))throw new v(`Expected ${n}, got "${e}".`);return t}function h(e,n,t,...o){return o.length>0?{flags:e,description:n,parser:t,defaultValue:o[0]}:{flags:e,description:n,parser:t}}function Ge(){return h("--json","Output as JSON for programmatic consumption")}function Fe(){return h("--compact","Emit minified one-line JSON (use with --json)")}function Ve(){return h("--result-only","Emit only the command-owned result (use with --json)")}function Ce(e=[]){return I(e)}function I(e=[]){let n=[Ge(),Ve(),Fe()],t=new Set(n.map(o=>o.flags));return[...e.filter(o=>!t.has(o.flags)),...n]}function $(e,n=[]){return{category:e,examples:n}}function Pt(e,n){return{origin:"mixed",observedSources:e,producerValidation:{status:"not-evaluated"},families:n}}function $t(e,n){return{origin:e,observedSources:n,producerValidation:{status:"not-evaluated"}}}function wt(e,n,t){return{id:e,selector:n,origin:{kind:"fixed",origin:t}}}function Ot(e,n,t,o){return{id:e,selector:n,origin:{kind:"result-field",field:t,values:o}}}function w(e,n,t,o,r,i,s){return{answers:typeof e=="string"?[e]:e,returns:typeof n=="string"?[n]:n,inputs:t,coverage:o,operation:i,semantic:s,...r?{scope:r}:{}}}function Nt(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,K(s.join(" "),c.join("; "),["This command establishes only its declared result units and evidence contract."],void 0,{outputCost:o==="complete"?"bounded":"variable"}))}function ye(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,Ke(c.join("; "),["This command does not establish repository graph relationships unless its result says so explicitly."]))}function be(e,n,t={ranking:"identity-only"}){return{kind:"locator",locates:e,nonClaims:n,outputCost:"small",frontierClosure:["evidence","inspect","code"],...t}}function Lt(e){return{kind:"graph-projection",outputCost:"bounded",frontierClosure:["inspect","code"],...e}}function Re(e,n,t,o={}){return{kind:"source-read",reads:e,nonClaims:n,outputCost:"potentially-large",frontierClosure:[],...t?{compatibility:t}:{},...o}}function K(e,n,t,o,r={}){return{kind:"analysis",analysis:e,resultMeaning:n,nonClaims:t,outputCost:"bounded",frontierClosure:["inspect","code"],...o?{compatibility:o}:{},...r}}function Ke(e,n,t,o={}){return{kind:"maintenance",effect:e,nonClaims:n,outputCost:"variable",frontierClosure:[],...t?{compatibility:t}:{},...o}}function J(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64url")}function A(e){return e.generation.identity}function U(e){return"after"in e?J({version:2,...e}):J({version:1,...e})}function ve(e,n){let t=_e(e);if(!Je(t)&&!Ue(t))throw new Error("Invalid result cursor. Run the command again without --cursor.");return ze(t,n),t}function Je(e){if(!e||typeof e!="object")return!1;let n=e;return n.version===1&&typeof n.command=="string"&&typeof n.target=="string"&&Number.isSafeInteger(n.offset)&&(n.offset??-1)>=0&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function Ue(e){if(!e||typeof e!="object")return!1;let n=e,t=n.after;return n.version===2&&typeof n.command=="string"&&typeof n.target=="string"&&!!t&&typeof t.relativePath=="string"&&t.relativePath.length>0&&Number.isSafeInteger(t.line)&&(t.line??-1)>=0&&(n.producer==="source-keyset"||n.producer==="complete-only")&&typeof n.semanticEnrichment=="boolean"&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function _e(e){try{return JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{throw new Error("Invalid result cursor. Run the command again without --cursor.")}}function ze(e,n){if(e.command!==n.command||e.target!==n.target)throw new Error("This cursor belongs to a different command or target. Run again without --cursor.");if(e.indexGeneration!==n.indexGeneration)throw new Error("The index changed after this cursor was issued. Run again without --cursor.")}function Se(e,n){let t=L(e,n),o=qe(t);for(let r of o)console.log(r)}function xe(e,n,t="No results found for resolved symbol."){return L(e,n).match?t:z(n,M(e,n,5))}function _(e,n,t,o){return{...D(e,n),[o]:t}}function D(e,n){let t=L(e,n);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:T(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(o=>({shortName:o.shortName,relativePath:o.relativePath,startLine:o.startLine})),totalMatches:t.total}:{matched:!1,suggestions:M(e,n,5)}}function z(e,n){let t=`No definition matched '${e}'.`;return n.length>0?`${t} Suggestions: ${n.join(", ")}`:t}function qe(e){if(!e.match||e.total<=1)return[];let n=e.match,t=Math.max(0,e.total-1),o=[`Resolved: ${T(n.symbol)} (${n.relativePath}) -- ${t} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=e.candidates.slice(0,3);return r.length>0&&o.push(`Alternates: ${r.map(i=>`${i.shortName} (${i.relativePath}:${g(i.startLine)})`).join("; ")}`),o.push(""),o}var We=k(({db:e,args:n,opts:t})=>{let o=B(n,0),r=b(t,"signatures"),i=se(e,o);if(b(t,"json")){P("outline",n,t,i);return}if(console.log(`\u2550\u2550\u2550 REQUEST \u2550\u2550\u2550
3
3
  file=${JSON.stringify(o)}; signatures=${r?"shown":"hidden"}`),i.length===0){console.log(`
4
4
  \u2550\u2550\u2550 OBSERVED FACTS \u2550\u2550\u2550
5
5
  No compiler-owned constructs were found for ${JSON.stringify(o)}.`),console.log(`
@@ -28,4 +28,4 @@ ${p}continue with --cursor ${d.cursor}`)}});function Ye(e,n,t){let o=E(e,n,{sema
28
28
  `),o=0,r=0;for(let i=0;i<t.length;i++){let s=t[i].length+12;i>o&&r+s>Ee&&(n.push(`${e.relativePath}:${g(e.startLine+o)}-${g(e.startLine+i-1)}`),o=i,r=0),r+=s}return n.push(`${e.relativePath}:${g(e.startLine+o)}-${g(e.endLine)}`),n}function Pe(e,n){return{requested:n.length,matched:n.filter(t=>t.status==="matched").length,ambiguous:n.filter(t=>t.status==="ambiguous").length,missing:n.filter(t=>t.status==="missing").length,entries:[...n],bindingClosure:e.bindingClosure}}function $e(e,n){return["codebaseiq","code",...e.map(O),...n.members==="all"?["--members","all"]:[],...n.context>0?["--context",String(n.context)]:[]].join(" ")}function dt(e,n,t){if(!t)return D(e,n);let o={file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:g(t.startLine),endLine:g(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
29
29
  `).map((s,c)=>({line:g(t.startLine+c),text:s}))},r=D(e,n),i=r.totalMatches??0;return!r.matched||!r.resolved||i<=1?o:{...o,resolution:{selected:r.resolved,alternatives:r.otherMatches??[],totalMatches:i}}}function ut(e){return{requested:e.requested,matched:e.matched,ambiguous:e.ambiguous,missing:e.missing,entries:e.entries.map(n=>({selector:n.selector,status:n.status,kind:n.kind,totalCandidates:n.totalCandidates,sources:n.results.map(t=>({file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:g(t.startLine),endLine:g(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
30
30
  `).map((o,r)=>({line:g(t.startLine+r),text:o}))})),definitions:n.definitions,...n.fileCoverage?{fileCoverage:n.fileCoverage}:{},...n.rangeCoverage?{rangeCoverage:n.rangeCoverage}:{},candidates:n.candidates,omittedCandidates:n.omittedCandidates,suggestions:n.suggestions,...n.reason?{reason:n.reason}:{}})),literalValues:e.bindingClosure.inline}}function O(e){return`'${e.replaceAll("'","'\\''")}'`}var Zt=[{id:"session",command:"session",description:"Show evidence already delivered in this agent exploration session",options:[h("--reset","Clear this agent exploration-session ledger")],agent:ye("Which indexed source ranges and graph facts have already been delivered in this exploration session?","prior command ordinals, exact source ranges, and content-bound graph receipts",[],"complete","repository",ce("repository-observation",[{when:{kind:"option",name:"reset",equals:!0},role:"mutation"}])),renderShape:"custom",docs:$("Navigation"),handler:et},{id:"refs",command:"refs <symbol>",description:"Find all files referencing a symbol",options:Ce([h("--full","Run unbounded semantic analysis on large indexes"),h("-n, --limit <n>","Maximum reference sites to return",he),h("--cursor <cursor>","Continue a prior bounded result (implies --limit 50 when omitted)")]),budget:"semantic",agent:{operation:y,answers:["Which files reference this symbol?","Is this symbol used anywhere, or only defined?"],returns:["referencing file paths","reference line numbers grouped by file"],inputs:["symbol"],coverage:"bounded",semantic:K("Resolve the exact reference sites attributed to one compiler symbol identity.","Referencing file paths and reference line numbers grouped by file.",["Reference sites do not establish runtime execution, data flow, or task relevance."]),contrasts:[{command:"imported-by",distinction:"imported-by lists files importing the symbol; refs covers every reference site, imported or not."},{command:"affected",distinction:"refs is one hop out; affected is the transitive closure of what could break."}]},renderShape:"grouped-by-file",docs:$("Navigation",["codebaseiq refs login"]),handler:Qe},{id:"outline",command:"outline <file>",description:"Tree view of symbols in a file, with line ranges",agent:{...w("What symbols and nesting exist in this file?","symbol names, nesting, and line ranges",["file"],"complete",void 0,y,be(["file","symbol","construct"],["File ownership and nesting do not establish execution or task relevance."],{ranking:"identity-only",manualInput:"One exact current project file path.",evidenceCeiling:"Exact compiler-owned constructs and ranges when the file is indexed; no invented semantic overlay."})),contrasts:[{command:"search",distinction:"outline enumerates constructs in one known file; search locates exact text across current project text."},{command:"code",distinction:"outline returns identities and ranges; code materializes exact source for selected identities."}]},options:I([h("--signatures","Show trimmed symbol signatures")]),renderShape:"custom",docs:$("Navigation"),handler:We},{id:"code",command:"code <selectors...>",description:"Read exact definitions, ranges with local call closure, or file export surfaces",agent:{...w("What exact source defines these symbols, ranges, or file surfaces?","per-selector resolution, complete definition source, exact ranges with statically attributed same-file call closure, file export surfaces, omitted-local ledgers, and line ranges",[["symbol","file"]],"complete",void 0,y,Re(["construct","exact-source"],["Source materialization does not establish callers, runtime reachability, or task relevance by itself."],void 0,{manualInput:"One or more exact symbols, file:line ranges, or file paths.",evidenceCeiling:"Exact current source bytes for every resolved selector, with omitted file-local constructs disclosed."})),resultUnits:{kind:"field",field:"code"},contrasts:[{command:"inspect",distinction:"code materializes complete exact source; inspect batches bounded behavior or source gaps."},{command:"outline",distinction:"code reads selected implementations; outline enumerates file structure without reading every body."}]},options:I([h("-C, --context <n>","Extra lines of context above/below",pe,0),h("--members <exported|all>","For file selectors, return the exported surface or the complete file",void 0,"exported")]),renderShape:"custom",docs:$("Navigation",["codebaseiq code parseRequest handleRequest","codebaseiq code src/api.ts src/web.ts"]),handler:Xe}];export{St as a,xt as b,pe as c,he as d,Et as e,h as f,Fe as g,Ce as h,I as i,$ as j,Pt as k,$t as l,wt as m,Ot as n,w as o,Nt as p,ye as q,be as r,Lt as s,Re as t,K as u,Se as v,xe as w,_ as x,D as y,Zt as z};
31
- //# sourceMappingURL=chunk-KWVHSKHK.js.map
31
+ //# sourceMappingURL=chunk-FPDL2TUB.js.map
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import{K as yt,f as mt,g as pt,p as Z,q as W,r as de,s as Et}from"./chunk-N3Q3AWGW.js";import{b as X,c as be,d as Ke,e as Ve,f as Ge,i as qe,j as ze,k as Je}from"./chunk-W3FK73MD.js";import{a as Ct}from"./chunk-EN4AHLL3.js";import{Ca as Ee,Da as ut,J as tt,K as nt,L as rt,Lb as St,M as ot,Mb as vt,Na as ft,b as Xe,c as he,cb as gt,db as bt,eb as ht,ha as st,ia as at,ja as it,qa as dt,r as Ye,ra as ct,t as Qe,u as Ze,ua as lt,v as et}from"./chunk-RJWAB4VR.js";import{J as ge,K as ie,L as H,M as J,T as je,u as We}from"./chunk-G2XUZCF2.js";import{o as He,q as pe}from"./chunk-DUKHVPU5.js";import{join as De}from"path";import{createHash as Rn}from"crypto";import{mkdirSync as Pt,mkdtempSync as Pn,renameSync as An,rmSync as At,statSync as _n,writeFileSync as _t}from"fs";import{tmpdir as Tn}from"os";import{extname as Nn,join as ee,resolve as Mn,sep as Bn}from"path";var On=1024*1024,kt=500,Ln=64,Fn=/\.(?:cmd|bat)$/i;async function Tt(e,t,n={}){let r=Se(e);if(!r.ok)return D(r.reason,r.detail);let a=JSON.stringify(Ke),o;try{Pt(t.workDir,{recursive:!0}),o=Pn(ee(Tn(),"codebaseiq-probe-")),e.argv.includes("{schemaFile}")&&_t(ee(o,"schema.json"),a)}catch(s){return xt(o),D("spawn-failed",`could not prepare the agent sandbox: ${te(In(s))}`)}try{let s=ee(o,"schema.json"),d=ee(o,"output.json"),i=e.argv.includes("{outputFile}"),l=new Map([["{schemaJson}",a],["{schemaFile}",s],["{outputFile}",d]]),c=bt(r.path,e.argv.slice(1).map(S=>l.get(S)??S)),p;try{p=await vt({command:c.binary,args:c.args,label:`agent probe command ${e.name}`,timeoutMs:e.timeoutMs,maxStdoutBytes:e.maxOutputBytes,maxStderrBytes:On,cwd:t.workDir,env:Un(n.env??process.env),input:Ge(t.description,t.languages),signal:n.signal})}catch(S){return Hn(S,n.signal)}if(p.status!==0){let S=wt(p.stdout),b=p.status===null?`signal ${p.signal}`:`code ${p.status}`,m=S.kind==="error"?S.detail:p.stderr.trim()||p.stdout.trim();return D("agent-error",`${e.name} exited with ${b}: ${te(m)}`)}let g=[];if(i){let S=Wn(d,e.maxOutputBytes);if(S==="too-large")return D("output-too-large",`${e.name} wrote more than ${e.maxOutputBytes} bytes.`);S!==null&&g.push(S)}g.push(p.stdout);for(let S of g){let b=wt(S);if(b.kind==="error")return D("agent-error",b.detail);if(b.kind==="none")continue;let{probes:m,diagnostics:x}=be(b.value);return X(m)?{ok:!0,probes:m,diagnostics:x,raw:S.trim()}:D("invalid-probes",Vn(x))}return D("no-json",`${e.name} printed no JSON object: ${te(p.stdout.trim())}`)}finally{xt(o)}}function xt(e){if(e!==void 0)try{At(e,{recursive:!0,force:!0,maxRetries:3})}catch{}}function In(e){return e instanceof Error?e.message:String(e)}function D(e,t){return{ok:!1,reason:e,detail:t}}function Dn(e){let t=ze({agent:{commands:[e]}}).filter(n=>n.level==="error");return t.length>0?t.map(n=>`${n.path}: ${n.message}`).join(" "):Je.has(e.argv[0])?"argv[0] must be the executable, not a placeholder.":[e.timeoutMs,e.maxOutputBytes].every(n=>Number.isFinite(n)&&n>0)?null:"timeoutMs and maxOutputBytes must be positive numbers."}function Se(e){let t=Dn(e);if(t)return{ok:!1,reason:"misconfigured",detail:t};let n=e.argv[0],r=`argv[0] "${n}" is a .cmd/.bat shim, which cannot be started without a shell. Point argv[0] at the real executable or at a node script (.js, .mjs, .cjs).`,a=n.includes("/")||n.includes(Bn),o;if(a){o=$n(Mn(n));let s=ye(o);if(s==="missing")return{ok:!1,reason:"spawn-failed",detail:`argv[0] "${n}" was not found.`};if(s==="other")return{ok:!1,reason:"misconfigured",detail:`argv[0] "${n}" is not an executable file.`}}else o=ht(n);return o===null?gt(n)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!1,reason:"spawn-failed",detail:`argv[0] "${n}" was not found on PATH.`}:process.platform==="win32"&&Fn.test(o)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!0,path:o}}function $n(e,t=process.platform){return t!=="win32"||Nn(e)!==""||ye(e)!=="missing"?e:[".exe",".com"].map(n=>`${e}${n}`).find(n=>ye(n)==="file")??e}function ye(e){try{return _n(e).isFile()?"file":"other"}catch{return"missing"}}function Un(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&!/^CODEBASEIQ_/i.test(n)&&(t[n]=r);return t}function Hn(e,t){if(!(e instanceof St))throw e;switch(e.kind){case"spawn":return D("spawn-failed",e.message);case"timeout":return D("timeout",e.message);case"stdout-limit":case"stderr-limit":return D("output-too-large",e.message);case"aborted":throw t?H(t,e.message):e}}function Wn(e,t){try{return pe(e,{maxBytes:t,inputKind:"agent output file"})}catch(n){return n instanceof He&&n.reason==="too-large"?"too-large":null}}function wt(e){let t=Rt(e);if(!t)return{kind:"none"};if(t.type!=="result")return{kind:"object",value:t};if(t.is_error===!0){let r=typeof t.result=="string"&&t.result?t.result:t.subtype;return{kind:"error",detail:te(`The agent reported an error: ${String(r??"no message")}`)}}if(Mt(t.structured_output))return{kind:"object",value:t.structured_output};let n=typeof t.result=="string"?Rt(t.result):null;return n?{kind:"object",value:n}:{kind:"none"}}function Rt(e){let t=e.trim();return Nt(t)??jn(t)}function Nt(e){try{let t=JSON.parse(e);return Mt(t)?t:null}catch{return null}}function jn(e){let t=/\{\s*["}]/g,n=null,r=0;for(let a=0;a<Ln;){t.lastIndex=r;let o=t.exec(e);if(!o)break;let s=Kn(e,o.index),d=s===-1?null:Nt(e.slice(o.index,s+1));d?(n=d,r=s+1):(r=o.index+1,a++)}return n}function Kn(e,t){let n=0,r=!1,a=!1;for(let o=t;o<e.length;o++){let s=e[o];if(r)a?a=!1:s==="\\"?a=!0:s==='"'&&(r=!1);else if(s==='"')r=!0;else if(s==="{")n++;else if(s==="}"&&--n===0)return o}return-1}function Mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Vn(e){return e.length===0?"The agent returned no usable probes.":te(`The agent returned no usable probes: ${e.slice(0,3).map(t=>`${t.path||"root"}: ${t.message}`).join("; ")}`)}function te(e){return e.length>kt?`${e.slice(0,kt)}...`:e}var Gn=64*1024,qn=3600*1e3;function Bt(e,t,n=Date.now){let r=(a,o)=>ee(e,`${Rn("sha256").update(JSON.stringify([a,3,o])).digest("hex")}.json`);return{get(a,o){try{let s=JSON.parse(pe(r(a,o),{maxBytes:Gn,inputKind:"agent probe cache entry"}));if(typeof s.storedAt!="number"||n()-s.storedAt>=t*qn)return;let{probes:d}=be(s.probes);return X(d)?d:void 0}catch{return}},set(a,o,s){let d=r(a,o),i=`${d}.${process.pid}.tmp`;try{Pt(e,{recursive:!0}),_t(i,JSON.stringify({storedAt:n(),probes:s})),An(i,d)}catch{try{At(i,{force:!0})}catch{}}}}}import{BlockList as zn,isIP as Jn}from"net";var Ce=64*1024*1024,Xn=2,Ot="embedding request aborted",Yn="codebaseiq embedding canary: parse a retry delay from a config file",N=class extends Error{constructor(n,r,a){super(r);this.kind=n;this.status=a;this.name="EmbeddingClientError"}kind;status},ne=new zn;for(let[e,t]of[["127.0.0.0",8],["10.0.0.0",8],["172.16.0.0",12],["192.168.0.0",16],["100.64.0.0",10],["169.254.0.0",16]])ne.addSubnet(e,t,"ipv4");ne.addAddress("::1","ipv6");ne.addSubnet("fe80::",10,"ipv6");ne.addSubnet("fc00::",7,"ipv6");var Qn=[".local",".lan",".home.arpa",".internal"];function Lt(e){let t;try{t=new URL(e).hostname}catch{return!1}let n=(t.startsWith("[")?t.slice(1,-1):t).replace(/\.$/,""),r=Jn(n);return r!==0?ne.check(n,r===4?"ipv4":"ipv6"):n==="localhost"||Qn.some(a=>n.endsWith(a))}function Dt(e,t={}){let n=t.fetchImpl??fetch,r=t.env??process.env,a=e.baseUrl.replace(/\/+$/,"");function o(){let c=e.apiKeyEnv?r[e.apiKeyEnv]:void 0;return c||void 0}function s(){let c;try{c=new URL(e.baseUrl)}catch{throw new N("invalid-endpoint",`embedding endpoint "${e.name}" has an invalid baseUrl`)}if(c.protocol!=="http:"&&c.protocol!=="https:")throw new N("invalid-endpoint",`embedding endpoint "${e.name}" must use http or https`);if(c.username!==""||c.password!=="")throw new N("invalid-endpoint",`embedding endpoint "${e.name}" must not embed credentials in baseUrl; use apiKeyEnv`);if(!e.allowRemote&&!Lt(e.baseUrl))throw new N("remote-not-allowed",`embedding endpoint "${e.name}" is not on a private network; set allowRemote to use it`);if(c.protocol==="http:"&&o()!==void 0&&!Lt(e.baseUrl))throw new N("insecure-token-transport",`embedding endpoint "${e.name}" would send its API key over plain http to a non-private host; use https`)}function d(c){let p={};c&&(p["content-type"]="application/json");let g=o();return g&&(p.authorization=`Bearer ${g}`),p}async function i(c,p,g,S){let b={model:e.model,input:c,encoding_format:"float",...e.dimensions!==void 0?{dimensions:e.dimensions}:{}},{status:m,text:x}=await Ft(n,`${a}/embeddings`,{method:"POST",headers:d(!0),body:JSON.stringify(b)},p,!0,S);if(m<200||m>=300)throw new N("http",`embeddings request failed with HTTP ${m}`,m);return nr(x,c.length,g)}async function l(c,p,g){try{return await i(c,e.requestTimeoutMs,p,g)}catch(S){if(!Zn(S))throw S;return i(c,e.requestTimeoutMs,p,g)}}return{async checkHealth({signal:c}={}){try{s()}catch(g){return ve(g)}try{await Ft(n,`${a}/models`,{method:"GET",headers:d(!1)},e.healthTimeoutMs,!1,c)}catch(g){return c?.aborted?ve(g,c):{ok:!1,reason:"unreachable",detail:ke(g)}}let p=ge();try{let[g]=await i([e.documentPrefix+Yn],e.warmTimeoutMs,{dims:e.dimensions},c);return{ok:!0,model:e.model,dimensions:g.length,latencyMs:Math.round(ge()-p),canary:g}}catch(g){return ve(g,c)}},async embed(c,p,{signal:g}={}){if(s(),c.length===0)return[];let S=p==="query"?e.queryPrefix:e.documentPrefix,b=Math.max(1,Math.floor(e.batchSize)),m=[];for(let R=0;R<c.length;R+=b)m.push(c.slice(R,R+b).map(A=>S+A));let x={dims:e.dimensions};return(await Ct(m,Xn,R=>l(R,x,g))).flat()}}}function Zn(e){return e instanceof N&&(e.kind==="timeout"||e.kind==="http"&&(e.status??0)>=500)}function ve(e,t){let n=ke(e);if(t?.aborted)return{ok:!1,reason:"aborted",detail:n};if(!(e instanceof N))return{ok:!1,reason:"bad-response",detail:n};switch(e.kind){case"remote-not-allowed":case"insecure-token-transport":case"invalid-endpoint":return{ok:!1,reason:e.kind,detail:n};case"network":return{ok:!1,reason:"unreachable",detail:n};case"timeout":return{ok:!1,reason:"model-loading",detail:n};case"http":return e.status===503?{ok:!1,reason:"model-loading",detail:n}:e.status===401||e.status===403?{ok:!1,reason:"unauthorized",detail:n}:{ok:!1,reason:"bad-response",detail:n};default:return{ok:!1,reason:"bad-response",detail:n}}}function ke(e){return e instanceof Error?e.message:String(e)}async function Ft(e,t,n,r,a,o){J(o,Ot);let s=new AbortController,d=setTimeout(()=>{s.abort(new N("timeout",`no response within ${r}ms`))},r),i=()=>s.abort(o?.reason);o?.addEventListener("abort",i,{once:!0});try{let l=await $t(e(t,{...n,signal:s.signal,redirect:"error"}),s.signal);return{status:l.status,text:a?await tr(l,s.signal):""}}catch(l){throw o?.aborted&&s.signal.reason===o.reason?H(o,Ot):l instanceof N?l:s.signal.aborted&&s.signal.reason instanceof N?s.signal.reason:new N("network",`could not reach the embeddings endpoint: ${er(l)}`)}finally{clearTimeout(d),o?.removeEventListener("abort",i),s.abort()}}function er(e){let t=e instanceof Error?e.cause:void 0;return typeof t?.code=="string"?t.code:ke(e)}async function tr(e,t){let n=Number(e.headers.get("content-length"));if(Number.isFinite(n)&&n>Ce)throw It();if(!e.body)return"";let r=e.body.getReader(),a=[],o=0;for(;;){let{done:s,value:d}=await $t(r.read(),t);if(s)break;if(o+=d.byteLength,o>Ce)throw r.cancel().catch(()=>{}),It();a.push(d)}return new TextDecoder().decode(Buffer.concat(a))}function It(){return new N("too-large",`embeddings response exceeded the ${Ce} byte limit`)}function $t(e,t){return new Promise((n,r)=>{let a=()=>r(t.reason);if(t.aborted){a();return}t.addEventListener("abort",a,{once:!0}),e.then(n,r).finally(()=>t.removeEventListener("abort",a))})}function nr(e,t,n){let r;try{r=JSON.parse(e)}catch{throw j("response is not valid JSON")}let a=typeof r=="object"&&r!==null?r.data:void 0;if(!Array.isArray(a)||a.length!==t)throw j(`expected ${t} embeddings, received ${Array.isArray(a)?a.length:"none"}`);let o=new Array(t).fill(void 0),s=new Set;return a.forEach((d,i)=>{let l=typeof d=="object"&&d!==null?d:{},c=l.index===void 0?i:l.index;if(typeof c!="number"||!Number.isInteger(c)||c<0||c>=t||s.has(c))throw j("embedding indexes are not a permutation of the inputs");s.add(c),o[c]=l.embedding}),o.map(d=>rr(d,n))}function rr(e,t){if(!Array.isArray(e)||e.length===0)throw j("embedding is not a non-empty float array");if(t.dims!==void 0&&e.length!==t.dims)throw j(`embedding has ${e.length} dimensions, expected ${t.dims}`);let n=0;for(let o of e){if(typeof o!="number"||!Number.isFinite(o))throw j("embedding contains a non-finite value");n+=o*o}let r=Math.sqrt(n);if(!Number.isFinite(r)||r===0)throw j("embedding has zero or unrepresentable magnitude");t.dims=e.length;let a=new Float32Array(e.length);for(let o=0;o<e.length;o+=1)a[o]=e[o]/r;return a}function j(e){return new N("bad-response",`embeddings response rejected: ${e}`)}import{createHash as Kt}from"crypto";var Ut=2,Ht=200,or=new Set(["string","template_string","string_literal","raw_string_literal","char_literal","concatenated_string"]),sr={class_declaration:"name",abstract_class_declaration:"name",class:"name",class_definition:"name",trait_item:"name",impl_item:"type",mod_item:"name"},Wt=Ye({kind:"callable-units",invalidation:Qe("callable-units"),serialize:e=>JSON.stringify({version:Ut,...e}),deserialize:e=>{try{let t=JSON.parse(e);return t.version!==Ut?null:{language:t.language,contentHash:t.contentHash,units:t.units}}catch{return null}}});function ar(e){return Kt("sha256").update(e).digest("hex")}function Vt(e,t,n){let r=ar(n),a=Wt.read(e,t,r);if(a&&a.contentHash===r)return a;let o=tt(e,t,n);if(!o)return null;let s={language:o.language,contentHash:r,units:ir(o.tree,o.language)};return Wt.write(e,t,r,s),s}function ir(e,t){let n=[],r=new Map,a=[],o=s=>{let d=ot(s,t),i=d?.functionNode.childForFieldName("body");if(d&&i){let c=`${a.join(".")}#${d.name}`,p=r.get(c)??0;r.set(c,p+1),n.push(dr(d.name,[...a],p,d.definitionNode,i,t)),a.push(d.name);for(let g of s.children)o(g);a.pop();return}let l=cr(s);l&&a.push(l);for(let c of s.children)o(c);l&&a.pop()};return o(e.rootNode),n}function dr(e,t,n,r,a,o){let s=[],d=[],i=new Set,l=c=>{if(rt(c))return;let p=nt(c,o);if(p&&i.add(p.calleeLeaf),or.has(c.type)){s.push(c.text.replace(/\r\n/g,`
3
+ `)),d.push("\0L");return}if(c.childCount===0){s.push(c.text),d.push(c.text);return}for(let g of c.children)l(g)};return l(a),{name:e,container:t,ordinal:n,startLine:r.startPosition.row,endLine:r.endPosition.row,bodyStartLine:a.startPosition.row,bodyLines:a.text.split(/\r?\n/).filter(c=>c.trim().length>0).length,tokenCount:s.length,signature:lr(r,a),exactHash:jt(s),shapeHash:jt(d),calleeLeaves:[...i].sort(),exported:fr(r)}}function cr(e){let t=sr[e.type];return t?e.childForFieldName(t)?.text??null:null}function lr(e,t){let n=e.text.lastIndexOf(t.text),a=(n>=0?e.text.slice(0,n):ur(e.text)).replace(/\s+/g," ").trim().replace(/[=:]?\s*$/,"").trim();return a.length>Ht?`${a.slice(0,Ht-1)}\u2026`:a}function ur(e){let t=e.indexOf(`
4
+ `);return t>=0?e.slice(0,t):e}function fr(e){if(e.namedChildren.some(n=>n.type==="visibility_modifier"&&n.text.startsWith("pub")))return!0;let t=e;for(let n=0;t&&n<3;n++,t=t.parent)if(t.type==="export_statement")return!0;return!1}function jt(e){return Kt("sha256").update(e.join("")).digest("hex").slice(0,24)}var Re=["name","container","doc","signature","path"],mr=1e3,pr=150,gr=400,br=3,xe=/@deprecated\b|#\[deprecated\b|\bdeprecated\s*[:(]/i,Gt=/^\s*(?:\/\/|\/\*|\*|#|@)/,hr=new Set(pt()),Er=/(?:^|\/)(?:__generated__|generated)\/|\.(?:generated|gen|g)\.[a-z0-9]+$|\.pb2?\.[a-z0-9]+$|_pb2?\.[a-z0-9]+$/i,we=/@generated\b|\bcode generated\b.*\bdo not edit\b/i,yr=40,Sr=/^(?:\/\/|--|#(?![[!\w]))/,vr=/^\s*export\s+(?:default\s+)?(?:(?:async\s+)?function|(?:abstract\s+)?class|interface|type|enum|namespace|module|const|let|var)\s+([\p{L}\p{N}_$]+)/u,Cr=/^\s*export\s*\{([^}\n]*)/,kr=/[\p{L}\p{N}_$]+/gu,xr=2,wr=Xe("builder-candidate-corpus",{clearGroups:["whole-project","definition-catalog"]});function Y(e){return wr.get(e,()=>Ar(e))}function $(e,t=2,n=Number.POSITIVE_INFINITY){let r=[],a=[],o=new Set;for(let s of W(e)){if(r.length>=n)break;if(Z.has(s.toLocaleLowerCase()))continue;let d=de(s),i=d[0];if(!(i.length<t||Z.has(i))){r.push(i),a.push(d);for(let l of d)o.add(l)}}return{words:r,variants:a,set:o}}function Pe(e){return W(e).map(Et)}function Rr(e){let t=0,n=0,r=0,a=-1;for(let i=0;i<e.length&&a<0;i+=1){let l=e[i];l==="["?t+=1:l==="]"?t=Math.max(0,t-1):l==="{"?n+=1:l==="}"?n=Math.max(0,n-1):l==="<"?r+=1:l===">"&&e[i-1]!=="="&&e[i-1]!=="-"?r=Math.max(0,r-1):l==="("&&t===0&&n===0&&r===0&&(a=i)}if(a<0)return{params:null,returns:null};let o=0,s=-1;for(let i=a;i<e.length;i+=1){let l=e[i];if(l==="(")o+=1;else if(l===")"&&(o-=1,o===0)){s=i;break}}if(s<0)return{params:e.slice(a+1).trim(),returns:null};let d=e.slice(s+1).trim().replace(/^(?:=>|->|:)\s*/,"").replace(/\s+where\b.*$/,"").replace(/\s*(?:=>|=|\{|:)\s*$/,"").trim();return{params:e.slice(a+1,s).trim(),returns:d||null}}function Pr(e){if(!e)return"";let t=/^\s*```(?:\w+)?\s*\n?[\s\S]*?\n?```/.exec(e);return(t?e.slice(t[0].length):e.includes("|")?e.slice(0,e.indexOf("|")):"").replace(/\s+/g," ").trim().slice(0,mr)}function Ar(e){let t=new Map,n=new Set;for(let s of lt(e)){if(s.symbol.startsWith("local ")||!s.isFunctionLike&&!s.isTypeLike||e.isIgnored(s.relativePath)||Ee(s.relativePath)==="test")continue;let d=`${s.symbol}\0${s.relativePath}`;if(n.has(d))continue;n.add(d);let i=t.get(s.relativePath);i?i.push(s):t.set(s.relativePath,[s])}let r=[];for(let s of[...t.keys()].sort()){let d=et(e,s);if(Wr(s,d))continue;let i=t.get(s),l=Mr(e,s,d,i);for(let c of i){let p=Or(c,l);p&&r.push({definition:c,candidate:p})}}r.sort((s,d)=>s.candidate.file.localeCompare(d.candidate.file)||s.candidate.startLine-d.candidate.startLine||s.candidate.name.localeCompare(d.candidate.name));let a=yt(e,new Set,r.map(({definition:s})=>s.symbolId)),o=r.map(({definition:s,candidate:d})=>{let i=[...a.get(s.symbolId)??[]].filter(([l,c])=>l!==d.file&&c.occurrences>0&&Ee(l)!=="test").map(([l])=>l).sort();return{...d,referencedFrom:i,consumable:d.exported||i.length>0}});return Tr(o,r.map(({definition:s})=>_r(s)))}function _r(e){let{symbolId:t,documentId:n,startLine:r,endLine:a,symbol:o,relativePath:s}=e;return{symbolId:t,documentId:n,startLine:r,endLine:a,symbol:o,relativePath:s}}function Tr(e,t){let n=new Map,r=new Map,a=new Map,o=new Set;return e.forEach((s,d)=>{let i=new Set;for(let l of Re)for(let c of s.fields[l].set)i.add(c);for(let l of i)zt(n,l,d);for(let l of s.fields.name.set)r.set(l,(r.get(l)??0)+1);zt(a,s.name,d);for(let l of s.calleeLeaves)o.add(l)}),{candidates:e,locations:t,byToken:n,nameDocFreq:r,byName:a,calledLeaves:o}}var qt=new WeakMap;function Jt(e,t,n,r){let a=qt.get(t);a||(a=new Map,qt.set(t,a));let o=a.get(n);return o||(o=Nr(e,t.locations[n],t.candidates[n].name),a.set(n,o)),o.get(r)??[]}function Nr(e,t,n){let r=new Map;for(let o of ft(e,[t.symbolId])){if(e.isIgnored(o.relative_path))continue;let s=[o.chunk_start,o.chunk_end],d=r.get(o.relative_path);d?d.push(s):r.set(o.relative_path,[s])}let a=new Map;for(let[o,s]of r){let d=o===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{},i=ut(e,o,n,d);a.set(o,s.flatMap(([l,c])=>{let p=i.filter(g=>g>=l&&g<=c);return p.length>0?p.map(g=>[g,g]):[[l,c]]}))}return a}function zt(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function Mr(e,t,n,r){let a=null;return{lines:n,units:Br(e,t),endLines:r.map(o=>o.endLine).sort((o,s)=>o-s),exportedNames:()=>a??=Ur(n)}}function Br(e,t){let n=new Map,r=Ze(e,t);if(!r)return n;for(let a of Vt(e,t,r)?.units??[]){let o=n.get(a.name);o?o.push(a):n.set(a.name,[a])}return n}function Or(e,t){let{units:n}=t,r=e.isTypeLike?null:Lr(n.get(e.leaf),e.startLine),a=!e.isTypeLike&&(r!==null||it(e.symbol)||hr.has(e.kind??-1));if(!e.isTypeLike&&!a)return null;let o=dt(ct(e.documentation)),s=jr(a&&(!o||!o.includes("("))&&r?r.signature:o??r?.signature??"").slice(0,gr),d=a&&s?Rr(s):{params:null,returns:null},i=Pr(e.documentation),l=Fr(e,r),c=e.leaf;return{symbol:e.symbol,name:c,kind:a?e.parentTypeName?"method":"function":Ir(e,s),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,container:l,doc:i,signature:s||null,paramsText:d.params,returnsText:d.returns,nameWords:Pe(c),fields:{name:$(c),container:$(l??""),doc:$(i,3,pr),signature:$(s),path:$(e.relativePath.replace(/\.[^./]+$/,""))},calleeLeaves:r?.calleeLeaves??[],hasBody:r!==null,exported:r?.exported===!0||Hr(t.exportedNames(),e),deprecated:Dr(t,e,i)}}function Lr(e,t){let n=null;for(let r of e??[]){let a=Math.abs(r.startLine-t);a<=br&&(!n||a<Math.abs(n.startLine-t))&&(n=r)}return n}function Fr(e,t){return e.parentTypeName?e.parentTypeName:e.enclosingSymbol&&at(e.enclosingSymbol)!=="namespace"?st(e.enclosingSymbol)||null:t?.container.at(-1)??null}function Ir(e,t){let r=(/^(?:export\s+)?(?:default\s+)?(?:declare\s+)?(?:abstract\s+)?(class|struct|interface|trait|protocol)\b/.exec(t)?.[1]??mt(e.kind??0)).toLowerCase();return r==="class"||r==="struct"?"class":r==="interface"||r==="trait"||r==="protocol"?"interface":"type"}function Dr(e,t,n){if(xe.test(n))return!0;let{lines:r}=e,a=r[t.startLine];if(a!==void 0&&Gt.test(a)&&xe.test(a))return!0;let o=$r(e.endLines,t.startLine),s=!1;for(let d=t.startLine-1;d>o;d-=1){let i=r[d]?.trim()??"";if(i===""){if(s)continue;return!1}if(!s&&!Gt.test(i))return!1;if(xe.test(i))return!0;s?s=!i.includes("/*"):s=i.endsWith("*/")&&!i.includes("/*")}return!1}function $r(e,t){let n=0,r=e.length;for(;n<r;){let a=n+r>>>1;e[a]<t?n=a+1:r=a}return n>0?e[n-1]:-1}function Ur(e){let t=new Map,n=new Set;return e.forEach((r,a)=>{if(!r.includes("export"))return;let o=vr.exec(r)?.[1];if(o){let s=t.get(o);s?s.push(a):t.set(o,[a])}for(let s of Cr.exec(r)?.[1]?.match(kr)??[])n.add(s)}),{declared:t,listed:n}}function Hr(e,t){if(e.listed.has(t.leaf))return!0;let n=t.startLine-xr;return e.declared.get(t.leaf)?.some(r=>r>=n&&r<=t.startLine)??!1}function Wr(e,t){if(Er.test(e.replace(/\\/g,"/")))return!0;let n=!1;for(let[r,a]of t.slice(0,yr).entries()){let o=a.trim();if(n){if(we.test(o))return!0;n=!o.includes("*/")}else{if(o===""||r===0&&o.startsWith("#!"))continue;if(o.startsWith("/*")){if(we.test(o))return!0;n=!o.includes("*/",2)}else if(Sr.test(o)){if(we.test(o))return!0}else return!1}}return!1}function jr(e){return e.replace(/\s+/g," ").trim()}var Kr={name:1,container:.8,doc:.6,signature:.5,path:.3},Vr=200,Gr=3,qr=5,zr=new Set(["add","apply","build","calculate","call","check","compute","config","context","convert","create","data","default","delete","do","ensure","error","fetch","find","format","get","handle","has","info","init","is","item","load","make","new","normalize","option","param","parse","process","read","remove","resolve","result","run","set","state","type","update","use","validate","value","with","wrap","write"]);function Yt(e,t,n={}){let r=Jr(e,t,n.scope),a=[];for(let o of Yr(e,r)){if(!Zt(r,e.candidates[o]))continue;let s=en(r,e,o);(s.exactName||s.match>0)&&a.push(s)}return a.sort((o,s)=>Number(s.exactName)-Number(o.exactName)||s.match-o.match||s.nameCoverage-o.nameCoverage||o.index-s.index),{plan:r,corpusUnits:e.candidates.filter(o=>Q(r.scope,o)).length,shortlist:a.slice(0,Vr).map(o=>tn(r,e,o)),unresolvedProbes:r.calls.filter(o=>o.status!=="matched").map(o=>({probe:o.probe,status:o.status}))}}function Qt(e,t,n){return Zt(t,e.candidates[n])?tn(t,e,en(t,e,n)):null}function re(e){return e?e.replace(/\\/g,"/").toLowerCase():null}function Q(e,t){return!e||t.file.toLowerCase().includes(e)}function Zt(e,t){return Q(e.scope,t)?e.kinds.size===0||e.kinds.has(t.kind)?!0:(t.kind==="function"||t.kind==="method")&&(e.kinds.has("function")||e.kinds.has("method")):!1}function Jr(e,t,n){let r=new Set,a=i=>{for(let l of W(i))for(let c of de(l))r.add(c)},o=[];for(let i of t.terms){let l=[],c=[];for(let g of i){let S=Ae(g);S.length!==0&&(l.push(g),c.push(S),a(g))}if(c.length===0)continue;let p=Math.max(...c.map(g=>Xr(e,g)));o.push({labels:l,synonyms:c,weight:Math.log((e.candidates.length+1)/(p+1))+1})}let s=t.names.map(Pe).filter(i=>i.length>0);for(let i of t.names)a(i);for(let i of t.calls)a(i);for(let i of[...t.params,...t.returns])a(i);let d=t.calls.map(i=>Zr(e,i));return{groups:o,totalWeight:o.reduce((i,l)=>i+l.weight,0),names:s,vocab:r,calls:d,callTargets:new Set(d.flatMap(i=>i.targets)),params:{label:t.params.join("/"),words:t.params.flatMap(Ae)},returns:{label:t.returns.join("/"),words:t.returns.flatMap(Ae)},kinds:new Set(t.kinds),scope:re(n)}}function Ae(e){return $(e).variants}function Xr(e,t){return Math.min(...t.map(n=>Math.max(0,...n.map(r=>e.nameDocFreq.get(r)??0))))}function Yr(e,t){let n=new Set,r=o=>o.flatMap(s=>e.byToken.get(s)??[]),a=o=>{let s=o.map(r).sort((d,i)=>d.length-i.length)[0];for(let d of s??[])n.add(d)};for(let o of t.groups)for(let s of o.synonyms)a(s);for(let o of t.names)a(o.filter(s=>s.length>=2&&!Z.has(s)).map(s=>[s]));return n}var Qr=/[.#:/]/;function Zr(e,t){let n=t.replace(/`/g,""),r=Qr.test(n),a=r?n.split(/[.#:/]+/).filter(Boolean).at(-1)??n:n,o=e.byName.get(a)??[],s=r?o.filter(i=>to(e.candidates[i]).has(n)):o;if(s.length>0)return new Set(s.map(l=>eo(e.candidates[l]))).size>qr?{probe:t,leaf:a,status:"ambiguous",targets:[]}:{probe:t,leaf:a,status:"matched",targets:s};let d=!r&&e.calledLeaves.has(n);return{probe:t,leaf:a,status:d?"matched":"unmatched",targets:[]}}function eo(e){return`${e.file}\0${e.container??""}`}function to(e){let t=new Set,n=[e.name];if(e.container){for(let r of[".","#","::"])t.add(`${e.container}${r}${e.name}`);n.push(`${e.container}.${e.name}`)}for(let r of[e.file,e.file.replace(/\.[^./]+$/,"")])for(let a of[":","#","/"])for(let o of n)t.add(`${r}${a}${o}`);return t}function en(e,t,n){let r=t.candidates[n],a=e.names.some(c=>no(c,r.nameWords)),o=0,s=0,d=0,i=[];for(let c of e.groups){let p={label:c.labels[0],field:null};for(let g of Re){let S=c.synonyms.findIndex(b=>ro(r.fields[g],b));if(!(S<0)){p={label:c.labels[S],field:g};break}}i.push(p),p.field&&(o+=c.weight*Kr[p.field]),p.field==="name"&&(s+=c.weight,d+=1)}let l=e.totalWeight;return{index:n,match:l>0?o/l:0,nameCoverage:l>0?s/l:0,nameGroups:d,exactName:a,hits:i}}function no(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function ro(e,t){if(t.length===1)return t[0].some(n=>e.set.has(n));for(let n=0;n+t.length<=e.words.length;n+=1)if(t.every((r,a)=>e.variants[n+a].some(o=>r.includes(o))))return!0;return!1}function tn(e,t,n){let r=t.candidates[n.index],a=e.calls.filter(i=>i.status==="matched"),o=a.filter(i=>r.calleeLeaves.includes(i.leaf)).map(i=>i.probe),{fit:s,note:d}=so(e,r);return{...n,candidate:r,callContainment:r.hasBody&&a.length>0?o.length/a.length:null,callsFound:o,fit:s,fitNote:d,specializedWords:oo(e,t,r),isCallTarget:e.callTargets.has(n.index)}}function oo(e,t,n){let r=n.fields.name;return r.words.filter((a,o)=>(t.nameDocFreq.get(a)??0)<=Gr&&!zr.has(a)&&!r.variants[o].some(s=>e.vocab.has(s)))}function so(e,t){if(t.kind!=="function"&&t.kind!=="method")return{fit:"unknown",note:null};let n=[ao(e,t),io(e,t)].filter(a=>a!==null),r=n.find(a=>a.verdict==="conflicts")??n[0];return r?{fit:r.verdict,note:r.note}:{fit:"unknown",note:null}}function ao(e,t){if(e.returns.words.length===0)return null;let n=t.returnsText;return n?nn($(n),e.returns.words)?{verdict:"fits",note:`returns ${Xt(n)}`}:{verdict:"conflicts",note:`returns ${Xt(n)}, probe expects ${e.returns.label}`}:null}function io(e,t){return e.params.words.length===0||t.paramsText===null?null:t.paramsText===""?{verdict:"conflicts",note:`takes no parameters, probe expects ${e.params.label}`}:nn($(t.paramsText),e.params.words)?{verdict:"fits",note:`parameters include ${e.params.label}`}:null}function nn(e,t){return t.some(n=>n.some(r=>e.set.has(r)))}function Xt(e){return e.length>40?`${e.slice(0,39)}\u2026`:e}import{createHash as Eo}from"crypto";var co=.6,lo=.35,rn=.5,uo=.75,fo=.5,Ne="blocked: file-internal (not exported, no references from other files)",Me="blocked: marked @deprecated",oe=["reuse","rework","compose"];function sn(e,t,n){let{plan:r}=n,a=new Map(n.shortlist.map(i=>[i.index,i])),o=i=>{if(a.has(i))return;let l=Qt(t,r,i);l&&a.set(i,l)};for(let i of r.callTargets)o(i);let s=new Map;for(let i of[...a.values()].filter(l=>po(r,l)))for(let l of i.candidate.calleeLeaves)for(let c of bo(e,t,i.candidate,l)){if(c===i.index)continue;let p=s.get(c);p?p.push(i):s.set(c,[i])}for(let i of s.keys())o(i);let d=[];for(let i of a.values()){let l=mo(r,i,s.get(i.index)??[]);l&&d.push(l)}return d.sort(ho)}function mo(e,t,n){let r=cn(t),a=go(e,t,n),o=t.exactName||t.nameCoverage>=uo,s=t.candidate.consumable&&!t.candidate.deprecated;return a.length>0&&!o&&s?_e(t,"compose",[...Te(t),...a]):an(t,r)?_e(t,"reuse",Te(t)):(t.exactName||t.match>=lo)&&r.length>0?_e(t,"rework",[...Te(t),...r.map(d=>d.text)]):null}function _e(e,t,n){let r=e.exactName||(e.callContainment??0)>=fo&&e.fit==="fits";return{candidate:e.candidate,bucket:t,tier:r?"direct":"signal",score:Fe(e.exactName?Math.max(e.match,.9):e.match),why:n}}function an(e,t){return(e.exactName||e.match>=co)&&t.length===0}function po(e,t){return an(t,cn(t))&&!t.isCallTarget&&!dn(e,t)}function dn(e,t){return e.groups.length>=2&&t.nameGroups===1&&t.specializedWords.length===0&&t.hits.some(n=>n.field===null)}function go(e,t,n){let r=[];t.isCallTarget&&r.push(`name matches call probe ${t.candidate.name}`),dn(e,t)&&r.push(`part of the task: name covers 1 of ${e.groups.length} concepts`);let a=n.filter(o=>on(o)>on(t));if(a.length>0){let o=[...new Set(a.map(s=>s.candidate.name))].slice(0,3);r.push(`referenced inside ${o.join(", ")}`)}return r}function on(e){return e.exactName?Math.max(e.match,.9):e.match}function bo(e,t,n,r){return(t.byName.get(r)??[]).filter(a=>{let o=t.candidates[a];return o.file!==n.file&&!o.referencedFrom.includes(n.file)?!1:Jt(e,t,a,n.file).some(([s,d])=>s>=n.startLine&&d<=n.endLine)})}function cn(e){let{candidate:t}=e,n=[];e.fit==="conflicts"&&n.push({kind:"signature",text:`blocked: ${e.fitNote??"signature conflicts with the probes"}`}),t.consumable||n.push({kind:"file-internal",text:Ne}),e.specializedWords.length>0&&n.push({kind:"specialized",text:`blocked: specialized name (${e.specializedWords.join(", ")} not in the probes)`}),t.deprecated&&n.push({kind:"deprecated",text:Me});let r=[...new Set(e.hits.flatMap(o=>o.field&&o.field!=="name"?[o.field]:[]))],a=e.exactName||e.nameCoverage>=rn||(e.callContainment??0)>=rn;return r.length>0&&!a&&n.push({kind:"doc-only",text:`blocked: concept appears only in ${r.join("/")}, not in the name or callees`}),n}function Te(e){let t=[];e.exactName&&t.push(`name equals probe name ${e.candidate.name}`);let n=new Map;for(let a of e.hits){if(!a.field)continue;let o=n.get(a.field)??[];o.push(a.label),n.set(a.field,o)}let r=n.get("name");r&&!e.exactName&&t.push(`name matches ${r.join("+")}`);for(let[a,o]of n)a!=="name"&&t.push(`${a} mentions ${o.join("+")}`);return e.callsFound.length>0&&t.push(`calls ${e.callsFound.join(", ")}`),e.candidate.consumable&&t.push(Be(e.candidate)),e.fit==="fits"&&e.fitNote&&t.push(`signature fits: ${e.fitNote}`),t}function Be(e){let t=e.referencedFrom.length,n=`referenced from ${t} ${t===1?"file":"files"}`;return e.exported?t>0?`exported, ${n}`:"exported, no references from other files":t>0?`not exported, ${n}`:"file-internal"}function Oe(e,t){return{symbolId:e.symbol,name:e.kind==="method"&&e.container?`${e.container}.${e.name}`:e.name,file:e.file,line:e.startLine+1,signature:e.signature,...t}}function Le(e,t,n){let r=new Map;return e.filter(a=>{if(n&&a.bucket!==n)return!1;let o=r.get(a.bucket)??0;return r.set(a.bucket,o+1),o<t})}function ho(e,t){return oe.indexOf(e.bucket)-oe.indexOf(t.bucket)||+(t.tier==="direct")-+(e.tier==="direct")||t.score-e.score||e.candidate.file.localeCompare(t.candidate.file)||e.candidate.startLine-t.candidate.startLine||e.candidate.name.localeCompare(t.candidate.name)}function Fe(e){return Math.round(e*1e3)/1e3}var mn=5,pn=1200,yo=.05,So=.12,vo=15,Co=3,ko=.5,xo=200,wo=300,ln=1e-9;function gn(e,t,n={}){let r=Y(e),a=Yt(r,t,{scope:n.scope}),o=sn(e,r,a);return{candidates:Le(o,n.limit??mn,n.bucket).map(s=>Oe(s.candidate,{bucket:s.bucket,tier:s.tier,score:s.score,scoreBasis:"probe-match",why:s.why})),unresolvedProbes:a.unresolvedProbes,coverage:{corpusUnits:a.corpusUnits}}}var un=new WeakMap;function bn(e,t=pn){return hn(Y(e),t).cards}function hn(e,t){let n=un.get(e);n||(n=new Map,un.set(e,n));let r=n.get(t);if(!r){let a=e.candidates.map((s,d)=>{let i=Po(s,t);return{cardHash:Ro(i),text:i,candidateIndex:d}}),o=new Map;for(let s of a){let d=o.get(s.cardHash);d?d.push(s.candidateIndex):o.set(s.cardHash,[s.candidateIndex])}r={cards:a,indexesByHash:o},n.set(t,r)}return r}function Ro(e){return Eo("sha256").update(`card-format-${1}
5
+ ${e}`).digest("hex")}function Po(e,t){let n=o=>W(o).map(s=>s.toLocaleLowerCase()).join(" "),r=`name: ${n(e.name)} | kind: ${e.kind} | in: ${e.container??""}`,a=[`signature: ${(e.signature??"").slice(0,xo)}`,`doc: ${e.doc.slice(0,wo)}`,`path: ${n(e.file.replace(/\.[^./]+$/,""))}`].join(" | ");return`${r}
6
+ ${a}`.slice(0,t)}function En(e,t,n={}){let{topBandMargin:r=yo,maxCardChars:a=pn}=n,o=Y(e),{indexesByHash:s}=hn(o,a),d=re(n.scope),i=new Map;for(let p of t)for(let g of s.get(p.cardHash)??[])Q(d,o.candidates[g])&&i.set(g,Math.max(i.get(g)??Number.NEGATIVE_INFINITY,p.score));if(i.size===0)return[];let l=Math.max(...i.values()),c=[];for(let[p,g]of i){let S=o.candidates[p],b=l-g,m=Ao(S),x=S.endLine-S.startLine+1<=vo&&S.referencedFrom.length>=Co,P=b<=So+ln,R=null;if(b<=r+ln?R=m.length===0?"reuse":"rework":x&&m.length===0&&(P||g>=ko)?R="compose":P&&m.length>0&&(R="rework"),!R)continue;let A=[`cosine ${g.toFixed(3)} (best ${l.toFixed(3)})`];S.consumable&&A.push(Be(S)),R==="compose"&&A.push(`small utility: ${S.endLine-S.startLine+1} lines, referenced from ${S.referencedFrom.length} files`),A.push(...m),c.push(Oe(S,{bucket:R,tier:"signal",score:Fe(g),scoreBasis:"cosine",why:A}))}return c.sort((p,g)=>oe.indexOf(p.bucket)-oe.indexOf(g.bucket)||g.score-p.score||p.file.localeCompare(g.file)||p.line-g.line||p.name.localeCompare(g.name)),Le(c,n.limit??mn,n.bucket)}function Ao(e){let t=[];return e.consumable||t.push(Ne),e.deprecated&&t.push(Me),t}import{mkdirSync as _o}from"fs";import{dirname as To,join as No}from"path";import Mo from"better-sqlite3";var Bo="embeddings",Oo=1,Lo=720*60*60*1e3,Fo=.995,Io=3600*1e3;function Do(e){return he(JSON.stringify({model:e.model,dims:e.dims,documentPrefix:e.documentPrefix,cardFormatVersion:e.cardFormatVersion})).slice(0,16)}function vn(e,t){return he(`${e}\0${t}`).slice(0,16)}function ce(e,t){process.env.CODEBASEIQ_DEBUG&&console.error(`embedding-store: ${e}: ${t instanceof Error?t.message:String(t)}`)}function Ie(e,t,n={}){let r=n.now??ie,a=n.storeKey??Do(t),o=No(e,Bo,`${a}.db`),s=t.dims,d=$o(o,t),i=null;function l(b,m){ce(`disabled (${b})`,m),i=null;try{d?.db.close()}catch(x){ce("close failed while disabling",x)}d=null}function c(b){return b.readDataVersion.get()}function p(b){return i&&i.dataVersion===c(b)||(i=g(b)),i}function g(b){return b.db.transaction(()=>{let m=c(b),x=b.countRows.get().count,P=new Float32Array(x*s),R=[],A=new Map;for(let B of b.readAll.iterate())new Uint8Array(P.buffer,R.length*s*4,s*4).set(B.vector),A.set(B.card_hash,R.length),R.push(B.card_hash);return{dataVersion:m,hashes:R,index:A,data:P}})()}function S(b,m){let x=0;for(let P of m)b.readUsed.get(P)!==void 0&&(x+=1);return x}return{get available(){return d!==null},key:a,path:o,verifyCanary(b){if(!d)return"first";try{let m=d.readCanary.get();return m?Wo(Ho(m.value),b)>=Fo?"match":"drift":(d.writeCanary.run(Sn(b)),"first")}catch(m){return l("canary",m),"first"}},missing(b){let m=[...new Set(b)];if(!d)return m;try{let x=[],P=[],R=r()-Io;for(let A of m){let B=d.readUsed.get(A);B?B.last_used_at<R&&P.push(A):x.push(A)}if(P.length>0){let A=d,B=r();A.db.transaction(()=>{for(let O of P)A.touch.run(B,O)})()}return x}catch(x){return l("missing",x),m}},put(b){for(let m of b)if(m.vector.length!==s)throw new RangeError(`vector for ${m.cardHash} has ${m.vector.length} dimensions, store holds ${s}`);if(!(!d||b.length===0))try{let m=d,x=r();m.db.transaction(()=>{for(let P of b)m.upsert.run(P.cardHash,x,x,Sn(P.vector))})(),i=null}catch(m){l("put",m)}},topK(b,m,x){if(b.length!==s)throw new RangeError(`query vector has ${b.length} dimensions, store holds ${s}`);if(!d||m<=0)return[];let P;try{P=p(d)}catch(M){return l("topK",M),[]}let{hashes:R,index:A,data:B}=P,O=[],ae=M=>{let I=R[M],K=0,fe=M*s;for(let G=0;G<s;G+=1)K+=B[fe+G]*b[G];if(O.length===m&&!yn(K,I,O[m-1]))return;let V=O.length;for(;V>0&&yn(K,I,O[V-1]);)V-=1;O.splice(V,0,{cardHash:I,score:K}),O.length>m&&O.pop()};if(x)for(let M of x){let I=A.get(M);I!==void 0&&ae(I)}else for(let M=0;M<R.length;M+=1)ae(M);return O},coverage(b){let m=new Set(b);if(m.size===0)return 1;if(!d)return 0;try{return S(d,m)/m.size}catch(x){return l("coverage",x),0}},prune(b={}){if(!d)return 0;try{let m=d,x=b.unusedForMs??Lo,P=m.db.transaction(()=>{let R=m.deleteUnusedBefore.run(r()-x).changes;if(b.maxRows!==void 0){let A=m.countRows.get().count;A>b.maxRows&&(R+=m.deleteOldest.run(A-b.maxRows).changes)}return R})();return P>0&&(i=null),P}catch(m){return l("prune",m),0}},async withRefreshLock(b){if(!d)return{acquired:!1};let m=await je(`${o}.refresh.lock`);if(!m)return{acquired:!1};try{return{acquired:!0,value:await b()}}finally{m.release()}},close(){i=null;try{d?.db.close()}catch(b){ce("close failed",b)}d=null}}}function yn(e,t,n){return e>n.score||e===n.score&&t<n.cardHash}function $o(e,t){let n;try{return _o(To(e),{recursive:!0}),n=new Mo(We(e)),n.pragma("busy_timeout = 5000"),n.pragma("journal_mode = WAL"),n.pragma("synchronous = NORMAL"),n.exec(`
7
+ CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value) WITHOUT ROWID;
8
+ CREATE TABLE IF NOT EXISTS vectors (
9
+ card_hash TEXT PRIMARY KEY,
10
+ embedded_at INTEGER NOT NULL,
11
+ last_used_at INTEGER NOT NULL,
12
+ vector BLOB NOT NULL
13
+ ) WITHOUT ROWID;
14
+ `),Uo(n,t),{db:n,readDataVersion:n.prepare("PRAGMA data_version").pluck(),readCanary:n.prepare("SELECT value FROM meta WHERE key = 'canary'"),writeCanary:n.prepare("INSERT OR REPLACE INTO meta (key, value) VALUES ('canary', ?)"),readUsed:n.prepare("SELECT last_used_at FROM vectors WHERE card_hash = ?"),touch:n.prepare("UPDATE vectors SET last_used_at = ? WHERE card_hash = ?"),upsert:n.prepare("INSERT OR REPLACE INTO vectors (card_hash, embedded_at, last_used_at, vector) VALUES (?, ?, ?, ?)"),countRows:n.prepare("SELECT COUNT(*) AS count FROM vectors"),readAll:n.prepare("SELECT card_hash, vector FROM vectors"),deleteUnusedBefore:n.prepare("DELETE FROM vectors WHERE last_used_at < ?"),deleteOldest:n.prepare(`DELETE FROM vectors WHERE card_hash IN (
15
+ SELECT card_hash FROM vectors ORDER BY last_used_at ASC, embedded_at ASC, card_hash ASC LIMIT ?
16
+ )`)}}catch(r){ce("disabled (open failed)",r);try{n?.close()}catch{}return null}}function Uo(e,t){let n={schema_version:String(Oo),model:t.model,dims:String(t.dims),document_prefix:t.documentPrefix,card_format_version:String(t.cardFormatVersion)};e.transaction(()=>{let r=new Map(e.prepare("SELECT key, value FROM meta").all().map(s=>[s.key,s.value]));if(Object.entries(n).every(([s,d])=>r.get(s)===d))return;e.exec("DELETE FROM vectors; DELETE FROM meta;");let o=e.prepare("INSERT INTO meta (key, value) VALUES (?, ?)");for(let[s,d]of Object.entries(n))o.run(s,d)}).immediate()}function Sn(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}function Ho(e){return new Float32Array(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}function Wo(e,t){if(e.length!==t.length)return 0;let n=0,r=0,a=0;for(let o=0;o<e.length;o+=1)n+=e[o]*t[o],r+=e[o]*e[o],a+=t[o]*t[o];return r===0||a===0?0:n/Math.sqrt(r*a)}var jo="builder";function ua(e){return De(e,jo)}var Ko=.8,Cn="inside an agent session: pass probes (--term/--name/--calls) instead of a description",Vo=3e4,Go=6e4,qo=2,zo=50,Jo=12,$e=2e3,Xo=5,se="builder query aborted",Yo=2147483647;function Qo(e){return e>=$e?`vector search returns at most ${$e} hits; lower-ranked units are not listed`:void 0}function fa(e){let{settings:t,storeRoot:n,languages:r}=e,a=e.env??process.env,o=e.now??ie,s=new Map,d;function i(u){let f=e.openDb();try{return u(f)}finally{e.closeDb?.(f)}}function l(){return Object.entries(a).some(([u,f])=>f!==void 0&&(u==="CLAUDECODE"||u.startsWith("CODEX_")))}function c(u){let f=s.get(u.name);return f||(f={client:Dt(u,{fetchImpl:e.fetchImpl,env:a})},s.set(u.name,f)),f}function p(u,f,h){u.health=void 0,u.failure={state:f,detail:h,openUntil:o()+Go}}async function g(u,f,h=!1){let E=c(u),v=o();if(!h&&E.failure&&v<E.failure.openUntil){let k=Math.ceil((E.failure.openUntil-v)/1e3);return{ok:!1,state:E.failure.state,detail:`${E.failure.detail} (not retried for another ${k}s)`}}let C=!h&&E.health!==void 0&&v-E.health.checkedAt<Vo,y;if(C)y=E.health.value;else{let k=await E.client.checkHealth({signal:f});if(!k.ok){J(f,se);let _=Zo(k.reason);return p(E,_,k.detail),{ok:!1,state:_,detail:k.detail}}y=k,E.health={value:k,checkedAt:o()},E.failure=void 0}let w=S(E,u,y,!C);return w.ok?{ok:!0,endpoint:u,store:w.held.store,client:E.client,...w.held.forked?{note:`model weights differ from the shared ${u.model} store; using a store forked for ${u.name}`}:{}}:w}function S(u,f,h,E){let v=u.held;if(v&&v.dims===h.dimensions&&(!E||v.store.verifyCanary(h.canary)!=="drift"))return{ok:!0,held:v};v?.store.close(),u.held=void 0;let C={model:f.model,dims:h.dimensions,documentPrefix:f.documentPrefix,cardFormatVersion:1},y=Ie(n,C);if(!y.available)return y.close(),{ok:!1,state:"degraded",detail:`the vector store ${y.path} could not be opened`};if(y.verifyCanary(h.canary)!=="drift")return u.held={store:y,dims:h.dimensions,forked:!1},{ok:!0,held:u.held};let w=y.key;y.close();let k=Ie(n,C,{storeKey:vn(w,f.name)});return!k.available||k.verifyCanary(h.canary)==="drift"?(k.close(),{ok:!1,state:"degraded",detail:`model weights for ${f.model} keep changing between runs`}):(u.held={store:k,dims:h.dimensions,forked:!0},{ok:!0,held:u.held})}function b(u){return i(f=>{let h=bn(f,t.maxCardChars),E=new Map;for(let y of h)E.has(y.cardHash)||E.set(y.cardHash,y.text);let v=re(u),C=null;if(v){let{candidates:y}=Y(f);C=new Set(h.filter(w=>Q(v,y[w.candidateIndex])).map(w=>w.cardHash))}return{hashes:h.map(y=>y.cardHash),textByHash:E,scopedHashes:C}})}function m(u,f){let h=new Set(u.missing(f.hashes)),E=f.hashes.filter(v=>!h.has(v)).length;return{embeddedUnits:E,fraction:f.hashes.length===0?1:E/f.hashes.length}}async function x(u,f,h,E){let{endpoint:v,store:C,client:y}=u,w=C.missing(f.hashes);if(w.length===0)return{embedded:0,budgetExhausted:!1};let k=AbortSignal.timeout(Math.min(E,Yo)),_=h?AbortSignal.any([h,k]):k,L=Math.max(1,Math.floor(v.batchSize))*qo,T={embedded:0,budgetExhausted:!1};return(await C.withRefreshLock(async()=>{for(let q=0;q<w.length;q+=L){let z=w.slice(q,q+L);try{let U=await y.embed(z.map(F=>f.textByHash.get(F)),"document",{signal:_});C.put(z.map((F,me)=>({cardHash:F,vector:U[me]}))),T.embedded+=z.length}catch(U){if(h?.aborted)throw H(h,se);if(k.aborted){T.budgetExhausted=!0;return}p(c(v),"degraded",ue(U)),T.note=`embedding stopped: ${ue(U)}`;return}}})).acquired?T.embedded>0&&C.prune():T.note="another process is already embedding this repository",T}async function P(u,f,h,E){let v=await g(u,E);if(!v.ok)return{kind:"failed",reason:`${v.state}: ${v.detail}`};let C=b(f.scope),y=await x(v,C,E,t.indexBudgetMs),{embeddedUnits:w,fraction:k}=m(v.store,C),_;try{let[F]=await v.client.embed([h],"query",{signal:E}),me=Math.min($e,Math.max(zo,(f.limit??Xo)*Jo));_=v.store.topK(F,me,C.scopedHashes??new Set(C.hashes))}catch(F){if(E?.aborted)throw H(E,se);return p(c(u),"degraded",ue(F)),{kind:"failed",reason:`degraded: ${ue(F)}`}}let L=i(F=>En(F,_,{topBandMargin:t.topBandMargin,maxCardChars:t.maxCardChars,limit:f.limit,scope:f.scope,bucket:f.bucket})),T=C.hashes.length,Ue=w<T?`partial embeddings: ${w} of ${T} units (${le(k)})`:void 0,q=y.budgetExhausted?`index budget of ${t.indexBudgetMs} ms used up`:void 0,z=[v.note,Ue,q,y.note,Qo(_.length)].filter(F=>F!==void 0),U={provider:`embeddings:${u.name}`,probes:null,unresolvedProbes:[],candidates:L,coverage:{corpusUnits:T,embeddedUnits:w,...z.length>0?{note:z.join("; ")}:{}}};return k>=t.minCoverage?{kind:"answer",answer:U}:{kind:"degraded",answer:U,fraction:k,reason:`degraded: embedded ${w} of ${T} units (${le(k)}), below the ${le(t.minCoverage)} minimum`}}function R(){return d??=Bt(De(n,"agent-probes"),t.cacheTtlHours,o),d}async function A(u,f,h,E){if(l())return{kind:"failed",reason:Cn};let v=R(),C=v.get(u.argv,h);if(!C){let y=await Tt(u,{description:h,languages:r,workDir:De(n,"agent-sandbox")},{signal:E,env:a});if(!y.ok)return{kind:"failed",reason:`${y.reason}: ${y.detail}`};C=y.probes,v.set(u.argv,h,C)}return{kind:"answer",answer:{provider:`agent:${u.name}`,...B(f,C)}}}function B(u,f){let h=i(E=>gn(E,f,{limit:u.limit,scope:u.scope,bucket:u.bucket}));return{probes:f,unresolvedProbes:h.unresolvedProbes,candidates:h.candidates,coverage:h.coverage}}function O(u){return u==="agent"?t.agents.map(f=>({kind:"agent",name:f.name})):u==="embeddings"?t.endpoints.map(f=>({kind:"embeddings",name:f.name})):t.chain}async function ae(u,f,h,E){if(u.kind==="agent"){let C=t.agents.find(y=>y.name===u.name);return C?A(C,f,h,E):{kind:"failed",reason:"not configured"}}let v=t.endpoints.find(C=>C.name===u.name);return v?P(v,f,h,E):{kind:"failed",reason:"not configured"}}function M(u,f){return{...u,fallbacksTried:f,evidence:"heuristic"}}function I(u,f){return M({provider:"none",probes:null,unresolvedProbes:[],candidates:[],coverage:{corpusUnits:0,note:f}},u)}async function K(u,f={}){let{signal:h}=f;J(h,se);let E=u.mode??t.mode;if(u.probes&&X(u.probes)&&E!=="embeddings")return M({provider:"agent:caller",...B(u,u.probes)},[]);let v=Ve(u.description?.trim()??"").trim();if(v===""){let k=E==="embeddings"&&u.probes&&X(u.probes)?"embeddings mode ranks a description; probes are not embedded":"no description or probes were given";return I([{provider:"request",reason:k}],"nothing to look up")}let C=O(E);if(C.length===0)return I([{provider:E,reason:"no providers are configured for this mode"}],"no provider ran");let y=[],w=[];for(let k of C){J(h,se);let _=await ae(k,u,v,h);if(_.kind==="answer")return M(_.answer,y);let L={provider:qe(k),reason:_.reason};y.push(L),_.kind==="degraded"&&w.push({entry:L,answer:_.answer,fraction:_.fraction})}if(w.length>0){let k=w.reduce((_,L)=>L.fraction>_.fraction?L:_);return M(k.answer,y.filter(_=>_!==k.entry))}return I(y,"no provider answered")}function fe(u){let f=`agent:${u.name}`;if(l())return{provider:f,state:"skipped",detail:Cn};let h=Se(u);return h.ok?{provider:f,state:"ok",detail:`runs ${u.argv[0]} with a ${Math.round(u.timeoutMs/1e3)}s timeout`}:{provider:f,state:h.reason==="misconfigured"?"misconfigured":"unreachable",detail:h.detail}}async function V(u,f){let h=`embeddings:${u.name}`,E=await g(u,f,!0);if(!E.ok)return{provider:h,state:E.state,detail:E.detail};let v=b(void 0),{embeddedUnits:C,fraction:y}=m(E.store,v),w=`${u.model} reachable; embedded ${C} of ${v.hashes.length} units (${le(y)})`;return{provider:h,state:y>=t.minCoverage?"ok":"degraded",detail:E.note?`${w}; ${E.note}`:w,coverage:y}}async function G(u={}){let f=[];for(let h of t.endpoints)f.push(await V(h,u.signal));for(let h of t.agents)f.push(fe(h));return f}async function kn(u={}){let{endpoint:f,signal:h,endsAt:E,budgetMs:v=t.indexBudgetMs}=u,C=f===void 0?t.endpoints:t.endpoints.filter(w=>w.name===f);if(C.length===0)throw new Error(f===void 0?"No embeddings endpoint is configured.":`No embeddings endpoint is named ${f}.`);let y=[];for(let w of C){let k=await g(w,h);if(!k.ok){y.push(`embeddings:${w.name} ${k.state}: ${k.detail}`);continue}let _=b(void 0),L=E===void 0?v:Math.max(1,Math.floor((E-o())*Ko)),T=await x(k,_,h,L);return{provider:`embeddings:${w.name}`,embedded:T.embedded,coverage:m(k.store,_).fraction,budgetExhausted:T.budgetExhausted,...T.note?{note:T.note}:{}}}throw new Error(`No embeddings endpoint could be refreshed: ${y.join("; ")}`)}function xn(){for(let u of s.values())u.held?.store.close(),u.held=void 0}return{query:K,providerStatus:G,refreshEmbeddings:kn,close:xn}}function Zo(e){switch(e){case"unreachable":return"unreachable";case"remote-not-allowed":case"insecure-token-transport":case"invalid-endpoint":case"unauthorized":return"misconfigured";default:return"degraded"}}function le(e){return`${Math.round(e*100)}%`}function ue(e){return e instanceof Error?e.message:String(e)}export{ua as a,fa as b};
17
+ //# sourceMappingURL=chunk-FQA3KIFX.js.map
@@ -0,0 +1,3 @@
1
+ import{a as S,e as d}from"./chunk-4NHWNAWQ.js";import{readdirSync as m}from"fs";import{execFileSync as x}from"child_process";import{extname as l,join as y}from"path";var h=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],X=[".vue"],f=[".tsx",".jsx"],g=[".vue"],_=[...f,...g],I=new Set(f),w=new Set(g),p=new Set(h.map(e=>e.toLowerCase())),C=[...p].sort().join(","),E=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".codebaseiq-cache","__pycache__",".venv","venv",".idea",".vscode"]);function O(e,t={}){let s=t.includeIndexed??!0,i=t.includeAuxiliary??!0,n=t.extensions?.map(c=>c.toLowerCase()),o=n?new Set(n):p,u=n?[...o].sort().join(","):C,r=`${s?"1":"0"}|${i?"1":"0"}|${u}`;return R.get(e,r,()=>{let c=new Set;if(s)for(let a of d(e,{includeIgnored:!1}))o.has(l(a).toLowerCase())&&c.add(a);if(i)for(let a of N(e.config.projectRoot,o))e.isIgnored(a)||s&&c.has(a)||c.add(a);return[...c].sort()})}function k(e,t={}){let s=!1,i=!1;for(let n of O(e,{extensions:_})){if(t.scope&&!n.includes(t.scope))continue;let o=l(n).toLowerCase();if(s||=I.has(o),i||=w.has(o),s&&i)break}return{react:s,vue:i}}var R=S("source-files",{clearGroups:[]});function N(e,t){return T(e,t)??v(e,t)}function T(e,t){try{let s=x("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,killSignal:"SIGKILL",stdio:["ignore","pipe","ignore"],windowsHide:!0}),i=new Set;for(let n of s.split(`
2
+ `)){let o=n.trim();o&&(j(o)||t.has(l(o).toLowerCase())&&i.add(o))}return i}catch{return null}}function j(e){return e.split("/").some(t=>E.has(t))}function v(e,t){let s=new Set,i=n=>{let o=n?y(e,n):e,u;try{u=m(o,{withFileTypes:!0})}catch{return}for(let r of u)if(!E.has(r.name)){if(r.isDirectory()){i(n?`${n}/${r.name}`:r.name);continue}t.has(l(r.name).toLowerCase())&&s.add(n?`${n}/${r.name}`:r.name)}};return i(""),s}export{X as a,E as b,O as c,k as d};
3
+ //# sourceMappingURL=chunk-FWY2PRIF.js.map
@@ -0,0 +1,2 @@
1
+ import{m as o}from"./chunk-CDWSLAPN.js";import{G as n}from"./chunk-4O52YNKL.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};
2
+ //# sourceMappingURL=chunk-FY5V4V4F.js.map