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
@@ -0,0 +1,278 @@
1
+ import{a as ne,c as re}from"./chunk-YTJHCGYB.js";import{a as jn}from"./chunk-ILMHV3KM.js";import{a as Qt,b as Kt,d as qe,e as nn}from"./chunk-O2M3VNDY.js";import{I as zt,J as Xt,K as Yt,M as Vt,Q as wn,R as Xe,T as Dn,U as Fn,V as kn,a as me,b as Ht,d as Jt}from"./chunk-K4S2VH42.js";import{b as Ot,c as Lt,e as X,f as ge,g as te,h as Ct,i as $t,j as Ut,k as Gt,l as Bt,r as he,s as rn}from"./chunk-EQNMD62X.js";import{a as ze,c as Se,d as _n,f as Tn}from"./chunk-4LK5OIPW.js";import{s as Be}from"./chunk-C6WKPKCF.js";import{A as ln,B as un,C as pn,D as gn,E as fn,F as mn,G as He,I as $,J as ye,K as hn,M as Je,N as yn,O as bn,P as be,S as Sn,T as Rn,U as xn,c as K,d as le,e as Ae,g as Me,h as Ce,i as Dt,j as D,l as jt,o as F,p as M,q as C,r as We,s as Zt,t as en,u as tn,v as an,w as on,x as sn,y as cn,z as dn}from"./chunk-T75DS2E6.js";import{e as fe}from"./chunk-YT4DVWUV.js";import{a as j,b as _t}from"./chunk-RCIGX23V.js";import{i as q,j as J,l as Ft,m as Ge,n as kt,r as Wt,s as qt,u as Pn,x as En,y as In,z as vn}from"./chunk-D7DOB27N.js";import{i as ue,j as Z}from"./chunk-R2NOK63J.js";import{a as S,c as Tt,d as ee,e as H}from"./chunk-6O3KXIDL.js";import{$ as Nt,E as $e,O as Ue,T as pe,Y as wt,Z as z,a as Pt,c as Q,f as A,g as se,ga as At,h as ce,ha as Mt,i as Et,n as It,o as vt,p as de,r as I}from"./chunk-UQYQBLJX.js";import{createHash as fo}from"crypto";import{existsSync as T,mkdirSync as je,readdirSync as Cr,renameSync as $r,rmSync as Y,statSync as mo}from"fs";import{basename as ke,dirname as h,extname as ho,join as v,resolve as Fr}from"path";import{execFileSync as Kr}from"child_process";import{constants as Zr,copyFileSync as On,statSync as ei}from"fs";import{platform as ti}from"os";var ni=Object.freeze({size:e=>ei(e).size,clone:ii,copy:(e,t)=>On(e,t)}),ri=new Set(["ENOSYS","ENOTSUP","EOPNOTSUPP","EINVAL","EXDEV","ENOTTY"]);function U(e,t,n=ni){let r=n.size(e);try{return n.clone(e,t),{method:"reflink",bytes:r}}catch(i){if(!oi(i))throw i}return n.copy(e,t),{method:"copy",bytes:r}}function ii(e,t){if(ti()!=="darwin"){On(e,t,Zr.COPYFILE_FICLONE_FORCE);return}try{Kr("/bin/cp",["-c",e,t],{timeout:6e4,maxBuffer:64*1024,stdio:["ignore","ignore","pipe"],windowsHide:!0})}catch(n){throw ai(n)}}function ai(e){let t=e?.stderr,n=Buffer.isBuffer(t)?t.toString("utf8"):t??"";return/operation not supported|not supported/i.test(n)?Object.assign(e instanceof Error?e:new Error(String(e)),{code:"ENOTSUP"}):/cross-device link/i.test(n)?Object.assign(e instanceof Error?e:new Error(String(e)),{code:"EXDEV"}):e}function oi(e){let t=e?.code;return t!==void 0&&ri.has(t)}function Ln(){return{reflinkedBytes:0,fallbackCopiedBytes:0}}function G(e,t){t.method==="reflink"?e.reflinkedBytes+=t.bytes:e.fallbackCopiedBytes+=t.bytes}import{dirname as si,join as ci}from"path";function Nn(e={}){return{id:"runtime-boundaries",facts:["runtime-boundary-observation","runtime-boundary-link"],run:({projectRoot:t,dbPath:n,onStatus:r})=>{let i=new F({projectRoot:t,dbPath:n,indexPath:e.indexPath??ci(si(n),"index.scip")}),a,o=!1,s=!1;try{let l=e.reuseExisting||e.affectedFiles?Vt(i):null;e.reuseExisting&&l?.extractorVersion===zt?(a=l,o=!0):(a=Xt(i,{...l?{previousGraph:l}:{},...e.affectedFiles?{affectedFiles:e.affectedFiles}:{}}),s=(a.coverage.filesReused??0)>0)}finally{i.close()}o||Yt(n,a);let c={reused:o,incrementallyUpdated:s,observations:a.observations.length,links:a.links.length,frontiers:a.frontiers.length,filesScanned:a.coverage.filesScanned,errors:a.coverage.extractionErrors.length,phases:a.coverage.phases};return r?.(c.reused?`Reused ${c.observations} cached runtime-boundary observation(s) and ${c.links} link(s).`:c.incrementallyUpdated?`Incrementally refreshed runtime-boundary observations (${c.filesScanned-(a.coverage.filesReused??0)} file(s) extracted, ${a.coverage.filesReused??0} reused) and rebuilt ${c.links} link(s).`:`Extracted ${c.observations} runtime-boundary observation(s), ${c.links} link(s), and ${c.frontiers} unresolved frontier(s).`),!o&&a.coverage.phases&&r?.(`Runtime-boundary phases: ${a.coverage.phases.map(l=>`${l.id} ${l.durationMs.toFixed(0)}ms`).join(", ")}.`),c}}}import{createHash as li}from"crypto";import{existsSync as ui}from"fs";import{dirname as pi,join as Mn}from"path";function Ye(e){let t=new Set;for(let n of e.uncertainty)t.add(n);e.projectIdentityChanged&&t.add("project-identity-changed");for(let n of e.changes)n.kind==="added"&&t.add("file-added"),n.kind==="deleted"&&t.add("file-deleted"),n.inputKind==="config"&&t.add("configuration-changed"),n.inputKind==="ambient"&&t.add("ambient-declaration-changed"),n.inputKind==="other"&&t.add("unclassified-input");return{fullProject:t.size>0,reasons:[...t].sort()}}function Re(e,t,n){let r=e.changes.map(s=>s.path).sort();if(r.length===0&&!e.projectIdentityChanged&&e.uncertainty.length===0)return{mode:"none",changedFiles:r,affectedFiles:[],reasons:[]};let i=new Set(n),a=Ye(e),o=new Set(a.reasons);return r.some(s=>!i.has(s))&&o.add("changed-file-outside-project"),t===null?(o.add("dependency-graph-unavailable"),An(r,i,o)):o.size>0?An(r,i,o):{mode:"closure",changedFiles:r,affectedFiles:di(r,t,i),reasons:[]}}function An(e,t,n){return{mode:"full-project",changedFiles:e,affectedFiles:[...t].sort(),reasons:[...n].sort()}}function di(e,t,n){let r=new Map;for(let[o,s]of t)if(n.has(o))for(let c of s){if(!n.has(c))continue;let l=r.get(c)??new Set;l.add(o),r.set(c,l)}let i=new Set(e),a=[...e];for(let o=0;o<a.length;o+=1){let s=a[o];if(s!==void 0)for(let c of r.get(s)??[])i.has(c)||(i.add(c),a.push(c))}return[...i].sort()}var gi="<global-symbols>";function fi(e){let t=[];for(let n of e.all(`
2
+ SELECT relative_path, language, position_encoding, text
3
+ FROM documents
4
+ `))t.push({relativePath:n.relative_path,kind:"document",values:[n.language,n.position_encoding,n.text]});for(let n of e.all(`
5
+ SELECT d.relative_path,
6
+ c.chunk_index,
7
+ c.start_line,
8
+ c.end_line,
9
+ hex(c.occurrences) AS occurrences_hex
10
+ FROM chunks c
11
+ JOIN documents d ON d.id = c.document_id
12
+ `))t.push({relativePath:n.relative_path,kind:"chunk",values:[n.chunk_index,n.start_line,n.end_line,n.occurrences_hex]});for(let n of e.all(`
13
+ SELECT d.relative_path,
14
+ r.start_line,
15
+ r.start_char,
16
+ r.end_line,
17
+ r.end_char,
18
+ g.symbol,
19
+ g.display_name,
20
+ g.kind,
21
+ g.documentation,
22
+ CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
23
+ g.enclosing_symbol,
24
+ CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
25
+ FROM defn_enclosing_ranges r
26
+ JOIN documents d ON d.id = r.document_id
27
+ JOIN global_symbols g ON g.id = r.symbol_id
28
+ `))t.push({relativePath:n.relative_path,kind:"definition",values:Ve(n,[n.start_line,n.start_char,n.end_line,n.end_char])});for(let n of e.all(`
29
+ SELECT d.relative_path,
30
+ c.chunk_index,
31
+ m.role,
32
+ g.symbol,
33
+ g.display_name,
34
+ g.kind,
35
+ g.documentation,
36
+ CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
37
+ g.enclosing_symbol,
38
+ CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
39
+ FROM mentions m
40
+ JOIN chunks c ON c.id = m.chunk_id
41
+ JOIN documents d ON d.id = c.document_id
42
+ JOIN global_symbols g ON g.id = m.symbol_id
43
+ `))t.push({relativePath:n.relative_path,kind:"mention",values:Ve(n,[n.chunk_index,n.role])});for(let n of e.all(`
44
+ SELECT g.symbol,
45
+ g.display_name,
46
+ g.kind,
47
+ g.documentation,
48
+ CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
49
+ g.enclosing_symbol,
50
+ CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
51
+ FROM global_symbols g
52
+ WHERE NOT EXISTS (
53
+ SELECT 1 FROM defn_enclosing_ranges r WHERE r.symbol_id = g.id
54
+ ) AND NOT EXISTS (
55
+ SELECT 1 FROM mentions m WHERE m.symbol_id = g.id
56
+ )
57
+ `))t.push({relativePath:gi,kind:"global-symbol",values:Ve(n)});return mi(t)}function mi(e){let t=new Map;for(let r of e){let i=JSON.stringify([r.kind,r.values]),a=t.get(r.relativePath)??[];a.push(i),t.set(r.relativePath,a)}let n=new Map;for(let[r,i]of[...t].sort(([a],[o])=>a.localeCompare(o))){let a=li("sha256");for(let o of i.sort())a.update(String(Buffer.byteLength(o))),a.update(":"),a.update(o),a.update(`
58
+ `);n.set(r,a.digest("hex"))}return n}function hi(e,t){let n=[],r=[],i=[],a=[],o=new Set([...e.keys(),...t.keys()]);for(let s of[...o].sort()){let c=e.get(s),l=t.get(s);c===void 0?n.push(s):l===void 0?i.push(s):c!==l?r.push(s):a.push(s)}return{addedFiles:n,modifiedFiles:r,deletedFiles:i,changedFiles:[...n,...r,...i].sort(),unchangedFiles:a}}function Qe(e,t,n){let r=new Set(e.affectedFiles),i=new Set(t.changedFiles),a=e.mode==="full-project"?[]:t.changedFiles.filter(c=>!r.has(c)),o=e.affectedFiles.filter(c=>!i.has(c)).sort(),s=t.changedFiles.length-a.length;return{passed:a.length===0,recall:t.changedFiles.length===0?1:s/t.changedFiles.length,affectedRatio:n===0?0:e.affectedFiles.length/n,predictedFiles:[...e.affectedFiles].sort(),actualFiles:[...t.changedFiles],missingFiles:a,extraFiles:o}}function Ke(e,t=xi){let n=t.wallNow===void 0&&t.monotonicNow===void 0,r=t.monotonicNow??t.now,i=t.wallNow??t.now,a=r(),o=(l,d)=>{let p=r();return qn(e.refreshResult,l,n?p:i(),Math.max(0,p-a),d)};if(!t.databaseExists(e.previousDbPath))return o("prior-index-unavailable");if(!t.databaseExists(e.candidateDbPath))return o("candidate-index-unavailable");let s=null,c=null;try{s=t.openDatabase(e.projectRoot,e.previousDbPath,e.previousIndexPath),c=t.openDatabase(e.projectRoot,e.candidateDbPath,e.candidateIndexPath);let l=[...new Set([...t.indexedPaths(s),...t.indexedPaths(c)])].sort(),d=de(e.previousSnapshot,e.currentSnapshot),p=new Set(l),u=d.changes.length>0&&!Ye(d).fullProject&&d.changes.every(_=>p.has(_.path)),g=Re(d,u?t.dependencyGraph(s):new Map,l),m=hi(t.factDigests(s),t.factDigests(c)),x=r();return{version:1,status:"evaluated",refreshResult:e.refreshResult,recordedAt:new Date(n?x:i()).toISOString(),durationMs:Math.max(0,x-a),manifest:d,plan:g,comparison:m,evaluation:Qe(g,m,l.length)}}catch(l){return o("oracle-error",l instanceof Error?l.message:String(l))}finally{Cn(s),Cn(c)}}function Gn(e,t,n,r=Date.now()){return qn(e,t,r,0,n)}function Bn(e){let t=pi(e);return{latestPath:Mn(t,"affected-shadow-latest.json"),historyPath:Mn(t,"affected-shadow.jsonl")}}function xs(e,t=n=>Et(n,"affected-shadow source file")){let n=Bn(e),r;try{r=JSON.parse(t(n.latestPath))}catch(f){let y=_i(f),R=y?"telemetry-missing":vi(f);return O(n,R,y?void 0:f instanceof Error?f.message:String(f))}if(M(r)&&typeof r.version=="number"&&r.version!==1)return O(n,"unsupported-record-version",`Unsupported version ${r.version}.`);if(!Ei(r))return O(n,"telemetry-malformed");if(r.status==="unavailable")return Ii(r.reason)?{state:"unavailable",...n,reason:r.reason,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,...typeof r.error=="string"?{error:r.error}:{}}:O(n,"telemetry-malformed");if(r.status!=="evaluated")return O(n,"telemetry-malformed");let i=r.plan,a=r.comparison,o=r.evaluation;if(!M(r.manifest)||!M(i)||!M(a)||!M(o))return O(n,"telemetry-malformed");let s=i.mode,c=C(i.affectedFiles),l=C(i.reasons),d=C(a.changedFiles),p=C(o.predictedFiles),u=C(o.actualFiles),g=C(o.missingFiles),m=o.recall,x=o.affectedRatio;if(s!=="none"&&s!=="closure"&&s!=="full-project"||c===null||l===null||d===null||p===null||u===null||g===null||typeof o.passed!="boolean"||!$n(m)||!$n(x))return O(n,"telemetry-malformed");let _=u.length===0?1:(u.length-g.length)/u.length;return!Un(c,p)||!Un(d,u)||o.passed!==(g.length===0)||Math.abs(m-_)>Number.EPSILON||g.some(f=>!u.includes(f)||p.includes(f))?O(n,"telemetry-malformed"):{state:o.passed?"passing":"failing",...n,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,mode:s,recall:m,affectedRatio:x,predictedFiles:p,actualFiles:u,missingFiles:g,fallbackReasons:l}}function Ps(e){if(e.state==="unavailable")return`unavailable (${e.reason})`;let t=e.missingFiles.length>0?`, ${e.missingFiles.length} missed`:"",n=e.fallbackReasons.length>0?`; fallback: ${e.fallbackReasons.join(", ")}`:"";return`${e.state}, ${(e.recall*100).toFixed(1)}% recall, ${e.predictedFiles.length} predicted / ${e.actualFiles.length} changed, ${(e.affectedRatio*100).toFixed(1)}% of project${t}${n}`}function Wn(e,t,n=Pi){let r=Bn(e);return n.appendHistory(r.historyPath,t),n.writeLatest(r.latestPath,t),r}var yi=8*1024*1024,bi=Qt;function Si(e){let t={historyVersion:1,sourceVersion:e.version,refreshResult:e.refreshResult,recordedAt:e.recordedAt,durationMs:e.durationMs};return e.status==="unavailable"?{...t,status:"unavailable",reason:e.reason,...e.error?{error:e.error}:{}}:{...t,status:"evaluated",mode:e.plan.mode,passed:e.evaluation.passed,recall:e.evaluation.recall,affectedRatio:e.evaluation.affectedRatio,predictedFileCount:e.evaluation.predictedFiles.length,actualFileCount:e.evaluation.actualFiles.length,missingFileCount:e.evaluation.missingFiles.length,fallbackReasons:[...e.plan.reasons]}}function Ri(e,t,n=yi){Kt(e,Si(t),{maxSegmentBytes:n,previousSuffix:bi})}function Ve(e,t=[]){let n=[];for(let r of t)n.push(r);return n.push(e.symbol,e.display_name,e.kind,e.documentation,e.signature_hex,e.enclosing_symbol,e.relationships_hex),n}var xi={now:()=>Date.now(),wallNow:()=>Date.now(),monotonicNow:S,databaseExists:e=>ui(e),openDatabase:(e,t,n)=>new F({projectRoot:e,dbPath:t,indexPath:n}),indexedPaths:e=>fe(e),dependencyGraph:e=>me(e),factDigests:e=>fi(e)},Pi={appendHistory:Ri,writeLatest:(e,t)=>Wt(e,t,{spacing:2,trailingNewline:!0})};function qn(e,t,n,r,i){return{version:1,status:"unavailable",refreshResult:e,recordedAt:new Date(n).toISOString(),durationMs:r,reason:t,...i?{error:i}:{}}}function Cn(e){try{e?.close()}catch{}}function Ei(e){return M(e)&&e.version===1&&typeof e.recordedAt=="string"&&(e.refreshResult==="rebuilt"||e.refreshResult==="reused")&&typeof e.durationMs=="number"&&Number.isFinite(e.durationMs)&&e.durationMs>=0}function Ii(e){return e==="prior-index-unavailable"||e==="candidate-index-unavailable"||e==="oracle-error"}function $n(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function Un(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function O(e,t,n){return{state:"unavailable",...e,reason:t,...n?{error:n}:{}}}function vi(e){return e instanceof SyntaxError?"telemetry-malformed":"telemetry-unreadable"}function _i(e){return e instanceof Error&&e.code==="ENOENT"}import{readdirSync as Ti}from"fs";import{isAbsolute as Hn,join as wi,resolve as Di}from"path";var xe="@sourcegraph/scip-typescript@0.4.0",Jn="scip-python-plus@0.7.5",zn="github.com/sourcegraph/scip-go@v0.2.7",Xn="scip-dotnet@0.2.14",Fi="scip_dart@1.6.2",ki=3,ji=new Set(["bin","obj","node_modules"]),Oi={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:t,indexerBinary:n,projectPath:r})=>r?{binary:n,args:["index","--output",e,"--no-progress-bar",r]}:t?{binary:n,args:["index","--pnpm-workspaces","--output",e,"--no-progress-bar"]}:{binary:n,args:["index","--output",e,"--no-progress-bar"]},markerFiles:[...I.typescript],installMethods:[{label:"npm",identity:xe,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",xe]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},javascript:{language:"javascript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--no-progress-bar"]}),markerFiles:[...I.javascript],installMethods:[{label:"npm",identity:xe,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",xe]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},java:{language:"java",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[...I.java],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},scala:{language:"scala",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[...I.scala],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},kotlin:{language:"kotlin",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[...I.kotlin],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},rust:{language:X.language,indexerBinary:X.indexerBinary,checkCommand:`${X.indexerBinary} --version`,indexArgs:({outputPath:e})=>({binary:X.indexerBinary,args:["scip",".","--output",e]}),markerFiles:[...I.rust],installMethods:[],installUrl:X.installUrl},python:{language:"python",indexerBinary:"scip-python-plus",binaryAliases:["scip-python"],checkCommand:"scip-python-plus --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--project-name","project"]}),markerFiles:[...I.python],installMethods:[{label:"npm",identity:Jn,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",Jn]}],installUrl:"https://github.com/PlunderStruck/scip-python",bundledNpmPackage:"scip-python-plus"},clojure:{language:"clojure",indexerBinary:"scip-clojure",projectLocalBinaries:["node_modules/.bin/scip-clojure"],checkCommand:"scip-clojure -h",indexArgs:({projectRoot:e,outputPath:t,indexerBinary:n,configPath:r})=>{let i=["-root",e,"-output",t];return r&&i.push("-config",Hn(r)?r:Di(e,r)),{binary:n,args:i}},markerFiles:[...I.clojure],installMethods:[],installUrl:"https://github.com/PlunderStruck/scip-clojure"},ruby:{language:"ruby",indexerBinary:"scip-ruby",checkCommand:"scip-ruby --version",indexArgs:({indexerBinary:e})=>({binary:e,args:["--dir","."]}),defaultOutputPath:"index.scip",markerFiles:[...I.ruby],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-ruby/releases"},go:{language:"go",indexerBinary:"scip-go",checkCommand:"scip-go --version",indexArgs:({outputPath:e})=>({binary:"scip-go",args:["--output",e]}),markerFiles:[...I.go],installMethods:[{label:"go install",identity:zn,destination:"Go bin directory (GOBIN or GOPATH/bin)",prerequisite:"go",binary:"go",args:["install",zn]}],installUrl:"https://github.com/sourcegraph/scip-go"},cpp:{language:"cpp",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:[...I.cpp],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},c:{language:"c",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:[...I.c],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},csharp:{language:"csharp",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",Yn(e,[".sln",".slnx",".csproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...I.csharp],installMethods:[{label:"dotnet",identity:Xn,destination:"dotnet global tool directory",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet","--version","0.2.14"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},vb:{language:"vb",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",Yn(e,[".sln",".slnx",".vbproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...I.vb],installMethods:[{label:"dotnet",identity:Xn,destination:"dotnet global tool directory",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet","--version","0.2.14"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},dart:{language:"dart",indexerBinary:"scip-dart",checkCommand:"scip-dart --version",indexArgs:({indexerBinary:e,outputPath:t})=>({binary:e,args:["--output",t]}),markerFiles:[...I.dart],installMethods:[{label:"dart pub",identity:Fi,destination:"Dart pub global cache",prerequisite:"dart",binary:"dart",args:["pub","global","activate","scip_dart","1.6.2"]}],installUrl:"https://github.com/Workiva/scip-dart/releases"},php:{language:"php",indexerBinary:"scip-php",projectLocalBinaries:["vendor/davidrjenni/scip-php/bin/scip-php","vendor/bin/scip-php"],checkCommand:"scip-php --version",indexArgs:({indexerBinary:e})=>Hn(e)?{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",e]}:{binary:e,args:[]},defaultOutputPath:"index.scip",markerFiles:[...I.php],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function Vn(e){if(!(e.projectPath||e.pnpmWorkspaces)){if(e.language==="typescript")return"{}";if(e.language==="javascript")return'{"compilerOptions":{"allowJs":true}}'}}function Ze(e){return Oi[e]}function Yn(e,t){let n=[e];for(let r=0;r<=ki&&n.length>0;r++){let i=[],a=[];for(let o of n){let s;try{s=Ti(o,{withFileTypes:!0})}catch{continue}for(let c of s){let l=wi(o,c.name);c.isDirectory()?!c.name.startsWith(".")&&!ji.has(c.name)&&a.push(l):i.push(l)}}for(let o of t){let s=i.filter(c=>c.endsWith(o)).sort()[0];if(s)return s}n=a.sort()}return null}import{createHash as Li}from"crypto";import{existsSync as Qn,rmSync as Kn}from"fs";import{resolve as Ni}from"path";import tr from"better-sqlite3";var Ai={documents:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"language",type:"TEXT",notnull:0,pk:0},{name:"relative_path",type:"TEXT",notnull:1,pk:0},{name:"position_encoding",type:"TEXT",notnull:0,pk:0},{name:"text",type:"TEXT",notnull:0,pk:0}],chunks:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"document_id",type:"INTEGER",notnull:1,pk:0},{name:"chunk_index",type:"INTEGER",notnull:1,pk:0},{name:"start_line",type:"INTEGER",notnull:1,pk:0},{name:"end_line",type:"INTEGER",notnull:1,pk:0},{name:"occurrences",type:"BLOB",notnull:1,pk:0}],global_symbols:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"symbol",type:"TEXT",notnull:1,pk:0},{name:"display_name",type:"TEXT",notnull:0,pk:0},{name:"kind",type:"INTEGER",notnull:0,pk:0},{name:"documentation",type:"TEXT",notnull:0,pk:0},{name:"signature",type:"BLOB",notnull:0,pk:0},{name:"enclosing_symbol",type:"TEXT",notnull:0,pk:0},{name:"relationships",type:"BLOB",notnull:0,pk:0}],mentions:[{name:"chunk_id",type:"INTEGER",notnull:1,pk:1},{name:"symbol_id",type:"INTEGER",notnull:1,pk:2},{name:"role",type:"INTEGER",notnull:1,pk:3}],defn_enclosing_ranges:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"document_id",type:"INTEGER",notnull:1,pk:0},{name:"symbol_id",type:"INTEGER",notnull:1,pk:0},{name:"start_line",type:"INTEGER",notnull:1,pk:0},{name:"start_char",type:"INTEGER",notnull:1,pk:0},{name:"end_line",type:"INTEGER",notnull:1,pk:0},{name:"end_char",type:"INTEGER",notnull:1,pk:0}]},Mi={idx_chunks_line_range:{table:"chunks",columns:["document_id","start_line","end_line"]},idx_defn_enclosing_ranges_document:{table:"defn_enclosing_ranges",columns:["document_id","start_line","end_line"]},idx_defn_enclosing_ranges_symbol_id:{table:"defn_enclosing_ranges",columns:["symbol_id"]},idx_mentions_symbol_id_role:{table:"mentions",columns:["symbol_id","role"]}};function nr(e){let t=S(),n=Ci(e.affectedFiles);if($i(e.previousDbPath,e.miniDbPath,e.candidateDbPath),Kn(e.candidateDbPath,{force:!0}),!Qn(e.previousDbPath))throw new Error("previous SQLite generation is unavailable");if(!Qn(e.miniDbPath))throw new Error("incremental SQLite mini database is unavailable");Zn(e.previousDbPath,"previous SQLite generation",!1),Zn(e.miniDbPath,"incremental SQLite mini database");let r=U(e.previousDbPath,e.candidateDbPath);e.writeTelemetry&&G(e.writeTelemetry,r);let i=null;try{i=new tr(j(e.candidateDbPath),{fileMustExist:!0}),i.pragma("busy_timeout = 5000"),i.pragma("foreign_keys = ON"),i.prepare("ATTACH DATABASE ? AS incremental").run(j(e.miniDbPath)),et(i,"main","candidate SQLite generation"),et(i,"incremental","incremental SQLite mini database"),Ui(i,n),Gi(i,n.length);let a=tt(i,"main",!0),o=L(i,"SELECT COUNT(*) AS value FROM main.documents");i.transaction(()=>{Bi(i),Wi(i),qi(i),e.onStage?.("after-delete"),Hi(i),e.onStage?.("after-symbol-reconciliation"),Ji(i),e.onStage?.("after-insert"),zi(i),Xi(i,n.length,o),e.onStage?.("before-commit")}).immediate(),rr(i,"main","candidate SQLite generation");let l=[...Yi(i)].filter(([d,p])=>a.get(d)!==p).map(([d])=>d).sort();return i.exec("DETACH DATABASE incremental"),i.close(),i=null,{candidateDbPath:e.candidateDbPath,affectedDocumentCount:n.length,changedDocumentPaths:l,durationMs:S()-t}}catch(a){try{i?.close()}finally{Kn(e.candidateDbPath,{force:!0})}throw new Error(`Incremental SQLite publication rejected: ${a instanceof Error?a.message:String(a)}`,{cause:a})}}function Ci(e){if(e.length===0)throw new Error("incremental SQLite publication requires affected documents");let t=[...e].sort();for(let n of t)if(!n||n.startsWith("/")||n.includes("\\")||n.split("/").includes(".."))throw new Error(`invalid affected document path: ${n}`);if(new Set(t).size!==t.length)throw new Error("incremental SQLite publication contains duplicate affected documents");return t}function $i(e,t,n){let r=[e,t,n].map(i=>Ni(i));if(new Set(r).size!==r.length)throw new Error("previous, mini, and candidate SQLite paths must be distinct")}function Zn(e,t,n=!0){let r=new tr(j(e),{readonly:!0,fileMustExist:!0});try{et(r,"main",t),n&&rr(r,"main",t)}finally{r.close()}}function et(e,t,n){for(let[r,i]of Object.entries(Ai)){let o=e.prepare(`PRAGMA ${t}.table_info('${r}')`).all().map(({name:s,type:c,notnull:l,pk:d})=>({name:s,type:c.toUpperCase(),notnull:l,pk:d}));if(JSON.stringify(o)!==JSON.stringify(i))throw new Error(`${n} schema changed for table ${r}`)}for(let[r,i]of Object.entries(Mi)){let a=e.prepare(`SELECT tbl_name FROM ${t}.sqlite_master WHERE type = 'index' AND name = ?`).get(r),o=e.prepare(`PRAGMA ${t}.index_info('${r}')`).all().map(s=>s.name);if(a?.tbl_name!==i.table||JSON.stringify(o)!==JSON.stringify(i.columns))throw new Error(`${n} schema changed for index ${r}`)}er(e,t,"documents",["relative_path"],n),er(e,t,"global_symbols",["symbol"],n)}function er(e,t,n,r,i){if(!e.prepare(`PRAGMA ${t}.index_list('${n}')`).all().some(s=>{if(s.unique!==1)return!1;let c=e.prepare(`PRAGMA ${t}.index_info('${s.name}')`).all().map(l=>l.name);return JSON.stringify(c)===JSON.stringify(r)}))throw new Error(`${i} lost the unique ${n}(${r.join(", ")}) constraint`)}function rr(e,t,n){let r=e.prepare(`PRAGMA ${t}.integrity_check`).pluck().get();if(r!=="ok")throw new Error(`${n} failed integrity_check: ${String(r)}`);if(e.prepare(`PRAGMA ${t}.foreign_key_check`).all().length>0)throw new Error(`${n} failed foreign_key_check`)}function Ui(e,t){e.exec("CREATE TEMP TABLE incremental_affected_paths (relative_path TEXT PRIMARY KEY) WITHOUT ROWID");let n=e.prepare("INSERT INTO temp.incremental_affected_paths(relative_path) VALUES (?)");e.transaction(i=>{for(let a of i)n.run(a)})(t)}function Gi(e,t){let n=L(e,"SELECT COUNT(*) AS value FROM incremental.documents"),r=L(e,`SELECT COUNT(*) AS value
59
+ FROM main.documents d
60
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`),i=e.prepare(`SELECT p.relative_path
61
+ FROM temp.incremental_affected_paths p
62
+ LEFT JOIN incremental.documents d ON d.relative_path = p.relative_path
63
+ WHERE d.id IS NULL
64
+ LIMIT 1`).pluck().get(),a=e.prepare(`SELECT d.relative_path
65
+ FROM incremental.documents d
66
+ LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
67
+ WHERE p.relative_path IS NULL
68
+ LIMIT 1`).pluck().get();if(n!==t||r!==t||i!==void 0||a!==void 0)throw new Error("incremental SQLite mini database does not exactly match the affected document set")}function Bi(e){e.exec(`
69
+ CREATE TEMP TABLE incremental_old_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
70
+ INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
71
+ SELECT g.symbol
72
+ FROM main.defn_enclosing_ranges r
73
+ JOIN main.documents d ON d.id = r.document_id
74
+ JOIN main.global_symbols g ON g.id = r.symbol_id
75
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path;
76
+ INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
77
+ SELECT g.symbol
78
+ FROM main.mentions m
79
+ JOIN main.chunks c ON c.id = m.chunk_id
80
+ JOIN main.documents d ON d.id = c.document_id
81
+ JOIN main.global_symbols g ON g.id = m.symbol_id
82
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
83
+ WHERE m.role = 1;
84
+
85
+ CREATE TEMP TABLE incremental_new_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
86
+ INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
87
+ SELECT g.symbol
88
+ FROM incremental.defn_enclosing_ranges r
89
+ JOIN incremental.global_symbols g ON g.id = r.symbol_id;
90
+ INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
91
+ SELECT g.symbol
92
+ FROM incremental.mentions m
93
+ JOIN incremental.global_symbols g ON g.id = m.symbol_id
94
+ WHERE m.role = 1;
95
+ `)}function Wi(e){let t=e.prepare(`WITH changed_symbols AS (
96
+ SELECT symbol FROM temp.incremental_old_defined_symbols
97
+ UNION
98
+ SELECT symbol FROM temp.incremental_new_defined_symbols
99
+ ), unaffected_definitions AS (
100
+ SELECT g.symbol
101
+ FROM main.defn_enclosing_ranges r
102
+ JOIN main.documents d ON d.id = r.document_id
103
+ JOIN main.global_symbols g ON g.id = r.symbol_id
104
+ LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
105
+ WHERE p.relative_path IS NULL
106
+ UNION
107
+ SELECT g.symbol
108
+ FROM main.mentions m
109
+ JOIN main.chunks c ON c.id = m.chunk_id
110
+ JOIN main.documents d ON d.id = c.document_id
111
+ JOIN main.global_symbols g ON g.id = m.symbol_id
112
+ LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
113
+ WHERE m.role = 1 AND p.relative_path IS NULL
114
+ )
115
+ SELECT u.symbol
116
+ FROM unaffected_definitions u
117
+ JOIN changed_symbols c ON c.symbol = u.symbol
118
+ LIMIT 1`).pluck().get();if(typeof t=="string")throw new Error(`symbol definition is shared by affected and unaffected documents: ${t}`)}function qi(e){e.exec(`
119
+ DELETE FROM main.mentions
120
+ WHERE chunk_id IN (
121
+ SELECT c.id
122
+ FROM main.chunks c
123
+ JOIN main.documents d ON d.id = c.document_id
124
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
125
+ );
126
+ DELETE FROM main.chunks
127
+ WHERE document_id IN (
128
+ SELECT d.id
129
+ FROM main.documents d
130
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
131
+ );
132
+ DELETE FROM main.defn_enclosing_ranges
133
+ WHERE document_id IN (
134
+ SELECT d.id
135
+ FROM main.documents d
136
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
137
+ );
138
+ DELETE FROM main.documents
139
+ WHERE relative_path IN (SELECT relative_path FROM temp.incremental_affected_paths);
140
+ `)}function Hi(e){e.exec(`
141
+ UPDATE main.global_symbols
142
+ SET display_name = NULL,
143
+ kind = NULL,
144
+ documentation = NULL,
145
+ signature = NULL,
146
+ enclosing_symbol = NULL,
147
+ relationships = NULL
148
+ WHERE symbol IN (SELECT symbol FROM temp.incremental_old_defined_symbols);
149
+
150
+ INSERT OR IGNORE INTO main.global_symbols(
151
+ symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
152
+ )
153
+ SELECT symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
154
+ FROM incremental.global_symbols;
155
+
156
+ UPDATE main.global_symbols
157
+ SET display_name = (
158
+ SELECT source.display_name FROM incremental.global_symbols source
159
+ WHERE source.symbol = main.global_symbols.symbol
160
+ ),
161
+ kind = (
162
+ SELECT source.kind FROM incremental.global_symbols source
163
+ WHERE source.symbol = main.global_symbols.symbol
164
+ ),
165
+ documentation = (
166
+ SELECT source.documentation FROM incremental.global_symbols source
167
+ WHERE source.symbol = main.global_symbols.symbol
168
+ ),
169
+ signature = (
170
+ SELECT source.signature FROM incremental.global_symbols source
171
+ WHERE source.symbol = main.global_symbols.symbol
172
+ ),
173
+ enclosing_symbol = (
174
+ SELECT source.enclosing_symbol FROM incremental.global_symbols source
175
+ WHERE source.symbol = main.global_symbols.symbol
176
+ ),
177
+ relationships = (
178
+ SELECT source.relationships FROM incremental.global_symbols source
179
+ WHERE source.symbol = main.global_symbols.symbol
180
+ )
181
+ WHERE symbol IN (SELECT symbol FROM temp.incremental_new_defined_symbols);
182
+ `)}function Ji(e){let t=L(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.documents"),n=L(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.chunks"),r=L(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.defn_enclosing_ranges");e.prepare(`INSERT INTO main.documents(id, language, relative_path, position_encoding, text)
183
+ SELECT id + ?, language, relative_path, position_encoding, text
184
+ FROM incremental.documents`).run(t),e.prepare(`INSERT INTO main.chunks(id, document_id, chunk_index, start_line, end_line, occurrences)
185
+ SELECT id + ?, document_id + ?, chunk_index, start_line, end_line, occurrences
186
+ FROM incremental.chunks`).run(n,t),e.prepare(`INSERT INTO main.mentions(chunk_id, symbol_id, role)
187
+ SELECT m.chunk_id + ?, target.id, m.role
188
+ FROM incremental.mentions m
189
+ JOIN incremental.global_symbols source ON source.id = m.symbol_id
190
+ JOIN main.global_symbols target ON target.symbol = source.symbol`).run(n),e.prepare(`INSERT INTO main.defn_enclosing_ranges(
191
+ id, document_id, symbol_id, start_line, start_char, end_line, end_char
192
+ )
193
+ SELECT r.id + ?, r.document_id + ?, target.id,
194
+ r.start_line, r.start_char, r.end_line, r.end_char
195
+ FROM incremental.defn_enclosing_ranges r
196
+ JOIN incremental.global_symbols source ON source.id = r.symbol_id
197
+ JOIN main.global_symbols target ON target.symbol = source.symbol`).run(r,t)}function zi(e){e.exec(`
198
+ DELETE FROM main.global_symbols
199
+ WHERE NOT EXISTS (SELECT 1 FROM main.mentions m WHERE m.symbol_id = main.global_symbols.id)
200
+ AND NOT EXISTS (
201
+ SELECT 1 FROM main.defn_enclosing_ranges r WHERE r.symbol_id = main.global_symbols.id
202
+ );
203
+ `)}function Xi(e,t,n){let r=L(e,"SELECT COUNT(*) AS value FROM main.documents"),i=L(e,`SELECT COUNT(*) AS value
204
+ FROM main.documents d
205
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`);if(r!==n||i!==t)throw new Error("candidate SQLite document counts changed unexpectedly");let a=e.prepare("SELECT relative_path FROM main.documents GROUP BY relative_path HAVING COUNT(*) > 1 LIMIT 1").pluck().get(),o=e.prepare("SELECT symbol FROM main.global_symbols GROUP BY symbol HAVING COUNT(*) > 1 LIMIT 1").pluck().get();if(a!==void 0||o!==void 0)throw new Error("candidate SQLite generation contains duplicate document paths or symbols")}function Yi(e){let t=tt(e,"main",!0),n=tt(e,"incremental",!1);if(JSON.stringify([...t])!==JSON.stringify([...n]))throw new Error("candidate SQLite affected document facts differ from the mini database");return t}function tt(e,t,n){let r=n?"JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path":"",i=e.prepare(`SELECT d.relative_path, d.language, d.position_encoding, d.text
206
+ FROM ${t}.documents d
207
+ ${r}
208
+ ORDER BY d.relative_path`).all(),a=e.prepare(`SELECT d.relative_path, c.chunk_index, c.start_line, c.end_line, hex(c.occurrences) AS occurrences
209
+ FROM ${t}.chunks c
210
+ JOIN ${t}.documents d ON d.id = c.document_id
211
+ ${r}
212
+ ORDER BY d.relative_path, c.chunk_index, c.start_line, c.end_line, c.id`).all(),o=e.prepare(`SELECT d.relative_path, r.start_line, r.start_char, r.end_line, r.end_char,
213
+ g.symbol, g.display_name, g.kind, g.documentation,
214
+ CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature,
215
+ g.enclosing_symbol,
216
+ CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships
217
+ FROM ${t}.defn_enclosing_ranges r
218
+ JOIN ${t}.documents d ON d.id = r.document_id
219
+ JOIN ${t}.global_symbols g ON g.id = r.symbol_id
220
+ ${r}
221
+ ORDER BY d.relative_path, r.start_line, r.start_char, r.end_line, r.end_char, g.symbol`).all(),s=e.prepare(`SELECT d.relative_path, c.chunk_index, m.role, g.symbol
222
+ FROM ${t}.mentions m
223
+ JOIN ${t}.chunks c ON c.id = m.chunk_id
224
+ JOIN ${t}.documents d ON d.id = c.document_id
225
+ JOIN ${t}.global_symbols g ON g.id = m.symbol_id
226
+ ${r}
227
+ ORDER BY d.relative_path, c.chunk_index, m.role, g.symbol`).all(),c=new Map;for(let[d,p]of Object.entries({documents:i,chunks:a,definitions:o,mentions:s}))for(let u of p){let g=JSON.stringify([d,u]),m=c.get(u.relative_path)??[];m.push(g),c.set(u.relative_path,m)}let l=new Map;for(let[d,p]of[...c].sort(([u],[g])=>u.localeCompare(g))){let u=Li("sha256");for(let g of p.sort())u.update(g).update(`
228
+ `);l.set(d,u.digest("hex"))}return l}function L(e,t){return e.prepare(t).get().value}import Vi from"better-sqlite3";var Pe="idx_mentions_definitions",Qi=["symbol_id","chunk_id"];function nt(e){let t=new Vi(j(e)),n=[],r=[],i=[];try{return t.transaction(()=>{Ki(t,n),Ee(t,"idx_global_symbols_symbol")?.join("\0")==="symbol"&&ir(t,"global_symbols").some(s=>s.name!=="idx_global_symbols_symbol"&&s.unique&&s.columns.join("\0")==="symbol")?(t.exec('DROP INDEX "idx_global_symbols_symbol"'),r.push("idx_global_symbols_symbol")):Ee(t,"idx_global_symbols_symbol")&&i.push("idx_global_symbols_symbol");let a=Ee(t,"idx_chunks_doc_id"),o=ir(t,"chunks").some(s=>s.name!=="idx_chunks_doc_id"&&s.columns.length>1&&s.columns[0]==="document_id");a?.join("\0")==="document_id"&&o?(t.exec('DROP INDEX "idx_chunks_doc_id"'),r.push("idx_chunks_doc_id")):a&&i.push("idx_chunks_doc_id"),t.exec("ANALYZE")})(),{added:n,removed:r,retained:i,analyzed:!0}}catch(a){if(a.code==="SQLITE_NOTADB")return{added:[],removed:[],retained:[],analyzed:!1,skippedReason:"not-a-sqlite-database"};throw a}finally{t.close()}}function Ki(e,t){let n=ar(e,Pe);if(n){let r=n.columns.join("\0")===Qi.join("\0"),i=/\bWHERE\s+role\s*=\s*1\b/iu.test(n.sql??"");if(!r||!i||n.table!=="mentions")throw new Error(`${Pe} exists with an incompatible definition`);return}e.exec(`CREATE INDEX "${Pe}" ON mentions(symbol_id, chunk_id) WHERE role = 1`),t.push(Pe)}function ir(e,t){return e.prepare(`PRAGMA index_list('${t.replaceAll("'","''")}')`).all().map(n=>({name:n.name,unique:n.unique===1,columns:Ee(e,n.name)??[]}))}function Ee(e,t){return ar(e,t)?.columns??null}function ar(e,t){let n=e.prepare("SELECT tbl_name, sql FROM sqlite_master WHERE type = 'index' AND name = ?").get(t);if(!n)return null;let r=e.prepare(`PRAGMA index_info('${t.replaceAll("'","''")}')`).all().map(i=>i.name);return{table:n.tbl_name,sql:n.sql,columns:r}}import{createHash as Zi}from"crypto";import{existsSync as rt,readdirSync as ea}from"fs";import{dirname as it,join as Ie,relative as ta,resolve as at,sep as or}from"path";function sr(e,t){let n=t.includes("."),r={};for(let a of t)r[a]=[];let i=[];for(let a of e){let o=ur(a.path,t);o?r[o].push(a):n?r["."].push(a):i.push(a)}return{files:r,shared:i}}function cr(e,t){let n=new Map;for(let i of e){let a=t[i]?.packageName;a&&n.set(a,i)}let r=new Map;for(let i of e)r.set(i,new Set);for(let i of e){let a=t[i],o=r.get(i);if(!a||a.parseFailed){for(let s of e)s!==i&&o.add(s);continue}for(let s of a.dependencyNames){let c=n.get(s);c&&c!==i&&o.add(c)}for(let s of[...a.pathsTargets,...a.referencesPaths]){let c=ur(s,e);c&&c!==i&&o.add(c)}}return na(e,r)}function dr(e,t,n){let r={};for(let i of e){let a=new Map;for(let o of t.files[i]??[])a.set(o.path,o);for(let o of n[i]??[])for(let s of t.files[o]??[])a.set(s.path,s);for(let o of t.shared)a.set(o.path,o);r[i]={files:[...a.values()].sort((o,s)=>o.path.localeCompare(s.path))}}return r}function ot(e){if(e===".")return"root";let t=Zi("sha256").update(e).digest("hex").slice(0,8);return`${e.split("/").join("__")}-${t}`}function lr(e,t){let n=at(e),r={};for(let i of t)r[i]=ra(n,i);return r}function ur(e,t){let n;for(let r of t)r!=="."&&(e===r||e.startsWith(`${r}/`))&&(!n||r.length>n.length)&&(n=r);return n}function na(e,t){let n={};for(let r of e){let i=new Set,a=[...t.get(r)??[]];for(;a.length>0;){let o=a.pop();if(!(o===r||i.has(o))){i.add(o);for(let s of t.get(o)??[])s!==r&&!i.has(s)&&a.push(s)}}n[r]=[...i].sort((o,s)=>o.localeCompare(s))}return n}function ra(e,t){let n=t==="."?e:Ie(e,t),r=ia(n),i=aa(n),a=i?oa(i,e):{pathsTargets:[],referencesPaths:[],failed:!1};return{packageName:r.name,dependencyNames:r.dependencyNames,pathsTargets:a.pathsTargets,referencesPaths:a.referencesPaths,parseFailed:r.failed||a.failed}}function ia(e){let t=Ie(e,"package.json");if(!rt(t))return{name:void 0,dependencyNames:[],failed:!1};let n=st(t);if(!n.ok)return{name:void 0,dependencyNames:[],failed:!0};let r=typeof n.value.name=="string"?n.value.name:void 0,i=new Set;for(let a of["dependencies","devDependencies","peerDependencies"]){let o=n.value[a];if(o&&typeof o=="object"&&!Array.isArray(o))for(let s of Object.keys(o))i.add(s)}return{name:r,dependencyNames:[...i],failed:!1}}function aa(e){let t=Ie(e,"tsconfig.json");if(rt(t))return t;let n;try{n=ea(e).filter(r=>/^tsconfig.*\.json$/.test(r))}catch{return}return n.sort((r,i)=>r.localeCompare(i)),n.length>0?Ie(e,n[0]):void 0}function oa(e,t){let n=st(e);if(!n.ok)return{pathsTargets:[],referencesPaths:[],failed:!0};let r=sa(n.value,e,t),i=pr(e,n.value,t,0);return{pathsTargets:i.pathsTargets,referencesPaths:r,failed:i.failed}}function sa(e,t,n){let r=e.references;if(!Array.isArray(r))return[];let i=it(t),a=new Set;for(let o of r){if(!o||typeof o!="object")continue;let s=o.path;if(typeof s!="string"||s.trim()==="")continue;let c=gr(s,i,n);c&&a.add(c)}return[...a]}function pr(e,t,n,r){let i=ca(t);if(i)return{pathsTargets:da(i,it(e),n),failed:!1};if(r>=5)return{pathsTargets:[],failed:!1};let a=la(t.extends,e,n);if(!a)return{pathsTargets:[],failed:!1};let o=st(a);return o.ok?pr(a,o.value,n,r+1):{pathsTargets:[],failed:!0}}function ca(e){let t=e.compilerOptions;if(!t||typeof t!="object"||Array.isArray(t))return;let n=t.paths;return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0}function da(e,t,n){let r=new Set;for(let i of Object.values(e))if(Array.isArray(i))for(let a of i){if(typeof a!="string")continue;let o=gr(a,t,n);o&&r.add(o)}return[...r]}function la(e,t,n){let r=Array.isArray(e)?e.at(-1):e;if(typeof r!="string"||r.trim()===""||!r.startsWith(".")&&!r.startsWith("/"))return;let i=at(it(t),r);if(i.endsWith(".json")||(i=`${i}.json`),!i.split(or).includes("node_modules")&&$e(n,i)&&rt(i))return i}function gr(e,t,n){let r=e.replace(/\/?\*+$/,""),i=at(t,r===""?".":r);if(!$e(n,i))return;let o=ta(n,i).split(or).join("/");return o===""?".":o}function ua(e){let t="",n=0,r=!1,i=e.length;for(;n<i;){let a=e[n];if(r){if(t+=a,a==="\\"&&n+1<i){t+=e[n+1],n+=2;continue}a==='"'&&(r=!1),n+=1;continue}if(a==='"'){r=!0,t+=a,n+=1;continue}if(a==="/"&&e[n+1]==="/"){for(n+=2;n<i&&e[n]!==`
229
+ `;)n+=1;continue}if(a==="/"&&e[n+1]==="*"){for(n+=2;n<i&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}t+=a,n+=1}return t}function st(e){try{let t=se(e,{maxBytes:Pt,inputKind:"TypeScript project manifest"}),n=JSON.parse(ua(t));return n&&typeof n=="object"&&!Array.isArray(n)?{ok:!0,value:n}:{ok:!1}}catch{return{ok:!1}}}import{writeFileSync as Ta}from"fs";import{deserializeSCIP as wa,PositionEncoding as ve,serializeSCIP as Da}from"@c4312/scip";import{rmSync as ga}from"fs";import fa from"better-sqlite3";var ma=200,ha=[`CREATE TABLE documents (
230
+ id INTEGER PRIMARY KEY,
231
+ language TEXT,
232
+ relative_path TEXT NOT NULL UNIQUE,
233
+ position_encoding TEXT,
234
+ text TEXT
235
+ )`,`CREATE TABLE chunks (
236
+ id INTEGER PRIMARY KEY,
237
+ document_id INTEGER NOT NULL,
238
+ chunk_index INTEGER NOT NULL,
239
+ start_line INTEGER NOT NULL,
240
+ end_line INTEGER NOT NULL,
241
+ occurrences BLOB NOT NULL,
242
+ FOREIGN KEY (document_id) REFERENCES documents(id)
243
+ )`,`CREATE TABLE global_symbols (
244
+ id INTEGER PRIMARY KEY,
245
+ symbol TEXT NOT NULL UNIQUE,
246
+ display_name TEXT,
247
+ kind INTEGER,
248
+ documentation TEXT,
249
+ signature BLOB,
250
+ enclosing_symbol TEXT,
251
+ relationships BLOB
252
+ )`,`CREATE TABLE mentions (
253
+ chunk_id INTEGER NOT NULL,
254
+ symbol_id INTEGER NOT NULL,
255
+ role INTEGER NOT NULL,
256
+ PRIMARY KEY (chunk_id, symbol_id, role),
257
+ FOREIGN KEY (chunk_id) REFERENCES chunks(id),
258
+ FOREIGN KEY (symbol_id) REFERENCES global_symbols(id)
259
+ )`,`CREATE TABLE defn_enclosing_ranges (
260
+ id INTEGER PRIMARY KEY,
261
+ document_id INTEGER NOT NULL,
262
+ symbol_id INTEGER NOT NULL,
263
+ start_line INTEGER NOT NULL,
264
+ start_char INTEGER NOT NULL,
265
+ end_line INTEGER NOT NULL,
266
+ end_char INTEGER NOT NULL,
267
+ FOREIGN KEY (document_id) REFERENCES documents(id),
268
+ FOREIGN KEY (symbol_id) REFERENCES global_symbols(id)
269
+ )`],ya=["CREATE INDEX idx_chunks_line_range ON chunks(document_id, start_line, end_line)","CREATE INDEX idx_mentions_symbol_id_role ON mentions(symbol_id, role)","CREATE INDEX idx_defn_enclosing_ranges_symbol_id ON defn_enclosing_ranges(symbol_id)","CREATE INDEX idx_defn_enclosing_ranges_document ON defn_enclosing_ranges(document_id, start_line, end_line)","CREATE INDEX idx_chunks_doc_id ON chunks(document_id)","CREATE INDEX idx_global_symbols_symbol ON global_symbols(symbol)"];function mr(e,t){ga(e,{force:!0});let n=new fa(j(e));try{n.pragma("journal_mode = WAL"),n.pragma("synchronous = NORMAL"),n.pragma("temp_store = MEMORY"),n.pragma("foreign_keys = ON");for(let r of ha)n.exec(r);n.transaction(()=>ba(n,t)).immediate(),n.transaction(()=>{for(let r of ya)n.exec(r)}).immediate()}finally{n.close()}}function ba(e,t){let n=Sa(e);for(let r of Ra(e,n,t))xa(e,n,r),Pa(e,n,r)}function Sa(e){let t=e.prepare("INSERT INTO global_symbols (symbol, display_name, kind, documentation, enclosing_symbol) VALUES (?, ?, ?, ?, ?)"),n=new Map,r=i=>{let a=n.get(i.symbol);if(a!==void 0)return a;let o=Number(t.run(i.symbol,i.displayName||null,i.kind||null,i.documentation.join(`
270
+ `)||null,i.enclosingSymbol||null).lastInsertRowid);return n.set(i.symbol,o),o};return{declared:r,referenced:i=>r({symbol:i,displayName:null,kind:null,documentation:[],enclosingSymbol:null})}}function Ra(e,t,n){let r=e.prepare("INSERT INTO documents (language, relative_path, position_encoding, text) VALUES (?, ?, ?, ?)"),i=[],a=new Set;for(let o of n){if(!o.relativePath)throw new Error("document relative path must not be empty");if(a.has(o.relativePath))continue;a.add(o.relativePath);let s=Number(r.run(o.language||null,o.relativePath,o.positionEncoding,o.text||null).lastInsertRowid);for(let c of Ea(o.symbols)){if(!c.symbol)throw new Error(`empty symbol in symbol information for document ${o.relativePath}`);he(c.symbol)||t.declared(c)}i.push({id:s,relativePath:o.relativePath,occurrences:Ia(o.occurrences)})}return i}function xa(e,t,n){let r=e.prepare(`INSERT INTO defn_enclosing_ranges (document_id, symbol_id, start_line, start_char, end_line, end_char)
271
+ VALUES (?, ?, ?, ?, ?, ?)`);for(let i of n.occurrences){if((i.roles&1)===0||he(i.symbol)||!i.enclosingRange)continue;let[a,o,s,c]=_a(i,n.relativePath);r.run(n.id,t.referenced(i.symbol),a,o,s,c)}}function Pa(e,t,n){let r=e.prepare("INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences) VALUES (?, ?, ?, ?, ?)"),i=e.prepare("INSERT INTO mentions (chunk_id, symbol_id, role) VALUES (?, ?, ?)");va(n.occurrences).forEach((a,o)=>{let s=Number(r.run(n.id,o,a.startLine,a.endLine,rn(a.occurrences)).lastInsertRowid),c=new Map;for(let l of a.occurrences){if(he(l.symbol))continue;let d=c.get(l.symbol)??new Set;d.add(l.roles),c.set(l.symbol,d)}for(let[l,d]of c){let p=t.referenced(l);for(let u of d)i.run(s,p,u)}})}function Ea(e){let t=new Map;for(let n of e){let r=t.get(n.symbol);if(!r){t.set(n.symbol,n);continue}t.set(n.symbol,{...r,documentation:[...r.documentation,...n.documentation.filter(i=>!r.documentation.includes(i))]})}return[...t.values()].sort((n,r)=>hr(n.symbol,r.symbol))}function Ia(e){let t=[...e].sort((r,i)=>fr(r.range,i.range)||hr(r.symbol,i.symbol)),n=[];for(let r of t){let i=n.at(-1);i&&i.symbol===r.symbol&&fr(i.range,r.range)===0?n[n.length-1]={...i,roles:i.roles|r.roles}:n.push(r)}return n}function va(e){let t=[],n=0;for(;n<e.length;){let r=Math.min(e.length,n+ma);for(;r<e.length&&e[r-1].range[0]===e[r].range[0];)r+=1;t.push({startLine:e[n].range[0],endLine:e[r-1].range[0],occurrences:e.slice(n,r)}),n=r}return t}function _a(e,t){let n=e.enclosingRange,[r,i,a,o]=n;if(!(r>=0&&i>=0&&(a>r&&o>=0||a===r&&o>=i)))throw new Error(`bad enclosing range ${JSON.stringify(n)} for symbol ${e.symbol} in document ${t}`);return n}function fr(e,t){return e[0]-t[0]||e[1]-t[1]||e[2]-t[2]||e[3]-t[3]}function hr(e,t){return e<t?-1:e>t?1:0}var Fa={[ve.UnspecifiedPositionEncoding]:null,[ve.UTF8CodeUnitOffsetFromLineStart]:"UTF-8",[ve.UTF16CodeUnitOffsetFromLineStart]:"UTF-16",[ve.UTF32CodeUnitOffsetFromLineStart]:"UTF-32"};function br(e,t,n){let r=wa(A(e,{inputKind:"SCIP index store input",maxBytes:Q})),i={removedDefinitionOccurrences:0,touchedDocuments:0};if(n.sanitize){let a=Zt(r);a.touchedDocuments>0&&(Ta(e,Buffer.from(Da(a.index))),r=a.index),i={removedDefinitionOccurrences:a.removedDefinitionOccurrences,touchedDocuments:a.touchedDocuments}}return mr(t,r.documents.map(ka)),i}function ka(e){let t=Fa[e.positionEncoding];if(t===void 0)throw new Error(`unknown position encoding ${e.positionEncoding} in ${e.relativePath}`);return{relativePath:e.relativePath,language:e.language||null,positionEncoding:t,text:e.text||null,symbols:e.symbols.map(n=>({symbol:n.symbol,displayName:n.displayName||null,kind:n.kind||null,documentation:n.documentation,enclosingSymbol:n.enclosingSymbol||null})),occurrences:e.occurrences.flatMap(n=>{let r=yr(n.range);return r?[{symbol:n.symbol,roles:n.symbolRoles,range:r,enclosingRange:yr(n.enclosingRange)}]:[]})}}function yr(e){return e.length===3?[e[0],e[1],e[0],e[2]]:e.length===4?[e[0],e[1],e[2],e[3]]:null}import{createHash as Ba}from"crypto";import{existsSync as ct,statSync as Wa,writeFileSync as dt}from"fs";import{join as qa}from"path";import{randomUUID as ja}from"crypto";import{existsSync as Oa}from"fs";var La=12e4,Na=5,_e=class{projectRoot;cacheDir;baseGeneration;timeoutMs;runtime;mailboxLimits;constructor(t,n={}){this.projectRoot=wt(t.projectRoot),this.cacheDir=t.cacheDir,this.baseGeneration=t.baseGeneration,this.timeoutMs=n.timeoutMs??Ua(),this.runtime=n.runtime??Ga,this.mailboxLimits=n.mailboxLimits??{}}request(t){let n=wn(this.cacheDir),r=_n(this.cacheDir),i=Xe(n.statePath);if(!Sr(i,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript index service is not running.");let a=this.runtime.now(),o=a+this.timeoutMs,s=(this.runtime.monotonicNow??S)()+this.timeoutMs,c=En("typescript-index-v4",{baseGeneration:this.baseGeneration,request:t}),l=In(c),d=vn(r,{mailboxVersion:Pn,operationKey:c,clientId:this.runtime.randomId(),enqueuedAtMs:a,deadlineAtMs:o,protocolVersion:Se,id:l,baseGeneration:this.baseGeneration,request:t},{nowMs:a,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??S)()<=s;){if(Oa(d.responsePath))return Aa(se(d.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript index mailbox response"}),l,c,this.baseGeneration,t.producerIdentity,t.affectedFiles);let p=Xe(n.statePath);if(!Sr(p,this.projectRoot,this.runtime))throw new Error("TypeScript index service stopped while processing a request.");this.runtime.sleep(Na)}throw new Error(`TypeScript index service timed out after ${this.timeoutMs}ms.`)}};function Sr(e,t,n){let r=e?.processIdentity?n.readProcessIdentity?.(e.pid):null;return e!==null&&e.projectRoot===t&&e.typescriptIndex?.protocolVersion===Se&&n.isProcessAlive(e.pid)&&(!e.processIdentity||r!=null&&ee(e.processIdentity,r))}function Aa(e,t,n,r,i,a){let o=JSON.parse(e);if(o.protocolVersion!==Se||o.id!==t||o.operationKey!==n||o.ok===!0&&o.baseGeneration!==r)throw new Error("TypeScript index service wrote an incompatible response.");if(o.ok!==!0)throw new Error(typeof o.error=="string"?o.error:"TypeScript index service request failed.");let s=Ma(o.response,i),c=[...new Set(a)].sort(),l=s.fragments.map(d=>d.relativePath).sort();if(JSON.stringify(l)!==JSON.stringify(c))throw new Error("TypeScript index service omitted or added an affected document.");return s}function Ma(e,t){if(!e||typeof e!="object")throw new Error("TypeScript index service wrote an invalid response.");let n=e;if(n.producerIdentity!==t||typeof n.cold!="boolean"||typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)||!Array.isArray(n.fragments))throw new Error("TypeScript index service wrote an invalid response.");let r=new Set,i=n.fragments.map(a=>{if(!a||typeof a.relativePath!="string"||a.bytesBase64!==null&&typeof a.bytesBase64!="string"||typeof a.occurrences!="number"||!Number.isInteger(a.occurrences)||a.occurrences<0||typeof a.symbols!="number"||!Number.isInteger(a.symbols)||a.symbols<0||!Array.isArray(a.referenceFragments)||!a.referenceFragments.every(Ca)||r.has(a.relativePath))throw new Error("TypeScript index service wrote an invalid fragment.");r.add(a.relativePath);let o=a.bytesBase64===null?null:$a(a.bytesBase64);return{relativePath:a.relativePath,bytes:o,occurrences:a.occurrences,symbols:a.symbols,referenceFragments:a.referenceFragments}});return{producerIdentity:n.producerIdentity,cold:n.cold,durationMs:n.durationMs,fragments:i}}function Ca(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.targetSymbol=="string"&&!!t.location&&typeof t.location.file=="string"&&Number.isInteger(t.location.line)&&Number.isInteger(t.location.column)}function $a(e){let t=Buffer.from(e,"base64");if(t.toString("base64")!==e)throw new Error("TypeScript index service wrote invalid base64.");return t}function Ua(){let e=Number(process.env.SCIP_TYPESCRIPT_INDEX_TIMEOUT_MS);return Number.isInteger(e)&&e>0?e:La}var Ga={now:Date.now,monotonicNow:S,randomId:ja,sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)},isProcessAlive:J,readProcessIdentity:H};function Ha(e){let t=e.projectMode==="workspace"?e.workspaceProjects??[]:["."];if(t.length===0)return{eligible:!1,reason:"workspace project roots unavailable"};if(t.length===1&&t[0]==="."&&!e.rootTsconfigExists)return{eligible:!1,reason:"root tsconfig unavailable"};if(!e.previousSnapshot)return{eligible:!1,reason:"prior project snapshot unavailable"};if(e.graph===null)return{eligible:!1,reason:"dependency graph unavailable"};if(e.projectFiles.length===0)return{eligible:!1,reason:"prior TypeScript documents unavailable"};let n=de(e.previousSnapshot,e.currentSnapshot);if(n.changes.length===0)return{eligible:!1,reason:"no changed project inputs"};if(n.changes.some(d=>d.kind!=="modified"||d.inputKind!=="source"||!Be(d.path)))return{eligible:!1,reason:"change is not a modified TypeScript source file"};let r=Re(n,e.graph,e.projectFiles);if(r.mode!=="closure"||r.affectedFiles.length===0)return{eligible:!1,reason:r.reasons.length>0?`affected set widened: ${r.reasons.join(", ")}`:"empty affected set"};let i=Ja(r,t,e.graph);if(!i)return{eligible:!1,reason:"affected files cross or ambiguously match TypeScript projects"};let a=Rr(e.currentSnapshot,e.projectFiles,e.producerIdentity),o=Rr(e.previousSnapshot,e.projectFiles,e.producerIdentity);if(a!==o)return{eligible:!1,reason:"TypeScript fragment project identity changed"};let s=Pr(e.previousSnapshot,e.projectFiles,e.graph,e.producerIdentity,e.projectFiles);if(!s)return{eligible:!1,reason:"prior document identity unavailable"};let c=Pr(e.currentSnapshot,e.projectFiles,e.graph,e.producerIdentity,r.affectedFiles);if(!c)return{eligible:!1,reason:"next document identity unavailable"};let l=i.length===1?i[0]:void 0;return{eligible:!0,manifest:n,plan:r,projectIdentity:a,previousFragmentGeneration:xr(e.previousSnapshot,e.producerIdentity),nextFragmentGeneration:xr(e.currentSnapshot,e.producerIdentity),previousDocumentIdentities:s,nextDocumentIdentities:c,projects:i,...l?{tsconfigPath:l.tsconfigPath,projectArgument:l.projectArgument}:{}}}function Ja(e,t,n){let r=new Map;for(let a of e.affectedFiles){let o=za(a,t);if(!o)return null;let s=r.get(o)??[];s.push(a),r.set(o,s)}let i=[];for(let[a,o]of[...r].sort(([s],[c])=>s.localeCompare(c))){let s=new Set(o),c=e.changedFiles.filter(l=>s.has(l)||o.some(d=>Xa(d,l,n)));if(c.length===0)return null;i.push({projectArgument:a,tsconfigPath:a==="."?"tsconfig.json":`${a}/tsconfig.json`,modifiedFiles:c,affectedFiles:[...o].sort()})}return i}function za(e,t){let n=t.filter(a=>a==="."||e===a||e.startsWith(`${a}/`));if(n.length===0)return null;let r=[...new Set(n)].sort((a,o)=>Te(o)-Te(a)||a.localeCompare(o)),i=r[0];return r[1]&&Te(r[1])===Te(i)?null:i}function Te(e){return e==="."?0:e.split("/").filter(Boolean).length}function Xa(e,t,n){let r=new Set,i=[e];for(let a=0;a<i.length;a+=1){let o=i[a];if(!(!o||r.has(o))){r.add(o);for(let s of n.get(o)??[]){if(s===t)return!0;r.has(s)||i.push(s)}}}return!1}function Er(e){let t=S();try{if(!ct(e.previousDbPath)||!ct(e.previousShardPath))throw new Error("prior TypeScript graph or language shard unavailable");let n=performance.now(),r=ze();if(!r.available)throw new Error(r.reason);let i=performance.now()-n;n=performance.now();let a=new F({projectRoot:e.projectRoot,dbPath:e.previousDbPath,indexPath:e.previousIndexPath}),o,s;try{o=fe(a,{includeIgnored:!1}).filter(Be).sort(),s=me(a)}finally{a.close()}let c=performance.now()-n,l=Ha({projectMode:e.projectMode,workspaceProjects:e.projectMode==="workspace"?z(e.projectRoot,e.currentSnapshot.typescriptProjects):void 0,previousSnapshot:e.previousSnapshot,currentSnapshot:e.currentSnapshot,projectFiles:o,graph:s,producerIdentity:r.producerIdentity,rootTsconfigExists:ct(qa(e.projectRoot,"tsconfig.json"))});if(!l.eligible)throw new Error(l.reason);let d=Tn(e.previousDbPath);if(!d)throw new Error("published TypeScript base generation unavailable");n=performance.now();let p=new _e({projectRoot:e.projectRoot,cacheDir:e.cacheDir,baseGeneration:d}),u=l.projects.map(b=>p.request({kind:"emit-documents",tsconfigPath:b.tsconfigPath,projectArgument:b.projectArgument,projectIdentity:l.projectIdentity,producerIdentity:r.producerIdentity,modifiedFiles:b.modifiedFiles,affectedFiles:b.affectedFiles})),g=u.flatMap(b=>b.fragments),m=performance.now()-n,x=Wa(e.previousShardPath).size>=ln;n=performance.now();let _=x?null:A(e.previousShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:Q}),f=x?{completeIndexBytes:null,affectedIndexBytes:an(g)}:cn({packageVersion:r.packageVersion,baseIndexBytes:_,fragments:g}),y=performance.now()-n;n=performance.now(),x?un({cacheDir:e.cacheDir,previousGenerationIdentity:l.previousFragmentGeneration,nextGenerationIdentity:l.nextFragmentGeneration,producerIdentity:r.producerIdentity,projectIdentity:l.projectIdentity,baseShardCurrent:e.baseShardCurrent,fragments:g}):(on({cacheDir:e.cacheDir,packageVersion:r.packageVersion,indexBytes:_,producerIdentity:r.producerIdentity,projectIdentity:l.projectIdentity,generationIdentity:l.previousFragmentGeneration,documentIdentities:l.previousDocumentIdentities,allowUntrackedDocuments:!0}),sn({cacheDir:e.cacheDir,previousGenerationIdentity:l.previousFragmentGeneration,producerIdentity:r.producerIdentity,projectIdentity:l.projectIdentity,generationIdentity:l.nextFragmentGeneration,fragments:g,documentIdentities:l.nextDocumentIdentities}));let R=performance.now()-n;n=performance.now(),f.completeIndexBytes&&dt(e.candidateShardPath,f.completeIndexBytes),dt(e.candidateAffectedScipPath,f.affectedIndexBytes);let E=performance.now()-n,P={scipPath:x?e.previousShardPath:e.candidateShardPath,candidateScipPath:e.candidateShardPath,affectedScipPath:e.candidateAffectedScipPath,completeScipUpdated:!x,durationMs:S()-t,cold:u.some(b=>b.cold),changedFiles:l.plan.changedFiles,affectedFiles:l.plan.affectedFiles,producerIdentity:r.producerIdentity,previousFragmentGeneration:l.previousFragmentGeneration,nextFragmentGeneration:l.nextFragmentGeneration,manifest:l.manifest,plan:l.plan,projectFileCount:o.length,referenceFragmentsByFile:new Map(g.map(b=>[b.relativePath,b.referenceFragments])),timings:{runtimeMs:i,graphMs:c,requestMs:m,serviceMs:u.reduce((b,B)=>b+B.durationMs,0),assemblyMs:y,fragmentStoreMs:R,writeMs:E}};return e.onStatus(`Incremental TypeScript index emitted ${P.affectedFiles.length} affected document(s) across ${l.projects.length} project(s) in ${(P.durationMs/1e3).toFixed(3)}s (${P.cold?"cold":"warm"} service; ${x?"whole SCIP deferred":"whole SCIP current"}; runtime ${i.toFixed(0)}ms, graph ${c.toFixed(0)}ms, request ${m.toFixed(0)}ms, assembly ${y.toFixed(0)}ms, fragments ${R.toFixed(0)}ms, write ${E.toFixed(0)}ms).`),P}catch(n){return e.onStatus(`Incremental TypeScript index unavailable: ${n instanceof Error?n.message:String(n)}. Falling back to the whole-project indexer.`),null}}function Ir(e){let t=ze();if(!t.available)throw new Error(t.reason);let n=pn({cacheDir:e.cacheDir,generationIdentity:e.generationIdentity,baseIndexBytes:A(e.baseShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:Q}),packageVersion:t.packageVersion});dt(e.candidateShardPath,n)}function Rr(e,t,n){let r=e.files.filter(i=>It(i.path,e.languages)!=="source").map(i=>({path:i.path,size:i.size,hash:i.hash})).sort((i,a)=>i.path.localeCompare(a.path));return lt(JSON.stringify({version:1,producerIdentity:n,pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:[...e.typescriptProjects].sort(),projectFiles:[...t].sort(),nonSourceInputs:r}))}function xr(e,t){return lt(JSON.stringify({version:1,producerIdentity:t,snapshot:e}))}function Pr(e,t,n,r,i){let a=new Set(e.files.map(c=>c.path)),o=Ht({projectFiles:t.filter(c=>a.has(c)),snapshot:e,graph:n,engineIdentity:r}),s=new Map;for(let c of i){let l=o.identityFor(c,"typescript-scip-document-v1");if(l.key){s.set(c,l.key);continue}if(a.has(c))return null;s.set(c,lt(JSON.stringify({version:1,producerIdentity:r,generatedDocument:c})))}return s}function lt(e){return Ba("sha256").update(e).digest("hex")}import{closeSync as Ya,existsSync as we,fstatSync as Va,lstatSync as Qa,openSync as Ka,renameSync as pt,rmSync as De,statSync as Za,writeSync as eo}from"fs";import{cpus as to}from"os";import{join as gt}from"path";function no(e,t){if(e.temporaryRootConfigContent===void 0)return null;let n=gt(t,"tsconfig.json"),r=Buffer.from(e.temporaryRootConfigContent,"utf8"),i;try{i=Ka(n,"wx",384)}catch(a){if(a.code==="EEXIST")return null;throw a}try{eo(i,r);let a=Va(i);return{path:n,content:r,device:a.dev,inode:a.ino}}finally{Ya(i)}}function ro(e){if(e)try{let t=Qa(e.path);if(!t.isFile()||t.dev!==e.device||t.ino!==e.inode||t.size!==e.content.byteLength)return;let n;try{n=A(e.path,{maxBytes:e.content.byteLength,inputKind:"temporary TypeScript index configuration"})}catch{return}if(!n.equals(e.content))return;De(e.path)}catch(t){if(t.code!=="ENOENT")throw t}}function io(e,t,n){if(!e.defaultOutputPath)return;let r=gt(t,e.defaultOutputPath);n!==r&&we(r)&&pt(r,n)}function ao(e,t,n){if(!e.defaultOutputPath)return null;let r=gt(t,e.defaultOutputPath);if(r===n)return null;let i=`${n}.default-output-backup`;return De(i,{force:!0}),we(r)?(pt(r,i),{defaultOutputPath:r,backupPath:i}):{defaultOutputPath:r,backupPath:null}}function oo(e){e&&(De(e.defaultOutputPath,{force:!0}),e.backupPath&&we(e.backupPath)&&pt(e.backupPath,e.defaultOutputPath))}function so(e,t){if(e<=1)return 1;let n=Number(process.env.CODEBASEIQ_INDEXER_CONCURRENCY??0),r=Number.isFinite(t)&&t&&t>0?t:Number.isFinite(n)&&n>0?n:Math.min(8,Math.max(1,to().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function _r(e,t,n,r,i){D(i,"Reindex cancelled by its owner.");let a=e.filter(d=>d.config.defaultOutputPath),o=e.filter(d=>!d.config.defaultOutputPath),s=[],c=so(o.length,r),l=await jn(o,c,d=>ut(d,t,n,i));if(c>1){let d=new Map;for(let p of l.filter(u=>u.result.skipped&&u.retryable)){let u=o.find(g=>g.id===p.result.id);u&&(n(`Retrying ${u.label} indexer serially after parallel failure...`),D(i,"Reindex cancelled by its owner."),d.set(u.id,(await ut(u,t,n,i)).result))}s.push(...l.map(({result:p})=>d.get(p.id)??p))}else s.push(...l.map(({result:d})=>d));for(let d of a)D(i,"Reindex cancelled by its owner."),s.push((await ut(d,t,n,i)).result);return s.sort((d,p)=>e.findIndex(u=>u.id===d.id)-e.findIndex(u=>u.id===p.id))}async function ut(e,t,n,r){D(r,"Reindex cancelled by its owner."),n(`Indexing ${e.label} with ${e.resolvedBinary}...`),De(e.scipPath,{force:!0});let i=ao(e.config,t,e.scipPath),a=no(e,t),o=[e.binary,...e.args].join(" "),s=S();try{e.trustedProjectTool&&Gt(t,e.trustedProjectTool);let l=Lt(e.binary,e.args),d=await kn({command:l.binary,args:l.args,label:`${e.label} indexer`,cwd:t,env:e.env,timeoutMs:co(),maxStdoutBytes:50*1024*1024,maxStderrBytes:50*1024*1024,signal:r});if(d.status!==0){let p=d.stderr.trim();throw new Error(`${e.resolvedBinary} exited with status ${d.status}${p?`:
272
+ ${p}`:""}`)}io(e.config,t,e.scipPath)}catch(l){if(r?.aborted)throw Dt(r,"Reindex cancelled by its owner.");let d=l instanceof Error?l.message:String(l),p=`${e.resolvedBinary} indexer failed: ${d.split(`
273
+ `)[0]}`,u=e.label===e.language?p:`${e.label}: ${p}`;return n(`Skipping ${e.label}: ${p}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:S()-s,command:o,skipped:{language:e.language,reason:u}},retryable:lo(l)}}finally{oo(i),ro(a)}if(!we(e.scipPath)){let l=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`,d=e.label===e.language?l:`${e.label}: ${l}`;return n(`Skipping ${e.label}: ${l}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:S()-s,command:o,skipped:{language:e.language,reason:d}},retryable:!1}}let c;try{c=Za(e.scipPath).size}catch{c=void 0}return{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:S()-s,command:o,outputBytes:c},retryable:!1}}function co(){let e=Number(process.env.CODEBASEIQ_INDEXER_TIMEOUT_MS);return Number.isFinite(e)&&e>0?Math.floor(e):Dn.indexer}function lo(e){return e instanceof Fn?e.kind==="spawn"&&vr(e.cause):vr(e)}function vr(e){let t=e?.code;return t==="EAGAIN"||t==="ENOMEM"||t==="EMFILE"||t==="ENFILE"||t==="ETXTBSY"}import{execFileSync as wr}from"child_process";import{homedir as Tr,platform as uo}from"os";import{delimiter as po,join as Fe}from"path";function Dr(e,t){let n=e.installMethods,r=ge(e);if(!n?.length)return t(`No auto-install method available for ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1;for(let i of n){if(!i.identity||!i.destination){t(`Refusing ${i.label} installation for ${r}: the installer descriptor lacks an immutable identity or destination.`);continue}if(!Ot(i.prerequisite))continue;let a=go(i);t(`Installing immutable ${i.identity} via ${i.label} into ${a}; expected executable: ${r}.`);try{wr(i.binary,i.args,{stdio:"inherit",windowsHide:!0,timeout:3e5,env:process.env,shell:uo()==="win32"});let o=te(e);if(o){let s=o===e.indexerBinary?"":` (using ${o})`;return t(`Successfully installed ${i.identity} via ${i.label}${s}; resolved executable: ${o}.`),!0}t(`${i.label} command completed but ${r} was not found on PATH`)}catch(o){let s=o instanceof Error?o.message:String(o);t(`${i.label} install failed: ${s}`)}}return t(`Could not auto-install ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1}function go(e){if(e.binary==="npm")return ft("npm",["root","-g"])??e.destination;if(e.binary==="go"){let t=ft("go",["env","GOBIN"]);if(t)return t;let n=ft("go",["env","GOPATH"]);if(n)return Fe(n.split(po)[0],"bin")}return e.binary==="dotnet"?Fe(process.env.DOTNET_CLI_HOME??Tr(),".dotnet","tools"):e.binary==="dart"?Fe(process.env.PUB_CACHE??Fe(Tr(),".pub-cache"),"bin"):e.destination}function ft(e,t){try{return wr(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL",env:process.env}).trim()||null}catch{return null}}async function zd(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log}=e,i=e.skipAutoInstall===!0||e.installMissing!==!0,a=So(e),o=Date.now(),s=S();je(h(a.outputScip),{recursive:!0}),je(h(a.outputDb),{recursive:!0});let c=e.languages??We(t);if(c.length===0)throw new Error("No supported languages detected in this project. Looked for: tsconfig.json, Cargo.toml, go.mod, pyproject.toml, etc.");r(`Detected languages: ${c.join(", ")}`);let l=ue("reindex.fingerprint",()=>Mt(t,c,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),{languages:c.length}),d,p;if(e.skipIfUnchanged!==!1&&!hn(t,a.outputDb)&&Fr(a.outputScip)===Fr(v(h(a.outputDb),"index.scip"))){let f=pe(t);if(d=f?.clean?ye(f,l):void 0,f&&!f.clean&&!bo(a)){let y=yn(f,c,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath});if(y)try{be({snapshot:y.snapshot,manifest:y.manifest,targetCacheDir:h(a.outputDb),targetProjectRoot:t,persistLease:!1}),xn(y.snapshot,h(a.outputDb)),r(`Forked shared baseline ${y.snapshot.generationId.slice(0,12)} for dirty worktree reindex`)}catch(R){r(`Shared baseline fork failed; continuing locally: ${N(R)}`)}}else if(d){let y=Je(d);if(y){if(!yo(a,l))try{be({snapshot:d,manifest:y,targetCacheDir:h(a.outputDb),targetProjectRoot:t}),r(`Attached shared generation ${d.generationId.slice(0,12)}`)}catch(R){r(`Shared generation attach failed; continuing locally: ${N(R)}`)}}else{let R=await Sn(d);if(R.kind==="owner")p=R.release;else if(R.kind==="generation-ready"){let E=Je(d);if(E)try{be({snapshot:d,manifest:E,targetCacheDir:h(a.outputDb),targetProjectRoot:t,action:"waited"}),r(`Attached shared generation ${d.generationId.slice(0,12)} after waiting`)}catch(P){r(`Shared generation attach failed after waiting; continuing locally: ${N(P)}`)}}else r("Shared generation build lock timed out; continuing with an isolated local reindex")}}}let g=jt(v(h(a.outputDb),"cache-lifecycle.lock"),{waitMs:3e4});if(!g)throw p?.(),new Error(`Could not acquire codebaseiq cache lifecycle lock for ${h(a.outputDb)}.`);let m;try{m=await Z("reindex.lock",()=>Ho(v(h(a.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:r}),{languages:c.length})}catch(f){throw g.release(),p?.(),f}let x=null,_=Ln();try{mn(a.outputDb,a.outputScip,a.metaPath);let f=Eo(h(a.outputDb));f.removed>0&&r(`Removed ${f.removed} abandoned reindex workspace(s)`);for(let W of f.errors)r(`Could not remove abandoned reindex workspace: ${W}`);let y=null,R=ue("reindex.reuse-check",()=>(y=Ro({opts:e,paths:a,languages:c,fingerprint:l,start:o,monotonicStart:s,onStatus:r}),y),()=>({languages:c.length,reused:y!==null}));if(R){kr({snapshot:d,paths:a,projectRoot:t,fingerprint:l,onStatus:r});let W=qe(a.outputDb,R);return W.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${W.reason}`),Ue(t,h(a.outputDb)),R}let E=Po(a);x=E.runDir;let P,b=await Z("reindex.fresh",async()=>(P=await Io({opts:e,languages:c,projectRoot:t,paths:a,tempPaths:E,fingerprint:l,start:o,monotonicStart:s,maxHeapMb:n,skipAutoInstall:i,onStatus:r,writeTelemetry:_}),P),()=>({languages:c.length,reused:P?.reused,skipped:P?.skipped.length}));kr({snapshot:d,paths:a,projectRoot:t,fingerprint:l,onStatus:r});let B=qe(a.outputDb,b);return B.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${B.reason}`),Ue(t,h(a.outputDb)),b}catch(f){let y=Ne({trigger:e.trigger,result:"failed",start:o,monotonicStart:s,error:f instanceof Error?f.message:String(f)});Qr(a.metaPath,y);let R=nn(a.outputDb,y);throw R.state==="failed"&&r(`Warning: failed reindex activity telemetry was not recorded: ${R.reason}`),f}finally{if(x){let f=x;try{q(()=>Y(f,{recursive:!0,force:!0}))}catch(y){r(`Warning: temporary reindex workspace was left behind: ${N(y)}`)}}m(),g.release(),p?.()}}function kr(e){if(e.snapshot)try{let t=pe(e.projectRoot),n=t?ye(t,e.fingerprint):void 0;if(!n||n.generationId!==e.snapshot.generationId){e.onStatus("Skipped shared generation publication because the worktree changed during indexing");return}let r=bn({snapshot:e.snapshot,sourceCacheDir:h(e.paths.outputDb),sourceProjectRoot:e.projectRoot,sourceStillValid:()=>{let i=pe(e.projectRoot);return(i?ye(i,e.fingerprint):void 0)?.generationId===e.snapshot?.generationId}});Rn(e.snapshot,h(e.paths.outputDb),"built"),e.onStatus(r.kind==="published"?`Published shared generation ${e.snapshot.generationId.slice(0,12)} (${r.achievedDurability})`:`Shared generation ${e.snapshot.generationId.slice(0,12)} was already available (${r.achievedDurability})`)}catch(t){e.onStatus(`Shared generation publication failed; local index remains valid: ${N(t)}`)}}function yo(e,t){if(!T(e.outputScip)||!T(e.outputDb)||!Vr(e.metaPath,t))return!1;let n=$(e.outputDb,e.metaPath);return n.state!=="invalid"&&n.state!=="drifted"}function bo(e){if(!T(e.outputScip)||!T(e.outputDb)||!V(e.metaPath))return!1;let t=$(e.outputDb,e.metaPath);return t.state!=="invalid"&&t.state!=="drifted"}function N(e){return e instanceof Error?e.message:String(e)}function yt(e,t,n,r,i,a){try{re(Nn({indexPath:n,reuseExisting:i,affectedFiles:a}),{projectRoot:e,dbPath:t,onStatus:r})}catch(o){r(`Runtime-boundary extraction unavailable: ${o instanceof Error?o.message:String(o)}.`)}}function So(e){let t=e.outputScip??v(e.projectRoot,"index.scip"),n=e.outputDb??v(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:v(h(n),"meta.json")}}function Ro(e){let t=$(e.paths.outputDb,e.paths.metaPath);if(e.opts.skipIfUnchanged===!1||!T(e.paths.outputScip)||!T(e.paths.outputDb)||!Vr(e.paths.metaPath,e.fingerprint)||t.state==="invalid"||t.state==="drifted")return null;re(ne(),{projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),yt(e.opts.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0),$(e.paths.outputDb,e.paths.metaPath).state==="drifted"&&(He(e.paths.outputDb,e.paths.metaPath),e.onStatus("Published refreshed SQLite generation after post-index augmentation"));let n=S()-e.monotonicStart,r=Ne({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:e.languages,skipped:[]});return Qr(e.paths.metaPath,r),e.onStatus(`Index unchanged; reused existing SQLite index in ${(n/1e3).toFixed(1)}s`),{languages:e.languages,indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:n,reused:!0,skipped:[],lastRefresh:r,shards:xo(e.paths,e.opts.projectRoot,e.languages,e.opts)}}function xo(e,t,n,r){let i=Xr(t,n,r);return n.map(a=>({id:a,language:a,reused:!0,fingerprint:ie(i[a]),outputBytes:ae(St(e.outputDb,a)),durationMs:0}))}function Po(e){let t=_t(v(h(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:v(t,ke(e.outputScip)),tempOutputDb:v(t,ke(e.outputDb)),tempMetaPath:v(t,ke(e.metaPath))}}function Eo(e){let t=[],n;try{n=Cr(e,{withFileTypes:!0})}catch(i){return{removed:0,errors:[N(i)]}}let r=0;for(let i of n)if(!(!i.name.startsWith("reindex-")||!i.isDirectory()))try{Y(v(e,i.name),{recursive:!0,force:!0}),r+=1}catch(a){t.push(`${i.name}: ${N(a)}`)}return{removed:r,errors:t}}async function Io(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},n,r=await Z("reindex.language-indexers",async()=>(n=await _o(e,t),n),()=>({languages:e.languages.length,indexed:n?.indexedOutputs.length,reused:n?.reusedLanguages.length,skipped:n?.skippedLanguages.length})),{indexedOutputs:i,skippedLanguages:a,reusedLanguages:o,languageFingerprints:s,shards:c,typescriptProjectShardContext:l,incrementalTypeScript:d}=r;if(o.length>0&&e.onStatus(`Reused ${o.length} cached language shard(s): ${o.join(", ")}`),vo({run:e,indexedOutputs:i,skippedLanguages:a,reusedLanguages:o})){let g=ue("reindex.publish",()=>No(e,i,a,o,s,l),{mode:"metadata-only",languages:i.length,reused:o.length}),m=g.durationMs;return e.onStatus(`All language shards unchanged; reused existing SQLite index in ${(m/1e3).toFixed(1)}s`),{languages:i.map(x=>x.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:m,reused:!0,skipped:a,lastRefresh:g,shards:c,writeTelemetry:e.writeTelemetry}}let p=await Z("reindex.publish",()=>Lo(e,t,i,a,o,s,l,d),{mode:d?"incremental-or-fallback":"full",languages:i.length,reused:o.length,skipped:a.length}),u=p.durationMs;return e.onStatus(`Done in ${(u/1e3).toFixed(1)}s`),{languages:i.map(g=>g.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:u,reused:!1,skipped:a,lastRefresh:p,shards:c,writeTelemetry:e.writeTelemetry}}function vo(e){if(e.run.opts.skipIfUnchanged===!1||e.skippedLanguages.length>0||!T(e.run.paths.outputScip)||!T(e.run.paths.outputDb))return!1;let t=$(e.run.paths.outputDb,e.run.paths.metaPath);if(t.state==="invalid"||t.state==="drifted")return!1;let n=new Set(e.reusedLanguages),r=new Set(e.indexedOutputs.map(i=>i.language));return e.run.languages.length>0&&r.size===e.run.languages.length&&e.indexedOutputs.length===e.run.languages.length&&e.run.languages.every(i=>n.has(i)&&r.has(i))}async function _o(e,t){let n=ko({paths:e.paths,projectRoot:e.projectRoot,languages:e.languages,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath}),r=[],i=new Set;for(let[w,xt]of n)xt.reused&&(r.push({language:w,scipPath:xt.scipPath}),i.add(w));for(let w of i)e.onStatus(`Reusing cached ${w} SCIP shard (language inputs unchanged).`);let a=n.get("typescript"),o=$(e.paths.outputDb,e.paths.metaPath),s=V(e.paths.metaPath),c=(o.state==="legacy"||o.state==="current")&&s!==null&&Ce(s),l=s?.scipCompanion!=="deferred"&&(o.state!=="current"||o.generation.publication?.scipCompanion!=="deferred"),d=a&&!a.reused&&c?Er({projectRoot:e.projectRoot,cacheDir:h(e.paths.outputDb),previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,previousShardPath:a.scipPath,candidateShardPath:oe(e.tempPaths.tempOutputScip,"typescript-incremental",0),candidateAffectedScipPath:oe(e.tempPaths.tempOutputScip,"typescript-affected",0),baseShardCurrent:l,previousSnapshot:bt(e.paths.metaPath),currentSnapshot:e.fingerprint,projectMode:e.opts.typescriptProjectMode,onStatus:e.onStatus}):null,p=new Set(d?["typescript"]:[]),u=d?void 0:To(e,n),{preparedRuns:g,skippedLanguages:m,languageOutputScipPaths:x}=Co({languages:e.languages.filter(w=>!i.has(w)&&!p.has(w)),tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:t,skipAutoInstall:e.skipAutoInstall,trustProjectTools:e.opts.trustProjectTools===!0,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,preDiscoveredTypeScriptProjects:u?.allProjects,clojureConfigPath:e.opts.clojureConfigPath,onStatus:e.onStatus}),_=u?g.filter(w=>w.language!=="typescript"||u.missedProjectIds.has(w.id)):g,f=await _r(_,e.projectRoot,e.onStatus,e.opts.indexerConcurrency,e.opts.signal),y=[];if(u){Do(e.paths.outputDb,f,e.writeTelemetry);let w=x.typescript??e.tempPaths.tempOutputScip;y=Fo({outputDb:e.paths.outputDb,tempOutputScip:e.tempPaths.tempOutputScip,outputScipPath:w,reusedProjects:u.reusedProjects,writeTelemetry:e.writeTelemetry})}let R=[...f,...y],{indexedOutputs:E}=Uo(R,m),P=d?[{language:"typescript",scipPath:d.scipPath}]:[],b=[...r,...P,...E];Go(b,m,e.languages,e.opts.allowPartial,e.onStatus);let B=d?[{id:"typescript",language:"typescript",label:"typescript (incremental documents)",scipPath:d.scipPath,outputScipPath:d.scipPath,durationMs:d.durationMs,command:"watch-service:typescript-index",outputBytes:ae(d.scipPath)??void 0}]:[],W=jo(n,[...f,...B],u?{outputDb:e.paths.outputDb,classification:u.classification}:void 0);return{indexedOutputs:b,skippedLanguages:m,reusedLanguages:[...i],languageFingerprints:Oo(n,e.languages),shards:W,typescriptProjectShardContext:u?{projects:u.allProjects,fingerprints:u.fingerprints}:void 0,incrementalTypeScript:d??void 0}}function To(e,t){let n=t.get("typescript");if(!n||n.reused||e.opts.typescriptProjectMode!=="workspace")return;let r=z(e.projectRoot,e.opts.typescriptProjects);if(r.length===0)return;let i=lr(e.projectRoot,r),a=sr(n.fingerprint.files,r),o=cr(r,i),s=dr(r,a,o),c=V(e.paths.metaPath),d=wo(c,s,m=>T(Le(e.paths.outputDb,m))),p=[...d.entries()].filter(([,m])=>m.reused).map(([m])=>m),u=new Set(p),g=new Set(r.filter(m=>!u.has(m)).map(m=>`typescript:${m}`));return{allProjects:r,fingerprints:s,classification:d,reusedProjects:p,missedProjectIds:g}}function wo(e,t,n){let r=new Map;for(let i of Object.keys(t)){let a=t[i];if(!e){r.set(i,{reused:!1,reason:"no reindex metadata found",fingerprint:a});continue}let o=e.version===K&&Me(e).typescriptProjectShardReuse?e.typescriptProjectShards?.[i]:void 0;if(!o){r.set(i,{reused:!1,reason:"no cached fingerprint for this project",fingerprint:a});continue}if(!n(i)){r.set(i,{reused:!1,reason:"cached shard file missing on disk",fingerprint:a});continue}if(k(o)!==k(a)){r.set(i,{reused:!1,reason:"project inputs changed since last index",fingerprint:a});continue}r.set(i,{reused:!0,fingerprint:a})}return r}function Do(e,t,n){for(let r of t){if(r.skipped||!r.id.startsWith("typescript:"))continue;let i=r.id.slice(11),a=Le(e,i);je(h(a),{recursive:!0}),G(n,U(r.scipPath,a))}}function Fo(e){return e.reusedProjects.map((t,n)=>{let r=Le(e.outputDb,t),i=oe(e.tempOutputScip,"typescript-project-cached",n);return G(e.writeTelemetry,U(r,i)),{id:`typescript:${t}`,language:"typescript",label:`typescript (${t})`,scipPath:i,outputScipPath:e.outputScipPath,durationMs:0,command:"cached",outputBytes:ae(i)??void 0}})}function ko(e){let t=V(e.paths.metaPath),n=Xr(e.projectRoot,e.languages,e),r=new Map;for(let i of e.languages){let a=St(e.paths.outputDb,i),o=n[i];if(!t){r.set(i,{reused:!1,reason:"no reindex metadata found",fingerprint:o,scipPath:a});continue}if(t.version!==K){r.set(i,{reused:!1,reason:`metadata version ${String(t.version??"unknown")} predates per-language shard caching`,fingerprint:o,scipPath:a});continue}if(i==="typescript"&&t.scipCompanion==="deferred"){r.set(i,{reused:!1,reason:"whole TypeScript SCIP companion is deferred behind changed-document overlays",fingerprint:o,scipPath:a});continue}if(!Me(t).languageShardReuse||!t.languageFingerprints){r.set(i,{reused:!1,reason:"no per-language fingerprints recorded in metadata",fingerprint:o,scipPath:a});continue}let s=t.languageFingerprints[i];if(!s){r.set(i,{reused:!1,reason:"no cached fingerprint for this language",fingerprint:o,scipPath:a});continue}if(!T(a)){r.set(i,{reused:!1,reason:"cached shard file missing on disk",fingerprint:o,scipPath:a});continue}if(k(s)!==k(o)){r.set(i,{reused:!1,reason:"language inputs changed since last index",fingerprint:o,scipPath:a});continue}r.set(i,{reused:!0,fingerprint:o,scipPath:a})}return r}function jo(e,t,n){let r=[];for(let[i,a]of e)a.reused&&r.push({id:i,language:i,reused:!0,fingerprint:ie(a.fingerprint),outputBytes:ae(a.scipPath),durationMs:0});for(let i of t){let a=e.get(i.language),o=n&&i.id.startsWith("typescript:")?i.id.slice(11):null,s=o?n.classification.get(o):void 0;r.push({id:i.id,language:i.language,reused:!1,missReason:s?.reason??a?.reason??i.skipped?.reason,fingerprint:s?ie(s.fingerprint):a?ie(a.fingerprint):"unknown",outputBytes:i.outputBytes??null,durationMs:i.durationMs,command:i.command})}if(n)for(let[i,a]of n.classification)a.reused&&r.push({id:`typescript:${i}`,language:"typescript",reused:!0,fingerprint:ie(a.fingerprint),outputBytes:ae(Le(n.outputDb,i)),durationMs:0});return r}function ie(e){return fo("sha256").update(k(e)).digest("hex").slice(0,16)}function ae(e){try{return mo(e).size}catch{return null}}function Oo(e,t){let n={};for(let r of t){let i=e.get(r);i&&(n[r]=i.fingerprint)}return n}async function Lo(e,t,n,r,i,a,o,s){D(e.opts.signal,"Reindex cancelled by its owner.");let c=!s||s.completeScipUpdated,l=!1;c&&(jr(e.paths.outputDb,n,e.writeTelemetry),l=Or(n,e.tempPaths.tempOutputScip,e.onStatus));let d=await Bo({run:e,indexedOutputs:n,skippedLanguages:r,reusedLanguages:i,incrementalTypeScript:s,completeScipAvailable:c,completeScipSanitized:l,materializeFullFallback:async()=>{if(D(e.opts.signal,"Reindex cancelled by its owner."),!s||s.completeScipUpdated)return l;e.onStatus("Materializing the deferred whole TypeScript SCIP companion for full conversion..."),Ir({cacheDir:h(e.paths.outputDb),generationIdentity:s.nextFragmentGeneration,baseShardPath:s.scipPath,candidateShardPath:s.candidateScipPath});let E=n.map(P=>P.language==="typescript"?{language:P.language,scipPath:s.candidateScipPath}:P);return jr(e.paths.outputDb,E,e.writeTelemetry),l=Or(E,e.tempPaths.tempOutputScip,e.onStatus),l}});D(e.opts.signal,"Reindex cancelled by its owner."),re(ne(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),yt(e.projectRoot,e.tempPaths.tempOutputDb,e.tempPaths.tempOutputScip,e.onStatus,!1,s?.affectedFiles);let p=nt(e.tempPaths.tempOutputDb);if(p.added.length>0&&e.onStatus(`Added SQLite query indexes: ${p.added.join(", ")}`),p.removed.length>0&&e.onStatus(`Removed redundant SQLite indexes: ${p.removed.join(", ")}`),d.mode==="incremental"&&s){let E=null,P=null;try{E=new F({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,indexPath:e.tempPaths.tempOutputScip}),P=new F({projectRoot:e.projectRoot,dbPath:e.paths.outputDb,indexPath:e.paths.outputScip});let b=Jt(E,e.fingerprint,s.referenceFragmentsByFile,P);e.onStatus(`Cached exact TypeScript reference fragments for ${b} affected document(s).`)}catch(b){e.onStatus(`Exact TypeScript reference fragment prefill unavailable: ${b instanceof Error?b.message:String(b)}.`)}finally{E?.close(),P?.close()}}let u=bt(e.paths.metaPath),g=d.mode==="incremental"&&s?qo(s,d.changedDocumentPaths):Ke({projectRoot:e.projectRoot,previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.tempPaths.tempOutputDb,candidateIndexPath:e.tempPaths.tempOutputScip,previousSnapshot:u,currentSnapshot:e.fingerprint,refreshResult:"rebuilt"}),m=Ne({trigger:e.opts.trigger,result:"rebuilt",start:e.start,monotonicStart:e.monotonicStart,languages:n.map(E=>E.language),skipped:[...r]}),x=d.mode==="incremental"&&d.scipCompanion==="deferred",_={...a};x&&delete _.typescript;let{metadata:f,pruneProjects:y}=Gr({run:e,indexedOutputs:n,skippedLanguages:r,reusedLanguages:i,languageFingerprints:_,typescriptProjectShardContext:o,lastRefresh:m});f.scipCompanion=x?"deferred":"current",Br(e.paths.outputDb,y),Rt(e.tempPaths.tempMetaPath,f);let R=fn({tempOutputScip:e.tempPaths.tempOutputScip,tempOutputDb:e.tempPaths.tempOutputDb,tempMetaPath:e.tempPaths.tempMetaPath,outputScip:e.paths.outputScip,outputDb:e.paths.outputDb,metaPath:e.paths.metaPath,preserveOutputScip:d.mode==="incremental"&&d.scipCompanion==="deferred",publication:d.mode==="incremental"?{mode:"incremental",validation:"passed",converterDurationMs:d.converterDurationMs,affectedDocumentCount:s?.affectedFiles.length,changedDocumentCount:d.changedDocumentPaths.length,producerDurationMs:s?.timings.serviceMs,materializationDurationMs:s?.durationMs,patchDurationMs:d.patchDurationMs,scipCompanion:d.scipCompanion,...d.scipCompanion==="deferred"&&s?{typescriptOverlayGeneration:s.nextFragmentGeneration}:{}}:{mode:"full",validation:"passed",converterDurationMs:d.converterDurationMs,scipCompanion:"current",...d.fallbackReason?{fallbackReason:d.fallbackReason}:{}}});return R.achievedDurability==="file-flushed"&&e.onStatus(`Published local generation ${R.currentGeneration.slice(0,12)} (file-flushed; directory sync unsupported)`),gn(h(e.paths.outputDb),d.mode==="incremental"&&d.scipCompanion==="deferred"?[s.nextFragmentGeneration]:[]),dn(h(e.paths.outputDb),s?.completeScipUpdated?[s.nextFragmentGeneration]:[]),Ur(e.paths.outputDb,g,e.onStatus),m}function No(e,t,n,r,i,a){let o=bt(e.paths.metaPath),s=null;try{G(e.writeTelemetry,U(e.paths.outputDb,e.tempPaths.tempOutputDb))}catch(u){s=Gn("reused","oracle-error",`Could not snapshot the prior database: ${u instanceof Error?u.message:String(u)}`)}re(ne(),{projectRoot:e.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),yt(e.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0);let c=nt(e.paths.outputDb);c.added.length>0&&e.onStatus(`Added SQLite query indexes: ${c.added.join(", ")}`),c.removed.length>0&&e.onStatus(`Removed redundant SQLite indexes: ${c.removed.join(", ")}`),s??=Ke({projectRoot:e.projectRoot,previousDbPath:e.tempPaths.tempOutputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.paths.outputDb,candidateIndexPath:e.paths.outputScip,previousSnapshot:o,currentSnapshot:e.fingerprint,refreshResult:"reused"});let l=Ne({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:t.map(u=>u.language),skipped:[...n]}),{metadata:d,pruneProjects:p}=Gr({run:e,indexedOutputs:t,skippedLanguages:n,reusedLanguages:r,languageFingerprints:i,typescriptProjectShardContext:a,lastRefresh:l});return Br(e.paths.outputDb,p),Rt(e.paths.metaPath,d),He(e.paths.outputDb,e.paths.metaPath),Ur(e.paths.outputDb,s,e.onStatus),l}function bt(e){return vt(V(e)?.fingerprint)}function Ur(e,t,n){try{Wn(e,t),t.status==="evaluated"?n(`Affected-set shadow: ${(t.evaluation.recall*100).toFixed(1)}% recall; ${t.plan.affectedFiles.length} predicted, ${t.comparison.changedFiles.length} changed.`):n(`Affected-set shadow unavailable: ${t.reason}.`)}catch(r){n(`Affected-set shadow telemetry unavailable: ${r instanceof Error?r.message:String(r)}`)}}function Gr(e){let t=Ao({mode:e.run.opts.typescriptProjectMode,skippedLanguages:e.skippedLanguages,reusedLanguages:e.reusedLanguages,context:e.typescriptProjectShardContext,metaPath:e.run.paths.metaPath});return{metadata:{version:K,status:e.skippedLanguages.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.run.fingerprint,sqliteLayoutVersion:2,languageFingerprints:e.languageFingerprints,typescriptProjectShards:t.field,requestedLanguages:e.run.languages,indexedLanguages:e.indexedOutputs.map(n=>n.language),skipped:[...e.skippedLanguages],lastRefresh:e.lastRefresh},pruneProjects:t.pruneProjects}}function Ao(e){if(e.mode!=="workspace")return{field:void 0,pruneProjects:null};if(e.skippedLanguages.some(t=>t.language==="typescript"))return{field:void 0,pruneProjects:null};if(e.reusedLanguages.includes("typescript")){let t=V(e.metaPath),n=t?.version===K?t.typescriptProjectShards:void 0;return{field:n,pruneProjects:n?Object.keys(n):[]}}return e.context?{field:e.context.fingerprints,pruneProjects:e.context.projects}:{field:void 0,pruneProjects:[]}}function Br(e,t){let n=Yr(e);if(t===null){q(()=>Y(n,{recursive:!0,force:!0}));return}let r;try{r=Cr(n)}catch{return}for(let i of Mo(r,t))q(()=>Y(v(n,i),{force:!0}))}function Mo(e,t){let n=new Set(t.map(r=>`${ot(r)}.scip`));return e.filter(r=>!n.has(r))}function jr(e,t,n){for(let r of t){let i=St(e,r.language);je(h(i),{recursive:!0}),r.scipPath!==i&&G(n,U(r.scipPath,i))}}function Co(e){let t=[],n=[],r=e.languages.map((a,o)=>({language:a,scipPath:e.languages.length>1?oe(e.tempOutputScip,a,o):e.tempOutputScip})),i=Object.fromEntries(r.map(({language:a,scipPath:o})=>[a,o]));for(let{language:a,scipPath:o}of r){let s=$o({...e,language:a,scipPath:o});for(let c of s)"skipped"in c?Wr(n,c.skipped):t.push(c.prepared)}return{preparedRuns:t,skippedLanguages:n,languageOutputScipPaths:i}}function $o(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[mt({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=e.preDiscoveredTypeScriptProjects??z(e.projectRoot,e.typescriptProjects);return t.length===0?[mt({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})]:(e.onStatus(`Indexing TypeScript workspace as ${t.length} project shard(s).`),t.map((n,r)=>mt({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:oe(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function mt(e){let t=Ze(e.language),n=ge(t),r=$t(t,e.projectRoot),i=e.trustProjectTools&&r?Ut(t,e.projectRoot):null,a=te(t);if(!i&&!a&&r){let d=`${n} is available only as repository-local code at ${r}. Review that exact tool and rerun with --trust-project-tools.`;return e.onStatus(`Skipping ${e.language}: ${d}`),{skipped:{language:e.language,reason:d}}}if(!i&&!a&&!Ct(t)){if(e.skipAutoInstall){let d=`${n} not found on PATH. To install the reviewed version, run: codebaseiq reindex --install-missing${t.installUrl?` (manual source: ${t.installUrl})`:""}`;return e.onStatus(`Skipping ${e.language}: ${d}`),{skipped:{language:e.language,reason:d}}}if(e.onStatus(`${n} not found. Attempting auto-install...`),!Dr(t,e.onStatus)){let d=`${n} could not be auto-installed. ${t.installUrl?`Install manually from ${t.installUrl}`:`Install ${n} and put it on PATH.`}`;return e.onStatus(`Skipping ${e.language}: ${d}`),{skipped:{language:e.language,reason:d}}}}let o=i?.canonicalPath??te(t);if(!o){let d=`${n} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${d}`),{skipped:{language:e.language,reason:d}}}let{binary:s,args:c}=t.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:o,projectPath:e.projectPath,configPath:e.language==="clojure"?e.clojureConfigPath:void 0}),l=Vn({language:e.language,projectPath:e.projectPath,pnpmWorkspaces:e.pnpmWorkspaces});if(i&&!i.executable){let d=`${i.relativePath} is not executable; refusing project-local indexer.`;return e.onStatus(`Skipping ${e.language}: ${d}`),{skipped:{language:e.language,reason:d}}}return i&&e.onStatus(`Trusted project-local ${e.language} indexer ${i.relativePath} (${i.sha256.slice(0,12)}\u2026, ${i.canonicalPath}).`),{prepared:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,config:t,resolvedBinary:o,binary:s,args:c,env:Bt(t,e.env,o),...l===void 0?{}:{temporaryRootConfigContent:l},...i?{trustedProjectTool:i}:{}}}}function Uo(e,t){let n=new Map;for(let i of e)if(i.skipped)Wr(t,i.skipped);else{let a=`${i.language}\0${i.outputScipPath}`,o=n.get(a)??{language:i.language,outputScipPath:i.outputScipPath,scipPaths:[]};o.scipPaths.push(i.scipPath),n.set(a,o)}let r=[];for(let i of n.values())if(i.scipPaths.length>1)en(i.scipPaths,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath});else{let a=i.scipPaths[0];a!==i.outputScipPath&&$r(a,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath})}return{indexedOutputs:r}}function Wr(e,t){let n=e.find(r=>r.language===t.language);if(!n){e.push(t);return}n.reason.includes(t.reason)||(n.reason=`${n.reason}; ${t.reason}`)}function Go(e,t,n,r,i){if(e.length===0){let a=t.map(o=>` - ${o.language}: ${o.reason}`).join(`
274
+ `);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
275
+ `+a)}if(t.length!==0&&(i(`Indexed ${e.length} language output(s); skipped or incomplete: ${t.map(a=>a.language).join(", ")}.`),!r))throw new Error(`Failed to index all required languages; preserving the previous index. Pass --allow-partial to intentionally write an incomplete index.
276
+ `+t.map(a=>` - ${a.language}: ${a.reason}`).join(`
277
+ `))}function Or(e,t,n){if(e.length>1){n(`Merging ${e.length} language indexes...`);let r=performance.now(),i=tn(e.map(a=>a.scipPath),t);return qr(i,n),n(`Merged and sanitized SCIP indexes in ${(performance.now()-r).toFixed(0)}ms.`),!0}else e[0].scipPath!==t&&$r(e[0].scipPath,t);return!1}async function Bo(e){let t;if(Wo(e)){let i=v(e.run.tempPaths.runDir,"typescript-affected.db");try{e.run.onStatus(`Converting ${e.incrementalTypeScript.affectedFiles.length} affected TypeScript document(s) to SQLite...`);let a=performance.now();Lr(e.incrementalTypeScript.affectedScipPath,i,e.run.onStatus,!1,e.run.opts.signal),e.run.onStatus(`Converted affected SCIP documents in ${(performance.now()-a).toFixed(0)}ms.`);let o=nr({previousDbPath:e.run.paths.outputDb,miniDbPath:i,candidateDbPath:e.run.tempPaths.tempOutputDb,affectedFiles:e.incrementalTypeScript.affectedFiles,writeTelemetry:e.run.writeTelemetry});return e.run.onStatus(`Patched ${o.affectedDocumentCount} SQLite document(s) in ${(o.durationMs/1e3).toFixed(3)}s.`),{mode:"incremental",changedDocumentPaths:o.changedDocumentPaths,patchDurationMs:o.durationMs,converterDurationMs:performance.now()-a,scipCompanion:e.incrementalTypeScript.completeScipUpdated?"current":"deferred"}}catch(a){D(e.run.opts.signal,"Reindex cancelled by its owner."),t=a instanceof Error?a.message:String(a),q(()=>Y(i,{force:!0})),q(()=>Y(e.run.tempPaths.tempOutputDb,{force:!0})),e.run.onStatus(`Incremental SQLite publication unavailable: ${t}. Falling back to complete conversion.`)}}let n=e.completeScipSanitized;e.completeScipAvailable||(n=await e.materializeFullFallback());let r=performance.now();return Lr(e.run.tempPaths.tempOutputScip,e.run.tempPaths.tempOutputDb,e.run.onStatus,n,e.run.opts.signal),{mode:"full",converterDurationMs:performance.now()-r,...t?{fallbackReason:t}:{}}}function Wo(e){if(!e.incrementalTypeScript||e.skippedLanguages.length>0||!T(e.run.paths.outputDb)||!T(e.run.paths.outputScip))return!1;let t=new Set(e.reusedLanguages);return e.indexedOutputs.length===e.run.languages.length&&e.run.languages.every(n=>n==="typescript"||t.has(n))}function qo(e,t){let n=S(),r=[...t].sort(),i=new Set(r),a={addedFiles:[],modifiedFiles:r,deletedFiles:[],changedFiles:r,unchangedFiles:e.affectedFiles.filter(o=>!i.has(o)).sort()};return{version:1,status:"evaluated",refreshResult:"rebuilt",recordedAt:new Date().toISOString(),durationMs:S()-n,manifest:e.manifest,plan:e.plan,comparison:a,evaluation:Qe(e.plan,a,e.projectFileCount)}}function Lr(e,t,n,r,i){if(D(i,"Reindex cancelled by its owner."),n("Writing the SQLite index..."),!T(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{qr(br(e,t,{sanitize:!r}),n)}catch(a){let o=a instanceof Error?a.message:String(a);throw new Error(`Failed to write the SQLite index: ${o}`,{cause:a})}}function qr(e,t){e.removedDefinitionOccurrences!==0&&t(`Sanitized ${e.removedDefinitionOccurrences} invalid definition occurrences across ${e.touchedDocuments} documents before SQLite conversion.`)}function oe(e,t,n){let r=ho(e)||".scip",i=ke(e,r);return v(h(e),`${i}.${n+1}.${t}${r}`)}async function Ho(e,t){for(let n=0;n<2;n++){let r=Jo(e,t);if(r)return r;let i=zo(e);if(i&&zr(t.trigger,i)){t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}.`);let a;try{a=await Yo(i)}catch(s){throw new Error(`Could not verify the watcher's in-progress reindex owner (pid ${i.pid}); refusing to steal an active lock: ${N(s)}`,{cause:s})}if(!a)throw new Error(`Could not confirm the watcher's in-progress reindex (pid ${i.pid}) terminated for ${h(e)}; refusing to steal an active lock.`);let o=Ge(e,{parseLegacy:Oe});if(!kt(e,o,{parseLegacy:Oe}))throw new Error(`Reindex lock ownership changed before preemption completed for ${h(e)}.`);continue}throw new Error(`Another codebaseiq reindex is already running for ${h(e)}.`)}throw new Error(`Could not acquire codebaseiq reindex lock for ${h(e)}.`)}function Jo(e,t){let n=H(process.pid),r=Ft(e,{kind:"reindex",processIdentity:n,detail:{projectRoot:t.projectRoot,...process.env.SCIP_REINDEX_PROCESS_GROUP_LEADER==="1"?{processGroupLeader:!0}:{},...t.trigger?{trigger:t.trigger}:{}},parseLegacy:Oe});if(r.kind==="acquired"&&r.reclaimed){let i=Hr(r.reclaimed,e);i&&zr(t.trigger,i)?t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}; its prior owner was already stale.`):t.onStatus(`Recovered an abandoned or incomplete reindex lock for ${h(e)}.`)}return r.kind==="acquired"?()=>{r.lock.release()}:null}function zo(e){return Hr(Ge(e,{parseLegacy:Oe}),e)}var Oe=e=>{let t=Jr(e,"");return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function Hr(e,t){if(e.state==="valid"&&e.record?.kind==="reindex"){let n=e.record.detail??{};return{version:2,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},...n.processGroupLeader===!0?{processGroupLeader:!0}:{},projectRoot:typeof n.projectRoot=="string"?n.projectRoot:h(t),startedAt:e.record.startedAt,trigger:n.trigger}}return Jr(e.parsed,t)}function Jr(e,t){try{let n=e;return typeof n.pid!="number"||!Number.isInteger(n.pid)||n.pid<=0?null:{version:n.version===2?2:1,pid:n.pid,...n.processIdentity===void 0?{}:(()=>{let r=Tt(n.processIdentity);return r?.pid===n.pid?{processIdentity:r}:{}})(),...n.processGroupLeader===!0?{processGroupLeader:!0}:{},projectRoot:typeof n.projectRoot=="string"?n.projectRoot:h(t),startedAt:typeof n.startedAt=="string"?n.startedAt:"unknown",trigger:n.trigger}}catch{return null}}function zr(e,t){return e?.kind==="manual-cli"&&Xo(t?.trigger)}function Xo(e){return e?.kind==="watch-source"||e?.kind==="watch-git-head"||e?.kind==="watch-git-index"||e?.kind==="watch-git-state"}async function Yo(e){return!J(e.pid)||(ht(e),Nr(e,"SIGTERM"),await Ar(e,2e3))?!0:(ht(e),Nr(e,"SIGKILL"),Ar(e,1e3))}function Nr(e,t){if(e.processGroupLeader)try{process.kill(-e.pid,t);return}catch{if(!J(e.pid))return;ht(e)}try{process.kill(e.pid,t)}catch{}}async function Ar(e,t){let n=S()+t;for(;S()<n;){if(Mr(e))return!0;await Vo(50)}return Mr(e)}function ht(e){if(!e.processIdentity)throw new Error(`Refusing to signal reindex pid ${e.pid}: its ownership record has no process identity.`);let t=H(e.pid);if(!t)throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity is unavailable.`);if(!ee(e.processIdentity,t))throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity does not match the ownership record.`)}function Mr(e){if(!J(e.pid))return!0;if(!e.processIdentity)return!1;let t=H(e.pid);return t!==null&&!ee(e.processIdentity,t)}function Vo(e){return new Promise(t=>setTimeout(t,e))}function Xr(e,t,n){return Object.fromEntries(t.map(r=>{let i=r==="typescript"?Nt(n.typescriptProjects):[],a=r==="clojure"?Qo(n.clojureConfigPath):void 0,o=[...Ze(r).markerFiles,...i,...a?[a]:[]],s=r==="typescript"?{typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:i}:{typescriptProjectMode:"single",typescriptProjects:[]};return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&&Ko(n),...s,clojureConfigPath:a,files:At(e,{language:r,markerFiles:o})}]}))}function Qo(e){return e?.trim()||void 0}function Ko(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function St(e,t){return v(h(e),"language-indexes",`${t}.scip`)}function Yr(e){return v(h(e),"language-indexes","typescript-projects")}function Le(e,t){return v(Yr(e),`${ot(t)}.scip`)}function V(e){try{return Ae(le(ce(e,"reindex metadata")))}catch{return null}}function Vr(e,t){try{let n=le(ce(e,"reindex metadata"));if(n.kind!=="legacy"&&n.kind!=="supported")return!1;let r=n.metadata;return n.capabilities.publishableGeneration&&Ce(r)&&k(r.fingerprint)===k(t)&&k([...r.indexedLanguages??[]].sort())===k(t.languages)}catch{return!1}}function Rt(e,t){qt(e,t,{spacing:2,trailingNewline:!0})}function Qr(e,t){try{let n=Ae(le(ce(e,"reindex metadata")));if(!n)return;Rt(e,{...n,lastRefresh:t})}catch{}}function Ne(e){return{trigger:e.trigger??{kind:"unknown"},result:e.result,startedAt:new Date(e.start).toISOString(),completedAt:new Date().toISOString(),durationMs:S()-e.monotonicStart,indexedLanguages:e.languages?[...e.languages]:void 0,skipped:e.skipped?[...e.skipped]:void 0,error:e.error}}function k(e){return JSON.stringify(e)}export{xs as a,Ps as b,Ze as c,Dr as d,zd as e};
278
+ //# sourceMappingURL=chunk-O2KWU34K.js.map
@@ -1,7 +1,7 @@
1
- import{a as B}from"./chunk-XYLV727H.js";import{b as N,e as A,h as p,l as I}from"./chunk-ACZDU5GK.js";import{d as J}from"./chunk-6URCE5QY.js";import{d as m,e as L,f as O,h as w}from"./chunk-4O52YNKL.js";import{existsSync as W,statSync as ne}from"fs";import{dirname as F,join as z}from"path";import{appendFileSync as j,existsSync as U,mkdirSync as q,renameSync as X,rmSync as G,statSync as V,truncateSync as K}from"fs";import{basename as Y,dirname as H}from"path";var R=".previous",Q=".rotation.lock",Z=2e3,h=class extends Error{constructor(t,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${t}`);this.lockPath=t;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},S=class extends Error{constructor(t){super(`Rotating JSONL lock ownership changed before release: ${t}`);this.lockPath=t;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},D=Object.freeze({monotonicNow:J,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,i){let t=I(e,{kind:"rotating-jsonl",detail:{target:Y(i)}});return t.kind==="acquired"?{kind:"acquired",lock:t.lock}:{kind:"contended"}},makeDirectory(e){q(e,{recursive:!0})},exists:U,readBytes(e){return O(e,{maxBytes:m,inputKind:"rotating JSONL segment"})},size(e){return V(e).size},truncate:K,remove(e){G(e,{force:!0})},rename:X,append:j});function E(e,i,t){let r=t.runtime??D,a=JSON.stringify(i);if(a===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let s=Buffer.from(`${a}
1
+ import{a as B}from"./chunk-T75DS2E6.js";import{b as N,e as A,h as p,l as I}from"./chunk-D7DOB27N.js";import{a as J}from"./chunk-6O3KXIDL.js";import{d as m,e as L,f as O,h as w}from"./chunk-UQYQBLJX.js";import{existsSync as W,statSync as ne}from"fs";import{dirname as F,join as z}from"path";import{appendFileSync as j,existsSync as U,mkdirSync as q,renameSync as X,rmSync as G,statSync as V,truncateSync as K}from"fs";import{basename as Y,dirname as H}from"path";var R=".previous",Q=".rotation.lock",Z=2e3,h=class extends Error{constructor(t,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${t}`);this.lockPath=t;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},S=class extends Error{constructor(t){super(`Rotating JSONL lock ownership changed before release: ${t}`);this.lockPath=t;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},D=Object.freeze({monotonicNow:J,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,i){let t=I(e,{kind:"rotating-jsonl",detail:{target:Y(i)}});return t.kind==="acquired"?{kind:"acquired",lock:t.lock}:{kind:"contended"}},makeDirectory(e){q(e,{recursive:!0})},exists:U,readBytes(e){return O(e,{maxBytes:m,inputKind:"rotating JSONL segment"})},size(e){return V(e).size},truncate:K,remove(e){G(e,{force:!0})},rename:X,append:j});function E(e,i,t){let r=t.runtime??D,a=JSON.stringify(i);if(a===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let s=Buffer.from(`${a}
2
2
  `),n=Math.max(1,Math.floor(t.maxSegmentBytes),s.length);return M(e,t.lockTimeoutMs,r,()=>{r.makeDirectory(H(e));let d=ee(e,m,r);t.onPhase?.("tail-repaired");let c=`${e}${t.previousSuffix??R}`,o=!1,l=!1;return r.exists(e)&&r.size(e)+s.length>n&&(r.exists(c)&&(r.remove(c),l=!0),t.onPhase?.("previous-pruned"),r.rename(e,c),o=!0,t.onPhase?.("current-rotated")),r.append(e,s),t.onPhase?.("record-appended"),{lineBytes:s.length,segmentLimitBytes:n,repairedTailBytes:d,rotated:o,prunedPrevious:l}})}function P(e,i={}){let t=i.runtime??D,r=te(i.maxSegmentBytes);return M(e,i.lockTimeoutMs,t,()=>{let a=[],s=0,n=`${e}${i.previousSuffix??R}`;for(let d of[n,e]){if(!t.exists(d))continue;let c=ie(_(d,r,t));a.push(...c.lines),s+=c.partialTailBytes}return{lines:a,ignoredPartialTailBytes:s}})}function M(e,i,t,r){let a=`${e}${Q}`,s=Math.max(0,i??Z),n=t.monotonicNow()+s,d;for(;;){let g=t.tryAcquireLock(a,e);if(g.kind==="acquired"){d=g.lock;break}let f=n-t.monotonicNow();if(f<=0)throw new h(a,s);t.wait(Math.min(5,f))}let c=!1,o,l;try{l=r()}catch(g){c=!0,o=g}let u=!1;try{u=d.release()}catch(g){if(!c)throw g}if(c)throw o;if(!u)throw new S(a);return l}function ee(e,i,t){if(!t.exists(e))return 0;let r=_(e,i,t);if(r.length===0||r[r.length-1]===10)return 0;let a=r.lastIndexOf(10),s=a<0?0:a+1;return t.truncate(e,s),r.length-s}function te(e){let i=e??m;if(!Number.isSafeInteger(i)||i<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${i}`);return i}function _(e,i,t){let r=t.size(e);if(r>i)throw new L("rotating JSONL segment",e,"too-large",r,i);let a=t.readBytes(e),s=t.size(e);if(s!==r||a.byteLength!==r)throw new L("rotating JSONL segment",e,"changed-during-read",s,i);return a}function ie(e){let i=e.lastIndexOf(10),t=i<0?0:i+1;return{lines:e.subarray(0,t).toString("utf8").split(`
3
3
  `).filter(a=>a.length>0),partialTailBytes:e.length-t}}var re="reindex-activity.jsonl",b=R,ae=1024*1024,se=1440*60*1e3,C=e=>w(e,"reindex activity segment");function x(e){return z(F(e),re)}function oe(e){if(e.reused)return 0;let i=T(e.indexPath)+T(e.dbPath);for(let t of e.shards??[])!t.reused&&t.outputBytes!==null&&(i+=t.outputBytes);return i}function De(e,i){let t=i.lastRefresh;if(!t)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=oe(i);return k(x(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:t.result,durationMs:t.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:r+(i.writeTelemetry?.fallbackCopiedBytes??0),reflinkedBytes:i.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:i.writeTelemetry?.fallbackCopiedBytes??0,byLanguage:pe(i)})}function Ee(e,i){return k(x(e),{version:1,event:"run",recordedAt:i.completedAt,trigger:i.trigger,result:"failed",durationMs:i.durationMs,estimatedLogicalOutputBytes:0})}function Pe(e,i,t=new Date){return k(x(e),{version:1,event:"suppressed",recordedAt:t.toISOString(),trigger:i,reason:"completed-index-is-fresh"})}function ue(e,i,t=ae,r){E(e,i,{maxSegmentBytes:t,previousSuffix:b,...r?{runtime:r}:{}})}function de(e,i=new Date,t=se,r=C){let a=i.getTime(),s=a-t,n={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(s).toISOString(),windowEndedAt:i.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:{}},d=x(e),c=[];if(r===C){if(!W(d)&&!W(`${d}${b}`))return n;try{let o=P(d,{previousSuffix:b});c=o.lines,n.ignoredPartialTailBytes=o.ignoredPartialTailBytes}catch{n.readErrors+=1,n.confidence="unavailable"}}else{let o=0;for(let l of[`${d}${b}`,d])try{c.push(...ve(r(l))),o+=1}catch{n.readErrors+=1}o===0?n.confidence="unavailable":n.readErrors>0&&(n.confidence="partial")}for(let o of c){n.recordsRead+=1;let l=ce(o);if(!l){n.invalidRecords+=1,n.confidence!=="unavailable"&&(n.confidence="partial");continue}let{record:u}=l,g=Date.parse(u.recordedAt);if(g<s||g>a){n.skippedRecords+=1;continue}if(n.invalidLanguageDetails=(n.invalidLanguageDetails??0)+l.invalidLanguageDetails,n.byTrigger[u.trigger.kind]=(n.byTrigger[u.trigger.kind]??0)+1,u.event==="suppressed"){n.suppressed+=1;continue}n.runs+=1,n[u.result]+=1,n.estimatedLogicalOutputBytes+=u.estimatedLogicalOutputBytes,n.estimatedWriteBytes=(n.estimatedWriteBytes??0)+(u.estimatedWriteBytes??u.estimatedLogicalOutputBytes),n.reflinkedBytes=(n.reflinkedBytes??0)+(u.reflinkedBytes??0),n.fallbackCopiedBytes=(n.fallbackCopiedBytes??0)+(u.fallbackCopiedBytes??0),u.result!=="failed"&&(l.hasLanguageDetails?n.attributedRuns=(n.attributedRuns??0)+1:n.unattributedRuns=(n.unattributedRuns??0)+1);for(let[f,v]of Re(u.byLanguage)){let y=(n.byLanguage??={})[f]??=be();y.runs+=1,y[v.result]+=1,y.producedOutputBytes+=v.producedOutputBytes,y.durationMs+=v.durationMs}u.result==="rebuilt"&&n.oldestRebuildAt===void 0&&(n.oldestRebuildAt=u.recordedAt),(u.estimatedWriteBytes??u.estimatedLogicalOutputBytes)>0&&n.oldestWriteAt===void 0&&(n.oldestWriteAt=u.recordedAt)}return n.ignoredPartialTailBytes>0&&n.confidence!=="unavailable"&&(n.confidence="partial"),n.languageAttribution=xe(n),n}function k(e,i){try{return ue(e,i),{state:"recorded"}}catch(t){return{state:"failed",reason:t instanceof Error?t.message:String(t)}}}function ce(e){try{let i=JSON.parse(e);if(!i||typeof i!="object")return null;let t=i;if(t.version!==1||!N(t.recordedAt)||!t.trigger||!ge(t.trigger.kind))return null;if(t.event==="suppressed")return t.reason==="completed-index-is-fresh"?{record:t,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(t.event!=="run"||t.result!=="rebuilt"&&t.result!=="reused"&&t.result!=="failed"||!p(t.durationMs)||!p(t.estimatedLogicalOutputBytes)||t.estimatedWriteBytes!==void 0&&!p(t.estimatedWriteBytes)||t.reflinkedBytes!==void 0&&!p(t.reflinkedBytes)||t.fallbackCopiedBytes!==void 0&&!p(t.fallbackCopiedBytes))return null;let r=t,{byLanguage:a,...s}=r,n=fe(a);return{record:{...s,...n.byLanguage?{byLanguage:n.byLanguage}:{}},hasLanguageDetails:n.hasLanguageDetails,invalidLanguageDetails:n.invalidLanguageDetails}}catch{return null}}function Me(e,i,t=new Date){return i.enabled?le(de(e,t,i.windowMs),i,t.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function le(e,i,t){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,a={rebuilt:e.rebuilt,estimatedWriteBytes:r};return i.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:t+i.windowMs,...a,detail:`reindex activity evidence is ${e.confidence}`}:e.rebuilt>=i.maxRebuilds?{state:"paused",reason:"rebuild-count",until:$(e.oldestRebuildAt,i.windowMs,t),...a,detail:`${e.rebuilt}/${i.maxRebuilds} automatic rebuild slots consumed`}:r>=i.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:$(e.oldestWriteAt,i.windowMs,t),...a,detail:`${r}/${i.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...a}:{state:"allowed",...a}}function $(e,i,t){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+i>t?r+i:t+i}function ge(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 T(e){try{return ne(e).size}catch{return 0}}function pe(e){let i={};for(let t of e.languages){let r=(e.shards??[]).filter(o=>o.language===t),a=r.find(o=>o.id===t),s=e.reused||(a?a.reused:r.length>0&&r.every(o=>o.reused)),n=T(z(F(e.dbPath),"language-indexes",`${t}.scip`)),d=n>0?n:a?.outputBytes??n,c=s?0:a?.durationMs??r.filter(o=>!o.reused).reduce((o,l)=>o+l.durationMs,0);i[t]={result:s?"reused":"rebuilt",outputBytes:d,producedOutputBytes:s?0:d,durationMs:c}}return i}function fe(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let i={},t=0;for(let[a,s]of Object.entries(e)){if(!me(a)||!ye(s)){t+=1;continue}i[a]=s}let r=Object.keys(i).length>0;return{...r?{byLanguage:i}:{},hasLanguageDetails:r,invalidLanguageDetails:t}}function ye(e){if(!e||typeof e!="object")return!1;let i=e;return(i.result==="rebuilt"||i.result==="reused")&&A(i.outputBytes)&&A(i.producedOutputBytes)&&p(i.durationMs)&&(i.result!=="reused"||i.producedOutputBytes===0&&i.durationMs===0)&&i.producedOutputBytes<=i.outputBytes}function me(e){return B.includes(e)}function Re(e){return e?B.flatMap(i=>{let t=e[i];return t?[[i,t]]:[]}):[]}function be(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function xe(e){let i=e.invalidLanguageDetails??0,t=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&i===0?"complete":t===0?"unavailable":"partial"}function ve(e){return e.endsWith(`
4
4
  `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
5
5
  `)+1))),e.split(`
6
6
  `).filter(i=>i.length>0)}export{R as a,E as b,re as c,De as d,Ee as e,Pe as f,de as g,Me as h};
7
- //# sourceMappingURL=chunk-HBXZAGY6.js.map
7
+ //# sourceMappingURL=chunk-O2M3VNDY.js.map
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{A as G,D as P,a as y,b as ce,i as k,j as le,t as B,u as de,w as j,x as ue,y as b}from"./chunk-FIXYHQ3W.js";import{c as Y,d as H,e as Z,g as X,i as ee,k as x}from"./chunk-PHPQ24UG.js";import{E,a as g,b as Q,c as C,e as S,v as se,x as ae}from"./chunk-N3Q3AWGW.js";import{la as W}from"./chunk-W3FK73MD.js";import{Ga as N,Ha as L,Ja as M,V as te,Wa as oe,Xa as re,Za as ie,ga as T,ka as ne}from"./chunk-RJWAB4VR.js";function ge(e,n,t){if(!Number.isSafeInteger(t.limit)||t.limit<=0)throw new Error("Reference page limit must be a positive safe integer.");let o=N(e,n);if(!o)return{rows:[],hasMore:!1,producer:t.producer??"source-keyset",semanticEnrichment:!1};if(t.producer==="complete-only"||t.semantic===!0||o.relativePath.endsWith(".rb"))return F(e,n,t);let i=oe(e,o);if(!i)return F(e,n,t);let s=fe(e,o),c=Te(e,s),a=[],l=t.producer==="source-keyset";for(let u of c){if(t.after&&u<t.after.relativePath)continue;t.instrumentation?.fileScanned?.(u);let f=re(e,i,u);f.length>0&&(l=!0);let d=new Set(f);s?.relativePath===u&&d.add(s.line);for(let m of[...d].sort((p,Ae)=>p-Ae)){let p={relativePath:u,line:m};if(!(t.after&&R(p,t.after)<=0)&&(a.push(p),t.instrumentation?.rowAccepted?.(p),l&&a.length>t.limit))return me(a,t.limit)}}return l?me(a,t.limit):F(e,n,t,s)}function R(e,n){return(e.relativePath<n.relativePath?-1:e.relativePath>n.relativePath?1:0)||e.line-n.line}function me(e,n){return{rows:e.slice(0,n),hasMore:e.length>n,producer:"source-keyset",semanticEnrichment:!1}}function F(e,n,t,o){let r=N(e,n),i=t.semantic===!0||r?.relativePath.endsWith(".rb")?E(e,n,{semantic:t.semantic}):De(e,n,o),s=Me(i).filter(c=>!t.after||R(c,t.after)>0);for(let c of s.slice(0,t.limit+1))t.instrumentation?.rowAccepted?.(c);return{rows:s.slice(0,t.limit),hasMore:s.length>t.limit,producer:"complete-only",semanticEnrichment:t.semantic===!0}}function De(e,n,t){let o=N(e,n);if(!o)return[];let r=t===void 0?fe(e,o):t,i=ie(e,o).map(s=>({relativePath:s.file,line:s.line}));return r?[r,...i]:i}function fe(e,n){return!ne(n.symbol)&&!e.isIgnored(n.relativePath)?{relativePath:n.relativePath,line:n.startLine}:null}function Te(e,n){let t=te(e);return!n||t.includes(n.relativePath)?t:[...t,n.relativePath].sort((o,r)=>o<r?-1:o>r?1:0)}function Me(e){let n=new Map;for(let t of e)n.set(`${t.relativePath}\0${t.line}`,t);return[...n.values()].sort(R)}import{InvalidArgumentError as v}from"commander";var St=W,Be=/^[+-]?\d+$/u,je=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,xt=(e=>V(e,"an integer")),pe=(e=>{let n=V(e,"a non-negative integer");if(n<0)throw new v(`Expected a non-negative integer, got "${e}".`);return n}),he=(e=>{let n=V(e,"a positive integer");if(n<1)throw new v(`Expected a positive integer, got "${e}".`);return n}),Et=(e=>{if(!je.test(e))throw new v(`Expected a number, got "${e}".`);let n=Number(e);if(!Number.isFinite(n))throw new v(`Expected a finite number, got "${e}".`);return n});function V(e,n){if(!Be.test(e))throw new v(`Expected ${n}, got "${e}".`);let t=Number(e);if(!Number.isSafeInteger(t))throw new v(`Expected ${n}, got "${e}".`);return t}function h(e,n,t,...o){return o.length>0?{flags:e,description:n,parser:t,defaultValue:o[0]}:{flags:e,description:n,parser:t}}function Ge(){return h("--json","Output as JSON for programmatic consumption")}function Fe(){return h("--compact","Emit minified one-line JSON (use with --json)")}function Ve(){return h("--result-only","Emit only the command-owned result (use with --json)")}function Ce(e=[]){return I(e)}function I(e=[]){let n=[Ge(),Ve(),Fe()],t=new Set(n.map(o=>o.flags));return[...e.filter(o=>!t.has(o.flags)),...n]}function $(e,n=[]){return{category:e,examples:n}}function Pt(e,n){return{origin:"mixed",observedSources:e,producerValidation:{status:"not-evaluated"},families:n}}function $t(e,n){return{origin:e,observedSources:n,producerValidation:{status:"not-evaluated"}}}function wt(e,n,t){return{id:e,selector:n,origin:{kind:"fixed",origin:t}}}function Ot(e,n,t,o){return{id:e,selector:n,origin:{kind:"result-field",field:t,values:o}}}function w(e,n,t,o,r,i,s){return{answers:typeof e=="string"?[e]:e,returns:typeof n=="string"?[n]:n,inputs:t,coverage:o,operation:i,semantic:s,...r?{scope:r}:{}}}function Nt(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,K(s.join(" "),c.join("; "),["This command establishes only its declared result units and evidence contract."],void 0,{outputCost:o==="complete"?"bounded":"variable"}))}function ye(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,Ke(c.join("; "),["This command does not establish repository graph relationships unless its result says so explicitly."]))}function be(e,n,t={ranking:"identity-only"}){return{kind:"locator",locates:e,nonClaims:n,outputCost:"small",frontierClosure:["evidence","inspect","code"],...t}}function Lt(e){return{kind:"graph-projection",outputCost:"bounded",frontierClosure:["inspect","code"],...e}}function Re(e,n,t,o={}){return{kind:"source-read",reads:e,nonClaims:n,outputCost:"potentially-large",frontierClosure:[],...t?{compatibility:t}:{},...o}}function K(e,n,t,o,r={}){return{kind:"analysis",analysis:e,resultMeaning:n,nonClaims:t,outputCost:"bounded",frontierClosure:["inspect","code"],...o?{compatibility:o}:{},...r}}function Ke(e,n,t,o={}){return{kind:"maintenance",effect:e,nonClaims:n,outputCost:"variable",frontierClosure:[],...t?{compatibility:t}:{},...o}}function J(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64url")}function A(e){return e.generation.identity}function U(e){return"after"in e?J({version:2,...e}):J({version:1,...e})}function ve(e,n){let t=_e(e);if(!Je(t)&&!Ue(t))throw new Error("Invalid result cursor. Run the command again without --cursor.");return ze(t,n),t}function Je(e){if(!e||typeof e!="object")return!1;let n=e;return n.version===1&&typeof n.command=="string"&&typeof n.target=="string"&&Number.isSafeInteger(n.offset)&&(n.offset??-1)>=0&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function Ue(e){if(!e||typeof e!="object")return!1;let n=e,t=n.after;return n.version===2&&typeof n.command=="string"&&typeof n.target=="string"&&!!t&&typeof t.relativePath=="string"&&t.relativePath.length>0&&Number.isSafeInteger(t.line)&&(t.line??-1)>=0&&(n.producer==="source-keyset"||n.producer==="complete-only")&&typeof n.semanticEnrichment=="boolean"&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function _e(e){try{return JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{throw new Error("Invalid result cursor. Run the command again without --cursor.")}}function ze(e,n){if(e.command!==n.command||e.target!==n.target)throw new Error("This cursor belongs to a different command or target. Run again without --cursor.");if(e.indexGeneration!==n.indexGeneration)throw new Error("The index changed after this cursor was issued. Run again without --cursor.")}function Se(e,n){let t=L(e,n),o=qe(t);for(let r of o)console.log(r)}function xe(e,n,t="No results found for resolved symbol."){return L(e,n).match?t:z(n,M(e,n,5))}function _(e,n,t,o){return{...D(e,n),[o]:t}}function D(e,n){let t=L(e,n);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:T(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(o=>({shortName:o.shortName,relativePath:o.relativePath,startLine:o.startLine})),totalMatches:t.total}:{matched:!1,suggestions:M(e,n,5)}}function z(e,n){let t=`No definition matched '${e}'.`;return n.length>0?`${t} Suggestions: ${n.join(", ")}`:t}function qe(e){if(!e.match||e.total<=1)return[];let n=e.match,t=Math.max(0,e.total-1),o=[`Resolved: ${T(n.symbol)} (${n.relativePath}) -- ${t} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=e.candidates.slice(0,3);return r.length>0&&o.push(`Alternates: ${r.map(i=>`${i.shortName} (${i.relativePath}:${g(i.startLine)})`).join("; ")}`),o.push(""),o}var We=k(({db:e,args:n,opts:t})=>{let o=B(n,0),r=b(t,"signatures"),i=se(e,o);if(b(t,"json")){P("outline",n,t,i);return}if(console.log(`\u2550\u2550\u2550 REQUEST \u2550\u2550\u2550
2
+ import{A as G,D as P,a as y,b as ce,i as k,j as le,t as B,u as de,w as j,x as ue,y as b}from"./chunk-CLPCFGRT.js";import{c as Y,d as H,e as Z,g as X,i as ee,k as x}from"./chunk-6FXXYYQM.js";import{E,a as g,b as Q,c as C,e as S,v as se,x as ae}from"./chunk-OWJWOEDU.js";import{la as W}from"./chunk-7UCDGXRW.js";import{Ga as N,Ha as L,Ja as M,V as te,Wa as oe,Xa as re,Za as ie,ga as T,ka as ne}from"./chunk-EOKVZXNF.js";function ge(e,n,t){if(!Number.isSafeInteger(t.limit)||t.limit<=0)throw new Error("Reference page limit must be a positive safe integer.");let o=N(e,n);if(!o)return{rows:[],hasMore:!1,producer:t.producer??"source-keyset",semanticEnrichment:!1};if(t.producer==="complete-only"||t.semantic===!0||o.relativePath.endsWith(".rb"))return F(e,n,t);let i=oe(e,o);if(!i)return F(e,n,t);let s=fe(e,o),c=Te(e,s),a=[],l=t.producer==="source-keyset";for(let u of c){if(t.after&&u<t.after.relativePath)continue;t.instrumentation?.fileScanned?.(u);let f=re(e,i,u);f.length>0&&(l=!0);let d=new Set(f);s?.relativePath===u&&d.add(s.line);for(let m of[...d].sort((p,Ae)=>p-Ae)){let p={relativePath:u,line:m};if(!(t.after&&R(p,t.after)<=0)&&(a.push(p),t.instrumentation?.rowAccepted?.(p),l&&a.length>t.limit))return me(a,t.limit)}}return l?me(a,t.limit):F(e,n,t,s)}function R(e,n){return(e.relativePath<n.relativePath?-1:e.relativePath>n.relativePath?1:0)||e.line-n.line}function me(e,n){return{rows:e.slice(0,n),hasMore:e.length>n,producer:"source-keyset",semanticEnrichment:!1}}function F(e,n,t,o){let r=N(e,n),i=t.semantic===!0||r?.relativePath.endsWith(".rb")?E(e,n,{semantic:t.semantic}):De(e,n,o),s=Me(i).filter(c=>!t.after||R(c,t.after)>0);for(let c of s.slice(0,t.limit+1))t.instrumentation?.rowAccepted?.(c);return{rows:s.slice(0,t.limit),hasMore:s.length>t.limit,producer:"complete-only",semanticEnrichment:t.semantic===!0}}function De(e,n,t){let o=N(e,n);if(!o)return[];let r=t===void 0?fe(e,o):t,i=ie(e,o).map(s=>({relativePath:s.file,line:s.line}));return r?[r,...i]:i}function fe(e,n){return!ne(n.symbol)&&!e.isIgnored(n.relativePath)?{relativePath:n.relativePath,line:n.startLine}:null}function Te(e,n){let t=te(e);return!n||t.includes(n.relativePath)?t:[...t,n.relativePath].sort((o,r)=>o<r?-1:o>r?1:0)}function Me(e){let n=new Map;for(let t of e)n.set(`${t.relativePath}\0${t.line}`,t);return[...n.values()].sort(R)}import{InvalidArgumentError as v}from"commander";var St=W,Be=/^[+-]?\d+$/u,je=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,xt=(e=>V(e,"an integer")),pe=(e=>{let n=V(e,"a non-negative integer");if(n<0)throw new v(`Expected a non-negative integer, got "${e}".`);return n}),he=(e=>{let n=V(e,"a positive integer");if(n<1)throw new v(`Expected a positive integer, got "${e}".`);return n}),Et=(e=>{if(!je.test(e))throw new v(`Expected a number, got "${e}".`);let n=Number(e);if(!Number.isFinite(n))throw new v(`Expected a finite number, got "${e}".`);return n});function V(e,n){if(!Be.test(e))throw new v(`Expected ${n}, got "${e}".`);let t=Number(e);if(!Number.isSafeInteger(t))throw new v(`Expected ${n}, got "${e}".`);return t}function h(e,n,t,...o){return o.length>0?{flags:e,description:n,parser:t,defaultValue:o[0]}:{flags:e,description:n,parser:t}}function Ge(){return h("--json","Output as JSON for programmatic consumption")}function Fe(){return h("--compact","Emit minified one-line JSON (use with --json)")}function Ve(){return h("--result-only","Emit only the command-owned result (use with --json)")}function Ce(e=[]){return I(e)}function I(e=[]){let n=[Ge(),Ve(),Fe()],t=new Set(n.map(o=>o.flags));return[...e.filter(o=>!t.has(o.flags)),...n]}function $(e,n=[]){return{category:e,examples:n}}function Pt(e,n){return{origin:"mixed",observedSources:e,producerValidation:{status:"not-evaluated"},families:n}}function $t(e,n){return{origin:e,observedSources:n,producerValidation:{status:"not-evaluated"}}}function wt(e,n,t){return{id:e,selector:n,origin:{kind:"fixed",origin:t}}}function Ot(e,n,t,o){return{id:e,selector:n,origin:{kind:"result-field",field:t,values:o}}}function w(e,n,t,o,r,i,s){return{answers:typeof e=="string"?[e]:e,returns:typeof n=="string"?[n]:n,inputs:t,coverage:o,operation:i,semantic:s,...r?{scope:r}:{}}}function Nt(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,K(s.join(" "),c.join("; "),["This command establishes only its declared result units and evidence contract."],void 0,{outputCost:o==="complete"?"bounded":"variable"}))}function ye(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,Ke(c.join("; "),["This command does not establish repository graph relationships unless its result says so explicitly."]))}function be(e,n,t={ranking:"identity-only"}){return{kind:"locator",locates:e,nonClaims:n,outputCost:"small",frontierClosure:["evidence","inspect","code"],...t}}function Lt(e){return{kind:"graph-projection",outputCost:"bounded",frontierClosure:["inspect","code"],...e}}function Re(e,n,t,o={}){return{kind:"source-read",reads:e,nonClaims:n,outputCost:"potentially-large",frontierClosure:[],...t?{compatibility:t}:{},...o}}function K(e,n,t,o,r={}){return{kind:"analysis",analysis:e,resultMeaning:n,nonClaims:t,outputCost:"bounded",frontierClosure:["inspect","code"],...o?{compatibility:o}:{},...r}}function Ke(e,n,t,o={}){return{kind:"maintenance",effect:e,nonClaims:n,outputCost:"variable",frontierClosure:[],...t?{compatibility:t}:{},...o}}function J(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64url")}function A(e){return e.generation.identity}function U(e){return"after"in e?J({version:2,...e}):J({version:1,...e})}function ve(e,n){let t=_e(e);if(!Je(t)&&!Ue(t))throw new Error("Invalid result cursor. Run the command again without --cursor.");return ze(t,n),t}function Je(e){if(!e||typeof e!="object")return!1;let n=e;return n.version===1&&typeof n.command=="string"&&typeof n.target=="string"&&Number.isSafeInteger(n.offset)&&(n.offset??-1)>=0&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function Ue(e){if(!e||typeof e!="object")return!1;let n=e,t=n.after;return n.version===2&&typeof n.command=="string"&&typeof n.target=="string"&&!!t&&typeof t.relativePath=="string"&&t.relativePath.length>0&&Number.isSafeInteger(t.line)&&(t.line??-1)>=0&&(n.producer==="source-keyset"||n.producer==="complete-only")&&typeof n.semanticEnrichment=="boolean"&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function _e(e){try{return JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{throw new Error("Invalid result cursor. Run the command again without --cursor.")}}function ze(e,n){if(e.command!==n.command||e.target!==n.target)throw new Error("This cursor belongs to a different command or target. Run again without --cursor.");if(e.indexGeneration!==n.indexGeneration)throw new Error("The index changed after this cursor was issued. Run again without --cursor.")}function Se(e,n){let t=L(e,n),o=qe(t);for(let r of o)console.log(r)}function xe(e,n,t="No results found for resolved symbol."){return L(e,n).match?t:z(n,M(e,n,5))}function _(e,n,t,o){return{...D(e,n),[o]:t}}function D(e,n){let t=L(e,n);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:T(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(o=>({shortName:o.shortName,relativePath:o.relativePath,startLine:o.startLine})),totalMatches:t.total}:{matched:!1,suggestions:M(e,n,5)}}function z(e,n){let t=`No definition matched '${e}'.`;return n.length>0?`${t} Suggestions: ${n.join(", ")}`:t}function qe(e){if(!e.match||e.total<=1)return[];let n=e.match,t=Math.max(0,e.total-1),o=[`Resolved: ${T(n.symbol)} (${n.relativePath}) -- ${t} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=e.candidates.slice(0,3);return r.length>0&&o.push(`Alternates: ${r.map(i=>`${i.shortName} (${i.relativePath}:${g(i.startLine)})`).join("; ")}`),o.push(""),o}var We=k(({db:e,args:n,opts:t})=>{let o=B(n,0),r=b(t,"signatures"),i=se(e,o);if(b(t,"json")){P("outline",n,t,i);return}if(console.log(`\u2550\u2550\u2550 REQUEST \u2550\u2550\u2550
3
3
  file=${JSON.stringify(o)}; signatures=${r?"shown":"hidden"}`),i.length===0){console.log(`
4
4
  \u2550\u2550\u2550 OBSERVED FACTS \u2550\u2550\u2550
5
5
  No compiler-owned constructs were found for ${JSON.stringify(o)}.`),console.log(`
@@ -28,4 +28,4 @@ ${p}continue with --cursor ${d.cursor}`)}});function Ye(e,n,t){let o=E(e,n,{sema
28
28
  `),o=0,r=0;for(let i=0;i<t.length;i++){let s=t[i].length+12;i>o&&r+s>Ee&&(n.push(`${e.relativePath}:${g(e.startLine+o)}-${g(e.startLine+i-1)}`),o=i,r=0),r+=s}return n.push(`${e.relativePath}:${g(e.startLine+o)}-${g(e.endLine)}`),n}function Pe(e,n){return{requested:n.length,matched:n.filter(t=>t.status==="matched").length,ambiguous:n.filter(t=>t.status==="ambiguous").length,missing:n.filter(t=>t.status==="missing").length,entries:[...n],bindingClosure:e.bindingClosure}}function $e(e,n){return["codebaseiq","code",...e.map(O),...n.members==="all"?["--members","all"]:[],...n.context>0?["--context",String(n.context)]:[]].join(" ")}function dt(e,n,t){if(!t)return D(e,n);let o={file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:g(t.startLine),endLine:g(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
29
29
  `).map((s,c)=>({line:g(t.startLine+c),text:s}))},r=D(e,n),i=r.totalMatches??0;return!r.matched||!r.resolved||i<=1?o:{...o,resolution:{selected:r.resolved,alternatives:r.otherMatches??[],totalMatches:i}}}function ut(e){return{requested:e.requested,matched:e.matched,ambiguous:e.ambiguous,missing:e.missing,entries:e.entries.map(n=>({selector:n.selector,status:n.status,kind:n.kind,totalCandidates:n.totalCandidates,sources:n.results.map(t=>({file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:g(t.startLine),endLine:g(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
30
30
  `).map((o,r)=>({line:g(t.startLine+r),text:o}))})),definitions:n.definitions,...n.fileCoverage?{fileCoverage:n.fileCoverage}:{},...n.rangeCoverage?{rangeCoverage:n.rangeCoverage}:{},candidates:n.candidates,omittedCandidates:n.omittedCandidates,suggestions:n.suggestions,...n.reason?{reason:n.reason}:{}})),literalValues:e.bindingClosure.inline}}function O(e){return`'${e.replaceAll("'","'\\''")}'`}var Zt=[{id:"session",command:"session",description:"Show evidence already delivered in this agent exploration session",options:[h("--reset","Clear this agent exploration-session ledger")],agent:ye("Which indexed source ranges and graph facts have already been delivered in this exploration session?","prior command ordinals, exact source ranges, and content-bound graph receipts",[],"complete","repository",ce("repository-observation",[{when:{kind:"option",name:"reset",equals:!0},role:"mutation"}])),renderShape:"custom",docs:$("Navigation"),handler:et},{id:"refs",command:"refs <symbol>",description:"Find all files referencing a symbol",options:Ce([h("--full","Run unbounded semantic analysis on large indexes"),h("-n, --limit <n>","Maximum reference sites to return",he),h("--cursor <cursor>","Continue a prior bounded result (implies --limit 50 when omitted)")]),budget:"semantic",agent:{operation:y,answers:["Which files reference this symbol?","Is this symbol used anywhere, or only defined?"],returns:["referencing file paths","reference line numbers grouped by file"],inputs:["symbol"],coverage:"bounded",semantic:K("Resolve the exact reference sites attributed to one compiler symbol identity.","Referencing file paths and reference line numbers grouped by file.",["Reference sites do not establish runtime execution, data flow, or task relevance."]),contrasts:[{command:"imported-by",distinction:"imported-by lists files importing the symbol; refs covers every reference site, imported or not."},{command:"affected",distinction:"refs is one hop out; affected is the transitive closure of what could break."}]},renderShape:"grouped-by-file",docs:$("Navigation",["codebaseiq refs login"]),handler:Qe},{id:"outline",command:"outline <file>",description:"Tree view of symbols in a file, with line ranges",agent:{...w("What symbols and nesting exist in this file?","symbol names, nesting, and line ranges",["file"],"complete",void 0,y,be(["file","symbol","construct"],["File ownership and nesting do not establish execution or task relevance."],{ranking:"identity-only",manualInput:"One exact current project file path.",evidenceCeiling:"Exact compiler-owned constructs and ranges when the file is indexed; no invented semantic overlay."})),contrasts:[{command:"search",distinction:"outline enumerates constructs in one known file; search locates exact text across current project text."},{command:"code",distinction:"outline returns identities and ranges; code materializes exact source for selected identities."}]},options:I([h("--signatures","Show trimmed symbol signatures")]),renderShape:"custom",docs:$("Navigation"),handler:We},{id:"code",command:"code <selectors...>",description:"Read exact definitions, ranges with local call closure, or file export surfaces",agent:{...w("What exact source defines these symbols, ranges, or file surfaces?","per-selector resolution, complete definition source, exact ranges with statically attributed same-file call closure, file export surfaces, omitted-local ledgers, and line ranges",[["symbol","file"]],"complete",void 0,y,Re(["construct","exact-source"],["Source materialization does not establish callers, runtime reachability, or task relevance by itself."],void 0,{manualInput:"One or more exact symbols, file:line ranges, or file paths.",evidenceCeiling:"Exact current source bytes for every resolved selector, with omitted file-local constructs disclosed."})),resultUnits:{kind:"field",field:"code"},contrasts:[{command:"inspect",distinction:"code materializes complete exact source; inspect batches bounded behavior or source gaps."},{command:"outline",distinction:"code reads selected implementations; outline enumerates file structure without reading every body."}]},options:I([h("-C, --context <n>","Extra lines of context above/below",pe,0),h("--members <exported|all>","For file selectors, return the exported surface or the complete file",void 0,"exported")]),renderShape:"custom",docs:$("Navigation",["codebaseiq code parseRequest handleRequest","codebaseiq code src/api.ts src/web.ts"]),handler:Xe}];export{St as a,xt as b,pe as c,he as d,Et as e,h as f,Fe as g,Ce as h,I as i,$ as j,Pt as k,$t as l,wt as m,Ot as n,w as o,Nt as p,ye as q,be as r,Lt as s,Re as t,K as u,Se as v,xe as w,_ as x,D as y,Zt as z};
31
- //# sourceMappingURL=chunk-FPDL2TUB.js.map
31
+ //# sourceMappingURL=chunk-OBC7HSSO.js.map