codebaseiq 0.2.0 → 0.3.1

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 (403) hide show
  1. package/CHANGELOG.md +59 -2
  2. package/README.md +1 -1
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/{chunk-WH5SYOMD.js → chunk-2E6OUPCF.js} +2 -2
  5. package/dist/chunk-2I2UHZET.js +2 -0
  6. package/dist/{chunk-CSZOQ7YO.js → chunk-2OMXFE64.js} +2 -2
  7. package/dist/{chunk-57KFVPVZ.js → chunk-2XBJRZEM.js} +2 -2
  8. package/dist/{chunk-PFPHS4NO.js → chunk-2Z7K66D7.js} +2 -2
  9. package/dist/{chunk-5WXOEJ4G.js → chunk-356EZBIP.js} +2 -2
  10. package/dist/{chunk-DLC6JDN7.js → chunk-3H2H5ODK.js} +2 -2
  11. package/dist/{chunk-HBQGKMM3.js → chunk-3LQJRS4I.js} +2 -2
  12. package/dist/{chunk-H3CKAL6P.js → chunk-3ON3A2QV.js} +2 -2
  13. package/dist/{chunk-MTMF4N7F.js → chunk-3VJ3OCRE.js} +2 -2
  14. package/dist/{chunk-QMGWSEPL.js → chunk-4GWN76B2.js} +2 -2
  15. package/dist/{chunk-IBM3F2BJ.js → chunk-4LK5OIPW.js} +2 -2
  16. package/dist/{chunk-6SDEQTVY.js → chunk-53ELMZRF.js} +2 -2
  17. package/dist/{chunk-OJFLPVBP.js → chunk-57OPIQFM.js} +2 -2
  18. package/dist/{chunk-2E6BTWER.js → chunk-5CR4U5X2.js} +2 -2
  19. package/dist/{chunk-IYBIBMPF.js → chunk-5FWR5HLG.js} +2 -2
  20. package/dist/{chunk-HHBBGWES.js → chunk-5LL4KEHO.js} +2 -2
  21. package/dist/{chunk-NTRW52UR.js → chunk-5MPBSFZH.js} +2 -2
  22. package/dist/chunk-5T44HG5Y.js +88 -0
  23. package/dist/chunk-5TZNHP4T.js +8 -0
  24. package/dist/{chunk-L3YSDLNB.js → chunk-5YBDBY5L.js} +2 -2
  25. package/dist/{chunk-YFQPWKHR.js → chunk-5ZI2PPI7.js} +2 -2
  26. package/dist/{chunk-WO47BIPY.js → chunk-6EYESTJM.js} +2 -2
  27. package/dist/{chunk-PHPQ24UG.js → chunk-6FXXYYQM.js} +2 -2
  28. package/dist/chunk-6O3KXIDL.js +2 -0
  29. package/dist/{chunk-PLZXWZHY.js → chunk-7GAK2F3H.js} +2 -2
  30. package/dist/{chunk-W3FK73MD.js → chunk-7UCDGXRW.js} +2 -2
  31. package/dist/{chunk-U2XX3BT4.js → chunk-AGGR2BKS.js} +2 -2
  32. package/dist/{chunk-ZB3V5QM7.js → chunk-ALOEHWJS.js} +2 -2
  33. package/dist/{chunk-NDGTJHQN.js → chunk-AXQCHG77.js} +2 -2
  34. package/dist/{chunk-X5I2BQGX.js → chunk-BFANZRQ5.js} +2 -2
  35. package/dist/{chunk-VVCBMH5O.js → chunk-BGGB5N53.js} +2 -2
  36. package/dist/{chunk-PARCKE3Q.js → chunk-BGYRF5YX.js} +2 -2
  37. package/dist/{chunk-CIVYHK7U.js → chunk-BIADXGC3.js} +2 -2
  38. package/dist/{chunk-NK76RSB6.js → chunk-BPKNP3KZ.js} +2 -2
  39. package/dist/{chunk-ZOEDRCR4.js → chunk-BRQL7AFJ.js} +2 -2
  40. package/dist/{chunk-KDYQQJ6X.js → chunk-BWL3PMPT.js} +2 -2
  41. package/dist/{chunk-M7LAIM77.js → chunk-C6WKPKCF.js} +2 -2
  42. package/dist/{chunk-37TKC6MB.js → chunk-CB5AVJMM.js} +2 -2
  43. package/dist/{chunk-BX2U3QQV.js → chunk-CCIYWXX6.js} +2 -2
  44. package/dist/{chunk-3AC56WAR.js → chunk-CIYA2KZN.js} +2 -2
  45. package/dist/{chunk-6OVNYYY4.js → chunk-CJTKGAGH.js} +2 -2
  46. package/dist/{chunk-FIXYHQ3W.js → chunk-CLPCFGRT.js} +2 -2
  47. package/dist/{chunk-LY2NB5XR.js → chunk-CSPDQLLU.js} +2 -2
  48. package/dist/{chunk-CMXW7MFV.js → chunk-CYJS33YX.js} +2 -2
  49. package/dist/{chunk-ACZDU5GK.js → chunk-D7DOB27N.js} +7 -7
  50. package/dist/{chunk-XUJM6474.js → chunk-DDRA3QKN.js} +2 -2
  51. package/dist/{chunk-3NUZVLR7.js → chunk-DECN422G.js} +2 -2
  52. package/dist/{chunk-RRPK327J.js → chunk-DJKOXMNG.js} +2 -2
  53. package/dist/{chunk-SJZQ2PTZ.js → chunk-DWBAESVW.js} +2 -2
  54. package/dist/{chunk-S5SKXCND.js → chunk-EHPOTEQX.js} +2 -2
  55. package/dist/chunk-EIBGSU2R.js +2 -0
  56. package/dist/{chunk-DVYG3JTA.js → chunk-ELYMY5S2.js} +2 -2
  57. package/dist/chunk-EOKVZXNF.js +355 -0
  58. package/dist/chunk-EQNMD62X.js +51 -0
  59. package/dist/{chunk-YIOQJ45A.js → chunk-F3QSL4W2.js} +2 -2
  60. package/dist/{chunk-VG55NFXF.js → chunk-F5CJO5JN.js} +2 -2
  61. package/dist/{chunk-JOALNFY3.js → chunk-F74LZWCE.js} +2 -2
  62. package/dist/chunk-G7GVV2TV.js +27 -0
  63. package/dist/{chunk-U24M5RQM.js → chunk-GQLDYCWS.js} +2 -2
  64. package/dist/{chunk-B2E3HZ2A.js → chunk-GV2CEZCW.js} +2 -2
  65. package/dist/{chunk-AM5SUGHF.js → chunk-GVAF222T.js} +2 -2
  66. package/dist/{chunk-T3YFIJ5P.js → chunk-HJTM3C4Y.js} +2 -2
  67. package/dist/{chunk-FY5V4V4F.js → chunk-HNXRVGMY.js} +2 -2
  68. package/dist/{chunk-UWB5WMC2.js → chunk-I3OK27P7.js} +2 -2
  69. package/dist/{chunk-RVYLJDXC.js → chunk-ICUL7XRT.js} +2 -2
  70. package/dist/{chunk-QVHZB75Z.js → chunk-IHSLIIL3.js} +2 -2
  71. package/dist/chunk-ILGTMRMZ.js +2 -0
  72. package/dist/{chunk-XNUWRTYM.js → chunk-IZDPGOZR.js} +2 -2
  73. package/dist/{chunk-BH5CE4LN.js → chunk-J7AMBVWF.js} +2 -2
  74. package/dist/chunk-JAFDMV5I.js +2 -0
  75. package/dist/{chunk-YXJ4IAHH.js → chunk-JCMFBF4Z.js} +2 -2
  76. package/dist/{chunk-BLKYYQ7C.js → chunk-JNXI6NQ7.js} +95 -95
  77. package/dist/{chunk-DKJXK3HA.js → chunk-JSB43EX6.js} +2 -2
  78. package/dist/chunk-JYRJYXUV.js +2 -0
  79. package/dist/chunk-K4S2VH42.js +82 -0
  80. package/dist/{chunk-QLTFXVUI.js → chunk-K6FNTQQW.js} +2 -2
  81. package/dist/{chunk-JYX5UZSZ.js → chunk-KEJ2HLRW.js} +2 -2
  82. package/dist/{chunk-VCWAJPXQ.js → chunk-KFTHI2R6.js} +2 -2
  83. package/dist/chunk-KLX6NSWT.js +3 -0
  84. package/dist/{chunk-DFPAZXLU.js → chunk-KPZGTB2O.js} +2 -2
  85. package/dist/{chunk-T55YPJGB.js → chunk-KUKKLWJD.js} +2 -2
  86. package/dist/{chunk-RWKEXCHU.js → chunk-KUKWHP4R.js} +2 -2
  87. package/dist/{chunk-ZJZQ7Q2Q.js → chunk-KWRQVLPX.js} +2 -2
  88. package/dist/{chunk-FQA3KIFX.js → chunk-L37EQYAX.js} +2 -2
  89. package/dist/{chunk-PNVZIJ57.js → chunk-LCW3PSGL.js} +2 -2
  90. package/dist/{chunk-7Z7HCZ7J.js → chunk-LKUTSP4G.js} +2 -2
  91. package/dist/{chunk-HIEXRDJF.js → chunk-LMTSB3TB.js} +2 -2
  92. package/dist/{chunk-SF34QLK2.js → chunk-LQHYYIOB.js} +2 -2
  93. package/dist/{chunk-EXMVF3JR.js → chunk-LSZYMN2A.js} +3 -3
  94. package/dist/{chunk-RCPZOPV6.js → chunk-M2Y6PCFE.js} +2 -2
  95. package/dist/chunk-MC46AL7B.js +343 -0
  96. package/dist/{chunk-SRY26ITJ.js → chunk-MDFT325O.js} +2 -2
  97. package/dist/{chunk-WJOQC4P7.js → chunk-MEUHIDI3.js} +2 -2
  98. package/dist/{chunk-FLLXYUOL.js → chunk-MQW6SJ4P.js} +2 -2
  99. package/dist/{chunk-57KEZDPT.js → chunk-MSI3K7PJ.js} +2 -2
  100. package/dist/{chunk-27PHVDKL.js → chunk-MZNMASFM.js} +2 -2
  101. package/dist/{chunk-VYZQZ4ZN.js → chunk-N2XDMNVI.js} +2 -2
  102. package/dist/{chunk-JN5LIBT3.js → chunk-NDKOVQFG.js} +2 -2
  103. package/dist/{chunk-W6C6QTXJ.js → chunk-NEWHKGVD.js} +2 -2
  104. package/dist/chunk-NNG6M6XD.js +3 -0
  105. package/dist/chunk-O2KWU34K.js +278 -0
  106. package/dist/{chunk-HBXZAGY6.js → chunk-O2M3VNDY.js} +2 -2
  107. package/dist/{chunk-FPDL2TUB.js → chunk-OBC7HSSO.js} +2 -2
  108. package/dist/{chunk-J24VICI5.js → chunk-OKAF4OQS.js} +2 -2
  109. package/dist/{chunk-I5FCDTK2.js → chunk-OP6BUIV6.js} +2 -2
  110. package/dist/{chunk-2DMVFAY7.js → chunk-OQ3DK7FW.js} +2 -2
  111. package/dist/{chunk-FEBLLMTL.js → chunk-OQUCBKOI.js} +2 -2
  112. package/dist/chunk-OT5ISJSR.js +2 -0
  113. package/dist/{chunk-N3Q3AWGW.js → chunk-OWJWOEDU.js} +96 -96
  114. package/dist/{chunk-M4EVGA5S.js → chunk-PIFYOWS4.js} +3 -3
  115. package/dist/{chunk-35YYZD3D.js → chunk-PTR3EOXC.js} +2 -2
  116. package/dist/{chunk-5XEVXVTK.js → chunk-PUVNH4PO.js} +2 -2
  117. package/dist/{chunk-I645ZF75.js → chunk-QEOWONKY.js} +2 -2
  118. package/dist/{chunk-JXHLB7TP.js → chunk-QMOZZ2VX.js} +2 -2
  119. package/dist/{chunk-NIO346UL.js → chunk-QY7QB7I6.js} +2 -2
  120. package/dist/{chunk-YYFV32WR.js → chunk-R4OJGTMP.js} +2 -2
  121. package/dist/{chunk-2VKB5CMA.js → chunk-RCIGX23V.js} +2 -2
  122. package/dist/{chunk-TUTSO7UZ.js → chunk-RIO3JXHM.js} +2 -2
  123. package/dist/{chunk-4IFISPQW.js → chunk-SA7G6GJX.js} +2 -2
  124. package/dist/{chunk-OMBRP7BB.js → chunk-SB53KPWA.js} +2 -2
  125. package/dist/chunk-SB7NASHU.js +2 -0
  126. package/dist/{chunk-3XFJUWJE.js → chunk-SGMNWYTH.js} +2 -2
  127. package/dist/{chunk-A7XQT7MH.js → chunk-SUE7SHZL.js} +2 -2
  128. package/dist/{chunk-IOVPAZWP.js → chunk-SX72EVMY.js} +2 -2
  129. package/dist/{chunk-OVKZM2XI.js → chunk-SZ4P7MF7.js} +2 -2
  130. package/dist/{chunk-EM5UHLAM.js → chunk-T2M5HWBQ.js} +2 -2
  131. package/dist/{chunk-CZEIHYMP.js → chunk-T6MQNNAC.js} +2 -2
  132. package/dist/chunk-T75DS2E6.js +21 -0
  133. package/dist/{chunk-57GCCPLS.js → chunk-TEANKHUU.js} +2 -2
  134. package/dist/{chunk-MT5W4DUG.js → chunk-TEMM2FEL.js} +2 -2
  135. package/dist/{chunk-I2KP4AGR.js → chunk-TJWVT4DO.js} +2 -2
  136. package/dist/{chunk-77GHPR2R.js → chunk-TLTSESB4.js} +2 -2
  137. package/dist/{chunk-KM4QRWI5.js → chunk-TNJGTQWO.js} +2 -2
  138. package/dist/{chunk-EFFMFK7C.js → chunk-TOTWJZIX.js} +2 -2
  139. package/dist/{chunk-54K6556S.js → chunk-U33PMPNW.js} +2 -2
  140. package/dist/{chunk-GXVDTHFC.js → chunk-U7NUXDQO.js} +2 -2
  141. package/dist/chunk-UC2FD2PS.js +4 -0
  142. package/dist/{chunk-MRGTCMDK.js → chunk-UIAUPFBJ.js} +2 -2
  143. package/dist/{chunk-LAGDJXFY.js → chunk-UJIXCI3L.js} +2 -2
  144. package/dist/{chunk-IVJJNVSX.js → chunk-UMEPSVKT.js} +2 -2
  145. package/dist/{chunk-4O52YNKL.js → chunk-UQYQBLJX.js} +2 -2
  146. package/dist/{chunk-JUO3Z644.js → chunk-UW6KD57C.js} +2 -2
  147. package/dist/{chunk-TAJ6UGCO.js → chunk-V4NGDIEA.js} +3 -3
  148. package/dist/{chunk-VLTUX4IF.js → chunk-VGWZ4MOY.js} +2 -2
  149. package/dist/{chunk-KNV5VFDV.js → chunk-VSGOIZMQ.js} +2 -2
  150. package/dist/{chunk-K5G7SPAG.js → chunk-W7QDASTN.js} +4 -4
  151. package/dist/{chunk-IWAMYGPN.js → chunk-W7YLRXZE.js} +2 -2
  152. package/dist/{chunk-QKVTWODE.js → chunk-WK2IQJPK.js} +2 -2
  153. package/dist/{chunk-HYKSLTAR.js → chunk-WO6OFKUC.js} +2 -2
  154. package/dist/{chunk-S64NCE2Z.js → chunk-WWCV4E6J.js} +2 -2
  155. package/dist/{chunk-2F5ERMNI.js → chunk-XJBK3QDV.js} +2 -2
  156. package/dist/{chunk-IGYAZPRX.js → chunk-XN3EKMLI.js} +2 -2
  157. package/dist/{chunk-FWY2PRIF.js → chunk-XQAVQVIL.js} +2 -2
  158. package/dist/{chunk-NJA4MMBD.js → chunk-XUPFA6GH.js} +2 -2
  159. package/dist/{chunk-4AOOSCZ7.js → chunk-YHPG3S2U.js} +2 -2
  160. package/dist/{chunk-CDWSLAPN.js → chunk-YPBKBYPS.js} +2 -2
  161. package/dist/{chunk-5BDK6QC3.js → chunk-YRKP7PM7.js} +2 -2
  162. package/dist/{chunk-4NHWNAWQ.js → chunk-YT4DVWUV.js} +2 -2
  163. package/dist/{chunk-5NJPH3QZ.js → chunk-YTJHCGYB.js} +2 -2
  164. package/dist/{chunk-ZNQCR656.js → chunk-Z66XYVLZ.js} +2 -2
  165. package/dist/{chunk-A67HT5FR.js → chunk-ZB4C5TTR.js} +2 -2
  166. package/dist/chunk-ZMA5HWXY.js +3 -0
  167. package/dist/{chunk-CWMHWD56.js → chunk-ZNH33XIB.js} +2 -2
  168. package/dist/{cli-context-XEPPF4RX.js → cli-context-FJL2JHOE.js} +2 -2
  169. package/dist/{cli-context-TSADTXLB.js → cli-context-PQNWHMCQ.js} +2 -2
  170. package/dist/{cli-program-KJGQEM72.js → cli-program-SCHOHOQE.js} +2 -2
  171. package/dist/cli.js +1 -1
  172. package/dist/{code-CDe-mIjx.d.ts → code-DfX3xeWy.d.ts} +1 -1
  173. package/dist/{code-viewer-ZCTHXQ5C.js → code-viewer-AMRXV444.js} +2 -2
  174. package/dist/{code-viewer-YGDON6SY.js → code-viewer-EXI5SFFR.js} +2 -2
  175. package/dist/{command-descriptors-5VAB2MZX.js → command-descriptors-H6A4UY72.js} +129 -129
  176. package/dist/{command-descriptors-EAHKIRAG.js → command-descriptors-ROIOTCCW.js} +130 -130
  177. package/dist/{db-DmRNdCtm.d.ts → db-BoG_PWYH.d.ts} +1 -1
  178. package/dist/direct-navigation-3JOYP2MO.js +3 -0
  179. package/dist/direct-navigation-SJMJLBY7.js +2 -0
  180. package/dist/{graph-evidence-Bs54NWws.d.ts → graph-evidence-D1jx1Cql.d.ts} +1 -1
  181. package/dist/{health-BnzbSLCE.d.ts → health-DkYBS5BI.d.ts} +1 -1
  182. package/dist/index.d.ts +1 -1
  183. package/dist/index.js +1 -1
  184. package/dist/invocation-command-descriptors-GMZX3UAD.js +2 -0
  185. package/dist/invocation-command-descriptors-HNMKDEF6.js +3 -0
  186. package/dist/{scip-cli-BRFKkHQn.d.ts → maintenance-types-CdL5eQii.d.ts} +1 -20
  187. package/dist/output-continuation-command-5NWVDQT7.js +2 -0
  188. package/dist/output-continuation-command-RNEHNYPU.js +3 -0
  189. package/dist/postinstall.js +1 -1
  190. package/dist/project-reindex-MIW5CYEG.js +3 -0
  191. package/dist/project-reindex-VQ23LWDA.js +2 -0
  192. package/dist/queries/affected.d.ts +1 -1
  193. package/dist/queries/affected.js +1 -1
  194. package/dist/queries/anchors.d.ts +1 -1
  195. package/dist/queries/anchors.js +1 -1
  196. package/dist/queries/architecture.d.ts +1 -1
  197. package/dist/queries/architecture.js +1 -1
  198. package/dist/queries/bottlenecks.d.ts +1 -1
  199. package/dist/queries/bottlenecks.js +1 -1
  200. package/dist/queries/by-kind.d.ts +1 -1
  201. package/dist/queries/by-kind.js +1 -1
  202. package/dist/queries/call-graph.d.ts +1 -1
  203. package/dist/queries/call-graph.js +1 -1
  204. package/dist/queries/change-surface.d.ts +1 -1
  205. package/dist/queries/change-surface.js +1 -1
  206. package/dist/queries/cleanup-plan.d.ts +1 -1
  207. package/dist/queries/cleanup-plan.js +1 -1
  208. package/dist/queries/co-change.d.ts +1 -1
  209. package/dist/queries/co-change.js +1 -1
  210. package/dist/queries/code.d.ts +2 -2
  211. package/dist/queries/code.js +1 -1
  212. package/dist/queries/complexity-hotspots.d.ts +1 -1
  213. package/dist/queries/complexity-hotspots.js +1 -1
  214. package/dist/queries/complexity.d.ts +1 -1
  215. package/dist/queries/complexity.js +1 -1
  216. package/dist/queries/context.d.ts +1 -1
  217. package/dist/queries/context.js +1 -1
  218. package/dist/queries/convergence.d.ts +1 -1
  219. package/dist/queries/convergence.js +1 -1
  220. package/dist/queries/coupling.d.ts +1 -1
  221. package/dist/queries/coupling.js +1 -1
  222. package/dist/queries/cycles.d.ts +1 -1
  223. package/dist/queries/cycles.js +1 -1
  224. package/dist/queries/dataflow.d.ts +1 -1
  225. package/dist/queries/dataflow.js +1 -1
  226. package/dist/queries/dead.d.ts +1 -1
  227. package/dist/queries/dead.js +1 -1
  228. package/dist/queries/decorative-checkers.d.ts +1 -1
  229. package/dist/queries/decorative-checkers.js +1 -1
  230. package/dist/queries/deep-chains.d.ts +1 -1
  231. package/dist/queries/deep-chains.js +1 -1
  232. package/dist/queries/dependence-slice.d.ts +2 -2
  233. package/dist/queries/dependence-slice.js +1 -1
  234. package/dist/queries/dependency-depth.d.ts +1 -1
  235. package/dist/queries/dependency-depth.js +1 -1
  236. package/dist/queries/deps.d.ts +1 -1
  237. package/dist/queries/deps.js +1 -1
  238. package/dist/queries/diff-impact.d.ts +1 -1
  239. package/dist/queries/diff-impact.js +1 -1
  240. package/dist/queries/doc-drift.d.ts +1 -1
  241. package/dist/queries/doc-drift.js +1 -1
  242. package/dist/queries/drift.d.ts +1 -1
  243. package/dist/queries/drift.js +1 -1
  244. package/dist/queries/duplicate-bodies.d.ts +1 -1
  245. package/dist/queries/duplicate-bodies.js +1 -1
  246. package/dist/queries/entry-map.d.ts +1 -1
  247. package/dist/queries/entry-map.js +1 -1
  248. package/dist/queries/evidence.d.ts +2 -2
  249. package/dist/queries/evidence.js +1 -1
  250. package/dist/queries/extract-candidates.d.ts +1 -1
  251. package/dist/queries/extract-candidates.js +1 -1
  252. package/dist/queries/fan.d.ts +1 -1
  253. package/dist/queries/fan.js +1 -1
  254. package/dist/queries/files.d.ts +1 -1
  255. package/dist/queries/files.js +1 -1
  256. package/dist/queries/health.d.ts +2 -2
  257. package/dist/queries/health.js +1 -1
  258. package/dist/queries/hierarchy.d.ts +1 -1
  259. package/dist/queries/hierarchy.js +1 -1
  260. package/dist/queries/hotspots.d.ts +1 -1
  261. package/dist/queries/hotspots.js +1 -1
  262. package/dist/queries/imports.d.ts +1 -1
  263. package/dist/queries/imports.js +1 -1
  264. package/dist/queries/incomplete-migration.d.ts +1 -1
  265. package/dist/queries/incomplete-migration.js +1 -1
  266. package/dist/queries/index.d.ts +4 -4
  267. package/dist/queries/index.js +1 -1
  268. package/dist/queries/isolated.d.ts +1 -1
  269. package/dist/queries/isolated.js +1 -1
  270. package/dist/queries/locality-candidates.d.ts +1 -1
  271. package/dist/queries/locality-candidates.js +1 -1
  272. package/dist/queries/members.d.ts +1 -1
  273. package/dist/queries/members.js +1 -1
  274. package/dist/queries/methods.d.ts +1 -1
  275. package/dist/queries/methods.js +1 -1
  276. package/dist/queries/not-implemented.d.ts +1 -1
  277. package/dist/queries/not-implemented.js +1 -1
  278. package/dist/queries/outline.d.ts +1 -1
  279. package/dist/queries/outline.js +1 -1
  280. package/dist/queries/passthrough-candidates.d.ts +1 -1
  281. package/dist/queries/passthrough-candidates.js +1 -1
  282. package/dist/queries/plan-context.d.ts +1 -1
  283. package/dist/queries/plan-context.js +1 -1
  284. package/dist/queries/react-component-duplicates.d.ts +1 -1
  285. package/dist/queries/react-component-duplicates.js +1 -1
  286. package/dist/queries/react-hook-candidates.d.ts +1 -1
  287. package/dist/queries/react-hook-candidates.js +1 -1
  288. package/dist/queries/react-large-component-pressure.d.ts +1 -1
  289. package/dist/queries/react-large-component-pressure.js +1 -1
  290. package/dist/queries/recent-duplicates.d.ts +1 -1
  291. package/dist/queries/recent-duplicates.js +1 -1
  292. package/dist/queries/redundant-reexports.d.ts +1 -1
  293. package/dist/queries/redundant-reexports.js +1 -1
  294. package/dist/queries/reference-neighborhood.d.ts +1 -1
  295. package/dist/queries/reference-neighborhood.js +1 -1
  296. package/dist/queries/reference-reachability.d.ts +1 -1
  297. package/dist/queries/reference-reachability.js +1 -1
  298. package/dist/queries/refs.d.ts +1 -1
  299. package/dist/queries/refs.js +1 -1
  300. package/dist/queries/self-audit.d.ts +1 -1
  301. package/dist/queries/self-audit.js +1 -1
  302. package/dist/queries/similar-chains.d.ts +1 -1
  303. package/dist/queries/similar-chains.js +1 -1
  304. package/dist/queries/similar-files.d.ts +1 -1
  305. package/dist/queries/similar-files.js +1 -1
  306. package/dist/queries/similar-signatures.d.ts +1 -1
  307. package/dist/queries/similar-signatures.js +1 -1
  308. package/dist/queries/similar.d.ts +1 -1
  309. package/dist/queries/similar.js +1 -1
  310. package/dist/queries/slice.d.ts +1 -1
  311. package/dist/queries/slice.js +1 -1
  312. package/dist/queries/source-inspection.d.ts +3 -3
  313. package/dist/queries/source-inspection.js +1 -1
  314. package/dist/queries/source-search.d.ts +1 -1
  315. package/dist/queries/source-search.js +1 -1
  316. package/dist/queries/stale-abstractions.d.ts +1 -1
  317. package/dist/queries/stale-abstractions.js +1 -1
  318. package/dist/queries/stats.d.ts +1 -1
  319. package/dist/queries/surface.d.ts +1 -1
  320. package/dist/queries/surface.js +1 -1
  321. package/dist/queries/symbols.d.ts +1 -1
  322. package/dist/queries/symbols.js +1 -1
  323. package/dist/queries/system-map.d.ts +1 -1
  324. package/dist/queries/system-map.js +1 -1
  325. package/dist/queries/system.d.ts +1 -1
  326. package/dist/queries/system.js +1 -1
  327. package/dist/queries/test-quality.d.ts +1 -1
  328. package/dist/queries/test-quality.js +1 -1
  329. package/dist/queries/trace.d.ts +1 -1
  330. package/dist/queries/trace.js +1 -1
  331. package/dist/queries/twin-ab.d.ts +1 -1
  332. package/dist/queries/twin-ab.js +1 -1
  333. package/dist/queries/twin-drift.d.ts +1 -1
  334. package/dist/queries/twin-drift.js +1 -1
  335. package/dist/queries/unused-imports.d.ts +1 -1
  336. package/dist/queries/unused-imports.js +1 -1
  337. package/dist/queries/unused-params.d.ts +1 -1
  338. package/dist/queries/unused-params.js +1 -1
  339. package/dist/queries/value-flow.d.ts +2 -2
  340. package/dist/queries/value-flow.js +1 -1
  341. package/dist/queries/vue-component-duplicates.d.ts +1 -1
  342. package/dist/queries/vue-component-duplicates.js +1 -1
  343. package/dist/queries/vue-composable-candidates.d.ts +1 -1
  344. package/dist/queries/vue-composable-candidates.js +1 -1
  345. package/dist/queries/vue-large-view-pressure.d.ts +1 -1
  346. package/dist/queries/vue-large-view-pressure.js +1 -1
  347. package/dist/queries/wrapper-candidates.d.ts +1 -1
  348. package/dist/queries/wrapper-candidates.js +1 -1
  349. package/dist/reindex-worker.js +2 -2
  350. package/dist/reindex.d.ts +2 -4
  351. package/dist/reindex.js +71 -32
  352. package/dist/runtime.d.ts +1 -2
  353. package/dist/runtime.js +3 -3
  354. package/dist/rust-semantic-session-server.js +1 -1
  355. package/dist/rust-semantic-session-worker.js +1 -1
  356. package/dist/rust-semantic-worker.js +1 -1
  357. package/dist/sentinel-ensure-command-H66AZ3VE.js +2 -0
  358. package/dist/sentinel-ensure-command-R4YAUCJB.js +3 -0
  359. package/dist/sentinel-worker.js +1 -1
  360. package/dist/typescript-mailbox-worker.js +1 -1
  361. package/dist/watch-server.js +2 -2
  362. package/docs/INDEX_GENERATIONS.md +2 -2
  363. package/docs/NPM_RELEASE.md +323 -0
  364. package/docs/schemas/npm-release-state.schema.json +4 -13
  365. package/package.json +3 -11
  366. package/dist/chunk-2Q2LW5JW.js +0 -14
  367. package/dist/chunk-327YK6TB.js +0 -4
  368. package/dist/chunk-347TXATM.js +0 -2
  369. package/dist/chunk-36WRYYTE.js +0 -3
  370. package/dist/chunk-5IO2APSS.js +0 -2
  371. package/dist/chunk-6OAHRI2D.js +0 -6
  372. package/dist/chunk-6URCE5QY.js +0 -2
  373. package/dist/chunk-6ZV5EDUT.js +0 -5
  374. package/dist/chunk-7R64XY4Y.js +0 -12
  375. package/dist/chunk-CANBLFVQ.js +0 -15
  376. package/dist/chunk-CCRZLRWJ.js +0 -2
  377. package/dist/chunk-G2XUZCF2.js +0 -88
  378. package/dist/chunk-H5QXP63L.js +0 -2
  379. package/dist/chunk-HCMQZPEO.js +0 -2
  380. package/dist/chunk-IEL6Q5W3.js +0 -308
  381. package/dist/chunk-IGQQUENU.js +0 -109
  382. package/dist/chunk-K2O7SBAU.js +0 -2
  383. package/dist/chunk-QVWDQTMG.js +0 -2
  384. package/dist/chunk-RJWAB4VR.js +0 -345
  385. package/dist/chunk-VCL7FK3E.js +0 -3
  386. package/dist/chunk-WOOTEWQT.js +0 -239
  387. package/dist/chunk-XYLV727H.js +0 -21
  388. package/dist/chunk-YMGZZEW4.js +0 -2
  389. package/dist/direct-navigation-B3SGOOBW.js +0 -2
  390. package/dist/direct-navigation-ZL362KXF.js +0 -3
  391. package/dist/invocation-command-descriptors-CSUGUHTT.js +0 -2
  392. package/dist/invocation-command-descriptors-PPVZOIE5.js +0 -3
  393. package/dist/output-continuation-command-FTVVBVSN.js +0 -2
  394. package/dist/output-continuation-command-ITPRC3YV.js +0 -3
  395. package/dist/project-reindex-7HZSLLLY.js +0 -3
  396. package/dist/project-reindex-NGM3DYBN.js +0 -2
  397. package/dist/sentinel-ensure-command-KYYULCFU.js +0 -2
  398. package/dist/sentinel-ensure-command-RIZA3RY7.js +0 -3
  399. package/docs/WINDOWS_SIDECAR_RELEASE.md +0 -424
  400. package/docs/schemas/windows-sidecar-provenance.schema.json +0 -137
  401. package/scripts/build-codebaseiq-windows.mjs +0 -197
  402. package/scripts/codebaseiq-windows-provenance.mjs +0 -364
  403. package/scripts/verify-codebaseiq-windows.mjs +0 -29
