codebaseiq 0.3.1 → 0.4.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 (321) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-7GAK2F3H.js → chunk-23AD24QZ.js} +12 -12
  4. package/dist/chunk-24TEZJST.js +2 -0
  5. package/dist/{chunk-356EZBIP.js → chunk-26EDDGAX.js} +2 -2
  6. package/dist/{chunk-O2M3VNDY.js → chunk-26EZWQ24.js} +2 -2
  7. package/dist/{chunk-U33PMPNW.js → chunk-2L3NCI52.js} +2 -2
  8. package/dist/{chunk-MSI3K7PJ.js → chunk-2QJAVISG.js} +2 -2
  9. package/dist/{chunk-4LK5OIPW.js → chunk-2ZBZRYX4.js} +2 -2
  10. package/dist/{chunk-JYRJYXUV.js → chunk-33AXWMO2.js} +2 -2
  11. package/dist/{chunk-EQNMD62X.js → chunk-37K55EG3.js} +2 -2
  12. package/dist/{chunk-LCW3PSGL.js → chunk-3EFZ5KQ4.js} +2 -2
  13. package/dist/{chunk-D7DOB27N.js → chunk-3F23W57G.js} +2 -2
  14. package/dist/{chunk-BGGB5N53.js → chunk-3GKKCVKK.js} +2 -2
  15. package/dist/{chunk-MQW6SJ4P.js → chunk-3SYRGMCL.js} +2 -2
  16. package/dist/{chunk-DWBAESVW.js → chunk-3VDL7GTY.js} +2 -2
  17. package/dist/{chunk-BFANZRQ5.js → chunk-3XBZ5PKL.js} +2 -2
  18. package/dist/{chunk-K6FNTQQW.js → chunk-42PXSE74.js} +2 -2
  19. package/dist/{chunk-ALOEHWJS.js → chunk-4GIERC2P.js} +2 -2
  20. package/dist/{chunk-W7YLRXZE.js → chunk-4UXDBRIF.js} +2 -2
  21. package/dist/chunk-4XMZYLW5.js +2 -0
  22. package/dist/{chunk-JSB43EX6.js → chunk-55NUXP2V.js} +2 -2
  23. package/dist/chunk-5AJQCOZZ.js +21 -0
  24. package/dist/{chunk-L37EQYAX.js → chunk-5NUPFZFA.js} +2 -2
  25. package/dist/{chunk-PIFYOWS4.js → chunk-65QIFIF6.js} +2 -2
  26. package/dist/{chunk-SUE7SHZL.js → chunk-66Q5VLH6.js} +2 -2
  27. package/dist/{chunk-KFTHI2R6.js → chunk-6CQPIIS7.js} +2 -2
  28. package/dist/{chunk-GV2CEZCW.js → chunk-6CTSFS7R.js} +2 -2
  29. package/dist/{chunk-SB53KPWA.js → chunk-6EBUAKJT.js} +2 -2
  30. package/dist/chunk-6I55VYFG.js +4 -0
  31. package/dist/chunk-6NUURWPF.js +3 -0
  32. package/dist/{chunk-TEMM2FEL.js → chunk-6P5QMOM7.js} +2 -2
  33. package/dist/{chunk-3LQJRS4I.js → chunk-6S5FE4ZF.js} +2 -2
  34. package/dist/chunk-74LRKLNC.js +22 -0
  35. package/dist/{chunk-NNG6M6XD.js → chunk-75A23IID.js} +2 -2
  36. package/dist/chunk-75VNTSO6.js +7 -0
  37. package/dist/chunk-7HBBVZJ6.js +3 -0
  38. package/dist/{chunk-AGGR2BKS.js → chunk-7PPBMBH6.js} +2 -2
  39. package/dist/{chunk-DECN422G.js → chunk-7WG57A5X.js} +2 -2
  40. package/dist/{chunk-ILGTMRMZ.js → chunk-7XHZX6FX.js} +2 -2
  41. package/dist/{chunk-OKAF4OQS.js → chunk-A5HJ3CJW.js} +2 -2
  42. package/dist/{chunk-JNXI6NQ7.js → chunk-AJ5HVC5Z.js} +2 -2
  43. package/dist/{chunk-SZ4P7MF7.js → chunk-AYRHOFLV.js} +2 -2
  44. package/dist/chunk-AZDY3EKD.js +93 -0
  45. package/dist/{chunk-SA7G6GJX.js → chunk-AZZNG5Z2.js} +2 -2
  46. package/dist/chunk-BEKCTUPY.js +3 -0
  47. package/dist/{chunk-PTR3EOXC.js → chunk-BKKX2OU5.js} +2 -2
  48. package/dist/{chunk-5LL4KEHO.js → chunk-BQKRYKDD.js} +2 -2
  49. package/dist/{chunk-UIAUPFBJ.js → chunk-BVDQU2XJ.js} +2 -2
  50. package/dist/chunk-C3PPB2T5.js +5 -0
  51. package/dist/chunk-CABIZQXQ.js +21 -0
  52. package/dist/{chunk-M2Y6PCFE.js → chunk-CAH322MC.js} +2 -2
  53. package/dist/{chunk-EIBGSU2R.js → chunk-CBOOHUK4.js} +2 -2
  54. package/dist/chunk-CFIICAOM.js +2 -0
  55. package/dist/{chunk-UMEPSVKT.js → chunk-CPWYEPWQ.js} +2 -2
  56. package/dist/{chunk-LQHYYIOB.js → chunk-CRT7I7RJ.js} +2 -2
  57. package/dist/{chunk-IZDPGOZR.js → chunk-CZVSQQDU.js} +2 -2
  58. package/dist/{chunk-TNJGTQWO.js → chunk-D3KE26FS.js} +2 -2
  59. package/dist/{chunk-CB5AVJMM.js → chunk-DNRHRVKS.js} +2 -2
  60. package/dist/{chunk-SGMNWYTH.js → chunk-DOQLO74K.js} +2 -2
  61. package/dist/{chunk-DDRA3QKN.js → chunk-DP3EJ6XL.js} +2 -2
  62. package/dist/{chunk-OWJWOEDU.js → chunk-DQZF7MP6.js} +2 -2
  63. package/dist/{chunk-VSGOIZMQ.js → chunk-DTM4EHD2.js} +2 -2
  64. package/dist/{chunk-YRKP7PM7.js → chunk-DUM7GR6B.js} +2 -2
  65. package/dist/{chunk-HNXRVGMY.js → chunk-DZ4QOIRY.js} +2 -2
  66. package/dist/{chunk-CSPDQLLU.js → chunk-E3R6TJ5T.js} +2 -2
  67. package/dist/chunk-E4DP45YU.js +3 -0
  68. package/dist/{chunk-PUVNH4PO.js → chunk-E5U6N5WI.js} +2 -2
  69. package/dist/chunk-E7T22WET.js +21 -0
  70. package/dist/{chunk-QEOWONKY.js → chunk-ED7ZAZ5V.js} +2 -2
  71. package/dist/{chunk-RCIGX23V.js → chunk-EDMG5CSO.js} +2 -2
  72. package/dist/{chunk-IHSLIIL3.js → chunk-EOSUV7H5.js} +2 -2
  73. package/dist/{chunk-EHPOTEQX.js → chunk-ESWVTSHU.js} +2 -2
  74. package/dist/{chunk-57OPIQFM.js → chunk-ETZBIG6K.js} +2 -2
  75. package/dist/chunk-EYSJHKX6.js +3 -0
  76. package/dist/{chunk-MC46AL7B.js → chunk-F4AGM7ZE.js} +37 -37
  77. package/dist/{chunk-EOKVZXNF.js → chunk-FPUJRBHL.js} +55 -55
  78. package/dist/{chunk-CCIYWXX6.js → chunk-G2UU6PQP.js} +2 -2
  79. package/dist/{chunk-C6WKPKCF.js → chunk-G3KRXNNT.js} +2 -2
  80. package/dist/{chunk-TEANKHUU.js → chunk-G3ZBP72R.js} +2 -2
  81. package/dist/{chunk-ELYMY5S2.js → chunk-GC4I33OD.js} +2 -2
  82. package/dist/{chunk-NDKOVQFG.js → chunk-GLXEWYQY.js} +2 -2
  83. package/dist/{chunk-CYJS33YX.js → chunk-GRHNPFHT.js} +2 -2
  84. package/dist/{chunk-QY7QB7I6.js → chunk-GWESWURK.js} +2 -2
  85. package/dist/{chunk-R4OJGTMP.js → chunk-GXOFPAIR.js} +2 -2
  86. package/dist/{chunk-OBC7HSSO.js → chunk-H4FGIFEU.js} +2 -2
  87. package/dist/{chunk-LKUTSP4G.js → chunk-HOGS6JFP.js} +2 -2
  88. package/dist/{chunk-RIO3JXHM.js → chunk-HSJLK5MC.js} +2 -2
  89. package/dist/{chunk-BWL3PMPT.js → chunk-HTPEUJ42.js} +2 -2
  90. package/dist/{chunk-DJKOXMNG.js → chunk-IBPXUGJV.js} +2 -2
  91. package/dist/{chunk-2XBJRZEM.js → chunk-ITA3N7G6.js} +2 -2
  92. package/dist/chunk-JG5OWAEB.js +22 -0
  93. package/dist/{chunk-LSZYMN2A.js → chunk-JGJKRTTB.js} +2 -2
  94. package/dist/{chunk-TJWVT4DO.js → chunk-JGXLB7PR.js} +2 -2
  95. package/dist/{chunk-5TZNHP4T.js → chunk-JKUF2UG6.js} +2 -2
  96. package/dist/{chunk-CIYA2KZN.js → chunk-JOYASZRF.js} +2 -2
  97. package/dist/{chunk-U7NUXDQO.js → chunk-K3PFL5QQ.js} +2 -2
  98. package/dist/{chunk-WK2IQJPK.js → chunk-KAXBWTSX.js} +2 -2
  99. package/dist/{chunk-5ZI2PPI7.js → chunk-KHHAGHAW.js} +2 -2
  100. package/dist/{chunk-UW6KD57C.js → chunk-KJLUQVBG.js} +2 -2
  101. package/dist/{chunk-WWCV4E6J.js → chunk-KOVUXHIZ.js} +2 -2
  102. package/dist/chunk-KPMMOAV5.js +4 -0
  103. package/dist/{chunk-2Z7K66D7.js → chunk-LKJZNGMA.js} +2 -2
  104. package/dist/{chunk-3VJ3OCRE.js → chunk-LMPOC372.js} +2 -2
  105. package/dist/{chunk-F3QSL4W2.js → chunk-LTPNP6D5.js} +2 -2
  106. package/dist/{chunk-O2KWU34K.js → chunk-M3IBH6C3.js} +9 -9
  107. package/dist/{chunk-UJIXCI3L.js → chunk-MAGBSB6E.js} +2 -2
  108. package/dist/{chunk-QMOZZ2VX.js → chunk-MFMHD36E.js} +2 -2
  109. package/dist/{chunk-LMTSB3TB.js → chunk-MJX2J5QE.js} +2 -2
  110. package/dist/{chunk-WO6OFKUC.js → chunk-N26LGGSF.js} +2 -2
  111. package/dist/{chunk-J7AMBVWF.js → chunk-NB2DAVPP.js} +2 -2
  112. package/dist/{chunk-MDFT325O.js → chunk-NJDXNYLG.js} +2 -2
  113. package/dist/{chunk-BRQL7AFJ.js → chunk-NMKQOIYZ.js} +2 -2
  114. package/dist/{chunk-ICUL7XRT.js → chunk-NRNVMB2R.js} +2 -2
  115. package/dist/{chunk-JAFDMV5I.js → chunk-O5BWFNIH.js} +2 -2
  116. package/dist/{chunk-3H2H5ODK.js → chunk-O7PCDZ5B.js} +2 -2
  117. package/dist/{chunk-KPZGTB2O.js → chunk-OAJYNPRU.js} +2 -2
  118. package/dist/{chunk-KUKWHP4R.js → chunk-OFUC6R46.js} +2 -2
  119. package/dist/chunk-OSZ7PW5K.js +5 -0
  120. package/dist/{chunk-B3UYV66Z.js → chunk-OZ2M2X7A.js} +2 -2
  121. package/dist/{chunk-6O3KXIDL.js → chunk-OZI44VCR.js} +2 -2
  122. package/dist/{chunk-XN3EKMLI.js → chunk-PCKIKOUA.js} +2 -2
  123. package/dist/{chunk-I3OK27P7.js → chunk-PFMQRHC6.js} +2 -2
  124. package/dist/{chunk-K4S2VH42.js → chunk-PVKSZBX5.js} +2 -2
  125. package/dist/{chunk-NEWHKGVD.js → chunk-QANCT4MO.js} +2 -2
  126. package/dist/{chunk-ZNH33XIB.js → chunk-QEWN7BLP.js} +2 -2
  127. package/dist/{chunk-OQUCBKOI.js → chunk-QFJ46F6F.js} +2 -2
  128. package/dist/{chunk-2E6OUPCF.js → chunk-QPQWR6CW.js} +2 -2
  129. package/dist/{chunk-YTJHCGYB.js → chunk-QX4HDF2I.js} +2 -2
  130. package/dist/{chunk-KLX6NSWT.js → chunk-R2F2CTBA.js} +2 -2
  131. package/dist/{chunk-2OMXFE64.js → chunk-R7PXHYMY.js} +2 -2
  132. package/dist/{chunk-F74LZWCE.js → chunk-RGBZDOUO.js} +2 -2
  133. package/dist/{chunk-362QOSFD.js → chunk-RNPG5P4P.js} +2 -2
  134. package/dist/{chunk-D62CTZX6.js → chunk-RS6UYNEP.js} +2 -2
  135. package/dist/{chunk-VGWZ4MOY.js → chunk-RVBRPBLQ.js} +2 -2
  136. package/dist/{chunk-BGYRF5YX.js → chunk-RWAZCEJD.js} +2 -2
  137. package/dist/{chunk-Z66XYVLZ.js → chunk-RWDIONS7.js} +2 -2
  138. package/dist/{chunk-CJTKGAGH.js → chunk-S3CJYDXP.js} +2 -2
  139. package/dist/{chunk-53ELMZRF.js → chunk-S6UTKCBT.js} +2 -2
  140. package/dist/chunk-SLLFJXTW.js +27 -0
  141. package/dist/{chunk-TOTWJZIX.js → chunk-T3KTMLQT.js} +2 -2
  142. package/dist/{chunk-HJTM3C4Y.js → chunk-TB575ZGO.js} +2 -2
  143. package/dist/{chunk-YHPG3S2U.js → chunk-TG4GMU73.js} +2 -2
  144. package/dist/{chunk-N2XDMNVI.js → chunk-THKM7OXM.js} +2 -2
  145. package/dist/{chunk-GVAF222T.js → chunk-TNLOX4TN.js} +2 -2
  146. package/dist/{chunk-BPKNP3KZ.js → chunk-UHFZDQZJ.js} +2 -2
  147. package/dist/{chunk-YT4DVWUV.js → chunk-UUMAM5LM.js} +2 -2
  148. package/dist/{chunk-TLTSESB4.js → chunk-UUT5P3V7.js} +2 -2
  149. package/dist/{chunk-W7QDASTN.js → chunk-VEPK6M5C.js} +2 -2
  150. package/dist/{chunk-XJBK3QDV.js → chunk-VPCHKZ3I.js} +2 -2
  151. package/dist/{chunk-3ON3A2QV.js → chunk-VZY3XOBU.js} +2 -2
  152. package/dist/{chunk-XQAVQVIL.js → chunk-W6E6ME7G.js} +2 -2
  153. package/dist/{chunk-KEJ2HLRW.js → chunk-WGYZBS5S.js} +2 -2
  154. package/dist/{chunk-5MPBSFZH.js → chunk-WUP24Q4U.js} +2 -2
  155. package/dist/chunk-WXUHXSLN.js +2 -0
  156. package/dist/{chunk-F5CJO5JN.js → chunk-X4YZD2MP.js} +2 -2
  157. package/dist/chunk-XARPGCTL.js +2 -0
  158. package/dist/{chunk-5FWR5HLG.js → chunk-XDQ6QJF5.js} +20 -20
  159. package/dist/{chunk-JCMFBF4Z.js → chunk-XRH7R5SX.js} +2 -2
  160. package/dist/{chunk-T2M5HWBQ.js → chunk-XVJ2E7W7.js} +2 -2
  161. package/dist/{chunk-AXQCHG77.js → chunk-Y7GFAU5N.js} +2 -2
  162. package/dist/{chunk-T6MQNNAC.js → chunk-YBDLHFZZ.js} +2 -2
  163. package/dist/{chunk-ZB4C5TTR.js → chunk-YI3CJPOY.js} +2 -2
  164. package/dist/chunk-YMAGXBLT.js +3 -0
  165. package/dist/{chunk-MZNMASFM.js → chunk-YRAGNEBZ.js} +2 -2
  166. package/dist/chunk-YXZAAQHZ.js +3 -0
  167. package/dist/chunk-Z2L5H2HF.js +3 -0
  168. package/dist/{chunk-5CR4U5X2.js → chunk-ZHK7TVAJ.js} +2 -2
  169. package/dist/chunk-ZJNV27DZ.js +4 -0
  170. package/dist/{chunk-GQLDYCWS.js → chunk-ZQ6GAIUV.js} +2 -2
  171. package/dist/{chunk-4GWN76B2.js → chunk-ZQE2QYAC.js} +2 -2
  172. package/dist/chunk-ZUQ2MDFT.js +2 -0
  173. package/dist/cli-context-4R2LREXQ.js +3 -0
  174. package/dist/cli-context-6X7JYARX.js +2 -0
  175. package/dist/cli-failure-RECEHOM2.js +3 -0
  176. package/dist/cli-program-MXA3WTAO.js +7 -0
  177. package/dist/cli.js +1 -1
  178. package/dist/{code-viewer-AMRXV444.js → code-viewer-C6HE4DFC.js} +2 -2
  179. package/dist/{code-viewer-EXI5SFFR.js → code-viewer-XHSSAMBX.js} +2 -2
  180. package/dist/{command-descriptors-ROIOTCCW.js → command-descriptors-NWW34Z54.js} +171 -171
  181. package/dist/{command-descriptors-H6A4UY72.js → command-descriptors-XHK3PK2I.js} +116 -116
  182. package/dist/{command-panels-SZONPMLJ.js → command-panels-OXMCJ2QZ.js} +2 -2
  183. package/dist/direct-navigation-236VXYBZ.js +3 -0
  184. package/dist/direct-navigation-36YSILY6.js +2 -0
  185. package/dist/index.js +1 -1
  186. package/dist/invocation-command-descriptors-35JULLNR.js +3 -0
  187. package/dist/invocation-command-descriptors-FEWSFUO2.js +2 -0
  188. package/dist/output-continuation-command-MJBVH3A5.js +2 -0
  189. package/dist/output-continuation-command-TBXIOPHQ.js +3 -0
  190. package/dist/project-reindex-5TCGOVSK.js +2 -0
  191. package/dist/project-reindex-BUNTSYKM.js +3 -0
  192. package/dist/queries/affected.js +1 -1
  193. package/dist/queries/anchors.js +1 -1
  194. package/dist/queries/architecture.js +1 -1
  195. package/dist/queries/bottlenecks.js +1 -1
  196. package/dist/queries/by-kind.js +1 -1
  197. package/dist/queries/call-graph.js +1 -1
  198. package/dist/queries/change-surface.js +1 -1
  199. package/dist/queries/cleanup-plan.js +1 -1
  200. package/dist/queries/co-change.js +1 -1
  201. package/dist/queries/code.js +1 -1
  202. package/dist/queries/complexity-hotspots.js +1 -1
  203. package/dist/queries/complexity.js +1 -1
  204. package/dist/queries/context.js +1 -1
  205. package/dist/queries/convergence.js +1 -1
  206. package/dist/queries/coupling.js +1 -1
  207. package/dist/queries/cycles.js +1 -1
  208. package/dist/queries/dataflow.js +1 -1
  209. package/dist/queries/dead.js +1 -1
  210. package/dist/queries/decorative-checkers.js +1 -1
  211. package/dist/queries/deep-chains.js +1 -1
  212. package/dist/queries/dependence-slice.js +1 -1
  213. package/dist/queries/dependency-depth.js +1 -1
  214. package/dist/queries/deps.js +1 -1
  215. package/dist/queries/diff-impact.js +1 -1
  216. package/dist/queries/doc-drift.js +1 -1
  217. package/dist/queries/drift.js +1 -1
  218. package/dist/queries/duplicate-bodies.js +1 -1
  219. package/dist/queries/entry-map.js +1 -1
  220. package/dist/queries/evidence.js +1 -1
  221. package/dist/queries/extract-candidates.js +1 -1
  222. package/dist/queries/fan.js +1 -1
  223. package/dist/queries/files.js +1 -1
  224. package/dist/queries/health.js +1 -1
  225. package/dist/queries/hierarchy.js +1 -1
  226. package/dist/queries/hotspots.js +1 -1
  227. package/dist/queries/imports.js +1 -1
  228. package/dist/queries/incomplete-migration.js +1 -1
  229. package/dist/queries/index.js +1 -1
  230. package/dist/queries/isolated.js +1 -1
  231. package/dist/queries/locality-candidates.js +1 -1
  232. package/dist/queries/members.js +1 -1
  233. package/dist/queries/methods.js +1 -1
  234. package/dist/queries/not-implemented.js +1 -1
  235. package/dist/queries/outline.js +1 -1
  236. package/dist/queries/passthrough-candidates.js +1 -1
  237. package/dist/queries/plan-context.js +1 -1
  238. package/dist/queries/react-component-duplicates.js +1 -1
  239. package/dist/queries/react-hook-candidates.js +1 -1
  240. package/dist/queries/react-large-component-pressure.js +1 -1
  241. package/dist/queries/recent-duplicates.js +1 -1
  242. package/dist/queries/redundant-reexports.js +1 -1
  243. package/dist/queries/reference-neighborhood.js +1 -1
  244. package/dist/queries/reference-reachability.js +1 -1
  245. package/dist/queries/refs.js +1 -1
  246. package/dist/queries/self-audit.js +1 -1
  247. package/dist/queries/similar-chains.js +1 -1
  248. package/dist/queries/similar-files.js +1 -1
  249. package/dist/queries/similar-signatures.js +1 -1
  250. package/dist/queries/similar.js +1 -1
  251. package/dist/queries/slice.js +1 -1
  252. package/dist/queries/source-inspection.js +1 -1
  253. package/dist/queries/source-search.js +1 -1
  254. package/dist/queries/stale-abstractions.js +1 -1
  255. package/dist/queries/surface.js +1 -1
  256. package/dist/queries/symbols.js +1 -1
  257. package/dist/queries/system-map.js +1 -1
  258. package/dist/queries/system.js +1 -1
  259. package/dist/queries/test-quality.js +1 -1
  260. package/dist/queries/trace.js +1 -1
  261. package/dist/queries/twin-ab.js +1 -1
  262. package/dist/queries/twin-drift.js +1 -1
  263. package/dist/queries/unused-imports.js +1 -1
  264. package/dist/queries/unused-params.js +1 -1
  265. package/dist/queries/value-flow.js +1 -1
  266. package/dist/queries/vue-component-duplicates.js +1 -1
  267. package/dist/queries/vue-composable-candidates.js +1 -1
  268. package/dist/queries/vue-large-view-pressure.js +1 -1
  269. package/dist/queries/wrapper-candidates.js +1 -1
  270. package/dist/reindex-worker.js +1 -1
  271. package/dist/reindex.js +30 -30
  272. package/dist/runtime.js +1 -1
  273. package/dist/rust-semantic-session-server.js +1 -1
  274. package/dist/rust-semantic-session-worker.js +1 -1
  275. package/dist/rust-semantic-worker.js +1 -1
  276. package/dist/sentinel-ensure-command-3MZCLPQY.js +2 -0
  277. package/dist/sentinel-ensure-command-LEWHIRLL.js +3 -0
  278. package/dist/sentinel-worker.js +1 -1
  279. package/dist/typescript-mailbox-worker.js +1 -1
  280. package/dist/watch-server.js +6 -6
  281. package/docs/COMMAND_REFERENCE.md +2 -2
  282. package/docs/SECURITY_MODEL.md +3 -0
  283. package/package.json +1 -1
  284. package/skills/codebaseiq/SKILL.md +15 -3
  285. package/dist/chunk-2I2UHZET.js +0 -2
  286. package/dist/chunk-5T44HG5Y.js +0 -88
  287. package/dist/chunk-5YBDBY5L.js +0 -2
  288. package/dist/chunk-6EYESTJM.js +0 -3
  289. package/dist/chunk-6FXXYYQM.js +0 -22
  290. package/dist/chunk-7UCDGXRW.js +0 -8
  291. package/dist/chunk-BIADXGC3.js +0 -22
  292. package/dist/chunk-CLPCFGRT.js +0 -3
  293. package/dist/chunk-DUKHVPU5.js +0 -4
  294. package/dist/chunk-G7GVV2TV.js +0 -27
  295. package/dist/chunk-KUKKLWJD.js +0 -3
  296. package/dist/chunk-KWRQVLPX.js +0 -3
  297. package/dist/chunk-MEUHIDI3.js +0 -7
  298. package/dist/chunk-OP6BUIV6.js +0 -2
  299. package/dist/chunk-OQ3DK7FW.js +0 -2
  300. package/dist/chunk-OT5ISJSR.js +0 -2
  301. package/dist/chunk-SX72EVMY.js +0 -3
  302. package/dist/chunk-T75DS2E6.js +0 -21
  303. package/dist/chunk-UC2FD2PS.js +0 -4
  304. package/dist/chunk-UQYQBLJX.js +0 -5
  305. package/dist/chunk-V4NGDIEA.js +0 -21
  306. package/dist/chunk-XUPFA6GH.js +0 -2
  307. package/dist/chunk-YPBKBYPS.js +0 -21
  308. package/dist/chunk-ZMA5HWXY.js +0 -3
  309. package/dist/cli-context-FJL2JHOE.js +0 -3
  310. package/dist/cli-context-PQNWHMCQ.js +0 -2
  311. package/dist/cli-program-SCHOHOQE.js +0 -7
  312. package/dist/direct-navigation-3JOYP2MO.js +0 -3
  313. package/dist/direct-navigation-SJMJLBY7.js +0 -2
  314. package/dist/invocation-command-descriptors-GMZX3UAD.js +0 -2
  315. package/dist/invocation-command-descriptors-HNMKDEF6.js +0 -3
  316. package/dist/output-continuation-command-5NWVDQT7.js +0 -2
  317. package/dist/output-continuation-command-RNEHNYPU.js +0 -3
  318. package/dist/project-reindex-MIW5CYEG.js +0 -3
  319. package/dist/project-reindex-VQ23LWDA.js +0 -2
  320. package/dist/sentinel-ensure-command-H66AZ3VE.js +0 -2
  321. package/dist/sentinel-ensure-command-R4YAUCJB.js +0 -3
