scip-query 0.22.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (470) hide show
  1. package/CHANGELOG.md +500 -0
  2. package/README.md +13 -0
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-H3P6BR5G.js +2 -0
  5. package/dist/call-graph-VTG2CUOQ.js +2 -0
  6. package/dist/call-graph-evidence-BociKRpF.d.ts +19 -0
  7. package/dist/chunk-2BMSSRBH.js +2 -0
  8. package/dist/{chunk-TAYD3AE7.js → chunk-2GJSD5GY.js} +2 -2
  9. package/dist/{chunk-TUQIPUDS.js → chunk-2M2LSIMY.js} +3 -3
  10. package/dist/{chunk-GIQ6CSL4.js → chunk-2N6WBNDC.js} +2 -2
  11. package/dist/{chunk-JHH5SCZ3.js → chunk-2OOY75BW.js} +2 -2
  12. package/dist/{chunk-EELPBR7E.js → chunk-2USA3S3P.js} +2 -2
  13. package/dist/chunk-2VAHDDLM.js +133 -0
  14. package/dist/chunk-2XWIUW5Z.js +455 -0
  15. package/dist/{chunk-57N6LN2A.js → chunk-3AF4TUFK.js} +2 -2
  16. package/dist/chunk-3D4BOXW6.js +20 -0
  17. package/dist/{chunk-FFJQZG6J.js → chunk-3LO4FST5.js} +2 -2
  18. package/dist/{chunk-HXOU4XNH.js → chunk-3WTY4LP2.js} +2 -2
  19. package/dist/{chunk-DPWKKNKI.js → chunk-3Z5AMSK6.js} +2 -2
  20. package/dist/{chunk-F24G5NBE.js → chunk-44IETFOU.js} +2 -2
  21. package/dist/chunk-4FR6GQIT.js +2 -0
  22. package/dist/chunk-4KBTHJLP.js +2 -0
  23. package/dist/chunk-5BIKR67W.js +2 -0
  24. package/dist/{chunk-DJAO2OZJ.js → chunk-5PROPLHI.js} +2 -2
  25. package/dist/chunk-5V7EPTII.js +2 -0
  26. package/dist/{chunk-VZ7NXSHV.js → chunk-62LPZCBQ.js} +2 -2
  27. package/dist/{chunk-LXQUF2RP.js → chunk-64O2JHQA.js} +2 -2
  28. package/dist/chunk-6D4F5VWG.js +10 -0
  29. package/dist/{chunk-NEIQPFBI.js → chunk-6ERFBC3X.js} +2 -2
  30. package/dist/{chunk-4HE7MVWD.js → chunk-6ILKOOGH.js} +2 -2
  31. package/dist/chunk-6MFXCMZC.js +2 -0
  32. package/dist/chunk-6O7FACKB.js +2 -0
  33. package/dist/{chunk-R6M456QG.js → chunk-6TS3KOXR.js} +2 -2
  34. package/dist/{chunk-7U2YQSDE.js → chunk-76QOU4PK.js} +2 -2
  35. package/dist/{chunk-25GWKRUZ.js → chunk-7DUI77BN.js} +2 -2
  36. package/dist/chunk-7F45LJKI.js +2 -0
  37. package/dist/{chunk-DEAB5TGT.js → chunk-7F7T6DCR.js} +2 -2
  38. package/dist/chunk-7H6VHWWJ.js +2 -0
  39. package/dist/chunk-7HXT6YLU.js +5 -0
  40. package/dist/{chunk-KZYID5KV.js → chunk-7R4V5ES6.js} +4 -4
  41. package/dist/chunk-7RIRIADH.js +7 -0
  42. package/dist/chunk-7ZLWLOGT.js +2 -0
  43. package/dist/{chunk-WHADK6OS.js → chunk-A4WEAK35.js} +2 -2
  44. package/dist/chunk-AADQLOQ4.js +38 -0
  45. package/dist/{chunk-XFMVKFSF.js → chunk-AN76MGUE.js} +2 -2
  46. package/dist/chunk-ANLNLY66.js +2 -0
  47. package/dist/chunk-ATXPTSEI.js +81 -0
  48. package/dist/{chunk-EELG7D3Q.js → chunk-AX7IDVFT.js} +2 -2
  49. package/dist/chunk-B3PYOSCX.js +2 -0
  50. package/dist/chunk-B7MPDEAK.js +3 -0
  51. package/dist/chunk-BBB5FBX4.js +2 -0
  52. package/dist/{chunk-Y2VM4CJC.js → chunk-BHKK5RJY.js} +2 -2
  53. package/dist/chunk-BJWFVAA5.js +2 -0
  54. package/dist/chunk-BKVWUP7Y.js +2 -0
  55. package/dist/{chunk-7XA3OM44.js → chunk-BKZYTLGE.js} +2 -2
  56. package/dist/chunk-BL6DCHQP.js +2 -0
  57. package/dist/chunk-BOW7SSQH.js +43 -0
  58. package/dist/{chunk-KQHJEU6V.js → chunk-C4RHHCKL.js} +2 -2
  59. package/dist/chunk-C7C6AKAT.js +117 -0
  60. package/dist/chunk-CD6M6LS2.js +16 -0
  61. package/dist/chunk-CFE6PSG6.js +2 -0
  62. package/dist/{chunk-GPGRZJ3R.js → chunk-CFNIGQMT.js} +2 -2
  63. package/dist/{chunk-K3XFWJI2.js → chunk-CKBUBRYD.js} +2 -2
  64. package/dist/chunk-CZW5MZ5B.js +2 -0
  65. package/dist/chunk-DBBZ63ZX.js +2 -0
  66. package/dist/chunk-DBN7DMJB.js +18 -0
  67. package/dist/{chunk-CKRWA452.js → chunk-DUULLZHZ.js} +2 -2
  68. package/dist/{chunk-6HRZQLOI.js → chunk-DV5Y5NOS.js} +2 -2
  69. package/dist/chunk-DZOIKCTM.js +3 -0
  70. package/dist/chunk-E4PKTOL3.js +2 -0
  71. package/dist/{chunk-GVOMSPGL.js → chunk-E65ELFKU.js} +2 -2
  72. package/dist/{chunk-VXJJTQYE.js → chunk-E7QR35ST.js} +2 -2
  73. package/dist/{chunk-2RE5OCHZ.js → chunk-EFSXAINW.js} +2 -2
  74. package/dist/{chunk-GY7CCCEZ.js → chunk-EHVEIEQN.js} +2 -2
  75. package/dist/{chunk-BVFYEEBH.js → chunk-EHYDXE3Z.js} +2 -2
  76. package/dist/{chunk-HISEUIL2.js → chunk-EP63Y6LD.js} +2 -2
  77. package/dist/chunk-EPX6NQN6.js +4 -0
  78. package/dist/chunk-ETC674NS.js +5 -0
  79. package/dist/{chunk-5H5WTJSD.js → chunk-F5GSBHC6.js} +2 -2
  80. package/dist/chunk-FH3DGXC6.js +2 -0
  81. package/dist/{chunk-2XCGSDIT.js → chunk-FI7VGOR4.js} +2 -2
  82. package/dist/chunk-FJF6VO2P.js +2 -0
  83. package/dist/{chunk-FELGD32K.js → chunk-FLMTCX5R.js} +2 -2
  84. package/dist/chunk-FVFDOIM3.js +2 -0
  85. package/dist/{chunk-AQ2PORIO.js → chunk-G2HU5WRN.js} +2 -2
  86. package/dist/{chunk-7YQOCABQ.js → chunk-G4ALYS4J.js} +2 -2
  87. package/dist/{chunk-SWK4XPUS.js → chunk-G56I7K4W.js} +2 -2
  88. package/dist/{chunk-JFQBRL3J.js → chunk-GC4DG2V5.js} +2 -2
  89. package/dist/chunk-GG45PK4S.js +4 -0
  90. package/dist/{chunk-XN22RGSR.js → chunk-GHNPACNP.js} +2 -2
  91. package/dist/{chunk-XU75YQN4.js → chunk-GINH3YQU.js} +2 -2
  92. package/dist/chunk-GTZZVLKJ.js +2 -0
  93. package/dist/chunk-GXXW5ZHH.js +2 -0
  94. package/dist/{chunk-RNKPYYYE.js → chunk-HAXXKRTD.js} +2 -2
  95. package/dist/chunk-HEZWBAZY.js +2 -0
  96. package/dist/chunk-HMEWLMML.js +2 -0
  97. package/dist/{chunk-2KVU55CW.js → chunk-HOBOVYPO.js} +2 -2
  98. package/dist/{chunk-2YC7YNKT.js → chunk-HRFQ6GW5.js} +2 -2
  99. package/dist/{chunk-RYOYJMGF.js → chunk-HX4X7KG3.js} +2 -2
  100. package/dist/{chunk-AZS7YPCB.js → chunk-HYT2R7LX.js} +2 -2
  101. package/dist/chunk-IKQVBVQL.js +40 -0
  102. package/dist/chunk-J6GLBBRK.js +4 -0
  103. package/dist/{chunk-TNG2FYS5.js → chunk-J7A4PWFX.js} +2 -2
  104. package/dist/chunk-JCSAZ35V.js +2 -0
  105. package/dist/{chunk-EWWY2ZFL.js → chunk-JDU2IV3A.js} +2 -2
  106. package/dist/{chunk-SB25YMEQ.js → chunk-JFMEXGFE.js} +2 -2
  107. package/dist/chunk-JFMI5SGB.js +4 -0
  108. package/dist/chunk-JJP37RGX.js +57 -0
  109. package/dist/chunk-JZ2A7LDM.js +5 -0
  110. package/dist/chunk-KNLQGXVH.js +80 -0
  111. package/dist/chunk-KVQCECPR.js +2 -0
  112. package/dist/{chunk-F24QUEQP.js → chunk-KXXORBZ2.js} +2 -2
  113. package/dist/{chunk-IKVNEGTW.js → chunk-L5KYH6U3.js} +2 -2
  114. package/dist/chunk-L6XHYJPZ.js +21 -0
  115. package/dist/chunk-L7KTFEAV.js +43 -0
  116. package/dist/{chunk-UAQ4T73O.js → chunk-LDXHR5EL.js} +2 -2
  117. package/dist/chunk-LEECKFCJ.js +2 -0
  118. package/dist/{chunk-LO5JSW2C.js → chunk-MHGDSBFX.js} +2 -2
  119. package/dist/{chunk-JUN5DOAK.js → chunk-MLQVVDG3.js} +2 -2
  120. package/dist/chunk-MOKUWRHO.js +3 -0
  121. package/dist/{chunk-44T4DUAA.js → chunk-MPYAPMNE.js} +2 -2
  122. package/dist/{chunk-ARVO6TTW.js → chunk-MV6SPXCR.js} +2 -2
  123. package/dist/{chunk-NRBNAECH.js → chunk-MWN53KRN.js} +2 -2
  124. package/dist/{chunk-TH6IC56G.js → chunk-MZPXPSUJ.js} +2 -2
  125. package/dist/{chunk-FBCVASUG.js → chunk-N55KIE46.js} +2 -2
  126. package/dist/{chunk-VMWUV6WB.js → chunk-NB4D3BNM.js} +2 -2
  127. package/dist/{chunk-JAT6C3VX.js → chunk-NGKBOT6G.js} +2 -2
  128. package/dist/{chunk-Q6T2CAJL.js → chunk-NJGKXKQF.js} +2 -2
  129. package/dist/chunk-NJQISBL4.js +8 -0
  130. package/dist/chunk-NJT3ZEKY.js +16 -0
  131. package/dist/{chunk-KFVSJX25.js → chunk-NKMKZP6A.js} +2 -2
  132. package/dist/chunk-NODFZ6ED.js +2 -0
  133. package/dist/{chunk-ERCYGVAM.js → chunk-NSM5IEVW.js} +2 -2
  134. package/dist/{chunk-YAGYMBEX.js → chunk-NTGUVNR2.js} +2 -2
  135. package/dist/{chunk-N7FP5H5U.js → chunk-NU3KFF2O.js} +8 -8
  136. package/dist/chunk-NWLVNU66.js +557 -0
  137. package/dist/{chunk-Q55NF3ZG.js → chunk-NYKZMCRC.js} +2 -2
  138. package/dist/{chunk-I6UTXNHU.js → chunk-O6BUXZEH.js} +2 -2
  139. package/dist/chunk-ODPDP7A4.js +3 -0
  140. package/dist/{chunk-ZAZGGSM3.js → chunk-OHIV323X.js} +2 -2
  141. package/dist/chunk-OIAPEKMT.js +3 -0
  142. package/dist/chunk-OIOC5EHF.js +3 -0
  143. package/dist/{chunk-YIHNPKWD.js → chunk-ONPPQM4G.js} +2 -2
  144. package/dist/{chunk-RHHCLWQ6.js → chunk-OUHEZBYI.js} +2 -2
  145. package/dist/{chunk-MSR2QRUE.js → chunk-OVGYW7UD.js} +2 -2
  146. package/dist/{chunk-OPSAW5DT.js → chunk-OYKU4B3Y.js} +2 -2
  147. package/dist/{chunk-5YRQIE2B.js → chunk-POBJ6FR2.js} +2 -2
  148. package/dist/{chunk-ZGW4HLPD.js → chunk-PSZPMMWN.js} +2 -2
  149. package/dist/chunk-PXTRBKRK.js +3 -0
  150. package/dist/{chunk-U2N2KE7A.js → chunk-Q5JRIHT3.js} +2 -2
  151. package/dist/{chunk-GRX7JOXQ.js → chunk-Q7ATHARX.js} +2 -2
  152. package/dist/{chunk-5ZMBRQFC.js → chunk-Q7CSKIDM.js} +2 -2
  153. package/dist/{chunk-HG722PO7.js → chunk-QBQE7ZJ5.js} +2 -2
  154. package/dist/{chunk-Z2PZVKPR.js → chunk-QH22UIXP.js} +2 -2
  155. package/dist/chunk-QXCKQTKR.js +60 -0
  156. package/dist/chunk-RBAD4GJ2.js +13 -0
  157. package/dist/chunk-RMDPFPNW.js +2 -0
  158. package/dist/chunk-ROPJDEJZ.js +4 -0
  159. package/dist/{chunk-56NQAEPJ.js → chunk-RVZC6TJE.js} +2 -2
  160. package/dist/{chunk-XJX6LGHL.js → chunk-S4QZBKSR.js} +2 -2
  161. package/dist/chunk-SCPMZ73U.js +2 -0
  162. package/dist/{chunk-7IQXARSQ.js → chunk-SIAP5RGI.js} +2 -2
  163. package/dist/{chunk-4TQU4TX2.js → chunk-SIX4RFR3.js} +2 -2
  164. package/dist/{chunk-AYPDH2LU.js → chunk-SKKXTABJ.js} +2 -2
  165. package/dist/{chunk-ZYM4HOFA.js → chunk-SSRFUQBD.js} +2 -2
  166. package/dist/chunk-SYVJEEUJ.js +3 -0
  167. package/dist/chunk-T3CZAZSI.js +8 -0
  168. package/dist/chunk-T3I6NHBH.js +2 -0
  169. package/dist/{chunk-GDRJB3SB.js → chunk-T6DWDI5E.js} +2 -2
  170. package/dist/chunk-T6HRIROJ.js +7 -0
  171. package/dist/{chunk-OTSPRVNW.js → chunk-TAA7HXHE.js} +2 -2
  172. package/dist/{chunk-IJMD6BRI.js → chunk-TJ2JQYT3.js} +2 -2
  173. package/dist/chunk-TULNMD5T.js +368 -0
  174. package/dist/chunk-U2FPY5XA.js +3 -0
  175. package/dist/chunk-U3SXIMII.js +38 -0
  176. package/dist/{chunk-ENWQWA2R.js → chunk-U6KCHXJ4.js} +2 -2
  177. package/dist/chunk-UH3XSKS5.js +9 -0
  178. package/dist/{chunk-UDY7MIAW.js → chunk-UIFUZVCC.js} +2 -2
  179. package/dist/{chunk-BDGTPN27.js → chunk-UXKURIVI.js} +2 -2
  180. package/dist/{chunk-FGNCOQUX.js → chunk-V2RBODHL.js} +2 -2
  181. package/dist/chunk-VBKUWB6N.js +2 -0
  182. package/dist/{chunk-PIFTZEEM.js → chunk-VBV6ALJE.js} +2 -2
  183. package/dist/{chunk-2OXVP5U5.js → chunk-VDGFWCQV.js} +2 -2
  184. package/dist/chunk-VDSDOEWF.js +2 -0
  185. package/dist/{chunk-C76O5MDS.js → chunk-VZPWVCLN.js} +2 -2
  186. package/dist/chunk-WDSFQDPN.js +2 -0
  187. package/dist/{chunk-BTVKZGWT.js → chunk-WFA35BGR.js} +2 -2
  188. package/dist/{chunk-H7CG6LOE.js → chunk-WLMP3OCW.js} +2 -2
  189. package/dist/{chunk-WOOAY3PA.js → chunk-WSA52GOR.js} +2 -2
  190. package/dist/chunk-WYPL7GF7.js +2 -0
  191. package/dist/{chunk-RDULNRSJ.js → chunk-X3YVZAKZ.js} +2 -2
  192. package/dist/chunk-X6OGVFIT.js +2 -0
  193. package/dist/{chunk-ISWFRGJ6.js → chunk-XKXTR6ZI.js} +2 -2
  194. package/dist/chunk-Y5DFAW5W.js +4 -0
  195. package/dist/chunk-YSYPDRD5.js +3 -0
  196. package/dist/chunk-ZFVPWH62.js +5 -0
  197. package/dist/chunk-ZGIHTH27.js +2 -0
  198. package/dist/{chunk-QKT4UI2Y.js → chunk-ZGIQN2SX.js} +2 -2
  199. package/dist/chunk-ZHG4WAHR.js +12 -0
  200. package/dist/{chunk-CLG6DWVS.js → chunk-ZKB2XUEN.js} +2 -2
  201. package/dist/chunk-ZLMXIQLC.js +21 -0
  202. package/dist/chunk-ZMCQIHI4.js +2 -0
  203. package/dist/cli-main.js +2 -2
  204. package/dist/code-TAVIKWJI.js +2 -0
  205. package/dist/code-result-json-5FEFQCAQ.js +2 -0
  206. package/dist/command-descriptors-7BKH53Y3.js +343 -0
  207. package/dist/dataflow-GFBTVDH3.js +2 -0
  208. package/dist/dependence-slice-GWGQCODG.js +2 -0
  209. package/dist/deps-4QHVDPYA.js +2 -0
  210. package/dist/direct-navigation-4UBC6HNW.js +3 -0
  211. package/dist/entry-map-QCTF4RVY.js +2 -0
  212. package/dist/files-M2UBF5HJ.js +2 -0
  213. package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
  214. package/dist/{health-CPp2Jf1Z.d.ts → health-BI2a9WPy.d.ts} +60 -2
  215. package/dist/hierarchy-2UIHRLW4.js +2 -0
  216. package/dist/imports-WIE3YZOB.js +2 -0
  217. package/dist/index.d.ts +1 -1
  218. package/dist/index.js +1 -1
  219. package/dist/members-YKD636DA.js +2 -0
  220. package/dist/methods-VDF4IMYG.js +2 -0
  221. package/dist/output-continuation-command-4UMDOOLO.js +3 -0
  222. package/dist/output-pagination-2GME6OPY.js +19 -0
  223. package/dist/postinstall.js +1 -1
  224. package/dist/project-reindex-XEQTRCV5.js +3 -0
  225. package/dist/queries/affected.js +1 -1
  226. package/dist/queries/anchors.d.ts +1 -1
  227. package/dist/queries/anchors.js +1 -1
  228. package/dist/queries/architecture.js +1 -1
  229. package/dist/queries/bottlenecks.js +1 -1
  230. package/dist/queries/by-kind.js +1 -1
  231. package/dist/queries/call-graph.d.ts +2 -0
  232. package/dist/queries/call-graph.js +1 -1
  233. package/dist/queries/change-surface.js +1 -1
  234. package/dist/queries/cleanup-plan.js +1 -1
  235. package/dist/queries/co-change.d.ts +20 -2
  236. package/dist/queries/co-change.js +1 -1
  237. package/dist/queries/code.js +1 -1
  238. package/dist/queries/complexity-hotspots.js +1 -1
  239. package/dist/queries/complexity.js +1 -1
  240. package/dist/queries/context.js +1 -1
  241. package/dist/queries/convergence.js +1 -1
  242. package/dist/queries/coupling.js +1 -1
  243. package/dist/queries/cycles.js +1 -1
  244. package/dist/queries/dataflow.js +1 -1
  245. package/dist/queries/dead.d.ts +2 -0
  246. package/dist/queries/dead.js +1 -1
  247. package/dist/queries/decorative-checkers.js +1 -1
  248. package/dist/queries/deep-chains.js +1 -1
  249. package/dist/queries/dependence-slice.js +1 -1
  250. package/dist/queries/dependency-depth.js +1 -1
  251. package/dist/queries/deps.js +1 -1
  252. package/dist/queries/diff-impact.d.ts +9 -0
  253. package/dist/queries/diff-impact.js +1 -1
  254. package/dist/queries/doc-drift.js +1 -1
  255. package/dist/queries/drift.js +1 -1
  256. package/dist/queries/duplicate-bodies.d.ts +28 -1
  257. package/dist/queries/duplicate-bodies.js +1 -1
  258. package/dist/queries/entry-map.d.ts +1 -1
  259. package/dist/queries/entry-map.js +1 -1
  260. package/dist/queries/evidence.js +1 -1
  261. package/dist/queries/extract-candidates.d.ts +50 -23
  262. package/dist/queries/extract-candidates.js +1 -1
  263. package/dist/queries/fan.js +1 -1
  264. package/dist/queries/files.js +1 -1
  265. package/dist/queries/health.d.ts +1 -1
  266. package/dist/queries/health.js +1 -1
  267. package/dist/queries/hierarchy.js +1 -1
  268. package/dist/queries/hotspots.js +1 -1
  269. package/dist/queries/imports.js +1 -1
  270. package/dist/queries/incomplete-migration.js +1 -1
  271. package/dist/queries/index.d.ts +4 -3
  272. package/dist/queries/index.js +1 -1
  273. package/dist/queries/isolated.js +1 -1
  274. package/dist/queries/locality-candidates.js +1 -1
  275. package/dist/queries/members.js +1 -1
  276. package/dist/queries/methods.js +1 -1
  277. package/dist/queries/not-implemented.js +1 -1
  278. package/dist/queries/outline.js +1 -1
  279. package/dist/queries/passthrough-candidates.d.ts +9 -1
  280. package/dist/queries/passthrough-candidates.js +1 -1
  281. package/dist/queries/plan-context.js +1 -1
  282. package/dist/queries/react-component-duplicates.d.ts +19 -3
  283. package/dist/queries/react-component-duplicates.js +1 -1
  284. package/dist/queries/react-hook-candidates.d.ts +22 -3
  285. package/dist/queries/react-hook-candidates.js +1 -1
  286. package/dist/queries/react-large-component-pressure.d.ts +17 -3
  287. package/dist/queries/react-large-component-pressure.js +1 -1
  288. package/dist/queries/recent-duplicates.js +1 -1
  289. package/dist/queries/redundant-reexports.js +1 -1
  290. package/dist/queries/reference-neighborhood.js +1 -1
  291. package/dist/queries/reference-reachability.js +1 -1
  292. package/dist/queries/refs.js +1 -1
  293. package/dist/queries/self-audit.d.ts +7 -1
  294. package/dist/queries/self-audit.js +1 -1
  295. package/dist/queries/similar-chains.js +1 -1
  296. package/dist/queries/similar-files.js +1 -1
  297. package/dist/queries/similar-signatures.js +1 -1
  298. package/dist/queries/similar.js +1 -1
  299. package/dist/queries/slice.js +1 -1
  300. package/dist/queries/source-inspection.js +1 -1
  301. package/dist/queries/source-search.js +1 -1
  302. package/dist/queries/stale-abstractions.js +1 -1
  303. package/dist/queries/surface.js +1 -1
  304. package/dist/queries/symbols.js +1 -1
  305. package/dist/queries/system-map.d.ts +1 -1
  306. package/dist/queries/system-map.js +1 -1
  307. package/dist/queries/system.js +1 -1
  308. package/dist/queries/test-quality.js +1 -1
  309. package/dist/queries/trace.js +1 -1
  310. package/dist/queries/twin-ab.js +1 -1
  311. package/dist/queries/twin-drift.d.ts +22 -6
  312. package/dist/queries/twin-drift.js +1 -1
  313. package/dist/queries/unused-imports.js +1 -1
  314. package/dist/queries/unused-params.js +1 -1
  315. package/dist/queries/value-flow.js +1 -1
  316. package/dist/queries/vue-component-duplicates.js +1 -1
  317. package/dist/queries/vue-composable-candidates.js +1 -1
  318. package/dist/queries/vue-large-view-pressure.js +1 -1
  319. package/dist/queries/wrapper-candidates.d.ts +16 -1
  320. package/dist/queries/wrapper-candidates.js +1 -1
  321. package/dist/query-service-fastpath.js +5 -5
  322. package/dist/query-service-server.js +3 -3
  323. package/dist/refs-JNK5CLM7.js +2 -0
  324. package/dist/refs-pagination-6BLRYGMV.js +2 -0
  325. package/dist/reindex-worker.js +25 -25
  326. package/dist/reindex.d.ts +3 -2
  327. package/dist/reindex.js +35 -35
  328. package/dist/runtime.d.ts +34 -2
  329. package/dist/runtime.js +4 -4
  330. package/dist/rust-semantic-session-server.js +1 -1
  331. package/dist/rust-semantic-session-worker.js +1 -1
  332. package/dist/rust-semantic-worker.js +1 -1
  333. package/dist/{scip-cli-H-n59izO.d.ts → scip-cli-DOerTq-R.d.ts} +42 -4
  334. package/dist/slice-PHPVNCWX.js +2 -0
  335. package/dist/surface-MQX5MPIV.js +2 -0
  336. package/dist/symbol-resolution-DBLVXLBC.js +2 -0
  337. package/dist/system-JOPKV4OG.js +2 -0
  338. package/dist/trace-I2P2YFH4.js +2 -0
  339. package/dist/typescript-mailbox-worker.js +1 -1
  340. package/dist/value-flow-JJVMF7NP.js +2 -0
  341. package/dist/watch-server.js +3 -3
  342. package/docs/COMMAND_REFERENCE.md +2 -2
  343. package/docs/DETECTOR_GUIDE.md +51 -12
  344. package/docs/accuracy-audit-checklist.md +36 -13
  345. package/docs/locality-analyzer-design.md +9 -9
  346. package/package.json +2 -2
  347. package/skills/conductor/SKILL.md +110 -0
  348. package/skills/conductor/agents/openai.yaml +4 -0
  349. package/skills/principal-maintainability-review/SKILL.md +273 -0
  350. package/skills/principal-maintainability-review/agents/openai.yaml +4 -0
  351. package/skills/scip-calibrate/SKILL.md +102 -0
  352. package/skills/scip-calibrate/agents/openai.yaml +4 -0
  353. package/skills/scip-claim-audit/SKILL.md +113 -0
  354. package/skills/scip-claim-audit/agents/openai.yaml +4 -0
  355. package/skills/scip-probe-reachability/SKILL.md +93 -0
  356. package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
  357. package/skills/scip-root-cause/SKILL.md +160 -0
  358. package/skills/scip-root-cause/agents/openai.yaml +4 -0
  359. package/skills/scip-system-compression/SKILL.md +252 -0
  360. package/skills/scip-system-compression/agents/openai.yaml +4 -0
  361. package/skills/scip-system-compression/references/compression-atlas.md +116 -0
  362. package/skills/scip-system-compression/references/compression-patterns.md +87 -0
  363. package/skills/scip-twin-drift/SKILL.md +109 -0
  364. package/skills/scip-twin-drift/agents/openai.yaml +4 -0
  365. package/dist/by-kind-4IYG2SKW.js +0 -2
  366. package/dist/call-graph-WQNXMNNN.js +0 -2
  367. package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
  368. package/dist/chunk-2BTJALUS.js +0 -454
  369. package/dist/chunk-3QXC54FQ.js +0 -3
  370. package/dist/chunk-3TJY6M3B.js +0 -7
  371. package/dist/chunk-42W3LFUK.js +0 -13
  372. package/dist/chunk-4GAQ6FI4.js +0 -43
  373. package/dist/chunk-6NC3YSPY.js +0 -38
  374. package/dist/chunk-6VEFRPTD.js +0 -5
  375. package/dist/chunk-7C26EKLZ.js +0 -4
  376. package/dist/chunk-7JYHQAH2.js +0 -22
  377. package/dist/chunk-7KSO2OAP.js +0 -2
  378. package/dist/chunk-7XZGZBSQ.js +0 -2
  379. package/dist/chunk-A77SCPW2.js +0 -3
  380. package/dist/chunk-AK3PYTIK.js +0 -5
  381. package/dist/chunk-AMIMMNA4.js +0 -11
  382. package/dist/chunk-AUY5BL74.js +0 -2
  383. package/dist/chunk-BDHFVH2M.js +0 -18
  384. package/dist/chunk-BECZLYNU.js +0 -8
  385. package/dist/chunk-BUTEIZKP.js +0 -10
  386. package/dist/chunk-BWVQP3LB.js +0 -38
  387. package/dist/chunk-BYDAFMSR.js +0 -57
  388. package/dist/chunk-BZYSGZRK.js +0 -2
  389. package/dist/chunk-C7IJMOFP.js +0 -134
  390. package/dist/chunk-CBBHFNLX.js +0 -2
  391. package/dist/chunk-D2MVJSP4.js +0 -21
  392. package/dist/chunk-D35XIZGN.js +0 -2
  393. package/dist/chunk-DKM723YF.js +0 -79
  394. package/dist/chunk-DRENNWRG.js +0 -2
  395. package/dist/chunk-E44IVWIJ.js +0 -367
  396. package/dist/chunk-EDMB6SSO.js +0 -7
  397. package/dist/chunk-EETGXQY7.js +0 -3
  398. package/dist/chunk-FKGQOTKD.js +0 -2
  399. package/dist/chunk-GH5YSGZL.js +0 -5
  400. package/dist/chunk-GQIDEID3.js +0 -2
  401. package/dist/chunk-HCVJR2V4.js +0 -3
  402. package/dist/chunk-IMKZEXZG.js +0 -2
  403. package/dist/chunk-ISIQLPJ2.js +0 -61
  404. package/dist/chunk-IXESDH3J.js +0 -2
  405. package/dist/chunk-JJ62MTQH.js +0 -40
  406. package/dist/chunk-JT6XX7QY.js +0 -8
  407. package/dist/chunk-KFOYCQAJ.js +0 -9
  408. package/dist/chunk-LRI5OMPE.js +0 -2
  409. package/dist/chunk-MHIEP7EG.js +0 -4
  410. package/dist/chunk-NK3JMP22.js +0 -2
  411. package/dist/chunk-NVSZNESQ.js +0 -2
  412. package/dist/chunk-OJNK5ALA.js +0 -2
  413. package/dist/chunk-OXYAWIEA.js +0 -2
  414. package/dist/chunk-OZETODHH.js +0 -2
  415. package/dist/chunk-PBUH2P5S.js +0 -3
  416. package/dist/chunk-PLJUQFQN.js +0 -2
  417. package/dist/chunk-PLYUVM4F.js +0 -2
  418. package/dist/chunk-PXXYQK55.js +0 -2
  419. package/dist/chunk-Q5TA4OY4.js +0 -20
  420. package/dist/chunk-Q7GBK5T7.js +0 -81
  421. package/dist/chunk-QLBSG7U5.js +0 -3
  422. package/dist/chunk-QWKHW6VZ.js +0 -2
  423. package/dist/chunk-RPL3ARU7.js +0 -16
  424. package/dist/chunk-SVHTMVA4.js +0 -4
  425. package/dist/chunk-T6QD2ZQB.js +0 -43
  426. package/dist/chunk-TD7VKJ2Y.js +0 -117
  427. package/dist/chunk-TKDNDQA7.js +0 -3
  428. package/dist/chunk-TQZV7KV4.js +0 -2
  429. package/dist/chunk-TUSPIVZ3.js +0 -4
  430. package/dist/chunk-URSGGIZX.js +0 -2
  431. package/dist/chunk-UT7TADJX.js +0 -2
  432. package/dist/chunk-V4NG5OMS.js +0 -554
  433. package/dist/chunk-VTCIYFEK.js +0 -2
  434. package/dist/chunk-VU6LIWHT.js +0 -2
  435. package/dist/chunk-VUSKPCUB.js +0 -2
  436. package/dist/chunk-WN3TCGJ4.js +0 -2
  437. package/dist/chunk-WSLEJSFR.js +0 -2
  438. package/dist/chunk-WYZIHUPZ.js +0 -16
  439. package/dist/chunk-XE33FV5W.js +0 -2
  440. package/dist/chunk-XGGBK66W.js +0 -4
  441. package/dist/chunk-XSWYJCAK.js +0 -2
  442. package/dist/chunk-Y334QQU5.js +0 -3
  443. package/dist/chunk-Z2AWCTN6.js +0 -2
  444. package/dist/chunk-ZOXKSQQB.js +0 -2
  445. package/dist/chunk-ZPASRBLF.js +0 -2
  446. package/dist/chunk-ZZ3Z7D56.js +0 -2
  447. package/dist/code-EQJFDT6I.js +0 -2
  448. package/dist/code-result-json-7UWIWBOO.js +0 -2
  449. package/dist/command-descriptors-ORNTVNYV.js +0 -342
  450. package/dist/dataflow-6VL54GX5.js +0 -2
  451. package/dist/dependence-slice-DT2NUHD2.js +0 -2
  452. package/dist/deps-DB7H5IKC.js +0 -2
  453. package/dist/direct-navigation-O3LUAYWQ.js +0 -3
  454. package/dist/entry-map-6K62RV3D.js +0 -2
  455. package/dist/files-MSLD7MO6.js +0 -2
  456. package/dist/hierarchy-IVBXAKFA.js +0 -2
  457. package/dist/imports-FRAVZ3Y2.js +0 -2
  458. package/dist/members-KJOJDYGO.js +0 -2
  459. package/dist/methods-2AYABBT3.js +0 -2
  460. package/dist/output-continuation-command-JHMPH6NC.js +0 -3
  461. package/dist/output-pagination-3OFL2MJV.js +0 -19
  462. package/dist/project-reindex-HYO4WD7Z.js +0 -3
  463. package/dist/refs-ARMA6XUJ.js +0 -2
  464. package/dist/refs-pagination-VUGIWN6U.js +0 -2
  465. package/dist/slice-YOB5YFAM.js +0 -2
  466. package/dist/surface-VY5EFWTW.js +0 -2
  467. package/dist/symbol-resolution-DGQN4XIV.js +0 -2
  468. package/dist/system-2KQ3QD2P.js +0 -2
  469. package/dist/trace-HTIPTXAE.js +0 -2
  470. package/dist/value-flow-5FV3VQI7.js +0 -2