@@ -1,14 +0,0 @@
1
- import{execFileSync as l,spawnSync as y}from"child_process";import{platform as E}from"os";import{resolve as b}from"path";import{createHash as m}from"crypto";import{existsSync as a,renameSync as u,rmSync as d,writeFileSync as f}from"fs";import{tmpdir as w}from"os";import{join as S}from"path";var c=`'use strict';
2
- const NativeRegExp = globalThis.RegExp;
3
- const escapeLoneSeparator = (args) =>
4
- typeof args[0] === 'string' && args[0] === '\\\\' ? ['\\\\\\\\', ...args.slice(1)] : args;
5
- globalThis.RegExp = new Proxy(NativeRegExp, {
6
- construct(target, args) {
7
- return Reflect.construct(target, escapeLoneSeparator(args));
8
- },
9
- apply(target, thisArg, args) {
10
- return Reflect.apply(target, thisArg, escapeLoneSeparator(args));
11
- },
12
- });
13
- `,x=/scip-python/i;function p(t,r=process.platform){return r!=="win32"||!x.test(t)?[]:["--require",h()]}function h(t=w()){let r=m("sha256").update(c).digest("hex").slice(0,16),e=S(t,`codebaseiq-indexer-compat-${r}.cjs`);if(a(e))return e;let n=`${e}.${process.pid}.tmp`;f(n,c);try{u(n,e)}catch{if(d(n,{force:!0}),!a(e))throw new Error(`could not materialize indexer compatibility preload at ${e}`)}return e}var g=E()==="win32";function k(t,r=y){try{return r(t,["--version"],{stdio:"ignore",timeout:1e4}).status===0}catch{return!1}}function D(t){let r=g?"where":"which";try{return l(r,[t],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var R=/\.(?:c|m)?js$/i,I=/\.(?:exe|com)$/i;function $(t,r){return R.test(t)?{binary:process.execPath,args:[...p(t),t,...r]}:{binary:t,args:[...r]}}function A(t,r){return l(t,r,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL"})}function B(t,r={}){let e=r.isWindows??g,n=r.lookup??A,i;try{i=n(e?"where":"which",[t])}catch{return null}let s=i.split(/\r?\n/).map(o=>o.trim()).filter(Boolean);if(!e){let o=s[0];return o?b(o):null}return s.find(o=>I.test(o))??null}export{k as a,D as b,$ as c,B as d};
14
- //# sourceMappingURL=chunk-2Q2LW5JW.js.map
@@ -1,4 +0,0 @@
1
- import{isAbsolute as Z,relative as _e}from"path";var g=class extends Error{constructor(r,n){super(`refusing unsafe project file path ${JSON.stringify(r)} (${n})`);this.relativePath=r;this.reason=n;this.name="UnsafeProjectPathError"}relativePath;reason;code="CODEBASEIQ_UNSAFE_PROJECT_PATH"};function L(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Ht(e){return e.replace(/\\/g,"/")}function Xt(e,t){return L(e)===L(t)}function Q(e){let t=e.trim();if(!/^file:/i.test(t))return t;let r;try{r=new URL(t)}catch{return t}if(r.protocol!=="file:")return t;let n;try{n=decodeURIComponent(r.pathname)}catch{return t}for(n=n.replace(/\\/g,"/");n.length>1&&n.endsWith("/");)n=n.slice(0,-1);let o=/^\/([A-Za-z]):(\/|$)/.exec(n);o&&(n=`/${o[1].toUpperCase()}:${n.slice(3)}`);let i=n.split("/").map(s=>encodeURIComponent(s).replace(/%3A/gi,":")).join("/");return`file://${r.host}${i}`}function Jt(e,t){return Q(e)===Q(t)}function _(e,t){let r=_e(e,t);return r===""||!r.startsWith("..")&&!Z(r)}function ee(e){if(!e)throw new g(e,"empty-path");if(e.includes("\0"))throw new g(e,"nul-byte");if(Z(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new g(e,"absolute-path");let t=L(e);if(t.split("/").some(n=>n===".."))throw new g(e,"parent-traversal");if(!t||t===".")throw new g(e,"empty-path");return t}function Me(e,t,r=[]){let n=N(e);if(oe.has(n)||r.some(i=>k(n,i))||t.some(i=>se(n,i)))return"config";if(t.some(ce)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return"ambient";let o=ae(n);return t.some(i=>(ue[i]??[]).includes(o))?"source":"other"}function Yt(e,t,r){let n=N(e);if(oe.has(n)||r?.some(i=>k(n,i))||se(n,t)||ce(t)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return!0;let o=ae(n);return(ue[t]??[]).includes(o)}function Qt(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!te(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!te(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(M)?null:t}function Zt(e,t){let r=new Map((e?.files??[]).map(a=>[a.path,a])),n=new Map(t.files.map(a=>[a.path,a])),o=new Set([...r.keys(),...n.keys()]),i=[];for(let a of[...o].sort()){let u=r.get(a),c=n.get(a),b=Me(a,t.languages);!u&&c?i.push({kind:"added",path:a,inputKind:b,after:c}):u&&!c?i.push({kind:"deleted",path:a,inputKind:b,before:u}):u&&c&&(u.hash!==c.hash||u.size!==c.size)&&i.push({kind:"modified",path:a,inputKind:b,before:u,after:c})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(re(e?.files??[])||re(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(Ne)&&s.add("unreadable-input"),{version:1,changes:i,projectIdentityChanged:e?!Te(e,t):!0,uncertainty:[...s].sort()}}function te(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function re(e){return new Set(e.map(t=>t.path)).size!==e.length}function M(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"}function Ne(e){return e.hash==="unreadable"||e.size<0}function Te(e,t){return ne(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&ne(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function ne(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();return r.every((o,i)=>o===n[i])}var oe=new Set([".codebaseiq.json"]),Be={typescript:["tsconfig.json"],javascript:["package.json"],java:["pom.xml","build.gradle"],scala:["build.sbt"],kotlin:["build.gradle.kts"],rust:["Cargo.toml"],python:["pyproject.toml","setup.py"],ruby:["Gemfile"],go:["go.mod"],cpp:["CMakeLists.txt","Makefile"],c:["CMakeLists.txt","Makefile"],csharp:["*.csproj","*.sln"],vb:["*.vbproj","*.sln"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},Ge={typescript:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],javascript:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.json","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],java:["build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],scala:["plugins.sbt","build.properties"],kotlin:["pom.xml","build.gradle","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],rust:["Cargo.lock","rust-project.json","rust-toolchain","rust-toolchain.toml"],python:["setup.cfg","requirements*.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock"],ruby:["Gemfile.lock","gems.locked"],go:["go.sum","go.work","go.work.sum"],cpp:["compile_commands.json"],c:["compile_commands.json"],csharp:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],vb:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],dart:["pubspec.lock","analysis_options.yaml"],php:["composer.lock"],clojure:[]},ie=new Map;function se(e,t){return Be[t].some(r=>k(e,r))||Ge[t].some(r=>k(e,r))}function k(e,t){let r=N(t).replace(/^\.\//,"");if(!r)return!1;let n=e.split("/").at(-1)??e,o=r.includes("/")?e:n;if(!r.includes("*")&&!r.includes("?"))return o===r;let i=ie.get(r);if(!i){let s=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");i=new RegExp(`^${s}$`),ie.set(r,i)}return i.test(o)}function N(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function ae(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function ce(e){return e==="typescript"||e==="javascript"}var ue={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs",".vue"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};function f(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function de(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function tr(e){return typeof e=="string"&&e.length>0}function rr(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function nr(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/u.test(e)}function ir(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}var pe=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"];var T=2,m=3;var B=new Set(pe);function pr(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(s){return{kind:"malformed",reason:`invalid JSON: ${He(s)}`}}if(!f(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!==T&&r!==m)return{kind:"unsupported",version:r,direction:r<T?"older":"future"};let n=$e(t,r);if(n)return{kind:"malformed",reason:n};let o=t,i={metadata:o,capabilities:We(o)};return r===T?{kind:"legacy",...i,metadata:o}:{kind:"supported",...i,metadata:o}}function lr(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function gr(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===m?t.sqliteLayoutVersion:void 0})}function We(e){let t=e.fingerprint!==void 0,r=f(e.fingerprint),n=e.indexedLanguages!==void 0,o=e.status==="complete",i=e.version===m?e:null;return{usableForQuery:n,usableForEvidenceCache:t,publishableGeneration:o&&r&&n,stableGenerationIdentity:o&&t&&typeof e.updatedAt=="string",languageShardReuse:!!i?.languageFingerprints,typescriptProjectShardReuse:!!i?.typescriptProjectShards}}function $e(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!de(e.updatedAt))return"updatedAt must be a valid timestamp";for(let r of["requestedLanguages","indexedLanguages"])if(e[r]!==void 0&&!Ue(e[r]))return`${r} must contain unique supported languages`;return e.skipped!==void 0&&!ze(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===m&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===m&&e.languageFingerprints!==void 0&&!qe(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===m&&e.typescriptProjectShards!==void 0&&!Ve(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function fr(e){return e.version===m&&e.sqliteLayoutVersion===1}function Ue(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&B.has(t))?!1:new Set(e).size===e.length}function ze(e){return Array.isArray(e)&&e.every(t=>f(t)&&typeof t.language=="string"&&B.has(t.language)&&typeof t.reason=="string")}function qe(e){return f(e)&&Object.entries(e).every(([t,r])=>B.has(t)&&f(r))}function Ve(e){return f(e)&&Object.values(e).every(t=>f(t)&&Array.isArray(t.files)&&t.files.every(M))}function He(e){return e instanceof Error?e.message:String(e)}import{closeSync as G,fstatSync as E,openSync as W,readFileSync as Xe,readSync as le}from"fs";import{createHash as Je}from"crypto";var ge=8*1024*1024,Ke=64*1024*1024,Ye=512*1024*1024,Qe=256*1024*1024,y=class extends Error{constructor(r,n,o,i,s){let a=o==="too-large"?`is ${i} bytes; the safety limit is ${s} bytes`:o==="not-regular"?"is not a regular file":"changed while it was being read";super(`${r} ${JSON.stringify(n)} ${a}`);this.inputKind=r;this.inputPath=n;this.reason=o;this.observedBytes=i;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="CODEBASEIQ_BOUNDED_FILE_READ"};function fe(e,t){z(t.maxBytes);let r=String(e),n=W(e,"r");try{let o=E(n);be(o,t,r);let i=Xe(n),s=E(n);if(s.dev!==o.dev||s.ino!==o.ino||s.size!==o.size||i.byteLength!==o.size)throw new y(t.inputKind,r,"changed-during-read",s.size,t.maxBytes);return i}finally{G(n)}}function ye(e,t,r="utf8"){return fe(e,t).toString(r)}function $(e,t){return ye(e,{maxBytes:ge,inputKind:t})}function U(e,t){z(t.maxBytes);let r=[],n=Buffer.allocUnsafe(64*1024),o=0;for(;;){let i=le(e,n,0,n.length,null);if(i===0)break;if(o+=i,!Number.isSafeInteger(o)||o>t.maxBytes)throw new y(t.inputKind,`file descriptor ${e}`,"too-large",o,t.maxBytes);r.push(Buffer.from(n.subarray(0,i)))}return Buffer.concat(r,o)}function Ze(e,t,r="utf8"){return U(e,t).toString(r)}function me(e,t){let r=W(e,"r");try{return U(r,t)}finally{G(r)}}function et(e,t,r="utf8"){return me(e,t).toString(r)}function he(e,t,r){z(t.maxBytes);let n=String(e),o=W(e,"r");try{let i=E(o);be(i,t,n);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,i.size))),a=0;for(;a<i.size;){let c=le(o,s,0,Math.min(s.length,i.size-a),a);if(c===0)break;r(s.subarray(0,c)),a+=c}let u=E(o);if(u.dev!==i.dev||u.ino!==i.ino||u.size!==i.size||a!==i.size)throw new y(t.inputKind,n,"changed-during-read",u.size,t.maxBytes);return a}finally{G(o)}}function tt(e,t){let r=Je("sha256");return he(e,t,n=>r.update(n)),r.digest("hex")}function be(e,t,r){if(!e.isFile())throw new y(t.inputKind,r,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new y(t.inputKind,r,"too-large",Number(e.size),t.maxBytes)}function z(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}import{createHash as we,randomUUID as dt}from"crypto";import{chmodSync as je,existsSync as h,linkSync as pt,lstatSync as D,readdirSync as H,realpathSync as p,unlinkSync as lt,writeSync as gt}from"fs";import{homedir as ft}from"os";import{basename as yt,dirname as A,isAbsolute as ke,join as d,resolve as v}from"path";import{closeSync as rt,existsSync as nt,fsyncSync as it,mkdirSync as ot,openSync as st}from"fs";import{dirname as Se}from"path";function xe(e,t,r,n){let o=0;for(;o<t.length;){let i=r.writeFile(e,t,o,t.length-o);if(!Number.isSafeInteger(i)||i<=0||i>t.length-o)throw new Error(`${n} write did not make valid forward progress`);o+=i}}function q(e,t){if(t!=="win32")return!1;let r=e.code;return r==="EACCES"||r==="EBADF"||r==="EINVAL"||r==="EISDIR"||r==="EPERM"}var S=Object.freeze({platform:process.platform,pathExists:e=>nt(e),makeDirectory:e=>ot(e,{recursive:!0}),openFile:(e,t,r)=>st(e,t,r),syncFile:e=>it(e),closeFile:e=>rt(e)});function Ce(e,t=S){let r=[],n=e;for(;!t.pathExists(n);){r.push(n);let i=Se(n);if(i===n)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);n=i}let o="synced";for(let i of r.reverse())t.makeDirectory(i),o=j(o,w(Se(i),t));return o}function w(e,t=S){let r;try{r=t.openFile(e,"r")}catch(n){if(q(n,t.platform))return"unsupported";throw n}try{t.syncFile(r)}catch(n){try{t.closeFile(r)}catch{}if(q(n,t.platform))return"unsupported";throw n}return t.closeFile(r),"synced"}function j(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{createRequire as at}from"module";var ct=at(import.meta.url),Re=ut().version;function ut(){for(let e of["../package.json","../../package.json"])try{return ct(e)}catch{}return{version:"0.0.0"}}var Pe=1,R=".codebaseiq-cache-owner.json",mt=16*1024,De=Object.freeze({...S,randomToken:()=>dt(),linkFile:(e,t)=>pt(e,t),removeFile:e=>lt(e),writeFile:(e,t,r,n)=>gt(e,t,r,n)});function P(e,t){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${t}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"CODEBASEIQ_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function l(e,t){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${t}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"CODEBASEIQ_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function ht(e,t){let r=p(e);return St(r,bt(r,t))}function bt(e,t){let r=p(e),n=process.env.CODEBASEIQ_CACHE_DIR;return n?v(n):t?.dbPath?Rt(r,t.dbPath):xt(r)}function Ae(){let e=process.env.XDG_CACHE_HOME;return d(e||d(ft(),".cache"),"codebaseiq")}function xt(e){let t=v(e);try{t=p(t)}catch{}let r=we("sha256").update(t).digest("hex").slice(0,12);return d(Ae(),"projects",r)}function Br(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=d(Ae(),"repositories",e);return Fe(t),p(t)}function Gr(e){return process.env.CODEBASEIQ_SHARED_CACHE!=="0"&&!process.env.CODEBASEIQ_CACHE_DIR&&!process.env.CODEBASEIQ_INDEX_DB&&!e?.dbPath}function Wr(e,t){let r=ht(e,t);return{cacheDir:r,dbPath:d(r,"index.db"),indexPath:d(r,"index.scip"),metaPath:d(r,"meta.json")}}function St(e,t,r=De){return Ct(e,t,r).cacheDir}function Ct(e,t,r=De){let n=p(e),o=h(t)?"synced":Fe(t,r),i=p(t),s=d(i,R);if(h(s))return V(n,i),X(s),C(i),{kind:"existing",cacheDir:i};Ee(i),Pt(i),Ee(i);let u=`${JSON.stringify({schemaVersion:Pe,canonicalProjectRoot:n,canonicalCacheDir:i,creatorVersion:Re},null,2)}
2
- `;try{let c=Dt(s,u,r),b=j(o,c);return{kind:"published",cacheDir:i,achievedDurability:b==="synced"?"directory-durable":"file-flushed",directorySync:b}}catch(c){if(vt(c))return V(n,i),{kind:"existing",cacheDir:i};throw c}}function V(e,t){let r=p(e),n=p(t);return Et(n,r,n)}function $r(e,t){return h(d(t,R))?(V(e,t),ve(t),!0):!1}function Rt(e,t){let r;try{r=ee(t)}catch(s){throw s instanceof g?P(t,s.reason):s}let n=v(e,...r.split("/"));if(n===e||!_(e,n))throw P(t,"outside-project");let o=kt(n),i=p(o);if(!_(e,i)&&i!==e)throw P(t,"symlink-escape");return n}function kt(e){let t=e;for(;!h(t);){let r=A(t);if(r===t)throw P(e,"no-existing-ancestor");t=r}return t}function Et(e,t,r){let n=d(e,R);if(!h(n)||D(n).isSymbolicLink())throw l(e,"missing regular ownership record");let o=D(n);if(!o.isFile()||o.size>mt)throw l(e,"invalid ownership record file");let i=$(n,"cache ownership record"),s=wt(i,e);if(s.canonicalProjectRoot!==t)throw l(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==r)throw l(e,"ownership record names a different cache directory");return{record:s,ownerSha256:we("sha256").update(i).digest("hex"),physicalCacheDir:e}}function wt(e,t){try{let r=JSON.parse(e);if(r.schemaVersion!==Pe||typeof r.canonicalProjectRoot!="string"||typeof r.canonicalCacheDir!="string"||typeof r.creatorVersion!="string"||!ke(r.canonicalProjectRoot)||!ke(r.canonicalCacheDir))throw new Error("invalid fields");return r}catch(r){throw l(t,`malformed ownership record: ${r instanceof Error?r.message:String(r)}`)}}function Ee(e){let t=H(e).filter(r=>r!==R&&!jt(r));if(t.length>0)throw l(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function jt(e){return e.startsWith(`${R}.tmp-`)||[".codebaseiq-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function Pt(e){for(let t of H(e)){let r=d(e,t);try{let n=D(r);if(n.isSymbolicLink())throw l(e,`legacy cache entry ${t} is a symlink`);if(n.isDirectory())C(r);else if(n.isFile())X(r);else throw l(e,`legacy cache entry ${t} is not a file or directory`)}catch(n){if(Ie(n))continue;throw n}}C(e)}function ve(e,t=!1){try{let r=D(e);if(r.isSymbolicLink())throw l(e,"managed cache tree contains a symlink");if(r.isFile()){X(e);return}if(!r.isDirectory())throw l(e,"managed cache tree contains a special file");C(e);for(let n of H(e))ve(d(e,n),!0)}catch(r){if(t&&Ie(r))return;throw r}}function Ie(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function Fe(e,t=S){let r=Ce(e,t);return C(e),r}function Dt(e,t,r){let n=`${e}.tmp-${process.pid}-${r.randomToken()}`,o,i=!1;try{o=r.openFile(n,"wx",384),i=!0,xe(o,Buffer.from(t),r,"cache ownership record"),r.syncFile(o),r.closeFile(o),o=void 0,r.linkFile(n,e);let s=w(A(e),r);return r.removeFile(n),i=!1,j(s,w(A(e),r))}finally{if(o!==void 0)try{r.closeFile(o)}catch{}if(i)try{r.removeFile(n)}catch{}}}function C(e){process.platform!=="win32"&&je(e,448)}function X(e){process.platform!=="win32"&&je(e,384)}function At(e){if(h(e))return p(e);let t=[],r=e;for(;;){let n=A(r);if(n===r)return e;if(t.unshift(yt(r)),h(n))return d(p(n),...t);r=n}}function Ur(e){return At(v(e))}function vt(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{spawnSync as It}from"child_process";import{createHash as Ft}from"crypto";import{existsSync as Ot,lstatSync as Lt,realpathSync as _t}from"fs";import{dirname as Mt,isAbsolute as Nt,join as Tt,resolve as F}from"path";function Bt(){return{...process.env,GIT_OPTIONAL_LOCKS:"0",LC_ALL:"C"}}var O={run(e,t){let r=Oe(e,t);return r.kind==="success"?r.output:void 0},runResult:Oe},Gt=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],J=/^[0-9a-f]{40,64}$/;function Jr(e,t,r=O){if(!t||t.startsWith("-")||/[\0\r\n]/.test(t))throw new Error(`Invalid Git revision ${JSON.stringify(t)}.`);let n=r.runResult(e,["rev-parse","--verify","--end-of-options",`${t}^{commit}`]);if(n.kind!=="success"||!J.test(n.output))throw new Error(`Git revision ${JSON.stringify(t)} does not resolve to exactly one commit.`);return n.output}function Kr(e,t=O){let r=t.runResult(e,Gt);if(r.kind==="success"){let n=Wt(r.output);if(n)return $t(n,t)}return Ut(e,t)}function Wt(e){let t=e.split(`
3
- `).map(u=>u.trim());if(t.length!==5)return;let[r,n,o,i,s]=t;if(!r||!n||!o||!i||!s||!J.test(i)||!J.test(s))return;let a=x(r);return{root:a,gitDir:x(I(a,n)),commonDir:x(I(a,o)),headCommit:i,treeOid:s}}function $t(e,t){let r=t.run(e.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...Le(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:Y("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.length===0}}function Ut(e,t){let r=zt(e,t);if(r.kind!=="worktree")return;let n=r.identity,o=n.projectRoot,i=t.run(o,["rev-parse","--git-common-dir"])?.trim();if(!i)return;let s=x(I(o,i)),a=K(t.run(o,["rev-parse","--verify","HEAD"])),u=K(t.run(o,["rev-parse","--verify","HEAD^{tree}"])),c=t.run(o,["status","--porcelain=v1","-z","--untracked-files=all"]);if(c!==void 0)return{...n,commonDir:s,repositoryId:Y("repository",s),headCommit:a,treeOid:u,clean:c.length===0}}function zt(e,t=O){let r=t.runResult(e,["rev-parse","--show-toplevel"]);if(r.kind==="not-repository")return{kind:"non-git"};if(r.kind==="error")return r;let n=r.output.trim();if(!n)return{kind:"error",message:"Git returned an empty worktree root."};let o=x(n),i=t.run(o,["rev-parse","--absolute-git-dir"])?.trim();if(!i)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=x(I(o,i));return{kind:"worktree",identity:Le(o,s)}}function Le(e,t){return{projectRoot:e,gitDir:t,worktreeId:Y("worktree",`${e}\0${t}`)}}function Yr(e,t,r=O){return K(r.run(e,t))}function I(e,t){return Nt(t)?t:F(e,t)}function x(e){try{return _t(e)}catch{return F(e)}}function Y(e,t){return Ft("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function K(e){return e?.trim()||void 0}function Oe(e,t){let r=It("git",["-C",e,...t],{encoding:"utf-8",env:Bt(),maxBuffer:52428800,stdio:["ignore","pipe","pipe"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"});if(r.status===0)return{kind:"success",output:r.stdout.trimEnd()};let o=(typeof r.stderr=="string"?r.stderr.trim():"")||r.error?.message||`git exited with status ${r.status??"unknown"}`,i=r.error?.code;return(/not a git repository/i.test(o)||i==="ENOENT"&&Ot(F(e)))&&!qt(e)?{kind:"not-repository"}:{kind:"error",message:o}}function qt(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=F(e);for(;;){try{return Lt(Tt(t,".git")),!0}catch(n){let o=n.code;if(o!=="ENOENT"&&o!=="ENOTDIR")return!0}let r=Mt(t);if(r===t)return!1;t=r}}export{g as a,L as b,Ht as c,Xt as d,Q as e,Jt as f,_ as g,ee as h,Me as i,Yt as j,Qt as k,Zt as l,Be as m,f as n,de as o,tr as p,rr as q,nr as r,ir as s,pe as t,m as u,pr as v,lr as w,gr as x,We as y,fr as z,ge as A,Ke as B,Ye as C,Qe as D,y as E,fe as F,ye as G,$ as H,Ze as I,et as J,he as K,tt as L,xe as M,q as N,S as O,Ce as P,w as Q,j as R,Re as S,bt as T,Ae as U,xt as V,Br as W,Gr as X,Wr as Y,$r as Z,Ur as _,Bt as $,O as aa,Jr as ba,Kr as ca,Yr as da,I as ea,x as fa};
4
- //# sourceMappingURL=chunk-327YK6TB.js.map
@@ -1,2 +0,0 @@
1
- import{b as r}from"./chunk-HIEXRDJF.js";import{y as e}from"./chunk-AM5SUGHF.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
- //# sourceMappingURL=chunk-347TXATM.js.map
@@ -1,3 +0,0 @@
1
- import{n as fe}from"./chunk-TAJ6UGCO.js";import{A as me,z as M}from"./chunk-BLKYYQ7C.js";import{c as ce,h as le}from"./chunk-HBXZAGY6.js";import{X as D,Y as he,b as H,c as z}from"./chunk-IGQQUENU.js";import{B as N,D as ge}from"./chunk-WJOQC4P7.js";import{d as se}from"./chunk-IYBIBMPF.js";import{K as de,L as ue,V as pe,a as j,k as oe,l as k}from"./chunk-XYLV727H.js";import{g as ae}from"./chunk-2VKB5CMA.js";import{j as w,r as W}from"./chunk-ACZDU5GK.js";import{a as V,c as Y,d as J}from"./chunk-6URCE5QY.js";import{H as K,I as Z,J as R,K as ee,M as te,N as re,P,R as ne,T as O,V as ie,W as T,X as _,h as C,n as X}from"./chunk-4O52YNKL.js";import{statSync as ye}from"fs";import{basename as He,isAbsolute as ze,join as L,relative as Xe}from"path";import{fileURLToPath as Je}from"url";import{watch as Ke}from"chokidar";import Ze from"ignore";var Ee=5e3,Re=class{projectRoot;config;watchConfig;outputDb;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onReindexError;onRefreshSuppressed;onFileChanged;onBulkChange;onError;reindexRunner;subscriptionFactory;budgetInspector;clock;activeOperation=null;stopPromise=null;stopInProgress=!1;status={state:"idle"};debounceTimer=null;cooldownTimer=null;budgetTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;reindexInFlight=!1;lastReindexEnd=0;fileChangeTimer=null;pendingFileChanges=new Set;bulkChangePending=!1;fsWatchers=[];sourcePollingFallbackStarted=!1;gitPollTimer=null;lastGitState=null;gitignoreFilter;extraIgnore;stopped=!1;observationEpoch=0;changeSequence=0;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=ge(e.config),this.outputDb=e.outputDb??L(Z(this.projectRoot,e.config),"index.db"),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.clojureConfigPath=e.config.indexer?.clojure?.configPath,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onReindexError=e.onReindexError??(()=>{}),this.onRefreshSuppressed=e.onRefreshSuppressed??(()=>{}),this.onFileChanged=e.onFileChanged,this.onBulkChange=e.onBulkChange;let r=e.onError??(n=>console.error(n.message));this.onError=n=>{this.observationEpoch+=1,r(n)},this.clock=e.clock??it,Ie.set(this,gt(e.stopTimeoutMs??Ee,"watcher stop timeout")),this.reindexRunner=e.reindexRunner??pt(),this.subscriptionFactory=e.subscriptionFactory??ot,this.budgetInspector=e.budgetInspector??le,Pe.set(this,{gitReader:e.gitReader??ne,languages:Te(e.languages??e.config.languages),stagedIndexEntries:null,gitSignalPaths:null,lastGitSignal:null}),this.gitignoreFilter=ae(e.projectRoot),this.extraIgnore=Ze(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){if(this.stopInProgress)throw new Error("Cannot restart a watcher while its previous ownership is still draining.");this.stopped=!1,this.stopPromise=null,G(this).errors=[],this.sourcePollingFallbackStarted=!1,this.observationEpoch+=1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{this.startSourceWatcher()}catch(e){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(e)}`))}}stop(){if(this.stopPromise)return this.stopPromise;this.stopped=!0,this.stopInProgress=!0;let e=this.fsWatchers;this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearBudgetTimer(),this.clearGitPollTimer(),this.clearFileChangeWindow();let r=this.activeOperation;r&&this.setStatus({state:"draining",startedAt:this.wallNow(),reason:"waiting for the active reindex worker to exit"});let n=[...G(this).closures],i=tt(this),s=this.clock.now()+i;return this.stopPromise=this.finishStop(e,n,r,s,i).catch(a=>{throw this.stopInProgress=!1,a}),this.stopPromise}observation(){return{epoch:this.observationEpoch,changeSequence:this.changeSequence}}requestRefresh(e,r={}){if(!this.stopped){if(!r.immediate||this.reindexInFlight||this.status.state==="cooldown"||this.status.state==="budget-paused"){this.scheduleReindex(e);return}this.pendingTrigger=Se(this.pendingTrigger,e),this.changedFiles+=1,this.changeSequence+=1,this.clearDebounceTimer(),this.triggerReindex()}}startSourceWatcher(e=!1){let r=this.subscriptionFactory(this.projectRoot,{ignoreInitial:!0,ignored:(n,i)=>this.isIgnoredWatchPath(n,i?.isDirectory()??!1),usePolling:e,...e?{interval:500,binaryInterval:1e3}:{}});r.on("all",(n,i)=>{!this.stopped&&n!=="addDir"&&n!=="unlinkDir"&&this.handleFileChange(i)}),r.on("error",n=>this.handleSourceWatcherError(r,n,e)),this.fsWatchers.push(r)}handleSourceWatcherError(e,r,n){if(n||this.sourcePollingFallbackStarted||!ht(r)||this.stopped){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(r)}`));return}this.observationEpoch+=1,this.sourcePollingFallbackStarted=!0,this.fsWatchers=this.fsWatchers.filter(i=>i!==e),rt(G(this),e,i=>this.onError(i));try{this.startSourceWatcher(!0)}catch(i){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(i)}`))}}isIgnoredWatchPath(e,r){let n=this.relativeWatchPath(e);if(!n)return!1;let i=r?`${n}/`:n;return i===".git/"||i.startsWith(".git/")?!0:this.gitignoreFilter.isIgnored(i)||this.extraIgnore.ignores(i)}handleFileChange(e){let r=this.relativeWatchPath(e);!r||r===".."||r.startsWith("../")||r===".git"||r.startsWith(".git/")||this.gitignoreFilter.isIgnored(r)||this.extraIgnore.ignores(r)||r.endsWith("index.db")||r.endsWith("index.scip")||r.endsWith("index.db.tmp")||He(r).startsWith(ce)||(r===".codebaseiq.json"&&Ce(this,this.projectRoot),we(this,r)&&(this.noteFileChange(r),this.scheduleReindex({kind:"watch-source",detail:r})))}noteFileChange(e){!this.onFileChanged&&!this.onBulkChange||(this.bulkChangePending||(this.pendingFileChanges.add(e),this.pendingFileChanges.size>at&&(this.pendingFileChanges.clear(),this.bulkChangePending=!0)),this.fileChangeTimer??=this.clock.setTimeout(()=>this.flushFileChangeWindow(),st))}flushFileChangeWindow(){if(this.fileChangeTimer=null,this.stopped)return;let e=[...this.pendingFileChanges],r=this.bulkChangePending;this.pendingFileChanges.clear(),this.bulkChangePending=!1;try{r?this.onBulkChange?.():this.onFileChanged?.(e)}catch{}}clearFileChangeWindow(){this.fileChangeTimer&&(this.clock.clearTimeout(this.fileChangeTimer),this.fileChangeTimer=null),this.pendingFileChanges.clear(),this.bulkChangePending=!1}relativeWatchPath(e){let r=ze(e)?e:L(this.projectRoot,e);return Xe(this.projectRoot,r).replaceAll("\\","/")}scheduleReindex(e){if(this.pendingTrigger=Se(this.pendingTrigger,e),this.changedFiles++,this.changeSequence+=1,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}if(this.status.state==="budget-paused"){this.dirty=!0,this.setStatus({...this.status,dirty:!0});return}this.clearDebounceTimer();let r=this.wallNow()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:r}),this.debounceTimer=this.clock.setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let e=this.inspectBudget();if(e.state==="paused"){this.dirty=!0;let a=Math.max(this.wallNow()+1,e.until);this.setStatus({state:"budget-paused",until:a,dirty:!0,reason:e.detail,rebuilt:e.rebuilt,estimatedWriteBytes:e.estimatedWriteBytes}),this.clearBudgetTimer(),this.budgetTimer=this.clock.setTimeout(()=>{this.budgetTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},Math.min(2147483647,Math.max(1,a-this.wallNow())));return}let r=this.clock.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&r<this.watchConfig.cooldownMs){let a=this.watchConfig.cooldownMs-r;this.dirty=!0;let o=this.wallNow()+a;this.setStatus({state:"cooldown",until:o,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},a);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let n=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let i=this.wallNow();this.setStatus({state:"indexing",startedAt:i});let s=this.reindexRunner.start(this.reindexRequest(n));this.activeOperation=s,s.completion.then(a=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let o=!1;try{o=this.onReindexComplete(a,n)===!0}catch(l){this.onError(l instanceof Error?l:new Error(String(l)))}if(this.dirty&&!this.stopped){if(o){let c=this.pendingTrigger??{kind:"unknown"};this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.onRefreshSuppressed(c),this.setStatus({state:"idle"});return}let l=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:l,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(a=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let o=a instanceof Error?a:new Error(String(a));this.onReindexError(o,n),this.onError(o),this.setStatus({state:"idle"})}).finally(()=>{this.activeOperation===s&&(this.activeOperation=null)})}async finishStop(e,r,n,i,s){let a=[],o=e.map(async p=>{try{await p.close()}catch(m){a.push(`watch subscription close failed: ${String(m)}`)}});o.push(...r),n&&o.push((async()=>{try{let p=await n.cancel();p.state==="degraded"&&a.push(p.reason)}catch(p){a.push(`reindex cancellation failed: ${p instanceof Error?p.message:String(p)}`)}})());let l=o.length,c=o.map(p=>p.finally(()=>{l-=1})),u=await et(c,i,this.clock),d=G(this);return a.push(...d.errors),d.errors=[],u?this.stopInProgress=!1:(a.push(`watch shutdown exceeded the ${s}ms deadline with ${l} operation(s) still pending`),Promise.all(c).then(()=>{this.stopInProgress=!1})),a.length>0?(this.setStatus({state:"draining",startedAt:this.wallNow(),reason:a.join("; ")}),{state:"degraded",reasons:a}):(this.setStatus({state:"idle"}),{state:"stopped"})}wallNow(){return this.clock.wallNow?.()??this.clock.now()}inspectBudget(){try{return this.budgetInspector(this.outputDb,this.watchConfig.resourceBudget,new Date(this.wallNow()))}catch(e){return{state:"paused",reason:"activity-evidence",until:this.wallNow()+this.watchConfig.resourceBudget.windowMs,rebuilt:0,estimatedWriteBytes:0,detail:`reindex activity evidence could not be read: ${e instanceof Error?e.message:String(e)}`}}}reindexRequest(e){return{projectRoot:this.projectRoot,config:this.config,languages:this.languages,pnpmWorkspaces:this.pnpmWorkspaces,typescriptProjectMode:this.typescriptProjectMode,typescriptProjects:this.typescriptProjects,clojureConfigPath:this.clojureConfigPath,indexerConcurrency:this.indexerConcurrency,trigger:e}}setStatus(e){this.status=e,this.onStatus(e)}clearDebounceTimer(){this.debounceTimer&&(this.clock.clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(this.clock.clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}clearBudgetTimer(){this.budgetTimer&&(this.clock.clearTimeout(this.budgetTimer),this.budgetTimer=null)}startGitStatePolling(){if(this.lastGitState=this.readGitState(),!this.lastGitState)return;let e=y(this);e.gitSignalPaths=this.resolveGitSignalPaths(),e.lastGitSignal=this.gitActivitySignal(),e.stagedIndexEntries=xe(this.projectRoot,e.gitReader),this.gitPollTimer=this.clock.setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.()}resolveGitSignalPaths(){let e=y(this).gitReader,r=T(this.projectRoot,["rev-parse","--git-dir"],e),n=T(this.projectRoot,["rev-parse","--git-common-dir"],e);if(!r)return null;let i=_(this.projectRoot,r),s=n?_(this.projectRoot,n):i,a=this.lastGitState?.indexPath;return[L(i,"HEAD"),L(s,"packed-refs"),L(s,"refs","heads"),...a?[a]:[]]}gitActivitySignal(){let e=y(this).gitSignalPaths;if(!e)return null;let r="";for(let n of e)try{let i=ye(n);r+=`${n}:${i.mtimeMs}:${i.size};`}catch{r+=`${n}:absent;`}return r}pollGitState(){let e=this.gitActivitySignal();if(e!==null){if(e===y(this).lastGitSignal)return;y(this).lastGitSignal=e}let r=this.lastGitState,n=this.readGitState();if(!r||!n||this.stopped){this.lastGitState=n;return}this.lastGitState=n;let i=r.head!==n.head,s=r.indexPath!==n.indexPath||r.indexMtimeMs!==n.indexMtimeMs||r.indexSize!==n.indexSize;if(!i&&!s)return;let a=y(this),o=a.stagedIndexEntries,l=xe(this.projectRoot,a.gitReader);a.stagedIndexEntries=l;let c=ft(this.projectRoot,a.gitReader,r,n,o,l,i,s),u=null;c!==null&&(c.includes(".codebaseiq.json")&&Ce(this,this.projectRoot),u=c.filter(d=>we(this,d)),u.length===0)||(i&&s?this.scheduleReindex({kind:"watch-git-state",detail:F("HEAD and index changed",u)}):i?this.scheduleReindex({kind:"watch-git-head",detail:F("HEAD changed",u)}):s&&this.scheduleReindex({kind:"watch-git-index",detail:F(n.indexPath??"index changed",u)}))}readGitState(){let e=y(this).gitReader,r=T(this.projectRoot,["rev-parse","--git-path","index"],e);if(!r)return null;let n=_(this.projectRoot,r),i={head:T(this.projectRoot,["rev-parse","--verify","HEAD"],e),indexPath:n};try{let s=ye(n);i.indexMtimeMs=s.mtimeMs,i.indexSize=s.size}catch{i.indexMtimeMs=void 0,i.indexSize=void 0}return i}clearGitPollTimer(){this.gitPollTimer&&(this.clock.clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};async function et(t,e,r){if(t.length===0)return!0;let n=Promise.all(t).then(()=>!0),i=Math.max(0,e-r.now()),s=null,a=new Promise(l=>{s=r.setTimeout(()=>l(!1),i)}),o=await Promise.race([n,a]);return o&&s&&r.clearTimeout(s),o}var ve=new WeakMap,Ie=new WeakMap,Pe=new WeakMap;function G(t){let e=ve.get(t);if(e)return e;let r={closures:new Set,errors:[]};return ve.set(t,r),r}function tt(t){return Ie.get(t)??Ee}function y(t){let e=Pe.get(t);if(!e)throw new Error("Watcher input state was not initialized.");return e}function rt(t,e,r){let n=Promise.resolve().then(()=>e.close()).catch(i=>{let s=`watch subscription close failed during polling fallback: ${String(i)}`;t.errors.push(s),r(new Error(s))});t.closures.add(n),n.then(()=>t.closures.delete(n))}function nt(t,e=Y){let{projectRoot:r,config:n,languages:i,pnpmWorkspaces:s,typescriptProjectMode:a,typescriptProjects:o,clojureConfigPath:l,indexerConcurrency:c,trigger:u}=t,d=N(r),p=Object.keys(d).length>0?d:n,m=re(r,p),f=p.indexer?.typescript,g=p.indexer?.clojure,I=e(process.pid);if(!I)throw new Error(`Could not establish watcher process identity for reindex worker ownership (pid ${process.pid}).`);return{workerPath:Je(new URL("./reindex-worker.js",import.meta.url)),env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:r,SCIP_REINDEX_OUTPUT_SCIP:m.indexPath,SCIP_REINDEX_OUTPUT_DB:m.dbPath,SCIP_REINDEX_LANGUAGES:(p.languages??i)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(p.indexerConcurrency??c??""),SCIP_REINDEX_PNPM_WORKSPACES:f?.pnpmWorkspaces??s?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:f?.projectMode??a,projects:f?.projects??o??[]}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:g?.configPath??l??"",SCIP_REINDEX_TRIGGER_KIND:u.kind,SCIP_REINDEX_TRIGGER_DETAIL:u.detail??"",SCIP_REINDEX_PROCESS_GROUP_LEADER:"1",SCIP_REINDEX_PARENT_IDENTITY:JSON.stringify(I)}}}var it={now:J,wallNow:()=>Date.now(),setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},ot=(t,e)=>Ke(t,e),st=120,at=200,ct=15*6e4,lt=1e3,dt=64*1024;function ut(){return{stdoutTail:"",stderrTail:"",stdoutTruncated:!1,stderrTruncated:!1}}function be(t,e){let r=t instanceof Error?t.message:String(t),n=e.stderrTail.trim()||e.stdoutTail.trim();return n?`${r}
2
- ${n}`:r}function pt(t={}){let e=t.timeoutMs??ct,r=t.terminationGraceMs??lt,n=t.maxOutputBytes??dt,i=t.resolveLaunch??nt;return{start(s){let a=i(s),o=new AbortController,l=ut(),c=!1,u=z({command:process.execPath,args:[...process.execArgv,a.workerPath],label:"watch reindex worker",env:a.env,timeoutMs:e,terminationGraceMs:r,maxStdoutBytes:n,maxStderrBytes:n,outputLimitBehavior:"truncate-tail",signal:o.signal,detached:!0}).then(d=>{if(l={stdoutTail:d.stdout,stderrTail:d.stderr,stdoutTruncated:d.stdoutTruncated,stderrTruncated:d.stderrTruncated},d.status!==0)throw new Error(be(new Error(`Reindex worker exited with ${d.signal?`signal ${d.signal}`:`code ${d.status}`}`),l));return d.durationMs}).catch(d=>{throw d instanceof H&&(l={stdoutTail:d.stdout,stderrTail:d.stderr,stdoutTruncated:d.stdoutTruncated,stderrTruncated:d.stderrTruncated}),new Error(be(d,l),{cause:d})}).finally(()=>{c=!0});return{completion:u,async cancel(){c||o.abort();try{await u}catch{}return{state:"exited",diagnostics:l}},diagnostics:()=>l}}}}function Se(t,e){return t?t.kind===e.kind?t.detail===e.detail?t:{kind:t.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${t.kind}, ${e.kind}`}:e}function ht(t){return t instanceof Error&&"code"in t&&t.code==="EMFILE"||String(t).includes("EMFILE: too many open files")}function gt(t,e){if(!Number.isSafeInteger(t)||t<=0)throw new Error(`${e} must be a positive integer.`);return t}function Te(t){return t&&t.length>0?[...t]:j}function Ce(t,e){try{y(t).languages=Te(N(e).languages)}catch{y(t).languages=j}}function we(t,e){return X(e,y(t).languages)!=="other"}function ft(t,e,r,n,i,s,a,o){let l=new Set;if(a){if(!r.head||!n.head)return null;let c=e.runResult(t,["diff","--name-only","-z","--no-renames","--relative",r.head,n.head,"--"]);if(c.kind!=="success")return null;for(let u of mt(c.output))l.add(u)}if(o){if(i===null||s===null)return null;for(let c of Rt(i,s))l.add(c)}return[...l].sort()}function xe(t,e){let r=e.runResult(t,["diff","--cached","--raw","-z","--no-renames","--relative","--"]);return r.kind==="success"?yt(r.output):null}function mt(t){return t.split("\0").filter(e=>e.length>0)}function yt(t){let e=t.split("\0");if(e.at(-1)===""&&e.pop(),e.length%2!==0)return null;let r=new Map;for(let n=0;n<e.length;n+=2){let i=e[n],s=e[n+1];if(!i.startsWith(":")||!s)return null;r.set(s,i)}return r}function Rt(t,e){return[...new Set([...t.keys(),...e.keys()])].filter(n=>t.get(n)!==e.get(n))}function F(t,e){return e===null?`${t}; changed paths unavailable`:e.length===0?t:e.length===1?e[0]:`${e.length} compiler inputs changed`}import{existsSync as E,lstatSync as b,readdirSync as Ae,realpathSync as ke,rmSync as v,statSync as _e}from"fs";import{join as h,resolve as A,sep as We}from"path";var vt=3600*1e3,bt=2*1024*1024*1024,B=300*1e3,St="gc-state.json",Ct="gc.lock",wt="projects-gc-state.json",xt="projects-gc.lock",Et=1440*60*1e3;function It(t){let e=t.leases.filter(o=>o.managed&&!o.live&&!o.busy),r=Ge(t.leases,t.locks),n={};for(let o of t.generations)r.has(o.generationId)||(n[o.generationId]=o.unreferencedAt??t.nowMs);let i=t.generations.filter(o=>!r.has(o.generationId)).sort((o,l)=>n[o.generationId]-n[l.generationId]||o.generationId.localeCompare(l.generationId)),s=new Set;for(let o of i)t.nowMs-n[o.generationId]>=t.policy.generationTtlMs&&s.add(o.generationId);let a=t.generations.filter(o=>!s.has(o.generationId)).reduce((o,l)=>o+l.size,0);for(let o of i){if(a<=t.policy.budgetBytes)break;s.has(o.generationId)||(s.add(o.generationId),a-=o.size)}for(let o of s)delete n[o];return{deleteWorktrees:e,deleteGenerations:t.generations.filter(o=>s.has(o.generationId)),deleteLocks:t.locks.filter(o=>!o.live),deleteTemporaries:t.temporaries.filter(o=>!o.live),protectedGenerationIds:[...r].sort(),unreferencedSince:n}}function Ge(t,e){let r=new Set(t.filter(n=>n.managed&&(n.live||n.busy)).flatMap(n=>[n.lease.baseGenerationId,n.lease.activeGenerationId]).filter(n=>n!==void 0));for(let n of e)n.live&&r.add(n.generationId);return r}function lr(t,e,r={}){if(!te())return{kind:"disabled"};let n=O(t);if(!n)return{kind:"unavailable"};let i=h(R(),"repositories",n.repositoryId),s=(r.now??Date.now)(),a=E(i)?je(t,i,n.repositoryId,e,s,r):{kind:"unavailable"};return kt(t,n.repositoryId,e,s,r),Pt(s,r),a}function Pt(t,e){let r=h(R(),"projects"),n={examined:0,reclaimed:0};if(!E(r))return n;let i=h(r,wt),s=Ne(i);if(!e.force&&s!==void 0&&t-s<B)return n;let a=k(h(r,xt));if(!a)return n;try{for(let o of x(r)){let l=h(r,o),c;try{c=b(l)}catch{continue}if(!(!c.isDirectory()||c.isSymbolicLink())&&(n.examined+=1,!!Tt(l,t)))try{v(l,{recursive:!0,force:!0}),n.reclaimed+=1}catch{}}W(i,{version:1,lastSweepAt:new Date(t).toISOString()},{spacing:2,trailingNewline:!0})}finally{a.release()}return n}function Tt(t,e){let r=h(t,K),n;try{let a=JSON.parse(C(r,"cache-ownership"));if(typeof a.canonicalProjectRoot!="string"||a.canonicalProjectRoot.length===0)return!1;n=a.canonicalProjectRoot}catch{return!1}if(E(n))return!1;try{if(e-b(t).mtimeMs<Et)return!1}catch{return!1}let i=he(D(t).statePath);if(i&&w(i.pid))return!1;let s=k(h(t,"cache-lifecycle.lock"));return s===null?!1:(s.release(),!0)}function je(t,e,r,n,i,s){let a=h(e,"gc-state.json"),o=De(a);if(!s.force&&o&&i-Date.parse(o.lastSweepAt)<B)return{kind:"throttled",sweptAt:o.lastSweepAt};let l=oe(e,{now:()=>i});if(!l)return{kind:"busy"};try{let c=Oe(t,e,r,o?.unreferencedSince??{}),u=It({nowMs:i,...c,policy:{generationTtlMs:s.policy?.generationTtlMs??vt,budgetBytes:s.policy?.budgetBytes??bt}}),d=0,p=0;for(let g of u.deleteWorktrees){if(!Q(g.lease))continue;if(!E(g.lease.localCacheDir)){v(g.leasePath,{force:!0}),p+=1;continue}if(!At(g.lease))continue;let I=k(h(g.lease.localCacheDir,"cache-lifecycle.lock"));if(I)try{if($(g.lease,!0))continue;try{fe({projectRoot:g.lease.projectRoot,cacheDir:g.lease.localCacheDir,cliVersion:n})}catch{continue}if($(g.lease,!0))continue;v(g.lease.localCacheDir,{recursive:!0,force:!0}),v(g.leasePath,{force:!0}),p+=1}finally{I.release()}}for(let g of u.deleteLocks)v(g.path,{force:!0});for(let g of u.deleteTemporaries)v(g.path,{recursive:!0,force:!0});for(let g of u.deleteGenerations)v(g.path,{recursive:!0,force:!0}),d+=g.size;se(h(e,"evidence.db"));let m={kind:"swept",sweptAt:new Date(i).toISOString(),deletedWorktrees:p,deletedGenerations:u.deleteGenerations.length,deletedBytes:d,protectedGenerations:u.protectedGenerationIds.length},f={version:1,lastSweepAt:m.sweptAt,unreferencedSince:u.unreferencedSince,lastResult:m};return W(a,f,{spacing:2,trailingNewline:!0}),m}catch(c){return{kind:"failed",error:c instanceof Error?c.message:String(c)}}finally{l.release()}}function kt(t,e,r,n,i){let s=h(R(),"repositories");if(!E(s))return;let a=h(s,St),o=Ne(a);if(!i.force&&o!==void 0&&n-o<B)return;let l=k(h(s,Ct));if(l)try{for(let c of x(s)){if(c===e||!/^[a-f0-9]{24}$/.test(c))continue;let u=h(s,c),d;try{d=b(u)}catch{continue}if(!d.isDirectory()||d.isSymbolicLink())continue;let p=_t(u)??t;je(p,u,c,r,n,i)}W(a,{version:1,lastSweepAt:new Date(n).toISOString()},{spacing:2,trailingNewline:!0})}finally{l.release()}}function dr(t,e,r){let n=de(t,r.dbPath,e);if(n)return{state:"bypassed",reason:n,localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let i=O(t);if(!i)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let s=h(R(),"repositories",i.repositoryId),a=U(h(s,"worktrees",`${i.worktreeId}.json`)),o=De(h(s,"gc-state.json")),l=Oe(t,s,i.repositoryId,o?.unreferencedSince??{}),c=Ge(l.leases,l.locks),u=l.generations.filter(f=>!c.has(f.generationId)),d=l.generations.reduce((f,g)=>f+g.size,0),p=ue(t,e),m=0;return p&&(m=Lt(p)),{state:"managed",repositoryId:i.repositoryId,worktreeId:i.worktreeId,localCacheDir:r.cacheDir,...a?{baseGenerationId:a.baseGenerationId,activeGenerationId:a.activeGenerationId,lastAction:a.lastAction,reason:a.lastReason,lastSeenAt:a.lastSeenAt}:{},generations:l.generations.length,generationBytes:d,protectedGenerations:l.generations.filter(f=>c.has(f.generationId)).length,unreferencedGenerations:u.length,unreferencedBytes:u.reduce((f,g)=>f+g.size,0),temporaryGenerations:l.temporaries.length,sharedEvidence:{path:p,exists:m>0,bytes:m},cleanup:o?.lastResult}}function Lt(t){return[t,`${t}-wal`,`${t}-shm`].reduce((e,r)=>{try{return e+_e(r).size}catch{return e}},0)}function Oe(t,e,r,n){let i=new Set(ie(t).map(c=>A(c.path))),s=[];for(let c of x(h(e,"worktrees"))){if(!c.endsWith(".json"))continue;let u=h(e,"worktrees",c),d=U(u);if(!d)continue;let p=A(d.projectRoot);s.push({leasePath:u,lease:d,managed:d.repositoryId===r&&Q(d),live:i.has(p)||E(p),busy:$(d)})}let a=[];for(let c of x(h(e,"locks"))){let u=/^([a-f0-9]{64})\.lock$/.exec(c);if(!u)continue;let d=h(e,"locks",c),p=q(d),m=p!==void 0&&w(p),f=u[1];a.push({generationId:f,path:d,live:m})}let o=[],l=[];for(let c of x(h(e,"generations"))){let u=/^\.tmp-(\d+)-/.exec(c);if(u){let m=h(e,"generations",c),f=Number(u[1]);try{l.push({path:m,size:Le(m),live:Number.isSafeInteger(f)&&w(f)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(c))continue;let d=h(e,"generations",c),p;try{p=b(d)}catch{continue}!p.isDirectory()||p.isSymbolicLink()||o.push({generationId:c,path:d,size:Le(d),...n[c]===void 0?{}:{unreferencedAt:n[c]}})}return{leases:s,generations:o,locks:a,temporaries:l}}function Q(t){if(t.ownershipChecksum!==pe(t)||P(t.localCacheDir)!==P(ee(t.projectRoot)))return!1;let e=P(h(R(),"projects"));return P(t.localCacheDir).startsWith(`${e}${We}`)}function At(t){if(!Q(t))return!1;let e=A(R()),r=A(h(e,"projects")),n=A(t.localCacheDir);try{let i=b(e),s=b(r),a=b(n);if(!i.isDirectory()||i.isSymbolicLink()||!s.isDirectory()||s.isSymbolicLink()||!a.isDirectory()||a.isSymbolicLink())return!1;let o=ke(r);return ke(n).startsWith(`${o}${We}`)}catch{return!1}}function _t(t){for(let e of x(h(t,"worktrees"))){if(!e.endsWith(".json"))continue;let r=U(h(t,"worktrees",e));if(r)return r.projectRoot}}function $(t,e=!1){for(let n of e?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let i=q(h(t.localCacheDir,n));if(i!==void 0&&w(i))return!0}let r=q(D(t.localCacheDir).lockPath);return r!==void 0&&w(r)}function U(t){try{let e=JSON.parse(C(t,"worktree cache lease"));return e.version!==1||typeof e.repositoryId!="string"||typeof e.worktreeId!="string"||typeof e.projectRoot!="string"||e.treeOid!==void 0&&typeof e.treeOid!="string"||typeof e.localCacheDir!="string"||e.baseGenerationId!==void 0&&typeof e.baseGenerationId!="string"||e.activeGenerationId!==void 0&&typeof e.activeGenerationId!="string"||typeof e.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(e.ownershipChecksum)||typeof e.lastAction!="string"||e.lastReason!==void 0&&typeof e.lastReason!="string"||typeof e.lastSeenAt!="string"?null:e}catch{return null}}function q(t){try{let e=JSON.parse(C(t,"watch lock record"));return typeof e.pid=="number"&&Number.isSafeInteger(e.pid)&&e.pid>0?e.pid:void 0}catch{return}}function De(t){try{let e=JSON.parse(C(t,"repository cache GC state"));return e.version!==1||typeof e.lastSweepAt!="string"||!Number.isFinite(Date.parse(e.lastSweepAt))||!e.unreferencedSince||typeof e.unreferencedSince!="object"||!e.lastResult?null:e}catch{return null}}function Ne(t){try{let e=JSON.parse(C(t,"global repository cache GC state"));if(e.version!==1||typeof e.lastSweepAt!="string")return;let r=Date.parse(e.lastSweepAt);return Number.isFinite(r)?r:void 0}catch{return}}function x(t){try{return Ae(t)}catch{return[]}}function Le(t){let e=0,r=[t];for(;r.length>0;){let n=r.pop();for(let i of Ae(n,{withFileTypes:!0})){let s=h(n,i.name);i.isDirectory()?r.push(s):i.isFile()&&(e+=_e(s).size)}}return e}import{createHash as Me}from"crypto";import{tmpdir as Wt,userInfo as Gt}from"os";import{join as Fe}from"path";var S=1,mr=1*1024*1024,yr=64*1024*1024,Rr=12e4,vr=["NO_COLOR","FORCE_COLOR","CLICOLOR","CLICOLOR_FORCE","TERM","CODEBASEIQ_DEBUG"];function br(t){let e=$e(),r=Me("sha256").update(`${e}\0${t}`).digest("hex");return process.platform==="win32"?`\\\\.\\pipe\\codebaseiq-lane-${r.slice(0,32)}`:Fe(jt(),`lane-${r.slice(0,24)}.sock`)}function jt(){let t=$e(),e=Me("sha256").update(t).digest("hex").slice(0,16);return Fe(Wt(),`codebaseiq-${e}`)}function $e(){try{return Gt().username}catch{return`uid-${typeof process.getuid=="function"?process.getuid():"unknown"}`}}function Sr(t,e){let r=Buffer.from(JSON.stringify(t),"utf8");if(r.byteLength>e)throw new Error(`query-lane frame of ${r.byteLength} bytes exceeds the ${e}-byte limit`);let n=Buffer.allocUnsafe(4+r.byteLength);return n.writeUInt32LE(r.byteLength,0),r.copy(n,4),n}function Cr(t,e,r){let n=Buffer.alloc(0),i=!1,s=a=>{i||(i=!0,r(new Error(a)))};return{push(a){if(!i)for(n=n.byteLength===0?a:Buffer.concat([n,a]);n.byteLength>=4;){let o=n.readUInt32LE(0);if(o>t){s(`query-lane frame of ${o} bytes exceeds the ${t}-byte limit`);return}if(n.byteLength<4+o)return;let l=n.subarray(4,4+o);n=n.subarray(4+o);let c;try{c=JSON.parse(l.toString("utf8"))}catch{s("query-lane frame carried invalid JSON");return}if(e(c),i)return}}}}function wr(t){if(!t||typeof t!="object")return null;let e=t;return e.protocolVersion!==S||typeof e.projectRoot!="string"||e.projectRoot.length===0?null:e.kind==="ping"?{protocolVersion:S,kind:"ping",projectRoot:e.projectRoot}:e.kind!=="execute"||!Array.isArray(e.argv)||!e.argv.every(r=>typeof r=="string")||typeof e.cwd!="string"||e.deadlineMs!==void 0&&!Number.isFinite(e.deadlineMs)||e.envAllowlist!==void 0&&(typeof e.envAllowlist!="object"||e.envAllowlist===null||Array.isArray(e.envAllowlist)||!Object.values(e.envAllowlist).every(r=>typeof r=="string"))||e.tty!==void 0&&(typeof e.tty!="object"||e.tty===null||typeof e.tty.isTTY!="boolean"||e.tty.columns!==void 0&&!Number.isFinite(e.tty.columns))||e.clientInvocation!==void 0&&(typeof e.clientInvocation!="object"||e.clientInvocation===null||typeof e.clientInvocation.execPath!="string"||e.clientInvocation.execPath.length===0||e.clientInvocation.scriptPath!==void 0&&typeof e.clientInvocation.scriptPath!="string")?null:{...e,kind:"execute"}}function xr(t){if(!t||typeof t!="object")return null;let e=t;if(e.protocolVersion!==S)return null;if(e.ok===!1)return e.code!=="unsupported"&&e.code!=="invalid-request"&&e.code!=="wrong-project"&&e.code!=="busy"&&e.code!=="stale-index"&&e.code!=="ineligible-command"&&e.code!=="execution-error"||typeof e.message!="string"?null:{ok:!1,protocolVersion:S,code:e.code,message:e.message};if(e.ok!==!0)return null;if(e.kind==="accepted"){let n=e.serverPid;return typeof n!="number"||!Number.isInteger(n)||n<=0?null:{ok:!0,kind:"accepted",protocolVersion:S,serverPid:n}}if(e.kind==="executed"){let n=e;return typeof n.serverPid!="number"||!Number.isInteger(n.serverPid)||n.serverPid<=0||typeof n.exitCode!="number"||!Number.isInteger(n.exitCode)||typeof n.stdout!="string"||typeof n.stderr!="string"||typeof n.generation!="string"||!/^[a-f0-9]{64}$/.test(n.generation)||typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)?null:{ok:!0,kind:"executed",protocolVersion:S,serverPid:n.serverPid,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr,generation:n.generation,durationMs:n.durationMs}}if(e.kind!=="pong"||typeof e.serverPid!="number"||!Number.isInteger(e.serverPid)||e.serverPid<=0||typeof e.cliVersion!="string"||typeof e.projectRoot!="string"||e.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(e.indexGeneration))return null;let r;if(e.processIdentity!==void 0){let n=V(e.processIdentity);if(!n||n.pid!==e.serverPid)return null;r=n}return{ok:!0,kind:"pong",protocolVersion:S,serverPid:e.serverPid,...r?{processIdentity:r}:{},cliVersion:e.cliVersion,projectRoot:e.projectRoot,...e.indexGeneration!==void 0?{indexGeneration:e.indexGeneration}:{}}}var qe=[{question:"Who can call or reach this?",family:"execution",direction:"incoming"},{question:"What can this call or reach?",family:"execution",direction:"outgoing"},{question:"Where can this value come from?",family:"dataflow",direction:"incoming"},{question:"Where can this value go?",family:"dataflow",direction:"outgoing"},{question:"Which producer and consumer rendezvous?",family:"runtime",direction:"both"},{question:"What resource is observed or changed?",family:"state",direction:"both"},{question:"What occurs before or after this?",family:"temporal",direction:"both"},{question:"What interface constrains this?",family:"contract",direction:"both"},{question:"Are these observations the same entity?",family:"identity",direction:"both"},{question:"What contains or owns this?",family:"ownership",direction:"both"},{question:"What does this statically rely on?",family:"dependencies",direction:"outgoing"}],Be={execution:{establishes:"Static may-call reachability between resolved program constructs.",nonClaims:["A may-call edge does not prove that a runtime invocation occurred."]},runtime:{establishes:"A source-grounded handoff between producer and consumer participants through a runtime mechanism.",nonClaims:["An unresolved or candidate join does not prove a runtime handoff."]},dataflow:{establishes:"A value, definition, argument, parameter, return, or statically resolved value may flow to another construct.",nonClaims:["Current partial providers do not establish general interprocedural definition-use coverage."]},state:{establishes:"A construct reads, writes, creates, deletes, or otherwise changes an identified state resource.",nonClaims:["A state edge does not prove transactionality, durability, or exclusive ownership unless qualified."]},temporal:{establishes:"One observed construct is locally ordered before or after another under the reported source evidence.",nonClaims:["Source order does not imply cross-process happens-before or durability."]},contract:{establishes:"A program construct implements, constrains, or is typed by an identified contract.",nonClaims:["Contract identity does not prove runtime invocation or conformance outside reported checks."]},identity:{establishes:"Two observations refer to the same compiler-owned or source-owned program entity.",nonClaims:["Shared identity does not establish execution or value transfer."]},ownership:{establishes:"A source construct, symbol, runtime observation, or state resource is contained or owned by another program entity.",nonClaims:["Structural ownership does not establish lifetime, singleton scope, or runtime execution unless qualified."]},dependencies:{establishes:"A file, module, or symbol statically relies on another indexed entity.",nonClaims:["A dependency edge does not establish that the depended-on code executes."]}};function Qe(t){return M.flatMap(e=>e.relations.filter(r=>r.family===t).map(r=>({...r,providerId:e.id,providerLabel:e.label})))}function Ue(t){return[...new Set(M.filter(e=>e.relations.some(r=>r.family===t)).map(e=>e.label))]}var Tr=me.map(t=>({family:t,...Be[t],providers:Ue(t),relations:Qe(t)}));function Ve(t){return{family:t,...Be[t],providers:Ue(t),relations:Qe(t)}}var Ar=["search","outline","entrypoints","evidence","inspect","code"];function _r(){return qe.map(t=>{let e=Ve(t.family);return{...t,establishes:e.establishes,evidenceStrengths:Ye(e.relations.flatMap(r=>r.evidenceStrengths)),supportCeilings:Ye(e.relations.map(r=>r.supportCeiling)),nonClaim:e.nonClaims.join(" ")}})}function Ye(t){return[...new Set(t)]}export{Re as a,lr as b,dr as c,S as d,mr as e,yr as f,Rr as g,vr as h,br as i,Sr as j,Cr as k,wr as l,xr as m,Tr as n,Ar as o,_r as p};
3
- //# sourceMappingURL=chunk-36WRYYTE.js.map
@@ -1,2 +0,0 @@
1
- import{b as f,c as p}from"./chunk-6URCE5QY.js";import{execFileSync as y}from"child_process";import{platform as I}from"os";var b=1e3,T=2*1024*1024,M=25;function v(e,n,r=S){let t=r.readIdentity(e),o=new Map;return t&&o.set(e,t),{rootPid:e,rootIdentity:t,ownsProcessGroup:n,knownMembers:o}}async function k(e,n,r=S){if(!e.rootIdentity){let a=await l(e,n.gracefulMs+n.forceMs,r);return{reaped:a,reason:a?"terminated":"identity-unavailable",detail:a?void 0:`Could not establish the birth identity of process ${e.rootPid}.`}}let t=g(e,r);if(t==="mismatch")return{reaped:!1,reason:"identity-mismatch",detail:`Process ${e.rootPid} no longer has the identity owned by this runner.`};if(t==="exited"&&!h(e,r))return{reaped:!0,reason:"terminated"};if(r.platform==="win32"){try{r.terminateWindowsTree(e.rootPid)}catch(u){let c=await l(e,n.forceMs,r);return{reaped:c,reason:c?"terminated":"signal-failed",detail:c?void 0:m(u)}}let a=await l(e,n.forceMs,r);return{reaped:a,reason:a?"terminated":"deadline"}}let o=P(e,"SIGTERM",r);if(await l(e,n.gracefulMs,r))return{reaped:!0,reason:"terminated"};let s=P(e,"SIGKILL",r);return await l(e,n.forceMs,r)?{reaped:!0,reason:"terminated"}:s?{reaped:!1,reason:s.reason,detail:s.detail}:o?{reaped:!1,reason:o.reason,detail:o.detail}:{reaped:!1,reason:"deadline",detail:`Process tree ${e.rootPid} did not exit before its termination deadline.`}}function g(e,n){let r=n.readIdentity(e.rootPid);if(!r)return"exited";if(!e.rootIdentity||!f(e.rootIdentity,r))return"mismatch";e.knownMembers.set(e.rootPid,r);for(let t of n.listDescendantPids(e.rootPid)){let o=n.readIdentity(t);o&&e.knownMembers.set(t,o)}return"owned"}function P(e,n,r){let t=g(e,r);if(t==="mismatch")return{reason:"identity-mismatch",detail:`Process ${e.rootPid} changed identity before ${n}.`};if(t==="owned"&&e.ownsProcessGroup)try{return r.signal(-e.rootPid,n),null}catch(i){if(!w(i))return{reason:"signal-failed",detail:m(i)}}let o=null;for(let i of e.knownMembers.values()){let s=r.readIdentity(i.pid);if(!(!s||!f(i,s)))try{r.signal(i.pid,n)}catch(d){!w(d)&&o===null&&(o=m(d))}}return o===null?null:{reason:"signal-failed",detail:o}}async function l(e,n,r){let t=r.now()+n;for(;h(e,r);){if(r.now()>=t)return!1;await r.sleep(Math.min(M,Math.max(1,t-r.now())))}return!0}function h(e,n){if(!e.rootIdentity&&n.isProcessAlive(e.rootPid))return!0;for(let r of e.knownMembers.values()){let t=n.readIdentity(r.pid);if(t&&f(r,t))return!0}return!!(e.ownsProcessGroup&&n.isProcessGroupAlive(e.rootPid))}function R(e){let n=y("ps",["-axo","pid=,ppid="],{encoding:"utf8",timeout:b,maxBuffer:T,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0}),r=new Map;for(let s of n.split(/\r?\n/)){let d=/^\s*(\d+)\s+(\d+)\s*$/.exec(s);if(!d)continue;let a=Number(d[1]),u=Number(d[2]),c=r.get(u)??[];c.push(a),r.set(u,c)}let t=[],o=[...r.get(e)??[]],i=new Set;for(;o.length>0;){let s=o.pop();i.has(s)||(i.add(s),t.push(s),o.push(...r.get(s)??[]))}return t}function w(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ESRCH"}function m(e){return e instanceof Error?e.message:String(e)}var S={platform:I(),now:Date.now,readIdentity:p,isProcessAlive(e){try{return process.kill(e,0),!0}catch(n){return typeof n=="object"&&n!==null&&"code"in n&&n.code==="EPERM"}},isProcessGroupAlive(e){if(this.platform==="win32")return!1;try{return process.kill(-e,0),!0}catch(n){return typeof n=="object"&&n!==null&&"code"in n&&n.code==="EPERM"}},listDescendantPids(e){if(this.platform==="win32")return[];try{return R(e)}catch{return[]}},signal(e,n){process.kill(e,n)},terminateWindowsTree(e){y("taskkill.exe",["/PID",String(e),"/T","/F"],{timeout:b,maxBuffer:T,stdio:"ignore",windowsHide:!0})},async sleep(e){await new Promise(n=>setTimeout(n,e))}};export{v as a,k as b};
2
- //# sourceMappingURL=chunk-5IO2APSS.js.map
@@ -1,6 +0,0 @@
1
- import{b as t,d}from"./chunk-2Q2LW5JW.js";import{execFileSync as g}from"child_process";import{createRequire as v}from"module";import{existsSync as w}from"fs";import{platform as i,arch as f}from"os";var r="v0.8.1",c="https://github.com/sourcegraph/scip",s=`github.com/sourcegraph/scip/cmd/scip@${r}`,m=v(import.meta.url),h="CODEBASEIQ_SCIP_BIN";function x(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let n=e.env[h];if(n&&e.fileExists(n))return{source:"env",path:n};if(e.platform==="win32"){let o=e.resolveSidecar(e.arch);if(o&&e.fileExists(o))return{source:"sidecar",path:o}}return null}function S(e){for(let n of e==="arm64"?["arm64","x64"]:[e])try{return m.resolve(`codebaseiq-windows/scip-win32-${n}.exe`)}catch{}return null}function u(e=process.env){let n=x({platform:i(),arch:f(),env:e,isOnPath:t,fileExists:w,resolveSidecar:S});return n?.source==="path"?d("scip")??n.path:n?.path??null}function C(){return u()!==null}function b(){let e=u();if(!e)return null;try{return g(e,["--version"],{stdio:"pipe",windowsHide:!0,timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function y(){let e=i(),n=f(),o,l,a;switch(e){case"darwin":o="darwin",a="tar.gz";break;case"linux":o="linux",a="tar.gz";break;default:return null}switch(n){case"arm64":l="arm64";break;case"x64":l="amd64";break;default:return null}let p=`scip-${o}-${l}.${a}`;return{url:`${c}/releases/download/${r}/${p}`,filename:p}}function O(){let e=y();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),i()==="darwin"||i()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${s}
2
- `),console.log("Or download that exact release manually:");else if(i()==="win32"){let n=$();console.log("On Windows the scip binary ships via the npm sidecar package codebaseiq-windows,"),console.log("installed automatically with codebaseiq. If it is missing:"),console.log(` npm install -g ${n}`),console.log(`Or set ${h} to a local scip.exe path.
3
- `),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
4
- `:` ${c}/releases/tag/${r}
5
- `),console.log("After installing, ensure `scip` is on your PATH and run `codebaseiq reindex`.")}function $(){let n=m("../../package.json").optionalDependencies?.["codebaseiq-windows"];if(!n||!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(n))throw new Error("codebaseiq package metadata does not declare an exact Windows sidecar version.");return`codebaseiq-windows@${n}`}function k(e){if(t("go")){e(`Installing immutable ${s} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(g("go",["install",s],{stdio:"inherit",windowsHide:!0,timeout:3e5,env:process.env}),t("scip")){let n=u(),o=b();if(n&&o&&o.includes(r))return e(`Successfully installed ${s}; resolved executable: ${n}; reported version: ${o}.`),!0;e(`go install completed, but the resolved scip executable did not report ${r} (executable: ${n??"unresolved"}; version: ${o??"unavailable"}).`)}}catch(n){let o=n instanceof Error?n.message:String(n);e(`go install failed: ${o}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${c}/releases`),!1}export{u as a,C as b,O as c,k as d};
6
- //# sourceMappingURL=chunk-6OAHRI2D.js.map
@@ -1,2 +0,0 @@
1
- import{k as o}from"./chunk-4O52YNKL.js";var f=new Set(["aix","android","darwin","freebsd","haiku","linux","openbsd","sunos","win32","cygwin","netbsd"]);function l(r){if(!r||typeof r!="object"||Array.isArray(r))return null;let t=r;return t.version!==1||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.platform!="string"||!f.has(t.platform)||typeof t.startToken!="string"||t.startToken.trim()===""?null:{version:1,pid:t.pid,platform:t.platform,startToken:t.startToken}}function c(r,t){return r.version===t.version&&r.pid===t.pid&&r.platform===t.platform&&r.startToken===t.startToken}import{execFileSync as m}from"child_process";import{platform as d}from"os";var s=new WeakMap,u=1e3,i=16*1024;function g(r,t=P){if(!Number.isSafeInteger(r)||r<=0)return null;if(r===process.pid){let n=s.get(t);if(n)return n}try{let n=p(r,t);if(!n)return null;let e={version:1,pid:r,platform:t.platform,startToken:n};return r===process.pid&&s.set(t,e),e}catch{return null}}function p(r,t){if(t.platform==="linux"||t.platform==="android")return y(t.readFile(`/proc/${r}/stat`));if(t.platform==="win32"){let n=`([DateTimeOffset](Get-Process -Id ${r} -ErrorAction Stop).StartTime).ToUnixTimeMilliseconds()`;return a(t.run("powershell.exe",["-NoProfile","-NonInteractive","-Command",n]))}return t.platform==="darwin"||t.platform==="freebsd"||t.platform==="openbsd"||t.platform==="netbsd"?a(t.run("ps",["-p",String(r),"-o","lstart="])):null}function y(r){let t=r.lastIndexOf(")");if(t<0)return null;let e=r.slice(t+1).trim().split(/\s+/)[19];return e&&/^\d+$/.test(e)?e:null}function a(r){let t=r.trim();return t===""?null:t}var P={platform:d(),readFile(r){return o(r,{maxBytes:i,inputKind:"process identity pseudo-file"})},run(r,t){return m(r,[...t],{encoding:"utf8",timeout:u,maxBuffer:i,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0})}};function k(){return performance.now()}function w(){return Date.now()}export{l as a,c as b,g as c,k as d,w as e};
2
- //# sourceMappingURL=chunk-6URCE5QY.js.map
@@ -1,5 +0,0 @@
1
- import{a as R,b as _,c as Te,d as Fe,e as $,f as Le,k as ie,l as oe,m as Oe,o as Ge}from"./chunk-CANBLFVQ.js";import{a as W}from"./chunk-B2E3HZ2A.js";import{a as De}from"./chunk-RVYLJDXC.js";import{h as ke,k as se,t as qe,v as je}from"./chunk-PLZXWZHY.js";import{d as Ne,e as Ce}from"./chunk-IOVPAZWP.js";import{d as ae}from"./chunk-3LCDIREB.js";import{E as Ae,H as S,L as Ee,P as Be,Q as F,R as re,i as Ie,k as Me,o as Re,q as d,s as we,t as Pe,v as G,x as ve}from"./chunk-327YK6TB.js";function Mt(t,e){return t.reason instanceof Error?t.reason:new Error(e)}function ir(t,e){if(t?.aborted)throw Mt(t,e)}import{join as Rt}from"path";var wt=t=>{if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t.pid;return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?{pid:e}:null};function dr(t,e={}){return z(Rt(t,"gc.lock"),e)}function z(t,e={}){let n=e.waitMs??0,r=e.pollMs??10,i=e.now??$,o=i()+n;do{let s=Pt(t);if(s)return vt(s);let a=o-i();if(a<=0)return null;At(Math.min(r,a))}while(i()<=o);return null}function Pt(t){let e=Le(t,{kind:"generic",parseLegacy:wt});return e.kind==="acquired"?e.lock:null}function vt(t){return{release:()=>{t.release()}}}function At(t){let e=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(e,0,0,t)}function _e(t,e,n={}){ie(t,$e(e,n),{durability:"visibility",runtime:n.runtime})}function pr(t,e,n={}){return ie(t,$e(e,n),{durability:"durable",runtime:n.runtime})}function $e(t,e){let n=JSON.stringify(t,null,e.spacing);return e.trailingNewline?`${n}
2
- `:n}import{execFileSync as ze}from"child_process";import{createHash as Et}from"crypto";import{existsSync as J,statSync as Tt}from"fs";import{createRequire as Ft}from"module";import{platform as Lt}from"os";import{dirname as We,join as L}from"path";var Bt=Ft(import.meta.url),Rr={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function ce(t){return[t.indexerBinary,...t.binaryAliases??[]]}function kt(t){let e=ce(t);return e.length===1?e[0]:e.join(" or ")}function de(t){for(let e of ce(t)){let n=Ge(e);if(n)return n}return qt(t)}function wr(t){return de(t)!==null||Dt(t)}function Dt(t){return Je(t)!==null}function qt(t){let e=Je(t);if(!e)return null;let r=JSON.parse(S(e,"indexer package manifest")).bin;if(!r)return null;if(typeof r=="string")return L(We(e),r);for(let i of ce(t)){let o=r[i];if(o)return L(We(e),o)}return null}function Je(t){if(!t.bundledNpmPackage)return null;try{return Bt.resolve(`${t.bundledNpmPackage}/package.json`)}catch{return null}}function jt(t,e){for(let n of t.projectLocalBinaries??[]){let r=L(e,n);if(J(r))return r}return null}function Nt(t,e){for(let n of t.projectLocalBinaries??[]){let r=L(e,n);if(J(r))return He(e,n,r)}return null}function Pr(t,e){let n=Ct(t,e);if(!n||n.canonicalPath!==e.canonicalPath||n.sha256!==e.sha256||n.size!==e.size||n.mtimeMs!==e.mtimeMs||n.device!==e.device||n.inode!==e.inode||n.executable!==e.executable)throw new Error(`refusing changed project-local indexer ${e.relativePath}; review the current file and rerun with --trust-project-tools`)}function Ct(t,e){try{return He(t,e.relativePath,e.configuredPath)}catch{return null}}function He(t,e,n){let r={maxBytes:268435456,inputKind:"project-local indexer"},i=Ne(t,e,r),o=Ce(t,e,r),s=Tt(i.absolutePath);return{configuredPath:n,canonicalPath:i.absolutePath,relativePath:e,sha256:Et("sha256").update(o).digest("hex"),size:i.size,mtimeMs:i.mtimeMs,device:i.device,inode:i.inode,executable:(s.mode&73)!==0}}function Ot(t,e,n={}){return(n.trustProjectTools?Nt(t,e)?.canonicalPath:null)??de(t)}function vr(t,e=process.env,n=t.indexerBinary){if(t.indexerBinary!=="scip-dotnet"||le(n,e))return e;let r=Ue(n,e);return r?{...e,DOTNET_ROOT:r}:e}function Ar(t,e,n={}){let r=kt(t),i=e?Ot(t,e,n):de(t);if(!i)return{language:t.language,binaryLabel:r,installed:!1,runnable:!1,resolvedBinary:null,installUrl:t.installUrl,...e&&jt(t,e)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(t.indexerBinary!=="scip-dotnet")return{language:t.language,binaryLabel:r,installed:!0,runnable:!0,resolvedBinary:i};let o=Gt(i);return{language:t.language,binaryLabel:r,installed:!0,runnable:o.runnable,resolvedBinary:i,installUrl:t.installUrl,note:o.note}}function Gt(t){if(le(t,process.env))return{runnable:!0};let e=Ue(t,process.env);if(e)return{runnable:!0,note:`using .NET 9 runtime from ${e}`};let n=Ve(process.env);return{runnable:!1,note:n.length>0?`.NET 9 runtime still unavailable after checking ${n.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function Ue(t,e){for(let n of Ve(e))if(le(t,{...e,DOTNET_ROOT:n}))return n;return null}function Ve(t){let e=[],n=t.DOTNET_ROOT;if(n&&J(n)&&e.push(n),Lt()==="darwin"&&Oe("brew"))try{let r=ze("brew",["--prefix","dotnet@9"],{stdio:"pipe",windowsHide:!0,env:t,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),i=L(r,"libexec");J(i)&&!e.includes(i)&&e.push(i)}catch{}return e}function le(t,e){try{return ze(t,["--version"],{stdio:"pipe",windowsHide:!0,env:e,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var _t=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function H(t){let e=t.toLowerCase();return _t.some(n=>e.endsWith(n))}function V(t){let e=U(t.projectFiles),n=new Set(e),r=new Map(t.snapshot.files.map(c=>[c.path,c])),i=t.snapshot.files.filter(c=>{let m=Ie(c.path,["typescript"]);return m==="config"||m==="ambient"}).map(c=>c.path),o=U([...e,...i]),s=o.find(c=>!r.has(c)),a=new Set(t.snapshot.files.map(c=>c.path)).size!==t.snapshot.files.length,l=!s&&o.some(c=>Qe(r.get(c))),p=se(JSON.stringify({pnpmWorkspaces:t.snapshot.pnpmWorkspaces,typescriptProjectMode:t.snapshot.typescriptProjectMode,typescriptProjects:U(t.snapshot.typescriptProjects),membership:e})),u=new Map;return{identityFor(c,m){if(!n.has(c))return w("target-outside-project");if(a)return w("duplicate-input-path");if(s)return w("missing-input-fingerprint");if(l)return w("unreadable-input");let g=[],f,I;if(t.graph===null)g.push("dependency-graph-unavailable"),I="whole-project",f=o;else{let O=Wt(c,t.graph,u);if(O.find(ne=>!r.has(ne)))return w("missing-input-fingerprint");if(f=U([...O,...i]),f.some(ne=>Qe(r.get(ne))))return w("unreadable-input");I="dependency-closure"}let C=f.map(O=>zt(r.get(O)));return{version:1,key:se(JSON.stringify({version:1,engineIdentity:t.engineIdentity,schemaVersion:m,projectIdentity:p,inputs:C})),mode:I,inputFiles:f,reasons:g}}}}function $t(t,e){let n=new Set,r=[t];for(let i=0;i<r.length;i+=1){let o=r[i];if(!(o===void 0||n.has(o))){n.add(o);for(let s of[...e.get(o)??[]].sort())n.has(s)||r.push(s)}}return[...n].sort()}function Wt(t,e,n){let r=n.get(t);if(r)return r;let i=$t(t,e);return n.set(t,i),i}function zt(t){return{path:t.path,size:t.size,hash:t.hash}}function Qe(t){return t.size<0||t.hash==="unreadable"}function w(t){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[t]}}function U(t){return[...new Set(t)].sort()}import{createRequire as Jt}from"module";var Ke=Jt(import.meta.url),B,Q;function Ht(){if(B!==void 0)return B;try{B=Ke("ts-morph")}catch{B=null}return B}function K(){if(Q)return Q;let t=Ht();if(!t)return"ts-morph:unavailable";let e="unknown";try{e=Ke("ts-morph/package.json").version??"unknown"}catch{}return Q=`ts-morph:${e}:typescript:${t.ts.version}`,Q}function Dr(t,e){return e.map(n=>({tsconfigPath:n,project:new t.Project({tsConfigFilePath:n,skipFileDependencyResolution:!0})}))}function qr(t,e,n){return{language:"typescript",availability:()=>({available:!1,reason:t,tsconfigPath:e,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var Ut=ke("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function ue(t,e,n){let r=Ut.get(t,()=>Vt(t));if(!r)return null;let i=`${n}\0${e}`,o=r.identities.get(i);if(o)return o;let s=r.builder.identityFor(e,n);return r.identities.set(i,s),s}function k(t){return De(t,{includeIgnored:!1}).filter(H).sort()}function Vt(t){try{if(!t.generation.metadataRaw)return null;let e=G(t.generation.metadataRaw);if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.usableForEvidenceCache)return null;let n=Me(e.metadata.fingerprint);return n?{builder:V({projectFiles:k(t),snapshot:n,graph:W(t),engineIdentity:K()}),identities:new Map}:null}catch{return null}}function X(t,e){let n=new Map(t.map(i=>[i.symbol,i])),r=new Map(t.map(i=>[i.symbolId,[]]));for(let i of e.values())for(let o of i){let s=n.get(o.targetSymbol);s&&r.get(s.symbolId).push(o.location)}for(let[i,o]of r)r.set(i,Qt(o));return r}function Ze(t,e,n){let r=Ye(t,e),i=Ye(t,n),o=[...r].filter(c=>!i.has(c)).sort(),s=[...i].filter(c=>!r.has(c)).sort(),a=Xe(t,e),l=Xe(t,n),p=[...a].filter(c=>!l.has(c)).sort(),u=[...l].filter(c=>!a.has(c)).sort();return{passed:o.length===0&&s.length===0,expectedCount:r.size,actualCount:i.size,missing:o,extra:s,callerFiles:{passed:p.length===0&&u.length===0,expectedCount:a.size,actualCount:l.size,missing:p,extra:u}}}function Xe(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])i.file!==r.relativePath&&n.add(`${r.symbol}\0${i.file}`);return n}function Hr(t,e,n){let r=new Set(n),i=new Map(n.map(o=>[o,[]]));for(let o of t)for(let s of e.get(o.symbolId)??[])r.has(s.file)&&i.get(s.file).push({targetSymbol:o.symbol,location:s});for(let[o,s]of i)i.set(o,Kt(s));return i}function Ye(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])n.add(`${r.symbol}\0${i.file}\0${i.line}\0${i.column}`);return n}function Qt(t){let e=new Map;for(let n of t)e.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...e.values()].sort(et)}function Kt(t){let e=new Map;for(let n of t){let{location:r}=n;e.set(`${n.targetSymbol}\0${r.file}\0${r.line}\0${r.column}`,n)}return[...e.values()].sort((n,r)=>n.targetSymbol.localeCompare(r.targetSymbol)||et(n.location,r.location))}function et(t,e){return t.file.localeCompare(e.file)||t.line-e.line||t.column-e.column}var pe="typescript-reference-fragment-v3-incomplete-scan",Y=qe({kind:"typescript-reference-fragments",invalidation:je("typescript-reference-fragments"),serialize:t=>JSON.stringify(t),deserialize:Yt});function ni(t,e,n,r=t){let i=k(t),o=V({projectFiles:i,snapshot:e,graph:W(t),engineIdentity:K()}),s=[...n].map(([a,l])=>({relativePath:a,contentHash:o.identityFor(a,pe).key,value:[...l]}));if(s.some(a=>a.contentHash===null))throw new Error("TypeScript reference fragment identity is unavailable for an affected document.");return Y.writeBatch(r,s.map(a=>({...a,contentHash:a.contentHash}))),s.length}function ri(t,e,n,r){let i=e.filter(s=>H(s.relativePath));if(i.length===0)return D("no TypeScript definitions");let o=D("shadow did not run");return ae("typescript.reference-fragments.shadow",()=>{try{let s=r(i[0].relativePath);if(!s.availability().available||!s.referenceFragmentsForFiles)return o=D("TypeScript reference fragment provider is unavailable"),o;let a=k(t),l=new Set(a),p=s.referenceFragmentsForFiles(a),u=a.filter(f=>!p.has(f));if(u.length>0)return o=D(`TypeScript reference lookup was incomplete for ${u.length} file(s)`),o;let c=X(i,p),m=Ze(i,Xt(n,l),c);if(!m.passed)return o={state:"failing",files:a.length,keyedFiles:0,writtenFiles:0,...m},o;let g=[];for(let f of a){let I=ue(t,f,pe);I?.key&&g.push({relativePath:f,contentHash:I.key,value:p.get(f)??[]})}return Y.writeBatch(t,g),o={state:"passing",files:a.length,keyedFiles:g.length,writtenFiles:g.length,...m},o}catch(s){return o=D(s instanceof Error?s.message:String(s)),o}},()=>({...o}))}function Xt(t,e){return new Map([...t].map(([n,r])=>[n,r.filter(i=>e.has(i.file))]))}function ii(t,e,n){if(e.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,s=0,a=0;return ae("typescript.reference-fragments.materialize",()=>{try{let l=k(t);i=l.length;let p=new Map,u=new Map,c=[];for(let f of l){let I=ue(t,f,pe);if(!I?.key)return null;p.set(f,I.key);let C=Y.read(t,f,I.key);C===null?(s+=1,c.push(f)):(o+=1,u.set(f,C))}if(s===0)return r="hit",{references:X(e,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a};let m=n(e[0].relativePath);if(!m.availability().available||!m.referenceFragmentsForFiles)return null;let g=m.referenceFragmentsForFiles(c);if(c.some(f=>!g.has(f)))return null;a=g.size,Y.writeBatch(t,c.map(f=>({relativePath:f,contentHash:p.get(f),value:g.get(f)??[]})));for(let[f,I]of g)u.set(f,I);return r="computed",{references:X(e,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a}}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:s,computedFiles:a}))}function D(t){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:t}}function Yt(t){try{let e=JSON.parse(t);return!Array.isArray(e)||!e.every(Zt)?null:e}catch{return null}}function Zt(t){if(!t||typeof t!="object")return!1;let e=t,n=e.location;return typeof e.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}import{createHash as en,randomUUID as tn}from"crypto";import{existsSync as P,mkdirSync as nn,readdirSync as rn,rmSync as nt,statSync as rt}from"fs";import{basename as on,dirname as Z,join as x}from"path";var sn=1,an=1,cn=".codebaseiq-generations",dn="manifest.json",it="readers",ln="gc.lock",un=128,q=new Map,ot={pid:process.pid,now:()=>new Date,randomToken:()=>tn(),isProcessAlive:Fe,readProcessIdentity:Te,resolveImmutableGeneration:ct};function v(t){return x(Z(t),cn)}function st(t){return x(v(t),ln)}function gi(t,e=ot){let n=z(st(t.dbPath),{waitMs:5e3});if(!n)throw new Error("SQLite generation retention is busy; retry opening the index.");let r;try{let o=ge(t.dbPath);if(!o||!at(t.dbPath,o.currentGeneration))return{generation:gn(t),release(){}};let s=e.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(s))throw new Error("SQLite generation reader token is unsafe.");let a=x(v(t.dbPath),it);nn(a,{recursive:!0});let l=x(a,`${e.pid}-${s}.json`),p=e.readProcessIdentity(e.pid);_e(l,{version:1,token:s,generationIdentity:o.currentGeneration,pid:e.pid,...p?{processIdentity:p}:{},acquiredAt:e.now().toISOString()},{spacing:2,trailingNewline:!0});let u=!1;r={identity:o.currentGeneration,required:o.artifactSet==="immutable-v1",release(){u||(u=!0,nt(l,{force:!0}))}}}finally{n.release()}let i;try{i=e.resolveImmutableGeneration(t,r.identity)}catch(o){throw r.release(),o}if(i?.source==="immutable"&&i.identity===r.identity)return{generation:i,release:r.release};if(r.release(),r.required)throw new Error(`Published SQLite generation ${r.identity} is missing or invalid.`);return pn(t,r.identity)}function pn(t,e){let n=z(st(t.dbPath),{waitMs:5e3});if(!n)throw new Error("SQLite generation retention is busy; retry opening the index.");try{let r=ge(t.dbPath);if(r?.currentGeneration!==e)throw new Error("SQLite index publication changed while opening a legacy generation.");if(P(x(Z(t.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return{generation:dt(t,r.currentGeneration),release(){}}}finally{n.release()}}function bi(t,e,n=ot,r={}){let i=x(v(t),it);if(!P(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,s=0,a=0,l=0;for(let p of rn(i,{withFileTypes:!0})){if(!p.isFile()||!p.name.endsWith(".json"))continue;let u=x(i,p.name),c;try{c=fn(JSON.parse(S(u,"SQLite generation reader lease")))}catch{c=null}if(!c){l+=1;for(let m of e)o.add(m);continue}if(!mn(c,n)){r.removeStale!==!1&&(nt(u,{force:!0}),a+=1);continue}s+=1,o.add(c.generationIdentity)}return{protectedGenerations:o,activeLeases:s,staleLeasesRemoved:a,malformedLeases:l}}function fn(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=e.processIdentity===void 0?null:R(e.processIdentity);return e.version!==1||typeof e.token!="string"||e.token.trim()===""||typeof e.generationIdentity!="string"||!/^[a-f0-9]{64}$/.test(e.generationIdentity)||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0||typeof e.acquiredAt!="string"||!Number.isFinite(Date.parse(e.acquiredAt))||e.processIdentity!==void 0&&(!n||n.pid!==e.pid)?null:{version:1,token:e.token,generationIdentity:e.generationIdentity,pid:e.pid,...n?{processIdentity:n}:{},acquiredAt:e.acquiredAt}}function mn(t,e){if(!e.isProcessAlive(t.pid))return!1;if(!t.processIdentity)return!0;let n=e.readProcessIdentity(t.pid);return n===null||_(t.processIdentity,n)}function ge(t){try{let e=JSON.parse(S(x(v(t),"state.json"),"SQLite generation state"));return xn(e)?e:null}catch{return null}}function at(t,e){return yn(v(t),e)}function yn(t,e){try{let n=JSON.parse(S(x(t,e,dn),"SQLite generation manifest"));return Sn(n,e)?n:null}catch{return null}}function gn(t){let e=ge(t.dbPath);if(e){let n=ct(t,e.currentGeneration);if(n)return n;if(e.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${e.currentGeneration} is missing or invalid.`)}if(P(x(Z(t.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return dt(t,e?.currentGeneration)}function bn(t){return ve(G(t))??t}function ct(t,e){try{let n=x(v(t.dbPath),e),r=at(t.dbPath,e);if(!r)return null;let i=fe(n,r.database),o=r.index?fe(n,r.index):void 0,s=r.metadata?fe(n,r.metadata):void 0;return!me(i,r.database)||r.index&&(!o||!me(o,r.index))||r.metadata&&(!s||!me(s,r.metadata))?null:{identity:e,databasePath:i,...o?{indexPath:o}:{},...s?{metadataPath:s,metadataRaw:S(s,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function dt(t,e){let n=lt(t.dbPath),r=x(Z(t.dbPath),"meta.json"),i=P(r)?S(r,"reindex metadata"):void 0,o=P(t.indexPath)?t.indexPath:void 0;return{identity:e??hn(t.dbPath,i),databasePath:t.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:r,metadataRaw:i},source:"legacy",databaseFileIdentity:n}}function hn(t,e){let n=en("sha256").update("sqlite-generation-legacy-v1\0");return e!==void 0&&n.update(bn(e)),n.update(`\0${lt(t)}`),n.digest("hex")}function lt(t){let e=rt(t);return`${e.dev}:${e.ino}:${e.size}:${e.mtimeMs}`}function fe(t,e){if(on(e.file)!==e.file||e.file==="."||e.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return x(t,e.file)}function me(t,e){if(!P(t))return!1;let n=tt(t);if(!n||n.size!==e.size)return!1;let r=`${t}\0${e.sha256}\0${n.identity}`;if(q.has(r))return!0;let i=Ee(t,{inputKind:"immutable SQLite generation artifact",maxBytes:e.size}),o=tt(t);if(!o||o.identity!==n.identity||i!==e.sha256)return!1;for(q.set(r,!0);q.size>un;){let s=q.keys().next().value;if(s===void 0)break;q.delete(s)}return!0}function tt(t){let e=rt(t,{bigint:!0});return e.isFile()?{identity:`${e.dev}:${e.ino}:${e.size}:${e.mtimeNs}:${e.ctimeNs}`,size:Number(e.size)}:null}function Sn(t,e){return t.version===an&&t.identity===e&&ye(t.database)&&(t.index===void 0||ye(t.index))&&(t.metadata===void 0||ye(t.metadata))}function ye(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.file=="string"&&!!e.file&&Number.isSafeInteger(e.size)&&(e.size??-1)>=0&&typeof e.sha256=="string"&&/^[a-f0-9]{64}$/.test(e.sha256)}function xn(t){return t.version===sn&&typeof t.currentGeneration=="string"&&!!t.currentGeneration&&typeof t.publishedAt=="string"&&Number.isFinite(Date.parse(t.publishedAt))&&(t.artifactSet===void 0||t.artifactSet==="immutable-v1")&&In(t.stableMirrors)&&Mn(t.previousGeneration)&&Rn(t.publication)}function In(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t;return typeof e.databaseFileIdentity=="string"&&!!e.databaseFileIdentity&&(e.indexFileIdentity===void 0||typeof e.indexFileIdentity=="string"&&!!e.indexFileIdentity)}function Mn(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t;return typeof e.generationIdentity=="string"&&!!e.generationIdentity&&typeof e.databasePath=="string"&&!!e.databasePath&&(e.metadataPath===void 0||typeof e.metadataPath=="string"&&!!e.metadataPath)}function Rn(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t,n=[e.converterDurationMs,e.affectedDocumentCount,e.changedDocumentCount,e.producerDurationMs,e.materializationDurationMs,e.patchDurationMs].filter(r=>r!==void 0);return(e.mode==="incremental"||e.mode==="full")&&e.validation==="passed"&&e.converterDurationMs!==void 0&&n.every(r=>typeof r=="number"&&Number.isFinite(r)&&r>=0)&&(e.scipCompanion===void 0||e.scipCompanion==="current"||e.scipCompanion==="deferred")&&(e.typescriptOverlayGeneration===void 0||typeof e.typescriptOverlayGeneration=="string"&&!!e.typescriptOverlayGeneration)&&(e.scipCompanion!=="deferred"||!!e.typescriptOverlayGeneration)&&(e.fallbackReason===void 0||typeof e.fallbackReason=="string")}import{createHash as wn,randomUUID as yt}from"crypto";import{existsSync as T,lstatSync as N,readdirSync as E,renameSync as gt,rmSync as M}from"fs";import{basename as be,dirname as Pn,join as y}from"path";function ee(t){return Array.isArray(t)?`[${t.map(ee).join(",")}]`:t&&typeof t=="object"?`{${Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>`${JSON.stringify(e)}:${ee(n)}`).join(",")}}`:JSON.stringify(t)}var vn=1,An=Object.freeze({maxItems:1024,maxBytes:512*1024*1024,maxItemBytes:64*1024*1024,maxBatch:16,claimLeaseMs:5*6e4,responseRetentionMs:10*6e4,deadLetterRetentionMs:1440*6e4,temporaryRetentionMs:6e4,cleanupBatch:64}),A=class extends Error{constructor(n,r,i,o){let s=n==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:n==="item-capacity"?`mailbox has ${r.totalItems} retained items; limit is ${i.maxItems}`:n==="byte-capacity"?`mailbox retains ${r.totalBytes} bytes and the request adds ${o}; limit is ${i.maxBytes}`:"another writer held the admission coordinator through the bounded wait";super(`Mailbox backpressure: ${s}. Retry after the service drains or expires retained work.`);this.code=n;this.status=r;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},En=".owner.json",Tn={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function Ti(t){return{rootDir:t,pendingDir:y(t,"pending"),inflightDir:y(t,"inflight"),responseDir:y(t,"responses"),deadLetterDir:y(t,"dead-letter"),legacyRequestDir:y(t,"requests")}}function Fn(t={}){let e={...An,...t};for(let[n,r]of Object.entries(e))if(!Number.isFinite(r)||r<=0||!Number.isInteger(r))throw new Error(`Mailbox limit ${n} must be a positive integer.`);return e}function bt(t){let e=[t.pendingDir,t.inflightDir,t.responseDir,t.deadLetterDir,t.legacyRequestDir].map(n=>Be(n));return re(...e)}function Fi(t,e){return wn("sha256").update(ee({namespace:t,payload:e})).digest("hex")}function Ln(t){if(!/^[a-f0-9]{64}$/.test(t))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${t}`}function Li(t,e,n={}){let r=Fn(n.limits),i=n.nowMs??Date.now(),o=bt(t);return On(e),kn(t,r,n.admissionLockTimeoutMs??2e3,n.monotonicNow??$,()=>{Bn(t,i,r);let s=y(t.pendingDir,`${e.id}.json`),a=y(t.responseDir,`${e.id}.json`),l=ut(t,e.id);if(l){let m=pt(l,e.operationKey,e.id);return{disposition:"duplicate",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:m.deadlineAtMs??e.deadlineAtMs}}let p=`${JSON.stringify(e)}
3
- `,u=Buffer.byteLength(p),c=ht(t);if(u>r.maxItemBytes)throw new A("item-too-large",c,r,u);if(c.totalItems+1>r.maxItems)throw new A("item-capacity",c,r,u);if(c.totalBytes+u>r.maxBytes)throw new A("byte-capacity",c,r,u);n.onBeforePublish?.();try{let m=oe(s,p,{durability:"durable"}),g=re(o,m.directorySync);return{disposition:"accepted",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:e.deadlineAtMs,achievedDurability:g==="synced"?"directory-durable":"file-flushed",directorySync:g}}catch(m){if(m.code!=="EEXIST")throw m;let g=ut(t,e.id);if(!g)throw m;let f=pt(g,e.operationKey,e.id);return{disposition:"duplicate",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:f.deadlineAtMs??e.deadlineAtMs}}})}function Bn(t,e,n,r=Tn){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=n.cleanupBatch;for(let s of Se(t.inflightDir)){if(o<=0)break;let a=y(t.responseDir,`${s.requestId}.json`);if(T(a)){M(s.path,{force:!0}),i.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>e||Nn(t,s.ownerId,r)!=="dead")continue;let l=y(t.pendingDir,s.originalFile);try{gt(s.path,l),i.reclaimed++}catch(p){if(p.code!=="EEXIST")throw p;M(s.path,{force:!0})}F(Pn(s.path)),F(t.pendingDir),o--}o=ft(t.responseDir,o,(s,a)=>a+n.responseRetentionMs,e,()=>{i.responsesRemoved++}),o=ft(t.deadLetterDir,o,(s,a)=>a+n.deadLetterRetentionMs,e,()=>{i.deadLettersRemoved++});for(let s of[t.pendingDir,t.inflightDir,t.responseDir,t.deadLetterDir,t.legacyRequestDir]){if(o<=0)break;for(let a of St(s)){if(o<=0)break;be(a).includes(".tmp-")&&(N(a).mtimeMs+n.temporaryRetentionMs>e||(M(a,{force:!0}),i.temporaryFilesRemoved++,o--))}}return Gn(t.inflightDir),i}function ht(t){bt(t);let e=[...j(t.pendingDir).map(l=>({path:l,pending:!0})),...j(t.legacyRequestDir).map(l=>({path:l,pending:!0}))],n=Se(t.inflightDir).map(l=>({path:l.path,pending:!1})),r=j(t.responseDir).map(l=>({path:l,pending:!1})),i=j(t.deadLetterDir).map(l=>({path:l,pending:!1})),o=[...e,...n,...r,...i],s=0,a;for(let l of e){let p=xe(l.path);if(!p){s++;continue}let u=p.enqueuedAtMs??N(l.path).mtimeMs;a=a===void 0?u:Math.min(a,u)}return{pending:e.length,inflight:n.length,responses:r.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((l,p)=>l+_n(p.path),0),...a===void 0?{}:{oldestPendingAt:new Date(a).toISOString()}}}function kn(t,e,n,r,i){let o=y(t.rootDir,".admission.lock"),s=`${process.pid}-${yt()}`,a=r()+Math.max(0,n);for(;!Dn(t.rootDir,o,s);){if(qn(o),r()>=a)throw new A("admission-busy",ht(t),e,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return i()}finally{try{he(o).ownerToken===s&&(M(o,{recursive:!0,force:!0}),F(t.rootDir))}catch{}}}function Dn(t,e,n){let r=`${JSON.stringify({ownerToken:n,pid:process.pid,acquiredAtMs:Date.now()})}
4
- `;try{return oe(e,r,{durability:"durable"}),!0}catch(i){if(i.code==="EEXIST")return!1;try{he(e).ownerToken===n&&(M(e,{force:!0}),F(t))}catch{}throw i}}function qn(t){let e=null;try{let r=he(t);typeof r.ownerToken=="string"&&Number.isSafeInteger(r.pid)&&Number(r.pid)>0&&(e=Number(r.pid))}catch{}if(e===null||jn(e))return;let n=`${t}.stale-${yt()}`;try{gt(t,n)}catch(r){let i=r.code;if(i==="ENOENT"||i==="EEXIST")return;throw r}M(n,{recursive:!0,force:!0})}function he(t){try{return JSON.parse(S(t,"mailbox lock record"))}catch(e){if(e.code!=="EISDIR"&&!(e instanceof Ae&&e.reason==="not-regular"))throw e;return JSON.parse(S(y(t,"owner.json"),"mailbox lock owner record"))}}function jn(t){try{return process.kill(t,0),!0}catch(e){let n=e.code;return n==="EPERM"||n!=="ESRCH"}}function Nn(t,e,n){let r=Cn(y(t.inflightDir,xt(e),En));if(!r)return"unknown";if(!n.isProcessAlive(r.pid))return"dead";if(!r.processIdentity)return"live";let i=n.readProcessIdentity(r.pid);return i?_(r.processIdentity,i)?"live":"dead":"unknown"}function Cn(t){try{let e=JSON.parse(S(t,"mailbox owner record"));if(e.version!==1||typeof e.ownerId!="string"||!e.ownerId||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0)return null;let n=e.processIdentity===void 0?null:R(e.processIdentity);return e.processIdentity!==void 0&&(!n||n.pid!==e.pid)?null:{version:1,ownerId:e.ownerId,pid:e.pid,...n?{processIdentity:n}:{}}}catch{return null}}function ut(t,e){for(let n of[y(t.pendingDir,`${e}.json`),y(t.legacyRequestDir,`${e}.json`),y(t.responseDir,`${e}.json`)])if(T(n))return n;for(let n of Se(t.inflightDir))if(n.requestId===e)return n.path;return null}function pt(t,e,n){let r=xe(t);if(!r||r.operationKey!==e)throw new Error(`Mailbox operation ${n} conflicts with an existing retained record.`);return r}function On(t){if(t.mailboxVersion!==vn||t.id!==Ln(t.operationKey)||!t.clientId.trim()||!Number.isFinite(t.enqueuedAtMs)||!Number.isFinite(t.deadlineAtMs)||t.deadlineAtMs<t.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function Se(t){if(!T(t))return[];let e=[];for(let n of E(t,{withFileTypes:!0})){if(!n.isDirectory())continue;let r=mt(n.name);if(r===null)continue;let i=y(t,n.name);for(let o of E(i,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let a=mt(s[1]),l=Number(s[2]);if(a===null||be(a)!==a||!a.endsWith(".json")||!Number.isSafeInteger(l))continue;let p=y(i,o.name),u=xe(p)??{id:be(a,".json")},c=N(p);e.push({requestId:u.id,ownerId:r,path:p,originalFile:a,claimedAtMs:c.mtimeMs,claimExpiresAtMs:l,byteLength:c.size,...u.operationKey?{operationKey:u.operationKey}:{},...u.clientId?{clientId:u.clientId}:{},...u.enqueuedAtMs===void 0?{}:{enqueuedAtMs:u.enqueuedAtMs},...u.deadlineAtMs===void 0?{}:{deadlineAtMs:u.deadlineAtMs},legacy:u.operationKey===void 0})}}return e.sort((n,r)=>n.claimedAtMs-r.claimedAtMs||n.path.localeCompare(r.path))}function xe(t){try{let e=JSON.parse(S(t,"mailbox record"));return typeof e.id!="string"||!e.id?null:{id:e.id,...typeof e.operationKey=="string"?{operationKey:e.operationKey}:{},...typeof e.clientId=="string"?{clientId:e.clientId}:{},...typeof e.enqueuedAtMs=="number"?{enqueuedAtMs:e.enqueuedAtMs}:{},...typeof e.deadlineAtMs=="number"?{deadlineAtMs:e.deadlineAtMs}:{}}}catch{return null}}function ft(t,e,n,r,i){for(let o of j(t)){if(e<=0)break;let s=N(o);n(o,s.mtimeMs)>r||(M(o,{force:!0}),i(),e--)}return e}function j(t){return T(t)?E(t,{withFileTypes:!0}).filter(e=>e.isFile()).map(e=>y(t,e.name)).sort():[]}function St(t){if(!T(t))return[];let e=[];for(let n of E(t,{withFileTypes:!0})){let r=y(t,n.name);n.isFile()?e.push(r):n.isDirectory()&&e.push(...St(r))}return e.sort()}function Gn(t){if(T(t))for(let e of E(t,{withFileTypes:!0})){if(!e.isDirectory())continue;let n=y(t,e.name);E(n).some(r=>r.endsWith(".claim"))||M(n,{recursive:!0,force:!0})}}function _n(t){try{return N(t).size}catch{return 0}}function xt(t){return Buffer.from(t,"utf8").toString("base64url")}function mt(t){try{let e=Buffer.from(t,"base64url").toString("utf8");return xt(e)===t?e:null}catch{return null}}import{join as te}from"path";var $n="watch.lock",Wn="watch-state.json",zn="watch-activity.json",Jn="watch-refresh-requests";function Ci(t){return{lockPath:te(t,$n),statePath:te(t,Wn),activityPath:te(t,zn),refreshRequestsPath:te(t,Jn)}}function Oi(t){try{return Hn(JSON.parse(S(t,"watch service state")))}catch{return null}}function Hn(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==1||typeof e.protocolVersion!="number"||typeof e.pid!="number"||!Number.isInteger(e.pid)||e.pid<=0||typeof e.projectRoot!="string"||e.worktreeId!==void 0&&(typeof e.worktreeId!="string"||e.worktreeId.length===0)||typeof e.cliVersion!="string"||!b(e.startedAt)||!b(e.heartbeatAt)||!b(e.lastActivityAt)||!Un(e.watcher)||e.idleDeadlineAt!==void 0&&!b(e.idleDeadlineAt))return null;if(e.processIdentity!==void 0){let n=R(e.processIdentity);if(!n||n.pid!==e.pid)return null;e.processIdentity=n}return e.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(e.indexGeneration)||e.lastError!==void 0&&!Vn(e.lastError)||e.lastRefresh!==void 0&&!Qn(e.lastRefresh)||e.reindexActivity!==void 0&&!Kn(e.reindexActivity)||e.refreshRequests!==void 0&&!Yn(e.refreshRequests)||e.typescriptSemantic!==void 0&&!Zn(e.typescriptSemantic)||e.typescriptIndex!==void 0&&!er(e.typescriptIndex)||e.queryLane!==void 0&&!tr(e.queryLane)?null:e}function b(t){return Re(t)}function Un(t){if(!t||typeof t!="object"||!("state"in t))return!1;let e=t;switch(e.state){case"idle":return!0;case"waiting":return h(e.changedFiles)&&h(e.reindexAt);case"indexing":return h(e.startedAt);case"cooldown":return h(e.until)&&typeof e.dirty=="boolean";case"budget-paused":return h(e.until)&&typeof e.dirty=="boolean"&&typeof e.reason=="string"&&d(e.rebuilt)&&d(e.estimatedWriteBytes);case"draining":return h(e.startedAt)&&typeof e.reason=="string";default:return!1}}function Vn(t){if(!t||typeof t!="object")return!1;let e=t;return b(e.at)&&typeof e.message=="string"}function Qn(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.trigger?.kind=="string"&&typeof e.result=="string"&&b(e.startedAt)&&b(e.completedAt)&&h(e.durationMs)}function Kn(t){if(!t||typeof t!="object")return!1;let e=t;return e.confidence!==void 0&&e.confidence!=="complete"&&e.confidence!=="partial"&&e.confidence!=="unavailable"||e.recordsRead!==void 0&&!d(e.recordsRead)||e.invalidRecords!==void 0&&!d(e.invalidRecords)||e.skippedRecords!==void 0&&!d(e.skippedRecords)||e.readErrors!==void 0&&!d(e.readErrors)||e.ignoredPartialTailBytes!==void 0&&!d(e.ignoredPartialTailBytes)||!b(e.windowStartedAt)||!b(e.windowEndedAt)||!d(e.runs)||!d(e.rebuilt)||!d(e.reused)||!d(e.failed)||!d(e.suppressed)||!h(e.estimatedLogicalOutputBytes)||e.estimatedWriteBytes!==void 0&&!d(e.estimatedWriteBytes)||e.reflinkedBytes!==void 0&&!d(e.reflinkedBytes)||e.fallbackCopiedBytes!==void 0&&!d(e.fallbackCopiedBytes)||e.oldestRebuildAt!==void 0&&!b(e.oldestRebuildAt)||e.oldestWriteAt!==void 0&&!b(e.oldestWriteAt)||e.languageAttribution!==void 0&&e.languageAttribution!=="complete"&&e.languageAttribution!=="partial"&&e.languageAttribution!=="unavailable"||e.attributedRuns!==void 0&&!d(e.attributedRuns)||e.unattributedRuns!==void 0&&!d(e.unattributedRuns)||e.invalidLanguageDetails!==void 0&&!d(e.invalidLanguageDetails)||e.estimatedLogicalOutputBytes<0||!e.byTrigger||typeof e.byTrigger!="object"||Array.isArray(e.byTrigger)||e.byLanguage!==void 0&&!Xn(e.byLanguage)?!1:Object.values(e.byTrigger).every(n=>n===void 0||d(n))}function Xn(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;for(let[e,n]of Object.entries(t)){if(!Pe.includes(e)||!n||typeof n!="object")return!1;let r=n;if(!d(r.runs)||!d(r.rebuilt)||!d(r.reused)||!d(r.producedOutputBytes)||!we(r.durationMs)||r.rebuilt+r.reused!==r.runs)return!1}return!0}function Yn(t){if(!t||typeof t!="object")return!1;let e=t;return d(e.pending)&&d(e.claimed)&&d(e.completed)&&d(e.expired)&&d(e.invalid)&&(e.oldestPendingAt===void 0||b(e.oldestPendingAt))}function Zn(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&h(e.requests)&&h(e.sessionsCreated)&&h(e.sessionsReused)&&h(e.sessionsRefreshed)&&h(e.sessionsReplaced)&&h(e.projectsCreated)&&(e.lastRequestAt===void 0||b(e.lastRequestAt))&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||b(e.busyUntil))&&(e.mailbox===void 0||It(e.mailbox))}function er(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&d(e.requests)&&d(e.sessionsCreated)&&d(e.sessionsReplaced)&&d(e.initializations)&&d(e.programUpdates)&&d(e.documentsEmitted)&&d(e.documentsRemoved)&&(e.lastRequestAt===void 0||b(e.lastRequestAt))&&(e.lastDurationMs===void 0||h(e.lastDurationMs)&&e.lastDurationMs>=0)&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||b(e.busyUntil))&&(e.mailbox===void 0||It(e.mailbox))}function tr(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&typeof e.socketPath=="string"&&e.socketPath.length>0&&d(e.requests)&&(e.lastRequestAt===void 0||b(e.lastRequestAt))&&(e.lastError===void 0||typeof e.lastError=="string")}function It(t){if(!t||typeof t!="object")return!1;let e=t;return d(e.pending)&&d(e.inflight)&&d(e.responses)&&d(e.deadLetters)&&d(e.invalid)&&d(e.totalItems)&&h(e.totalBytes)&&e.totalBytes>=0&&e.totalItems===e.pending+e.inflight+e.responses+e.deadLetters&&(e.oldestPendingAt===void 0||b(e.oldestPendingAt))}function h(t){return typeof t=="number"&&Number.isFinite(t)}export{Mt as a,ir as b,dr as c,z as d,_e as e,pr as f,sn as g,an as h,cn as i,dn as j,v as k,st as l,gi as m,bi as n,ge as o,at as p,yn as q,gn as r,bn as s,lt as t,Rr as u,kt as v,de as w,wr as x,jt as y,Nt as z,Pr as A,vr as B,Ar as C,ee as D,vn as E,Ti as F,Fi as G,Ln as H,Li as I,Ci as J,Oi as K,_t as L,H as M,Ht as N,Dr as O,qr as P,Hr as Q,V as R,ue as S,ni as T,ri as U,ii as V};
5
- //# sourceMappingURL=chunk-6ZV5EDUT.js.map
@@ -1,12 +0,0 @@
1
- import{e as V,f as X,m as A,o as H,p as Y,q as Q}from"./chunk-CANBLFVQ.js";import{D as L,E as $,F as U,H as K,o as z,q as _,s as b,t as N}from"./chunk-327YK6TB.js";import{spawn as Se}from"child_process";import{platform as Z}from"os";import{performance as ee}from"perf_hooks";var St={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},v=class extends Error{constructor(n,i,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=i;this.name="BoundedProcessError",this.timedOut=a.timedOut??!1,this.reaped=a.reaped??!1,this.stdout=a.stdout??"",this.stderr=a.stderr??"",this.stdoutTruncated=a.stdoutTruncated??!1,this.stderrTruncated=a.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function h(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function te(e,t,n,i){let s=Math.max(0,i-n);s>0&&e.push(t.subarray(0,s))}function ne(e,t,n){let i=Buffer.concat([...e,t]);e.length=0,e.push(i.subarray(Math.max(0,i.length-n)))}function Lt(e){h(e.timeoutMs,"timeoutMs"),h(e.maxStdoutBytes,"maxStdoutBytes"),h(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;h(t,"terminationGraceMs");let n=e.terminationForceMs??t;return h(n,"terminationForceMs"),new Promise((i,s)=>{let a=ee.now(),r;try{let c=Z()!=="win32";r=Se(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(c){s(new v("spawn",e.label,`${e.label} could not start.`,{cause:c,reaped:!0}));return}let u=[],d=[],o=0,g=0,l=!1,m=!1,p=null,y=!1,x=Z()!=="win32",G=r.pid===void 0?null:Y(r.pid,x),O=()=>{clearTimeout(q),e.signal?.removeEventListener("abort",E)},P=c=>{if(y||!p)return;y=!0,O();let f=Buffer.concat(u).toString("utf8"),I=Buffer.concat(d).toString("utf8"),M=c.reaped||!c.detail?"":` Process-tree cleanup failed: ${c.detail}`;s(new v(p.kind,e.label,`${p.message}${M}`,{timedOut:p.timedOut,reaped:c.reaped,stdout:f,stderr:I,stdoutTruncated:l,stderrTruncated:m}))},R=c=>{if(!(p||y)){if(p=c,!G){P({reaped:r.pid===void 0,reason:r.pid===void 0?"terminated":"identity-unavailable"});return}Q(G,{gracefulMs:t,forceMs:n}).then(P,f=>{P({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},q=setTimeout(()=>{R({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);q.unref();let E=()=>{R({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",E,{once:!0}),e.signal?.aborted&&E(),r.stdout.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ne(u,f,e.maxStdoutBytes):te(u,f,o,e.maxStdoutBytes),o+=f.length,o>e.maxStdoutBytes&&(l=!0,e.outputLimitBehavior!=="truncate-tail"&&R({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),r.stderr.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ne(d,f,e.maxStderrBytes):te(d,f,g,e.maxStderrBytes),g+=f.length,g>e.maxStderrBytes&&(m=!0,e.outputLimitBehavior!=="truncate-tail"&&R({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),r.on("error",c=>{if(!y&&!p){if(r.pid===void 0){O(),y=!0,s(new v("spawn",e.label,`${e.label} could not start: ${c.message}`,{cause:c,reaped:!0}));return}R({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${c.message}`})}}),r.on("close",(c,f)=>{if(y||p)return;y=!0,O();let I=Buffer.concat(u).toString("utf8"),M=Buffer.concat(d).toString("utf8");i({status:c,signal:f,stdout:I,stderr:M,timedOut:!1,durationMs:ee.now()-a,stdoutTruncated:l,stderrTruncated:m})}),e.input===void 0?r.stdin.end():r.stdin.end(e.input)})}import{execFileSync as ie}from"child_process";import{createRequire as Le}from"module";import{existsSync as Ae}from"fs";import{platform as B,arch as re}from"os";var S="v0.8.1",D="https://github.com/sourcegraph/scip",w=`github.com/sourcegraph/scip/cmd/scip@${S}`,se=Le(import.meta.url),ae="CODEBASEIQ_SCIP_BIN";function we(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let t=e.env[ae];if(t&&e.fileExists(t))return{source:"env",path:t};if(e.platform==="win32"){let n=e.resolveSidecar(e.arch);if(n&&e.fileExists(n))return{source:"sidecar",path:n}}return null}function Te(e){for(let t of e==="arm64"?["arm64","x64"]:[e])try{return se.resolve(`codebaseiq-windows/scip-win32-${t}.exe`)}catch{}return null}function J(e=process.env){let t=we({platform:B(),arch:re(),env:e,isOnPath:A,fileExists:Ae,resolveSidecar:Te});return t?.source==="path"?H("scip")??t.path:t?.path??null}function Et(){return J()!==null}function ke(){let e=J();if(!e)return null;try{return ie(e,["--version"],{stdio:"pipe",windowsHide:!0,timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function Oe(){let e=B(),t=re(),n,i,s;switch(e){case"darwin":n="darwin",s="tar.gz";break;case"linux":n="linux",s="tar.gz";break;default:return null}switch(t){case"arm64":i="arm64";break;case"x64":i="amd64";break;default:return null}let a=`scip-${n}-${i}.${s}`;return{url:`${D}/releases/download/${S}/${a}`,filename:a}}function It(){let e=Oe();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),B()==="darwin"||B()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${w}
2
- `),console.log("Or download that exact release manually:");else if(B()==="win32"){let t=Pe();console.log("On Windows the scip binary ships via the npm sidecar package codebaseiq-windows,"),console.log("installed automatically with codebaseiq. If it is missing:"),console.log(` npm install -g ${t}`),console.log(`Or set ${ae} to a local scip.exe path.
3
- `),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
4
- `:` ${D}/releases/tag/${S}
5
- `),console.log("After installing, ensure `scip` is on your PATH and run `codebaseiq reindex`.")}function Pe(){let t=se("../../package.json").optionalDependencies?.["codebaseiq-windows"];if(!t||!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(t))throw new Error("codebaseiq package metadata does not declare an exact Windows sidecar version.");return`codebaseiq-windows@${t}`}function Mt(e){if(A("go")){e(`Installing immutable ${w} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(ie("go",["install",w],{stdio:"inherit",windowsHide:!0,timeout:3e5,env:process.env}),A("scip")){let t=J(),n=ke();if(t&&n&&n.includes(S))return e(`Successfully installed ${w}; resolved executable: ${t}; reported version: ${n}.`),!0;e(`go install completed, but the resolved scip executable did not report ${S} (executable: ${t??"unresolved"}; version: ${n??"unavailable"}).`)}}catch(t){let n=t instanceof Error?t.message:String(t);e(`go install failed: ${n}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${D}/releases`),!1}import{execFileSync as Ee}from"child_process";import{existsSync as Ie,readdirSync as ue}from"fs";import{extname as de,join as le}from"path";var ce=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),Me=[{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 Jt(e){let t=[],n=_e(e),i=Je(e);for(let s of Me){if(Ne(e,s.files)){t.push(s.language);continue}if($e(n,s.globs)){t.push(s.language);continue}Ce(i,s.extensions)&&t.push(s.language)}return t.includes("typescript")&&oe(t,"javascript"),t.includes("cpp")&&!i.has(".c")&&oe(t,"c"),t}function _e(e){try{return ue(e)}catch{return[]}}function Ne(e,t){return t?.length?t.some(n=>Ie(le(e,n))):!1}function $e(e,t){return t?.length?e.some(n=>t.some(i=>De(n,i))):!1}function De(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[n,i]=t.split("*");return e.startsWith(n??"")&&e.endsWith(i??"")}function Je(e){let t=We(e);if(t)return t;let n=new Set,i=[e];for(;i.length>0;){let s=i.pop();if(!s)continue;let a;try{a=ue(s,{withFileTypes:!0})}catch{continue}for(let r of a){if(r.name.startsWith(".")&&!r.name.endsWith("proj")&&!r.name.endsWith("sln")&&r.isDirectory())continue;let u=le(s,r.name);if(r.isDirectory()){ce.has(r.name)||i.push(u);continue}let d=de(r.name).toLowerCase();d&&n.add(d)}}return n}function We(e){try{let t=Ee("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}),n=new Set;for(let i of t.split(`
6
- `)){if(!i||i.split("/").some(a=>ce.has(a)))continue;let s=de(i).toLowerCase();s&&n.add(s)}return n}catch{return null}}function Ce(e,t){return t?.length?t.some(n=>e.has(n)):!1}function oe(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}import{existsSync as be,statSync as tt}from"fs";import{dirname as he,join as ve}from"path";import{appendFileSync as je,existsSync as Fe,mkdirSync as Ge,renameSync as qe,rmSync as ze,statSync as Ue,truncateSync as Ke}from"fs";import{basename as Ve,dirname as Xe}from"path";var T=".previous",He=".rotation.lock",Ye=2e3,W=class extends Error{constructor(n,i){super(`Timed out after ${i}ms waiting for rotating JSONL lock: ${n}`);this.lockPath=n;this.timeoutMs=i;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},C=class extends Error{constructor(n){super(`Rotating JSONL lock ownership changed before release: ${n}`);this.lockPath=n;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},ge=Object.freeze({monotonicNow:V,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=X(e,{kind:"rotating-jsonl",detail:{target:Ve(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){Ge(e,{recursive:!0})},exists:Fe,readBytes(e){return U(e,{maxBytes:L,inputKind:"rotating JSONL segment"})},size(e){return Ue(e).size},truncate:Ke,remove(e){ze(e,{force:!0})},rename:qe,append:je});function fe(e,t,n){let i=n.runtime??ge,s=JSON.stringify(t);if(s===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let a=Buffer.from(`${s}
7
- `),r=Math.max(1,Math.floor(n.maxSegmentBytes),a.length);return pe(e,n.lockTimeoutMs,i,()=>{i.makeDirectory(Xe(e));let u=Qe(e,L,i);n.onPhase?.("tail-repaired");let d=`${e}${n.previousSuffix??T}`,o=!1,g=!1;return i.exists(e)&&i.size(e)+a.length>r&&(i.exists(d)&&(i.remove(d),g=!0),n.onPhase?.("previous-pruned"),i.rename(e,d),o=!0,n.onPhase?.("current-rotated")),i.append(e,a),n.onPhase?.("record-appended"),{lineBytes:a.length,segmentLimitBytes:r,repairedTailBytes:u,rotated:o,prunedPrevious:g}})}function me(e,t={}){let n=t.runtime??ge,i=Ze(t.maxSegmentBytes);return pe(e,t.lockTimeoutMs,n,()=>{let s=[],a=0,r=`${e}${t.previousSuffix??T}`;for(let u of[r,e]){if(!n.exists(u))continue;let d=et(ye(u,i,n));s.push(...d.lines),a+=d.partialTailBytes}return{lines:s,ignoredPartialTailBytes:a}})}function pe(e,t,n,i){let s=`${e}${He}`,a=Math.max(0,t??Ye),r=n.monotonicNow()+a,u;for(;;){let m=n.tryAcquireLock(s,e);if(m.kind==="acquired"){u=m.lock;break}let p=r-n.monotonicNow();if(p<=0)throw new W(s,a);n.wait(Math.min(5,p))}let d=!1,o,g;try{g=i()}catch(m){d=!0,o=m}let l=!1;try{l=u.release()}catch(m){if(!d)throw m}if(d)throw o;if(!l)throw new C(s);return g}function Qe(e,t,n){if(!n.exists(e))return 0;let i=ye(e,t,n);if(i.length===0||i[i.length-1]===10)return 0;let s=i.lastIndexOf(10),a=s<0?0:s+1;return n.truncate(e,a),i.length-a}function Ze(e){let t=e??L;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function ye(e,t,n){let i=n.size(e);if(i>t)throw new $("rotating JSONL segment",e,"too-large",i,t);let s=n.readBytes(e),a=n.size(e);if(a!==i||s.byteLength!==i)throw new $("rotating JSONL segment",e,"changed-during-read",a,t);return s}function et(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
8
- `).filter(s=>s.length>0),partialTailBytes:e.length-n}}var nt="reindex-activity.jsonl",k=T,it=1024*1024,rt=1440*60*1e3,xe=e=>K(e,"reindex activity segment");function F(e){return ve(he(e),nt)}function st(e){if(e.reused)return 0;let t=j(e.indexPath)+j(e.dbPath);for(let n of e.shards??[])!n.reused&&n.outputBytes!==null&&(t+=n.outputBytes);return t}function Qt(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let i=st(t);return Be(F(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:i,estimatedWriteBytes:i+(t.writeTelemetry?.fallbackCopiedBytes??0),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,byLanguage:ct(t)})}function Zt(e,t){return Be(F(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function at(e,t,n=it,i){fe(e,t,{maxSegmentBytes:n,previousSuffix:k,...i?{runtime:i}:{}})}function ot(e,t=new Date,n=rt,i=xe){let s=t.getTime(),a=s-n,r={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(a).toISOString(),windowEndedAt:t.toISOString(),runs:0,rebuilt:0,reused:0,failed:0,suppressed:0,estimatedLogicalOutputBytes:0,estimatedWriteBytes:0,reflinkedBytes:0,fallbackCopiedBytes:0,languageAttribution:"complete",attributedRuns:0,unattributedRuns:0,invalidLanguageDetails:0,byLanguage:{},byTrigger:{}},u=F(e),d=[];if(i===xe){if(!be(u)&&!be(`${u}${k}`))return r;try{let o=me(u,{previousSuffix:k});d=o.lines,r.ignoredPartialTailBytes=o.ignoredPartialTailBytes}catch{r.readErrors+=1,r.confidence="unavailable"}}else{let o=0;for(let g of[`${u}${k}`,u])try{d.push(...xt(i(g))),o+=1}catch{r.readErrors+=1}o===0?r.confidence="unavailable":r.readErrors>0&&(r.confidence="partial")}for(let o of d){r.recordsRead+=1;let g=ut(o);if(!g){r.invalidRecords+=1,r.confidence!=="unavailable"&&(r.confidence="partial");continue}let{record:l}=g,m=Date.parse(l.recordedAt);if(m<a||m>s){r.skippedRecords+=1;continue}if(r.invalidLanguageDetails=(r.invalidLanguageDetails??0)+g.invalidLanguageDetails,r.byTrigger[l.trigger.kind]=(r.byTrigger[l.trigger.kind]??0)+1,l.event==="suppressed"){r.suppressed+=1;continue}r.runs+=1,r[l.result]+=1,r.estimatedLogicalOutputBytes+=l.estimatedLogicalOutputBytes,r.estimatedWriteBytes=(r.estimatedWriteBytes??0)+(l.estimatedWriteBytes??l.estimatedLogicalOutputBytes),r.reflinkedBytes=(r.reflinkedBytes??0)+(l.reflinkedBytes??0),r.fallbackCopiedBytes=(r.fallbackCopiedBytes??0)+(l.fallbackCopiedBytes??0),l.result!=="failed"&&(g.hasLanguageDetails?r.attributedRuns=(r.attributedRuns??0)+1:r.unattributedRuns=(r.unattributedRuns??0)+1);for(let[p,y]of pt(l.byLanguage)){let x=(r.byLanguage??={})[p]??=yt();x.runs+=1,x[y.result]+=1,x.producedOutputBytes+=y.producedOutputBytes,x.durationMs+=y.durationMs}l.result==="rebuilt"&&r.oldestRebuildAt===void 0&&(r.oldestRebuildAt=l.recordedAt),(l.estimatedWriteBytes??l.estimatedLogicalOutputBytes)>0&&r.oldestWriteAt===void 0&&(r.oldestWriteAt=l.recordedAt)}return r.ignoredPartialTailBytes>0&&r.confidence!=="unavailable"&&(r.confidence="partial"),r.languageAttribution=bt(r),r}function Be(e,t){try{return at(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function ut(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!z(n.recordedAt)||!n.trigger||!lt(n.trigger.kind))return null;if(n.event==="suppressed")return n.reason==="completed-index-is-fresh"?{record:n,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(n.event!=="run"||n.result!=="rebuilt"&&n.result!=="reused"&&n.result!=="failed"||!b(n.durationMs)||!b(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!b(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!b(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!b(n.fallbackCopiedBytes))return null;let i=n,{byLanguage:s,...a}=i,r=gt(s);return{record:{...a,...r.byLanguage?{byLanguage:r.byLanguage}:{}},hasLanguageDetails:r.hasLanguageDetails,invalidLanguageDetails:r.invalidLanguageDetails}}catch{return null}}function en(e,t,n=new Date){return t.enabled?dt(ot(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function dt(e,t,n){let i=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,s={rebuilt:e.rebuilt,estimatedWriteBytes:i};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:n+t.windowMs,...s,detail:`reindex activity evidence is ${e.confidence}`}:e.rebuilt>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:Re(e.oldestRebuildAt,t.windowMs,n),...s,detail:`${e.rebuilt}/${t.maxRebuilds} automatic rebuild slots consumed`}:i>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:Re(e.oldestWriteAt,t.windowMs,n),...s,detail:`${i}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...s}:{state:"allowed",...s}}function Re(e,t,n){let i=e?Date.parse(e):Number.NaN;return Number.isFinite(i)&&i+t>n?i+t:n+t}function lt(e){return e==="manual-cli"||e==="setup"||e==="watch-source"||e==="watch-startup"||e==="watch-demand"||e==="watch-git-head"||e==="watch-git-index"||e==="watch-git-state"||e==="unknown"}function j(e){try{return tt(e).size}catch{return 0}}function ct(e){let t={};for(let n of e.languages){let i=(e.shards??[]).filter(o=>o.language===n),s=i.find(o=>o.id===n),a=e.reused||(s?s.reused:i.length>0&&i.every(o=>o.reused)),r=j(ve(he(e.dbPath),"language-indexes",`${n}.scip`)),u=r>0?r:s?.outputBytes??r,d=a?0:s?.durationMs??i.filter(o=>!o.reused).reduce((o,g)=>o+g.durationMs,0);t[n]={result:a?"reused":"rebuilt",outputBytes:u,producedOutputBytes:a?0:u,durationMs:d}}return t}function gt(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let t={},n=0;for(let[s,a]of Object.entries(e)){if(!mt(s)||!ft(a)){n+=1;continue}t[s]=a}let i=Object.keys(t).length>0;return{...i?{byLanguage:t}:{},hasLanguageDetails:i,invalidLanguageDetails:n}}function ft(e){if(!e||typeof e!="object")return!1;let t=e;return(t.result==="rebuilt"||t.result==="reused")&&_(t.outputBytes)&&_(t.producedOutputBytes)&&b(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function mt(e){return N.includes(e)}function pt(e){return e?N.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function yt(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function bt(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function xt(e){return e.endsWith(`
9
- `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
10
- `)+1))),e.split(`
11
- `).filter(t=>t.length>0)}export{St as a,v as b,Lt as c,J as d,Et as e,ke as f,It as g,Mt as h,T as i,fe as j,Jt as k,nt as l,Qt as m,Zt as n,en as o};
12
- //# sourceMappingURL=chunk-7R64XY4Y.js.map
@@ -1,15 +0,0 @@
1
- import{H as h,J as D,M as P,N as S,O as A,P as p,Q as f,R as y}from"./chunk-327YK6TB.js";var ce=new Set(["aix","android","darwin","freebsd","haiku","linux","openbsd","sunos","win32","cygwin","netbsd"]);function k(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;return r.version!==1||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.platform!="string"||!ce.has(r.platform)||typeof r.startToken!="string"||r.startToken.trim()===""?null:{version:1,pid:r.pid,platform:r.platform,startToken:r.startToken}}function m(e,r){return e.version===r.version&&e.pid===r.pid&&e.platform===r.platform&&e.startToken===r.startToken}import{execFileSync as ae}from"child_process";import{platform as le}from"os";var _=new WeakMap,de=1e3,N=16*1024;function F(e,r=fe){if(!Number.isSafeInteger(e)||e<=0)return null;if(e===process.pid){let t=_.get(r);if(t)return t}try{let t=ue(e,r);if(!t)return null;let n={version:1,pid:e,platform:r.platform,startToken:t};return e===process.pid&&_.set(r,n),n}catch{return null}}function ue(e,r){if(r.platform==="linux"||r.platform==="android")return me(r.readFile(`/proc/${e}/stat`));if(r.platform==="win32"){let t=`([DateTimeOffset](Get-Process -Id ${e} -ErrorAction Stop).StartTime).ToUnixTimeMilliseconds()`;return M(r.run("powershell.exe",["-NoProfile","-NonInteractive","-Command",t]))}return r.platform==="darwin"||r.platform==="freebsd"||r.platform==="openbsd"||r.platform==="netbsd"?M(r.run("ps",["-p",String(e),"-o","lstart="])):null}function me(e){let r=e.lastIndexOf(")");if(r<0)return null;let n=e.slice(r+1).trim().split(/\s+/)[19];return n&&/^\d+$/.test(n)?n:null}function M(e){let r=e.trim();return r===""?null:r}var fe={platform:le(),readFile(e){return D(e,{maxBytes:N,inputKind:"process identity pseudo-file"})},run(e,r){return ae(e,[...r],{encoding:"utf8",timeout:de,maxBuffer:N,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0})}};function C(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}}function br(){return performance.now()}import{randomUUID as pe}from"crypto";import{closeSync as ye,fsyncSync as be,linkSync as Pe,mkdirSync as ge,openSync as Fe,statSync as we,unlinkSync as Se,writeSync as ke}from"fs";import{dirname as L}from"path";var R="codebaseiq-process-lock",E=1,w=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:C,readProcessIdentity:F,randomToken:()=>pe(),makeDirectory:e=>ge(e,{recursive:!0}),openFile:(e,r,t)=>Fe(e,r,t),writeFile:(e,r,t,n)=>ke(e,r,t,n),syncFile:e=>be(e),closeFile:e=>ye(e),linkFile:(e,r)=>Pe(e,r),readFile:e=>h(e,"process lock record"),statFile:e=>{let r=we(e);return{dev:r.dev,ino:r.ino,size:r.size,mtimeMs:r.mtimeMs}},removeFile:e=>Se(e)});function Er(e,r){let t=r.runtime??w;t.makeDirectory(L(e));let n;for(let o=0;o<2;o+=1)try{return{kind:"acquired",lock:B(e,r,t),...n?{reclaimed:n}:{}}}catch(i){if(i.code!=="EEXIST")throw i;let s=b(e,{parseLegacy:r.parseLegacy,runtime:t});if(o===0&&Re(e,s,{creationGraceMs:r.creationGraceMs,parseLegacy:r.parseLegacy,runtime:t})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:b(e,{parseLegacy:r.parseLegacy,runtime:t})}}function b(e,r={}){let t=r.runtime??w,n,o;try{n=t.statFile(e),o=t.readFile(e)}catch(l){return l.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let i;try{i=JSON.parse(o)}catch{return{state:"malformed",raw:o,identity:n}}let s=Ie(i);if(s)return{state:"valid",raw:o,identity:n,record:s,owner:Te(s),parsed:i};let c=r.parseLegacy?.(i)??null;return c?{state:"legacy",raw:o,identity:n,owner:c,parsed:i}:{state:"malformed",raw:o,identity:n,parsed:i}}function Ie(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;if(r.protocol!==R||r.version!==E||typeof r.kind!="string"||r.kind.trim()===""||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.token!="string"||r.token.trim()===""||typeof r.startedAt!="string"||!Number.isFinite(Date.parse(r.startedAt))||r.detail!==void 0&&(typeof r.detail!="object"||r.detail===null||Array.isArray(r.detail)))return null;let t=r.processIdentity===void 0?null:k(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{protocol:R,version:E,kind:r.kind,pid:r.pid,token:r.token,...t?{processIdentity:t}:{},startedAt:r.startedAt,...r.detail?{detail:r.detail}:{}}}function Re(e,r,t={}){let n=t.runtime??w;if(!T(r,n))return!1;let o=Ee(`${e}.reclaim`,n);if(!o)return!1;try{let i=b(e,{parseLegacy:t.parseLegacy,runtime:n});return!U(r,i)||!T(i,n)?!1:x(e,n)}finally{o.release()}}function B(e,r,t){let n=r.pid??process.pid,o=t.randomToken(),i=r.processIdentity===void 0?t.readProcessIdentity(n):r.processIdentity,s={protocol:R,version:E,kind:r.kind,pid:n,token:o,...i?{processIdentity:i}:{},startedAt:new Date(t.wallNow()).toISOString(),...r.detail?{detail:r.detail}:{}},c=`${e}.${o}.candidate`,l=t.openFile(c,"wx",384),a;try{P(l,Buffer.from(`${JSON.stringify(s)}
2
- `),t,"process lock"),t.syncFile(l)}catch(u){a=u}try{t.closeFile(l)}catch(u){a??=u}if(a!==void 0)throw I(c,t),a;try{t.linkFile(c,e)}catch(u){throw I(c,t),u}I(c,t);try{$(L(e),t)}catch(u){throw W(e,s,t),u}let d=!1;return{path:e,record:s,release:()=>d?!1:(d=!0,W(e,s,t))}}function W(e,r,t=w){let n=b(e,{runtime:t});return n.state!=="valid"||!n.record||n.record.pid!==r.pid||n.record.token!==r.token||r.processIdentity&&(!n.record.processIdentity||!m(r.processIdentity,n.record.processIdentity))?!1:x(e,t)}function Ee(e,r){for(let t=0;t<2;t+=1)try{return B(e,{kind:"reclaim-guard",runtime:r},r)}catch(n){if(n.code!=="EEXIST")return null;let o=b(e,{runtime:r});if(t>0||!T(o,r))return null;let i=b(e,{runtime:r});if(!U(o,i)||!x(e,r))return null}return null}function T(e,r){if(e.state==="missing")return!1;if(e.owner){if(!r.isProcessAlive(e.owner.pid))return!0;if(!e.owner.processIdentity)return!1;let t=r.readProcessIdentity(e.owner.pid);return t!==null&&!m(e.owner.processIdentity,t)}return!1}function U(e,r){return e.state===r.state&&e.raw===r.raw&&e.identity!==void 0&&r.identity!==void 0&&e.identity.dev===r.identity.dev&&e.identity.ino===r.identity.ino&&e.identity.size===r.identity.size&&e.identity.mtimeMs===r.identity.mtimeMs}function Te(e){return{pid:e.pid,...e.processIdentity?{processIdentity:e.processIdentity}:{}}}function $(e,r){let t;try{t=r.openFile(e,"r")}catch(n){if(S(n,process.platform))return;throw n}try{r.syncFile(t)}catch(n){if(!S(n,process.platform))throw n}finally{r.closeFile(t)}}function x(e,r){try{return r.removeFile(e),$(L(e),r),!0}catch{return!1}}function I(e,r){try{r.removeFile(e)}catch{}}var Le=Object.freeze(["EPERM","EACCES","EBUSY"]),xe=Object.freeze([10,20,40,80,160,320,640,1e3,1e3,1e3]);function Oe(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var O=Object.freeze({platform:process.platform,sleep:Oe});function ve(e,r){if(r!=="win32")return!1;let t=e?.code;return typeof t=="string"&&Le.includes(t)}function J(e,r={}){let t=r.runtime??O,n=r.delaysMs??xe;for(let o of n)try{return e()}catch(i){if(!ve(i,t.platform))throw i;t.sleep(o)}return e()}import{execFileSync as z,spawnSync as _r}from"child_process";import{platform as Be}from"os";import{resolve as Ue}from"path";import{createHash as he}from"crypto";import{existsSync as q,renameSync as De,rmSync as Ae,writeFileSync as _e}from"fs";import{tmpdir as Ne}from"os";import{join as Me}from"path";var G=`'use strict';
3
- const NativeRegExp = globalThis.RegExp;
4
- const escapeLoneSeparator = (args) =>
5
- typeof args[0] === 'string' && args[0] === '\\\\' ? ['\\\\\\\\', ...args.slice(1)] : args;
6
- globalThis.RegExp = new Proxy(NativeRegExp, {
7
- construct(target, args) {
8
- return Reflect.construct(target, escapeLoneSeparator(args));
9
- },
10
- apply(target, thisArg, args) {
11
- return Reflect.apply(target, thisArg, escapeLoneSeparator(args));
12
- },
13
- });
14
- `,Ce=/scip-python/i;function j(e,r=process.platform){return r!=="win32"||!Ce.test(e)?[]:["--require",We()]}function We(e=Ne()){let r=he("sha256").update(G).digest("hex").slice(0,16),t=Me(e,`codebaseiq-indexer-compat-${r}.cjs`);if(q(t))return t;let n=`${t}.${process.pid}.tmp`;_e(n,G);try{De(n,t)}catch{if(Ae(n,{force:!0}),!q(t))throw new Error(`could not materialize indexer compatibility preload at ${t}`)}return t}var Y=Be()==="win32";function Wr(e){let r=Y?"where":"which";try{return z(r,[e],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var $e=/\.(?:c|m)?js$/i,Je=/\.(?:exe|com)$/i;function Br(e,r){return $e.test(e)?{binary:process.execPath,args:[...j(e),e,...r]}:{binary:e,args:[...r]}}function qe(e,r){return z(e,r,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL"})}function Ur(e,r={}){let t=r.isWindows??Y,n=r.lookup??qe,o;try{o=n(t?"where":"which",[e])}catch{return null}let i=o.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(!t){let s=i[0];return s?Ue(s):null}return i.find(s=>Je.test(s))??null}import{chmodSync as Ge,constants as je,copyFileSync as ze}from"fs";import{dirname as Ye}from"path";var K=Object.freeze({...A,copyFile:(e,r)=>ze(e,r,je.COPYFILE_FICLONE),chmodFile:(e,r)=>Ge(e,r)});function Ke(e,r,t={}){let n=t.runtime??K,o=Ye(r),i=p(o,n);if(n.copyFile(e,r),n.platform==="win32")Xe(r,t.mode,n);else{t.mode!==void 0&&n.chmodFile(r,t.mode);let s=n.openFile(r,"r");try{n.syncFile(s)}finally{n.closeFile(s)}}return y(i,f(o,n))}function Xe(e,r,t){let n=!1,o;try{o=t.openFile(e,"r+")}catch(i){let s=i.code;if(s!=="EACCES"&&s!=="EPERM")throw i;t.chmodFile(e,384),n=!0,o=t.openFile(e,"r+")}try{t.syncFile(o)}finally{t.closeFile(o)}r!==void 0?t.chmodFile(e,r):n&&t.chmodFile(e,292)}import{randomUUID as He}from"crypto";import{closeSync as Ve,existsSync as Qe,fsyncSync as Ze,linkSync as er,mkdirSync as rr,openSync as tr,renameSync as nr,unlinkSync as or,writeSync as ir}from"fs";import{dirname as X}from"path";var H=Object.freeze({platform:process.platform,randomToken:()=>He(),pathExists:e=>Qe(e),makeDirectory:e=>rr(e,{recursive:!0}),openFile:(e,r,t)=>tr(e,r,t),writeFile:(e,r,t,n)=>ir(e,r,t,n),syncFile:e=>Ze(e),closeFile:e=>Ve(e),renameFile:(e,r)=>nr(e,r),linkFile:(e,r)=>er(e,r),removeFile:e=>or(e)});function Qr(e,r,t={}){let n=t.durability??"visibility",o=t.runtime??H,i=X(e),s=n==="durable"?p(i,o):(o.makeDirectory(i),"not-requested"),c=`${e}.tmp-${o.randomToken()}`,l=typeof r=="string"?Buffer.from(r):r,a,d=!1;try{a=o.openFile(c,"wx",t.mode??384),d=!0,P(a,l,o,"atomic file"),n==="durable"&&o.syncFile(a),o.closeFile(a),a=void 0,J(()=>o.renameFile(c,e),{runtime:{platform:o.platform,sleep:o.sleep??O.sleep}}),d=!1;let u=n==="durable"?y(s,f(i,o)):"not-requested";return V(n,u)}finally{if(a!==void 0)try{o.closeFile(a)}catch{}if(d)try{o.removeFile(c)}catch{}}}function Zr(e,r,t={}){let n=t.durability??"visibility",o=t.runtime??H;if(!o.linkFile)throw new Error("Exclusive atomic file publication requires hard-link support.");let i=X(e),s=n==="durable"?p(i,o):(o.makeDirectory(i),"not-requested"),c=`${e}.tmp-${o.randomToken()}`,l=typeof r=="string"?Buffer.from(r):r,a,d=!1;try{a=o.openFile(c,"wx",t.mode??384),d=!0,P(a,l,o,"exclusive atomic file"),n==="durable"&&o.syncFile(a),o.closeFile(a),a=void 0,o.linkFile(c,e);let u=n==="durable"?f(i,o):"not-requested";o.removeFile(c),d=!1;let se=n==="durable"?y(s,u,f(i,o)):"not-requested";return V(n,se)}finally{if(a!==void 0)try{o.closeFile(a)}catch{}if(d)try{o.removeFile(c)}catch{}}}function V(e,r){return{requestedDurability:e,achievedDurability:e==="visibility"?"visibility":r==="synced"?"directory-durable":"file-flushed",directorySync:r}}import{execFileSync as ee}from"child_process";import{platform as sr}from"os";var re=1e3,te=2*1024*1024,cr=25;function st(e,r,t=ie){let n=t.readIdentity(e),o=new Map;return n&&o.set(e,n),{rootPid:e,rootIdentity:n,ownsProcessGroup:r,knownMembers:o}}async function ct(e,r,t=ie){if(!e.rootIdentity){let l=await g(e,r.gracefulMs+r.forceMs,t);return{reaped:l,reason:l?"terminated":"identity-unavailable",detail:l?void 0:`Could not establish the birth identity of process ${e.rootPid}.`}}let n=ne(e,t);if(n==="mismatch")return{reaped:!1,reason:"identity-mismatch",detail:`Process ${e.rootPid} no longer has the identity owned by this runner.`};if(n==="exited"&&!oe(e,t))return{reaped:!0,reason:"terminated"};if(t.platform==="win32"){try{t.terminateWindowsTree(e.rootPid)}catch(a){let d=await g(e,r.forceMs,t);return{reaped:d,reason:d?"terminated":"signal-failed",detail:d?void 0:v(a)}}let l=await g(e,r.forceMs,t);return{reaped:l,reason:l?"terminated":"deadline"}}let o=Q(e,"SIGTERM",t);if(await g(e,r.gracefulMs,t))return{reaped:!0,reason:"terminated"};let s=Q(e,"SIGKILL",t);return await g(e,r.forceMs,t)?{reaped:!0,reason:"terminated"}:s?{reaped:!1,reason:s.reason,detail:s.detail}:o?{reaped:!1,reason:o.reason,detail:o.detail}:{reaped:!1,reason:"deadline",detail:`Process tree ${e.rootPid} did not exit before its termination deadline.`}}function ne(e,r){let t=r.readIdentity(e.rootPid);if(!t)return"exited";if(!e.rootIdentity||!m(e.rootIdentity,t))return"mismatch";e.knownMembers.set(e.rootPid,t);for(let n of r.listDescendantPids(e.rootPid)){let o=r.readIdentity(n);o&&e.knownMembers.set(n,o)}return"owned"}function Q(e,r,t){let n=ne(e,t);if(n==="mismatch")return{reason:"identity-mismatch",detail:`Process ${e.rootPid} changed identity before ${r}.`};if(n==="owned"&&e.ownsProcessGroup)try{return t.signal(-e.rootPid,r),null}catch(i){if(!Z(i))return{reason:"signal-failed",detail:v(i)}}let o=null;for(let i of e.knownMembers.values()){let s=t.readIdentity(i.pid);if(!(!s||!m(i,s)))try{t.signal(i.pid,r)}catch(c){!Z(c)&&o===null&&(o=v(c))}}return o===null?null:{reason:"signal-failed",detail:o}}async function g(e,r,t){let n=t.now()+r;for(;oe(e,t);){if(t.now()>=n)return!1;await t.sleep(Math.min(cr,Math.max(1,n-t.now())))}return!0}function oe(e,r){if(!e.rootIdentity&&r.isProcessAlive(e.rootPid))return!0;for(let t of e.knownMembers.values()){let n=r.readIdentity(t.pid);if(n&&m(t,n))return!0}return!!(e.ownsProcessGroup&&r.isProcessGroupAlive(e.rootPid))}function ar(e){let r=ee("ps",["-axo","pid=,ppid="],{encoding:"utf8",timeout:re,maxBuffer:te,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0}),t=new Map;for(let s of r.split(/\r?\n/)){let c=/^\s*(\d+)\s+(\d+)\s*$/.exec(s);if(!c)continue;let l=Number(c[1]),a=Number(c[2]),d=t.get(a)??[];d.push(l),t.set(a,d)}let n=[],o=[...t.get(e)??[]],i=new Set;for(;o.length>0;){let s=o.pop();i.has(s)||(i.add(s),n.push(s),o.push(...t.get(s)??[]))}return n}function Z(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ESRCH"}function v(e){return e instanceof Error?e.message:String(e)}var ie={platform:sr(),now:Date.now,readIdentity:F,isProcessAlive(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}},isProcessGroupAlive(e){if(this.platform==="win32")return!1;try{return process.kill(-e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}},listDescendantPids(e){if(this.platform==="win32")return[];try{return ar(e)}catch{return[]}},signal(e,r){process.kill(e,r)},terminateWindowsTree(e){ee("taskkill.exe",["/PID",String(e),"/T","/F"],{timeout:re,maxBuffer:te,stdio:"ignore",windowsHide:!0})},async sleep(e){await new Promise(r=>setTimeout(r,e))}};export{k as a,m as b,F as c,C as d,br as e,Er as f,b as g,Re as h,J as i,Ke as j,Qr as k,Zr as l,Wr as m,Br as n,Ur as o,st as p,ct as q};
15
- //# sourceMappingURL=chunk-CANBLFVQ.js.map
@@ -1,2 +0,0 @@
1
- import{a as R}from"./chunk-MTMF4N7F.js";import{d as Y,e as U,f as H,m as z}from"./chunk-BH5CE4LN.js";import{c as K,t as T,u as X}from"./chunk-AM5SUGHF.js";import{f as k,j as N,k as E,p as A}from"./chunk-JOALNFY3.js";import{C as w}from"./chunk-RVYLJDXC.js";import{w as G}from"./chunk-PLZXWZHY.js";import{C as V,F as q,d as M}from"./chunk-327YK6TB.js";var J=new WeakMap,ee=new WeakMap,te=new WeakMap,ne=new WeakMap,re=new WeakMap;function Ve(t,e){let n=ee.get(t);n||(n=new Map,ee.set(t,n));let i=n.get(e);if(i)return i;let r=w(t,e)?.rootNode;if(!r)return n.set(e,[]),[];let o=new Set;I(r,c=>{if(c.type!=="call_expression")return;let p=c.childForFieldName("function")??c.namedChild(0),s=/^([A-Za-z_$][\w$]*(?:\.Service)?)\.of$/u.exec(p?.text.replace(/\s+/gu,"")??"");s&&o.add(s[1])});let m=A(t,e).filter(c=>!!c.sourcePath),u=new Set;for(let c of o){let p=/^([A-Za-z_$][\w$]*)\.Service$/u.exec(c);if(p){for(let s of m)s.localName===p[1]&&u.add(s.sourcePath);continue}if(c==="Service"){T(t,e).some(s=>s.leaf==="Service")&&u.add(e);for(let s of m)(s.localName??s.importedName)==="Service"&&u.add(s.sourcePath)}}let l=B([...u]).sort();return n.set(e,l),l}function qe(t,e,n={}){let r=E(t,e)?.filter(a=>!n.ranges||n.ranges.some(d=>a.line>=d.startLine&&a.line<=d.endLine));if(!r)return{targets:[],unresolvedCallsites:0};let o=A(t,e).filter(a=>!!a.sourcePath),m=_e(G(t,e)??""),u=w(t,e)?.rootNode??null,l=u?pe(u):ie(),c=new Map,p=H(t),s=[],f=0;for(let a of r){if(!a.memberAccess)continue;let d=Y(e,p.get(a.calleeLeaf)??[]);if(n.excludeIndexedTargets!==!1&&U(t,e,d,!0,a.calleeQualifier))continue;let h=a.calleeQualifier,L=Pe(t,e,a,o);if(L){s.push(L);continue}let S=de(t,e,a,o,ge(l,a.calleeQualifier,a.line));if(S.length>0){s.push(...S);continue}let x=he(t,e,a);if(x.length>0){s.push(...x);continue}let y=h?m.get(h)??h:null,P=(y?B(o.filter(g=>(g.localName??g.importedName)===y).map(g=>g.sourcePath)):[]).flatMap(g=>{let v=c.get(g);return v||(v=N(t,g)??[],c.set(g,v)),v.filter(b=>b.name===a.calleeLeaf).map(b=>({file:g,callable:b}))});if(P.length!==1){f+=1;continue}let _=P[0];s.push({calleeLeaf:a.calleeLeaf,line:a.line,sourceFile:e,targetFile:_.file,targetStartLine:_.callable.startLine,targetEndLine:_.callable.endLine,resolution:"direct-import-receiver",strength:"candidate"})}return{targets:s,unresolvedCallsites:f}}function de(t,e,n,i,r){let o=n.calleeQualifier;if(!o||!/^[A-Za-z_$][\w$]*$/u.test(o))return[];if(r.size!==1)return[];let m=[...r][0],u=B(i.filter(p=>p.localName===m||p.importedName===m).map(p=>p.sourcePath));if(u.length!==1)return[];let l=u[0],c=xe(t,l,n.calleeLeaf);return c.map(p=>({calleeLeaf:p.name,line:n.line,sourceFile:e,targetFile:p.file,targetStartLine:p.startLine,targetEndLine:p.endLine,serviceFile:l,resolutionAlternativeCount:c.length,resolution:"imported-service-object-member",strength:"candidate"}))}function ie(){return{declarations:new Map,callbacks:[]}}function pe(t){let e=ie();return I(t,n=>{if(n.type==="variable_declarator"){let l=n.childForFieldName("name")??n.namedChild(0),c=n.childForFieldName("value")??n.namedChild(1);if(l?.type!=="identifier"||!c)return;let p=new Set;if(I(c,s=>{if(s.type!=="member_expression")return;let f=s.childForFieldName("object")??s.namedChild(0),a=s.childForFieldName("property")??s.namedChild(1);f?.type==="identifier"&&a?.text==="Service"&&p.add(f.text)}),p.size===1){let s=e.declarations.get(l.text)??[];s.push({line:n.startPosition.row,alias:[...p][0]}),e.declarations.set(l.text,s)}return}if(!["arrow_function","function_expression","generator_function"].includes(n.type))return;let i=n.childForFieldName("parameters")??n.childForFieldName("parameter");if(!i)return;let r=n.parent;for(;r&&r.type!=="call_expression";)r=r.parent;if(!r)return;let o=r.childForFieldName("function")??r.namedChild(0),m=/^([A-Za-z_$][\w$]*)\.Service\.use$/u.exec(o?.text??"");if(!m)return;let u=new Set;I(i,l=>{l.type==="identifier"&&u.add(l.text)}),u.size!==0&&e.callbacks.push({startLine:n.startPosition.row,endLine:n.endPosition.row,receivers:u,alias:m[1]})}),e}function ge(t,e,n){if(!e||!/^[A-Za-z_$][\w$]*$/u.test(e))return new Set;let i=new Set((t.declarations.get(e)??[]).filter(r=>r.line<=n).map(r=>r.alias));for(let r of t.callbacks)r.startLine<=n&&r.endLine>=n&&r.receivers.has(e)&&i.add(r.alias);return i}function he(t,e,n){let i=n.calleeQualifier;if(!i||!/^[A-Za-z_$][\w$]*$/u.test(i))return[];let r=w(t,e)?.rootNode;if(!r)return[];let o=ye(t,e,r,n.line,n.calleeLeaf,i),m=o?Se(o,i):null;if(!m)return[];if(!Le(m))return[];let u=(N(t,e)??[]).filter(a=>a.startLine<=m.startPosition.row&&a.endLine>=m.endPosition.row).sort((a,d)=>a.endLine-a.startLine-(d.endLine-d.startLine))[0];if(!u)return[];let l=T(t,e).filter(a=>a.isFunctionLike&&a.leaf===u.name);if(l.length!==1)return[];let c=l[0],p=ne.get(t);p||(p=new Map,ne.set(t,p));let s=`${c.symbol}\0${n.calleeLeaf}`,f=p.get(s);if(!f){let a=[];for(let d of z(t,c)){let h=w(t,d.file)?.rootNode;if(!h)continue;let L=h.descendantsOfType("call_expression").filter(y=>y.startPosition.row>d.line||y.endPosition.row<d.line?!1:(y.childForFieldName("function")??y.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,"").match(/[A-Za-z_$][\w$]*$/u)?.[0]===c.leaf);if(L.length!==1)continue;let x=L[0].childForFieldName("arguments")?.namedChildren.find(y=>F(y).type==="object");if(x)for(let y of F(x).namedChildren){if(y.type==="shorthand_property_identifier"&&y.text===n.calleeLeaf){a.push(...D(t,d.file,n.calleeLeaf,y,y));continue}if(y.type!=="pair")continue;let $=y.childForFieldName("key")??y.namedChild(0),P=y.childForFieldName("value")??y.namedChild(1);O($?.text)!==n.calleeLeaf||!P||a.push(...D(t,d.file,n.calleeLeaf,P,y))}}f=a.filter((d,h,L)=>L.findIndex(S=>S.file===d.file&&S.startLine===d.startLine&&S.endLine===d.endLine&&S.name===d.name)===h),p.set(s,f)}return f.map(a=>({calleeLeaf:a.name,line:n.line,sourceFile:e,targetFile:a.file,targetStartLine:a.startLine,targetEndLine:a.endLine,resolutionAlternativeCount:f.length,resolution:"factory-callback-member",strength:f.length===1?"exact":"candidate"}))}function ye(t,e,n,i,r,o){let m=te.get(t);m||(m=new Map,te.set(t,m));let u=m.get(e);if(!u){u=new Map;for(let l of n.descendantsOfType("call_expression")){let c=l.childForFieldName("function")??l.namedChild(0),p=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(c?.text.replace(/\s+/gu,"")??"");if(p)for(let s=l.startPosition.row;s<=l.endPosition.row;s+=1){let f=`${s}\0${p[1]}\0${p[2]}`,a=u.get(f);(!a||l.endIndex-l.startIndex<a.endIndex-a.startIndex)&&u.set(f,l)}}m.set(e,u)}return u.get(`${i}\0${o}\0${r}`)??null}function Le(t){return t.descendantsOfType("return_statement").some(e=>{let n=e.childForFieldName("argument")??e.namedChild(0);return!!(n&&F(n).type==="object")})}function Se(t,e){let n=t.parent;for(;n;){if(/(?:function|method|lambda)/u.test(n.type)||n.type==="arrow_function"){let i=n.childForFieldName("parameters")??n.childForFieldName("parameter"),r=!1;if(i&&I(i,o=>{o.type==="identifier"&&o.text===e&&(r=!0)}),r)return n}n=n.parent}return null}function D(t,e,n,i,r){if(i.type==="identifier")return(N(t,e)??[]).filter(l=>l.name===i.text).map(l=>({...l,file:e}));let o=j(t,e,i.text);if(o.length>0)return o;if(!Z(i))return[];let u=(N(t,e)??[]).filter(l=>l.startLine>=r.startPosition.row&&l.endLine<=r.endPosition.row&&(l.name===n||l.name.startsWith("source@"))).sort((l,c)=>l.endLine-l.startLine-(c.endLine-c.startLine))[0];return[u?{...u,file:e}:{name:n,file:e,startLine:r.startPosition.row,endLine:r.endPosition.row}]}function xe(t,e,n){let i=re.get(t);i||(i=new Map,re.set(t,i));let r=`${e}\0${n}`,o=i.get(r);if(o)return o;let m=Ne(t,e).flatMap(u=>be(t,u,e,n));return i.set(r,m),m}function be(t,e,n,i){let r=w(t,e)?.rootNode,o=N(t,e)??[];if(!r)return[];let m=ve(t,e,n);if(m.size===0)return[];let u=new Set,l=[],c=[],p=[];return I(r,f=>{if(Ce(f,m)){if(f.type==="pair"){let a=f.childForFieldName("key")??f.namedChild(0),d=f.childForFieldName("value")??f.namedChild(1);if(O(a?.text)!==i||!d)return;if(d.type==="identifier")u.add(d.text);else if(Z(d))l.push({name:i,startLine:f.startPosition.row,endLine:f.endPosition.row});else{let h=we(t,e,d.text),L=j(t,e,d.text);if(h.length>0)p.push(...h);else if(L.length>0)p.push(...L);else{let S=Ie(f);S&&c.push(S)}}return}f.type==="shorthand_property_identifier"&&f.text===i&&u.add(i)}}),[...o.filter(f=>u.has(f.name)).map(f=>({...f,file:e})),...l.map(f=>({...f,file:e})),...c.map(f=>({...f,file:e})),...p].filter((f,a,d)=>d.findIndex(h=>h.file===f.file&&h.name===f.name&&h.startLine===f.startLine&&h.endLine===f.endLine)===a)}function Ce(t,e){let n=t,i=null;for(;n;){if(n.type==="object"&&(i=n),n.type==="call_expression"){if(!i)return!1;let r=n.childForFieldName("function")??n.namedChild(0);return r?e.has(r.text.replace(/\.of$/u,""))&&r.text.endsWith(".of"):!1}n=n.parent}return!1}function Ne(t,e){let n=J.get(t);n||(n=new Map,J.set(t,n));let i=n.get(e);if(i)return i;let r=new Set([e]),o=T(t,e).filter(u=>u.leaf==="Service"&&u.isTypeLike);for(let u of o)for(let l of z(t,u))r.add(l.file);let m=[...r].sort();return n.set(e,m),m}function ve(t,e,n){let i=new Set;M(e,n)&&i.add("Service");for(let r of A(t,e)){if(!r.sourcePath||!M(r.sourcePath,n))continue;if(r.kind==="namespace"&&r.localName){i.add(`${r.localName}.Service`);continue}(r.importedName==="default"?r.localName:r.importedName)==="Service"?i.add(r.localName??r.importedName):r.localName&&r.importedName!=="default"&&i.add(`${r.localName}.Service`)}return i}function j(t,e,n){let i=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!i)return[];let r=w(t,e)?.rootNode;if(!r)return[];let o=ae(r,i[1]),m=o?se(o):null;if(!m)return[];let u=m.childForFieldName("function")??m.namedChild(0),l=u?oe(t,e,u.text):[];if(l.length!==1)return[];let c=l[0],p=w(t,c.relativePath)?.rootNode;if(!p)return[];let s=le(p,c.startLine,c.endLine);if(!s)return[];let f=[];for(let a of s.descendantsOfType("return_statement")){let d=a.childForFieldName("argument")??a.namedChild(0);if(!d)continue;let h=F(d);if(h.type==="object")for(let L of h.namedChildren){if(L.type==="shorthand_property_identifier"&&L.text===i[2]){for(let y of N(t,c.relativePath)??[])y.name===i[2]&&f.push({...y,file:c.relativePath});continue}if(L.type!=="pair")continue;let S=L.childForFieldName("key")??L.namedChild(0),x=L.childForFieldName("value")??L.namedChild(1);if(!(O(S?.text)!==i[2]||!x))if(x.type==="identifier")for(let y of N(t,c.relativePath)??[])y.name===x.text&&f.push({...y,file:c.relativePath});else Z(x)&&f.push({name:i[2],startLine:L.startPosition.row,endLine:L.endPosition.row,file:c.relativePath})}}return f.filter((a,d,h)=>h.findIndex(L=>L.file===a.file&&L.name===a.name&&L.startLine===a.startLine&&L.endLine===a.endLine)===d)}function we(t,e,n){let i=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!i)return[];let r=w(t,e)?.rootNode;if(!r)return[];let o=ae(r,i[1]),m=o?se(o):null,u=m?.childForFieldName("function")??m?.namedChild(0),l=u?oe(t,e,u.text):[];if(l.length!==1||!m)return[];let c=l[0],p=w(t,c.relativePath)?.rootNode;if(!p)return[];let s=le(p,c.startLine,c.endLine);if(!s)return[];let f=new Set,a=s.childForFieldName("parameters")??s.childForFieldName("parameter");if(a&&I(a,g=>{g.type==="identifier"&&f.add(g.text)}),f.size===0)return[];let d=j(t,e,n);if(d.length===0)return[];let h=(N(t,c.relativePath)??[]).filter(g=>g.startLine>=c.startLine&&g.endLine<=c.endLine),L=(E(t,c.relativePath)??[]).filter(g=>g.line>=c.startLine&&g.line<=c.endLine),S=new Set,x=d.map(g=>({name:g.name,startLine:g.startLine,endLine:g.endLine})),y=new Set;for(;x.length>0&&y.size<32;){let g=x.shift(),v=`${g.name}\0${g.startLine}\0${g.endLine}`;if(!y.has(v)){y.add(v);for(let b of L.filter(C=>C.line>=g.startLine&&C.line<=g.endLine)){if(b.memberAccess&&b.calleeQualifier&&f.has(b.calleeQualifier)){S.add(b.calleeLeaf);continue}if(b.memberAccess)continue;let C=h.filter(me=>me.name===b.calleeLeaf);C.length===1&&x.push(C[0])}}}if(S.size===0)return[];let P=m.childForFieldName("arguments")?.namedChildren.find(g=>F(g).type==="object");if(!P)return[];let _=[];for(let g of F(P).namedChildren){if(g.type==="shorthand_property_identifier"&&S.has(g.text)){_.push(...D(t,e,g.text,g,g));continue}if(g.type!=="pair")continue;let v=g.childForFieldName("key")??g.namedChild(0),b=g.childForFieldName("value")??g.namedChild(1),C=O(v?.text);!C||!S.has(C)||!b||_.push(...D(t,e,C,b,g))}return _.filter((g,v,b)=>b.findIndex(C=>C.file===g.file&&C.name===g.name&&C.startLine===g.startLine&&C.endLine===g.endLine)===v)}function ae(t,e){for(let n of t.descendantsOfType("variable_declarator"))if((n.childForFieldName("name")??n.namedChild(0))?.text===e)return n.childForFieldName("value")??n.namedChild(1);return null}function se(t){return t.type==="call_expression"?t:t.descendantsOfType("call_expression")[0]??null}function oe(t,e,n){let i=n.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,""),r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(i);if(r){let s=A(t,e).filter(d=>d.localName===r[1]&&d.sourcePath);if(s.length!==1||!s[0].sourcePath)return[];let f=s[0].sourcePath,a=R(t,f,r[2]).filter(d=>d.isFunctionLike);return a.length>0?a:(N(t,f)??[]).filter(d=>d.name===r[2]).map(d=>({...d,relativePath:f}))}if(!/^[A-Za-z_$][\w$]*$/u.test(i))return[];let o=T(t,e).filter(s=>s.leaf===i&&s.isFunctionLike);if(o.length>0)return o;let m=(N(t,e)??[]).filter(s=>s.name===i).map(s=>({...s,relativePath:e}));if(m.length>0)return m;let u=A(t,e).filter(s=>s.localName===i&&s.sourcePath&&s.kind!=="namespace");if(u.length!==1||!u[0].sourcePath)return[];let l=u[0].sourcePath,c=u[0].importedName==="default"?i:u[0].importedName,p=R(t,l,c).filter(s=>s.isFunctionLike);return p.length>0?p:(N(t,l)??[]).filter(s=>s.name===c).map(s=>({...s,relativePath:l}))}function le(t,e,n){let i=null;return I(t,r=>{!/(?:function|method|lambda)/u.test(r.type)&&r.type!=="arrow_function"||r.startPosition.row>e||r.endPosition.row<n||(!i||r.endIndex-r.startIndex<i.endIndex-i.startIndex)&&(i=r)}),i}function Z(t){return["arrow_function","function_expression","generator_function"].includes(t.type)||t.descendantsOfType(["arrow_function","function_expression","generator_function"]).length>0}function Ie(t){let e=t.parent;for(;e;){if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0);if(n?.type==="identifier")return{name:n.text,startLine:e.startPosition.row,endLine:e.endPosition.row}}e=e.parent}return null}function O(t){return t?t.replace(/^(?:['"])(.*)(?:['"])$/u,"$1"):null}function Pe(t,e,n,i){let r=/^this\.([A-Za-z_$][\w$]*)$/u.exec(n.calleeQualifier??"");if(!r)return null;let o=w(t,e)?.rootNode;if(!o)return null;let m=$e(o,n.line);if(!m)return null;let u=new Set;if(I(m,h=>{if(h.type!=="assignment_expression")return;let L=h.childForFieldName("left")??h.namedChild(0),S=h.childForFieldName("right")??h.namedChild(h.namedChildCount-1);if(L?.text.replace(/\s+/gu,"")!==`this.${r[1]}`||!S)return;let x=F(S);if(x.type!=="new_expression")return;let $=(x.childForFieldName("constructor")??x.namedChild(0))?.text.match(/[A-Za-z_$][\w$]*$/u)?.[0];$&&u.add($)}),u.size!==1)return null;let l=[...u][0],c=i.filter(h=>h.localName===l);if(c.length!==1)return null;let p=c[0].importedName==="default"?l:c[0].importedName,s=c[0].importedName==="default"?R(t,c[0].sourcePath,l):[],f=s.length===1?s[0].leaf:p,a=T(t,c[0].sourcePath).filter(h=>h.isFunctionLike&&h.leaf===n.calleeLeaf&&K(h.symbol)===f);if(a.length!==1)return null;let d=a[0];return{calleeLeaf:n.calleeLeaf,line:n.line,sourceFile:e,targetFile:d.relativePath,targetStartLine:d.startLine,targetEndLine:d.endLine,targetSymbol:d.symbol,resolution:"constructed-member-receiver",strength:"exact"}}function $e(t,e){let n=[];return I(t,i=>{["class","class_declaration","class_definition"].includes(i.type)&&i.startPosition.row<=e&&i.endPosition.row>=e&&n.push(i)}),n.sort((i,r)=>i.endPosition.row-i.startPosition.row-(r.endPosition.row-r.startPosition.row))[0]??null}function F(t){let e=t;for(;["parenthesized_expression","as_expression","type_assertion","satisfies_expression"].includes(e.type)&&e.namedChildCount===1;)e=e.namedChild(0);return e}function I(t,e){e(t);for(let n of t.namedChildren)I(n,e)}function _e(t){let e=new Map,n=/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*;/gu;for(let i of t.matchAll(n)){let r=i[1],o=i[2];r&&o&&e.set(r,o)}return e}function B(t){let e=[];for(let n of t)e.some(i=>M(i,n))||e.push(n);return e}import{existsSync as Ae}from"fs";import{SymbolRole as Te}from"@c4312/scip";import{deserializeSCIP as Fe}from"@c4312/scip";function ce(t,e){return Fe(q(t,{inputKind:e,maxBytes:V}))}var W=new WeakMap;function nt(t,e,n,i){let r=k(t,e),o=(r?.callSites??[]).filter(a=>a.line>=n&&a.line<=i);if(!r||o.length===0)return{available:!!r,targets:[],resolvedCallsites:0,unresolvedCallsites:0};let m=Q(t);if(!m)return{available:!1,targets:[],resolvedCallsites:0,unresolvedCallsites:o.length};let u=(m.byFile.get(e)??[]).filter(a=>a.sourceLine>=n&&a.sourceLine<=i).map(a=>({...a,calleeLeaf:a.definition.leaf})),l=ue(o.map(a=>({line:a.line,leaf:a.calleeLeaf}))),c=ue(u.map(a=>({line:a.sourceLine,leaf:a.calleeLeaf}))),p=new Set([...l].flatMap(([a,d])=>c.get(a)===d?[a]:[])),s=u.filter(a=>p.has(fe(a.sourceLine,a.calleeLeaf))),f=[...p].reduce((a,d)=>a+(l.get(d)??0),0);return{available:!0,targets:s,resolvedCallsites:f,unresolvedCallsites:Math.max(0,o.length-f)}}function rt(t,e,n,i){let r=Q(t);return r?{available:!0,targets:(r.byFile.get(e)??[]).filter(o=>o.sourceLine>=n&&o.sourceLine<=i)}:{available:!1,targets:[]}}function it(t,e,n,i){let r=Q(t);return r?{available:!0,targets:(r.byFile.get(e)??[]).filter(o=>o.sourceLine>=n&&o.sourceLine<=i&&Re(t,o.definition)).map(o=>({...o,calleeLeaf:o.definition.leaf}))}:{available:!1,targets:[]}}function Q(t){if(W.has(t))return W.get(t)??null;let e=Me(t);return W.set(t,e),e}function Me(t){if(!t.generation.indexPath||!Ae(t.generation.indexPath))return null;try{let e=X(t),n=new Map(e.map(o=>[o.symbol,o])),i=ce(t.generation.indexPath,"SCIP source-range call-target index"),r=new Map;for(let o of i.documents??[]){let m=o.relativePath;if(!m||t.isIgnored(m))continue;let u=[];for(let l of o.occurrences??[]){if(!l.symbol||(l.symbolRoles&Te.Definition)!==0)continue;let c=n.get(l.symbol),p=l.range?.[0];!c||!Number.isInteger(p)||u.push({sourceLine:p,definition:c})}r.set(m,u)}return{byFile:r}}catch{return null}}function Re(t,e){if(!e.isFunctionLike)return!1;let n=k(t,e.relativePath);return!n||n.callables.some(i=>i.name===e.leaf&&i.startLine===e.startLine&&i.endLine===e.endLine)?!0:De(e)}function De(t){let e=t.documentation;if(!e)return!1;let n=t.leaf.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`\\bfunction\\s+${n}\\s*(?:<[^>]*>)?\\s*\\(`,"u").test(e)||new RegExp(`\\b(?:const|let|var)\\s+${n}\\s*:\\s*(?:<[^>]*>\\s*)?\\([^\\n]*\\)\\s*=>`,"u").test(e)}function ue(t){let e=new Map;for(let n of t){let i=fe(n.line,n.leaf);e.set(i,(e.get(i)??0)+1)}return e}function fe(t,e){return`${t}\0${e}`}export{Ve as a,qe as b,nt as c,rt as d,it as e,Re as f};
2
- //# sourceMappingURL=chunk-CCRZLRWJ.js.map