@@ -0,0 +1,21 @@
1
+ import{a as Ee,b as Qe,e as tr}from"./chunk-EDMG5CSO.js";import{a as j,b as Vt,i as I,j as ie,l as Te,o as ke,r as N,s as C}from"./chunk-3F23W57G.js";import{a as te,c as Kt,d as Xt,e as ne}from"./chunk-OZI44VCR.js";import{C as Qt,D as K,F as Ge,G as Ht,I as Ut,J as Jt,M as Yt,N as He,O as Ce,P as Ue,S as Je,V as Zt,X as oe,Z as er,a as v,b as J,c as P,f as R,g as E,h as b,l as zt,la as Ye,m as Y,ma as Ke,q as Wt,v as Pe,w as F,x as re}from"./chunk-C3PPB2T5.js";var rr=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"],wo=["entry-surface","generated-code","compatibility-shim","reflection-or-registration","test-fixture","intentional-twin","historical-coupling-ended","detector-counterexample"];var Xe=2,z=3;var Ze=new Set(rr);function Ae(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(a){return{kind:"malformed",reason:`invalid JSON: ${kn(a)}`}}if(!j(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let r=t.version;if(!Number.isInteger(r))return{kind:"malformed",reason:"version must be an integer"};if(r!==Xe&&r!==z)return{kind:"unsupported",version:r,direction:r<Xe?"older":"future"};let n=En(t,r);if(n)return{kind:"malformed",reason:n};let i=t,o={metadata:i,capabilities:vn(i)};return r===Xe?{kind:"legacy",...o,metadata:i}:{kind:"supported",...o,metadata:i}}function Co(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function nr(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===z?t.sqliteLayoutVersion:void 0})}function vn(e){let t=e.fingerprint!==void 0,r=j(e.fingerprint),n=e.indexedLanguages!==void 0,i=e.status==="complete",o=e.version===z?e:null;return{usableForQuery:n,usableForEvidenceCache:t,publishableGeneration:i&&r&&n,stableGenerationIdentity:i&&t&&typeof e.updatedAt=="string",languageShardReuse:!!o?.languageFingerprints,typescriptProjectShardReuse:!!o?.typescriptProjectShards}}function En(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!Vt(e.updatedAt))return"updatedAt must be a valid timestamp";for(let r of["requestedLanguages","indexedLanguages"])if(e[r]!==void 0&&!Pn(e[r]))return`${r} must contain unique supported languages`;return e.skipped!==void 0&&!Gn(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===z&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===z&&e.languageFingerprints!==void 0&&!Cn(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===z&&e.typescriptProjectShards!==void 0&&!Tn(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function To(e){return e.version===z&&e.sqliteLayoutVersion===2}function Pn(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&Ze.has(t))?!1:new Set(e).size===e.length}function Gn(e){return Array.isArray(e)&&e.every(t=>j(t)&&typeof t.language=="string"&&Ze.has(t.language)&&typeof t.reason=="string")}function Cn(e){return j(e)&&Object.entries(e).every(([t,r])=>Ze.has(t)&&j(r))}function Tn(e){return j(e)&&Object.values(e).every(t=>j(t)&&Array.isArray(t.files)&&t.files.every(Wt))}function kn(e){return e instanceof Error?e.message:String(e)}import Yn from"better-sqlite3";import{createHash as Mn,randomUUID as _n}from"crypto";import{existsSync as W,mkdirSync as jn,readdirSync as Fn,rmSync as dr,statSync as lr}from"fs";import{basename as Nn,dirname as se,join as x}from"path";import{join as An}from"path";function De(e,t){return e.reason instanceof Error?e.reason:new Error(t)}function ir(e,t){if(e?.aborted)throw De(e,t)}var Dn=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.pid;return typeof t=="number"&&Number.isSafeInteger(t)&&t>0?{pid:t}:null};function or(e,t={}){return T(An(e,"gc.lock"),t)}function T(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??te,o=i()+r;do{let a=ar(e);if(a)return sr(a);let s=o-i();if(s<=0)return null;Ln(Math.min(n,s))}while(i()<=o);return null}async function _o(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??te,o=i()+r;do{ir(t.signal,"Lock acquisition was aborted.");let a=ar(e);if(a)return sr(a);let s=o-i();if(s<=0)return null;await On(Math.min(n,s),t.signal)}while(i()<=o);return null}function ar(e){let t=Te(e,{kind:"generic",parseLegacy:Dn});return t.kind==="acquired"?t.lock:null}function sr(e){return{release:()=>{e.release()}}}function Ln(e){let t=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(t,0,0,e)}function On(e,t){return t?.aborted?Promise.reject(De(t,"Lock acquisition was aborted.")):new Promise((r,n)=>{let i=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e),o=()=>{clearTimeout(i),t?.removeEventListener("abort",o),n(t?De(t,"Lock acquisition was aborted."):new Error("Lock acquisition was aborted."))};t?.addEventListener("abort",o,{once:!0})})}var V=1,nt=1,ce=".codebaseiq-generations",Oe="manifest.json",ur="readers",qn="gc.lock",Bn=128,ae=new Map,pr={pid:process.pid,now:()=>new Date,randomToken:()=>_n(),isProcessAlive:ie,readProcessIdentity:ne,resolveImmutableGeneration:gr};function y(e){return x(se(e),ce)}function de(e){return x(y(e),qn)}function fr(e,t=pr){if(Ut())return{generation:Le(e),release(){}};let r=T(de(e.dbPath),{waitMs:5e3});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");let n;try{let o=k(e.dbPath);if(!o||!le(e.dbPath,o.currentGeneration))return{generation:Le(e),release(){}};let a=t.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(a))throw new Error("SQLite generation reader token is unsafe.");let s=x(y(e.dbPath),ur);jn(s,{recursive:!0});let c=x(s,`${t.pid}-${a}.json`),d=t.readProcessIdentity(t.pid);N(c,{version:1,token:a,generationIdentity:o.currentGeneration,pid:t.pid,...d?{processIdentity:d}:{},acquiredAt:t.now().toISOString()},{spacing:2,trailingNewline:!0});let l=!1;n={identity:o.currentGeneration,required:o.artifactSet==="immutable-v1",release(){l||(l=!0,dr(c,{force:!0}))}}}finally{r.release()}let i;try{i=t.resolveImmutableGeneration(e,n.identity)}catch(o){throw n.release(),o}if(i?.source==="immutable"&&i.identity===n.identity)return{generation:i,release:n.release};if(n.release(),n.required)throw new Error(`Published SQLite generation ${n.identity} is missing or invalid.`);return $n(e,n.identity)}function $n(e,t){let r=T(de(e.dbPath),{waitMs:5e3});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");try{let n=k(e.dbPath);if(n?.currentGeneration!==t)throw new Error("SQLite index publication changed while opening a legacy generation.");if(W(x(se(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return{generation:mr(e,n.currentGeneration),release(){}}}finally{r.release()}}function it(e,t,r=pr,n={}){let i=x(y(e),ur);if(!W(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,a=0,s=0,c=0;for(let d of Fn(i,{withFileTypes:!0})){if(!d.isFile()||!d.name.endsWith(".json"))continue;let l=x(i,d.name),p;try{p=zn(JSON.parse(b(l,"SQLite generation reader lease")))}catch{p=null}if(!p){c+=1;for(let g of t)o.add(g);continue}if(!Wn(p,r)){n.removeStale!==!1&&(dr(l,{force:!0}),s+=1);continue}a+=1,o.add(p.generationIdentity)}return{protectedGenerations:o,activeLeases:a,staleLeasesRemoved:s,malformedLeases:c}}function zn(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,r=t.processIdentity===void 0?null:Kt(t.processIdentity);return t.version!==1||typeof t.token!="string"||t.token.trim()===""||typeof t.generationIdentity!="string"||!/^[a-f0-9]{64}$/.test(t.generationIdentity)||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.acquiredAt!="string"||!Number.isFinite(Date.parse(t.acquiredAt))||t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,token:t.token,generationIdentity:t.generationIdentity,pid:t.pid,...r?{processIdentity:r}:{},acquiredAt:t.acquiredAt}}function Wn(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||Xt(e.processIdentity,r)}function k(e){try{let t=JSON.parse(b(x(y(e),"state.json"),"SQLite generation state"));return Qn(t)?t:null}catch{return null}}function le(e,t){return ue(y(e),t)}function ue(e,t){try{let r=JSON.parse(b(x(e,t,Oe),"SQLite generation manifest"));return Vn(r,t)?r:null}catch{return null}}function Le(e){let t=k(e.dbPath);if(t){let r=gr(e,t.currentGeneration);if(r)return r;if(t.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${t.currentGeneration} is missing or invalid.`)}if(W(x(se(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return mr(e,t?.currentGeneration)}function Jo(e){let t=k(e);if(t)return t.currentGeneration;try{let r=x(se(e),"meta.json"),n=W(r)?b(r,"reindex metadata"):void 0;return yr(e,n)}catch{return null}}function q(e){return nr(Ae(e))??e}function gr(e,t){try{let r=x(y(e.dbPath),t),n=le(e.dbPath,t);if(!n)return null;let i=et(r,n.database),o=n.index?et(r,n.index):void 0,a=n.metadata?et(r,n.metadata):void 0;return!tt(i,n.database)||n.index&&(!o||!tt(o,n.index))||n.metadata&&(!a||!tt(a,n.metadata))?null:{identity:t,databasePath:i,...o?{indexPath:o}:{},...a?{metadataPath:a,metadataRaw:b(a,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function mr(e,t){let r=O(e.dbPath),n=x(se(e.dbPath),"meta.json"),i=W(n)?b(n,"reindex metadata"):void 0,o=W(e.indexPath)?e.indexPath:void 0;return{identity:t??yr(e.dbPath,i),databasePath:e.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:n,metadataRaw:i},source:"legacy",databaseFileIdentity:r}}function yr(e,t){let r=Mn("sha256").update("sqlite-generation-legacy-v1\0");return t!==void 0&&r.update(q(t)),r.update(`\0${O(e)}`),r.digest("hex")}function O(e){let t=lr(e);return`${t.dev}:${t.ino}:${t.size}:${t.mtimeMs}`}function et(e,t){if(Nn(t.file)!==t.file||t.file==="."||t.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return x(e,t.file)}function tt(e,t){if(!W(e))return!1;let r=cr(e);if(!r||r.size!==t.size)return!1;let n=`${e}\0${t.sha256}\0${r.identity}`;if(ae.has(n))return!0;let i=Y(e,{inputKind:"immutable SQLite generation artifact",maxBytes:t.size}),o=cr(e);if(!o||o.identity!==r.identity||i!==t.sha256)return!1;for(ae.set(n,!0);ae.size>Bn;){let a=ae.keys().next().value;if(a===void 0)break;ae.delete(a)}return!0}function cr(e){let t=lr(e,{bigint:!0});return t.isFile()?{identity:`${t.dev}:${t.ino}:${t.size}:${t.mtimeNs}:${t.ctimeNs}`,size:Number(t.size)}:null}function Vn(e,t){return e.version===nt&&e.identity===t&&rt(e.database)&&(e.index===void 0||rt(e.index))&&(e.metadata===void 0||rt(e.metadata))}function rt(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.file=="string"&&!!t.file&&Number.isSafeInteger(t.size)&&(t.size??-1)>=0&&typeof t.sha256=="string"&&/^[a-f0-9]{64}$/.test(t.sha256)}function Qn(e){return e.version===V&&typeof e.currentGeneration=="string"&&!!e.currentGeneration&&typeof e.publishedAt=="string"&&Number.isFinite(Date.parse(e.publishedAt))&&(e.artifactSet===void 0||e.artifactSet==="immutable-v1")&&Hn(e.stableMirrors)&&Un(e.previousGeneration)&&Jn(e.publication)}function Hn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.databaseFileIdentity=="string"&&!!t.databaseFileIdentity&&(t.indexFileIdentity===void 0||typeof t.indexFileIdentity=="string"&&!!t.indexFileIdentity)}function Un(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.generationIdentity=="string"&&!!t.generationIdentity&&typeof t.databasePath=="string"&&!!t.databasePath&&(t.metadataPath===void 0||typeof t.metadataPath=="string"&&!!t.metadataPath)}function Jn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e,r=[t.converterDurationMs,t.affectedDocumentCount,t.changedDocumentCount,t.producerDurationMs,t.materializationDurationMs,t.patchDurationMs].filter(n=>n!==void 0);return(t.mode==="incremental"||t.mode==="full")&&t.validation==="passed"&&t.converterDurationMs!==void 0&&r.every(n=>typeof n=="number"&&Number.isFinite(n)&&n>=0)&&(t.scipCompanion===void 0||t.scipCompanion==="current"||t.scipCompanion==="deferred")&&(t.typescriptOverlayGeneration===void 0||typeof t.typescriptOverlayGeneration=="string"&&!!t.typescriptOverlayGeneration)&&(t.scipCompanion!=="deferred"||!!t.typescriptOverlayGeneration)&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")}var Kn=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],ot=class{constructor(t,r){this.connection=t;this.releaseGenerationReader=r}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let r of Kn)this.connection.pragma(r);t(this.connection)}catch(r){try{this.close()}catch(n){throw new AggregateError([r,n],"SQLite initialization and rollback both failed.",{cause:n})}throw r}}close(){if(!this.active)return;this.active=!1;let t,r;try{this.connection.close()}catch(n){t=n}try{this.releaseGenerationReader()}catch(n){r=n}if(t!==void 0&&r!==void 0)throw new AggregateError([t,r],"SQLite connection close and generation-reader release both failed.");if(t!==void 0)throw t;if(r!==void 0)throw r}},Xn=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".codebaseiq-cache","__pycache__",".venv","venv"],hr=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;closed=!1;constructor(t,r){this.config=t,this.pathFilter=r??null;let n=ri(t),i=new ot(n.db,n.release);try{i.initialize(ti),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=i,this.db=Zn(n.db)}catch(o){try{i.close()}catch(a){throw new AggregateError([o,a],"SQLite construction and rollback both failed.",{cause:a})}throw o}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
2
+ EXISTS (
3
+ SELECT 1
4
+ FROM defn_enclosing_ranges local_der
5
+ JOIN documents local_d ON local_der.document_id = local_d.id
6
+ WHERE local_der.symbol_id = gs.id
7
+ ${this.pathExclusionsFor("local_d").trimStart()}
8
+ )
9
+ OR EXISTS (
10
+ SELECT 1
11
+ FROM mentions local_m
12
+ JOIN chunks local_c ON local_m.chunk_id = local_c.id
13
+ JOIN documents local_d ON local_c.document_id = local_d.id
14
+ WHERE local_m.symbol_id = gs.id
15
+ AND local_m.role = 1
16
+ ${this.pathExclusionsFor("local_d").trimStart()}
17
+ )
18
+ )`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(r=>Xn.flatMap(n=>[`AND ${r}.relative_path NOT LIKE '${n}/%'`,`AND ${r}.relative_path NOT LIKE '%/${n}/%'`])).join(`
19
+ `)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...r){return this.statement(t).all(...r)}get(t,...r){return this.statement(t).get(...r)}close(){if(this.closed)return;this.closed=!0,this.statementCache.clear();let t,r;try{tr(this)}catch(n){t=n}try{this.connectionOwnership.close()}catch(n){r=n}if(t!==void 0&&r!==void 0)throw new AggregateError([t,r],"Database-owned resource and SQLite connection cleanup both failed.");if(t!==void 0)throw t;if(r!==void 0)throw r}statement(t){let r=this.statementCache.get(t);return r||(r=this.connection.prepare(t),this.statementCache.set(t,r)),r}};function Zn(e){return Object.freeze({prepare(t){let r=e.prepare(t);if(!r.readonly||!r.reader)throw new Error("ScipDatabase.db only permits read-only statements that return rows.");return ei(r)}})}function ei(e){let t={get:(...r)=>e.get(...r),all:(...r)=>e.all(...r),iterate:(...r)=>e.iterate(...r),pluck(r){return r===void 0?e.pluck():e.pluck(r),t},expand(r){return r===void 0?e.expand():e.expand(r),t},raw(r){return r===void 0?e.raw():e.raw(r),t},bind(...r){return e.bind(...r),t},columns:()=>e.columns(),safeIntegers(r){return r===void 0?e.safeIntegers():e.safeIntegers(r),t}};return Object.freeze(t)}function ti(e){if(!e.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'documents'").get())return;let r=e.prepare("SELECT relative_path FROM documents").iterate();for(let n of r)Ge(n.relative_path)}function ri(e){for(let t=0;t<4;t+=1){let r=fr(e),n=r.generation,i;try{i=new Yn(Ee(n.databasePath),{readonly:!0,fileMustExist:!0})}catch(o){throw r.release(),o}if(n.source==="immutable")return{db:i,generation:n,release:r.release};try{let o=Le(e);if(n.databaseFileIdentity===O(n.databasePath)&&o.source==="legacy"&&o.identity===n.identity&&o.databaseFileIdentity===n.databaseFileIdentity&&o.metadataRaw===n.metadataRaw)return{db:i,generation:n,release:r.release}}catch(o){throw i.close(),r.release(),o}i.close(),r.release()}throw new Error("SQLite index publication changed repeatedly while opening a coherent generation.")}import{createHash as mn,randomUUID as oo}from"crypto";import{existsSync as _,lstatSync as kt,mkdirSync as ee,readdirSync as yn,realpathSync as hn,renameSync as U,rmSync as B,statSync as We}from"fs";import{dirname as At,join as u,resolve as we}from"path";import{setTimeout as ao}from"timers/promises";import{pathToFileURL as ln}from"url";import{deserializeSCIP as Sn}from"@c4312/scip";import so from"better-sqlite3";import{execFileSync as ni}from"child_process";import{existsSync as ii,readdirSync as br}from"fs";import{extname as Ir,join as xr}from"path";var wr=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),oi=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function at(e){let t=[],r=ai(e),n=li(e);for(let i of oi){if(si(e,i.files)){t.push(i.language);continue}if(ci(r,i.globs)){t.push(i.language);continue}pi(n,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&Sr(t,"javascript"),t.includes("cpp")&&!n.has(".c")&&Sr(t,"c"),t}function ai(e){try{return br(e)}catch{return[]}}function si(e,t){return t?.length?t.some(r=>ii(xr(e,r))):!1}function ci(e,t){return t?.length?e.some(r=>t.some(n=>di(r,n))):!1}function di(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[r,n]=t.split("*");return e.startsWith(r??"")&&e.endsWith(n??"")}function li(e){let t=ui(e);if(t)return t;let r=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!i)continue;let o;try{o=br(i,{withFileTypes:!0})}catch{continue}for(let a of o){if(a.name.startsWith(".")&&!a.name.endsWith("proj")&&!a.name.endsWith("sln")&&a.isDirectory())continue;let s=xr(i,a.name);if(a.isDirectory()){wr.has(a.name)||n.push(s);continue}let c=Ir(a.name).toLowerCase();c&&r.add(c)}}return r}function ui(e){try{let t=ni("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}),r=new Set;for(let n of t.split(`
20
+ `)){if(!n||n.split("/").some(o=>wr.has(o)))continue;let i=Ir(n).toLowerCase();i&&r.add(i)}return r}catch{return null}}function pi(e,t){return t?.length?t.some(r=>e.has(r)):!1}function Sr(e,t){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}import{lstatSync as Pi,readdirSync as Gi}from"fs";import{join as Ci,relative as Ti,resolve as mt,sep as ki}from"path";import{createHash as fi}from"crypto";import{existsSync as pe,mkdirSync as gi,readdirSync as Rr,renameSync as mi,rmSync as vr,writeFileSync as yi}from"fs";import{join as M}from"path";import{create as Pr,fromBinary as Gr,toBinary as hi}from"@bufbuild/protobuf";import{deserializeSCIP as Me,DocumentSchema as ct,IndexSchema as Cr,serializeSCIP as Tr}from"@c4312/scip";var _e=1,fe="typescript-scip-fragments";function ga(e){if(e.length===0)throw new Error("affected TypeScript mini index requires documents");let t=new Set,r=[];for(let o of e){let a=Q(o.relativePath);if(t.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(t.add(a),o.bytes===null)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${a}`);let s=Gr(ct,o.bytes);if(s.relativePath!==a)throw new Error(`TypeScript fragment path mismatch: expected ${a}, got ${s.relativePath}`);r.push(s)}let n=Tr(Pr(Cr,{documents:r,externalSymbols:[]})),i=Me(n);if(i.documents.length!==r.length||i.externalSymbols.length!==0)throw new Error("affected TypeScript SCIP index failed structural verification");return n}function ge(e){let t=M(e,fe);return{rootDir:t,blobDir:M(t,"blobs"),generationDir:M(t,"generations")}}function Si(e){let t=Me(e.indexBytes);Fr(t.metadata,Nr(e)),jr(t.externalSymbols);let r=new Set,n=[];for(let o of t.documents){let a=Q(o.relativePath);if(r.has(a))throw new Error(`duplicate TypeScript SCIP document path: ${a}`);r.add(a);let s=hi(ct,o),c=e.documentIdentities.get(a)??(e.allowUntrackedDocuments?H(JSON.stringify({version:1,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,untrackedDocument:a,contentHash:H(s)})):null);if(!c)throw new Error(`missing TypeScript document identity: ${a}`);n.push(Lr(e.cacheDir,{relativePath:a,bytes:s,occurrences:o.occurrences.length,symbols:o.symbols.length,referenceFragments:[]},c))}let i=Or(e,n);return Mr(e.cacheDir,i),i}function ma(e){let t=ge(e.cacheDir);if(!pe(lt(t,e.generationIdentity)))return Si(e);let r=kr({cacheDir:e.cacheDir,generationIdentity:e.generationIdentity,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity});if(!e.allowUntrackedDocuments&&r.manifest.documents.length!==e.documentIdentities.size)throw new Error("TypeScript fragment generation document identities changed");for(let n of r.manifest.documents){let i=e.documentIdentities.get(n.relativePath);if(!(i===void 0&&e.allowUntrackedDocuments)&&i!==n.documentIdentity)throw new Error(`TypeScript fragment generation document identity changed: ${n.relativePath}`)}return r.manifest}function ya(e){let t=kr({cacheDir:e.cacheDir,generationIdentity:e.previousGenerationIdentity,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity}).manifest,r=new Map(t.documents.map(o=>[o.relativePath,o])),n=new Set;for(let o of e.fragments){let a=Q(o.relativePath);if(n.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(n.add(a),!r.has(a))throw new Error(`TypeScript fragment replacement has no prior document: ${a}`);let s=e.documentIdentities.get(a);if(!s)throw new Error(`missing TypeScript document identity: ${a}`);o.bytes===null?r.delete(a):r.set(a,Lr(e.cacheDir,o,s))}if(n.size===0)throw new Error("TypeScript fragment generation requires at least one replacement");let i=Or(e,[...r.values()]);return Mr(e.cacheDir,i),i}function kr(e){let t=ge(e.cacheDir),r=lt(t,e.generationIdentity),n;try{n=dt(E(r,{maxBytes:v,inputKind:"TypeScript fragment manifest"}))}catch(o){throw new Error(`TypeScript fragment generation is unavailable: ${o instanceof Error?o.message:String(o)}`,{cause:o})}if(n.generationIdentity!==e.generationIdentity)throw new Error("TypeScript fragment generation identity does not match its manifest path");if(e.producerIdentity&&n.producerIdentity!==e.producerIdentity)throw new Error("TypeScript fragment producer identity changed");if(e.projectIdentity&&n.projectIdentity!==e.projectIdentity)throw new Error("TypeScript fragment project identity changed");let i=new Map;for(let o of n.documents){let a=M(t.blobDir,`${o.blobHash}.scipdoc`),s=R(a,{maxBytes:J,inputKind:"TypeScript fragment blob"});if(s.byteLength!==o.byteLength||H(s)!==o.blobHash)throw new Error(`TypeScript fragment blob is corrupt: ${o.relativePath}`);i.set(o.relativePath,s)}return{manifest:n,fragments:i}}function Ar(e){let t=Dr(e);return st(t.baseIndex,t.completeDocuments,"assembled")}function ha(e){let t=Dr(e);return bi(t.deletedAffectedPaths),{completeIndexBytes:st(t.baseIndex,t.completeDocuments,"assembled"),affectedIndexBytes:st(t.baseIndex,t.affectedDocuments,"affected")}}function Dr(e){let t=Me(e.baseIndexBytes);Fr(t.metadata,Nr(e)),jr(t.externalSymbols);let r=new Map;for(let s of e.fragments){let c=Q(s.relativePath);if(r.has(c))throw new Error(`duplicate TypeScript fragment replacement: ${c}`);r.set(c,s)}if(r.size===0)throw new Error("TypeScript index assembly requires at least one replacement");let n=new Set,i=[],o=[],a=[];for(let s of t.documents){let c=Q(s.relativePath);if(n.has(c))throw new Error(`duplicate TypeScript SCIP document path: ${c}`);n.add(c);let d=r.get(c);if(!d){i.push(s);continue}if(r.delete(c),d.bytes===null){a.push(c);continue}let l=Gr(ct,d.bytes);if(l.relativePath!==c)throw new Error(`TypeScript fragment path mismatch: expected ${c}, got ${l.relativePath}`);i.push(l),o.push(l)}if(r.size>0)throw new Error(`TypeScript fragment replacement has no prior document: ${[...r.keys()].sort()[0]}`);return{baseIndex:t,completeDocuments:i,affectedDocuments:o,deletedAffectedPaths:a}}function st(e,t,r){let n=Tr(Pr(Cr,{metadata:e.metadata,documents:t,externalSymbols:[]})),i=Me(n);if(i.documents.length!==t.length||i.externalSymbols.length!==0)throw new Error(`${r} TypeScript SCIP index failed structural verification`);return n}function bi(e){if(e.length>0)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${e[0]}`)}function Sa(e,t){let r=ge(e);if(!pe(r.generationDir))return;let n=new Set(t.map(a=>_r(a))),i=Rr(r.generationDir).filter(a=>a.endsWith(".json")),o=new Set;for(let a of i.filter(s=>n.has(s))){let s=dt(E(M(r.generationDir,a),{maxBytes:v,inputKind:"TypeScript fragment manifest"}));for(let c of s.documents)o.add(`${c.blobHash}.scipdoc`)}for(let a of i)n.has(a)||vr(M(r.generationDir,a),{force:!0});if(pe(r.blobDir))for(let a of Rr(r.blobDir))o.has(a)||vr(M(r.blobDir,a),{force:!0})}function Lr(e,t,r){if(t.bytes===null)throw new Error(`cannot persist an empty TypeScript fragment: ${t.relativePath}`);let n=Q(t.relativePath),i=Buffer.from(t.bytes),o=H(i),a=ge(e);gi(a.blobDir,{recursive:!0});let s=M(a.blobDir,`${o}.scipdoc`);if(pe(s)){let c=R(s,{maxBytes:J,inputKind:"TypeScript fragment blob"});if(c.byteLength!==i.byteLength||H(c)!==o)throw new Error(`existing TypeScript fragment blob is corrupt: ${n}`)}else{let c=`${s}.${process.pid}.${Date.now()}.tmp`;yi(c,i),mi(c,s)}return{relativePath:n,blobHash:o,byteLength:i.byteLength,documentIdentity:r}}function Or(e,t){if(!e.producerIdentity||!e.projectIdentity||!e.generationIdentity)throw new Error("TypeScript fragment generation identities must be non-empty");let r=[...t].sort((n,i)=>n.relativePath.localeCompare(i.relativePath));if(new Set(r.map(n=>n.relativePath)).size!==r.length)throw new Error("TypeScript fragment generation contains duplicate document paths");return{version:_e,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,generationIdentity:e.generationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),documents:r}}function Mr(e,t){let r=ge(e),n=lt(r,t.generationIdentity);if(pe(n)){let i=dt(E(n,{maxBytes:v,inputKind:"TypeScript fragment manifest"}));if(Er(i)!==Er(t))throw new Error(`TypeScript fragment generation is immutable: ${t.generationIdentity}`);return}N(n,t,{spacing:2,trailingNewline:!0})}function Er(e){return H(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,generationIdentity:e.generationIdentity,documents:e.documents}))}function dt(e){let t=JSON.parse(e);if(t.version!==_e||typeof t.producerIdentity!="string"||typeof t.projectIdentity!="string"||typeof t.generationIdentity!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.documents))throw new Error("invalid TypeScript fragment generation manifest");let r=new Set;for(let n of t.documents){if(!n||typeof n.relativePath!="string"||typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash)||typeof n.byteLength!="number"||!Number.isInteger(n.byteLength)||n.byteLength<0||typeof n.documentIdentity!="string"||!n.documentIdentity)throw new Error("invalid TypeScript fragment record");if(Q(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript fragment record");r.add(n.relativePath)}return t}function lt(e,t){return M(e.generationDir,_r(t))}function _r(e){if(!e)throw new Error("TypeScript fragment generation identity must be non-empty");return`${H(e)}.json`}function jr(e){if(e.length>0)throw new Error("scip-typescript emitted external symbols; incremental document assembly is unsupported")}function Fr(e,t){if(!e||typeof e!="object")throw new Error("TypeScript SCIP shard has no producer metadata");let r=e,n=r.toolInfo??r.tool_info;if(!n||typeof n!="object")throw new Error("TypeScript SCIP shard has no producer tool identity");let i=n;if(i.name!=="scip-typescript"||i.version!==t)throw new Error("TypeScript SCIP shard producer identity changed")}function Nr(e){let t=e.packageVersion??e.runtime?.packageVersion;if(!t)throw new Error("scip-typescript package version is unavailable");return t}function Q(e){if(!e||e.startsWith("/")||e.startsWith("\\")||e.includes("\\"))throw new Error(`invalid TypeScript SCIP document path: ${e}`);let t=e.split("/");if(t.includes("")||t.includes(".")||t.includes(".."))throw new Error(`invalid TypeScript SCIP document path: ${e}`);return e}function H(e){return fi("sha256").update(e).digest("hex")}import{createHash as Ii}from"crypto";import{existsSync as me,mkdirSync as xi,readdirSync as ut,renameSync as wi,rmSync as qr,writeFileSync as Ri}from"fs";import{join as G}from"path";var je=1,Pa=64*1024*1024,he="typescript-scip-overlays";function Ga(e){let t=$r(e.cacheDir,e.previousGenerationIdentity);if(!t&&!e.baseShardCurrent)throw new Error("deferred TypeScript SCIP base has no matching overlay generation");if(t&&(t.producerIdentity!==e.producerIdentity||t.projectIdentity!==e.projectIdentity))throw new Error("TypeScript overlay producer or project identity changed");let r=new Map((t?.overlays??[]).map(o=>[o.relativePath,o])),n=new Set;for(let o of e.fragments){let a=gt(o.relativePath);if(n.has(a))throw new Error(`duplicate TypeScript overlay: ${a}`);n.add(a),r.set(a,vi(e.cacheDir,o))}if(n.size===0)throw new Error("TypeScript overlay generation requires affected documents");let i={version:je,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:t?.baseGenerationIdentity??e.previousGenerationIdentity,generationIdentity:e.nextGenerationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),overlays:[...r.values()].sort((o,a)=>o.relativePath.localeCompare(a.relativePath))};return Ei(e.cacheDir,i),i}function Ca(e){let t=$r(e.cacheDir,e.generationIdentity);if(!t)throw new Error("TypeScript overlay generation is unavailable");let r=t.overlays.map(n=>{if(n.blobHash===null)return{relativePath:n.relativePath,bytes:null,occurrences:0,symbols:0,referenceFragments:[]};let i=R(G(Se(e.cacheDir),"blobs",`${n.blobHash}.scipdoc`),{maxBytes:J,inputKind:"TypeScript overlay blob"});if(i.byteLength!==n.byteLength||ye(i)!==n.blobHash)throw new Error(`TypeScript overlay blob is corrupt: ${n.relativePath}`);return{relativePath:n.relativePath,bytes:i,occurrences:0,symbols:0,referenceFragments:[]}});return Ar({packageVersion:e.packageVersion,baseIndexBytes:e.baseIndexBytes,fragments:r})}function Ta(e,t){let r=Se(e),n=G(r,"generations");if(!me(n))return;let i=new Set(t.map(ft)),o=new Set;for(let s of ut(n).filter(c=>i.has(c))){let c=pt(E(G(n,s),{maxBytes:v,inputKind:"TypeScript overlay manifest"}));for(let d of c.overlays)d.blobHash&&o.add(`${d.blobHash}.scipdoc`)}for(let s of ut(n))i.has(s)||qr(G(n,s),{force:!0});let a=G(r,"blobs");if(me(a))for(let s of ut(a))o.has(s)||qr(G(a,s),{force:!0})}function $r(e,t){let r=G(Se(e),"generations",ft(t));if(!me(r))return null;let n=pt(E(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(n.generationIdentity!==t)throw new Error("TypeScript overlay generation identity does not match its path");return n}function vi(e,t){let r=gt(t.relativePath);if(t.bytes===null)return{relativePath:r,blobHash:null,byteLength:0};let n=Buffer.from(t.bytes),i=ye(n),o=G(Se(e),"blobs");xi(o,{recursive:!0});let a=G(o,`${i}.scipdoc`);if(me(a)){let s=R(a,{maxBytes:J,inputKind:"TypeScript overlay blob"});if(s.byteLength!==n.byteLength||ye(s)!==i)throw new Error(`existing TypeScript overlay blob is corrupt: ${r}`)}else{let s=`${a}.${process.pid}.${Date.now()}.tmp`;Ri(s,n),wi(s,a)}return{relativePath:r,blobHash:i,byteLength:n.byteLength}}function Ei(e,t){let r=G(Se(e),"generations",ft(t.generationIdentity));if(me(r)){let n=pt(E(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(Br(n)!==Br(t))throw new Error(`TypeScript overlay generation is immutable: ${t.generationIdentity}`);return}N(r,t,{spacing:2,trailingNewline:!0})}function pt(e){let t=JSON.parse(e);if(t.version!==je||typeof t.producerIdentity!="string"||!t.producerIdentity||typeof t.projectIdentity!="string"||!t.projectIdentity||typeof t.baseGenerationIdentity!="string"||!t.baseGenerationIdentity||typeof t.generationIdentity!="string"||!t.generationIdentity||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.overlays))throw new Error("invalid TypeScript overlay manifest");let r=new Set;for(let n of t.overlays){if(!n||typeof n.relativePath!="string"||n.blobHash!==null&&(typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash))||!Number.isInteger(n.byteLength)||n.byteLength<0||n.blobHash===null&&n.byteLength!==0)throw new Error("invalid TypeScript overlay record");if(gt(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript overlay record");r.add(n.relativePath)}return t}function Se(e){return G(e,he)}function ft(e){if(!e)throw new Error("TypeScript overlay generation identity must be non-empty");return`${ye(e)}.json`}function Br(e){return ye(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:e.baseGenerationIdentity,generationIdentity:e.generationIdentity,overlays:e.overlays}))}function gt(e){if(!e||e.startsWith("/")||e.includes("\\")||e.split("/").some(t=>!t||t==="."))throw new Error(`invalid TypeScript overlay path: ${e}`);if(e.split("/").includes(".."))throw new Error(`invalid TypeScript overlay path: ${e}`);return e}function ye(e){return Ii("sha256").update(e).digest("hex")}var be=1,yt="language-indexes",zr=["index.db","index.scip","meta.json"],Wr=[yt,fe,he];function Fe(e){let t=[];for(let r of zr)Ai(e,r),t.push(r);for(let r of Wr)Vr(e,r,t);return{version:be,files:t.sort()}}function Ne(e){if(!e||e.includes("\0")||e.startsWith("/")||e.includes("\\"))throw new Error(`invalid index artifact path: ${e||"<empty>"}`);let t=e.split("/");if(t.some(n=>!n||n==="."||n===".."))throw new Error(`invalid index artifact path: ${e}`);let r=t[0];if(!zr.includes(e)&&!Wr.includes(r))throw new Error(`index artifact path is not shareable: ${e}`);return e}function A(e,t){let r=Ne(t),n=mt(e),i=mt(n,...r.split("/"));if(i!==n&&!i.startsWith(`${n}${ki}`))throw new Error(`index artifact escapes cache: ${t}`);return i}function Vr(e,t,r){let n=Ci(e,t),i;try{i=Gi(n,{withFileTypes:!0,encoding:"utf8"})}catch{return}for(let o of i){let a=`${t}/${o.name}`;if(o.isSymbolicLink())throw new Error(`index artifact cannot be a symlink: ${a}`);o.isDirectory()?Vr(e,a,r):o.isFile()&&r.push(Ne(a))}}function Ai(e,t){let r=A(e,t),n;try{n=Pi(r)}catch{throw new Error(`required index artifact is missing: ${t}`)}if(!n.isFile()||n.isSymbolicLink())throw new Error(`required index artifact is not a regular file: ${t}`);if(Ti(mt(e),r).startsWith(".."))throw new Error(`index artifact escapes cache: ${t}`)}import{writeFileSync as ht}from"fs";import{create as X}from"@bufbuild/protobuf";import{deserializeSCIP as St,serializeSCIP as bt,DocumentSchema as Mi,IndexSchema as Ur,MetadataSchema as Jr,SymbolInformationSchema as _i}from"@c4312/scip";import{create as Qr}from"@bufbuild/protobuf";import{DocumentSchema as Di,IndexSchema as Li,SymbolRole as Oi}from"@c4312/scip";function Hr(e){let t=new Set,r=new Map;for(let a of e.documents){r.set(a,Ge(a.relativePath));for(let s of a.symbols)s.symbol&&t.add(s.symbol)}for(let a of e.externalSymbols)a.symbol&&t.add(a.symbol);let n=0,i=0,o=[];for(let a of e.documents){let s=r.get(a),c=a.occurrences.filter(d=>(d.symbolRoles&Oi.Definition)===0||t.has(d.symbol)?!0:(n+=1,!1));if(s===a.relativePath&&c.length===a.occurrences.length){o.push(a);continue}i+=1,o.push(Qr(Di,{language:a.language,relativePath:s,occurrences:c,symbols:a.symbols,text:a.text,positionEncoding:a.positionEncoding}))}return{index:i===0?e:Qr(Li,{metadata:e.metadata,documents:o,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:i}}function Yr(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=Fi(e),r=Ni(e.flatMap(i=>i.documents??[])),n=Xr(e.flatMap(i=>i.externalSymbols??[]));return X(Ur,{metadata:t,documents:r,externalSymbols:n})}function Qa(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>St(R(i,{inputKind:"SCIP merge input",maxBytes:P}))),n=Yr(r);return ht(t,Buffer.from(bt(n))),{documentCount:n.documents.length,externalSymbolCount:n.externalSymbols.length,inputCount:e.length}}function Ha(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>St(R(i,{inputKind:"SCIP merge input",maxBytes:P}))),n=Hr(Yr(r));return ht(t,Buffer.from(bt(n.index))),{documentCount:n.index.documents.length,externalSymbolCount:n.index.externalSymbols.length,inputCount:e.length,removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function ji(e,t,r){let n=e.metadata;if(!n)throw new Error("Cannot rebase a SCIP index without metadata");if(!K(n.projectRoot,t))throw new Error(`Cannot rebase SCIP project root: expected ${t}, got ${n.projectRoot}`);return X(Ur,{metadata:X(Jr,{...n,projectRoot:r}),documents:e.documents,externalSymbols:e.externalSymbols})}function Kr(e,t,r){let n=St(R(e,{inputKind:"SCIP normalization input",maxBytes:P})),i=ji(n,t,r);ht(e,Buffer.from(bt(i)))}function Fi(e){let t=e[0]?.metadata;if(!t)return;let r=t.projectRoot;for(let i of e.slice(1)){let o=i.metadata?.projectRoot;if(r&&o&&!K(o,r))throw new Error(`Cannot merge SCIP indexes with different project roots: ${r} vs ${o}`)}let n=r&&Qt(r);return n===r?t:X(Jr,{...t,projectRoot:n})}function Ni(e){let t=new Map;for(let r of e){let n=t.get(r.relativePath);if(!n){t.set(r.relativePath,r);continue}t.set(r.relativePath,X(Mi,{language:n.language||r.language,relativePath:n.relativePath||r.relativePath,occurrences:qi([...n.occurrences,...r.occurrences]),symbols:Xr([...n.symbols,...r.symbols]),text:$i(n.text,r.text),positionEncoding:n.positionEncoding||r.positionEncoding}))}return[...t.values()]}function qi(e){let t=new Set,r=[];for(let n of e){let i=JSON.stringify(n);t.has(i)||(t.add(i),r.push(n))}return r}function Xr(e){let t=new Map;for(let r of e){let n=t.get(r.symbol);if(!n){t.set(r.symbol,r);continue}t.set(r.symbol,X(_i,{symbol:n.symbol,documentation:zi([...n.documentation,...r.documentation]),relationships:Bi([...n.relationships,...r.relationships]),kind:n.kind||r.kind,displayName:n.displayName||r.displayName,enclosingSymbol:n.enclosingSymbol||r.enclosingSymbol,signatureDocumentation:n.signatureDocumentation??r.signatureDocumentation}))}return[...t.values()]}function Bi(e){let t=new Set,r=[];for(let n of e){let i=[n.symbol,n.isReference?"1":"0",n.isImplementation?"1":"0",n.isTypeDefinition?"1":"0",n.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),r.push(n))}return r}function $i(e,t){return e?t?e.length>=t.length?e:t:e:t}function zi(e){return[...new Set(e)]}import{createHash as Et}from"crypto";import{closeSync as Wi,existsSync as m,mkdirSync as Vi,openSync as Qi,readSync as Hi,readdirSync as Pt,renameSync as Rt,rmSync as Ie,statSync as Z}from"fs";import{basename as rn,dirname as D,join as f,relative as Zr}from"path";var vt=Object.freeze({maxGenerations:2,maxLogicalBytes:2*1024*1024*1024});function nn(e){let t=y(e.outputDb),r=Xi(e);e.onStage?.("after-recovery-retained");let n=e.preserveOutputScip?e.outputScip:e.tempOutputScip,i=Tt({generationRoot:t,databasePath:e.tempOutputDb,indexPath:m(n)?n:void 0,metadataPath:m(e.tempMetaPath)?e.tempMetaPath:void 0}),o=(e.now??(()=>new Date))().toISOString(),a={version:V,currentGeneration:i.identity,artifactSet:"immutable-v1",...r?{previousGeneration:r}:{},...e.publication?{publication:e.publication}:{},publishedAt:o},s=C(f(t,"state.json"),a,{spacing:2,trailingNewline:!0});e.onStage?.("after-pointer-handoff"),e.preserveOutputScip||wt(e.tempOutputScip,e.outputScip),e.onStage?.("after-scip-handoff"),wt(e.tempOutputDb,e.outputDb),e.onStage?.("after-database-handoff"),wt(e.tempMetaPath,e.metaPath),e.onStage?.("after-metadata-handoff");let c=i.identity,d={...a,stableMirrors:Ct(e.outputDb,e.outputScip)};C(f(t,"state.json"),d,{spacing:2,trailingNewline:!0});let l=on(e.outputDb,{now:e.now}),p=re(i.directorySync,s.directorySync);return{currentGeneration:c,...r?{previousGeneration:r}:{},retention:l,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}function Ui(e,t,r,n=()=>new Date){if(!m(e))return null;let i=k(e),o=f(y(e),"state.json");if(i?.artifactSet==="immutable-v1"&&le(e,i.currentGeneration))return i;let a=y(e),s=!i&&m(o)?eo(r,e,t):void 0;if(s&&!ue(a,s))return null;let c=Tt({generationRoot:a,databasePath:e,indexPath:m(t)?t:void 0,metadataPath:m(r)?r:void 0,forcedIdentity:i?.currentGeneration??s}),d={version:V,currentGeneration:c.identity,artifactSet:"immutable-v1",stableMirrors:Ct(e,t),...i?.previousGeneration?{previousGeneration:i.previousGeneration}:{},...i?.publication?{publication:i.publication}:{},publishedAt:i?.publishedAt??n().toISOString()};return C(f(a,"state.json"),d,{spacing:2,trailingNewline:!0}),d}function as(e,t,r=()=>new Date){if(!m(e)||!m(t))throw new Error("metadata-only generation refresh requires stable database and metadata files");let n=k(e),i=y(e),o=Tt({generationRoot:i,databasePath:e,indexPath:m(f(D(e),"index.scip"))?f(D(e),"index.scip"):void 0,metadataPath:t}),a=n&&n.currentGeneration!==o.identity?cn(e,n.currentGeneration):void 0,s={version:V,currentGeneration:o.identity,artifactSet:"immutable-v1",stableMirrors:Ct(e,f(D(e),"index.scip")),...a?{previousGeneration:a}:{},...n?.publication?{publication:n.publication}:{},publishedAt:r().toISOString()};return C(f(y(e),"state.json"),s,{spacing:2,trailingNewline:!0}),on(e,{now:r}),s}function on(e,t={}){let r=Ji(t.limits),i=(t.now??(()=>new Date))().toISOString(),o=T(de(e),{waitMs:0});if(!o)return{state:"deferred",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:"another process owns local generation retention"};try{let a=k(e),s=an(e),c=it(e,s.map(w=>w.identity),{isProcessAlive:t.isProcessAlive??ie,readProcessIdentity:t.readProcessIdentity??ne}),d=new Set(c.protectedGenerations);a?.currentGeneration&&d.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&d.add(a.previousGeneration.generationIdentity);let l=s.length,p=s.reduce((w,Ve)=>w+Ve.logicalBytes,0),g=0,h=0;for(let w of s){if(l<=r.maxGenerations&&p<=r.maxLogicalBytes)break;d.has(w.identity)||(t.onBeforeRemove?.(w.identity),Ie(w.path,{recursive:!0,force:!0}),l-=1,p-=w.logicalBytes,g+=1,h+=w.logicalBytes)}let S=l>r.maxGenerations||p>r.maxLogicalBytes,L={state:S?"protected":g>0?"collected":"within-bounds",generationCount:l,logicalBytes:p,protectedGenerations:d.size,activeReaderLeases:c.activeLeases,staleReaderLeasesRemoved:c.staleLeasesRemoved,malformedReaderLeases:c.malformedLeases,removedGenerations:g,removedLogicalBytes:h,limits:r,at:i,...S?{reason:c.malformedLeases>0?"malformed reader ownership evidence fails closed":"retention bounds cannot be met without deleting a protected generation"}:{}};return en(e,L),L}catch(a){let s={state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:a instanceof Error?a.message:String(a)};try{en(e,s)}catch{}return s}finally{o.release()}}function ss(e){let t=y(e);if(!m(t))return{state:"absent",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,malformedReaderLeases:0,limits:{...vt},reason:"local immutable generation store does not exist"};let r=Yi(e),n=r?.limits??{...vt},i=T(de(e),{waitMs:0});if(!i)return{state:"deferred",generationCount:r?.generationCount??0,logicalBytes:r?.logicalBytes??0,protectedGenerations:r?.protectedGenerations??0,activeReaderLeases:r?.activeReaderLeases??0,malformedReaderLeases:r?.malformedReaderLeases??0,limits:n,...r?{lastCollection:r}:{},reason:"another process owns local generation retention"};try{let o=an(e),a=k(e),s=it(e,o.map(d=>d.identity),{isProcessAlive:ie,readProcessIdentity:ne},{removeStale:!1}),c=new Set(s.protectedGenerations);return a?.currentGeneration&&c.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&c.add(a.previousGeneration.generationIdentity),{state:"managed",generationCount:o.length,logicalBytes:o.reduce((d,l)=>d+l.logicalBytes,0),...o[0]?{oldestGenerationAt:new Date(o[0].modifiedAtMs).toISOString()}:{},protectedGenerations:c.size,activeReaderLeases:s.activeLeases,malformedReaderLeases:s.malformedLeases,limits:n,...r?{lastCollection:r}:{},...s.malformedLeases>0?{reason:"malformed reader ownership evidence prevents unsafe collection"}:{}}}catch(o){return{state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,malformedReaderLeases:0,limits:n,...r?{lastCollection:r}:{},reason:o instanceof Error?o.message:String(o)}}finally{i.release()}}function Ji(e={}){let t={...vt,...e};if(!Number.isSafeInteger(t.maxGenerations)||t.maxGenerations<2)throw new Error("Local SQLite generation retention must keep at least current and previous generations.");if(!Number.isSafeInteger(t.maxLogicalBytes)||t.maxLogicalBytes<=0)throw new Error("Local SQLite generation byte retention must be a positive safe integer.");return t}function an(e){let t=y(e);return m(t)?Pt(t,{withFileTypes:!0}).filter(r=>r.isDirectory()&&/^[a-f0-9]{64}$/.test(r.name)).map(r=>{let n=f(t,r.name),i=ue(t,r.name),o=i?i.database.size+(i.index?.size??0)+(i.metadata?.size??0):sn(n);return{identity:r.name,path:n,logicalBytes:o,modifiedAtMs:Z(n).mtimeMs}}).sort((r,n)=>r.modifiedAtMs-n.modifiedAtMs||r.identity.localeCompare(n.identity)):[]}function sn(e){let t=0;for(let r of Pt(e,{withFileTypes:!0})){let n=f(e,r.name);r.isDirectory()?t+=sn(n):r.isFile()&&(t+=Z(n).size)}return t}function en(e,t){N(f(y(e),"gc.json"),t,{spacing:2,trailingNewline:!0})}function Yi(e){try{let t=JSON.parse(b(f(y(e),"gc.json"),"local SQLite generation GC status"));return!t||t.state!=="within-bounds"&&t.state!=="collected"&&t.state!=="protected"&&t.state!=="deferred"&&t.state!=="error"||!Number.isSafeInteger(t.generationCount)||t.generationCount<0||!Number.isFinite(t.logicalBytes)||t.logicalBytes<0||!Number.isFinite(Date.parse(t.at))?void 0:t}catch{return}}function Gt(e,t=f(D(e),"meta.json")){let r=f(y(e),"state.json");if(!m(r))return{state:"legacy",statePath:r};let n=k(e);if(!n)return{state:"invalid",statePath:r,reason:"generation state is malformed"};try{let i=le(e,n.currentGeneration),o=i!==null,a=i?Ki(e,t,i,n):!1,s=n.previousGeneration?m(f(D(e),n.previousGeneration.databasePath)):!0;return!a||!o||!s?{state:"drifted",statePath:r,currentMatches:a,recoveryExists:s,generation:n,reason:o?a?"retained recovery database is missing":"stable database or metadata no longer matches the published generation":"published immutable generation is missing"}:{state:"current",statePath:r,currentMatches:a,recoveryExists:s,generation:n}}catch(i){return{state:"drifted",statePath:r,currentMatches:!1,recoveryExists:!1,generation:n,reason:i instanceof Error?i.message:String(i)}}}function Ki(e,t,r,n){if(n.stableMirrors&&(n.stableMirrors.databaseFileIdentity!==O(e)||n.stableMirrors.indexFileIdentity!==void 0&&n.stableMirrors.indexFileIdentity!==O(f(D(e),"index.scip")))||!tn(e,r.database))return!1;let i=f(D(e),"index.scip");if(r.index&&!tn(i,r.index))return!1;if(!r.metadata)return!m(t);if(!m(t))return!1;let o=f(y(e),r.identity,r.metadata.file);return m(o)&&q(b(t,"reindex metadata"))===q(b(o,"immutable reindex metadata"))}function tn(e,t){return m(e)&&Z(e).isFile()&&Z(e).size===t.size}function Xi(e){let t=Ui(e.outputDb,e.outputScip,e.metaPath);return t?cn(e.outputDb,t.currentGeneration):void 0}function Ct(e,t){return{databaseFileIdentity:O(e),...m(t)?{indexFileIdentity:O(t)}:{}}}function cn(e,t){let r=f(y(e),t),n=f(r,rn(e)),i=f(r,"meta.json");return{generationIdentity:t,databasePath:Zr(D(e),n),...m(i)?{metadataPath:Zr(D(e),i)}:{}}}function Zi(e){if(m(e)){for(let t of Pt(e,{withFileTypes:!0}))if(t.isDirectory()&&t.name.endsWith(".tmp"))try{Ie(f(e,t.name),{recursive:!0,force:!0})}catch{}}}function eo(e,t,r=f(D(t),"index.scip")){let n=Et("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(qe(t)),m(r)&&n.update(`\0${qe(r)}`),m(e)&&n.update(`\0${q(b(e,"reindex metadata"))}`),n.digest("hex")}function Tt(e){let t=It(e.databasePath),r=e.indexPath?It(e.indexPath):void 0,n=e.metadataPath?It(e.metadataPath):void 0,i=e.forcedIdentity??to(t,r,e.metadataPath),o=f(e.generationRoot,i),a=f(o,Oe);if(m(a)){let d=ue(e.generationRoot,i);if(d&&dn(o,d.database,t)&&no(o,d.index,r)&&io(o,d.metadata,e.metadataPath))return{identity:i,directorySync:F(e.generationRoot)};throw new Error(`SQLite generation ${i} already exists with different or corrupt artifacts.`)}let s=[Pe(e.generationRoot)];Zi(e.generationRoot);let c=`${o}.${process.pid}.${Date.now()}.tmp`;Ie(c,{recursive:!0,force:!0}),Vi(c,{recursive:!0});try{s.push(xt(e.databasePath,f(c,t.file))),r&&e.indexPath&&s.push(xt(e.indexPath,f(c,r.file))),n&&e.metadataPath&&s.push(xt(e.metadataPath,f(c,n.file)));let d=C(f(c,Oe),{version:nt,identity:i,database:t,...r?{index:r}:{},...n?{metadata:n}:{}},{spacing:2,trailingNewline:!0});d.directorySync!=="not-requested"&&s.push(d.directorySync),s.push(F(c)),I(()=>Rt(c,o)),s.push(F(e.generationRoot))}finally{try{Ie(c,{recursive:!0,force:!0})}catch{}}return{identity:i,directorySync:re(...s)}}function to(e,t,r){let n=Et("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(e.sha256),t&&n.update(`\0${t.sha256}`),r&&n.update(`\0${q(b(r,"reindex metadata"))}`),n.digest("hex")}function It(e){return{file:rn(e),size:Z(e).size,sha256:qe(e)}}function qe(e){let t=Et("sha256"),r=Qi(e,"r"),n=Buffer.allocUnsafe(1024*1024);try{for(;;){let i=ro(r,n);if(i===0)break;t.update(n.subarray(0,i))}}finally{Wi(r)}return t.digest("hex")}function ro(e,t){let r=0;for(;r<t.length;){let n=Hi(e,t,r,t.length-r,null);if(r+=n,n===0)break}return r}function xt(e,t){return ke(e,t,{mode:292})}function dn(e,t,r){let n=f(e,t.file);return t.file===r.file&&t.size===r.size&&t.sha256===r.sha256&&m(n)&&Z(n).size===t.size&&qe(n)===t.sha256}function no(e,t,r){return!t||!r?t===r:dn(e,t,r)}function io(e,t,r){if(!t||!r)return t===void 0&&r===void 0;let n=f(e,t.file);return m(n)&&q(b(n,"stored reindex metadata"))===q(b(r,"candidate reindex metadata"))}function wt(e,t){I(()=>Ie(`${t}.tmp-replace`,{force:!0})),I(()=>Rt(e,`${t}.tmp-replace`)),I(()=>Rt(`${t}.tmp-replace`,t))}var Ot=1,un="CODEBASEIQ_SHARED_CACHE",co=2,Be=JSON.stringify({cliVersion:Ht,artifactCatalogVersion:be,postIndexAugmentationSchemaVersion:co,sqliteGenerationStoreVersion:V,typescriptFragmentStoreVersion:_e,typescriptOverlayStoreVersion:je}),Mt="manifest.json",lo="shared-cache.json",_t=[yt,fe,he];function Dt(e,t){if(!e.clean||!e.treeOid)return;let r=Rn(JSON.stringify({version:Ot,repositoryId:e.repositoryId,treeOid:e.treeOid,fingerprint:t,producerIdentity:Be}));return{repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:t,producerIdentity:Be,generationId:r,repositoryCacheDir:Ce(e.repositoryId)}}function bn(e,t,r){if(process.env[un]==="0")return`${un}=0`;if(!Ue(r))return"explicit cache or database override";if(Je(At(t))!==Je(He(e))||t!==u(At(t),"index.db"))return"index database is outside the managed worktree cache"}function js(e,t,r){if(!Ue(t))return;let n=r??oe(e);return n?u(Ce(n.repositoryId),"evidence.db"):void 0}function $(e,t=!0){let r=qt(e),n;try{n=xn(E(u(r,Mt),{inputKind:"shared-generation manifest",maxBytes:v}))}catch{return null}if(n.generationId!==e.generationId||n.repositoryId!==e.repositoryId||n.treeOid!==e.treeOid||n.producerIdentity!==e.producerIdentity||JSON.stringify(n.fingerprint)!==JSON.stringify(e.fingerprint))return null;if(!t)return n;try{for(let i of n.artifacts){let o=A(r,i.path),a=We(o);if(!a.isFile()||a.size!==i.size||Y(o,{inputKind:"shared-generation artifact",maxBytes:P})!==i.sha256)return null}}catch{return null}return n}var uo=100;function po(e,t,r){if(!e.treeOid)return null;let n=Ke(t,r),i=u(Yt(),"repositories",e.repositoryId),o;try{let l=kt(i);if(!l.isDirectory()||l.isSymbolicLink())return null;o=hn(i)}catch{return null}let a=u(o,"generations"),s=[],c=e.headCommit?Zt(e.projectRoot,`${e.headCommit}^`,uo):[],d=new Map;for(let l of[e.treeOid,...c])d.has(l)||d.set(l,d.size);try{for(let l of yn(a)){if(!/^[a-f0-9]{64}$/.test(l))continue;let p=u(a,l),g;try{g=kt(p)}catch{continue}if(!(!g.isDirectory()||g.isSymbolicLink()))try{let h=xn(E(u(p,Mt),{inputKind:"shared-generation baseline manifest",maxBytes:v}));h.generationId===l&&h.repositoryId===e.repositoryId&&d.has(h.treeOid)&&h.producerIdentity===Be&&ho(h.fingerprint,n)&&s.push(h)}catch{continue}}}catch{return null}s.sort((l,p)=>{let g=d.get(l.treeOid)-d.get(p.treeOid),h=Date.parse(p.createdAt)-Date.parse(l.createdAt);return g||h||l.generationId.localeCompare(p.generationId)});for(let l of s){let p={repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:l.treeOid,fingerprint:l.fingerprint,producerIdentity:l.producerIdentity,generationId:l.generationId,repositoryCacheDir:o},g=$(p);if(g)return{snapshot:p,manifest:g}}return null}function In(e){let t=T(u(e.snapshot.repositoryCacheDir,"locks",`${e.snapshot.generationId}.publish.lock`));if(!t)throw new Error(`shared generation publication is already in progress for ${e.snapshot.generationId}`);try{return fo(e)}finally{t.release()}}function fo(e){let t=$(e.snapshot);if(t)return pn(e.snapshot,t);if(!Re(e.sourceCacheDir,e.sourceProjectRoot,e.snapshot.fingerprint))throw new Error("source index is incomplete, incompatible, or corrupt");let r=gn(e.sourceCacheDir);if(!r)throw new Error("source index artifacts are incomplete");let n=Fe(e.sourceCacheDir),i=u(e.snapshot.repositoryCacheDir,"generations"),o=[Pe(i)],a=Qe(u(i,`.tmp-${process.pid}-`));try{let s=[];for(let S of n.files){let L=A(e.sourceCacheDir,S),w=A(a,S);o.push(ve(L,w,292)),e.onPublicationStage?.("after-artifact-flushed",S);let Ve=We(w).size;s.push({path:S,size:Ve,sha256:Y(w,{inputKind:"staged shared-generation artifact",maxBytes:P})})}let c=Sn(R(u(a,"index.scip"),{inputKind:"staged shared SCIP index",maxBytes:P})).metadata?.projectRoot;if(!c)throw new Error("shared SCIP generation has no project root metadata");let d=$t(e.sourceProjectRoot);if(!K(c,d))throw new Error("shared SCIP generation root does not match its source worktree");if(gn(e.sourceCacheDir)!==r||e.sourceStillValid&&!e.sourceStillValid())throw new Error("source index changed while staging a shared generation");let l={version:Ot,artifactCatalogVersion:be,generationId:e.snapshot.generationId,repositoryId:e.snapshot.repositoryId,treeOid:e.snapshot.treeOid,fingerprint:e.snapshot.fingerprint,producerIdentity:e.snapshot.producerIdentity,sourceProjectRoot:e.sourceProjectRoot,scipProjectRoot:c,createdAt:(e.now??(()=>new Date))().toISOString(),artifacts:s.sort((S,L)=>S.path.localeCompare(L.path))},p=C(u(a,Mt),l,{spacing:2,trailingNewline:!0});p.directorySync!=="not-requested"&&o.push(p.directorySync),e.onPublicationStage?.("after-manifest-flushed"),o.push(F(a)),e.onPublicationStage?.("after-staging-directory-synced");let g=qt(e.snapshot);try{if(_(g)&&!$(e.snapshot)){let S=`${g}.corrupt-${process.pid}-${Date.now()}`;I(()=>U(g,S)),B(S,{recursive:!0,force:!0})}I(()=>U(a,g))}catch(S){let L=$(e.snapshot);if(L)return pn(e.snapshot,L);throw S}e.onPublicationStage?.("after-generation-renamed"),o.push(F(i)),e.onPublicationStage?.("after-generations-directory-synced");let h=re(...o);return{kind:"published",manifest:l,achievedDurability:h==="synced"?"directory-durable":"file-flushed",directorySync:h}}finally{B(a,{recursive:!0,force:!0})}}function pn(e,t){let r=F(u(e.repositoryCacheDir,"generations"));return{kind:"existing",manifest:t,achievedDurability:r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function $e(e){let t=qt(e.snapshot);ee(e.targetCacheDir,{recursive:!0});let r=T(u(e.targetCacheDir,"cache-lifecycle.lock"),{waitMs:3e4});if(!r)throw new Error("timed out waiting for another cache hydration");let n,i,o=!1;try{n=Qe(u(e.targetCacheDir,".shared-hydrate-")),xo(e.manifest,e.snapshot);for(let c of e.manifest.artifacts){let d=A(t,c.path),l=A(n,c.path);if(ve(d,l),We(l).size!==c.size||Y(l,{inputKind:"hydrated shared-generation artifact",maxBytes:P})!==c.sha256)throw new Error(`shared artifact is corrupt: ${c.path}`)}let a=$t(e.targetProjectRoot);if(a!==e.manifest.scipProjectRoot)for(let c of e.manifest.artifacts)c.path.endsWith(".scip")&&Kr(A(n,c.path),e.manifest.scipProjectRoot,a);if(!Re(n,e.targetProjectRoot,e.snapshot.fingerprint,!1))throw new Error("staged shared generation failed completeness or integrity validation");i=So(e.targetCacheDir,n),o=!0,bo(n,e.targetCacheDir,i),nn({tempOutputScip:u(n,"index.scip"),tempOutputDb:u(n,"index.db"),tempMetaPath:u(n,"meta.json"),outputScip:u(e.targetCacheDir,"index.scip"),outputDb:u(e.targetCacheDir,"index.db"),metaPath:u(e.targetCacheDir,"meta.json"),now:e.now});let s=Gt(u(e.targetCacheDir,"index.db"),u(e.targetCacheDir,"meta.json"));if(s.state==="invalid"||s.state==="drifted")throw new Error(`hydrated SQLite generation failed validation: ${s.reason}`);e.persistLease!==!1&&Lt(e.snapshot,e.targetCacheDir,e.action??"attached",e.now)}catch(a){throw o&&i&&Io(e.targetCacheDir,i),a}finally{n&&B(n,{recursive:!0,force:!0}),r.release()}}function Fs(e,t,r,n){let i=bn(e,r.dbPath,t);if(i)return{kind:"bypassed",reason:i};try{let o=n??oe(e);if(!o)return{kind:"missed",reason:"Git worktree identity is unavailable"};let a=t.languages??at(e);if(!o.clean){let p=fn(o,t,a,r,e);return p||(ze(o,r.cacheDir,"missed",void 0,"worktree has uncommitted changes"),{kind:"missed",reason:"worktree has uncommitted changes"})}let s=Ye(e,a,Nt(t)),c=Dt(o,s);if(!c)return{kind:"missed",reason:"clean committed snapshot is unavailable"};let d=$(c);if(d)return $e({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e}),{kind:"attached",generationId:c.generationId};let l=mo(c,e);if(!l){let p=fn(o,t,a,r,e);return p||(ze(o,r.cacheDir,"missed",void 0,"no exact shared or peer generation exists"),{kind:"missed",reason:"no exact shared or peer generation exists"})}return d=l.manifest,$e({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e,action:"peer-imported"}),{kind:"peer-imported",generationId:c.generationId,sourceProjectRoot:l.sourceProjectRoot}}catch(o){return{kind:"failed",reason:o instanceof Error?o.message:String(o)}}}function fn(e,t,r,n,i){if(!Jt()||_(n.dbPath))return;let o=po(e,r,Nt(t));if(o)return $e({snapshot:o.snapshot,manifest:o.manifest,targetCacheDir:n.cacheDir,targetProjectRoot:i,persistLease:!1}),go(o.snapshot,n.cacheDir),{kind:"overlay",generationId:o.snapshot.generationId}}function Ns(e,t,r,n){let i=bn(e,r.dbPath,t);if(i)return{kind:"bypassed",reason:i};try{let o=n??oe(e);if(!o)return{kind:"missed",reason:"Git worktree identity is unavailable"};if(!o.clean)return ze(o,r.cacheDir,"missed",void 0,"worktree is not a clean committed snapshot"),{kind:"missed",reason:"worktree is not a clean committed snapshot"};let a=t.languages??at(e),s=Ye(e,a,Nt(t)),c=Dt(o,s);if(!c)return ze(o,r.cacheDir,"missed",void 0,"worktree is not a clean committed snapshot"),{kind:"missed",reason:"worktree is not a clean committed snapshot"};let d=$(c);if(d)return Re(r.cacheDir,e,s)?(Lt(c,r.cacheDir,"local-fresh"),{kind:"local-fresh"}):($e({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e}),{kind:"attached",generationId:c.generationId});let l=Ft(r.cacheDir);return!l||JSON.stringify(l.fingerprint)!==JSON.stringify(s)||JSON.stringify([...l.indexedLanguages??[]].sort())!==JSON.stringify([...a].sort())?{kind:"missed",reason:"local metadata does not match the clean worktree snapshot"}:Re(r.cacheDir,e,s)?(In({snapshot:c,sourceCacheDir:r.cacheDir,sourceProjectRoot:e,sourceStillValid:()=>{let p=oe(e);return(p?Dt(p,s):void 0)?.generationId===c.generationId}}),Lt(c,r.cacheDir,"built"),{kind:"built",generationId:c.generationId}):{kind:"missed",reason:"local index artifacts are incomplete or incompatible"}}catch(o){return{kind:"failed",reason:o instanceof Error?o.message:String(o)}}}async function qs(e,t={}){let r=t.timeoutMs??3e4,n=t.pollMs??100,i=t.now??te,o=i()+r,a=u(e.repositoryCacheDir,"locks"),s=u(a,`${e.generationId}.lock`),c=d=>{if(!d||typeof d!="object"||Array.isArray(d))return null;let l=d.pid;return typeof l=="number"&&Number.isSafeInteger(l)&&l>0?{pid:l}:null};for(;i()<=o;){if($(e))return{kind:"generation-ready"};let d=Te(s,{kind:"shared-generation-build",detail:{generationId:e.generationId},parseLegacy:c});if(d.kind==="acquired")return{kind:"owner",release:()=>d.lock.release()};let l=o-i();if(l<=0)break;await ao(Math.min(n,l))}return $(e)?{kind:"generation-ready"}:{kind:"timeout"}}function Lt(e,t,r,n=void 0){let i={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,activeGenerationId:e.generationId,lastAction:r,lastSeenAt:(n??(()=>new Date))().toISOString()},o={...i,ownershipChecksum:jt(i)};return Bt(e.repositoryCacheDir,o,!0),o}function go(e,t,r=void 0){let n={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,lastAction:"overlay",lastReason:`private cache forked from shared baseline ${e.generationId}`,lastSeenAt:(r??(()=>new Date))().toISOString()},i={...n,ownershipChecksum:jt(n)};return Bt(e.repositoryCacheDir,i,!0),i}function ze(e,t,r,n=void 0,i=void 0){let o={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,lastAction:r,...i?{lastReason:i}:{},lastSeenAt:(n??(()=>new Date))().toISOString()},a={...o,ownershipChecksum:jt(o)};return Bt(Ce(e.repositoryId),a,!1),a}function jt(e){return Rn(JSON.stringify({version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:we(e.projectRoot),localCacheDir:we(e.localCacheDir)}))}function xn(e){let t=JSON.parse(e);if(t.version!==Ot||t.artifactCatalogVersion!==be||typeof t.generationId!="string"||!/^[a-f0-9]{64}$/.test(t.generationId)||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.treeOid!="string"||!t.treeOid||typeof t.producerIdentity!="string"||t.producerIdentity!==Be||typeof t.sourceProjectRoot!="string"||typeof t.scipProjectRoot!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!t.fingerprint||!Array.isArray(t.artifacts))throw new Error("invalid shared generation manifest");let r=new Set;for(let n of t.artifacts){if(!n||typeof n.path!="string"||typeof n.size!="number"||n.size<0||typeof n.sha256!="string"||!/^[a-f0-9]{64}$/.test(n.sha256))throw new Error("invalid shared generation artifact");if(Ne(n.path),r.has(n.path))throw new Error(`duplicate shared generation artifact: ${n.path}`);r.add(n.path)}for(let n of["index.db","index.scip","meta.json"])if(!r.has(n))throw new Error(`shared generation is missing ${n}`);return t}function ve(e,t,r=384){return ke(e,t,{mode:r})}function mo(e,t){for(let r of er(t)){if(we(r.path)===we(t))continue;let n=He(r.path),i=Ft(n);if(!(!i||JSON.stringify(i.fingerprint)!==JSON.stringify(e.fingerprint)||JSON.stringify([...i.indexedLanguages??[]].sort())!==JSON.stringify([...e.fingerprint.languages].sort()))&&Re(n,r.path,e.fingerprint))try{return{manifest:In({snapshot:e,sourceCacheDir:n,sourceProjectRoot:r.path}).manifest,sourceProjectRoot:r.path}}catch{continue}}return null}function yo(e,t,r){ee(e,{recursive:!0}),C(u(e,lo),{version:1,repositoryId:t,worktreeId:r},{spacing:2,trailingNewline:!0})}function gn(e){try{let t=Fe(e),r=mn("sha256");for(let n of t.files){let i=A(e,n),o=We(i).size;r.update(n).update("\0").update(String(o)).update("\0"),zt(i,{inputKind:"source-generation artifact",maxBytes:P},a=>r.update(a)),r.update("\0")}return r.digest("hex")}catch{return null}}function Ft(e){try{let t=Ae(E(u(e,"meta.json"),{inputKind:"reindex metadata",maxBytes:v}));return(t.kind==="legacy"||t.kind==="supported")&&t.capabilities.publishableGeneration?t.metadata:void 0}catch{return}}function Nt(e){return{pnpmWorkspaces:e.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:e.indexer?.typescript?.projectMode,typescriptProjects:e.indexer?.typescript?.projects,clojureConfigPath:e.indexer?.clojure?.configPath}}function ho(e,t){let r=Ke(e.languages,e);return JSON.stringify(r)===JSON.stringify(t)}function qt(e){return u(e.repositoryCacheDir,"generations",e.generationId)}function Bt(e,t,r){let n=or(e,{waitMs:5e3});if(!n)throw new Error("repository cache cleanup is busy");try{if(r){let o=t.activeGenerationId??t.baseGenerationId;if(!o||!_(u(e,"generations",o)))throw new Error("shared generation disappeared before its lease was attached")}let i=u(e,"worktrees");ee(i,{recursive:!0}),C(u(i,`${t.worktreeId}.json`),t,{spacing:2,trailingNewline:!0}),yo(t.localCacheDir,t.repositoryId,t.worktreeId)}finally{n.release()}}function So(e,t){let r=u(t,".rollback"),n=new Map,i=new Map;ee(r,{recursive:!0});for(let s of["index.scip","index.db","meta.json"]){let c=u(e,s),d=_(c);n.set(s,d),d&&ve(c,u(r,"stable",s))}for(let s of _t){let c=u(e,s),d=_(c);if(d){let l=kt(c);if(!l.isDirectory()||l.isSymbolicLink())throw new Error(`managed artifact path is not a directory: ${s}`)}i.set(s,d)}let o=u(e,ce),a=_(o);return a&&wn(o,u(r,"sqlite-generations")),{root:r,stableFiles:n,managedDirectories:i,generationStoreExisted:a}}function bo(e,t,r){for(let n of _t){let i=u(t,n);if(r.managedDirectories.get(n)){let a=u(r.root,"managed",n);ee(At(a),{recursive:!0}),I(()=>U(i,a))}let o=u(e,n);_(o)&&I(()=>U(o,i))}}function Io(e,t){for(let i of _t){let o=u(e,i),a=u(t.root,"managed",i);t.managedDirectories.get(i)?_(a)&&(B(o,{recursive:!0,force:!0}),I(()=>U(a,o))):B(o,{recursive:!0,force:!0})}for(let[i,o]of t.stableFiles){let a=u(e,i);if(!o){B(a,{force:!0});continue}let s=`${a}.shared-restore-${oo()}`;ve(u(t.root,"stable",i),s),I(()=>B(a,{force:!0})),I(()=>U(s,a))}let r=u(e,ce);B(r,{recursive:!0,force:!0});let n=u(t.root,"sqlite-generations");t.generationStoreExisted&&_(n)&&I(()=>U(n,r))}function wn(e,t){ee(t,{recursive:!0});for(let r of yn(e,{withFileTypes:!0})){let n=u(e,r.name),i=u(t,r.name);if(r.isSymbolicLink())throw new Error(`managed cache backup cannot contain a symlink: ${n}`);r.isDirectory()?wn(n,i):r.isFile()&&ve(n,i)}}function xo(e,t){if(e.generationId!==t.generationId||e.repositoryId!==t.repositoryId||e.treeOid!==t.treeOid||e.producerIdentity!==t.producerIdentity||JSON.stringify(e.fingerprint)!==JSON.stringify(t.fingerprint))throw new Error("shared generation manifest does not match the requested snapshot")}function Re(e,t,r,n=!0,i=!0){try{let o=Ft(e);if(!o||JSON.stringify(o.fingerprint)!==JSON.stringify(r)||JSON.stringify([...o.indexedLanguages??[]].sort())!==JSON.stringify([...r.languages].sort()))return xe("source validation rejected metadata"),!1;let a=Fe(e),s=Gt(u(e,"index.db"),u(e,"meta.json"));if(n?s.state!=="current":s.state==="invalid"||s.state==="drifted")return xe(`source validation rejected SQLite generation state ${s.state}`),!1;let c=new so(Ee(u(e,"index.db")),{readonly:!0,fileMustExist:!0});try{if(i){if(c.pragma("quick_check(1)",{simple:!0})!=="ok")return!1}else c.pragma("schema_version",{simple:!0})}finally{c.close()}let d=$t(t),p=(i?a.files.filter(g=>g.endsWith(".scip")):["index.scip"]).every(g=>{let h=Sn(R(A(e,g),{inputKind:"shared SCIP validation artifact",maxBytes:P})).metadata?.projectRoot,S=h!==void 0&&K(h,d);return S||xe(`source validation rejected SCIP root for ${g}: ${String(h)}`),S});return p||xe("source validation rejected SCIP project roots"),p}catch(o){return xe(`source validation failed: ${o instanceof Error?o.message:String(o)}`),!1}}function xe(e){process.env.CODEBASEIQ_DEBUG&&console.error(`shared-cache: ${e}`)}function $t(e){try{return ln(hn(e)).href}catch{return ln(we(e)).href}}function Rn(e){return mn("sha256").update(e).digest("hex")}function $s(e){return typeof e=="object"&&e!==null}function zs(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")?e:null}export{rr as a,wo as b,z as c,Ae as d,Co as e,nr as f,vn as g,To as h,De as i,ir as j,or as k,T as l,_o as m,Jo as n,hr as o,$s as p,zs as q,at as r,Hr as s,Qa as t,Ha as u,ga as v,ma as w,ya as x,ha as y,Sa as z,Pa as A,Ga as B,Ca as C,Ta as D,nn as E,Ui as F,as as G,ss as H,Gt as I,Dt as J,bn as K,js as L,$ as M,po as N,In as O,$e as P,Fs as Q,Ns as R,qs as S,Lt as T,go as U,jt as V};
21
+ //# sourceMappingURL=chunk-E7T22WET.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-TJWVT4DO.js";import{h as o}from"./chunk-UC2FD2PS.js";function g(e,r){return s(e).filter(t=>c({pattern:r,relativePath:t})).map(t=>({relativePath:t}))}function c(e,r){let t=typeof e=="string"?{pattern:e,relativePath:r}:e;if(typeof t.pattern!="string"||typeof t.relativePath!="string")throw new TypeError("pathMatchesGlob requires pattern and relativePath.");let n=o(t.pattern),a=o(t.relativePath);if(!/[*?]/.test(n))return a.includes(n);let l=n.includes("/")?n:`**/${n}`;return i(l.split("/"),a.split("/"))}function i(e,r){if(e.length===0)return r.length===0;let[t,...n]=e;return t==="**"?i(n,r)||r.length>0&&i(e,r.slice(1)):r.length===0||!f(t??"",r[0]??"")?!1:i(n,r.slice(1))}function f(e,r){let t="^";for(let n of e)n==="*"?t+="[^/]*":n==="?"?t+="[^/]":t+=p(n);return t+="$",new RegExp(t).test(r)}function p(e){return/[\\^$.*+?()[\]{}|]/.test(e)?`\\${e}`:e}export{g as a,c as b};
2
- //# sourceMappingURL=chunk-QEOWONKY.js.map
1
+ import{a as s}from"./chunk-JGXLB7PR.js";import{h as o}from"./chunk-6I55VYFG.js";function g(e,r){return s(e).filter(t=>c({pattern:r,relativePath:t})).map(t=>({relativePath:t}))}function c(e,r){let t=typeof e=="string"?{pattern:e,relativePath:r}:e;if(typeof t.pattern!="string"||typeof t.relativePath!="string")throw new TypeError("pathMatchesGlob requires pattern and relativePath.");let n=o(t.pattern),a=o(t.relativePath);if(!/[*?]/.test(n))return a.includes(n);let l=n.includes("/")?n:`**/${n}`;return i(l.split("/"),a.split("/"))}function i(e,r){if(e.length===0)return r.length===0;let[t,...n]=e;return t==="**"?i(n,r)||r.length>0&&i(e,r.slice(1)):r.length===0||!f(t??"",r[0]??"")?!1:i(n,r.slice(1))}function f(e,r){let t="^";for(let n of e)n==="*"?t+="[^/]*":n==="?"?t+="[^/]":t+=p(n);return t+="$",new RegExp(t).test(r)}function p(e){return/[\\^$.*+?()[\]{}|]/.test(e)?`\\${e}`:e}export{g as a,c as b};
2
+ //# sourceMappingURL=chunk-ED7ZAZ5V.js.map
@@ -1,4 +1,4 @@
1
- import{a as p,g as m}from"./chunk-UQYQBLJX.js";import F from"ignore";import{existsSync as h,readdirSync as D}from"fs";import{dirname as d,isAbsolute as b,join as l,relative as T,resolve as $}from"path";function M(e){let t=F();return x(e,t)||t.add(P),{isIgnored:r=>f(t,e,r),filter:r=>r.filter(i=>!f(t,e,i))}}function x(e,t){let n=new Set,r=(s,a)=>{if(!(n.has(s)||!h(s)))try{let g=m(s,{maxBytes:p,inputKind:"gitignore file"});t.add(a?w(g,a):g),n.add(s)}catch{}},i=d(e),o=0;for(;i!==d(i)&&o<5&&(r(l(i,".gitignore"),""),!h(l(i,".git")));)i=d(i),o++;return y(e,"",t,r),n.size>0}function y(e,t,n,r){let i=t?l(e,t):e;r(l(i,".gitignore"),t);let o;try{o=D(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;f(n,e,`${a}/`)||y(e,a,n,r)}}function w(e,t){let n=t.replaceAll("\\","/").replace(/\/+$/,"");return e.split(/\r?\n/).map(r=>I(r,n)).join(`
1
+ import{a as p,g as m}from"./chunk-C3PPB2T5.js";import F from"ignore";import{existsSync as h,readdirSync as D}from"fs";import{dirname as d,isAbsolute as b,join as l,relative as T,resolve as $}from"path";function M(e){let t=F();return x(e,t)||t.add(P),{isIgnored:r=>f(t,e,r),filter:r=>r.filter(i=>!f(t,e,i))}}function x(e,t){let n=new Set,r=(s,a)=>{if(!(n.has(s)||!h(s)))try{let g=m(s,{maxBytes:p,inputKind:"gitignore file"});t.add(a?w(g,a):g),n.add(s)}catch{}},i=d(e),o=0;for(;i!==d(i)&&o<5&&(r(l(i,".gitignore"),""),!h(l(i,".git")));)i=d(i),o++;return y(e,"",t,r),n.size>0}function y(e,t,n,r){let i=t?l(e,t):e;r(l(i,".gitignore"),t);let o;try{o=D(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;f(n,e,`${a}/`)||y(e,a,n,r)}}function w(e,t){let n=t.replaceAll("\\","/").replace(/\/+$/,"");return e.split(/\r?\n/).map(r=>I(r,n)).join(`
2
2
  `)}function I(e,t){let n=e.trimStart();if(!n||n.startsWith("#"))return e;let r=e.slice(0,e.length-n.length),i=n.startsWith("!"),o=i?n.slice(1):n;if(!o||o.startsWith("#"))return e;let s=o.startsWith("/"),a=s?o.slice(1):o,A=(a.endsWith("/")?a.slice(0,-1):a).includes("/")||s?`${t}/${a}`:`${t}/**/${a}`;return`${r}${i?"!":""}${A}`}var P=`
3
3
  # Dependencies
4
4
  node_modules/
@@ -57,4 +57,4 @@ Thumbs.db
57
57
  # Type definitions (often noise in queries)
58
58
  *.d.ts
59
59
  `;function f(e,t,n){let r=R(t,n);if(!r)return!1;try{return e.ignores(r)}catch{return!1}}function R(e,t){if(!t||t===".")return null;if(!b(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let n=b(t)?t:$(e,t),r=T(e,n).replaceAll("\\","/");return!r||r==="."||r.startsWith("..")?null:r}import{mkdtempSync as S}from"fs";import{win32 as G}from"path";var W=259,N=8,E=6,c="\\\\?\\",u=`${c}UNC\\`;function v(e,t,n){if(n!=="win32"||e.startsWith(c))return;let r=G.resolve(e);if(!(r.length+t<=W))return r.startsWith("\\\\")?`${u}${r.slice(2)}`:`${c}${r}`}function q(e,t=process.platform){return e===""||e===":memory:"?e:v(e,N,t)??e}function K(e,t=process.platform){let n=v(e,E,t);if(!n)return S(e);let r=S(n);return r.startsWith(u)?`\\\\${r.slice(u.length)}`:r.slice(c.length)}var C=[],_=[];function j(e){e.groups.length>0&&C.push(e)}function Q(e){_.push(e)}function Y(e){let t=[];for(let n of _)try{n.close(e)}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Multiple database-owned resources failed to close.")}function V(e,t){let n=new Set(t.groups);for(let r of C)r.groups.some(i=>n.has(i))&&(t.file!==void 0&&r.clearFile?r.clearFile(e,t.file):r.clearAll(e))}export{q as a,K as b,j as c,Q as d,Y as e,V as f,M as g};
60
- //# sourceMappingURL=chunk-RCIGX23V.js.map
60
+ //# sourceMappingURL=chunk-EDMG5CSO.js.map
@@ -1,7 +1,7 @@
1
- import{b as B}from"./chunk-BWL3PMPT.js";import{c as K}from"./chunk-TJWVT4DO.js";import{a as O}from"./chunk-BRQL7AFJ.js";import{a as M}from"./chunk-OANDYLJQ.js";import{A as R,d as I,i as P,t as _}from"./chunk-GVAF222T.js";import{f as E}from"./chunk-F74LZWCE.js";function re(e,n,t){let r=[],i=[],a=new Map;for(let l of[...e].sort(t)){let s=l.channel??"default",c=n[s]??Number.MAX_SAFE_INTEGER,u=a.get(s)??0;if(u>=c){i.push(l);continue}r.push(l),a.set(s,u+1)}return{selected:r,omitted:i}}function H(e,n,t,r,i=!1){let a=[...e],l=[],s=new Set,c=0;for(;a.length>0&&l.length<n;){let u=a.filter(h=>c+h.evidenceCharacters<=t||i&&l.length===0);if(u.length===0)break;let g=u.filter(h=>h.roles.includes("location")||h.roles.includes("definition")).sort(r);u.sort((h,S)=>N(S,s)-N(h,s)||r(h,S));let p=g[0]??u[0];l.push(p),c+=p.evidenceCharacters;for(let h of $(p))s.add(h.key);a.splice(a.indexOf(p),1)}return{selected:l,omitted:a.sort(r)}}function N(e,n){let t=$(e).reduce((a,l)=>a+(n.has(l.key)?0:l.weight),0),r=Math.max(0,8-e.priority)*20,i=Math.min(500,Math.ceil(e.evidenceCharacters/160));return t+r-i}function $(e){return[...e.reasons.map(X),...e.roles.map(n=>({key:`role:${n}`,weight:Y(n)})),{key:`file:${e.relativePath}`,weight:180},{key:`scope:${J(e.relativePath)}`,weight:120},{key:`kind:${e.fileKind}`,weight:40},...e.symbols.map(n=>({key:`symbol:${n}`,weight:100})),...e.behaviorSignals.map(n=>({key:`behavior:${n}`,weight:70}))]}function X(e){let n=e.indexOf(":"),t=n<0?e:e.slice(0,n);return t==="dependency"||t==="consumer"?{key:`reason:${t}`,weight:220}:{key:`reason:${e}`,weight:t==="location"||t==="definition"?1400:800}}function Y(e){switch(e){case"location":return 1200;case"definition":return 1100;case"reference":return 600;case"caller":case"callee":return 550;case"dependency":case"consumer":return 500;case"search":return 400;default:return 300}}function J(e){let n=e.lastIndexOf("/");return n<0?e:e.slice(0,n)}var j=64,A=12;function de(e,n,t={}){if(n.length===0)throw new Error("The source search pattern must not be empty.");let r=t.context??6;if(!Number.isSafeInteger(r)||r<0)throw new RangeError(`context must be a non-negative safe integer; received ${r}`);let i=t.limit??12;if(!Number.isSafeInteger(i)||i<=0)throw new RangeError(`limit must be a positive safe integer; received ${i}`);let a=t.regexp?M(n,"source search pattern",t.ignoreCase?"iu":"u"):null,l=t.ignoreCase?n.toLocaleLowerCase():n,s=K(e,{scope:t.scope}),c=[],u=[];for(let o of s.files){let m=o.relativePath,b=Z(o.text);if(b.length===0)continue;let z=o.freshness.semantic.state!=="stale"&&o.freshness.semantic.basis!=="no-compiler-document"?_(e,m):[],U=E(e,m)?.callables??[],C=0;for(let d=0;d<b.length;d+=1){let x=b[d]??"",w=x.endsWith("\r")?x.slice(0,-1):x;if(!(a?a.test(w):(t.ignoreCase?w.toLocaleLowerCase():w).includes(l)))continue;C+=1;let f=R(z,d),F=Q(U,d),y=f&&!P(f.symbol)?f:null,G=y?.startLine??F?.startLine??f?.startLine??d,q=y?.endLine??F?.endLine??f?.endLine??d,k=B(e,m,d,G,q);c.push({relativePath:m,focusLine:d,ownerSymbol:y?.symbol??null,ownerShort:y?I(y.symbol):F?.name??(f?I(f.symbol):null),ownerStartLine:k.startLine,ownerEndLine:k.endLine,fileKind:O(m),freshness:o.freshness})}C>0&&u.push({relativePath:m,matchingLines:C,returnedMatches:0,freshness:o.freshness})}c.sort(W);let g=c.length>j?D(c,j):c,p=i===Number.MAX_SAFE_INTEGER?c:t.ranking?D(c,i):c.slice(0,i),h=new Map(s.files.map(o=>[o.relativePath,o.text])),S=p.flatMap(o=>{let m=h.get(o.relativePath),b=m===void 0?null:V(o.relativePath,m,o.focusLine,r);return b?[{...b,...o}]:[]}),v=new Map;for(let o of S)v.set(o.relativePath,(v.get(o.relativePath)??0)+1);for(let o of u)o.returnedMatches=v.get(o.relativePath)??0;let T=ee(u);return{pattern:n,mode:t.regexp?"regexp":"literal",identities:c,...g.length<c.length?{identityManifest:g}:{},identityCoverage:{mode:g.length===c.length?"complete":"bounded",returned:g.length,total:c.length,omitted:c.length-g.length},matches:S,matchingLines:c.length,matchingFiles:u.length,omittedMatches:Math.max(0,c.length-S.length),fileCoverage:u,scopeHints:T.slice(0,A),omittedScopeHints:Math.max(0,T.length-A),scannedFiles:s.files.length,textCoverage:{basis:"current-project-text-files",candidateFiles:s.candidateFiles,scannedTextFiles:s.files.length,scannedBytes:s.scannedBytes,skippedBinaryPaths:s.skippedBinaryPaths,skippedUnreadablePaths:s.skippedUnreadablePaths,skippedOversizedPaths:s.skippedOversizedPaths,semanticFiles:{aligned:s.files.filter(o=>o.freshness.semantic.state==="aligned").length,stale:s.files.filter(o=>o.freshness.semantic.state==="stale").length,unavailable:s.files.filter(o=>o.freshness.semantic.state==="unavailable").length}}}}function Q(e,n){return e.filter(t=>t.startLine<=n&&t.endLine>=n).sort((t,r)=>t.endLine-t.startLine-(r.endLine-r.startLine)||t.startLine-r.startLine)[0]??null}function V(e,n,t,r){let i=n.split(`
1
+ import{b as B}from"./chunk-HTPEUJ42.js";import{c as K}from"./chunk-JGXLB7PR.js";import{a as O}from"./chunk-NMKQOIYZ.js";import{a as M}from"./chunk-OANDYLJQ.js";import{A as R,d as I,i as P,t as _}from"./chunk-TNLOX4TN.js";import{f as E}from"./chunk-RGBZDOUO.js";function re(e,n,t){let r=[],i=[],a=new Map;for(let l of[...e].sort(t)){let s=l.channel??"default",c=n[s]??Number.MAX_SAFE_INTEGER,u=a.get(s)??0;if(u>=c){i.push(l);continue}r.push(l),a.set(s,u+1)}return{selected:r,omitted:i}}function H(e,n,t,r,i=!1){let a=[...e],l=[],s=new Set,c=0;for(;a.length>0&&l.length<n;){let u=a.filter(h=>c+h.evidenceCharacters<=t||i&&l.length===0);if(u.length===0)break;let g=u.filter(h=>h.roles.includes("location")||h.roles.includes("definition")).sort(r);u.sort((h,S)=>N(S,s)-N(h,s)||r(h,S));let p=g[0]??u[0];l.push(p),c+=p.evidenceCharacters;for(let h of $(p))s.add(h.key);a.splice(a.indexOf(p),1)}return{selected:l,omitted:a.sort(r)}}function N(e,n){let t=$(e).reduce((a,l)=>a+(n.has(l.key)?0:l.weight),0),r=Math.max(0,8-e.priority)*20,i=Math.min(500,Math.ceil(e.evidenceCharacters/160));return t+r-i}function $(e){return[...e.reasons.map(X),...e.roles.map(n=>({key:`role:${n}`,weight:Y(n)})),{key:`file:${e.relativePath}`,weight:180},{key:`scope:${J(e.relativePath)}`,weight:120},{key:`kind:${e.fileKind}`,weight:40},...e.symbols.map(n=>({key:`symbol:${n}`,weight:100})),...e.behaviorSignals.map(n=>({key:`behavior:${n}`,weight:70}))]}function X(e){let n=e.indexOf(":"),t=n<0?e:e.slice(0,n);return t==="dependency"||t==="consumer"?{key:`reason:${t}`,weight:220}:{key:`reason:${e}`,weight:t==="location"||t==="definition"?1400:800}}function Y(e){switch(e){case"location":return 1200;case"definition":return 1100;case"reference":return 600;case"caller":case"callee":return 550;case"dependency":case"consumer":return 500;case"search":return 400;default:return 300}}function J(e){let n=e.lastIndexOf("/");return n<0?e:e.slice(0,n)}var j=64,A=12;function de(e,n,t={}){if(n.length===0)throw new Error("The source search pattern must not be empty.");let r=t.context??6;if(!Number.isSafeInteger(r)||r<0)throw new RangeError(`context must be a non-negative safe integer; received ${r}`);let i=t.limit??12;if(!Number.isSafeInteger(i)||i<=0)throw new RangeError(`limit must be a positive safe integer; received ${i}`);let a=t.regexp?M(n,"source search pattern",t.ignoreCase?"iu":"u"):null,l=t.ignoreCase?n.toLocaleLowerCase():n,s=K(e,{scope:t.scope}),c=[],u=[];for(let o of s.files){let m=o.relativePath,b=Z(o.text);if(b.length===0)continue;let z=o.freshness.semantic.state!=="stale"&&o.freshness.semantic.basis!=="no-compiler-document"?_(e,m):[],U=E(e,m)?.callables??[],C=0;for(let d=0;d<b.length;d+=1){let x=b[d]??"",w=x.endsWith("\r")?x.slice(0,-1):x;if(!(a?a.test(w):(t.ignoreCase?w.toLocaleLowerCase():w).includes(l)))continue;C+=1;let f=R(z,d),F=Q(U,d),y=f&&!P(f.symbol)?f:null,G=y?.startLine??F?.startLine??f?.startLine??d,q=y?.endLine??F?.endLine??f?.endLine??d,k=B(e,m,d,G,q);c.push({relativePath:m,focusLine:d,ownerSymbol:y?.symbol??null,ownerShort:y?I(y.symbol):F?.name??(f?I(f.symbol):null),ownerStartLine:k.startLine,ownerEndLine:k.endLine,fileKind:O(m),freshness:o.freshness})}C>0&&u.push({relativePath:m,matchingLines:C,returnedMatches:0,freshness:o.freshness})}c.sort(W);let g=c.length>j?D(c,j):c,p=i===Number.MAX_SAFE_INTEGER?c:t.ranking?D(c,i):c.slice(0,i),h=new Map(s.files.map(o=>[o.relativePath,o.text])),S=p.flatMap(o=>{let m=h.get(o.relativePath),b=m===void 0?null:V(o.relativePath,m,o.focusLine,r);return b?[{...b,...o}]:[]}),v=new Map;for(let o of S)v.set(o.relativePath,(v.get(o.relativePath)??0)+1);for(let o of u)o.returnedMatches=v.get(o.relativePath)??0;let T=ee(u);return{pattern:n,mode:t.regexp?"regexp":"literal",identities:c,...g.length<c.length?{identityManifest:g}:{},identityCoverage:{mode:g.length===c.length?"complete":"bounded",returned:g.length,total:c.length,omitted:c.length-g.length},matches:S,matchingLines:c.length,matchingFiles:u.length,omittedMatches:Math.max(0,c.length-S.length),fileCoverage:u,scopeHints:T.slice(0,A),omittedScopeHints:Math.max(0,T.length-A),scannedFiles:s.files.length,textCoverage:{basis:"current-project-text-files",candidateFiles:s.candidateFiles,scannedTextFiles:s.files.length,scannedBytes:s.scannedBytes,skippedBinaryPaths:s.skippedBinaryPaths,skippedUnreadablePaths:s.skippedUnreadablePaths,skippedOversizedPaths:s.skippedOversizedPaths,semanticFiles:{aligned:s.files.filter(o=>o.freshness.semantic.state==="aligned").length,stale:s.files.filter(o=>o.freshness.semantic.state==="stale").length,unavailable:s.files.filter(o=>o.freshness.semantic.state==="unavailable").length}}}}function Q(e,n){return e.filter(t=>t.startLine<=n&&t.endLine>=n).sort((t,r)=>t.endLine-t.startLine-(r.endLine-r.startLine)||t.startLine-r.startLine)[0]??null}function V(e,n,t,r){let i=n.split(`
2
2
  `),a=n.endsWith(`
3
3
  `)?i.length-1:i.length;if(t<0||t>=a)return null;let l=Math.max(0,t-r),s=Math.min(a-1,t+r);return{relativePath:e,startLine:l,endLine:s,focusLine:t,source:i.slice(l,s+1).join(`
4
4
  `)}}function Z(e){if(e.length===0)return[];let n=e.split(`
5
5
  `);return e.endsWith(`
6
6
  `)&&n.pop(),n}function ee(e){let n=new Map;for(let t of e){let r=ne(t.relativePath),i=n.get(r)??{matchingLines:0,matchingFiles:0};i.matchingLines+=t.matchingLines,i.matchingFiles+=1,n.set(r,i)}return[...n.entries()].map(([t,r])=>({scope:t,...r})).sort((t,r)=>r.matchingLines-t.matchingLines||r.matchingFiles-t.matchingFiles||t.scope.localeCompare(r.scope))}function ne(e){let n=e.lastIndexOf("/");return n<0?e:e.slice(0,n)}function D(e,n){let t=e.map((i,a)=>({...i,priority:L(i.fileKind),sequence:a,evidenceCharacters:1,roles:["search"],reasons:["search"],symbols:i.ownerSymbol?[i.ownerSymbol]:[],behaviorSignals:[]})),r=[];for(let i of[0,1,2]){let a=n-r.length;if(a===0)break;let l=t.filter(s=>L(s.fileKind)===i);r.push(...H(l,a,Number.MAX_SAFE_INTEGER,W).selected)}return r.map(({priority:i,sequence:a,evidenceCharacters:l,roles:s,reasons:c,symbols:u,behaviorSignals:g,...p})=>p)}function W(e,n){return L(e.fileKind)-L(n.fileKind)||+(n.ownerSymbol!==null)-+(e.ownerSymbol!==null)||e.relativePath.localeCompare(n.relativePath)||e.focusLine-n.focusLine}function L(e){switch(e){case"entry":case"source":case"worker":return 0;case"barrel":return 1;case"test":return 2}}export{re as a,H as b,de as c};
7
- //# sourceMappingURL=chunk-IHSLIIL3.js.map
7
+ //# sourceMappingURL=chunk-EOSUV7H5.js.map
@@ -1,4 +1,4 @@
1
- import{a as G}from"./chunk-QOKYJ33H.js";import{a as O,c as z}from"./chunk-BPKNP3KZ.js";import{j as $}from"./chunk-KLX6NSWT.js";import{d as k,g as S,i as j}from"./chunk-GVAF222T.js";import{C as A}from"./chunk-ICUL7XRT.js";import{f as _}from"./chunk-SX72EVMY.js";import{ba as C,h as b}from"./chunk-UC2FD2PS.js";import{execFileSync as g}from"child_process";import{existsSync as ne}from"fs";import{basename as W}from"path";var ie="Unable to compute git diff.",se={semanticConsumers:$,sourceFallbackConsumers:O},w={resolveCommit:C,readBatch({projectRoot:e,resolvedBase:i,relativePaths:t}){let n=t.map(a=>`${i}:./${a}
1
+ import{a as G}from"./chunk-QOKYJ33H.js";import{a as O,c as z}from"./chunk-UHFZDQZJ.js";import{j as $}from"./chunk-R2F2CTBA.js";import{d as k,g as S,i as j}from"./chunk-TNLOX4TN.js";import{C as A}from"./chunk-NRNVMB2R.js";import{f as _}from"./chunk-YMAGXBLT.js";import{da as C,h as b}from"./chunk-6I55VYFG.js";import{execFileSync as g}from"child_process";import{existsSync as ne}from"fs";import{basename as W}from"path";var ie="Unable to compute git diff.",se={semanticConsumers:$,sourceFallbackConsumers:O},w={resolveCommit:C,readBatch({projectRoot:e,resolvedBase:i,relativePaths:t}){let n=t.map(a=>`${i}:./${a}
2
2
  `).join("");return g("git",["cat-file","--batch"],{cwd:e,input:n,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"],windowsHide:!0})}};function Ze(e,i={}){let t=i.plan??ae(e,i);return t.note?ce(t.note,t.changedFileLines):t.changedFiles.length===0?le(t.changedFileLines):oe(t.changedFiles,[re(e,t.changedFiles,t.changedFiles,t.changedRanges)])}function ae(e,i={}){let{base:t="HEAD"}=i;try{let n=C(e.config.projectRoot,t),a=de(e.config.projectRoot,n),s=a.changedFileLines,o=be(e,s),r=ye(e,a.changedRanges);return{changedFileLines:s,changedFiles:o,changedRanges:r,renamedFiles:ge(e.config.projectRoot,n,o,a),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:ie}}}function re(e,i,t,n=[],a={}){let s=a.evidenceRuntime??se,o=new z(e),r=new Set(t),l=G(n),u=[],d=new Map,c=i.flatMap(f=>o.definitionsForFile(f)).filter(Ne),m=c.filter(f=>Ce(f,l)),p=ve(e,c,m,l),y=Ie([...m,...p.definitions]).sort((f,h)=>f.relativePath.localeCompare(h.relativePath)||f.startLine-h.startLine),B=y.map(f=>f.symbolId),M=Pe(e,B),ee=Ee(e,B,t),R=y.filter(f=>(M.get(f.symbolId)??0)===0),P=q("semantic-consumers",R.length,()=>s.semanticConsumers(e,R)),E=P.values,T=R.filter(f=>(E.get(f.symbolId)?.size??0)===0),N=q("source-fallback-consumers",T.length,()=>s.sourceFallbackConsumers(e,T)),te=N.values;for(let f of y)Fe(e,f,r,u,d,E.get(f.symbolId)??new Set,te.get(f.symbolId)??new Set,M.get(f.symbolId)??0,ee.get(f.symbolId)??new Set);return{changedSymbols:u,consumerEntries:[...d.entries()].map(([f,h])=>({file:f,symbols:[...h].sort()})),attributionNotes:p.notes,evidenceTiers:[P.status,N.status]}}function oe(e,i){let t=new Map,n=i.flatMap(r=>r.changedSymbols),a=i.flatMap(r=>r.attributionNotes??[]),s=Be(i);for(let r of i)for(let l of r.consumerEntries){let u=t.get(l.file);u||(u=new Set,t.set(l.file,u));for(let d of l.symbols)u.add(d)}let o=Te(t);return{changedFiles:[...e],changedSymbols:n,affectedConsumers:o,attributionNotes:a,evidenceTiers:s,summary:{totalChangedFiles:e.length,totalChangedSymbols:n.length,totalAffectedFiles:o.length}}}function ce(e,i=[]){return{changedFiles:i,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:X(),summary:{totalChangedFiles:i.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function le(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:X(),summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function de(e,i){let t=g("git",["diff","--name-status","--find-renames",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864,windowsHide:!0}),n=g("git",["diff","--name-status","--find-renames","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024,windowsHide:!0}),a=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024,windowsHide:!0}),s=g("git",["diff","--unified=0",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024,windowsHide:!0}),o=g("git",["diff","--unified=0","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024,windowsHide:!0}),r=pe([t,n]);return{changedFileLines:[...new Set([...r.changedFiles,...V(a)])],changedRanges:K([...U(s),...U(o)]),renamedFiles:r.renamedFiles,deletedFiles:r.deletedFiles}}function ue(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePath:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||typeof n.relativePath!="string")throw new TypeError("fileContentAtBase requires projectRoot, base, and relativePath.");let a={projectRoot:n.projectRoot,base:n.base,relativePath:n.relativePath},{relativePath:s}=a,o=J(a);if(o.state==="unavailable")throw new Error(`Base content unavailable for ${s}: ${o.reason}`);return o.state==="present"?o.content:null}function J(e,i=w){return Z(e.relativePath),x({projectRoot:e.projectRoot,base:e.base,relativePaths:[e.relativePath]},i).get(e.relativePath)??{state:"unavailable",reason:`Base-content lookup omitted ${e.relativePath}.`}}function x(e,i=w){for(let o of e.relativePaths)Z(o);let t=[...new Set(e.relativePaths)];if(t.length===0)return new Map;let n;try{n=i.resolveCommit(e.projectRoot,e.base)}catch(o){return v(t,D(o))}let a;try{a=i.readBatch({projectRoot:e.projectRoot,resolvedBase:n,relativePaths:t})}catch(o){return v(t,D(o))}let s;try{s=me(a,t)}catch(o){return v(t,`Malformed git cat-file batch output: ${D(o)}`)}return new Map(t.map(o=>{let r=s.get(o)??null;return[o,r===null?{state:"absent"}:{state:"present",content:r}]}))}function fe(e,i=w){let t=x({projectRoot:e.projectRoot,base:e.base,relativePaths:e.preloadPaths??[]},i);return n=>(t.has(n)||t.set(n,J({projectRoot:e.projectRoot,base:e.base,relativePath:n},i)),t.get(n)??{state:"unavailable",reason:`Base-content reader omitted ${n}.`})}function Ve(e,i,t=[]){let n=typeof e=="string"?{projectRoot:e,base:i,preloadPaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string")throw new TypeError("createBaseContentReader requires projectRoot and base.");let a={projectRoot:n.projectRoot,base:n.base,preloadPaths:n.preloadPaths},s=fe(a);return o=>{let r=s(o);if(r.state==="unavailable")throw new Error(`Base content unavailable for ${o}: ${r.reason}`);return r.state==="present"?r.content:null}}function Ye(e,i=e.changedFiles){let t=new Map(e.renamedFiles.map(n=>[n.to,n.from]));return[...new Set(i.map(n=>t.get(n)??n))]}function Ke(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||!Array.isArray(n.relativePaths))throw new TypeError("fileContentsAtBase requires projectRoot, base, and relativePaths.");let a=x(n),s=new Map;for(let[o,r]of a){if(r.state==="unavailable")throw new Error(`Base content unavailable for ${o}: ${r.reason}`);s.set(o,r.state==="present"?r.content:null)}return s}function Z(e){b(e)}function v(e,i){return new Map(e.map(t=>[t,{state:"unavailable",reason:i}]))}function D(e){let t=(e instanceof Error?e.message:String(e)).replaceAll(/\s+/g," ").trim().slice(0,500);return t===""?"Git base-content lookup failed without a reason.":t}function me(e,i){let t=new Map,n=0;for(let a of i){let s=e.indexOf(10,n);if(s<0)throw new Error("git cat-file batch output ended before object header");let o=e.subarray(n,s).toString("utf-8");if(n=s+1,o.endsWith(" missing")){t.set(a,null);continue}let r=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(o);if(!r)throw new Error(`unexpected git cat-file batch header: ${o}`);let[,l,u]=r,d=Number(u);if(!Number.isFinite(d)||d<0)throw new Error(`unexpected git cat-file batch size: ${o}`);if(n+d>e.length)throw new Error("git cat-file batch output ended before blob payload");let c=e.subarray(n,n+d);t.set(a,l==="blob"?c.toString("utf-8"):null),n+=d,e[n]===10&&(n+=1)}return t}function ge(e,i,t,n){if(t.length===0)return[];let a=new Map,s=new Set;for(let r of n.renamedFiles)t.includes(r.to)&&(a.set(r.to,r),s.add(r.from));let o=n.deletedFiles;if(o.length===0)return[...a.values()].sort((r,l)=>r.to.localeCompare(l.to));for(let r of t){if(a.has(r)||!ne(`${e}/${r}`))continue;let l=o.filter(c=>!s.has(c)).filter(c=>W(c)===W(r));if(l.length===0)continue;let u=_(e,r),d=l.map(c=>({from:c,to:r,similarity:he(ue({projectRoot:e,base:i,relativePath:c})??"",u)})).sort((c,m)=>m.similarity-c.similarity)[0];d&&d.similarity>=.45&&(a.set(r,d),s.add(d.from))}return[...a.values()].sort((r,l)=>r.to.localeCompare(l.to))}function pe(e){let i=new Set,t=new Map,n=new Set;for(let a of e.flatMap(s=>V(s))){let[s,o,r]=a.split(" ");if(!(!s||!o)){if(s.startsWith("R")&&r){i.add(r),t.set(r,{from:o,to:r,similarity:Number(s.slice(1))/100});continue}i.add(o),s.startsWith("D")&&n.add(o)}}return{changedFiles:[...i],renamedFiles:[...t.values()],deletedFiles:[...n]}}function he(e,i){let t=new Set(H(e)),n=new Set(H(i));if(t.size===0&&n.size===0)return 1;if(t.size===0||n.size===0)return 0;let a=0;for(let s of t)n.has(s)&&(a+=1);return 2*a/(t.size+n.size)}function H(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function V(e){return e.split(`
3
3
  `).map(i=>i.trim()).filter(i=>i.length>0)}function be(e,i){let t=Y(e),n=[];for(let a of i){let s=t(a);s&&!e.isIgnored(s)&&n.push(s)}return n}function ye(e,i){let t=Y(e),n=[];for(let a of i){let s=t(a.file);s&&!e.isIgnored(s)&&n.push({...a,file:s})}return K(n)}function Y(e){let t=e.all(`SELECT relative_path FROM documents
4
4
  ORDER BY id`).map(a=>a.relative_path).map(a=>({path:a,normalized:b(a)})),n=new Map;for(let a of t){let s=n.get(a.normalized);n.set(a.normalized,s===void 0||s===a.path?a.path:null)}return a=>{let s=b(a),o=n.get(s);if(o)return o;let r=t.filter(l=>l.normalized.endsWith(s));return r.length===1?r[0].path:null}}function U(e){let i=[],t=null;for(let n of e.split(`
@@ -15,4 +15,4 @@ import{a as G}from"./chunk-QOKYJ33H.js";import{a as O,c as z}from"./chunk-BPKNP3
15
15
  AND m.role != 1
16
16
  AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
17
17
  ${e.pathExclusionsFor("ref_d")}`,...i,...t),a=new Map;for(let s of n){let o=a.get(s.symbol_id);o||(o=new Set,a.set(s.symbol_id,o)),o.add(s.relative_path)}return a}function I(e,i,t,n,a){if(e.isIgnored(n)||i.has(n))return;let s=t.get(n);s||(s=new Set,t.set(n,s)),s.add(a)}function Te(e){return[...e.entries()].map(([i,t])=>({file:i,consumedSymbols:t.size})).sort((i,t)=>t.consumedSymbols-i.consumedSymbols)}function Ne(e){return!(j(e.symbol)||e.parentTypeName!==null&&!S(e.symbol))}function _e(e,i){return S(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&i>0}export{ie as a,Ze as b,ae as c,re as d,oe as e,ue as f,J as g,x as h,fe as i,Ve as j,Ye as k,Ke as l,Se as m};
18
- //# sourceMappingURL=chunk-EHPOTEQX.js.map
18
+ //# sourceMappingURL=chunk-ESWVTSHU.js.map
@@ -1,2 +1,2 @@
1
- import{a as O,b as T,c as y,f as I,g as G,i as $,l as Y,m as q,n as K}from"./chunk-KLX6NSWT.js";import{Y as _}from"./chunk-G7GVV2TV.js";import{a as N}from"./chunk-GV2CEZCW.js";import{g as U,k as P,l as h,n as z,p as E,w as g}from"./chunk-7GAK2F3H.js";import{a as J,d as f}from"./chunk-3LCDIREB.js";var ue={references:$,referenceMap:Y,referenceEvidenceMap:q,callerMap:(e,i)=>I(e).callerMap(i),calleeMap:X,calleeEvidenceMap:Q};function X(e,i,r={}){return Q(e,i,r).rows}function Q(e,i,r={}){let a=J(),o=new Map,l=G(e,i),n=[],c=[],m=0,p=0,d=0,w=0,R=0,H=0,k=0,S=new Set,v=new Set;for(let{definition:t,callees:s}of l.hits)R+=1,o.set(t.symbolId,s),s.length>0&&(H+=1,k+=s.length);let u=Z(e,l.hits);if(u.entries.length>0&&f("semantic.callees.prefetch-cache-write",()=>E(e,u.entries),()=>({entries:u.entries.length,sourceMissing:u.sourceMissing,skippedUnsupportedLanguage:u.skippedUnsupportedLanguage})),f("semantic.callees.cache-scan",()=>{for(let[t,s]of O(l.misses)){if(!y(t)){a&&(m+=s.length);continue}let j=g(e,t);if(!j){a&&(p+=s.length),c.push(...s);continue}let A=h(e,t,j),D=V(e,t);if(!D){c.push(...s);continue}let W=z(e,t,A,D);for(let M of s){let L=W.get(M.symbol)??null;if(L!==null){let B=te(L);if(B){a&&(d+=1),o.set(M.symbolId,B);continue}a&&(w+=1)}n.push({def:M,contentHash:A,depsDigest:D})}}},()=>({definitions:i.length,skippedUnsupportedLanguage:m,sourceMissing:p,cacheHits:d,parseFailures:w,misses:n.length,unkeyed:c.length,inMemoryHits:R,inMemoryRows:H,inMemoryCalleeCount:k,resultRows:o.size})),n.length===0&&c.length===0)return{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v};let x=[...c,...n.map(t=>t.def)],F=0,C=f("semantic.callees.compute-misses",()=>{let t=K(e,x,r.resolveProvider);for(let s of t.incompleteSymbolIds)S.add(s);for(let s of t.unavailableSymbolIds)v.add(s);return F=t.rows.size,t.rows},()=>({definitions:x.length,misses:n.length,unkeyed:c.length,rows:F}));for(let[t,s]of C)o.set(t,s);let b=n.filter(t=>C.has(t.def.symbolId)&&I(e).capability("semantic-callees",t.def.relativePath).available).map(t=>({relativePath:t.def.relativePath,symbol:t.def.symbol,contentHash:t.contentHash,depsDigest:t.depsDigest,payload:JSON.stringify(C.get(t.def.symbolId)??[])}));return b.length>0?f("semantic.callees.cache-write",()=>E(e,b),()=>({entries:b.length})):f("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:n.length})),{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v}}function Z(e,i){let r=[],a=new Map,o=0,l=0;for(let{definition:n,callees:c}of i){if(!y(n.relativePath)){l+=1;continue}if(!a.has(n.relativePath)){let p=g(e,n.relativePath),d=p?V(e,n.relativePath):null;a.set(n.relativePath,p&&d?{contentHash:h(e,n.relativePath,p),depsDigest:d}:null)}let m=a.get(n.relativePath);if(!m){o+=1;continue}r.push({relativePath:n.relativePath,symbol:n.symbol,contentHash:m.contentHash,depsDigest:m.depsDigest,payload:JSON.stringify(c)})}return{entries:r,sourceMissing:o,skippedUnsupportedLanguage:l}}var ee="typescript-callees-v3-incomplete-scan";function V(e,i){let r=y(i);if(r==="typescript")return _(e,i,ee)?.key??null;let a=ie(e,i);return r==="rust"?P(JSON.stringify({kind:"semantic-callees",language:r,engine:T(e.config.projectRoot),positionMapping:"nearby-leaf-v2-callsite-line",depsDigest:a})):a}function te(e){try{return JSON.parse(e)}catch{return null}}var ne=U("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function ie(e,i){return ne.get(e,i,()=>{let a=[...N(e).get(i)??[]].sort().map(o=>`${o}:${h(e,o,g(e,o))}`);return P(a.join("|"))})}export{ue as a};
2
- //# sourceMappingURL=chunk-57OPIQFM.js.map
1
+ import{a as O,b as T,c as y,f as I,g as G,i as $,l as Y,m as q,n as K}from"./chunk-R2F2CTBA.js";import{Y as _}from"./chunk-SLLFJXTW.js";import{a as N}from"./chunk-6CTSFS7R.js";import{g as U,k as P,l as h,n as z,p as E,w as g}from"./chunk-23AD24QZ.js";import{a as J,d as f}from"./chunk-3LCDIREB.js";var ue={references:$,referenceMap:Y,referenceEvidenceMap:q,callerMap:(e,i)=>I(e).callerMap(i),calleeMap:X,calleeEvidenceMap:Q};function X(e,i,r={}){return Q(e,i,r).rows}function Q(e,i,r={}){let a=J(),o=new Map,l=G(e,i),n=[],c=[],m=0,p=0,d=0,w=0,R=0,H=0,k=0,S=new Set,v=new Set;for(let{definition:t,callees:s}of l.hits)R+=1,o.set(t.symbolId,s),s.length>0&&(H+=1,k+=s.length);let u=Z(e,l.hits);if(u.entries.length>0&&f("semantic.callees.prefetch-cache-write",()=>E(e,u.entries),()=>({entries:u.entries.length,sourceMissing:u.sourceMissing,skippedUnsupportedLanguage:u.skippedUnsupportedLanguage})),f("semantic.callees.cache-scan",()=>{for(let[t,s]of O(l.misses)){if(!y(t)){a&&(m+=s.length);continue}let j=g(e,t);if(!j){a&&(p+=s.length),c.push(...s);continue}let A=h(e,t,j),D=V(e,t);if(!D){c.push(...s);continue}let W=z(e,t,A,D);for(let M of s){let L=W.get(M.symbol)??null;if(L!==null){let B=te(L);if(B){a&&(d+=1),o.set(M.symbolId,B);continue}a&&(w+=1)}n.push({def:M,contentHash:A,depsDigest:D})}}},()=>({definitions:i.length,skippedUnsupportedLanguage:m,sourceMissing:p,cacheHits:d,parseFailures:w,misses:n.length,unkeyed:c.length,inMemoryHits:R,inMemoryRows:H,inMemoryCalleeCount:k,resultRows:o.size})),n.length===0&&c.length===0)return{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v};let x=[...c,...n.map(t=>t.def)],F=0,C=f("semantic.callees.compute-misses",()=>{let t=K(e,x,r.resolveProvider);for(let s of t.incompleteSymbolIds)S.add(s);for(let s of t.unavailableSymbolIds)v.add(s);return F=t.rows.size,t.rows},()=>({definitions:x.length,misses:n.length,unkeyed:c.length,rows:F}));for(let[t,s]of C)o.set(t,s);let b=n.filter(t=>C.has(t.def.symbolId)&&I(e).capability("semantic-callees",t.def.relativePath).available).map(t=>({relativePath:t.def.relativePath,symbol:t.def.symbol,contentHash:t.contentHash,depsDigest:t.depsDigest,payload:JSON.stringify(C.get(t.def.symbolId)??[])}));return b.length>0?f("semantic.callees.cache-write",()=>E(e,b),()=>({entries:b.length})):f("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:n.length})),{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v}}function Z(e,i){let r=[],a=new Map,o=0,l=0;for(let{definition:n,callees:c}of i){if(!y(n.relativePath)){l+=1;continue}if(!a.has(n.relativePath)){let p=g(e,n.relativePath),d=p?V(e,n.relativePath):null;a.set(n.relativePath,p&&d?{contentHash:h(e,n.relativePath,p),depsDigest:d}:null)}let m=a.get(n.relativePath);if(!m){o+=1;continue}r.push({relativePath:n.relativePath,symbol:n.symbol,contentHash:m.contentHash,depsDigest:m.depsDigest,payload:JSON.stringify(c)})}return{entries:r,sourceMissing:o,skippedUnsupportedLanguage:l}}var ee="typescript-callees-v3-incomplete-scan";function V(e,i){let r=y(i);if(r==="typescript")return _(e,i,ee)?.key??null;let a=ie(e,i);return r==="rust"?P(JSON.stringify({kind:"semantic-callees",language:r,engine:T(e.config.projectRoot),positionMapping:"nearby-leaf-v2-callsite-line",depsDigest:a})):a}function te(e){try{return JSON.parse(e)}catch{return null}}var ne=U("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function ie(e,i){return ne.get(e,i,()=>{let a=[...N(e).get(i)??[]].sort().map(o=>`${o}:${h(e,o,g(e,o))}`);return P(a.join("|"))})}export{ue as a};
2
+ //# sourceMappingURL=chunk-ETZBIG6K.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{a as r}from"./chunk-Z2L5H2HF.js";var i=new Set(["EPERM","EACCES","ENOTDIR","EROFS"]);function E(e){let n=e instanceof Error?e.message:String(e),{code:t,name:o}=e??{};return typeof t=="string"&&i.has(t)?`error: ${n} (codebaseiq cannot write here; set ${r}=1 to query an existing index without writing, or set CODEBASEIQ_CACHE_DIR to a writable directory)`:o==="CacheOwnershipError"?`error: ${n} (CODEBASEIQ_CACHE_DIR must name a directory that only this project uses)`:`error: ${n}`}export{E as a};
3
+ //# sourceMappingURL=chunk-EYSJHKX6.js.map