@@ -0,0 +1,12 @@
1
+ import{c as Re,f as ir,g as te,h as or,i as Y,j as ar,k as Ae,l as it,m as L,n as sr,p as cr,q as ne,r as Le,s as De,v as z,w as ie}from"./chunk-SYVJEEUJ.js";import{c as tr,d as rr,e as ve,f as Te,i as Pe,j as C,k as ke,m as yr,n as hr,o as Sr}from"./chunk-QBQE7ZJ5.js";import{h as M,y as oe}from"./chunk-KNLQGXVH.js";import{C as T,D as ee,E as R,F as xe,G as rt,H as v,I as P,J as _,Ja as at,N as er,O as we,P as nr,Q as nt,S as Ee,T as $,U as re,V as dr,W as lr,b as Qe,f as Ze,g as Yt,i as Kt,j as Xt,k as Ie,la as ur,o as Qt,oa as fr,pa as pr,q as et,qa as gr,ra as mr,u as N,ua as ot,v as tt,x as Zt}from"./chunk-JZ2A7LDM.js";import{spawn as ni}from"child_process";import{platform as br}from"os";import{performance as Ir}from"perf_hooks";var bs={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},se=class extends Error{constructor(r,n,i,o={}){super(i,o.cause===void 0?void 0:{cause:o.cause});this.kind=r;this.label=n;this.name="BoundedProcessError",this.timedOut=o.timedOut??!1,this.reaped=o.reaped??!1,this.stdout=o.stdout??"",this.stderr=o.stderr??"",this.stdoutTruncated=o.stdoutTruncated??!1,this.stderrTruncated=o.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function ae(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function xr(e,t,r,n){let i=Math.max(0,n-r);i>0&&e.push(t.subarray(0,i))}function wr(e,t,r){let n=Buffer.concat([...e,t]);e.length=0,e.push(n.subarray(Math.max(0,n.length-r)))}function Is(e){ae(e.timeoutMs,"timeoutMs"),ae(e.maxStdoutBytes,"maxStdoutBytes"),ae(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;ae(t,"terminationGraceMs");let r=e.terminationForceMs??t;return ae(r,"terminationForceMs"),new Promise((n,i)=>{let o=Ir.now(),a=br()!=="win32"&&process.env.SCIP_REINDEX_PROCESS_GROUP_LEADER==="1",s=br()!=="win32"&&!a,c;try{c=ni(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:s?!0:e.detached,stdio:["pipe","pipe","pipe"]})}catch(S){let w=S instanceof Error?S.message:String(S);i(new se("spawn",e.label,`${e.label} could not start: ${w}`,{cause:S,reaped:!0}));return}let d=[],l=[],p=0,u=0,b=!1,g=!1,h=null,y=!1,k=c.pid===void 0?null:hr(c.pid,s),F=()=>{clearTimeout(Ht),e.signal?.removeEventListener("abort",Ye)},He=S=>{if(y||!h)return;y=!0,F();let w=Buffer.concat(d).toString("utf8"),Ke=Buffer.concat(l).toString("utf8"),Xe=S.reaped||!S.detail?"":` Process-tree cleanup failed: ${S.detail}`;i(new se(h.kind,e.label,`${h.message}${Xe}`,{timedOut:h.timedOut,reaped:S.reaped,stdout:w,stderr:Ke,stdoutTruncated:b,stderrTruncated:g}))},Z=S=>{if(!(h||y)){if(h=S,!k){He({reaped:c.pid===void 0,reason:c.pid===void 0?"terminated":"identity-unavailable"});return}Sr(k,{gracefulMs:t,forceMs:r}).then(He,w=>{He({reaped:!1,reason:"signal-failed",detail:w instanceof Error?w.message:String(w)})})}},Ht=setTimeout(()=>{Z({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);Ht.unref();let Ye=()=>{Z({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",Ye,{once:!0}),e.signal?.aborted&&Ye(),c.stdout.on("data",S=>{let w=Buffer.isBuffer(S)?S:Buffer.from(S);e.outputLimitBehavior==="truncate-tail"?wr(d,w,e.maxStdoutBytes):xr(d,w,p,e.maxStdoutBytes),p+=w.length,p>e.maxStdoutBytes&&(b=!0,e.outputLimitBehavior!=="truncate-tail"&&Z({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),c.stderr.on("data",S=>{let w=Buffer.isBuffer(S)?S:Buffer.from(S);e.outputLimitBehavior==="truncate-tail"?wr(l,w,e.maxStderrBytes):xr(l,w,u,e.maxStderrBytes),u+=w.length,u>e.maxStderrBytes&&(g=!0,e.outputLimitBehavior!=="truncate-tail"&&Z({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),c.on("error",S=>{if(!y&&!h){if(c.pid===void 0){F(),y=!0,i(new se("spawn",e.label,`${e.label} could not start: ${S.message}`,{cause:S,reaped:!0}));return}Z({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${S.message}`})}}),c.on("close",(S,w)=>{if(y||h)return;y=!0,F();let Ke=Buffer.concat(d).toString("utf8"),Xe=Buffer.concat(l).toString("utf8");n({status:S,signal:w,stdout:Ke,stderr:Xe,timedOut:!1,durationMs:Ir.now()-o,stdoutTruncated:b,stderrTruncated:g})}),e.input===void 0?c.stdin.end():c.stdin.end(e.input)})}import{execFileSync as Be}from"child_process";import{createRequire as wi}from"module";import{chmodSync as vi,existsSync as Dr}from"fs";import{platform as j,arch as Ge}from"os";import{dirname as Ri,join as kr}from"path";import{createHash as Er,randomUUID as ii}from"crypto";import{closeSync as Ce,createReadStream as oi,existsSync as ai,fsyncSync as si,mkdirSync as ci,openSync as ct,renameSync as di,unlinkSync as li,writeSync as ui}from"fs";import{homedir as fi}from"os";import{dirname as Tr,join as st}from"path";var pi=3e5,gi=256*1024*1024;function Pr(e,t=process.env){let r=t.SCIP_QUERY_CACHE_DIR??(t.XDG_CACHE_HOME?st(t.XDG_CACHE_HOME,"scip-query"):st(fi(),".cache","scip-query"));return st(r,e)}var x=class extends Error{constructor(r,n,i={}){super(n,i.cause===void 0?void 0:{cause:i.cause});this.kind=r;this.name="VerifiedBinaryFetchError"}kind};async function Ar(e){let{cachePath:t,url:r,expectedSha256:n}=e,i=e.timeoutMs??pi,o=e.maxBytes??gi,a=e.lockWaitMs??i;mi(i,o,a);let s=yi(r,i,e.signal);try{let c=await vr(t,n,o,s.controller.signal);if(c)return{status:"cached",path:t,sha256:c};ci(Tr(t),{recursive:!0});let d=await or(`${t}.fetch.lock`,{waitMs:a,pollMs:25,signal:s.controller.signal});if(!d)throw new x("lock-timeout",`timed out waiting ${a}ms for verified binary cache ownership at ${t}`);try{let l=await vr(t,n,o,s.controller.signal);return l?{status:"cached",path:t,sha256:l}:await hi(e,s.controller,o)}finally{d.release()}}catch(c){throw s.controller.signal.aborted?K(s.controller.signal,r):c instanceof x?c:new x("stream",`failed to download ${r}: ${Lr(c)}`,{cause:c})}finally{clearTimeout(s.timeout),s.detachExternalAbort(),s.controller.signal.aborted||s.controller.abort()}}function mi(e,t,r){if(!Number.isFinite(e)||e<=0)throw new TypeError("timeoutMs must be a positive finite number.");if(!Number.isSafeInteger(t)||t<=0)throw new TypeError("maxBytes must be a positive safe integer.");if(!Number.isFinite(r)||r<0)throw new TypeError("lockWaitMs must be a non-negative finite number.")}function yi(e,t,r){let n=new AbortController,i=()=>{n.abort(new x("aborted",`download of ${e} was aborted`,{cause:r?.reason}))};r?.addEventListener("abort",i,{once:!0}),r?.aborted&&i();let o=setTimeout(()=>{n.abort(new x("timeout",`download of ${e} timed out after ${t}ms`))},t);return o.unref(),{controller:n,timeout:o,detachExternalAbort:()=>r?.removeEventListener("abort",i)}}async function vr(e,t,r,n){if(!ai(e))return null;let i=Er("sha256"),o=0;try{for await(let s of oi(e,{signal:n})){let c=Buffer.isBuffer(s)?s:Buffer.from(s);if(o+=c.length,o>r)return null;i.update(c)}}catch{if(n.aborted)throw K(n,e);return null}let a=i.digest("hex");return a===t?a:null}async function hi(e,t,r){let n=e.fetchImpl??fetch,i;try{i=await Rr(n(e.url,{signal:t.signal}),t.signal)}catch(d){throw t.signal.aborted?K(t.signal,e.url):new x("stream",`failed to download ${e.url}: ${Lr(d)}`,{cause:d})}if(!i.ok){let d=new x("http",`failed to download ${e.url}: HTTP ${i.status}`);throw t.abort(d),d}let o=Si(i,r,e.url);if(!i.body)throw new x("stream",`downloaded ${e.url} response has no readable body`);let a=`${e.cachePath}.tmp-${process.pid}-${ii()}`,s,c=!1;try{s=ct(a,"wx",384),c=!0;let d=i.body.getReader(),l=Er("sha256"),p=0;for(;;){let{done:b,value:g}=await Rr(d.read(),t.signal);if(b)break;if(!(g instanceof Uint8Array))throw new x("stream",`downloaded ${e.url} produced a non-byte stream chunk`);if(p+=g.byteLength,p>r||o!==void 0&&p>o){let y=new x("length",`downloaded ${e.url} exceeded its ${o??r} byte limit`);throw t.abort(y),y}let h=Buffer.from(g.buffer,g.byteOffset,g.byteLength);l.update(h),nr(s,h,{writeFile:e.writeImpl??ui},"verified binary staging")}if(o!==void 0&&p!==o)throw new x("length",`downloaded ${e.url} length mismatch: declared ${o} bytes, received ${p}`);let u=l.digest("hex");if(u!==e.expectedSha256)throw new x("checksum",`downloaded ${e.url} checksum mismatch: expected ${e.expectedSha256}, got ${u}`);Ce(s),s=void 0;try{bi(a,e.cachePath,e.renameImpl??di,e.syncImpl??si)}catch(b){throw new x("install",`failed to install verified binary at ${e.cachePath}`,{cause:b})}return c=!1,{status:"downloaded",path:e.cachePath,sha256:u}}catch(d){throw t.signal.aborted?K(t.signal,e.url):d instanceof x?d:new x("install",`failed to stage verified binary at ${e.cachePath}`,{cause:d})}finally{if(s!==void 0)try{Ce(s)}catch{}if(c)try{li(a)}catch{}}}function Si(e,t,r){let n=e.headers?.get("content-length");if(n==null)return;if(!/^\d+$/.test(n))throw new x("length",`downloaded ${r} has an invalid Content-Length header`);let i=Number(n);if(!Number.isSafeInteger(i)||i<0)throw new x("length",`downloaded ${r} has an invalid Content-Length header`);if(i>t)throw new x("length",`downloaded ${r} declares ${i} bytes, above the ${t} byte limit`);return i}function bi(e,t,r,n){Ii(e,n),r(e,t),xi(Tr(t),n)}function Ii(e,t){let r=ct(e,"r");try{t(r)}finally{Ce(r)}}function xi(e,t){let r;try{r=ct(e,"r")}catch(n){if(nt(n,process.platform))return;throw n}try{t(r)}catch(n){if(!nt(n,process.platform))throw n}finally{Ce(r)}}function Rr(e,t){return t.aborted?Promise.reject(K(t,"operation")):new Promise((r,n)=>{let i=()=>{t.removeEventListener("abort",i),n(K(t,"operation"))};t.addEventListener("abort",i,{once:!0}),e.then(o=>{t.removeEventListener("abort",i),r(o)},o=>{t.removeEventListener("abort",i),n(o)})})}function K(e,t){return e.reason instanceof Error?e.reason:new x("aborted",`verified binary operation for ${t} was aborted`)}function Lr(e){return e instanceof Error?e.message:String(e)}var E="v0.8.1",dt="https://github.com/sourcegraph/scip",Oe=`github.com/sourcegraph/scip/cmd/scip@${E}`,Cr=wi(import.meta.url),Ei={"scip-darwin-amd64.tar.gz":"39f18be957d350bcd9ed5cb12d7781b0e237a5cb2429a107feaf9ce2d1dcd5d5","scip-darwin-arm64.tar.gz":"5b3f4a2fb1dc10c599cb3422ed0406a739060e4ac0b1222c0f43630dd0dd8221","scip-linux-amd64.tar.gz":"16b79ed98f893abd530cfa63f333527f1351008b4a23e02b9e522e34d1da6596","scip-linux-arm64.tar.gz":"876dfb680119dd6e5713077c49b27701102d598bdeba94c809173276d399c7e2"},Or="SCIP_QUERY_SCIP_BIN";function _s(e=process.env){return e.SCIP_QUERY_SQLITE_CONVERTER==="scip-cli"}function Ti(e){let t=e.env[Or];if(t&&e.fileExists(t))return{source:"env",path:t};let r=e.resolveCached?.()??null;if(r)return{source:"cache",path:r};if(e.isOnPath("scip"))return{source:"path",path:"scip"};if(e.platform==="win32"){let n=e.resolveSidecar(e.arch);if(n&&e.fileExists(n))return{source:"sidecar",path:n}}return null}function Pi(e){for(let t of e==="arm64"?["arm64","x64"]:[e])try{return Cr.resolve(`scip-query-scip-windows/scip-win32-${t}.exe`)}catch{}return null}function lt(e=process.env){return Ai(e)?.path??null}function Ai(e=process.env){let t=Ti({platform:j(),arch:Ge(),env:e,isOnPath:ke,fileExists:Dr,resolveSidecar:Pi,resolveCached:()=>Li(e)});return t?.source==="path"?{source:"path",path:yr("scip")??t.path}:t}function Br(e=process.env){return Pr(kr("scip",E,"scip"),e)}function Li(e){let t=Br(e);return Dr(t)?t:null}function Di(e){return e!==null&&e.includes(E.replace(/^v/,""))}function Ms(){return lt()!==null}function ki(){let e=lt();if(!e)return null;try{return Be(e,["--version"],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function Ci(e=j(),t=Ge()){let r=Gr(e,t);if(!r)return null;let n=Ei[r.filename];return n?{...r,sha256:n}:null}function Gr(e=j(),t=Ge()){let r,n,i;switch(e){case"darwin":r="darwin",i="tar.gz";break;case"linux":r="linux",i="tar.gz";break;default:return null}switch(t){case"arm64":n="arm64";break;case"x64":n="amd64";break;default:return null}let o=`scip-${r}-${n}.${i}`;return{url:`${dt}/releases/download/${E}/${o}`,filename:o}}function Fs(){let e=Gr();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),j()==="darwin"||j()==="linux")console.log(`Let scip-query install the reviewed release (${E}, digest-verified) into its cache:`),console.log(` scip-query setup --install-missing
2
+ `),console.log("Or install it with Go:"),console.log(` go install ${Oe}
3
+ `),console.log("Or download that exact release manually:");else if(j()==="win32"){let t=Oi();console.log("On Windows the scip binary ships via the npm sidecar package scip-query-scip-windows,"),console.log("installed automatically with scip-query. If it is missing:"),console.log(` npm install -g ${t}`),console.log(`Or set ${Or} to a local scip.exe path.
4
+ `),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
5
+ `:` ${dt}/releases/tag/${E}
6
+ `),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function Oi(){let t=Cr("../../package.json").optionalDependencies?.["scip-query-scip-windows"];if(!t||!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(t))throw new Error("scip-query package metadata does not declare an exact Windows sidecar version.");return`scip-query-scip-windows@${t}`}var Bi={fetch:Ar,extract:(e,t)=>{Be("tar",["-xzf",e,"-C",t,"scip"],{stdio:"pipe",timeout:12e4,killSignal:"SIGKILL"})},markExecutable:e=>vi(e,493),probeVersion:e=>_i(e),env:process.env};async function Gi(e,t={}){let r={...Bi,...t},n=Ci();if(!n)return e(`No reviewed scip ${E} release archive is published for ${j()}/${Ge()}.`),null;let i=Br(r.env),o=Ri(i),a=kr(o,n.filename);e(`Downloading reviewed scip ${E} (${n.filename}, sha256 ${n.sha256.slice(0,12)}\u2026).`);try{let c=await r.fetch({cachePath:a,url:n.url,expectedSha256:n.sha256});r.extract(c.path,o),r.markExecutable(i)}catch(c){return e(`Could not install scip ${E}: ${c instanceof Error?c.message:String(c)}`),null}let s=r.probeVersion(i);return Di(s)?(e(`Installed reviewed scip ${E} at ${i}.`),i):(e(`Installed scip at ${i} did not report ${E} (reported: ${s??"unavailable"}).`),null)}function _i(e){try{return Be(e,["--version"],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}async function Ns(e,t={}){if(j()!=="win32"&&await Gi(e,t)!==null)return!0;if(ke("go")){e(`Installing immutable ${Oe} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(Be("go",["install",Oe],{stdio:"inherit",timeout:3e5,env:process.env}),ke("scip")){let r=lt(),n=ki();if(r&&n&&n.includes(E))return e(`Successfully installed ${Oe}; resolved executable: ${r}; reported version: ${n}.`),!0;e(`go install completed, but the resolved scip executable did not report ${E} (executable: ${r??"unresolved"}; version: ${n??"unavailable"}).`)}}catch(r){let n=r instanceof Error?r.message:String(r);e(`go install failed: ${n}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${dt}/releases/tag/${E}`),!1}var _r=class extends Error{constructor(t){super(t),this.name="ReindexLockUnavailableError"}};import{execFileSync as Mi}from"child_process";import{existsSync as Fi,readdirSync as Mr}from"fs";import{extname as Fr,join as Nr}from"path";var $r=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),Ni=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function Vs(e){let t=[],r=$i(e),n=zi(e);for(let i of Ni){if(ji(e,i.files)){t.push(i.language);continue}if(Wi(r,i.globs)){t.push(i.language);continue}Vi(n,i.extensions)&&t.push(i.language)}if(t.includes("typescript")&&ut(t,"javascript"),t.includes("cpp")&&t.includes("c")){let i=n.has(".c"),o=[".cc",".cpp",".cxx"].some(a=>n.has(a));i&&!o?ut(t,"cpp"):i||ut(t,"c")}return t}function $i(e){try{return Mr(e)}catch{return[]}}function ji(e,t){return t?.length?t.some(r=>Fi(Nr(e,r))):!1}function Wi(e,t){return t?.length?e.some(r=>t.some(n=>qi(r,n))):!1}function qi(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[r,n]=t.split("*");return e.startsWith(r??"")&&e.endsWith(n??"")}function zi(e){let t=Ji(e);if(t)return t;let r=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!i)continue;let o;try{o=Mr(i,{withFileTypes:!0})}catch{continue}for(let a of o){if(a.name.startsWith(".")&&!a.name.endsWith("proj")&&!a.name.endsWith("sln")&&a.isDirectory())continue;let s=Nr(i,a.name);if(a.isDirectory()){$r.has(a.name)||n.push(s);continue}let c=Fr(a.name).toLowerCase();c&&r.add(c)}}return r}function Ji(e){try{let t=dr(e,26214400,()=>Mi("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:52428800,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"})),r=new Set;for(let n of lr(t)){if(n.split("/").some(o=>$r.has(o)))continue;let i=Fr(n).toLowerCase();i&&r.add(i)}return r}catch{return null}}function Vi(e,t){return t?.length?t.some(r=>e.has(r)):!1}function ut(e,t){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}import{closeSync as Wr,openSync as Qi,renameSync as Zi,rmSync as eo,writeSync as to}from"fs";import{create as qr,fromBinary as ro,toBinary as no}from"@bufbuild/protobuf";import{DocumentSchema as pt,IndexSchema as io,SymbolRole as mt}from"@c4312/scip";var A=class extends Error{},Ui=0,Hi=1,jr=2,Yi=5;function ft(e,t,r){let n=0,i=0;for(;t<r;){let o=e[t];if(t+=1,i<53)n+=(o&127)*2**i;else if((o&127)!==0)throw new A("varint exceeds the safe integer range");if((o&128)===0)return{value:n,pos:t};if(i+=7,i>63)throw new A("varint is longer than 64 bits")}throw new A("varint runs past the end of the buffer")}function*D(e,t=0,r=e.length){let n=t;for(;n<r;){let i=n,o=ft(e,n,r);n=o.pos;let a=Math.floor(o.value/8),s=o.value%8;if(a===0)throw new A("field number 0 is invalid");let c=n,d=0;if(s===Ui){let l=ft(e,n,r);d=l.value,n=l.pos}else if(s===jr){let l=ft(e,n,r);if(c=l.pos,n=l.pos+l.value,n>r)throw new A("length-delimited field runs past the end of the buffer")}else if(s===Hi)n+=8;else if(s===Yi)n+=4;else throw new A(`unsupported wire type ${s}`);if(n>r)throw new A("field value runs past the end of the buffer");yield{fieldNumber:a,wireType:s,fieldStart:i,valueStart:c,valueEnd:n,fieldEnd:n,varint:d}}}function ce(e){if(!Number.isSafeInteger(e)||e<0)throw new A(`cannot encode varint ${e}`);let t=[],r=e;do{let n=r%128;r=Math.floor(r/128),r>0&&(n|=128),t.push(n)}while(r>0);return Uint8Array.from(t)}function _e(e){return ce(e*8+jr)}var Ki=1,Xi=3;function de(e){let t=new TextDecoder,r;for(let n of D(e))if(!(n.fieldNumber!==Ki||n.wireType!==2))for(let i of D(e,n.valueStart,n.valueEnd)){if(i.fieldNumber!==Xi||i.wireType!==2)continue;let o=t.decode(e.subarray(i.valueStart,i.valueEnd));o&&(r=o)}return r}var gt=2,oo=3,ao=1,so=2,co=3,lo=1,uo=2,fo=3;function tc(e){let t;try{t=v(e,{inputKind:"SCIP sanitization input",maxBytes:R})}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}try{return po(t,e)}catch(r){if(r instanceof A)return{removedDefinitionOccurrences:0,touchedDocuments:0};throw r}}function po(e,t){let r=new TextDecoder,n=new Set;for(let a of D(e))if(a.wireType===2)if(a.fieldNumber===gt)for(let s of D(e,a.valueStart,a.valueEnd))s.wireType===2&&(s.fieldNumber===ao?Ze(r.decode(e.subarray(s.valueStart,s.valueEnd))):s.fieldNumber===co&&zr(e,s,r,n));else a.fieldNumber===oo&&zr(e,a,r,n);let i=0,o=[];for(let a of D(e)){if(a.wireType!==2||a.fieldNumber!==gt)continue;let s=go(e,a,r,n);s>0&&(i+=s,o.push(a))}return i===0?{removedDefinitionOccurrences:0,touchedDocuments:0}:(mo(e,t,o,n),{removedDefinitionOccurrences:i,touchedDocuments:o.length})}function zr(e,t,r,n){for(let i of D(e,t.valueStart,t.valueEnd)){if(i.wireType!==2||i.fieldNumber!==lo)continue;let o=r.decode(e.subarray(i.valueStart,i.valueEnd));o&&n.add(o)}}function go(e,t,r,n){let i=0;for(let o of D(e,t.valueStart,t.valueEnd)){if(o.wireType!==2||o.fieldNumber!==so)continue;let a="",s=0;for(let c of D(e,o.valueStart,o.valueEnd))c.fieldNumber===uo&&c.wireType===2?a=r.decode(e.subarray(c.valueStart,c.valueEnd)):c.fieldNumber===fo&&c.wireType===0&&(s=c.varint);(s&mt.Definition)!==0&&!n.has(a)&&(i+=1)}return i}function mo(e,t,r,n){let i=`${t}.sanitize-tmp`,o=Qi(i,"w",384);try{let a=0;for(let s of r){le(o,e.subarray(a,s.fieldStart));let c=ro(pt,e.subarray(s.valueStart,s.valueEnd));c.occurrences=c.occurrences.filter(l=>(l.symbolRoles&mt.Definition)===0||n.has(l.symbol));let d=no(pt,c);le(o,_e(gt)),le(o,ce(d.byteLength)),le(o,d),a=s.fieldEnd}le(o,e.subarray(a))}catch(a){throw Wr(o),eo(i,{force:!0}),a}Wr(o),Zi(i,t)}function le(e,t){let r=0;for(;r<t.byteLength;)r+=to(e,t,r,t.byteLength-r)}function Jr(e){let t=new Set;for(let o of e.documents){Ze(o.relativePath);for(let a of o.symbols)a.symbol&&t.add(a.symbol)}for(let o of e.externalSymbols)o.symbol&&t.add(o.symbol);let r=0,n=0,i=[];for(let o of e.documents){let a=o.occurrences.filter(s=>(s.symbolRoles&mt.Definition)===0||t.has(s.symbol)?!0:(r+=1,!1));if(a.length===o.occurrences.length){i.push(o);continue}n+=1,i.push(qr(pt,{language:o.language,relativePath:o.relativePath,occurrences:a,symbols:o.symbols,text:o.text,positionEncoding:o.positionEncoding}))}return{index:r===0?e:qr(io,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:r,touchedDocuments:n}}import{closeSync as fe,openSync as yt,readSync as yo,renameSync as ho,rmSync as Hr,statSync as So,writeFileSync as Yr,writeSync as Kr}from"fs";import{create as ht,fromBinary as bo,toBinary as Io}from"@bufbuild/protobuf";import{deserializeSCIP as Xr,serializeSCIP as Qr,DocumentSchema as xo,IndexSchema as wo,MetadataSchema as Vr,SymbolInformationSchema as vo}from"@c4312/scip";function Zr(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=Ro(e),r=Eo(e.flatMap(i=>i.documents??[])),n=tn(e.flatMap(i=>i.externalSymbols??[]));return ht(wo,{metadata:t,documents:r,externalSymbols:n})}function lc(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>Xr(v(i,{inputKind:"SCIP merge input",maxBytes:R}))),n=Zr(r);return Yr(t,Qr(n)),{documentCount:n.documents.length,externalSymbolCount:n.externalSymbols.length,inputCount:e.length}}function uc(e,t){if(e.length===0)throw new Error("Cannot concatenate zero SCIP files");let r=0;for(let o of e)if(r+=So(o).size,r>R)throw new Error(`Concatenated SCIP output exceeds the ${R}-byte artifact limit. Reduce the indexed project scope or use compatible cached generations.`);let n=Buffer.allocUnsafe(1024*1024),i=yt(t,"w",384);try{for(let o of e){let a=yt(o,"r");try{let s=0;for(;(s=yo(a,n,0,n.byteLength,null))>0;){let c=0;for(;c<s;)c+=Kr(i,n,c,s-c)}}finally{fe(a)}}}catch(o){throw fe(i),Hr(t,{force:!0}),o}fe(i)}function fc(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=oe("reindex.publish.scip-output.deserialize",()=>e.map(o=>Xr(v(o,{inputKind:"SCIP merge input",maxBytes:R})))),n=oe("reindex.publish.scip-output.merge",()=>Zr(r)),i=oe("reindex.publish.scip-output.sanitize",()=>Jr(n));return oe("reindex.publish.scip-output.serialize",()=>Yr(t,Qr(i.index))),{documentCount:i.index.documents.length,externalSymbolCount:i.index.externalSymbols.length,inputCount:e.length,removedDefinitionOccurrences:i.removedDefinitionOccurrences,touchedDocuments:i.touchedDocuments}}var Ur=1;function en(e,t,r){let n=v(e,{inputKind:"SCIP normalization input",maxBytes:R}),i=de(n),o=[];for(let c of D(n))c.fieldNumber===Ur&&c.wireType===2&&o.push(c);if(o.length===0)throw new Error("Cannot rebase a SCIP index without metadata");if((i??"")!==t)throw new Error(`Cannot rebase SCIP project root: expected ${t}, got ${i??""}`);let a=`${e}.rebase-tmp`,s=yt(a,"w",384);try{let c=0;for(let d of o){ue(s,n.subarray(c,d.fieldStart));let l=bo(Vr,n.subarray(d.valueStart,d.valueEnd));l.projectRoot=r;let p=Io(Vr,l);ue(s,_e(Ur)),ue(s,ce(p.byteLength)),ue(s,p),c=d.fieldEnd}ue(s,n.subarray(c))}catch(c){throw fe(s),Hr(a,{force:!0}),c}fe(s),ho(a,e)}function ue(e,t){let r=0;for(;r<t.byteLength;)r+=Kr(e,t,r,t.byteLength-r)}function Ro(e){let t=e[0]?.metadata;if(!t)return;let r=t.projectRoot;for(let n of e.slice(1)){let i=n.metadata?.projectRoot;if(r&&i&&i!==r)throw new Error(`Cannot merge SCIP indexes with different project roots: ${r} vs ${i}`)}return t}function Eo(e){let t=new Map;for(let r of e){let n=t.get(r.relativePath);if(!n){t.set(r.relativePath,r);continue}t.set(r.relativePath,ht(xo,{language:n.language||r.language,relativePath:n.relativePath||r.relativePath,occurrences:To([...n.occurrences,...r.occurrences]),symbols:tn([...n.symbols,...r.symbols]),text:Ao(n.text,r.text),positionEncoding:n.positionEncoding||r.positionEncoding}))}return[...t.values()]}function To(e){let t=new Set,r=[];for(let n of e){let i=JSON.stringify(n);t.has(i)||(t.add(i),r.push(n))}return r}function tn(e){let t=new Map;for(let r of e){let n=t.get(r.symbol);if(!n){t.set(r.symbol,r);continue}t.set(r.symbol,ht(vo,{symbol:n.symbol,documentation:Lo([...n.documentation,...r.documentation]),relationships:Po([...n.relationships,...r.relationships]),kind:n.kind||r.kind,displayName:n.displayName||r.displayName,enclosingSymbol:n.enclosingSymbol||r.enclosingSymbol,signatureDocumentation:n.signatureDocumentation??r.signatureDocumentation}))}return[...t.values()]}function Po(e){let t=new Set,r=[];for(let n of e){let i=[n.symbol,n.isReference?"1":"0",n.isImplementation?"1":"0",n.isTypeDefinition?"1":"0",n.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),r.push(n))}return r}function Ao(e,t){return e?t?e.length>=t.length?e:t:e:t}function Lo(e){return[...new Set(e)]}import{existsSync as cn,statSync as zo}from"fs";import{dirname as un,join as fn}from"path";import{appendFileSync as Do,existsSync as ko,mkdirSync as Co,renameSync as Oo,rmSync as Bo,statSync as Go,truncateSync as _o}from"fs";import{basename as Mo,dirname as Fo}from"path";var Me=".previous",No=".rotation.lock",$o=2e3,St=class extends Error{constructor(r,n){super(`Timed out after ${n}ms waiting for rotating JSONL lock: ${r}`);this.lockPath=r;this.timeoutMs=n;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},bt=class extends Error{constructor(r){super(`Rotating JSONL lock ownership changed before release: ${r}`);this.lockPath=r;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},rn=Object.freeze({monotonicNow:ve,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let r=Re(e,{kind:"rotating-jsonl",detail:{target:Mo(t)}});return r.kind==="acquired"?{kind:"acquired",lock:r.lock}:{kind:"contended"}},makeDirectory(e){Co(e,{recursive:!0})},exists:ko,readBytes(e){return v(e,{maxBytes:xe,inputKind:"rotating JSONL segment"})},size(e){return Go(e).size},truncate:_o,remove(e){Bo(e,{force:!0})},rename:Oo,append:Do});function nn(e,t,r){let n=r.runtime??rn,i=JSON.stringify(t);if(i===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let o=Buffer.from(`${i}
7
+ `),a=Math.max(1,Math.floor(r.maxSegmentBytes),o.length);return an(e,r.lockTimeoutMs,n,()=>{n.makeDirectory(Fo(e));let s=jo(e,xe,n);r.onPhase?.("tail-repaired");let c=`${e}${r.previousSuffix??Me}`,d=!1,l=!1;return n.exists(e)&&n.size(e)+o.length>a&&(n.exists(c)&&(n.remove(c),l=!0),r.onPhase?.("previous-pruned"),n.rename(e,c),d=!0,r.onPhase?.("current-rotated")),n.append(e,o),r.onPhase?.("record-appended"),{lineBytes:o.length,segmentLimitBytes:a,repairedTailBytes:s,rotated:d,prunedPrevious:l}})}function on(e,t={}){let r=t.runtime??rn,n=Wo(t.maxSegmentBytes);return an(e,t.lockTimeoutMs,r,()=>{let i=[],o=0,a=`${e}${t.previousSuffix??Me}`;for(let s of[a,e]){if(!r.exists(s))continue;let c=qo(sn(s,n,r));i.push(...c.lines),o+=c.partialTailBytes}return{lines:i,ignoredPartialTailBytes:o}})}function an(e,t,r,n){let i=`${e}${No}`,o=Math.max(0,t??$o),a=r.monotonicNow()+o,s;for(;;){let u=r.tryAcquireLock(i,e);if(u.kind==="acquired"){s=u.lock;break}let b=a-r.monotonicNow();if(b<=0)throw new St(i,o);r.wait(Math.min(5,b))}let c=!1,d,l;try{l=n()}catch(u){c=!0,d=u}let p=!1;try{p=s.release()}catch(u){if(!c)throw u}if(c)throw d;if(!p)throw new bt(i);return l}function jo(e,t,r){if(!r.exists(e))return 0;let n=sn(e,t,r);if(n.length===0||n[n.length-1]===10)return 0;let i=n.lastIndexOf(10),o=i<0?0:i+1;return r.truncate(e,o),n.length-o}function Wo(e){let t=e??xe;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function sn(e,t,r){let n=r.size(e);if(n>t)throw new rt("rotating JSONL segment",e,"too-large",n,t);let i=r.readBytes(e),o=r.size(e);if(o!==n||i.byteLength!==n)throw new rt("rotating JSONL segment",e,"changed-during-read",o,t);return i}function qo(e){let t=e.lastIndexOf(10),r=t<0?0:t+1;return{lines:e.subarray(0,r).toString("utf8").split(`
8
+ `).filter(i=>i.length>0),partialTailBytes:e.length-r}}var Jo="reindex-activity.jsonl",Fe=Me,Vo=1024*1024,Uo=1440*60*1e3,dn=e=>_(e,"reindex activity segment");function xt(e){return fn(un(e),Jo)}function pn(e){if(e.reused)return 0;let r=(e.shards?.some(n=>!n.reused&&n.strategy==="incremental")??!1?0:It(e.indexPath))+It(e.dbPath);for(let n of e.shards??[]){if(n.reused)continue;let i=n.producedOutputBytes??n.outputBytes;i!==null&&(r+=i)}return r}function Ho(e){let t=pn(e),r=e.writeTelemetry;return r?Math.max(0,t-r.reflinkedBytes)+r.fallbackCopiedBytes+(r.incrementalWrittenBytes??0):t}function Tc(e,t){let r=t.lastRefresh;if(!r)return{state:"failed",reason:"reindex result has no refresh metadata"};let n=pn(t);return gn(xt(e),{version:1,event:"run",recordedAt:r.completedAt,trigger:r.trigger,result:r.result,durationMs:r.durationMs,estimatedLogicalOutputBytes:n,estimatedWriteBytes:Ho(t),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,incrementalWrittenBytes:t.writeTelemetry?.incrementalWrittenBytes??0,byLanguage:na(t)})}function Pc(e,t){return gn(xt(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function Yo(e,t,r=Vo,n){nn(e,t,{maxSegmentBytes:r,previousSuffix:Fe,...n?{runtime:n}:{}})}function Ko(e,t=new Date,r=Uo,n=dn){let i=t.getTime(),o=i-r,a={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(o).toISOString(),windowEndedAt:t.toISOString(),runs:0,rebuilt:0,fullRebuilds: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:{},automatic:{runs:0,rebuilt:0,fullRebuilds:0,estimatedWriteBytes:0}},s=a.automatic,c=xt(e),d=[];if(n===dn){if(!cn(c)&&!cn(`${c}${Fe}`))return a;try{let l=on(c,{previousSuffix:Fe});d=l.lines,a.ignoredPartialTailBytes=l.ignoredPartialTailBytes}catch{a.readErrors+=1,a.confidence="unavailable"}}else{let l=0;for(let p of[`${c}${Fe}`,c])try{d.push(...da(n(p))),l+=1}catch{a.readErrors+=1}l===0?a.confidence="unavailable":a.readErrors>0&&(a.confidence="partial")}for(let l of d){a.recordsRead+=1;let p=Xo(l);if(!p){a.invalidRecords+=1,a.confidence!=="unavailable"&&(a.confidence="partial");continue}let{record:u}=p,b=Date.parse(u.recordedAt);if(b<o||b>i){a.skippedRecords+=1;continue}if(a.invalidLanguageDetails=(a.invalidLanguageDetails??0)+p.invalidLanguageDetails,a.byTrigger[u.trigger.kind]=(a.byTrigger[u.trigger.kind]??0)+1,u.event==="suppressed"){a.suppressed+=1;continue}a.runs+=1,a[u.result]+=1,a.estimatedLogicalOutputBytes+=u.estimatedLogicalOutputBytes;let g=Qo(u);a.estimatedWriteBytes=(a.estimatedWriteBytes??0)+g,a.reflinkedBytes=(a.reflinkedBytes??0)+(u.reflinkedBytes??0),a.fallbackCopiedBytes=(a.fallbackCopiedBytes??0)+(u.fallbackCopiedBytes??0),u.result!=="failed"&&(p.hasLanguageDetails?a.attributedRuns=(a.attributedRuns??0)+1:a.unattributedRuns=(a.unattributedRuns??0)+1);for(let[y,k]of mn(u.byLanguage)){let F=(a.byLanguage??={})[y]??=sa();F.runs+=1,F[k.result]+=1,F.producedOutputBytes+=k.producedOutputBytes,F.durationMs+=k.durationMs}let h=ta(u);h&&a.oldestRebuildAt===void 0&&(a.oldestRebuildAt=u.recordedAt),h&&(a.fullRebuilds=(a.fullRebuilds??0)+1),g>0&&a.oldestWriteAt===void 0&&(a.oldestWriteAt=u.recordedAt),Zo(u.trigger)&&(s.runs+=1,u.result==="rebuilt"&&(s.rebuilt+=1),h&&(s.fullRebuilds+=1,s.oldestRebuildAt??=u.recordedAt),s.estimatedWriteBytes+=g,g>0&&(s.oldestWriteAt??=u.recordedAt))}return a.ignoredPartialTailBytes>0&&a.confidence!=="unavailable"&&(a.confidence="partial"),a.languageAttribution=ca(a),a}function gn(e,t){try{return Yo(e,t),{state:"recorded"}}catch(r){return{state:"failed",reason:r instanceof Error?r.message:String(r)}}}function Xo(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let r=t;if(r.version!==1||!Qt(r.recordedAt)||!r.trigger||!ra(r.trigger.kind))return null;if(r.event==="suppressed")return r.reason==="completed-index-is-fresh"?{record:r,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(r.event!=="run"||r.result!=="rebuilt"&&r.result!=="reused"&&r.result!=="failed"||!N(r.durationMs)||!N(r.estimatedLogicalOutputBytes)||r.estimatedWriteBytes!==void 0&&!N(r.estimatedWriteBytes)||r.reflinkedBytes!==void 0&&!N(r.reflinkedBytes)||r.fallbackCopiedBytes!==void 0&&!N(r.fallbackCopiedBytes)||r.incrementalWrittenBytes!==void 0&&!N(r.incrementalWrittenBytes))return null;let n=r,{byLanguage:i,...o}=n,a=ia(i);return{record:{...o,...a.byLanguage?{byLanguage:a.byLanguage}:{}},hasLanguageDetails:a.hasLanguageDetails,invalidLanguageDetails:a.invalidLanguageDetails}}catch{return null}}function Qo(e){return e.reflinkedBytes===void 0?e.estimatedWriteBytes??e.estimatedLogicalOutputBytes:Math.max(0,e.estimatedLogicalOutputBytes-e.reflinkedBytes)+(e.fallbackCopiedBytes??0)+(e.incrementalWrittenBytes??0)}function Ac(e,t,r=new Date){return t.enabled?ea(Ko(e,r,t.windowMs),t,r.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function Zo(e){return e.kind.startsWith("watch-")}function ea(e,t,r){let n=e.automatic??{fullRebuilds:e.fullRebuilds??e.rebuilt,estimatedWriteBytes:e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,oldestRebuildAt:e.oldestRebuildAt,oldestWriteAt:e.oldestWriteAt},i=n.estimatedWriteBytes,o=n.fullRebuilds,a={rebuilt:o,estimatedWriteBytes:i};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:r+t.windowMs,...a,detail:`reindex activity evidence is ${e.confidence}`}:o>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:ln(n.oldestRebuildAt,t.windowMs,r),...a,detail:`${o}/${t.maxRebuilds} expensive full rebuild slots consumed by automatic refreshes`}:i>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:ln(n.oldestWriteAt,t.windowMs,r),...a,detail:`${i}/${t.maxEstimatedWriteBytes} estimated write bytes consumed by automatic refreshes`}:{state:"allowed",...a}:{state:"allowed",...a}}function ta(e){if(e.result!=="rebuilt")return!1;let t=mn(e.byLanguage);return t.length===0?!0:t.some(([,r])=>r.result==="rebuilt"&&r.strategy!=="incremental"&&r.strategy!=="reused")}function ln(e,t,r){let n=e?Date.parse(e):Number.NaN;return Number.isFinite(n)&&n+t>r?n+t:r+t}function ra(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 It(e){try{return zo(e).size}catch{return 0}}function na(e){let t={};for(let r of e.languages){let n=(e.shards??[]).filter(d=>d.language===r),i=n.find(d=>d.id===r),o=e.reused||(i?i.reused:n.length>0&&n.every(d=>d.reused)),a=It(fn(un(e.dbPath),"language-indexes",`${r}.scip`)),s=a>0?a:i?.outputBytes??a,c=o?0:i?.durationMs??n.filter(d=>!d.reused).reduce((d,l)=>d+l.durationMs,0);t[r]={result:o?"reused":"rebuilt",strategy:o?"reused":i?.strategy??"full",...i?.strategy==="full"&&(i.fallbackReason??i.missReason)?{fallbackReason:i.fallbackReason??i.missReason}:{},outputBytes:s,producedOutputBytes:o?0:i?.producedOutputBytes??s,durationMs:c}}return t}function ia(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let t={},r=0;for(let[i,o]of Object.entries(e)){if(!aa(i)||!oa(o)){r+=1;continue}t[i]=o}let n=Object.keys(t).length>0;return{...n?{byLanguage:t}:{},hasLanguageDetails:n,invalidLanguageDetails:r}}function oa(e){if(!e||typeof e!="object")return!1;let t=e;return(t.result==="rebuilt"||t.result==="reused")&&(t.strategy===void 0||t.strategy==="reused"||t.strategy==="incremental"||t.strategy==="full")&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")&&et(t.outputBytes)&&et(t.producedOutputBytes)&&N(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function aa(e){return tt.includes(e)}function mn(e){return e?tt.flatMap(t=>{let r=e[t];return r?[[t,r]]:[]}):[]}function sa(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function ca(e){let t=e.invalidLanguageDetails??0,r=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":r===0?"unavailable":"partial"}function da(e){return e.endsWith(`
9
+ `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
10
+ `)+1))),e.split(`
11
+ `).filter(t=>t.length>0)}import la from"better-sqlite3";var ua=25,fa=new Set(["typescript","javascript"]);function Oc(e,t,r){let n=null;try{n=new la(e,{readonly:!0,fileMustExist:!0});let i=new Set(n.prepare("SELECT relative_path FROM documents").pluck().all().map(Qe)),o=pa(t,r),a=new Set([...o.values()].flatMap(l=>[...l])),s=[...a].filter(l=>!i.has(l)).sort();if(s.length===0)return{state:"complete",expectedDocumentCount:a.size,actualDocumentCount:i.size};let c=new Set(s),d=r.filter(l=>[...o.get(l)??[]].some(p=>c.has(p)));return{state:"incomplete",expectedDocumentCount:a.size,actualDocumentCount:i.size,missingDocumentCount:s.length,missingPaths:s.slice(0,ua),affectedLanguages:d}}catch(i){return{state:"unavailable",reason:i instanceof Error?i.message:String(i)}}finally{n?.close()}}function pa(e,t){let r=new Map,n=t.filter(i=>fa.has(i));for(let i of n)r.set(i,new Set);for(let i of e.files){let o=Qe(i.path);for(let a of n)Yt(o,[a])==="source"&&r.get(a).add(o)}return r}import{existsSync as hn,readdirSync as Sn,rmSync as bn}from"fs";import{join as X}from"path";import{create as xn,fromBinary as wn,toBinary as qc}from"@bufbuild/protobuf";import{deserializeSCIP as wt,DocumentSchema as vn,IndexSchema as Rn,serializeSCIP as En}from"@c4312/scip";import{existsSync as ga,mkdirSync as ma,renameSync as ya,writeFileSync as ha}from"fs";import{join as Sa}from"path";function yn(e){ma(e.blobDir,{recursive:!0});let t=Sa(e.blobDir,`${e.blobHash}.scipdoc`);if(ga(t)){let n=v(t,{maxBytes:ee,inputKind:e.inputKind});if(n.byteLength!==e.bytes.byteLength||M(n)!==e.blobHash)throw new Error(`existing ${e.inputKind} is corrupt: ${e.relativePath}`);return}let r=`${t}.${process.pid}.${Date.now()}.tmp`;ha(r,e.bytes),ya(r,t)}var vt=1,pe="typescript-scip-fragments";function Uc(e){let t=new Set,r=[];for(let o of e){let a=Ne(o.relativePath);if(t.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(t.add(a),o.bytes===null)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${a}`);let s=wn(vn,o.bytes);if(s.relativePath!==a)throw new Error(`TypeScript fragment path mismatch: expected ${a}, got ${s.relativePath}`);r.push(s)}let n=En(xn(Rn,{documents:r,externalSymbols:[]})),i=wt(n);if(i.documents.length!==r.length||i.externalSymbols.length!==0)throw new Error("affected TypeScript SCIP index failed structural verification");return n}function ba(e){let t=X(e,pe);return{rootDir:t,blobDir:X(t,"blobs"),generationDir:X(t,"generations")}}function Tn(e){let t=Ia(e);return xa(t.baseIndex,t.completeDocuments,"assembled")}function Ia(e){let t=wt(e.baseIndexBytes);Ea(t.metadata,Ta(e)),Ra(t.externalSymbols);let r=new Map;for(let s of e.fragments){let c=Ne(s.relativePath);if(r.has(c))throw new Error(`duplicate TypeScript fragment replacement: ${c}`);r.set(c,s)}if(r.size===0)throw new Error("TypeScript index assembly requires at least one replacement");let n=new Set,i=[],o=[],a=[];for(let s of t.documents){let c=Ne(s.relativePath);if(n.has(c))throw new Error(`duplicate TypeScript SCIP document path: ${c}`);n.add(c);let d=r.get(c);if(!d){i.push(s);continue}if(r.delete(c),d.bytes===null){a.push(c);continue}let l=In(c,d.bytes);i.push(l),o.push(l)}for(let s of[...r.keys()].sort()){let c=r.get(s);if(c.bytes===null)continue;if(n.has(s))throw new Error(`duplicate TypeScript SCIP document path: ${s}`);n.add(s);let d=In(s,c.bytes);i.push(d),o.push(d)}return{baseIndex:t,completeDocuments:i,affectedDocuments:o,deletedAffectedPaths:a}}function In(e,t){let r=wn(vn,t);if(r.relativePath!==e)throw new Error(`TypeScript fragment path mismatch: expected ${e}, got ${r.relativePath}`);return r}function xa(e,t,r){let n=En(xn(Rn,{metadata:e.metadata,documents:t,externalSymbols:[]})),i=wt(n);if(i.documents.length!==t.length||i.externalSymbols.length!==0)throw new Error(`${r} TypeScript SCIP index failed structural verification`);return n}function Hc(e,t){let r=ba(e);if(!hn(r.generationDir))return;let n=new Set(t.map(a=>va(a))),i=Sn(r.generationDir).filter(a=>a.endsWith(".json")),o=new Set;for(let a of i.filter(s=>n.has(s))){let s=wa(P(X(r.generationDir,a),{maxBytes:T,inputKind:"TypeScript fragment manifest"}));for(let c of s.documents)o.add(`${c.blobHash}.scipdoc`)}for(let a of i)n.has(a)||bn(X(r.generationDir,a),{force:!0});if(hn(r.blobDir))for(let a of Sn(r.blobDir))o.has(a)||bn(X(r.blobDir,a),{force:!0})}function wa(e){let t=JSON.parse(e);if(t.version!==vt||typeof t.producerIdentity!="string"||typeof t.projectIdentity!="string"||typeof t.generationIdentity!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.documents))throw new Error("invalid TypeScript fragment generation manifest");let r=new Set;for(let n of t.documents){if(!n||typeof n.relativePath!="string"||typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash)||typeof n.byteLength!="number"||!Number.isInteger(n.byteLength)||n.byteLength<0||typeof n.documentIdentity!="string"||!n.documentIdentity)throw new Error("invalid TypeScript fragment record");if(Ne(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript fragment record");r.add(n.relativePath)}return t}function va(e){if(!e)throw new Error("TypeScript fragment generation identity must be non-empty");return`${M(e)}.json`}function Ra(e){if(e.length>0)throw new Error("scip-typescript emitted external symbols; incremental document assembly is unsupported")}function Ea(e,t){if(!e||typeof e!="object")throw new Error("TypeScript SCIP shard has no producer metadata");let r=e,n=r.toolInfo??r.tool_info;if(!n||typeof n!="object")throw new Error("TypeScript SCIP shard has no producer tool identity");let i=n;if(i.name!=="scip-typescript"||i.version!==t)throw new Error("TypeScript SCIP shard producer identity changed")}function Ta(e){let t=e.packageVersion??e.runtime?.packageVersion;if(!t)throw new Error("scip-typescript package version is unavailable");return t}function Ne(e){if(!e||e.startsWith("/")||e.startsWith("\\")||e.includes("\\"))throw new Error(`invalid TypeScript SCIP document path: ${e}`);let t=e.split("/");if(t.includes("")||t.includes(".")||t.includes(".."))throw new Error(`invalid TypeScript SCIP document path: ${e}`);return e}import{existsSync as $e,readdirSync as Rt,rmSync as Pn}from"fs";import{join as O}from"path";var je=1,ge="typescript-scip-overlays",An="typescript-project-v3:";function nd(e){let t=Dn(e.cacheDir,e.previousGenerationIdentity);if(!t&&!e.baseShardCurrent)throw new Error("deferred TypeScript SCIP base has no matching overlay generation");if(t?.producerIdentity!==void 0&&t.producerIdentity!==e.producerIdentity)throw new Error("TypeScript overlay producer identity changed");let r=e.allowLegacyProjectIdentityMigration===!0&&t!==null&&!t.projectIdentity.startsWith(An)&&e.projectIdentity.startsWith(An);if(t&&t.projectIdentity!==e.projectIdentity&&!e.allowProjectIdentityChange&&!r)throw new Error("TypeScript overlay project identity changed");let n=new Map((t?.overlays??[]).map(a=>[a.relativePath,a])),i=new Set;for(let a of e.fragments){let s=Pt(a.relativePath);if(i.has(s))throw new Error(`duplicate TypeScript overlay: ${s}`);i.add(s),n.set(s,Pa(e.cacheDir,a))}if(i.size===0)throw new Error("TypeScript overlay generation requires affected documents");let o={version:je,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:t?.baseGenerationIdentity??e.previousGenerationIdentity,generationIdentity:e.nextGenerationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),overlays:[...n.values()].sort((a,s)=>a.relativePath.localeCompare(s.relativePath))};return Aa(e.cacheDir,o),o}function id(e){let t=Dn(e.cacheDir,e.generationIdentity);if(!t)throw new Error("TypeScript overlay generation is unavailable");let r=t.overlays.map(n=>{if(n.blobHash===null)return{relativePath:n.relativePath,bytes:null,occurrences:0,symbols:0,referenceFragments:[]};let i=v(O(me(e.cacheDir),"blobs",`${n.blobHash}.scipdoc`),{maxBytes:ee,inputKind:"TypeScript overlay blob"});if(i.byteLength!==n.byteLength||M(i)!==n.blobHash)throw new Error(`TypeScript overlay blob is corrupt: ${n.relativePath}`);return{relativePath:n.relativePath,bytes:i,occurrences:0,symbols:0,referenceFragments:[]}});return Tn({packageVersion:e.packageVersion,baseIndexBytes:e.baseIndexBytes,fragments:r})}function od(e,t){let r=me(e),n=O(r,"generations");if(!$e(n))return;let i=new Set(t.map(Tt)),o=new Set;for(let s of Rt(n).filter(c=>i.has(c))){let c=Et(P(O(n,s),{maxBytes:T,inputKind:"TypeScript overlay manifest"}));for(let d of c.overlays)d.blobHash&&o.add(`${d.blobHash}.scipdoc`)}for(let s of Rt(n))i.has(s)||Pn(O(n,s),{force:!0});let a=O(r,"blobs");if($e(a))for(let s of Rt(a))o.has(s)||Pn(O(a,s),{force:!0})}function Dn(e,t){let r=O(me(e),"generations",Tt(t));if(!$e(r))return null;let n=Et(P(r,{maxBytes:T,inputKind:"TypeScript overlay manifest"}));if(n.generationIdentity!==t)throw new Error("TypeScript overlay generation identity does not match its path");return n}function Pa(e,t){let r=Pt(t.relativePath);if(t.bytes===null)return{relativePath:r,blobHash:null,byteLength:0};let n=Buffer.from(t.bytes),i=M(n);return yn({blobDir:O(me(e),"blobs"),blobHash:i,bytes:n,relativePath:r,inputKind:"TypeScript overlay blob"}),{relativePath:r,blobHash:i,byteLength:n.byteLength}}function Aa(e,t){let r=O(me(e),"generations",Tt(t.generationIdentity));if($e(r)){let n=Et(P(r,{maxBytes:T,inputKind:"TypeScript overlay manifest"}));if(Ln(n)!==Ln(t))throw new Error(`TypeScript overlay generation is immutable: ${t.generationIdentity}`);return}Pe(r,t,{spacing:2,trailingNewline:!0})}function Et(e){let t=JSON.parse(e);if(t.version!==je||typeof t.producerIdentity!="string"||!t.producerIdentity||typeof t.projectIdentity!="string"||!t.projectIdentity||typeof t.baseGenerationIdentity!="string"||!t.baseGenerationIdentity||typeof t.generationIdentity!="string"||!t.generationIdentity||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.overlays))throw new Error("invalid TypeScript overlay manifest");let r=new Set;for(let n of t.overlays){if(!n||typeof n.relativePath!="string"||n.blobHash!==null&&(typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash))||!Number.isInteger(n.byteLength)||n.byteLength<0||n.blobHash===null&&n.byteLength!==0)throw new Error("invalid TypeScript overlay record");if(Pt(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript overlay record");r.add(n.relativePath)}return t}function me(e){return O(e,ge)}function Tt(e){if(!e)throw new Error("TypeScript overlay generation identity must be non-empty");return`${M(e)}.json`}function Ln(e){return M(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:e.baseGenerationIdentity,generationIdentity:e.generationIdentity,overlays:e.overlays}))}function Pt(e){if(!e||e.startsWith("/")||e.includes("\\")||e.split("/").some(t=>!t||t==="."))throw new Error(`invalid TypeScript overlay path: ${e}`);if(e.split("/").includes(".."))throw new Error(`invalid TypeScript overlay path: ${e}`);return e}import{createHash as Ot}from"crypto";import{closeSync as La,existsSync as I,mkdirSync as Da,openSync as ka,readSync as Ca,readdirSync as Bt,renameSync as kt,rmSync as ye,statSync as J}from"fs";import{basename as Gt,dirname as B,join as m,relative as kn}from"path";var Oa=Object.freeze({maxGenerations:2,maxLogicalBytes:2*1024*1024*1024});function On(e){let t=L(e.outputDb),r=Fa(e);e.onStage?.("after-recovery-retained");let n=e.preserveOutputScip?e.outputScip:e.tempOutputScip,i=Na(e,r),o=Mt({generationRoot:t,databasePath:e.tempOutputDb,indexPath:I(n)?n:void 0,verifiedIndexArtifact:i,metadataPath:I(e.tempMetaPath)?e.tempMetaPath:void 0}),a=(e.now??(()=>new Date))().toISOString(),s={version:Y,currentGeneration:o.identity,artifactSet:"immutable-v1",...r?{previousGeneration:r}:{},...e.publication?{publication:e.publication}:{},publishedAt:a},c=C(m(t,"state.json"),s,{spacing:2,trailingNewline:!0});e.onStage?.("after-pointer-handoff"),e.preserveOutputScip||Dt(e.tempOutputScip,e.outputScip),e.onStage?.("after-scip-handoff"),Dt(e.tempOutputDb,e.outputDb),e.onStage?.("after-database-handoff"),Dt(e.tempMetaPath,e.metaPath),e.onStage?.("after-metadata-handoff");let d=o.identity,l={...s,stableMirrors:_t(e.outputDb,e.outputScip)};C(m(t,"state.json"),l,{spacing:2,trailingNewline:!0});let p=Bn(e.outputDb,{now:e.now}),u=re(o.directorySync,c.directorySync);return{currentGeneration:d,...r?{previousGeneration:r}:{},retention:p,achievedDurability:u==="synced"?"directory-durable":"file-flushed",directorySync:u}}function Ba(e,t,r,n=()=>new Date){if(!I(e))return null;let i=ne(e),o=m(L(e),"state.json");if(i?.artifactSet==="immutable-v1"&&Le(e,i.currentGeneration))return i;let a=L(e),s=!i&&I(o)?ja(r,e,t):void 0;if(s&&!De(a,s))return null;let c=Mt({generationRoot:a,databasePath:e,indexPath:I(t)?t:void 0,metadataPath:I(r)?r:void 0,forcedIdentity:i?.currentGeneration??s}),d={version:Y,currentGeneration:c.identity,artifactSet:"immutable-v1",stableMirrors:_t(e,t),...i?.previousGeneration?{previousGeneration:i.previousGeneration}:{},...i?.publication?{publication:i.publication}:{},publishedAt:i?.publishedAt??n().toISOString()};return C(m(a,"state.json"),d,{spacing:2,trailingNewline:!0}),d}function hd(e,t,r=()=>new Date){if(!I(e)||!I(t))throw new Error("metadata-only generation refresh requires stable database and metadata files");let n=ne(e),i=L(e),o=Mt({generationRoot:i,databasePath:e,indexPath:I(m(B(e),"index.scip"))?m(B(e),"index.scip"):void 0,metadataPath:t}),a=n&&n.currentGeneration!==o.identity?_n(e,n.currentGeneration):void 0,s={version:Y,currentGeneration:o.identity,artifactSet:"immutable-v1",stableMirrors:_t(e,m(B(e),"index.scip")),...a?{previousGeneration:a}:{},...n?.publication?{publication:n.publication}:{},publishedAt:r().toISOString()};return C(m(L(e),"state.json"),s,{spacing:2,trailingNewline:!0}),Bn(e,{now:r}),s}function Bn(e,t={}){let r=Ga(t.limits),i=(t.now??(()=>new Date))().toISOString(),o=te(sr(e),{waitMs:0});if(!o)return{state:"deferred",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:"another process owns local generation retention"};try{let a=ne(e),s=_a(e),c=cr(e,s.map(y=>y.identity),{isProcessAlive:t.isProcessAlive??rr,readProcessIdentity:t.readProcessIdentity??tr}),d=new Set(c.protectedGenerations);a?.currentGeneration&&d.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&d.add(a.previousGeneration.generationIdentity);let l=s.length,p=s.reduce((y,k)=>y+k.logicalBytes,0),u=0,b=0;for(let y of s){if(l<=r.maxGenerations&&p<=r.maxLogicalBytes)break;d.has(y.identity)||(t.onBeforeRemove?.(y.identity),ye(y.path,{recursive:!0,force:!0}),l-=1,p-=y.logicalBytes,u+=1,b+=y.logicalBytes)}let g=l>r.maxGenerations||p>r.maxLogicalBytes,h={state:g?"protected":u>0?"collected":"within-bounds",generationCount:l,logicalBytes:p,protectedGenerations:d.size,activeReaderLeases:c.activeLeases,staleReaderLeasesRemoved:c.staleLeasesRemoved,malformedReaderLeases:c.malformedLeases,removedGenerations:u,removedLogicalBytes:b,limits:r,at:i,...g?{reason:c.malformedLeases>0?"malformed reader ownership evidence fails closed":"retention bounds cannot be met without deleting a protected generation"}:{}};return Cn(e,h),h}catch(a){let s={state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:a instanceof Error?a.message:String(a)};try{Cn(e,s)}catch{}return s}finally{o.release()}}function Ga(e={}){let t={...Oa,...e};if(!Number.isSafeInteger(t.maxGenerations)||t.maxGenerations<2)throw new Error("Local SQLite generation retention must keep at least current and previous generations.");if(!Number.isSafeInteger(t.maxLogicalBytes)||t.maxLogicalBytes<=0)throw new Error("Local SQLite generation byte retention must be a positive safe integer.");return t}function _a(e){let t=L(e);return I(t)?Bt(t,{withFileTypes:!0}).filter(r=>r.isDirectory()&&/^[a-f0-9]{64}$/.test(r.name)).map(r=>{let n=m(t,r.name),i=De(t,r.name),o=i?i.database.size+(i.index?.size??0)+(i.metadata?.size??0):Gn(n);return{identity:r.name,path:n,logicalBytes:o,modifiedAtMs:J(n).mtimeMs}}).sort((r,n)=>r.modifiedAtMs-n.modifiedAtMs||r.identity.localeCompare(n.identity)):[]}function Gn(e){let t=0;for(let r of Bt(e,{withFileTypes:!0})){let n=m(e,r.name);r.isDirectory()?t+=Gn(n):r.isFile()&&(t+=J(n).size)}return t}function Cn(e,t){Pe(m(L(e),"gc.json"),t,{spacing:2,trailingNewline:!0})}function qe(e,t=m(B(e),"meta.json")){let r=m(L(e),"state.json");if(!I(r))return{state:"legacy",statePath:r};let n=ne(e);if(!n)return{state:"invalid",statePath:r,reason:"generation state is malformed"};try{let i=Le(e,n.currentGeneration),o=i!==null,a=i?Ma(e,t,i,n):!1,s=n.previousGeneration?I(m(B(e),n.previousGeneration.databasePath)):!0;return!a||!o||!s?{state:"drifted",statePath:r,currentMatches:a,recoveryExists:s,generation:n,reason:o?a?"retained recovery database is missing":"stable database or metadata no longer matches the published generation":"published immutable generation is missing"}:{state:"current",statePath:r,currentMatches:a,recoveryExists:s,generation:n}}catch(i){return{state:"drifted",statePath:r,currentMatches:!1,recoveryExists:!1,generation:n,reason:i instanceof Error?i.message:String(i)}}}function Ma(e,t,r,n){if(n.stableMirrors&&(n.stableMirrors.databaseFileIdentity!==ie(e)||n.stableMirrors.indexFileIdentity!==void 0&&n.stableMirrors.indexFileIdentity!==ie(m(B(e),"index.scip")))||!Ct(e,r.database))return!1;let i=m(B(e),"index.scip");if(r.index&&!Ct(i,r.index))return!1;if(!r.metadata)return!I(t);if(!I(t))return!1;let o=m(L(e),r.identity,r.metadata.file);return I(o)&&z(_(t,"reindex metadata"))===z(_(o,"immutable reindex metadata"))}function Ct(e,t){return I(e)&&J(e).isFile()&&J(e).size===t.size}function Fa(e){let t=Ba(e.outputDb,e.outputScip,e.metaPath);return t?_n(e.outputDb,t.currentGeneration):void 0}function Na(e,t){if(!e.preserveOutputScip)return;if(!t)throw new Error("deferred SCIP publication requires an accepted immutable generation");let r=qe(e.outputDb,e.metaPath);if(r.state!=="current"||r.generation.currentGeneration!==t.generationIdentity){let i=r.state==="current"?"generation identity changed":"reason"in r?r.reason:`generation state is ${r.state}`;throw new Error(`deferred SCIP publication requires a verified accepted companion: ${i}`)}let n=Le(e.outputDb,t.generationIdentity);if(!n?.index||!Ct(e.outputScip,n.index))throw new Error("deferred SCIP publication requires the verified accepted index artifact");return n.index}function _t(e,t){return{databaseFileIdentity:ie(e),...I(t)?{indexFileIdentity:ie(t)}:{}}}function _n(e,t){let r=m(L(e),t),n=m(r,Gt(e)),i=m(r,"meta.json");return{generationIdentity:t,databasePath:kn(B(e),n),...I(i)?{metadataPath:kn(B(e),i)}:{}}}function $a(e){if(I(e))for(let t of Bt(e,{withFileTypes:!0}))t.isDirectory()&&t.name.endsWith(".tmp")&&ye(m(e,t.name),{recursive:!0,force:!0})}function ja(e,t,r=m(B(t),"index.scip")){let n=Ot("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(We(t)),I(r)&&n.update(`\0${We(r)}`),I(e)&&n.update(`\0${z(_(e,"reindex metadata"))}`),n.digest("hex")}function Mt(e){let t=At(e.databasePath),r=e.indexPath?e.verifiedIndexArtifact?qa(e.indexPath,e.verifiedIndexArtifact):At(e.indexPath):void 0,n=e.metadataPath?At(e.metadataPath):void 0,i=e.forcedIdentity??Wa(t,r,e.metadataPath),o=m(e.generationRoot,i),a=m(o,it);if(I(a)){let d=De(e.generationRoot,i);if(d&&Mn(o,d.database,t)&&Ja(o,d.index,r)&&Va(o,d.metadata,e.metadataPath))return{identity:i,directorySync:$(e.generationRoot)};throw new Error(`SQLite generation ${i} already exists with different or corrupt artifacts.`)}let s=[Ee(e.generationRoot)];$a(e.generationRoot);let c=`${o}.${process.pid}.${Date.now()}.tmp`;ye(c,{recursive:!0,force:!0}),Da(c,{recursive:!0});try{s.push(Lt(e.databasePath,m(c,t.file))),r&&e.indexPath&&s.push(Lt(e.indexPath,m(c,r.file))),n&&e.metadataPath&&s.push(Lt(e.metadataPath,m(c,n.file)));let d=C(m(c,it),{version:ar,identity:i,database:t,...r?{index:r}:{},...n?{metadata:n}:{}},{spacing:2,trailingNewline:!0});d.directorySync!=="not-requested"&&s.push(d.directorySync),s.push($(c)),kt(c,o),s.push($(e.generationRoot))}finally{ye(c,{recursive:!0,force:!0})}return{identity:i,directorySync:re(...s)}}function Wa(e,t,r){let n=Ot("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(e.sha256),t&&n.update(`\0${t.sha256}`),r&&n.update(`\0${z(_(r,"reindex metadata"))}`),n.digest("hex")}function At(e){return{file:Gt(e),size:J(e).size,sha256:We(e)}}function qa(e,t){if(t.file!==Gt(e)||J(e).size!==t.size)throw new Error(`verified SQLite generation artifact changed before publication: ${e}`);return t}function We(e){let t=Ot("sha256"),r=ka(e,"r"),n=Buffer.allocUnsafe(1024*1024);try{for(;;){let i=za(r,n);if(i===0)break;t.update(n.subarray(0,i))}}finally{La(r)}return t.digest("hex")}function za(e,t){let r=0;for(;r<t.length;){let n=Ca(e,t,r,t.length-r,null);if(r+=n,n===0)break}return r}function Lt(e,t){return Te(e,t,{mode:292})}function Mn(e,t,r){let n=m(e,t.file);return t.file===r.file&&t.size===r.size&&t.sha256===r.sha256&&I(n)&&J(n).size===t.size&&We(n)===t.sha256}function Ja(e,t,r){return!t||!r?t===r:Mn(e,t,r)}function Va(e,t,r){if(!t||!r)return t===void 0&&r===void 0;let n=m(e,t.file);return I(n)&&z(_(n,"stored reindex metadata"))===z(_(r,"candidate reindex metadata"))}function Dt(e,t){ye(`${t}.tmp-replace`,{force:!0}),kt(e,`${t}.tmp-replace`),kt(`${t}.tmp-replace`,t)}import{createHash as Vn,randomUUID as Za}from"crypto";import{existsSync as q,lstatSync as $t,mkdirSync as Q,mkdtempSync as Un,readdirSync as Hn,realpathSync as Yn,renameSync as U,rmSync as W,statSync as Ue}from"fs";import{dirname as jt,join as f,resolve as V}from"path";import{setTimeout as es}from"timers/promises";import{pathToFileURL as jn}from"url";import ts from"better-sqlite3";import{lstatSync as Ua,readdirSync as Ha}from"fs";import{join as Ya,relative as Ka,resolve as Ft,sep as Xa}from"path";var he=1,Nt="language-indexes",Fn=["index.db","index.scip","meta.json"],Nn=[Nt,pe,ge];function ze(e){let t=[];for(let r of Fn)Qa(e,r),t.push(r);for(let r of Nn)$n(e,r,t);return{version:he,files:t.sort()}}function Je(e){if(!e||e.includes("\0")||e.startsWith("/")||e.includes("\\"))throw new Error(`invalid index artifact path: ${e||"<empty>"}`);let t=e.split("/");if(t.some(n=>!n||n==="."||n===".."))throw new Error(`invalid index artifact path: ${e}`);let r=t[0];if(!Fn.includes(e)&&!Nn.includes(r))throw new Error(`index artifact path is not shareable: ${e}`);return e}function G(e,t){let r=Je(t),n=Ft(e),i=Ft(n,...r.split("/"));if(i!==n&&!i.startsWith(`${n}${Xa}`))throw new Error(`index artifact escapes cache: ${t}`);return i}function $n(e,t,r){let n=Ya(e,t),i;try{i=Ha(n,{withFileTypes:!0,encoding:"utf8"})}catch{return}for(let o of i){let a=`${t}/${o.name}`;if(o.isSymbolicLink())throw new Error(`index artifact cannot be a symlink: ${a}`);o.isDirectory()?$n(e,a,r):o.isFile()&&r.push(Je(a))}}function Qa(e,t){let r=G(e,t),n;try{n=Ua(r)}catch{throw new Error(`required index artifact is missing: ${t}`)}if(!n.isFile()||n.isSymbolicLink())throw new Error(`required index artifact is not a regular file: ${t}`);if(Ka(Ft(e),r).startsWith(".."))throw new Error(`index artifact escapes cache: ${t}`)}var Wt=1,Wn="SCIP_QUERY_SHARED_CACHE",rs=2,Ve=JSON.stringify({cliVersion:ur,artifactCatalogVersion:he,postIndexAugmentationSchemaVersion:rs,sqliteGenerationStoreVersion:Y,typescriptFragmentStoreVersion:vt,typescriptOverlayStoreVersion:je}),qt="manifest.json",Kn="shared-cache.json";var zt=[Nt,pe,ge];function ns(e,t){if(!e.clean||!e.treeOid)return;let r=ri(JSON.stringify({version:Wt,repositoryId:e.repositoryId,treeOid:e.treeOid,fingerprint:Xt(t),producerIdentity:Ve}));return{repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:t,producerIdentity:Ve,generationId:r,repositoryCacheDir:gr(e.repositoryId)}}function Hd(e,t,r){if(!gs(r))return!1;let n=ns(e,r);if(!n)return!1;try{let i=ds(t);if(!i||i.repositoryId!==e.repositoryId||i.worktreeId!==e.worktreeId)return!1;let o=JSON.parse(P(f(n.repositoryCacheDir,"worktrees",`${i.worktreeId}.json`),{inputKind:"worktree cache lease",maxBytes:T}));return o.version!==1||o.repositoryId!==i.repositoryId||o.worktreeId!==i.worktreeId||V(o.projectRoot)!==V(e.projectRoot)||o.treeOid!==e.treeOid||V(o.localCacheDir)!==V(t)||o.ownershipChecksum!==Jt(o)||o.baseGenerationId!==n.generationId||o.activeGenerationId!==n.generationId?!1:H(n,!1)!==null}catch{return!1}}function Yd(e,t,r){if(process.env[Wn]==="0")return`${Wn}=0`;if(!mr(r))return"explicit cache or database override";if(ot(jt(t))!==ot(pr(e))||t!==f(jt(t),"index.db"))return"index database is outside the managed worktree cache"}function H(e,t=!0){let r=Vt(e),n;try{n=Xn(P(f(r,qt),{inputKind:"shared-generation manifest",maxBytes:T}))}catch{return null}if(n.generationId!==e.generationId||n.repositoryId!==e.repositoryId||n.treeOid!==e.treeOid||n.producerIdentity!==e.producerIdentity||!Ie(n.fingerprint,e.fingerprint)||!ss(r))return null;if(!t)return n;try{for(let i of n.artifacts){let o=G(r,i.path),a=Ue(o);if(!a.isFile()||a.size!==i.size||we(o,{inputKind:"shared-generation artifact",maxBytes:R})!==i.sha256)return null}}catch{return null}return n}function Kd(e,t,r,n){if(!e.treeOid)return null;let i=at(t,r),o=f(fr(),"repositories",e.repositoryId),a;try{let d=$t(o);if(!d.isDirectory()||d.isSymbolicLink())return null;a=Yn(o)}catch{return null}let s=f(a,"generations"),c=[];try{for(let d of Hn(s)){if(!/^[a-f0-9]{64}$/.test(d))continue;let l=f(s,d),p;try{p=$t(l)}catch{continue}if(!(!p.isDirectory()||p.isSymbolicLink()))try{let u=Xn(P(f(l,qt),{inputKind:"shared-generation baseline manifest",maxBytes:T}));u.generationId===d&&u.repositoryId===e.repositoryId&&u.producerIdentity===Ve&&cs(u.fingerprint,i)&&c.push(u)}catch{continue}}}catch{return null}c.sort((d,l)=>{let p=d.treeOid===e.treeOid?0:1,u=l.treeOid===e.treeOid?0:1;if(p!==u)return p-u;if(n){let g=Jn(d.fingerprint,n)-Jn(l.fingerprint,n);if(g!==0)return g}return Date.parse(l.createdAt)-Date.parse(d.createdAt)||d.generationId.localeCompare(l.generationId)});for(let d of c){let l={repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:d.treeOid,fingerprint:d.fingerprint,producerIdentity:d.producerIdentity,generationId:d.generationId,repositoryCacheDir:a},p=H(l);if(p)return{snapshot:l,manifest:p}}return null}function Xd(e){let t=te(f(e.snapshot.repositoryCacheDir,"locks",`${e.snapshot.generationId}.publish.lock`));if(!t)throw new Error(`shared generation publication is already in progress for ${e.snapshot.generationId}`);try{return is(e)}finally{t.release()}}function is(e){let t=H(e.snapshot);if(t)return qn(e.snapshot,t);if(!ti(e.sourceCacheDir,e.sourceProjectRoot,e.snapshot.fingerprint))throw new Error("source index is incomplete, incompatible, or corrupt");let r=zn(e.sourceCacheDir);if(!r)throw new Error("source index artifacts are incomplete");let n=ze(e.sourceCacheDir),i=f(e.snapshot.repositoryCacheDir,"generations"),o=[Ee(i)],a=Un(f(i,`.tmp-${process.pid}-`));try{let s=[];for(let g of n.files){let h=G(e.sourceCacheDir,g),y=G(a,g);o.push(be(h,y,292)),e.onPublicationStage?.("after-artifact-flushed",g);let k=Ue(y).size;s.push({path:g,size:k,sha256:we(y,{inputKind:"staged shared-generation artifact",maxBytes:R})})}let c=de(v(f(a,"index.scip"),{inputKind:"staged shared SCIP index",maxBytes:R}));if(!c)throw new Error("shared SCIP generation has no project root metadata");let d=Ut(e.sourceProjectRoot);if(c!==d)throw new Error("shared SCIP generation root does not match its source worktree");if(zn(e.sourceCacheDir)!==r||e.sourceStillValid&&!e.sourceStillValid())throw new Error("source index changed while staging a shared generation");let l={version:Wt,artifactCatalogVersion:he,generationId:e.snapshot.generationId,repositoryId:e.snapshot.repositoryId,treeOid:e.snapshot.treeOid,fingerprint:e.snapshot.fingerprint,producerIdentity:e.snapshot.producerIdentity,sourceProjectRoot:e.sourceProjectRoot,scipProjectRoot:c,createdAt:(e.now??(()=>new Date))().toISOString(),artifacts:s.sort((g,h)=>g.path.localeCompare(h.path))},p=C(f(a,qt),l,{spacing:2,trailingNewline:!0});p.directorySync!=="not-requested"&&o.push(p.directorySync),e.onPublicationStage?.("after-manifest-flushed"),o.push($(a)),e.onPublicationStage?.("after-staging-directory-synced");let u=Vt(e.snapshot);try{if(q(u)&&!H(e.snapshot)){let g=`${u}.corrupt-${process.pid}-${Date.now()}`;U(u,g),W(g,{recursive:!0,force:!0})}U(a,u)}catch(g){let h=H(e.snapshot);if(h)return qn(e.snapshot,h);throw g}e.onPublicationStage?.("after-generation-renamed"),o.push($(i)),e.onPublicationStage?.("after-generations-directory-synced");let b=re(...o);return{kind:"published",manifest:l,achievedDurability:b==="synced"?"directory-durable":"file-flushed",directorySync:b}}finally{W(a,{recursive:!0,force:!0})}}function qn(e,t){let r=$(f(e.repositoryCacheDir,"generations"));return{kind:"existing",manifest:t,achievedDurability:r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function Qd(e){let t=Vt(e.snapshot);Q(e.targetCacheDir,{recursive:!0});let r=te(f(e.targetCacheDir,"cache-lifecycle.lock"),{waitMs:e.lockWaitMs??3e4});if(!r)throw new Error("timed out waiting for another cache hydration");let n,i,o=!1;try{n=Un(f(e.targetCacheDir,".shared-hydrate-")),ps(e.manifest,e.snapshot);for(let c of e.manifest.artifacts){let d=G(t,c.path),l=G(n,c.path);if(be(d,l),Ue(l).size!==c.size||we(l,{inputKind:"hydrated shared-generation artifact",maxBytes:R})!==c.sha256)throw new Error(`shared artifact is corrupt: ${c.path}`)}let a=Ut(e.targetProjectRoot);if(a!==e.manifest.scipProjectRoot)for(let c of e.manifest.artifacts)c.path.endsWith(".scip")&&en(G(n,c.path),e.manifest.scipProjectRoot,a);if(!ti(n,e.targetProjectRoot,e.snapshot.fingerprint,!1))throw new Error("staged shared generation failed completeness or integrity validation");i=ls(e.targetCacheDir,n),o=!0,us(n,e.targetCacheDir,i),On({tempOutputScip:f(n,"index.scip"),tempOutputDb:f(n,"index.db"),tempMetaPath:f(n,"meta.json"),outputScip:f(e.targetCacheDir,"index.scip"),outputDb:f(e.targetCacheDir,"index.db"),metaPath:f(e.targetCacheDir,"meta.json"),now:e.now});let s=qe(f(e.targetCacheDir,"index.db"),f(e.targetCacheDir,"meta.json"));if(s.state==="invalid"||s.state==="drifted")throw new Error(`hydrated SQLite generation failed validation: ${s.reason}`);e.persistLease!==!1&&os(e.snapshot,e.targetCacheDir,e.action??"attached",e.now)}catch(a){throw o&&i&&fs(e.targetCacheDir,i),a}finally{n&&W(n,{recursive:!0,force:!0}),r.release()}}async function Zd(e,t={}){let r=t.timeoutMs??3e4,n=t.pollMs??100,i=t.now??ve,o=i()+r,a=f(e.repositoryCacheDir,"locks"),s=f(a,`${e.generationId}.lock`),c=d=>{if(!d||typeof d!="object"||Array.isArray(d))return null;let l=d.pid;return typeof l=="number"&&Number.isSafeInteger(l)&&l>0?{pid:l}:null};for(;i()<=o;){if(H(e))return{kind:"generation-ready"};let d=Re(s,{kind:"shared-generation-build",detail:{generationId:e.generationId},parseLegacy:c});if(d.kind==="acquired")return{kind:"owner",release:()=>d.lock.release()};let l=o-i();if(l<=0)break;await es(Math.min(n,l))}return H(e)?{kind:"generation-ready"}:{kind:"timeout"}}function os(e,t,r,n=void 0){let i={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,activeGenerationId:e.generationId,lastAction:r,lastSeenAt:(n??(()=>new Date))().toISOString()},o={...i,ownershipChecksum:Jt(i)};return Zn(e.repositoryCacheDir,o,!0),o}function el(e,t,r=void 0){let n={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,lastAction:"overlay",lastReason:`private cache forked from shared baseline ${e.generationId}`,lastSeenAt:(r??(()=>new Date))().toISOString()},i={...n,ownershipChecksum:Jt(n)};return Zn(e.repositoryCacheDir,i,!0),i}function Jt(e){return ri(JSON.stringify({version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:V(e.projectRoot),localCacheDir:V(e.localCacheDir)}))}function Xn(e){let t=JSON.parse(e);if(t.version!==Wt||t.artifactCatalogVersion!==he||typeof t.generationId!="string"||!/^[a-f0-9]{64}$/.test(t.generationId)||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.treeOid!="string"||!t.treeOid||typeof t.producerIdentity!="string"||t.producerIdentity!==Ve||typeof t.sourceProjectRoot!="string"||typeof t.scipProjectRoot!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!t.fingerprint||!Array.isArray(t.artifacts))throw new Error("invalid shared generation manifest");let r=new Set;for(let n of t.artifacts){if(!n||typeof n.path!="string"||typeof n.size!="number"||n.size<0||typeof n.sha256!="string"||!/^[a-f0-9]{64}$/.test(n.sha256))throw new Error("invalid shared generation artifact");if(Je(n.path),r.has(n.path))throw new Error(`duplicate shared generation artifact: ${n.path}`);r.add(n.path)}for(let n of["index.db","index.scip","meta.json"])if(!r.has(n))throw new Error(`shared generation is missing ${n}`);return t}function be(e,t,r=384){return Te(e,t,{mode:r})}function as(e,t,r){Q(e,{recursive:!0}),C(f(e,Kn),{version:1,repositoryId:t,worktreeId:r},{spacing:2,trailingNewline:!0})}function zn(e){try{let t=ze(e),r=Vn("sha256");for(let n of t.files){let i=G(e,n),o=Ue(i).size;r.update(n).update("\0").update(String(o)).update("\0"),er(i,{inputKind:"source-generation artifact",maxBytes:R},a=>r.update(a)),r.update("\0")}return r.digest("hex")}catch{return null}}function Qn(e){try{let t=Zt(P(f(e,"meta.json"),{inputKind:"reindex metadata",maxBytes:T}));return(t.kind==="legacy"||t.kind==="supported")&&t.capabilities.publishableGeneration?t.metadata:void 0}catch{return}}function ss(e){return Qn(e)?.scipCompanion!=="deferred"}function cs(e,t){let r=at(e.languages,e);return JSON.stringify(r)===JSON.stringify(t)}function Jn(e,t){let r=new Map(e.files.map(o=>[o.path,`${o.size}\0${o.hash}`])),n=new Map(t.files.map(o=>[o.path,`${o.size}\0${o.hash}`])),i=0;for(let[o,a]of r)n.get(o)!==a&&(i+=1);for(let o of n.keys())r.has(o)||(i+=1);return i}function Vt(e){return f(e.repositoryCacheDir,"generations",e.generationId)}function ds(e){let t=JSON.parse(P(f(e,Kn),{inputKind:"worktree cache pointer",maxBytes:T}));return t.version!==1||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.worktreeId!="string"||!/^[a-f0-9]{24}$/.test(t.worktreeId)?null:{version:t.version,repositoryId:t.repositoryId,worktreeId:t.worktreeId}}function Zn(e,t,r){let n=ir(e,{waitMs:5e3});if(!n)throw new Error("repository cache cleanup is busy");try{if(r){let o=t.activeGenerationId??t.baseGenerationId;if(!o||!q(f(e,"generations",o)))throw new Error("shared generation disappeared before its lease was attached")}let i=f(e,"worktrees");Q(i,{recursive:!0}),C(f(i,`${t.worktreeId}.json`),t,{spacing:2,trailingNewline:!0}),as(t.localCacheDir,t.repositoryId,t.worktreeId)}finally{n.release()}}function ls(e,t){let r=f(t,".rollback"),n=new Map,i=new Map;Q(r,{recursive:!0});for(let s of["index.scip","index.db","meta.json"]){let c=f(e,s),d=q(c);n.set(s,d),d&&be(c,f(r,"stable",s))}for(let s of zt){let c=f(e,s),d=q(c);if(d){let l=$t(c);if(!l.isDirectory()||l.isSymbolicLink())throw new Error(`managed artifact path is not a directory: ${s}`)}i.set(s,d)}let o=f(e,Ae),a=q(o);return a&&ei(o,f(r,"sqlite-generations")),{root:r,stableFiles:n,managedDirectories:i,generationStoreExisted:a}}function us(e,t,r){for(let n of zt){let i=f(t,n);if(r.managedDirectories.get(n)){let a=f(r.root,"managed",n);Q(jt(a),{recursive:!0}),U(i,a)}let o=f(e,n);q(o)&&U(o,i)}}function fs(e,t){for(let i of zt){let o=f(e,i),a=f(t.root,"managed",i);t.managedDirectories.get(i)?q(a)&&(W(o,{recursive:!0,force:!0}),U(a,o)):W(o,{recursive:!0,force:!0})}for(let[i,o]of t.stableFiles){let a=f(e,i);if(!o){W(a,{force:!0});continue}let s=`${a}.shared-restore-${Za()}`;be(f(t.root,"stable",i),s),W(a,{force:!0}),U(s,a)}let r=f(e,Ae);W(r,{recursive:!0,force:!0});let n=f(t.root,"sqlite-generations");t.generationStoreExisted&&q(n)&&U(n,r)}function ei(e,t){Q(t,{recursive:!0});for(let r of Hn(e,{withFileTypes:!0})){let n=f(e,r.name),i=f(t,r.name);if(r.isSymbolicLink())throw new Error(`managed cache backup cannot contain a symlink: ${n}`);r.isDirectory()?ei(n,i):r.isFile()&&be(n,i)}}function ps(e,t){if(e.generationId!==t.generationId||e.repositoryId!==t.repositoryId||e.treeOid!==t.treeOid||e.producerIdentity!==t.producerIdentity||!Ie(e.fingerprint,t.fingerprint))throw new Error("shared generation manifest does not match the requested snapshot")}function ti(e,t,r,n=!0,i=!0){try{let o=Qn(e);if(!o||o.scipCompanion==="deferred"||!Ie(Kt(o.fingerprint),r)||JSON.stringify([...o.indexedLanguages??[]].sort())!==JSON.stringify([...r.languages].sort()))return Se("source validation rejected metadata"),!1;let a=ze(e),s=qe(f(e,"index.db"),f(e,"meta.json"));if(n?s.state!=="current":s.state==="invalid"||s.state==="drifted")return Se(`source validation rejected SQLite generation state ${s.state}`),!1;let c=new ts(f(e,"index.db"),{readonly:!0,fileMustExist:!0});try{if(i){if(c.pragma("quick_check(1)",{simple:!0})!=="ok")return!1}else c.pragma("schema_version",{simple:!0})}finally{c.close()}let d=Ut(t),p=(i?a.files.filter(u=>u.endsWith(".scip")):["index.scip"]).every(u=>{let b=de(v(G(e,u),{inputKind:"shared SCIP validation artifact",maxBytes:R}));return b!==d&&Se(`source validation rejected SCIP root for ${u}: ${String(b)}`),b===d});return p||Se("source validation rejected SCIP project roots"),p}catch(o){return Se(`source validation failed: ${o instanceof Error?o.message:String(o)}`),!1}}function Se(e){process.env.SCIP_QUERY_DEBUG&&console.error(`shared-cache: ${e}`)}function Ut(e){try{return jn(Yn(e)).href}catch{return jn(V(e)).href}}function gs(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===3&&Array.isArray(t.languages)&&typeof t.pnpmWorkspaces=="boolean"&&(t.typescriptProjectMode==="single"||t.typescriptProjectMode==="workspace")&&Array.isArray(t.typescriptProjects)&&Array.isArray(t.files)&&t.files.every(r=>r!==null&&typeof r=="object"&&typeof r.path=="string"&&typeof r.size=="number"&&typeof r.hash=="string"&&(r.semanticHash===void 0||typeof r.semanticHash=="string"))}function ri(e){return Vn("sha256").update(e).digest("hex")}export{bs as a,se as b,Is as c,E as d,_s as e,lt as f,Ai as g,Di as h,Ms as i,ki as j,Fs as k,Gi as l,Ns as m,_r as n,Me as o,nn as p,Vs as q,D as r,ce as s,_e as t,tc as u,Zr as v,lc as w,uc as x,fc as y,Jo as z,Tc as A,Pc as B,Ac as C,Oc as D,Uc as E,Hc as F,nd as G,id as H,od as I,On as J,Ba as K,hd as L,qe as M,ns as N,Hd as O,Yd as P,H as Q,Kd as R,Xd as S,Qd as T,Zd as U,os as V,el as W};
12
+ //# sourceMappingURL=chunk-ZHG4WAHR.js.map
@@ -1,4 +1,4 @@
1
- import{b as l,e as m}from"./chunk-EELPBR7E.js";import{c as r}from"./chunk-DRENNWRG.js";function d(s,e){let t=l(s,e);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:r(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(n=>({shortName:n.shortName,relativePath:n.relativePath,startLine:n.startLine})),totalMatches:t.total}:{matched:!1,suggestions:m(s,e,5)}}function g(s){let e=s.entries[0];return s.requested===1&&e?.status==="matched"&&e.kind==="source"&&(!e.rangeCoverage||e.rangeCoverage.referencedDefinitions===0)&&e.results.length===1?e.results[0]:null}function u(s,e,t){if(!t)return d(s,e);let n={file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:o(t.startLine),endLine:o(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
1
+ import{b as l,e as m}from"./chunk-2USA3S3P.js";import{c as r}from"./chunk-BL6DCHQP.js";function d(s,e){let t=l(s,e);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:r(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(n=>({shortName:n.shortName,relativePath:n.relativePath,startLine:n.startLine})),totalMatches:t.total}:{matched:!1,suggestions:m(s,e,5)}}function g(s){let e=s.entries[0];return s.requested===1&&e?.status==="matched"&&e.kind==="source"&&(!e.rangeCoverage||e.rangeCoverage.referencedDefinitions===0)&&e.results.length===1?e.results[0]:null}function u(s,e,t){if(!t)return d(s,e);let n={file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:o(t.startLine),endLine:o(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
2
2
  `).map((h,c)=>({line:o(t.startLine+c),text:h}))},a=d(s,e),i=a.totalMatches??0;return!a.matched||!a.resolved||i<=1?n:{...n,resolution:{selected:a.resolved,alternatives:a.otherMatches??[],totalMatches:i}}}function f(s){return{requested:s.requested,matched:s.matched,ambiguous:s.ambiguous,missing:s.missing,entries:s.entries.map(e=>({selector:e.selector,status:e.status,kind:e.kind,totalCandidates:e.totalCandidates,sources:e.results.map(t=>({file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:o(t.startLine),endLine:o(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
3
3
  `).map((n,a)=>({line:o(t.startLine+a),text:n}))})),definitions:e.definitions,...e.fileCoverage?{fileCoverage:e.fileCoverage}:{},...e.rangeCoverage?{rangeCoverage:e.rangeCoverage}:{},candidates:e.candidates,omittedCandidates:e.omittedCandidates,suggestions:e.suggestions,...e.reason?{reason:e.reason}:{}})),literalValues:s.bindingClosure.inline}}function v(s,e,t){let n=g(t);return n?u(s,e[0],n):f(t)}function o(s){return s+1}export{d as a,g as b,u as c,f as d,v as e};
4
- //# sourceMappingURL=chunk-CLG6DWVS.js.map
4
+ //# sourceMappingURL=chunk-ZKB2XUEN.js.map
@@ -0,0 +1,21 @@
1
+ import{a as we,b as x,c as Re,e as Ve,h as g,k as Ie}from"./chunk-ETC674NS.js";import{c as A,d as Z,e as E,f as Fe,h as Pe,i as Ae}from"./chunk-KNLQGXVH.js";import{J as G,c as y}from"./chunk-JZ2A7LDM.js";import{basename as je}from"path";var Jt=A("indexed-document-paths",{clearGroups:["whole-project"]});function W(e,t={}){let n=Gt(t);return[...Jt.get(e,n,()=>{let o=t.scope?"AND relative_path LIKE ?":"",s=t.like?"AND relative_path LIKE ?":"",i=[...t.scope?[`%${t.scope}%`]:[],...t.like?[t.like]:[]],a=e.all(`SELECT relative_path
2
+ FROM documents
3
+ WHERE 1 = 1
4
+ ${e.pathExclusionsFor("documents")}
5
+ ${o}
6
+ ${s}
7
+ ORDER BY relative_path`,...i).map(l=>l.relative_path),c=t.extensions?a.filter(l=>t.extensions.some(f=>l.toLowerCase().endsWith(f.toLowerCase()))):a;return t.includeIgnored===!1?c.filter(l=>!e.isIgnored(l)):c})]}function Gt(e){let t=e.extensions?[...new Set(e.extensions.map(n=>n.toLowerCase()))].sort():null;return JSON.stringify({scope:e.scope??null,like:e.like??null,extensions:t,includeIgnored:e.includeIgnored!==!1})}function fs(e,t,n){let r=Oe(t);if(!r)return[];let o=e.all(`SELECT relative_path
8
+ FROM documents
9
+ WHERE relative_path = ?
10
+ ${e.pathExclusionsFor("documents")}`,r).filter(c=>!e.isIgnored(c.relative_path)).map(c=>({relativePath:c.relative_path,score:Be(c.relative_path,r)}));if(o.length>0)return o;let s=W(e,{includeIgnored:!1}).map(c=>({relativePath:c,score:Be(c,r)})).filter(c=>c.score>0).sort((c,l)=>l.score-c.score||c.relativePath.localeCompare(l.relativePath)),i=s.filter(c=>c.score>=1100);if(i.length>0)return n.allowMultiple?i:[i[0]];if(n.requirePathMatch)return[];let a=s.filter(c=>c.score>=800);return a.length>0?n.allowMultiple?a:[a[0]]:n.allowMultiple?s:s.slice(0,1)}function Be(e,t){let n=Oe(e),r=je(n),o=je(t),s=0;return n===t&&(s+=1200),n.endsWith(`/${t}`)&&(s+=1100),r===o&&(s+=900),n.startsWith(`${t}/`)&&(s+=850),n.includes(t)&&(s+=250),s}function Oe(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}import{extname as De}from"path";var Zt={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb",".clj":"clojure",".cljs":"clojure",".cljc":"clojure"};function U(e){return Zt[De(e).toLowerCase()]??null}function pe(e){return De(e).toLowerCase()===".vue"}import{createRequire as tn}from"module";import{setFlagsFromString as $e}from"v8";import{runInNewContext as Kt}from"vm";var w;function Yt(){if(w!==void 0)return w;let e=globalThis.gc;if(typeof e=="function")return w=e,w;try{$e("--expose_gc");let t=Kt("gc");$e("--no-expose_gc"),w=typeof t=="function"?t:null}catch{w=null}return w}function Qt(){let e=Yt();return e?(e(),!0):!1}var en=512*1024*1024,fe=0;function We(e,t=Qt){!Number.isFinite(e)||e<=0||(fe+=e,!(fe<en)&&(fe=0,t()))}var d=tn(import.meta.url),K=null,Ue=!1;function nn(){if(Ue)return null;if(K)return K;try{return K=d("tree-sitter"),K}catch{return Ue=!0,null}}var Me=new Map,Y=new Set;function rn(e){if(Y.has(e))return null;let t=Me.get(e);if(t)return t;let n;try{switch(e){case"rust":n=d("tree-sitter-rust");break;case"typescript":n=d("tree-sitter-typescript").typescript;break;case"tsx":n=d("tree-sitter-typescript").tsx;break;case"javascript":n=d("tree-sitter-javascript");break;case"python":n=d("tree-sitter-python");break;case"java":n=d("tree-sitter-java");break;case"kotlin":n=d("tree-sitter-kotlin");break;case"scala":n=d("tree-sitter-scala");break;case"ruby":n=d("tree-sitter-ruby");break;case"c":n=d("tree-sitter-c");break;case"cpp":n=d("tree-sitter-cpp");break;case"csharp":n=d("tree-sitter-c-sharp");break;case"php":n=d("tree-sitter-php").php;break;case"vb":{let r=d("tree-sitter-vb-dotnet");n=r.language??r;break}case"clojure":return Y.add(e),null}}catch{return Y.add(e),null}return Me.set(e,n),n}var ze=new Map;function on(e){let t=ze.get(e);if(t)return t;let n=rn(e);if(!n)return null;let r=nn();if(!r)return null;let o=new r;try{o.setLanguage(n)}catch{return Y.add(e),null}return ze.set(e,o),o}function sn(e,t){return e.parse(r=>r>=t.length?null:t.slice(r,Math.min(t.length,r+16384)))}var an=24;function R(e,t){let n=on(e);if(!n)return null;try{let r=sn(n,t);return We(t.length*an),r}catch{return null}}import{createRequire as cn}from"module";import{posix as me}from"path";var ln=E("vue-sfc-units"),un=cn(import.meta.url),pn;function fn(){return pn??=un("@vue/compiler-sfc")}function He(...e){return fn().parse(...e)}function I(e,t){let n=Je(t),r=g(e,n);return ln.get(e,n,r,()=>de(e,n,r))}function Je(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function mn(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function V(e){return!e||e.body.length===0?0:e.body.split(`
11
+ `).length}function de(e,t,n){let r={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!n)return r;let o;try{o=He(n,{filename:t})}catch(i){return r.errors.push(Xe(i)),r}r.errors.push(...o.errors.map(Xe));let{descriptor:s}=o;return s.template&&(r.template=Q(e,t,"template",s.template)),s.script&&r.scripts.push(qe(e,t,s.script,!1)),s.scriptSetup&&r.scripts.push(qe(e,t,s.scriptSetup,!0)),r.styles=s.styles.map(i=>Q(e,t,"style",i)),r.customBlocks=s.customBlocks.map(i=>Q(e,t,"custom",i)),r.errors.push(...[r.template,...r.scripts,...r.styles,...r.customBlocks].flatMap(i=>i?.errors??[])),r}function qe(e,t,n,r){let o=Q(e,t,"script",n);return{...o,kind:"script",setup:r,astLanguage:mn(o.lang)}}function Q(e,t,n,r){let o=gn(r.attrs),s=typeof o.lang=="string"?o.lang:null,i=typeof o.src=="string"?o.src:typeof r.src=="string"?r.src:void 0;if(i){let c=dn(t,i);if(!c)return{kind:n,ownerPath:t,sourcePath:t,external:!0,src:i,attrs:o,lang:s,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${n} block source: ${i}`]};let l=g(e,c),f=l?Math.max(0,l.split(`
12
+ `).length-1):0;return{kind:n,ownerPath:t,sourcePath:c,external:!0,src:i,attrs:o,lang:s,body:l,startLine:0,endLine:f,errors:l?[]:[`Vue ${n} block source not found: ${c}`]}}let a=Math.max(0,r.loc.start.line-1);return{kind:n,ownerPath:t,sourcePath:t,external:!1,attrs:o,lang:s,body:r.content,startLine:a,endLine:Math.max(a,r.loc.end.line-1),errors:[]}}function dn(e,t){let n=t.split(/[?#]/,1)[0];if(!n||n.startsWith("/")||n.includes("://"))return null;let r=Je(me.normalize(me.join(me.dirname(e),n)));return r===".."||r.startsWith("../")?null:r}function gn(e){return{...e}}function Xe(e){return e instanceof Error?e.message:String(e)}function ge(e,t,n){let o=de(e,t,n).scripts.filter(i=>i.astLanguage&&i.body.length>0),s=o[0]?.astLanguage;return s?{body:o.map(i=>`${`
13
+ `.repeat(i.startLine)}${i.body}`).join(`
14
+ `),startLine:0,language:s}:null}var ee=Fe("ast-trees",{clearGroups:["whole-project","source-file"]});function Ge(e,t){if(pe(t))return hn(e,t);let n=U(t);if(!n)return null;let r=g(e,t);return r?ee.get(e,t,r,()=>R(n,r)):null}function Vs(e,t,n){if(pe(t))return ee.get(e,t,n,()=>{let o=ge(e,t,n);return o?R(o.language,`
15
+ `.repeat(o.startLine)+o.body):null});let r=U(t);return r?ee.get(e,t,n,()=>R(r,n)):null}function hn(e,t){let n=g(e,t);return n?ee.get(e,t,n,()=>{let r=ge(e,t,n);if(!r)return null;let o=`
16
+ `.repeat(r.startLine)+r.body;return R(r.language,o)}):null}function M(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var nt=["function_declaration","generator_function_declaration","method_definition","method_signature","function_signature"],Sn=new Set(nt),yn=[...nt,"variable_declarator","public_field_definition"],xn=["function_item","function_signature_item"],Nn=["function_definition"],Cn=[],Ze=new Set(["arrow_function","function_expression","generator_function"]);function Os(e){return e==="rust"?xn:e==="python"?Nn:e==="typescript"||e==="tsx"||e==="javascript"?yn:Cn}function rt(e,t){let n=bn(e,t);if(n)return{name:n.name,startLine:n.definitionNode.startPosition.row,endLine:n.definitionNode.endPosition.row,paramCount:et(n.functionNode),params:Ke(n.functionNode),paramsEndLine:Ye(n.functionNode),isLiteralPassthrough:tt(n.functionNode,t),branches:0};if(!vn(e.type,t))return null;let r=e.childForFieldName("name")??e.namedChildren.find(o=>o.type==="identifier"||o.type==="property_identifier");return r?{name:r.text,startLine:e.startPosition.row,endLine:e.endPosition.row,paramCount:et(e),params:Ke(e),paramsEndLine:Ye(e),isLiteralPassthrough:tt(e,t),branches:0}:null}function ot(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function Ke(e){let t=ot(e);if(!t)return[];let n=[];for(let r of t.namedChildren){if(M(r))continue;if(r.type==="identifier"){n.push({name:r.text,simple:!0});continue}let o=r.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(r.text),s=r.childForFieldName("pattern");if(!o&&s&&s.type==="identifier"){n.push({name:s.text,simple:!0});continue}let i=r.namedChildren.find(a=>a.type==="identifier");n.push({name:s?.type==="identifier"?s.text:i?.text??"",simple:!1})}return n}function Ye(e){let t=ot(e);return t?t.endPosition.row:e.startPosition.row}function vn(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?Sn.has(e):!1}function bn(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(!n||!r)return null;let o=Qe(r);return o?{name:n.text,definitionNode:e,functionNode:o}:null}if(e.type==="public_field_definition"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(!n||!r)return null;let o=Qe(r);return o?{name:n.text,definitionNode:e,functionNode:o}:null}return null}function Qe(e){if(Ze.has(e.type))return e;if(e.type!=="call_expression"||(e.childForFieldName("function")??e.namedChild(0))?.type!=="call_expression")return null;let r=((e.childForFieldName("arguments")??e.namedChildren.find(o=>o.type==="arguments"))?.namedChildren??[]).filter(o=>Ze.has(o.type));return r.length===1?r[0]:null}function et(e){let t=e.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters");if(!t)return 0;let n=0;for(let r of t.namedChildren)M(r)||(n+=1);return n}function tt(e,t){let n=e.namedChildren.find(u=>u.type==="block"||u.type==="statement_block");if(!n)return!1;let r=n.namedChildren.filter(u=>!M(u));if(r.length!==1)return!1;let o=r[0],s=null;if(o.type==="return_statement"||o.type==="expression_statement"?s=o.namedChild(0)??null:t==="rust"&&(o.type==="call_expression"||o.type==="macro_invocation")&&(s=o),!s)return!1;let i=t==="python"?"call":"call_expression";if(s.type!==i)return!1;let a=s.childForFieldName("function")??s.namedChild(0);if(a&&(a.type===i||a.type==="call_expression"))return!1;let c=s.namedChildren.find(u=>u.type==="arguments"||u.type==="argument_list");if(!c)return!1;let l=c.namedChildren.filter(u=>!M(u)),f=e.namedChildren.find(u=>u.type==="parameters"||u.type==="formal_parameters");if(!f)return!1;let C=[];for(let u of f.namedChildren){if(u.type==="identifier"){C.push(u.text);continue}let v=u.namedChildren.find(D=>D.type==="identifier");v&&C.push(v.text)}if(l.length!==C.length)return!1;for(let u=0;u<C.length;u+=1){let v=l[u];if(v.type!=="identifier"||v.text!==C[u])return!1}return!0}function Ds(e,t){return e.filter(n=>n.startLine<=t&&n.endLine>=t).sort((n,r)=>n.endLine-n.startLine-(r.endLine-r.startLine)||n.startLine-r.startLine)[0]??null}import{readdirSync as Tn}from"fs";import{execFileSync as _n}from"child_process";import{extname as te,join as kn}from"path";var Ln=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],Xs=[".vue"],st=[".tsx",".jsx"],it=[".vue"],En=[...st,...it],Fn=new Set(st),Pn=new Set(it),at=new Set(Ln.map(e=>e.toLowerCase())),An=[...at].sort().join(","),ct=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function z(e,t={}){let n=t.includeIndexed??!0,r=t.includeAuxiliary??!0,o=t.extensions?.map(c=>c.toLowerCase()),s=o?new Set(o):at,i=o?[...s].sort().join(","):An,a=`${n?"1":"0"}|${r?"1":"0"}|${i}`;return wn.get(e,a,()=>{let c=new Set;if(n)for(let l of W(e,{includeIgnored:!1}))s.has(te(l).toLowerCase())&&c.add(l);if(r)for(let l of Rn(e.config.projectRoot,s))e.isIgnored(l)||n&&c.has(l)||c.add(l);return[...c].sort()})}function Hs(e,t={}){let n=!1,r=!1;for(let o of z(e,{extensions:En})){if(t.scope&&!o.includes(t.scope))continue;let s=te(o).toLowerCase();if(n||=Fn.has(s),r||=Pn.has(s),n&&r)break}return{react:n,vue:r}}var wn=A("source-files",{clearGroups:[]});function Rn(e,t){return Vn(e,t)??jn(e,t)}function Vn(e,t){try{let n=_n("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,killSignal:"SIGKILL",stdio:["ignore","pipe","ignore"]}),r=new Set;for(let o of n.split(`
17
+ `)){let s=o.trim();s&&(In(s)||t.has(te(s).toLowerCase())&&r.add(s))}return r}catch{return null}}function In(e){return e.split("/").some(t=>ct.has(t))}function jn(e,t){let n=new Set,r=o=>{let s=o?kn(e,o):e,i;try{i=Tn(s,{withFileTypes:!0})}catch{return}for(let a of i)if(!ct.has(a.name)){if(a.isDirectory()){r(o?`${o}/${a.name}`:a.name);continue}t.has(te(a.name).toLowerCase())&&n.add(o?`${o}/${a.name}`:a.name)}};return r(""),n}import{extname as zn}from"path";function re(e,t){let n=Dn(e,t);if(!n)return null;let r=ne(n);if(!r)return null;let o=Un(n);return{kind:Bn(e),calleeLeaf:r,calleeQualifier:o?On(n):void 0,calleeText:n.text,memberAccess:o,line:e.startPosition.row}}function Bn(e){return ut.has(e.type)?"jsx-render":e.type==="new_expression"?"new":"call"}var ut=new Set(["jsx_opening_element","jsx_self_closing_element"]);function On(e){return(e.childForFieldName("object")??e.childForFieldName("value")??e.namedChild(0)??void 0)?.text||void 0}function Dn(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return lt(e.childForFieldName("function")??e.namedChild(0));if(e.type==="new_expression")return lt(e.childForFieldName("constructor")??e.namedChild(0));if(ut.has(e.type))return Wn(e)}return null}var $n=new Set(["await_expression","parenthesized_expression","non_null_expression","as_expression","satisfies_expression"]);function lt(e){let t=e;for(;t&&$n.has(t.type);){let n=t.namedChild(0);if(!n)return t;t=n}return t}function Wn(e){let t=e.childForFieldName("name")??e.namedChild(0);return t&&(t.type==="member_expression"||t.type==="nested_identifier"||(t.type==="identifier"||t.type==="jsx_identifier")&&/^[A-Z]/.test(t.text))?t:null}function Un(e){switch(e.type){case"field_expression":case"member_expression":case"nested_identifier":case"attribute":return!0;default:return!1}}function ne(e){switch(e.type){case"identifier":case"type_identifier":case"field_identifier":case"property_identifier":case"private_property_identifier":case"shorthand_property_identifier":return e.text.replace(/^#/u,"");case"field_expression":case"member_expression":case"nested_identifier":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?ne(t):null}case"jsx_identifier":return e.text;case"generic_function":{let t=e.childForFieldName("function")??e.namedChild(0);return t?ne(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?ne(t):null}case"super":case"self":case"this":return null;default:return null}}var Mn=new Set(["children","className","data","e","err","error","ev","event","false","id","idx","index","item","key","null","props","res","result","state","style","true","undefined","val","value"]);function oe(e){return e.length<=2||Mn.has(e)}var qn=[".tsx",".jsx"],pt=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),Xn=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),Hn=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),Jn=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),Gn=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),Zn=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),Kn=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]),Yn=E("react-component-behavior-profiles"),ft=Re({kind:"react-component-behavior-profiles",invalidation:Ve("react-component-behavior-profiles"),serialize:nr,deserialize:rr});function ht(e,t={}){let n=z(e,{extensions:qn}).filter(o=>!t.scope||o.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(o=>Se(e,o)).filter(o=>(t.minJsxTokens===void 0||o.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||o.behaviorTokens.size>=t.minBehaviorTokens))}function Se(e,t){let n=t.replace(/\\/g,"/"),r=g(e,n);return Yn.get(e,n,r,()=>Qn(e,n,r)).map(tr)}function Qn(e,t,n){let r=Ae(e,t,n),o=ft.read(e,t,r);if(o)return o;let s=er(e,t);return ft.write(e,t,r,s),s}function er(e,t){let n=sr(t);if(!n)return[];let r=Ge(e,t);if(!r)return[];let o=Ie(e,t).length;return ir(r.rootNode,n).filter(i=>i.kind==="hook"||ye(i.bodyNode)).map(i=>{let a=mr(i.bodyNode),c=yr(i.bodyNode,n);return{file:t,name:i.name,kind:i.kind,startLine:i.node.startPosition.row,endLine:i.node.endPosition.row,loc:Math.max(1,i.node.endPosition.row-i.node.startPosition.row+1),fileLines:o,jsxTokens:a.tokens,behaviorTokens:c.tokens,componentNames:T(a.componentNames),nativeTags:T(a.nativeTags),propNames:T(a.propNames),eventNames:T(a.eventNames),hookNames:T(c.hookNames),requestNames:T(c.requestNames),stateNames:T(c.stateNames),effectNames:T(c.effectNames),handlerNames:T(c.handlerNames)}})}function tr(e){return{...e,jsxTokens:new Set(e.jsxTokens),behaviorTokens:new Set(e.behaviorTokens),componentNames:[...e.componentNames],nativeTags:[...e.nativeTags],propNames:[...e.propNames],eventNames:[...e.eventNames],hookNames:[...e.hookNames],requestNames:[...e.requestNames],stateNames:[...e.stateNames],effectNames:[...e.effectNames],handlerNames:[...e.handlerNames]}}function nr(e){return JSON.stringify(e.map(t=>({...t,jsxTokens:[...t.jsxTokens],behaviorTokens:[...t.behaviorTokens]})))}function rr(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=[];for(let r of t){let o=or(r);if(!o)return null;n.push(o)}return n}catch{return null}}function or(e){if(!we(e))return null;let{file:t,name:n,kind:r,startLine:o,endLine:s,loc:i,fileLines:a,jsxTokens:c,behaviorTokens:l,componentNames:f,nativeTags:C,propNames:u,eventNames:v,hookNames:D,requestNames:ue,stateNames:m,effectNames:b,handlerNames:$}=e;if(typeof t!="string"||typeof n!="string"||r!=="component"&&r!=="hook"||!se(o)||!se(s)||!se(i)||!se(a))return null;let S={jsxTokens:x(c),behaviorTokens:x(l),componentNames:x(f),nativeTags:x(C),propNames:x(u),eventNames:x(v),hookNames:x(D),requestNames:x(ue),stateNames:x(m),effectNames:x(b),handlerNames:x($)};return Object.values(S).some(Ht=>Ht===null)?null:{file:t,name:n,kind:r,startLine:o,endLine:s,loc:i,fileLines:a,jsxTokens:new Set(S.jsxTokens),behaviorTokens:new Set(S.behaviorTokens),componentNames:S.componentNames,nativeTags:S.nativeTags,propNames:S.propNames,eventNames:S.eventNames,hookNames:S.hookNames,requestNames:S.requestNames,stateNames:S.stateNames,effectNames:S.effectNames,handlerNames:S.handlerNames}}function se(e){return typeof e=="number"&&Number.isFinite(e)}function sr(e){let t=zn(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:U(e)}function ir(e,t){let n=[],r=new Set,o=s=>{let i=ar(s);if(i&&(!pr(s)||i.kind==="component")){let a=`${i.name}:${i.node.startIndex}:${i.node.endIndex}`;r.has(a)||(r.add(a),n.push(i))}for(let a of s.namedChildren)o(a)};return(t==="tsx"||t==="javascript")&&o(e),n}function ar(e){if(e.type==="class_declaration"){let s=he(e);if(!s||!/^[A-Z]/.test(s))return null;let i=cr(e);return!i||!lr(e)&&!ye(i)?null:{name:s,kind:"component",node:e,bodyNode:i}}if(e.type==="function_declaration"){let s=he(e);return!s||!mt(s)?null:{name:s,kind:dt(s),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),r=q(t);if(!r||!n||!mt(r))return null;let o=ur(n);return o?{name:r,kind:dt(r),node:e,bodyNode:o}:null}function cr(e){for(let t of e.namedChildren)if(t.type==="class_body")for(let n of t.namedChildren){if(n.type!=="method_definition")continue;if((n.childForFieldName("name")??n.namedChild(0))?.text==="render")return n}return null}function lr(e){return/\b(?:React\.)?(?:Pure)?Component\b/.test(e.text)}function mt(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function dt(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function ur(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=fr(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(o=>o.type==="arguments")?.namedChildren.find(o=>o.type==="arrow_function"||o.type==="function_expression")??null}function pr(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function he(e){return q(e.childForFieldName("name")??e.namedChild(0))}function fr(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function ye(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(ye)}function mr(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=r=>{r.type==="jsx_opening_element"||r.type==="jsx_self_closing_element"?dr(r,t):r.type==="jsx_element"&&r.text.trimStart().startsWith("<>")?t.tokens.add("jsx:fragment"):r.type==="jsx_expression"?gr(r,t):r.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let o of r.children)n(o)};return n(e),t}function dr(e,t){let n=hr(e),r=!1;if(n){let o=gt(n),s=o==="Fragment"||o==="React.Fragment";r=br(o)&&!s,s?t.tokens.add("jsx:fragment"):r?(t.componentNames.add(o),t.tokens.add(`component:${o}`)):(t.nativeTags.add(o),t.tokens.add(`native:${o}`))}for(let o of e.namedChildren)if(o.type==="jsx_attribute"){let s=Sr(o);if(!s)continue;let i=gt(s);if(i.startsWith("on")&&i.length>2){let a=i.slice(2).replace(/^[A-Z]/,c=>c.toLowerCase());t.eventNames.add(a),t.tokens.add(`event:${a}`)}else Kn.has(i)||(t.propNames.add(i),t.tokens.add(`${r?"prop":"native-prop"}:${i}`))}else o.type==="jsx_spread_attribute"&&t.tokens.add(St(o))}function gr(e,t){let n=e.text;/^\{\s*\.\.\./.test(n)&&t.tokens.add(St(e)),yt(e)&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let r of Tr(n))oe(r)||t.tokens.add(`binding:${r}`)}function St(e){let t=/^\{\s*\.\.\.\s*([^}]+)\s*\}$/.exec(e.text)?.[1],n=e.namedChildren.find(s=>s.type!=="comment"),r=t??n?.text??"",o=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.exec(r.trim())?.[0];return o?`prop:spread:${o}`:"prop:spread"}function yt(e){return e.type==="ternary_expression"||e.type==="conditional_expression"?!0:e.namedChildren.some(yt)}function hr(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function Sr(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function yr(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},r=o=>{if(o.type==="call_expression"){let s=re(o,t);s&&xr(s.calleeLeaf,n)}else if(o.type==="variable_declarator")Cr(o,n);else if(o.type==="function_declaration"){let s=he(o);s&&xt(s,n)}for(let s of o.namedChildren)r(s)};return r(e),n}function xr(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!pt.has(e)&&!Jn.has(e)&&t.tokens.add(`hook:${e}`)),pt.has(e)&&t.tokens.add(`react-hook:${e}`),Xn.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),Hn.has(e)&&t.tokens.add(`state-hook:${e}`),Nr(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function Nr(e){if(Gn.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function Cr(e,t){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&r?.text.includes("useState")){let s=n.namedChildren.find(a=>q(a)),i=q(s);i&&(t.stateNames.add(i),t.tokens.add(`state:${i}`))}let o=q(n);o&&xt(o,t)}function xt(e,t){let n=vr(e);!n||!Zn.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function vr(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function br(e){return/^[A-Z]/.test(e)||e.includes(".")}function gt(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function q(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function Tr(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];t.includes(r)||t.push(r)}return t}function T(e){return[...e].sort()}var _r=new Set(["ref","shallowRef","reactive","computed","watch","watchEffect"]),kr=new Set(["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured"]),Lr=new Set(["axios","fetch","runRequest","useAsyncData","useFetch","useResource"]),Er=new Set(["defineEmits","defineExpose","defineModel","defineOptions","defineProps","withDefaults"]),Fr=new Set(["catch","for","function","if","return","switch","while"]);function ae(e){let t={imports:[],functions:[],calls:[],composables:[],stores:[],reactivity:[],lifecycle:[],requests:[],macros:[],lineCount:0,externalLineCount:0,externalScriptPaths:[],unresolvedScripts:[]};for(let n of e.scripts){t.lineCount+=V(n),n.external&&(t.externalLineCount+=V(n),t.externalScriptPaths.push(n.sourcePath));for(let o of n.errors)t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:o});if(!n.body||!n.astLanguage){n.astLanguage||t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:`Unsupported Vue script language: ${n.lang??"unknown"}`});continue}t.imports.push(...Rr(n));let r=R(n.astLanguage,n.body);r?Ar(n,r.rootNode,t):wr(n,t)}return Pr(t),t.externalScriptPaths=Ct(t.externalScriptPaths),t}function Pr(e){e.composables=j(e,"composable"),e.stores=j(e,"store"),e.reactivity=j(e,"reactivity"),e.lifecycle=j(e,"lifecycle"),e.requests=j(e,"request"),e.macros=j(e,"macro")}function j(e,t){return Ct(e.calls.filter(n=>n.categories.includes(t)).map(n=>n.name))}function Ar(e,t,n){let r=new Set,o=new Set,s=i=>{let a=rt(i,e.astLanguage);if(a){let l=`${a.name}:${a.startLine}:${a.endLine}`;o.has(l)||(o.add(l),n.functions.push({name:a.name,sourcePath:e.sourcePath,startLine:e.startLine+a.startLine,endLine:e.startLine+a.endLine,setup:e.setup}))}let c=re(i,e.astLanguage);if(c){let l=`${c.calleeLeaf}:${c.line}`;r.has(l)||(r.add(l),n.calls.push({name:c.calleeLeaf,sourcePath:e.sourcePath,line:e.startLine+c.line,categories:Nt(c.calleeLeaf),setup:e.setup}))}for(let l of i.children)s(l)};s(t)}function wr(e,t){for(let n of e.body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g)){let r=n[1];!r||Fr.has(r)||t.calls.push({name:r,sourcePath:e.sourcePath,line:e.startLine+ie(e.body,n.index??0),categories:Nt(r),setup:e.setup})}for(let n of e.body.matchAll(/\bfunction\s+([A-Za-z_$][\w$]*)\b/g)){let r=n[1];if(!r)continue;let o=e.startLine+ie(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:o,endLine:o,setup:e.setup})}for(let n of e.body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>)/g)){let r=n[1];if(!r)continue;let o=e.startLine+ie(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:o,endLine:o,setup:e.setup})}}function Rr(e){let t=[];for(let n of e.body.matchAll(/\bimport\s+(?:type\s+)?([^'";]+?)\s+from\s+['"]([^'"]+)['"]/g)){let r=n[1]?.trim(),o=n[2];if(!r||!o)continue;let s=e.startLine+ie(e.body,n.index??0);for(let i of Vr(r))t.push({local:i,source:o,sourcePath:e.sourcePath,line:s,setup:e.setup})}return t}function Vr(e){let t=[],r=e.split(",").map(i=>i.trim()).filter(Boolean)[0];r&&!r.startsWith("{")&&!r.startsWith("*")&&t.push(r);let o=/\{([^}]*)\}/.exec(e)?.[1];if(o)for(let i of o.split(",")){let a=i.trim();if(!a)continue;let c=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(a)?.[1];t.push(c??a.replace(/^type\s+/,"").trim())}let s=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(e)?.[1];return s&&t.push(s),t.filter(i=>/^[A-Za-z_$][\w$]*$/.test(i))}function Nt(e){let t=["call"];return/^use[A-Z0-9_]/.test(e)&&t.push("composable"),/^use[A-Z0-9_].*Store$/.test(e)&&t.push("store"),_r.has(e)&&t.push("reactivity"),kr.has(e)&&t.push("lifecycle"),Lr.has(e)&&t.push("request"),Er.has(e)&&t.push("macro"),t}function ie(e,t){let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function Ct(e){return[...new Set(e)].sort()}import{createRequire as Ir}from"module";function vt(e,t){return e.split(t).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var jr=E("vue-template-facts"),Br=Ir(import.meta.url),Or;function X(){return Or??=Br("@vue/compiler-dom")}var Dr=new Set(["component","keep-alive","slot","suspense","teleport","template","transition","transition-group"]),$r=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),Wr=new Set(["div","span","template"]),Ur=new Set(["as","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","if","import","in","instanceof","let","new","null","of","return","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"]);function ce(e,t){let n=t.replace(/\\/g,"/"),r=g(e,n);return jr.get(e,n,r,()=>Mr(n,I(e,n).template))}function Mr(e,t){let n={relativePath:e,template:t?{startLine:t.startLine,endLine:t.endLine}:null,componentTags:[],nativeTags:[],builtinTags:[],props:[],events:[],directives:[],slots:[],expressionIdentifiers:[],structuralTokens:[]};if(!t)return n;let r;try{r=X().parse(t.body,{comments:!1})}catch{return n}let o=new Set,s=i=>{i.trim()&&o.add(i)};return Tt(r.children,t.startLine,n,s),n.structuralTokens=[...o].sort(),n}function Tt(e,t,n,r){for(let o of e)if(o.type===X().NodeTypes.ELEMENT)zr(o,t,n,r),Tt(o.children,t,n,r);else if(o.type===X().NodeTypes.INTERPOLATION){r("interpolation");let s=xe(o.content);s&&_t(s,t,o.loc.start.line,n,r)}}function zr(e,t,n,r){let o=Kr(e.tag),s={tag:e.tag,normalized:o,kind:Zr(e),startLine:B(t,e.loc.start.line),endLine:B(t,e.loc.end.line)};s.kind==="component"?(n.componentTags.push(s),r(`component:${o}`)):s.kind==="builtin"?(n.builtinTags.push(s),r(`builtin:${o}`)):(n.nativeTags.push(s),Wr.has(e.tag)||r(`native:${e.tag}`));for(let i of e.props)qr(i,t,n,r)}function qr(e,t,n,r){if(e.type===X().NodeTypes.ATTRIBUTE){let a=e.value?.content??null,c=bt("prop",e.name,a,t,e.loc.start.line,e.loc.end.line);n.props.push(c),r(`prop:${e.name}`);return}let o=Hr(e),s=xe(e.exp),i=bt(Xr(e.name),o,s,t,e.loc.start.line,e.loc.end.line);switch(i.kind){case"prop":n.props.push(i),r(`prop:${o}`);break;case"event":n.events.push(i),r(`event:${o}`);break;case"slot":n.slots.push(i),r(`slot:${o}`);break;case"directive":n.directives.push(i),r(`directive:${o}`);break}s&&_t(s,t,e.loc.start.line,n,r)}function bt(e,t,n,r,o,s){return{kind:e,name:t,value:n,startLine:B(r,o),endLine:B(r,s)}}function Xr(e){switch(e){case"bind":case"model":return"prop";case"on":return"event";case"slot":return"slot";default:return"directive"}}function Hr(e){let t=xe(e.arg);return t||e.name}function xe(e){if(!e)return null;let t=("content"in e&&typeof e.content=="string"?e.content:e.loc.source).trim();return t||null}function _t(e,t,n,r,o){for(let s of Jr(e)){let i={name:s,startLine:B(t,n),endLine:B(t,n)};r.expressionIdentifiers.push(i),o(`id:${s}`)}}function Jr(e){let t=new Set,n=Gr(e),r=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,o;for(;o=r.exec(n);){let s=o[0];Ur.has(s)||oe(s)||/^[A-Z_]+$/.test(s)||t.add(s)}return[...t].sort()}function Gr(e){return e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/.*$/gm," ").replace(/`(?:\\[\s\S]|\$\{([^}]*)\}|[^`\\])*`/g,(t,n)=>n??" ").replace(/'(?:\\[\s\S]|[^'\\])*'/g," ").replace(/"(?:\\[\s\S]|[^"\\])*"/g," ")}function Zr(e){let t=e.tag;return e.tagType===X().ElementTypes.COMPONENT?"component":Dr.has(t)?"builtin":$r.has(t)?"native":/^[A-Z]/.test(t)||t.includes("-")?"component":"native"}function Kr(e){return vt(e,/[-_:]/)}function B(e,t){return e+Math.max(0,t-1)}import{createRequire as co}from"module";import{existsSync as P}from"fs";import{basename as Lt,dirname as h,extname as _,join as N,relative as F,resolve as p,sep as lo}from"path";import{existsSync as Ce,readdirSync as Yr,statSync as Qr}from"fs";import{join as O,relative as eo}from"path";function kt(e){let t=to(e)??so(e);if(!t||t.length===0)return[];let n=[],r=new Set;for(let o of t)for(let s of io(e,o)){if(r.has(s))continue;r.add(s);let i=ao(e,s);i&&n.push(i)}return n}function to(e){let t=O(e,"pnpm-workspace.yaml");if(!Ce(t))return null;try{return no(G(t,"pnpm workspace manifest"))}catch{return null}}function no(e){let t=[],n=!1;for(let r of e.split(/\r?\n/)){let o=ro(r);if(!n){/^packages\s*:\s*$/.test(o.trim())&&(n=!0);continue}let s=/^\s+-\s*(.+)$/.exec(o);if(s){let i=oo(s[1].trim());i&&t.push(i);continue}if(o.trim()!=="")break}return t}function ro(e){let t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function oo(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function so(e){let t=O(e,"package.json");if(!Ce(t))return null;try{let n=JSON.parse(G(t,"workspace package manifest"));return n.workspaces?Array.isArray(n.workspaces)?n.workspaces:n.workspaces.packages??[]:null}catch{return null}}function io(e,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let i=O(e,t);return Ne(i)?[i]:[]}let n=t.indexOf("*"),r=t.slice(0,n).replace(/\/$/,""),o=t.slice(n+1).replace(/^\//,""),s=O(e,r||".");return Ne(s)?Yr(s).map(i=>O(s,i,o)).filter(Ne):[]}function Ne(e){try{return Qr(e).isDirectory()}catch{return!1}}function ao(e,t){let n=O(t,"package.json");if(!Ce(n))return null;try{let r=JSON.parse(G(n,"workspace package manifest"));return typeof r.name!="string"||r.name.length===0?null:{name:r.name,relativeDir:eo(e,t).replace(/\\/g,"/"),exports:r.exports}}catch{return null}}var uo=Z("indexed-paths",{clearGroups:[]}),po=Z("indexed-path-digest",{clearGroups:[]}),fo=A("tsconfig-alias-config",{clearGroups:["whole-project"]}),mo=A("tsconfig-alias-config-for-dir",{clearGroups:["whole-project"]}),go=co(import.meta.url),H;function ho(){if(H!==void 0)return H;try{H=go("typescript")}catch{H=null}return H}var So=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"],yo=Z("workspace-packages",{clearGroups:["whole-project"]}),J=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],Et=[".py",".pyi"],Ft=[".java",".scala",".kt",".kts"],Pt=[".rs"],At=[".rb"],wt=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],Rt=[".cs",".vb"],Vt=[".dart"],It=[".php"],le=[".clj",".cljs",".cljc"],xo=new Set(J),ve=new Set(Et),jt=new Set(Ft),be=new Set(Pt),Te=new Set(At),Bt=new Set(wt),Ot=new Set(Rt),_e=new Set(Vt),Dt=new Set(It),$t=new Set(le),No=[{extensions:J,lookup:xo},{extensions:Et,lookup:ve},{extensions:Ft,lookup:jt},{extensions:Pt,lookup:be},{extensions:At,lookup:Te},{extensions:wt,lookup:Bt},{extensions:Rt,lookup:Ot},{extensions:Vt,lookup:_e},{extensions:It,lookup:Dt},{extensions:le,lookup:$t}];function k(e,t){return t.has(_(e).toLowerCase())}function Co(e){return k(e,ve)}function vo(e){return k(e,jt)}function bo(e){return k(e,be)}function To(e){return k(e,Te)}function _o(e){return k(e,Bt)}function ko(e){return k(e,Ot)}function Vi(e){return _(e).toLowerCase()===".vb"}function Lo(e){return k(e,_e)}function Eo(e){return k(e,Dt)}function Fo(e){return k(e,$t)}function Po(e){let t=_(e).toLowerCase();for(let n of No)if(n.lookup.has(t))return n.extensions;return J}function Ao(e){return vo(e)||ko(e)||Eo(e)}function Wt(e,t,n){return Co(t)?Uo(e,t,n):bo(t)?Mo(e,t,n):To(t)?zo(e,t,n):_o(t)?qo(e,t,n):Ao(t)?Xo(e,n.replace(/\\/g,"."),Po(t)):Lo(t)?Ho(e,t,n):Fo(t)?Jo(e,n):wo(e,t,n)}function wo(e,t,n){if(!n.startsWith(".")&&!n.startsWith("/"))return Ro(e,t,n)??Vo(e,n);let r=h(N(e.config.projectRoot,t)),o=p(r,n),s=L(e);for(let i of Le(o)){let a=y(F(e.config.projectRoot,i));if(s.has(a)||P(i))return a}return y(F(e.config.projectRoot,o))}function Ro(e,t,n){let r=zt(e,t);if(!r)return null;let o=L(e);for(let s of Ut(r,n)){let i=p(r.baseUrl,s);for(let a of Le(i)){let c=y(F(e.config.projectRoot,a));if(o.has(c)||P(a))return c}}return null}function Ii(e,t,n){let r=zt(e,t);if(!r)return null;for(let o of Ut(r,n)){let s=p(r.baseUrl,o);if(P(s))return y(F(e.config.projectRoot,s))}return null}function Ut(e,t){let n=[];for(let[r,o]of Object.entries(e.paths)){let s=r.indexOf("*");if(s===-1){if(t!==r)continue;n.push(...o);continue}let i=r.slice(0,s),a=r.slice(s+1);if(!t.startsWith(i)||!t.endsWith(a)||t.length<i.length+a.length)continue;let c=t.slice(i.length,t.length-a.length);for(let l of o)n.push(l.includes("*")?l.replace("*",c):l)}return n}function Vo(e,t){let n=jo(Io(e),t);if(!n)return null;let r=L(e);for(let o of Bo(n)){let s=p(e.config.projectRoot,n.pkg.relativeDir,o);for(let i of Le(s)){let a=y(F(e.config.projectRoot,i));if(r.has(a)||P(i))return a}}return null}function Io(e){return yo.get(e,()=>kt(e.config.projectRoot))}function jo(e,t){let n=null;for(let r of e){let o=null;t===r.name?o="":t.startsWith(`${r.name}/`)&&(o=t.slice(r.name.length+1)),o!==null&&(!n||r.name.length>n.pkg.name.length)&&(n={pkg:r,subpath:o})}return n}function Bo(e){let t=[],n=Oo(e.pkg.exports,e.subpath);if(n){let r=Do(n);r&&t.push(r)}return t.push(e.subpath?`src/${e.subpath}`:"src/index"),t}function Oo(e,t){if(!e||typeof e!="object")return null;let n=t===""?".":`./${t}`;return Mt(e[n])}function Mt(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;let t=e;for(let n of["types","import","default","require","node"]){let r=Mt(t[n]);if(r)return r}return null}function Do(e){let t=e.replace(/^\.\//,"");return t.startsWith("dist/")?`src/${t.slice(5)}`:null}function zt(e,t){let n=y(h(t));return mo.get(e,n,()=>$o(e,n))}function $o(e,t){let n=ho();if(!n)return null;let r=p(e.config.projectRoot),o=p(r,t);for(;o===r||o.startsWith(r+lo);){for(let i of So){let a=N(o,i);if(!P(a))continue;let c=fo.get(e,a,()=>Wo(n,a));if(c)return c}let s=h(o);if(s===o)break;o=s}return null}function Wo(e,t){try{let n=e.readConfigFile(t,e.sys.readFile);if(n.error||!n.config)return null;let r=e.parseJsonConfigFileContent(n.config,e.sys,h(t)),o=r.options.paths;return!o||Object.keys(o).length===0?null:{baseUrl:r.options.baseUrl?p(h(t),r.options.baseUrl):h(t),paths:o}}catch{return null}}function Uo(e,t,n){let r=L(e),o;if(n.startsWith(".")){let s=n.match(/^(\.+)(.*)$/);if(!s)return null;let i=s[1].length,a=s[2].replace(/^\./,""),c=h(N(e.config.projectRoot,t));for(let l=1;l<i;l++)c=h(c);o=a?p(c,a.replace(/\./g,"/")):c}else o=p(e.config.projectRoot,n.replace(/\./g,"/"));for(let s of Go(o)){let i=y(F(e.config.projectRoot,s));if(r.has(i)||P(s))return i}return null}function Mo(e,t,n){if(!n)return null;let r=n.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let o=h(N(e.config.projectRoot,t)),s;return r.startsWith("crate::")?s=p(e.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?s=p(o,r.slice(6).replace(/::/g,"/")):s=p(h(o),r.slice(7).replace(/::/g,"/")),ke(e,Zo(s))}function zo(e,t,n){let r=h(N(e.config.projectRoot,t)),o=p(r,n);return ke(e,Ko(o))}function qo(e,t,n){let r=h(N(e.config.projectRoot,t)),o=[p(r,n),p(e.config.projectRoot,n),p(e.config.projectRoot,"include",n),p(e.config.projectRoot,"src",n)];return ke(e,o)}function Xo(e,t,n){let r=L(e),o=t.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),s=o.replace(/\./g,"/"),i=o.split(".").pop()??o;for(let c of n){let l=`${s}${c}`,f=[...r].find(C=>C.endsWith(l));if(f)return f}for(let c of n){let l=[...r].find(f=>Lt(f)===`${i}${c}`);if(l)return l}let a=[...r].filter(c=>n.includes(_(c).toLowerCase())).filter(c=>c.includes(`/${s}/`)||c.includes(`/${i}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function Ho(e,t,n){let r=L(e);if(n.startsWith("package:")){let i=n.slice(8),a=i.indexOf("/");if(a<0)return null;let c=i.slice(a+1),l=y(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let o=h(N(e.config.projectRoot,t)),s=p(o,n);for(let i of Yo(s)){let a=y(F(e.config.projectRoot,i));if(r.has(a)||P(i))return a}return null}function Jo(e,t){let n=t.replace(/-/g,"_").replace(/\./g,"/"),r=L(e);for(let o of le){let s=`${n}${o}`,i=[...r].find(a=>a.endsWith(s));if(i)return i}for(let o of le){let s=[...r].find(i=>Lt(i)===`${n.split("/").pop()}${o}`);if(s)return s}return null}function Go(e){let t=_(e);return ve.has(t)?[e]:[`${e}.py`,`${e}.pyi`,N(e,"__init__.py"),N(e,"__init__.pyi")]}function ke(e,t){let n=L(e);for(let r of t){let o=y(F(e.config.projectRoot,r));if(n.has(o)||P(r))return o}return null}function Zo(e){let t=_(e);return be.has(t)?[e]:[`${e}.rs`,N(e,"mod.rs")]}function Ko(e){let t=_(e);return Te.has(t)?[e]:[`${e}.rb`,N(e,"index.rb")]}function Yo(e){let t=_(e);return _e.has(t)?[e]:[`${e}.dart`,e]}function Le(e){let t=_(e),n=new Set;if(t){n.add(e);for(let r of J)n.add(e.slice(0,-t.length)+r)}else for(let r of J)n.add(`${e}${r}`),n.add(N(e,`index${r}`));return[...n]}function L(e){return uo.get(e,()=>new Set(W(e,{includeIgnored:!1}).map(y)))}function ji(e){return po.get(e,()=>Pe([...L(e)].sort().join(`
18
+ `)))}var Qo=new Set(["in","key","of"]),es=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]),ts=E("vue-component-behavior-profiles");function qt(e,t={}){let n=z(e,{extensions:[".vue"]}).filter(o=>!t.scope||o.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(o=>Ee(e,o)).filter(o=>(t.minTemplateTokens===void 0||o.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||o.behaviorTokens.size>=t.minBehaviorTokens))}function Ee(e,t){let n=t.replace(/\\/g,"/"),r=g(e,n),o=ts.get(e,n,r,()=>ns(e,n,r));return os(o)}function ns(e,t,n){let r=I(e,t),o=ce(e,t),s=ae(r),i=as(o),a=o.expressionIdentifiers.map(m=>m.name).filter(m=>!i.includes(m)).filter((m,b,$)=>$.indexOf(m)===b).sort(),c=o.componentTags.map(m=>m.normalized).filter((m,b,$)=>$.indexOf(m)===b).sort(),l=n?n.split(`
19
+ `).length:0,f=V(r.template),C=s.lineCount,u=r.styles.reduce((m,b)=>m+V(b),0),v=r.customBlocks.reduce((m,b)=>m+V(b),0),{lines:D,paths:ue}=rs(e,t,s);return{file:t,sfc:r,templateFacts:o,scriptFacts:s,templateTokens:new Set(o.structuralTokens),behaviorTokens:is(o,s,a),templateBindingNames:a,templateLocalNames:i,componentNames:c,sfcLines:l,totalLines:l+s.externalLineCount,templateLines:f,scriptLines:C,styleLines:u,externalScriptLines:s.externalLineCount,externalScriptPaths:s.externalScriptPaths,customBlockLines:v,delegatedComposableLines:D,delegatedComposablePaths:ue}}function rs(e,t,n){let r=new Set;for(let i of n.composables){let a=n.imports.find(l=>l.local===i);if(!a)continue;let c=Wt(e,a.sourcePath,a.source);!c||c===t||r.add(c)}let o=[...r].sort();return{lines:o.reduce((i,a)=>{let c=g(e,a);return i+(c?c.split(`
20
+ `).length:0)},0),paths:o}}function os(e){let t=ss(e.scriptFacts);return{...e,scriptFacts:t,templateTokens:new Set(e.templateTokens),behaviorTokens:new Set(e.behaviorTokens),templateBindingNames:[...e.templateBindingNames],templateLocalNames:[...e.templateLocalNames],componentNames:[...e.componentNames],externalScriptPaths:t.externalScriptPaths,delegatedComposablePaths:[...e.delegatedComposablePaths]}}function ss(e){return{...e,imports:e.imports.map(t=>({...t})),functions:e.functions.map(t=>({...t})),calls:e.calls.map(t=>({...t,categories:[...t.categories]})),composables:[...e.composables],stores:[...e.stores],reactivity:[...e.reactivity],lifecycle:[...e.lifecycle],requests:[...e.requests],macros:[...e.macros],externalScriptPaths:[...e.externalScriptPaths],unresolvedScripts:e.unresolvedScripts.map(t=>({...t}))}}function is(e,t,n){let r=new Set;for(let o of t.composables)r.add(`composable:${o}`);for(let o of t.stores)r.add(`store:${o}`);for(let o of t.reactivity)r.add(`reactivity:${o}`);for(let o of t.lifecycle)r.add(`lifecycle:${o}`);for(let o of t.requests)r.add(`request:${o}`);for(let o of t.macros)r.add(`macro:${o}`);for(let o of t.functions){if(es.has(o.name))continue;r.add(`function:${o.name}`);let s=/^[a-z]+/.exec(o.name)?.[0]??null;s&&s.length>2&&s!==o.name&&r.add(`function-verb:${s}`)}for(let o of e.events)r.add(`template-event:${o.name}`);for(let o of n)r.add(`template-binding:${o}`);return r}function as(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of cs(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of Xt(n.value))t.add(r);return[...t].sort()}function cs(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?Xt(t[1]??""):[]}function Xt(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];Qo.has(r)||t.push(r)}return t}function Ki(e){return{capability:(t,n)=>ls(t,n),reactProfiles:(t={})=>ht(e,t),reactProfilesForFile:t=>Se(e,t),vueProfiles:(t={})=>qt(e,t),vueProfileForFile:t=>Ee(e,t),vueTemplateFacts:t=>ce(e,t),vueScriptFacts:t=>ae(I(e,t))}}function ls(e,t){let n=e.startsWith("react-")?"react":"vue";if(t===void 0)return{slot:e,available:!0,framework:n};let r=t.replace(/\\/g,"/").toLowerCase();return n==="react"&&!r.endsWith(".tsx")&&!r.endsWith(".jsx")?{slot:e,available:!1,framework:n,reason:"React behavior profiles are only available for .tsx and .jsx files"}:n==="vue"&&!r.endsWith(".vue")?{slot:e,available:!1,framework:n,reason:"Vue behavior facts are only available for .vue files"}:{slot:e,available:!0,framework:n}}export{W as a,fs as b,kt as c,io as d,J as e,Et as f,Ft as g,Pt as h,At as i,wt as j,Rt as k,Vt as l,It as m,le as n,Vi as o,Po as p,Wt as q,Ii as r,Uo as s,Mo as t,zo as u,qo as v,Xo as w,Ho as x,Jo as y,ji as z,U as A,pe as B,Qt as C,ge as D,Ge as E,Vs as F,re as G,ne as H,Os as I,rt as J,Ds as K,vt as L,Xs as M,ct as N,z as O,Hs as P,Ki as Q};
21
+ //# sourceMappingURL=chunk-ZLMXIQLC.js.map
@@ -0,0 +1,2 @@
1
+ import{a as m}from"./chunk-FJF6VO2P.js";import{j as g}from"./chunk-NJQISBL4.js";import{b as d}from"./chunk-FLMTCX5R.js";import{c as f}from"./chunk-JZ2A7LDM.js";var P=new Set(["page","layout","template","loading","error","not-found","global-error","default","route"]),x=/\.(?:ts|tsx|js|jsx|mjs|cjs)$/,k=/^\((\.{1,3})\)(.*)$/,E=/^\(\.\.\)\(\.\.\)(.*)$/;function h(i){return l(i)!==null}function l(i){let e=f(i);if(!x.test(e))return null;let r=e.split("/"),t=r[r.length-1].replace(x,"");if(!P.has(t))return null;let o=r.findIndex((s,u)=>s==="app"&&u<r.length-1);if(o<0)return null;let n=[],a=!1;for(let s of r.slice(o+1,-1)){if(s.startsWith("@"))continue;let u=E.exec(s);if(u){a=!0,n.splice(Math.max(0,n.length-2)),n.push(u[1]);continue}let c=k.exec(s);if(c){a=!0;let p=c[1];p===".."?n.splice(Math.max(0,n.length-1)):p==="..."&&n.splice(0),n.push(c[2]);continue}s.startsWith("(")&&s.endsWith(")")||n.push(s)}return{route:n,entry:t,intercepting:a}}function R(i,e){let r=l(i),t=l(e);return!r||!t||!r.intercepting&&!t.intercepting||r.entry!==t.entry?!1:r.route.join("/")===t.route.join("/")}function S(i){let e=new Map,r=t=>{let o=e.get(t);if(o)return o;let n=F(i,t);return e.set(t,n),n};return{roleOf:r,pairContext:(t,o)=>{let n=r(t),a=r(o);return n==="ui-kit"&&a==="ui-kit"?"ui-kit-pair":t!==o&&R(t,o)?"intercepting-route-pair":n==="framework-route"&&a==="framework-route"&&t!==o?"framework-route-pair":"product"}}}function F(i,e){return d(e)==="test"?"test":m(i,e)?"ui-kit":h(e)||g(e)?"framework-route":"product"}var y=class{counts=new Map;record(e,r,t=1){if(t<=0)return;let o=this.counts.get(e);if(o){o.count+=t;return}this.counts.set(e,{reason:e,detail:r,count:t})}list(){return[...this.counts.values()].sort((e,r)=>e.reason.localeCompare(r.reason))}},T={testFiles:"components defined in test files (fixture scaffolding, not product code)",uiKitPairs:"pairs where both components are vendored UI-kit primitives (similar by construction)",uiKitFiles:"components defined in vendored UI-kit directories",hookComponentPairs:"pairs that mix a hook with a component (a hook is already the extraction target)"};function v(i){switch(i){case"framework-route-pair":return"both files are framework route entries; route files share framework scaffolding by design";case"intercepting-route-pair":return"intercepting route and its target route are meant to render the same view";case"ui-kit-pair":return"both files are vendored UI-kit primitives";case"product":return null}}export{S as a,y as b,T as c,v as d};
2
+ //# sourceMappingURL=chunk-ZMCQIHI4.js.map
package/dist/cli-main.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import{i as pe,j as le,k as v,m as fe,q as he,w as l,y as j}from"./chunk-A77SCPW2.js";import{a as re,b as oe,d as ie}from"./chunk-Q5TA4OY4.js";import{c as ae,d as se,e as ce,f as me,g as de,h as ue}from"./chunk-CKRWA452.js";import{Ab as y,Cb as Q,Eb as X,Fb as K,Gb as Z,Hb as ee,Qb as P,Rb as te,Tb as ne,dc as $e,ob as C,pb as Y,zb as S}from"./chunk-V4NG5OMS.js";import{A as b,D as M,F as G,Hd as J,I as F,Va as q,Zd as B,_ as m,ea as R,ib as U,jb as L,kb as V,lb as H,mb as z,t as _,u as $,z as W}from"./chunk-2BTJALUS.js";import{Help as bt,program as d}from"commander";import{existsSync as Rt,realpathSync as Te}from"fs";import{fileURLToPath as St}from"url";var We=new Set(["code","outline","refs"]),Me=["--symbol","--at","--search","--view","--edge","--direction","--subtype","--connecting","--inventory-only","--fold","--depth","--max-edges"];function ge(e){if(e[2]!=="evidence")return;let n=e[3];if(!n||n.startsWith("-"))return;if(e.slice(4).some(o=>Me.some(r=>o===r||o.startsWith(`${r}=`)))){e.splice(3,1,"--symbol",n);return}e[2]="evidence-source"}function Ge(e){return e!==void 0&&We.has(e)}async function Ce(e){if(e==="continue"){let{outputContinuationCommandDescriptor:t}=await import("./output-continuation-command-JHMPH6NC.js");return[t]}if(Ge(e)){let{directNavigationQueryCommandDescriptors:t}=await import("./direct-navigation-O3LUAYWQ.js"),i=t.find(o=>o.id===e);if(!i)throw new Error(`Direct navigation command descriptor is unavailable: ${e}`);return[i]}let{commandDescriptors:n}=await import("./command-descriptors-ORNTVNYV.js");return n}import{Option as Ue}from"commander";function D(e){return e.evidence?e.evidence:Fe.has(e.id)?"mixed":e.heuristic?"heuristic":"graph-fact"}var Fe=new Set(["health","context","co-change"]);function ye(e){if(e.claims){if(e.claims.origin==="mixed"&&!e.claims.families?.length)throw new Error(`Mixed command ${e.id} must declare at least one claim family.`);return e.claims}let n=D(e);if(n==="mixed")throw new Error(`Mixed command ${e.id} must declare claim families.`);let t=e.agent?se(e.agent.operation):[];return t.length>0&&t.every(o=>o==="repository-observation"||o==="repository-preview")?{origin:n==="heuristic"?"heuristic":"compiler-graph",observedSources:["index-generation"],producerValidation:{status:"not-evaluated"}}:{origin:"unknown",observedSources:["process"],producerValidation:{status:"not-evaluated"}}}import{basename as qe}from"path";function ve(e=process.argv,n=process.execPath){let t=e[1];return!t||qe(t)==="scip-query"?["scip-query"]:[n,t]}function Ee(e,n){return me(new Map(n.map(t=>[t.id,D(t)]))),ue(new Map(n.map(t=>[t.id,ye(t)]))),de(new Map(n.flatMap(t=>t.agent?[[t.id,{...t.agent,resultUnits:Ve(t)}]]:[]))),n.map(t=>{let i=t.hidden?e.command(t.command,{hidden:!0}):e.command(t.command);i.description(t.description),t.helpAfter&&i.addHelpText("after",`
2
+ import{i as pe,j as le,k as v,m as fe,q as he,w as l,y as j}from"./chunk-U2FPY5XA.js";import{a as re,b as oe,d as ie}from"./chunk-3D4BOXW6.js";import{c as ae,d as se,e as ce,f as me,g as de,h as ue}from"./chunk-DUULLZHZ.js";import{Ab as y,Cb as Q,Eb as X,Fb as K,Gb as Z,Hb as ee,Rb as P,Sb as te,Ub as ne,ec as $e,ob as C,pb as Y,zb as S}from"./chunk-NWLVNU66.js";import{A as b,D as M,F as G,I as F,Wa as q,_ as m,_d as J,fa as R,kb as U,lb as L,mb as V,nb as H,ob as z,qe as B,t as _,u as $,z as W}from"./chunk-2XWIUW5Z.js";import{Help as bt,program as d}from"commander";import{existsSync as Rt,realpathSync as Te}from"fs";import{fileURLToPath as St}from"url";var We=new Set(["code","outline","refs"]),Me=["--symbol","--at","--search","--view","--edge","--direction","--subtype","--connecting","--inventory-only","--fold","--depth","--max-edges"];function ge(e){if(e[2]!=="evidence")return;let n=e[3];if(!n||n.startsWith("-"))return;if(e.slice(4).some(o=>Me.some(r=>o===r||o.startsWith(`${r}=`)))){e.splice(3,1,"--symbol",n);return}e[2]="evidence-source"}function Ge(e){return e!==void 0&&We.has(e)}async function Ce(e){if(e==="continue"){let{outputContinuationCommandDescriptor:t}=await import("./output-continuation-command-4UMDOOLO.js");return[t]}if(Ge(e)){let{directNavigationQueryCommandDescriptors:t}=await import("./direct-navigation-4UBC6HNW.js"),i=t.find(o=>o.id===e);if(!i)throw new Error(`Direct navigation command descriptor is unavailable: ${e}`);return[i]}let{commandDescriptors:n}=await import("./command-descriptors-7BKH53Y3.js");return n}import{Option as Ue}from"commander";function D(e){return e.evidence?e.evidence:Fe.has(e.id)?"mixed":e.heuristic?"heuristic":"graph-fact"}var Fe=new Set(["health","context","co-change"]);function ye(e){if(e.claims){if(e.claims.origin==="mixed"&&!e.claims.families?.length)throw new Error(`Mixed command ${e.id} must declare at least one claim family.`);return e.claims}let n=D(e);if(n==="mixed")throw new Error(`Mixed command ${e.id} must declare claim families.`);let t=e.agent?se(e.agent.operation):[];return t.length>0&&t.every(o=>o==="repository-observation"||o==="repository-preview")?{origin:n==="heuristic"?"heuristic":"compiler-graph",observedSources:["index-generation"],producerValidation:{status:"not-evaluated"}}:{origin:"unknown",observedSources:["process"],producerValidation:{status:"not-evaluated"}}}import{basename as qe}from"path";function ve(e=process.argv,n=process.execPath){let t=e[1];return!t||qe(t)==="scip-query"?["scip-query"]:[n,t]}function Ee(e,n){return me(new Map(n.map(t=>[t.id,D(t)]))),ue(new Map(n.map(t=>[t.id,ye(t)]))),de(new Map(n.flatMap(t=>t.agent?[[t.id,{...t.agent,resultUnits:Ve(t)}]]:[]))),n.map(t=>{let i=t.hidden?e.command(t.command,{hidden:!0}):e.command(t.command);i.description(t.description),t.helpAfter&&i.addHelpText("after",`
3
3
  ${t.helpAfter.trim()}
4
4
  `);for(let o of t.arguments??[])i.argument(o.name);for(let o of t.options??[])if(o.hidden){let r=new Ue(o.flags,o.description).hideHelp();o.parser&&r.argParser(o.parser),Object.hasOwn(o,"defaultValue")&&r.default(o.defaultValue),i.addOption(r)}else o.parser&&Object.hasOwn(o,"defaultValue")?i.option(o.flags,o.description,o.parser,o.defaultValue):o.parser?i.option(o.flags,o.description,o.parser):Object.hasOwn(o,"defaultValue")?i.option(o.flags,o.description,o.defaultValue):i.option(o.flags,o.description);return i.action(async(...o)=>{try{let r=i.optsWithGlobals();Le(r);let a=()=>t.id===re?t.handler(...o):oe({command:t.id,producerVersion:m,invocationPrefix:ve(),argv:process.argv.slice(2),cwd:process.cwd(),json:r.json===!0,agentOutput:r.agentOutput===!0,...typeof r.jsonOutput=="string"?{jsonOutputPath:r.jsonOutput}:{},sourceSession:r.session!==!1,reemitSource:r.reemit===!0,...typeof r.outputPageSize=="number"?{pageSize:r.outputPageSize}:{},...typeof r.outputCursor=="string"?{cursor:r.outputCursor}:{}},()=>t.handler(...o)),c=t.agent?ae(t.agent.operation,{args:o.slice(0,-1),options:r}):void 0;await(c?ce(c,a):a())}catch(r){He(r)}}),{descriptor:t,command:i}})}function Le(e){if(e.resultOnly===!0&&e.json!==!0)throw new Error("--result-only requires --json.");if(e.compact===!0&&e.json!==!0)throw new Error("--compact requires --json.");if(e.agentOutput===!0&&e.json!==!0)throw new Error("--agent-output requires --json.");if(typeof e.jsonOutput=="string"&&e.json!==!0)throw new Error("--json-output requires --json.");if(e.rawJson===!0&&e.json!==!0)throw new Error("--raw-json requires --json.");if(e.agentOutput===!0&&e.rawJson===!0)throw new Error("--agent-output cannot be combined with --raw-json.");if(typeof e.jsonOutput=="string"){if(e.agentOutput===!0||e.rawJson===!0)throw new Error("--json-output cannot be combined with --agent-output or --raw-json.");if(e.outputPageSize!==void 0||e.outputCursor!==void 0)throw new Error("--json-output cannot be combined with output pagination.")}if(e.rawJson===!0&&(e.outputPageSize!==void 0||e.outputCursor!==void 0))throw new Error("--raw-json cannot be combined with output pagination.")}function Ve(e){let n=e.agent?.resultUnits;if(n?.kind==="field"&&n.field.trim()==="")throw new Error(`Command ${e.id} declares an empty result-unit field.`);return n||(e.renderShape==="list"||e.renderShape==="table"||e.renderShape==="grouped-by-file"?{kind:"rows"}:{kind:"report"})}function He(e){let n=e instanceof Error?e.message:String(e);console.error(`error: ${te(n)}`),process.exitCode=1}var ze=new Set(j),xe=new Map(j.map((e,n)=>[e,n])),Je=new Set(["Navigation","Graph","Impact","Exploration"]),Be=new Set(["Cleanup","Health"]),Ye=new Set(["Indexing","Core","Maintenance"]);function Qe(e){if(e.hidden||e.agent?.semantic?.compatibility==="deprecated")return"compatibility";if(ze.has(e.id))return"primary-exploration";let n=e.docs?.category;if(n&&Je.has(n))return"specialized-analysis";if(n&&Be.has(n))return"quality-cleanup";if(n&&Ye.has(n))return"maintenance";if(n==="Formal Models")return"formal-modeling";throw new Error(`Visible command ${e.id} has no cockpit panel (docs category: ${n??"missing"}).`)}function Xe(e,n={}){let i=[{id:"primary-exploration",title:"Primary exploration",purpose:"Locate exact referents, project chosen relationships, and read only named implementation gaps."},{id:"specialized-analysis",title:"Specialized analysis",purpose:"Run a named graph, impact, or structural analysis when that exact analysis answers the task."},{id:"quality-cleanup",title:"Quality and cleanup",purpose:"Evaluate repository quality, cleanup candidates, and configured architecture findings."},{id:"maintenance",title:"Maintenance",purpose:"Build, inspect, configure, and maintain the project index and local integrations."},{id:"formal-modeling",title:"Formal modeling",purpose:"Create, verify, and check explicit state-machine models and traces."},{id:"compatibility",title:"Compatibility and deprecated controls",purpose:"Preserved invocation surfaces for existing consumers; do not choose these for new workflows."}].map(r=>({...r,commands:e.filter(a=>Qe(a)===r.id).sort((a,c)=>r.id==="primary-exploration"?(xe.get(a.id)??Number.MAX_SAFE_INTEGER)-(xe.get(c.id)??Number.MAX_SAFE_INTEGER):0)})),o=new Set(["primary-exploration","maintenance"]);return i.filter(r=>r.commands.length>0&&(n.includeCompatibility||o.has(r.id)))}function O(e,n,t={}){let i=[`Usage: ${e.name()} [options] [command]`,"",e.description(),"","Options:"],o=e.options.map(a=>a.flags),r=Math.max(...o.map(a=>a.length),0);for(let a of e.options)i.push(` ${a.flags.padEnd(r)} ${a.description}`);i.push(` ${"-h, --help".padEnd(r)} Display this grouped command help`);for(let a of Xe(n,t)){i.push("",`${a.title}:`,` ${a.purpose}`);let c=Math.max(...a.commands.map(s=>s.command.length),0);for(let s of a.commands)i.push(` ${s.command.padEnd(c)} ${s.description}`)}return t.includeCompatibility||i.push("","Run `scip-query --help-all` to include advanced, compatibility, and deprecated controls."),i.push("Run `scip-query <command> --help` for one control's options and examples.",""),i.join(`
5
5
  `)}import{createHash as Ke}from"crypto";import{lstatSync as Ze}from"fs";import{isAbsolute as et,join as Pe}from"path";var je="git-worktree-context.json",we=16*1024,be=/^[0-9a-f]{40,64}$/,Re=/^[0-9a-f]{24}$/,Se=/^[0-9a-f]{64}$/;function De(e,n,t=b){let i=t!==b||F(),o=i?tt(e,n):void 0;if(o){let a=G(e,o,t);if(a)return a}let r=M(e,t);if(r&&i)try{nt(e,n,r.context,o)}catch{}return r}function tt(e,n){try{let t=R(e,n),i=Pe(t.physicalCacheDir,je),o=Ze(i);if(!o.isFile()||o.isSymbolicLink()||o.size>we)return;let r=JSON.parse(_(i,{inputKind:"Git worktree context receipt",maxBytes:we}));return!rt(r)||r.requestedProjectRoot!==t.record.canonicalProjectRoot||r.cacheOwnerSha256!==t.ownerSha256||r.checksum!==Oe(r)?void 0:r}catch{return}}function nt(e,n,t,i){if(!t.headCommit||!t.treeOid)return;let o=R(e,n),r={version:1,requestedProjectRoot:o.record.canonicalProjectRoot,cacheOwnerSha256:o.ownerSha256,projectRoot:t.projectRoot,gitDir:t.gitDir,commonDir:t.commonDir,repositoryId:t.repositoryId,worktreeId:t.worktreeId,headCommit:t.headCommit,treeOid:t.treeOid},a={...r,checksum:Oe(r)};i?.checksum!==a.checksum&&J(Pe(o.physicalCacheDir,je),a,{spacing:2,trailingNewline:!0})}function rt(e){return ot(e)?e.version===1&&E(e.requestedProjectRoot)&&p(Se,e.cacheOwnerSha256)&&E(e.projectRoot)&&E(e.gitDir)&&E(e.commonDir)&&p(Re,e.repositoryId)&&p(Re,e.worktreeId)&&p(be,e.headCommit)&&p(be,e.treeOid)&&p(Se,e.checksum):!1}function ot(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function E(e){return typeof e=="string"&&et(e)}function Oe(e){return Ke("sha256").update(JSON.stringify({version:e.version,requestedProjectRoot:e.requestedProjectRoot,cacheOwnerSha256:e.cacheOwnerSha256,projectRoot:e.projectRoot,gitDir:e.gitDir,commonDir:e.commonDir,repositoryId:e.repositoryId,worktreeId:e.worktreeId,headCommit:e.headCommit,treeOid:e.treeOid})).digest("hex")}function p(e,n){return typeof n=="string"&&e.test(n)}import{existsSync as it,mkdirSync as at,writeFileSync as st}from"fs";import{homedir as ct}from"os";import{join as x}from"path";var mt=1440*60*1e3,Ae="update-check.json",dt="https://registry.npmjs.org/scip-query/latest";async function I(e={}){let n=e.env??process.env;if(n.SCIP_QUERY_UPDATE_CHECK==="0"||n.NO_UPDATE_NOTIFIER)return;let t=e.cacheDir??lt(n),i=e.now??Date.now(),o=e.currentVersion??m,r=ft(t),a=r&&i-r.checkedAt<mt?r.latestVersion:await ht(t,e.fetchLatestVersion??Ct,i);if(!a||!pt(a,o))return;(e.writeNotice??(s=>console.error(s)))(ut(o,a))}function ut(e,n){return[`scip-query update available: ${e} -> ${n}.`,"Agent: tell your human to update with: npm install -g scip-query@latest",""].join(`
6
6
  `)}function pt(e,n){let t=Ie(e),i=Ie(n);if(!t||!i)return e!==n;for(let o=0;o<t.length;o++){let r=t[o]-i[o];if(r>0)return!0;if(r<0)return!1}return!1}function lt(e){let n=e.XDG_CACHE_HOME||x(ct(),".cache");return x(n,"scip-query")}function ft(e){let n=x(e,Ae);if(!it(n))return null;try{let t=JSON.parse($(n,"update notice cache"));return typeof t.checkedAt=="number"&&(typeof t.latestVersion=="string"||t.latestVersion===null)?{checkedAt:t.checkedAt,latestVersion:t.latestVersion}:null}catch{return null}}async function ht(e,n,t){let i;try{i=await n()}catch{i=null}return gt(e,{checkedAt:t,latestVersion:i}),i}function gt(e,n){try{at(e,{recursive:!0}),st(x(e,Ae),`${JSON.stringify(n,null,2)}
7
- `)}catch{}}async function Ct(){let e=await fetch(dt,{signal:AbortSignal.timeout(1e3)});if(!e.ok)return null;let n=await e.json();return typeof n.version=="string"?n.version:null}function Ie(e){let n=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e);return n?[Number(n[1]),Number(n[2]),Number(n[3])]:null}var yt=5e3,vt=100,Et={prepare:X,freshness:Y,ensureService:v,inspectService:fe,requestRefresh:he,async reindex(e,n,t,i){let{reindexConfiguredProject:o}=await import("./project-reindex-HYO4WD7Z.js");return o(e,n,t,i)},wait(e){return new Promise(n=>setTimeout(n,e))},now:Date.now};async function Ne(e,n=Et,t={}){if(e.dbPathSource==="env")return{source:"explicit-index",service:{kind:"skipped",reason:"environment"}};let i=xt(e,n),o=n.prepare(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext,gitObservation:e.gitObservation,...i?{watcherGeneration:i}:{}}),r=o.kind==="local-fresh"&&o.freshness?o.freshness:n.freshness(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext}),a=n.ensureService({commandName:e.commandName,projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,config:e.config,gitContext:e.gitContext});if(r.state==="fresh")return{source:o.kind==="local-fresh"?"existing":"shared-generation",service:a};let c=a.kind==="started"||a.kind==="reused";if(c&&n.requestRefresh(B(e.paths.cacheDir).activityPath,`evidence command ${e.commandName} requires a fresh generation`),C(r))return{source:"stale",service:a};if(c){let s=a.state.watcher.state;if(s==="budget-paused"||s==="indexing")throw new Error(`Could not prepare fresh evidence for scip-query ${e.commandName}: index remained ${r.state} (${r.reason}) while the watcher is ${s}`);if(r=await wt(e,r,n,t,a),r.state==="fresh")return{source:"watcher",service:a};if(C(r))return{source:"stale",service:a}}try{await n.reindex(e.projectRoot,e.config,e.paths,{allowPartial:!1,skipAutoInstall:!0,trigger:{kind:"watch-demand",detail:`scip-query ${e.commandName}`},onStatus:()=>{}})}catch(s){throw new Error(`Could not prepare fresh evidence for scip-query ${e.commandName}: ${s instanceof Error?s.message:String(s)}`,{cause:s})}if(r=n.freshness(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext}),r.state!=="fresh"&&!C(r))throw new Error(`Could not prepare fresh evidence for scip-query ${e.commandName}: index remained ${r.state} (${r.reason})`);return{source:"synchronous-reindex",service:a}}function xt(e,n){if(e.config.watch?.enabled===!0)try{return pe(n.inspectService({projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,gitContext:e.gitContext}))}catch{return}}async function wt(e,n,t,i,o){if(o.state.watcher.state==="budget-paused")return n;let r=Math.max(0,i.waitMs??yt),a=Math.max(1,i.pollMs??vt),c=t.now()+r,s=n;for(;t.now()<c;)if(await t.wait(Math.min(a,Math.max(1,c-t.now()))),s=t.freshness(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext}),s.state==="fresh")return s;return s}async function ke(e,n={}){try{await e()}catch(t){let i=t instanceof Error?t.message:String(t);console.error(`error: ${i}`),(n.debug??process.env.SCIP_QUERY_DEBUG!==void 0)&&t instanceof Error&&t.stack&&console.error(t.stack),process.exitCode=1}}var w=Dt();w&&(ne(),d.configureOutput({writeOut:e=>process.stdout.write(P(e)),writeErr:e=>process.stderr.write(P(e))}));d.name("scip-query").description("Language-agnostic code intelligence CLI powered by SCIP indexes").version(m).option("--output-page-size <characters>","Return bounded output pages with an exact continuation command",ie).option("--output-cursor <cursor>","Continue a bounded output page").option("--agent-output","Emit a bounded JSON projection for model-facing clients (requires --json)").option("--json-output <path>","Atomically write the complete JSON result and print a small receipt").option("--raw-json","Explicitly retain the legacy unpaged JSON stream (requires --json)").option("--no-session","Disable the explicit exploration evidence ledger").option("--reemit","Recovery only: render source and graph evidence again instead of citing session receipts").option("--help-all","Display every command, including compatibility and deprecated controls");w&&ge(process.argv);var N=await Ce(w?process.argv[2]:void 0);Ee(d,N);var f,Pt=new bt;d.configureHelp({formatHelp:(e,n)=>e===d?O(d,N):Pt.formatHelp(e,n)});d.hook("preAction",async(e,n)=>{let t=n.name();if(t==="continue"){A();return}let i=K(t),o=le(t);if(i&&(f=W()),!i&&!o){A(),await I({commandName:t});return}let r=S(),a=Q(r);y(a),A(),await I({commandName:t});let c=De(r,a.paths.cacheDir),s=c?.context;a={...a,gitContext:s},y(a);let{config:k,paths:T}=a;if(i){let u;try{u=await Ne({commandName:t,projectRoot:r,config:k,paths:T,dbPathSource:a.dbPathSource,gitContext:s,gitObservation:c})}catch(g){if(!Z(t)||!Rt(a.dbPath))throw g;let _e=g instanceof Error?g.message:String(g);console.error(`warning: index refresh failed; ${t} is using the existing index. Current file text remains exact, but index-derived symbols and relationships may be stale. ${_e}`),l(r,m,{repositoryId:s?.repositoryId??null});return}process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-freshness: ${u.source}`),u.service.kind==="failed"&&console.error(`warning: scip-query watch service did not start: ${u.service.message}`),(u.service.kind==="failed"||u.service.kind==="skipped")&&l(r,m,{repositoryId:s?.repositoryId??null});return}if(!o){l(r,m,{repositoryId:s?.repositoryId??null});return}let h=v({commandName:t,projectRoot:r,cacheDir:T.cacheDir,cliVersion:m,config:k,gitContext:s});h.kind==="failed"&&console.error(`warning: scip-query watch service did not start: ${h.message}`),(h.kind==="failed"||h.kind==="skipped")&&l(r,m,{repositoryId:s?.repositoryId??null})});d.hook("postAction",()=>{y(void 0),f?.(),f=void 0});function A(){if(V(),!U()||H())return;let e=null,n=null;try{n=ee(S()),e=q(n)}catch{}finally{n?.close()}z({command:L()??`scip-query ${process.argv.slice(2).join(" ")}`,toolVersion:m,projectFingerprint:e})}async function jt(){try{process.argv.includes("--help-all")?process.stdout.write(O(d,N,{includeCompatibility:!0})):await d.parseAsync()}finally{f?.(),f=void 0}}w&&await ke(jt);function Dt(){if(!process.argv[1])return!1;let e=St(import.meta.url);try{return Te(e)===Te(process.argv[1])}catch{return e===process.argv[1]}}export{d as program,$e as renderHeuristicNotice,jt as runCli};
7
+ `)}catch{}}async function Ct(){let e=await fetch(dt,{signal:AbortSignal.timeout(1e3)});if(!e.ok)return null;let n=await e.json();return typeof n.version=="string"?n.version:null}function Ie(e){let n=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e);return n?[Number(n[1]),Number(n[2]),Number(n[3])]:null}var yt=5e3,vt=100,Et={prepare:X,freshness:Y,ensureService:v,inspectService:fe,requestRefresh:he,async reindex(e,n,t,i){let{reindexConfiguredProject:o}=await import("./project-reindex-XEQTRCV5.js");return o(e,n,t,i)},wait(e){return new Promise(n=>setTimeout(n,e))},now:Date.now};async function Ne(e,n=Et,t={}){if(e.dbPathSource==="env")return{source:"explicit-index",service:{kind:"skipped",reason:"environment"}};let i=xt(e,n),o=n.prepare(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext,gitObservation:e.gitObservation,...i?{watcherGeneration:i}:{}}),r=o.kind==="local-fresh"&&o.freshness?o.freshness:n.freshness(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext}),a=n.ensureService({commandName:e.commandName,projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,config:e.config,gitContext:e.gitContext});if(r.state==="fresh")return{source:o.kind==="local-fresh"?"existing":"shared-generation",service:a};let c=a.kind==="started"||a.kind==="reused";if(c&&n.requestRefresh(B(e.paths.cacheDir).activityPath,`evidence command ${e.commandName} requires a fresh generation`),C(r))return{source:"stale",service:a};if(c){let s=a.state.watcher.state;if(s==="budget-paused"||s==="indexing")throw new Error(`Could not prepare fresh evidence for scip-query ${e.commandName}: index remained ${r.state} (${r.reason}) while the watcher is ${s}`);if(r=await wt(e,r,n,t,a),r.state==="fresh")return{source:"watcher",service:a};if(C(r))return{source:"stale",service:a}}try{await n.reindex(e.projectRoot,e.config,e.paths,{allowPartial:!1,skipAutoInstall:!0,trigger:{kind:"watch-demand",detail:`scip-query ${e.commandName}`},onStatus:()=>{}})}catch(s){throw new Error(`Could not prepare fresh evidence for scip-query ${e.commandName}: ${s instanceof Error?s.message:String(s)}`,{cause:s})}if(r=n.freshness(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext}),r.state!=="fresh"&&!C(r))throw new Error(`Could not prepare fresh evidence for scip-query ${e.commandName}: index remained ${r.state} (${r.reason})`);return{source:"synchronous-reindex",service:a}}function xt(e,n){if(e.config.watch?.enabled===!0)try{return pe(n.inspectService({projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,gitContext:e.gitContext}))}catch{return}}async function wt(e,n,t,i,o){if(o.state.watcher.state==="budget-paused")return n;let r=Math.max(0,i.waitMs??yt),a=Math.max(1,i.pollMs??vt),c=t.now()+r,s=n;for(;t.now()<c;)if(await t.wait(Math.min(a,Math.max(1,c-t.now()))),s=t.freshness(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext}),s.state==="fresh")return s;return s}async function ke(e,n={}){try{await e()}catch(t){let i=t instanceof Error?t.message:String(t);console.error(`error: ${i}`),(n.debug??process.env.SCIP_QUERY_DEBUG!==void 0)&&t instanceof Error&&t.stack&&console.error(t.stack),process.exitCode=1}}var w=Dt();w&&(ne(),d.configureOutput({writeOut:e=>process.stdout.write(P(e)),writeErr:e=>process.stderr.write(P(e))}));d.name("scip-query").description("Language-agnostic code intelligence CLI powered by SCIP indexes").version(m).option("--output-page-size <characters>","Return bounded output pages with an exact continuation command",ie).option("--output-cursor <cursor>","Continue a bounded output page").option("--agent-output","Emit a bounded JSON projection for model-facing clients (requires --json)").option("--json-output <path>","Atomically write the complete JSON result and print a small receipt").option("--raw-json","Explicitly retain the legacy unpaged JSON stream (requires --json)").option("--no-session","Disable the explicit exploration evidence ledger").option("--reemit","Recovery only: render source and graph evidence again instead of citing session receipts").option("--help-all","Display every command, including compatibility and deprecated controls");w&&ge(process.argv);var N=await Ce(w?process.argv[2]:void 0);Ee(d,N);var f,Pt=new bt;d.configureHelp({formatHelp:(e,n)=>e===d?O(d,N):Pt.formatHelp(e,n)});d.hook("preAction",async(e,n)=>{let t=n.name();if(t==="continue"){A();return}let i=K(t),o=le(t);if(i&&(f=W()),!i&&!o){A(),await I({commandName:t});return}let r=S(),a=Q(r);y(a),A(),await I({commandName:t});let c=De(r,a.paths.cacheDir),s=c?.context;a={...a,gitContext:s},y(a);let{config:k,paths:T}=a;if(i){let u;try{u=await Ne({commandName:t,projectRoot:r,config:k,paths:T,dbPathSource:a.dbPathSource,gitContext:s,gitObservation:c})}catch(g){if(!Z(t)||!Rt(a.dbPath))throw g;let _e=g instanceof Error?g.message:String(g);console.error(`warning: index refresh failed; ${t} is using the existing index. Current file text remains exact, but index-derived symbols and relationships may be stale. ${_e}`),l(r,m,{repositoryId:s?.repositoryId??null});return}process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-freshness: ${u.source}`),u.service.kind==="failed"&&console.error(`warning: scip-query watch service did not start: ${u.service.message}`),(u.service.kind==="failed"||u.service.kind==="skipped")&&l(r,m,{repositoryId:s?.repositoryId??null});return}if(!o){l(r,m,{repositoryId:s?.repositoryId??null});return}let h=v({commandName:t,projectRoot:r,cacheDir:T.cacheDir,cliVersion:m,config:k,gitContext:s});h.kind==="failed"&&console.error(`warning: scip-query watch service did not start: ${h.message}`),(h.kind==="failed"||h.kind==="skipped")&&l(r,m,{repositoryId:s?.repositoryId??null})});d.hook("postAction",()=>{y(void 0),f?.(),f=void 0});function A(){if(V(),!U()||H())return;let e=null,n=null;try{n=ee(S()),e=q(n)}catch{}finally{n?.close()}z({command:L()??`scip-query ${process.argv.slice(2).join(" ")}`,toolVersion:m,projectFingerprint:e})}async function jt(){try{process.argv.includes("--help-all")?process.stdout.write(O(d,N,{includeCompatibility:!0})):await d.parseAsync()}finally{f?.(),f=void 0}}w&&await ke(jt);function Dt(){if(!process.argv[1])return!1;let e=St(import.meta.url);try{return Te(e)===Te(process.argv[1])}catch{return e===process.argv[1]}}export{d as program,$e as renderHeuristicNotice,jt as runCli};
8
8
  //# sourceMappingURL=cli-main.js.map
@@ -0,0 +1,2 @@
1
+ import{b as a,c as b}from"./chunk-2M2LSIMY.js";import"./chunk-GHNPACNP.js";import"./chunk-6MFXCMZC.js";import"./chunk-RVZC6TJE.js";import"./chunk-POBJ6FR2.js";import"./chunk-HAXXKRTD.js";import"./chunk-AADQLOQ4.js";import"./chunk-MTDBHTSF.js";import"./chunk-HX4X7KG3.js";import"./chunk-NJGKXKQF.js";import"./chunk-FI7VGOR4.js";import"./chunk-WRQXLNYE.js";import"./chunk-L7KTFEAV.js";import"./chunk-2USA3S3P.js";import"./chunk-YUKYB54I.js";import"./chunk-BJT7LSPK.js";import"./chunk-2VAHDDLM.js";import"./chunk-YXPUP5G2.js";import"./chunk-BL6DCHQP.js";import"./chunk-ATXPTSEI.js";import"./chunk-CKBUBRYD.js";import"./chunk-IW5XQG5G.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import"./chunk-7HXT6YLU.js";import"./chunk-7F45LJKI.js";export{a as code,b as codeBatch};
2
+ //# sourceMappingURL=code-TAVIKWJI.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e}from"./chunk-ZKB2XUEN.js";import"./chunk-2USA3S3P.js";import"./chunk-2VAHDDLM.js";import"./chunk-YXPUP5G2.js";import"./chunk-BL6DCHQP.js";import"./chunk-ATXPTSEI.js";import"./chunk-CKBUBRYD.js";import"./chunk-IW5XQG5G.js";import"./chunk-H5EXS3HM.js";import"./chunk-HGFDYOVB.js";import"./chunk-7HXT6YLU.js";import"./chunk-7F45LJKI.js";export{d as codeBatchResultOnlyJson,e as codeBatchResultOnlyJsonForSelectors,c as codeResultOnlyJson,b as singleExactCodeResult,a as symbolResolutionJson};
2
+ //# sourceMappingURL=code-result-json-5FEFQCAQ.js.map