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
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{B as te,C as Ee}from"./chunk-V4NG5OMS.js";import{$d as j,$e as Te,Ad as X,Ae as xe,Bd as M,Be as ie,C as K,H as Re,Hd as k,Id as G,J as Ie,M as Q,Wa as ke,X as Y,Xd as Z,Y as C,Yd as ee,Z as be,Zd as R,_d as $,aa as w,af as qe,ba as Ce,ca as we,ha as A,kf as _e,u as v,we as re,xd as S,xe as Ae,ya as P,yd as We,ye as ne,zd as L,ze as Pe}from"./chunk-2BTJALUS.js";import{spawn as Tt}from"child_process";import{existsSync as qt,rmSync as Ue}from"fs";import{dirname as _t,resolve as z}from"path";import{fileURLToPath as Dt}from"url";import{createHash as gt,randomUUID as oe}from"crypto";import{existsSync as vt,linkSync as St,readdirSync as Rt,rmSync as W}from"fs";import{basename as It,dirname as bt,join as m}from"path";var I=1,Ct=10*6e4,wt=10080*6e4,F="requests",x="claims",N="completions",Oe="staging";function Le(e,t,r={}){let n=r.now?.()??new Date,i=Et(r.ttlMs),o=At(r.idempotencyKey),a=o?`key-${gt("sha256").update(o).digest("hex")}`:`request-${(r.randomId??oe)()}`,s={version:I,requestId:a,...o?{idempotencyKey:o}:{},createdAt:n.toISOString(),deadlineAt:new Date(n.getTime()+i).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},c=Fe(e,a),d=ae(e,c,s,r.onStage);if(d.published)return{disposition:"accepted",request:s,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let l=se(c);if(!l)throw new Error(`Watch refresh request identity ${a} exists but is malformed.`);return{disposition:"duplicate",request:l}}function sr(e,t={}){let r=t.now?.()??new Date,n=`claim-${(t.randomId??oe)()}`,i=Math.max(1,Math.floor(t.limit??64)),o=$e(e).sort(Pt),a=[];for(let s of o){if(a.length>=i)break;if(De(e,s.requestId))continue;if(Date.parse(s.deadlineAt)<=r.getTime()){Ge(e,{version:I,requestId:s.requestId,outcome:"expired",completedAt:r.toISOString()});continue}let c={version:I,requestId:s.requestId,claimId:n,claimedAt:r.toISOString()};if(ae(e,He(e,s.requestId),c).published){if(De(e,s.requestId)){je(e,s.requestId,n);continue}a.push(s)}}return{claimId:n,requests:a}}function ar(e,t,r=()=>new Date,n){let i=r().toISOString();for(let o of t.requests)Ge(e,{version:I,requestId:o.requestId,claimId:t.claimId,outcome:"completed",completedAt:i});n?.("after-completion"),kt(e,t),n?.("after-claim-release")}function kt(e,t){for(let r of t.requests)je(e,r.requestId,t.claimId)}function cr(e){let t=0;for(let r of b(m(e,x)))W(r,{force:!0}),t++;return t>0&&C(m(e,x)),Ne(e),t}function dr(e){let t=$e(e),r=new Map,n=Wt(m(e,F),se);for(let c of b(m(e,N))){let d=H(c);if(!d){n++;continue}r.set(d.requestId,d)}let i=new Set;for(let c of b(m(e,x))){let d=Me(c);if(!d){n++;continue}i.add(d.requestId)}let o=t.filter(c=>!r.has(c.requestId)&&!i.has(c.requestId)),a=[...r.values()].filter(c=>c.outcome==="completed").length,s=[...r.values()].filter(c=>c.outcome==="expired").length;return{pending:o.length,claimed:t.filter(c=>!r.has(c.requestId)&&i.has(c.requestId)).length,completed:a,expired:s,invalid:n,...o.length>0?{oldestPendingAt:o.map(c=>c.createdAt).reduce((c,d)=>xt(c,d))}:{}}}function lr(e,t={}){let r=(t.now?.()??new Date).getTime(),n=Math.max(0,t.retentionMs??wt),i=0;for(let o of b(m(e,N))){let a=H(o);!a||r-Date.parse(a.completedAt)<n||(W(o,{force:!0}),W(Fe(e,a.requestId),{force:!0}),i++)}return i>0&&(C(m(e,N)),C(m(e,F))),Ne(e),i}function se(e){return ce(e,t=>{let r=t;return r.version===I&&T(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&P(r.createdAt)&&P(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function Me(e){return ce(e,t=>{let r=t;return r.version===I&&T(r.requestId)&&T(r.claimId)&&P(r.claimedAt)})}function H(e){return ce(e,t=>{let r=t;return r.version===I&&T(r.requestId)&&(r.claimId===void 0||T(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&P(r.completedAt)})}function Ge(e,t){let r=Ve(e,t.requestId);if(ae(e,r,t).published)return;let n=H(r);if(!n||n.requestId!==t.requestId||n.outcome!==t.outcome)throw new Error(`Watch refresh completion ${t.requestId} conflicts with an existing record.`)}function ae(e,t,r,n){let i=m(e,Oe),o=bt(t),a=Y(i),s=Y(o),c=m(i,`${It(t)}.${process.pid}.${oe()}.tmp`);try{let d=G(c,r,{spacing:2,trailingNewline:!0});n?.("after-staged");try{St(c,t)}catch(u){if(u.code==="EEXIST")return{published:!1};throw u}let l=be(a,s,d.directorySync,C(o));return n?.("after-published"),{published:!0,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}finally{W(c,{force:!0})}}function $e(e){let t=[];for(let r of b(m(e,F))){let n=se(r);n&&t.push(n)}return t}function je(e,t,r){let n=He(e,t),i=Me(n);!i||i.claimId!==r||(W(n,{force:!0}),C(m(e,x)))}function Ne(e){for(let t of b(m(e,Oe),".tmp"))W(t,{force:!0})}function Wt(e,t){return b(e).filter(r=>!t(r)).length}function b(e,t=".json"){return vt(e)?Rt(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(t)).map(r=>m(e,r.name)).sort():[]}function ce(e,t){try{let r=JSON.parse(v(e,"watch refresh request record"));return t(r)?r:null}catch{return null}}function Fe(e,t){return m(e,F,`${t}.json`)}function He(e,t){return m(e,x,`${t}.json`)}function Ve(e,t){return m(e,N,`${t}.json`)}function De(e,t){return H(Ve(e,t))!==null}function Et(e){if(e===void 0)return Ct;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function At(e){let t=e?.trim();return t?t.slice(0,512):void 0}function T(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function Pt(e,t){return Date.parse(e.createdAt)-Date.parse(t.createdAt)||e.requestId.localeCompare(t.requestId)}function xt(e,t){return Date.parse(t)<Date.parse(e)?t:e}var Be=5e3,Ot=6e3,Lt=1e3,le=10,Mt=new Set(["capabilities","check-deps","config-validate","continue","doctor","init","install-skills","reindex","setup","setup-agent","status","suppress","uninstall","watch"]);function xr(e){let t=e.classification;if(t.kind!=="live")return;let{state:r}=t;return r.watcher.state==="idle"&&r.lastError===void 0?r.indexGeneration:void 0}function Gt(e,t=process.env){return t.SCIP_QUERY_SKIP_WATCH_SERVICE!=="1"&&!e.startsWith("__")&&!Mt.has(e)}function Tr(e){let t=e.env??process.env;if(t.SCIP_QUERY_SKIP_WATCH_SERVICE==="1")return{kind:"skipped",reason:"environment"};if(!Gt(e.commandName,t))return{kind:"skipped",reason:"excluded-command"};if(e.config.watch?.enabled!==!0)return{kind:"skipped",reason:"disabled"};if(e.config.watch.autoStart===!1)return{kind:"skipped",reason:"auto-start-disabled"};try{let r=$t({projectRoot:e.projectRoot,cacheDir:e.cacheDir,cliVersion:e.cliVersion,gitContext:e.gitContext,runtime:e.runtime});return{kind:r.disposition,state:r.state}}catch(r){return{kind:"failed",message:r instanceof Error?r.message:String(r)}}}function Qe(e,t,r){let n=Q(z(e));if(r&&Q(r.projectRoot)===n)return{projectRoot:n,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:t};let i=Re(n);if(i.kind==="error")throw new Error(`Could not establish Git worktree identity for ${n}: ${i.message}`);return i.kind==="non-git"?{projectRoot:n,worktreeKind:"non-git",cliVersion:t}:{projectRoot:n,worktreeKind:"git",worktreeId:i.identity.worktreeId,cliVersion:t}}function qr(e){return U(e,Qe(e.projectRoot,e.cliVersion,e.gitContext))}function U(e,t){let r=e.runtime??fe,n=R(e.cacheDir),i=$(n.statePath),o=he(n.lockPath);return{identity:t,classification:jt(i,t,r.now(),r.isProcessAlive),lock:o,lockIsLive:o!==null&&r.isProcessAlive(o.pid),paths:n}}function $t(e){let t=e.runtime??fe,r=Qe(e.projectRoot,e.cliVersion,e.gitContext),n=U(e,r),i=ue("ensure",n.classification);if(i.kind==="reuse")return V(n.paths.activityPath,t),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${i.state.pid} is still alive but its heartbeat is old. Refusing automatic replacement because civil-clock age alone cannot authorize a process signal.`);if(i.kind==="replace")pe(i.state,e,t),q(n.paths,i.state.pid,t);else if(i.kind==="start"){if(n.lockIsLive){let s=ze(e,r,t,Math.min(e.startupTimeoutMs??1e3,1e3));if(s)return V(n.paths.activityPath,t),{disposition:"reused",state:s};throw new Error(`scip-query watch is already running for ${z(e.projectRoot)} (pid ${n.lock?.pid}; lock: ${n.paths.lockPath}) without compatible daemon state. Stop the foreground watcher before starting the service.`)}n.classification.kind==="stale"&&q(n.paths,n.classification.state.pid,t)}else throw new Error(`Unexpected ensure action: ${i.kind}`);if(n=U(e,r),i=ue("ensure",n.classification),i.kind==="reuse")return V(n.paths.activityPath,t),{disposition:"reused",state:i.state};if(i.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${i.state.pid} remains alive with an old heartbeat; automatic replacement is not authorized.`);let o=e.serverPath??Dt(new URL("./watch-server.js",import.meta.url));t.spawnServer(o,r.projectRoot,e.cliVersion,e.watchOverrides??{});let a=ze(e,r,t,e.startupTimeoutMs??Be);if(!a)throw new Error(`scip-query watch service did not become ready within ${e.startupTimeoutMs??Be}ms.`);return V(n.paths.activityPath,t),{disposition:"started",state:a}}function Ye(e){let t=e.runtime??fe,r=R(e.cacheDir),n=$(r.statePath),i=n?Je(n,t)?{kind:"live",state:n}:{kind:"stale",state:n,reason:"dead-process"}:{kind:"stopped"},o=ue("stop",i);if(o.kind==="signal-stop")return pe(o.state,e,t),q(r,o.state.pid,t),{disposition:"stopped",pid:o.state.pid};if(o.kind==="clean-stale")return q(r,o.state.pid,t),{disposition:"stopped",pid:o.state.pid};let a=he(r.lockPath);return o.kind==="already-stopped"&&a?(Je(a,t)&&pe(a,e,t),q(r,a.pid,t),{disposition:"stopped",pid:a.pid}):{disposition:"already-stopped"}}function _r(e,t,r={}){let{durability:n="durable",...i}=r;n==="durable"?G(e,t,i):k(e,t,i)}function Xe(e,t=Date.now()){k(e,{version:1,at:new Date(t).toISOString()})}function Dr(e,t,r=Date.now(),n={}){Le(R(_t(e)).refreshRequestsPath,t,{...n,now:()=>new Date(r)}),Xe(e,r)}function Or(e){try{let t=JSON.parse(v(e,"watch activity record"));return t.version!==1||!j(t.at)||t.refreshRequestedAt!==void 0&&!j(t.refreshRequestedAt)||t.refreshDetail!==void 0&&typeof t.refreshDetail!="string"?null:{atMs:Date.parse(t.at),...t.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(t.refreshRequestedAt)},...t.refreshDetail===void 0?{}:{refreshDetail:t.refreshDetail}}}catch{return null}}function Lr(e,t,r={}){let n=r.pid??process.pid,i=r.isProcessAlive??S,o=()=>{},a=r.readProcessIdentity??X,s=r.now??(()=>new Date),c={...re,wallNow:()=>s().getTime(),isProcessAlive:i,readProcessIdentity:a},d=Ae(e,{kind:"watch",pid:n,processIdentity:a(n),detail:{projectRoot:z(t)},parseLegacy:B,runtime:c});if(d.kind==="contended"){let l=Ze(d.observation);return{acquired:!1,lockPath:e,message:Nt(e,t,l),release:o}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function he(e){return Ze(ne(e,{parseLegacy:B}))}var B=e=>{let t=et(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function Ze(e){if(e.state==="valid"&&e.record?.kind==="watch"){let t=e.record.detail?.projectRoot;return typeof t!="string"?null:{version:1,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},projectRoot:t,startedAt:e.record.startedAt}}return et(e.parsed)}function et(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!j(t.startedAt))return null;let r=t.processIdentity===void 0?null:We(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,pid:t.pid,...r?{processIdentity:r}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function jt(e,t,r,n){if(!e)return{kind:"stopped"};if(e.protocolVersion!==Z)return{kind:"incompatible",state:e,reason:"protocol"};if(e.projectRoot!==t.projectRoot)return{kind:"incompatible",state:e,reason:"project"};let i=t.worktreeKind==="git"?t.worktreeId:void 0;if(e.worktreeId!==i)return{kind:"incompatible",state:e,reason:"worktree"};if(e.cliVersion!==t.cliVersion)return{kind:"incompatible",state:e,reason:"cli-version"};if(!n(e.pid))return{kind:"stale",state:e,reason:"dead-process"};let o=Date.parse(e.heartbeatAt);return r-o>ee?{kind:"stale",state:e,reason:"old-heartbeat"}:{kind:"live",state:e}}function ue(e,t){switch(e){case"status":return{kind:"report",classification:t};case"ensure":switch(t.kind){case"stopped":return{kind:"start"};case"stale":return t.reason==="old-heartbeat"?{kind:"refuse-replace",state:t.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:t.state};case"incompatible":return{kind:"replace",state:t.state};default:return de(t)}case"stop":switch(t.kind){case"stopped":return{kind:"already-stopped"};case"stale":return t.reason==="old-heartbeat"?{kind:"signal-stop",state:t.state}:{kind:"clean-stale",state:t.state};case"live":case"incompatible":return{kind:"signal-stop",state:t.state};default:return de(t)}default:return de(e)}}function Mr(e){return e.idleTimeoutMs===0||e.watcher.state!=="idle"?!1:e.nowMs-e.lastActivityAtMs>=e.idleTimeoutMs}function ze(e,t,r,n){let i=r.monotonicNow??M,o=i()+n;for(;i()<=o;){let a=U(e,t).classification;if(a.kind==="live")return a.state;r.sleep(le)}return null}function pe(e,t,r){let{pid:n}=e;if(!r.isProcessAlive(n))return;Ke(e,r),r.signalProcess(n);let i=t.stopTimeoutMs??Ot,o=r.monotonicNow??M,a=o()+i;for(;o()<=a;){if(!r.isProcessAlive(n))return;r.sleep(le)}if(!r.forceSignalProcess)throw new Error(`scip-query watch service pid ${n} did not stop within ${i}ms and forced termination is unavailable.`);Ke(e,r),r.forceSignalProcess(n);let s=t.forceStopTimeoutMs??Lt,c=o()+s;for(;o()<=c;){if(!r.isProcessAlive(n))return;let d=r.readProcessIdentity(n);if(e.processIdentity&&d&&!L(e.processIdentity,d))return;r.sleep(le)}throw new Error(`scip-query watch service pid ${n} remained alive ${s}ms after forced termination.`)}function q(e,t,r){if(Ue(e.statePath,{force:!0}),Ue(e.activityPath,{force:!0}),he(e.lockPath)?.pid===t){let i={...re,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},o=ne(e.lockPath,{parseLegacy:B,runtime:i});Pe(e.lockPath,o,{parseLegacy:B,runtime:i})}}function Je(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||L(e.processIdentity,r)}function Nt(e,t,r){return`error: scip-query watch is already running for ${z(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}function V(e,t){try{(t.recordActivity??Xe)(e,t.now())}catch(r){let n=Ft(r);if(n!=="EPERM"&&n!=="EACCES"&&n!=="EROFS")throw r}}function Ft(e){return e.code}var fe={now:Date.now,monotonicNow:M,isProcessAlive:S,readProcessIdentity:X,spawnServer(e,t,r,n){if(!qt(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);Tt(process.execPath,[e,t,r,JSON.stringify(n)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function Ke(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its ownership record has no process identity.`);let r=t.readProcessIdentity(e.pid);if(!r)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity is unavailable.`);if(!L(e.processIdentity,r))throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity does not match the ownership record.`)}function de(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}import{existsSync as J,lstatSync as _,readdirSync as nt,realpathSync as tt,rmSync as E,statSync as it}from"fs";import{join as p,resolve as D,sep as ot}from"path";var Ht=3600*1e3,Vt=2*1024*1024*1024,st=300*1e3,Ut="gc-state.json",Bt="gc.lock";function zt(e){let t=e.leases.filter(s=>s.managed&&!s.live&&!s.busy),r=at(e.leases,e.locks),n={};for(let s of e.generations)r.has(s.generationId)||(n[s.generationId]=s.unreferencedAt??e.nowMs);let i=e.generations.filter(s=>!r.has(s.generationId)).sort((s,c)=>n[s.generationId]-n[c.generationId]||s.generationId.localeCompare(c.generationId)),o=new Set;for(let s of i)e.nowMs-n[s.generationId]>=e.policy.generationTtlMs&&o.add(s.generationId);let a=e.generations.filter(s=>!o.has(s.generationId)).reduce((s,c)=>s+c.size,0);for(let s of i){if(a<=e.policy.budgetBytes)break;o.has(s.generationId)||(o.add(s.generationId),a-=s.size)}for(let s of o)delete n[s];return{deleteWorktrees:t,deleteGenerations:e.generations.filter(s=>o.has(s.generationId)),deleteLocks:e.locks.filter(s=>!s.live),deleteTemporaries:e.temporaries.filter(s=>!s.live),protectedGenerationIds:[...r].sort(),unreferencedSince:n}}function at(e,t){let r=new Set(e.filter(n=>n.managed&&(n.live||n.busy)).flatMap(n=>[n.lease.baseGenerationId,n.lease.activeGenerationId]).filter(n=>n!==void 0));for(let n of t)n.live&&r.add(n.generationId);return r}function Xr(e,t,r={}){if(!we())return{kind:"disabled"};let n=r.repositoryId===void 0?K(e)?.repositoryId:r.repositoryId;if(!n)return{kind:"unavailable"};let i=p(w(),"repositories",n),o=(r.now??Date.now)(),a=J(i)?ct(e,i,n,t,o,r):{kind:"unavailable"};return Jt(e,n,t,o,r),a}function ct(e,t,r,n,i,o){let a=p(t,"gc-state.json"),s=lt(a);if(!o.force&&s&&i-Date.parse(s.lastSweepAt)<st)return{kind:"throttled",sweptAt:s.lastSweepAt};let c=xe(t,{now:()=>i});if(!c)return{kind:"busy"};try{let d=dt(e,t,r,s?.unreferencedSince??{}),l=zt({nowMs:i,...d,policy:{generationTtlMs:o.policy?.generationTtlMs??Ht,budgetBytes:o.policy?.budgetBytes??Vt}}),u=0,f=0;for(let h of l.deleteWorktrees){if(!ge(h.lease))continue;if(!J(h.lease.localCacheDir)){E(h.leasePath,{force:!0}),f+=1;continue}if(!Qt(h.lease))continue;let Se=ie(p(h.lease.localCacheDir,"cache-lifecycle.lock"));if(Se)try{if(me(h.lease,!0))continue;try{Ye({projectRoot:h.lease.projectRoot,cacheDir:h.lease.localCacheDir,cliVersion:n})}catch{continue}if(me(h.lease,!0))continue;E(h.lease.localCacheDir,{recursive:!0,force:!0}),E(h.leasePath,{force:!0}),f+=1}finally{Se.release()}}for(let h of l.deleteLocks)E(h.path,{force:!0});for(let h of l.deleteTemporaries)E(h.path,{recursive:!0,force:!0});for(let h of l.deleteGenerations)E(h.path,{recursive:!0,force:!0}),u+=h.size;ke(p(t,"evidence.db"));let g={kind:"swept",sweptAt:new Date(i).toISOString(),deletedWorktrees:f,deletedGenerations:l.deleteGenerations.length,deletedBytes:u,protectedGenerations:l.protectedGenerationIds.length},y={version:1,lastSweepAt:g.sweptAt,unreferencedSince:l.unreferencedSince,lastResult:g};return k(a,y,{spacing:2,trailingNewline:!0}),g}catch(d){return{kind:"failed",error:d instanceof Error?d.message:String(d)}}finally{c.release()}}function Jt(e,t,r,n,i){let o=p(w(),"repositories");if(!J(o))return;let a=p(o,Ut),s=Xt(a);if(!i.force&&s!==void 0&&n-s<st)return;let c=ie(p(o,Bt));if(c)try{for(let d of O(o)){if(d===t||!/^[a-f0-9]{24}$/.test(d))continue;let l=p(o,d),u;try{u=_(l)}catch{continue}if(!u.isDirectory()||u.isSymbolicLink())continue;let f=Yt(l)??e;ct(f,l,d,r,n,i)}k(a,{version:1,lastSweepAt:new Date(n).toISOString()},{spacing:2,trailingNewline:!0})}finally{c.release()}}function Zr(e,t,r){let n=Te(e,r.dbPath,t);if(n)return{state:"bypassed",reason:n,localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let i=K(e);if(!i)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let o=p(w(),"repositories",i.repositoryId),a=ve(p(o,"worktrees",`${i.worktreeId}.json`)),s=lt(p(o,"gc-state.json")),c=dt(e,o,i.repositoryId,s?.unreferencedSince??{}),d=at(c.leases,c.locks),l=c.generations.filter(y=>!d.has(y.generationId)),u=c.generations.reduce((y,h)=>y+h.size,0),f=qe(e,t),g=0;return f&&(g=Kt(f)),{state:"managed",repositoryId:i.repositoryId,worktreeId:i.worktreeId,localCacheDir:r.cacheDir,...a?{baseGenerationId:a.baseGenerationId,activeGenerationId:a.activeGenerationId,lastAction:a.lastAction,reason:a.lastReason,lastSeenAt:a.lastSeenAt}:{},generations:c.generations.length,generationBytes:u,protectedGenerations:c.generations.filter(y=>d.has(y.generationId)).length,unreferencedGenerations:l.length,unreferencedBytes:l.reduce((y,h)=>y+h.size,0),temporaryGenerations:c.temporaries.length,sharedEvidence:{path:f,exists:g>0,bytes:g},cleanup:s?.lastResult}}function Kt(e){return[e,`${e}-wal`,`${e}-shm`].reduce((t,r)=>{try{return t+it(r).size}catch{return t}},0)}function dt(e,t,r,n){let i=new Set(Ie(e).map(d=>D(d.path))),o=[];for(let d of O(p(t,"worktrees"))){if(!d.endsWith(".json"))continue;let l=p(t,"worktrees",d),u=ve(l);if(!u)continue;let f=D(u.projectRoot);o.push({leasePath:l,lease:u,managed:u.repositoryId===r&&ge(u),live:i.has(f)||J(f),busy:me(u)})}let a=[];for(let d of O(p(t,"locks"))){let l=/^([a-f0-9]{64})\.lock$/.exec(d);if(!l)continue;let u=p(t,"locks",d),f=ye(u),g=f!==void 0&&S(f),y=l[1];a.push({generationId:y,path:u,live:g})}let s=[],c=[];for(let d of O(p(t,"generations"))){let l=/^\.tmp-(\d+)-/.exec(d);if(l){let g=p(t,"generations",d),y=Number(l[1]);try{c.push({path:g,size:rt(g),live:Number.isSafeInteger(y)&&S(y)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(d))continue;let u=p(t,"generations",d),f;try{f=_(u)}catch{continue}!f.isDirectory()||f.isSymbolicLink()||s.push({generationId:d,path:u,size:rt(u),...n[d]===void 0?{}:{unreferencedAt:n[d]}})}return{leases:o,generations:s,locks:a,temporaries:c}}function ge(e){if(e.ownershipChecksum!==_e(e)||A(e.localCacheDir)!==A(Ce(e.projectRoot)))return!1;let t=A(p(w(),"projects"));return A(e.localCacheDir).startsWith(`${t}${ot}`)}function Qt(e){if(!ge(e))return!1;let t=D(w()),r=D(p(t,"projects")),n=D(e.localCacheDir);try{let i=_(t),o=_(r),a=_(n);if(!i.isDirectory()||i.isSymbolicLink()||!o.isDirectory()||o.isSymbolicLink()||!a.isDirectory()||a.isSymbolicLink())return!1;let s=tt(r);return tt(n).startsWith(`${s}${ot}`)}catch{return!1}}function Yt(e){for(let t of O(p(e,"worktrees"))){if(!t.endsWith(".json"))continue;let r=ve(p(e,"worktrees",t));if(r)return r.projectRoot}}function me(e,t=!1){for(let n of t?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let i=ye(p(e.localCacheDir,n));if(i!==void 0&&S(i))return!0}let r=ye(R(e.localCacheDir).lockPath);return r!==void 0&&S(r)}function ve(e){try{let t=JSON.parse(v(e,"worktree cache lease"));return t.version!==1||typeof t.repositoryId!="string"||typeof t.worktreeId!="string"||typeof t.projectRoot!="string"||t.treeOid!==void 0&&typeof t.treeOid!="string"||typeof t.localCacheDir!="string"||t.baseGenerationId!==void 0&&typeof t.baseGenerationId!="string"||t.activeGenerationId!==void 0&&typeof t.activeGenerationId!="string"||typeof t.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(t.ownershipChecksum)||typeof t.lastAction!="string"||t.lastReason!==void 0&&typeof t.lastReason!="string"||typeof t.lastSeenAt!="string"?null:t}catch{return null}}function ye(e){try{let t=JSON.parse(v(e,"watch lock record"));return typeof t.pid=="number"&&Number.isSafeInteger(t.pid)&&t.pid>0?t.pid:void 0}catch{return}}function lt(e){try{let t=JSON.parse(v(e,"repository cache GC state"));return t.version!==1||typeof t.lastSweepAt!="string"||!Number.isFinite(Date.parse(t.lastSweepAt))||!t.unreferencedSince||typeof t.unreferencedSince!="object"||!t.lastResult?null:t}catch{return null}}function Xt(e){try{let t=JSON.parse(v(e,"global repository cache GC state"));if(t.version!==1||typeof t.lastSweepAt!="string")return;let r=Date.parse(t.lastSweepAt);return Number.isFinite(r)?r:void 0}catch{return}}function O(e){try{return nt(e)}catch{return[]}}function rt(e){let t=0,r=[e];for(;r.length>0;){let n=r.pop();for(let i of nt(n,{withFileTypes:!0})){let o=p(n,i.name);i.isDirectory()?r.push(o):i.isFile()&&(t+=it(o).size)}}return t}var ut=[{question:"Who can call or reach this?",family:"execution",direction:"incoming"},{question:"What can this call or reach?",family:"execution",direction:"outgoing"},{question:"Where can this value come from?",family:"dataflow",direction:"incoming"},{question:"Where can this value go?",family:"dataflow",direction:"outgoing"},{question:"Which producer and consumer rendezvous?",family:"runtime",direction:"both"},{question:"What resource is observed or changed?",family:"state",direction:"both"},{question:"What occurs before or after this?",family:"temporal",direction:"both"},{question:"What interface constrains this?",family:"contract",direction:"both"},{question:"Are these observations the same entity?",family:"identity",direction:"both"},{question:"What contains or owns this?",family:"ownership",direction:"both"},{question:"What does this statically rely on?",family:"dependencies",direction:"outgoing"}],pt={execution:{establishes:"Static may-call reachability between resolved program constructs.",nonClaims:["A may-call edge does not prove that a runtime invocation occurred."]},runtime:{establishes:"A source-grounded handoff between producer and consumer participants through a runtime mechanism.",nonClaims:["An unresolved or candidate join does not prove a runtime handoff."]},dataflow:{establishes:"A value, definition, argument, parameter, return, or statically resolved value may flow to another construct.",nonClaims:["Current partial providers do not establish general interprocedural definition-use coverage."]},state:{establishes:"A construct reads, writes, creates, deletes, or otherwise changes an identified state resource.",nonClaims:["A state edge does not prove transactionality, durability, or exclusive ownership unless qualified."]},temporal:{establishes:"One observed construct is locally ordered before or after another under the reported source evidence.",nonClaims:["Source order does not imply cross-process happens-before or durability."]},contract:{establishes:"A program construct implements, constrains, or is typed by an identified contract.",nonClaims:["Contract identity does not prove runtime invocation or conformance outside reported checks."]},identity:{establishes:"Two observations refer to the same compiler-owned or source-owned program entity.",nonClaims:["Shared identity does not establish execution or value transfer."]},ownership:{establishes:"A source construct, symbol, runtime observation, or state resource is contained or owned by another program entity.",nonClaims:["Structural ownership does not establish lifetime, singleton scope, or runtime execution unless qualified."]},dependencies:{establishes:"A file, module, or symbol statically relies on another indexed entity.",nonClaims:["A dependency edge does not establish that the depended-on code executes."]}};function ht(e){return te.flatMap(t=>t.relations.filter(r=>r.family===e).map(r=>({...r,providerId:t.id,providerLabel:t.label})))}function ft(e){return[...new Set(te.filter(t=>t.relations.some(r=>r.family===e)).map(t=>t.label))]}var nn=Ee.map(e=>({family:e,...pt[e],providers:ft(e),relations:ht(e)}));function mt(e){return{family:e,...pt[e],providers:ft(e),relations:ht(e)}}var an=["search","outline","entrypoints","evidence","inspect","code"];function cn(){return ut.map(e=>{let t=mt(e.family);return{...e,establishes:t.establishes,evidenceStrengths:yt(t.relations.flatMap(r=>r.evidenceStrengths)),supportCeilings:yt(t.relations.map(r=>r.supportCeiling)),nonClaim:t.nonClaims.join(" ")}})}function yt(e){return[...new Set(e)]}export{nn as a,Le as b,sr as c,ar as d,kt as e,cr as f,dr as g,lr as h,xr as i,Gt as j,Tr as k,Qe as l,qr as m,$t as n,Ye as o,_r as p,Dr as q,Or as r,Lr as s,he as t,Mr as u,st as v,Xr as w,Zr as x,an as y,cn as z};
3
- //# sourceMappingURL=chunk-A77SCPW2.js.map
@@ -1,5 +0,0 @@
1
- import{isAbsolute as Qe,relative as hn}from"path";var g=class extends Error{constructor(n,r){super(`refusing unsafe project file path ${JSON.stringify(n)} (${r})`);this.relativePath=n;this.reason=r;this.name="UnsafeProjectPathError"}relativePath;reason;code="SCIP_QUERY_UNSAFE_PROJECT_PATH"};function me(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Ii(e){return e.replace(/\\/g,"/")}function Ri(e,t){return me(e)===me(t)}function b(e,t){let n=hn(e,t);return n===""||!n.startsWith("..")&&!Qe(n)}function E(e){if(!e)throw new g(e,"empty-path");if(e.includes("\0"))throw new g(e,"nul-byte");if(Qe(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new g(e,"absolute-path");let t=me(e);if(t.split("/").some(r=>r===".."))throw new g(e,"parent-traversal");if(!t||t===".")throw new g(e,"empty-path");return t}import{createHash as lt,randomUUID as Tn}from"crypto";import{chmodSync as ft,existsSync as L,linkSync as On,lstatSync as oe,readdirSync as xe,realpathSync as F,unlinkSync as _n,writeSync as Bn}from"fs";import{homedir as Dn}from"os";import{basename as Ln,dirname as se,isAbsolute as at,join as y,resolve as ce}from"path";import{closeSync as mn,existsSync as yn,fsyncSync as Sn,mkdirSync as bn,openSync as Pn}from"fs";import{dirname as Ze}from"path";function Q(e,t,n,r){let i=0;for(;i<t.length;){let o=n.writeFile(e,t,i,t.length-i);if(!Number.isSafeInteger(o)||o<=0||o>t.length-i)throw new Error(`${r} write did not make valid forward progress`);i+=o}}function ye(e,t){if(t!=="win32")return!1;let n=e.code;return n==="EACCES"||n==="EBADF"||n==="EINVAL"||n==="EISDIR"||n==="EPERM"}var W=Object.freeze({platform:process.platform,pathExists:e=>yn(e),makeDirectory:e=>bn(e,{recursive:!0}),openFile:(e,t,n)=>Pn(e,t,n),syncFile:e=>Sn(e),closeFile:e=>mn(e)});function et(e,t=W){let n=[],r=e;for(;!t.pathExists(r);){n.push(r);let o=Ze(r);if(o===r)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);r=o}let i="synced";for(let o of n.reverse())t.makeDirectory(o),i=ee(i,Z(Ze(o),t));return i}function Z(e,t=W){let n;try{n=t.openFile(e,"r")}catch(r){if(ye(r,t.platform))return"unsupported";throw r}try{t.syncFile(n)}catch(r){try{t.closeFile(n)}catch{}if(ye(r,t.platform))return"unsupported";throw r}return t.closeFile(n),"synced"}function ee(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{createRequire as jn}from"module";var xn=jn(import.meta.url),tt=Fn().version;function Fn(){for(let e of["../package.json","../../package.json"])try{return xn(e)}catch{}return{version:"0.0.0"}}import{closeSync as Se,fstatSync as te,openSync as be,readFileSync as Cn,readSync as nt}from"fs";import{createHash as wn}from"crypto";var rt=8*1024*1024,it=64*1024*1024,kn=512*1024*1024,En=256*1024*1024,I=class extends Error{constructor(n,r,i,o,s){let c=i==="too-large"?`is ${o} bytes; the safety limit is ${s} bytes`:i==="not-regular"?"is not a regular file":"changed while it was being read";super(`${n} ${JSON.stringify(r)} ${c}`);this.inputKind=n;this.inputPath=r;this.reason=i;this.observedBytes=o;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="SCIP_QUERY_BOUNDED_FILE_READ"};function ne(e,t){T(t.maxBytes);let n=String(e),r=be(e,"r");try{let i=te(r);ct(i,t,n);let o=Cn(r),s=te(r);if(s.dev!==i.dev||s.ino!==i.ino||s.size!==i.size||o.byteLength!==i.size)throw new I(t.inputKind,n,"changed-during-read",s.size,t.maxBytes);return o}finally{Se(r)}}function Pe(e,t,n="utf8"){return ne(e,t).toString(n)}function H(e,t){return Pe(e,{maxBytes:rt,inputKind:t})}function In(e,t){return Pe(e,{maxBytes:it,inputKind:t})}function ot(e,t){T(t.maxBytes);let n=[],r=Buffer.allocUnsafe(64*1024),i=0;for(;;){let o=nt(e,r,0,r.length,null);if(o===0)break;if(i+=o,!Number.isSafeInteger(i)||i>t.maxBytes)throw new I(t.inputKind,`file descriptor ${e}`,"too-large",i,t.maxBytes);n.push(Buffer.from(r.subarray(0,o)))}return Buffer.concat(n,i)}function st(e,t){let n=be(e,"r");try{return ot(n,t)}finally{Se(n)}}function Rn(e,t,n="utf8"){return st(e,t).toString(n)}function re(e,t,n){T(t.maxBytes);let r=String(e),i=be(e,"r");try{let o=te(i);ct(o,t,r);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,o.size))),c=0;for(;c<o.size;){let u=nt(i,s,0,Math.min(s.length,o.size-c),c);if(u===0)break;n(s.subarray(0,u)),c+=u}let a=te(i);if(a.dev!==o.dev||a.ino!==o.ino||a.size!==o.size||c!==o.size)throw new I(t.inputKind,r,"changed-during-read",a.size,t.maxBytes);return c}finally{Se(i)}}function vn(e,t){let n=wn("sha256");return re(e,t,r=>n.update(r)),n.digest("hex")}function ct(e,t,n){if(!e.isFile())throw new I(t.inputKind,n,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new I(t.inputKind,n,"too-large",Number(e.size),t.maxBytes)}function T(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}var pt=1,U=".scip-query-cache-owner.json",An=16*1024,dt=Object.freeze({...W,randomToken:()=>Tn(),linkFile:(e,t)=>On(e,t),removeFile:e=>_n(e),writeFile:(e,t,n,r)=>Bn(e,t,n,r)});function ie(e,t){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${t}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"SCIP_QUERY_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function C(e,t){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${t}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"SCIP_QUERY_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function Nn(e,t){let n=F(e);return Mn(n,Fe(n,t))}function Fe(e,t){let n=F(e),r=process.env.SCIP_QUERY_CACHE_DIR;return r?ce(r):t?.dbPath?Wn(n,t.dbPath):Gn(n)}function gt(){let e=process.env.XDG_CACHE_HOME;return y(e||y(Dn(),".cache"),"scip-query")}function Gn(e){let t=ce(e);try{t=F(t)}catch{}let n=lt("sha256").update(t).digest("hex").slice(0,12);return y(gt(),"projects",n)}function eo(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=y(gt(),"repositories",e);return yt(t),F(t)}function to(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function no(e,t){let n=Nn(e,t);return{cacheDir:n,dbPath:y(n,"index.db"),indexPath:y(n,"index.scip"),metaPath:y(n,"meta.json")}}function Mn(e,t,n=dt){return zn(e,t,n).cacheDir}function zn(e,t,n=dt){let r=F(e),i=L(t)?"synced":yt(t,n),o=F(t),s=y(o,U);if(L(s))return je(r,o),Ce(s),$(o),{kind:"existing",cacheDir:o};ut(o),qn(o),ut(o);let a=`${JSON.stringify({schemaVersion:pt,canonicalProjectRoot:r,canonicalCacheDir:o,creatorVersion:tt},null,2)}
2
- `;try{let u=Kn(s,a,n),f=ee(i,u);return{kind:"published",cacheDir:o,achievedDurability:f==="synced"?"directory-durable":"file-flushed",directorySync:f}}catch(u){if(Xn(u))return je(r,o),{kind:"existing",cacheDir:o};throw u}}function je(e,t){let n=F(e),r=F(t);return $n(r,n,r)}function ro(e,t){return L(y(t,U))?(je(e,t),ht(t),!0):!1}function Wn(e,t){let n;try{n=E(t)}catch(s){throw s instanceof g?ie(t,s.reason):s}let r=ce(e,...n.split("/"));if(r===e||!b(e,r))throw ie(t,"outside-project");let i=Hn(r),o=F(i);if(!b(e,o)&&o!==e)throw ie(t,"symlink-escape");return r}function Hn(e){let t=e;for(;!L(t);){let n=se(t);if(n===t)throw ie(e,"no-existing-ancestor");t=n}return t}function $n(e,t,n){let r=y(e,U);if(!L(r)||oe(r).isSymbolicLink())throw C(e,"missing regular ownership record");let i=oe(r);if(!i.isFile()||i.size>An)throw C(e,"invalid ownership record file");let o=H(r,"cache ownership record"),s=Un(o,e);if(t!==void 0&&s.canonicalProjectRoot!==t)throw C(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==n)throw C(e,"ownership record names a different cache directory");return{record:s,ownerSha256:lt("sha256").update(o).digest("hex"),physicalCacheDir:e}}function Un(e,t){try{let n=JSON.parse(e);if(n.schemaVersion!==pt||typeof n.canonicalProjectRoot!="string"||typeof n.canonicalCacheDir!="string"||typeof n.creatorVersion!="string"||!at(n.canonicalProjectRoot)||!at(n.canonicalCacheDir))throw new Error("invalid fields");return n}catch(n){throw C(t,`malformed ownership record: ${n instanceof Error?n.message:String(n)}`)}}function ut(e){let t=xe(e).filter(n=>n!==U&&!Jn(n));if(t.length>0)throw C(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function Jn(e){return e.startsWith(`${U}.tmp-`)||e.startsWith("git-worktree-context.json.tmp-")||[".scipquery-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","git-worktree-context.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","typescript-shard-costs.json","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function qn(e){for(let t of xe(e)){let n=y(e,t);try{let r=oe(n);if(r.isSymbolicLink())throw C(e,`legacy cache entry ${t} is a symlink`);if(r.isDirectory())$(n);else if(r.isFile())Ce(n);else throw C(e,`legacy cache entry ${t} is not a file or directory`)}catch(r){if(mt(r))continue;throw r}}$(e)}function ht(e,t=!1){try{let n=oe(e);if(n.isSymbolicLink())throw C(e,"managed cache tree contains a symlink");if(n.isFile()){Ce(e);return}if(!n.isDirectory())throw C(e,"managed cache tree contains a special file");$(e);for(let r of xe(e))ht(y(e,r),!0)}catch(n){if(t&&mt(n))return;throw n}}function mt(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function yt(e,t=W){let n=et(e,t);return $(e),n}function Kn(e,t,n){let r=`${e}.tmp-${process.pid}-${n.randomToken()}`,i,o=!1;try{i=n.openFile(r,"wx",384),o=!0,Q(i,Buffer.from(t),n,"cache ownership record"),n.syncFile(i),n.closeFile(i),i=void 0,n.linkFile(r,e);let s=Z(se(e),n);return n.removeFile(r),o=!1,ee(s,Z(se(e),n))}finally{if(i!==void 0)try{n.closeFile(i)}catch{}if(o)try{n.removeFile(r)}catch{}}}function $(e){process.platform!=="win32"&&ft(e,448)}function Ce(e){process.platform!=="win32"&&ft(e,384)}function Yn(e){if(L(e))return F(e);let t=F(se(e));return y(t,Ln(e))}function io(e){return Yn(ce(e))}function Xn(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{spawnSync as Qn}from"child_process";import{createHash as Zn}from"crypto";import{existsSync as er,lstatSync as tr,realpathSync as nr}from"fs";import{dirname as rr,isAbsolute as ir,join as or,relative as fo,resolve as ue,sep as po}from"path";var St=Symbol.for("scip-query.project-file-listing-context.v1"),bt=globalThis,we=bt[St],R=we&&typeof we=="object"?we:{};bt[St]=R;function Pt(e,t){let n=R.active?R.canonicalProjectRoots:void 0,r=n?.get(e);if(r!==void 0)return r;let i=t();return n?.set(e,i),i}function jt(){return R.sequence??0}function xt(e,t,n){let r=R.active,i=r?.get(e);if(i&&i.pathBytes<=t)return i;let o=Vn(n(),(R.sequence??0)+1);if(R.sequence=o.sequence,o.pathBytes>t)throw new RangeError(`Git project file listing exceeded ${t} path bytes.`);return r?.set(e,o),o}function Ft(e,t){let n=R.active?.get(e);return n&&n.sequence>t?n.indexAllowsTreeFingerprintReuse:void 0}function*Ct(e){let t=0;for(;t<e.taggedOutput.length;){let n=e.taggedOutput.indexOf("\0",t);if(n<0)return;yield e.taggedOutput.slice(t+2,n),t=n+1}}function Vn(e,t){let n=0,r=0,i=!0;for(;n<e.length;){let o=e.indexOf("\0",n);if(o<0||o<=n+2||e[n+1]!==" ")throw new Error("Git returned a malformed tagged project file listing.");let s=e[n];i&&=s==="H"||s==="?",r+=1,n=o+1}return{taggedOutput:e,pathBytes:Buffer.byteLength(e,"utf8")-r*2,indexAllowsTreeFingerprintReuse:i,sequence:t}}var v={run(e,t){let n=kt(e,t);return n.kind==="success"?n.output:void 0},runResult:kt},sr=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],Ie=["status","--porcelain=v2","--branch","-z","--untracked-files=all"],ke=/^[0-9a-f]{40,64}$/;function ho(e,t=v){return cr(e,t)?.context}function cr(e,t=v){let n=t.runResult(e,sr);if(n.kind==="success"){let i=ar(n.output);if(i){let o=ur(i,t);if(o)return wt(o)}}let r=lr(e,t);return r?wt(r):void 0}function mo(e,t=v){if(!e.headCommit)return;let n=t.run(e.projectRoot,Ie);if(n===void 0)return;let r=Re(n);if(!(!r?.headCommit||r.headCommit!==e.headCommit))return{...e,clean:r.clean}}function yo(e,t=v,n={}){let r=t===v&&n.cachedInventoryAfterSequence!==void 0?Ft(e,n.cachedInventoryAfterSequence):void 0;if(r!==void 0)return r;let i=t.run(e,["ls-files","-v","-z"]);return i===void 0?!1:i.split("\0").filter(Boolean).every(o=>o.startsWith("H "))}function wt(e){return{context:e,projectFileInventorySequence:jt()}}function Re(e){let t=e.split("\0").filter(Boolean),n=t.find(i=>i.startsWith("# branch.oid "))?.slice(13),r=n==="(initial)"?void 0:n;if(!(r!==void 0&&!ke.test(r))&&n!==void 0)return{headCommit:r,clean:t.every(i=>i.startsWith("# "))}}function ar(e){let t=e.split(`
3
- `).map(a=>a.trim());if(t.length!==5)return;let[n,r,i,o,s]=t;if(!n||!r||!i||!o||!s||!ke.test(o)||!ke.test(s))return;let c=w(n);return{root:c,gitDir:w(ae(c,r)),commonDir:w(ae(c,i)),headCommit:o,treeOid:s}}function ur(e,t){let n=t.run(e.root,Ie);if(n===void 0)return;let r=Re(n);return r?.headCommit!==e.headCommit?void 0:{...Et(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:ve("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.clean}}function lr(e,t){let n=fr(e,t);if(n.kind!=="worktree")return;let r=n.identity,i=r.projectRoot,o=t.run(i,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=w(ae(i,o)),c=Ee(t.run(i,["rev-parse","--verify","HEAD"])),a=Ee(t.run(i,["rev-parse","--verify","HEAD^{tree}"])),u=t.run(i,Ie);if(u===void 0)return;let f=Re(u);if(!(!f||f.headCommit!==c))return{...r,commonDir:s,repositoryId:ve("repository",s),headCommit:c,treeOid:a,clean:f.clean}}function fr(e,t=v){let n=t.runResult(e,["rev-parse","--show-toplevel"]);if(n.kind==="not-repository")return{kind:"non-git"};if(n.kind==="error")return n;let r=n.output.trim();if(!r)return{kind:"error",message:"Git returned an empty worktree root."};let i=w(r),o=t.run(i,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=w(ae(i,o));return{kind:"worktree",identity:Et(i,s)}}function Et(e,t){return{projectRoot:e,gitDir:t,worktreeId:ve("worktree",`${e}\0${t}`)}}function So(e,t=v){let n=t.run(e,["worktree","list","--porcelain","-z"]);return n===void 0?[]:pr(n)}function pr(e){let t=[],n;for(let r of e.split("\0")){if(r===""){n&&t.push(n),n=void 0;continue}let i=r.indexOf(" "),o=i<0?r:r.slice(0,i),s=i<0?"":r.slice(i+1);if(o==="worktree"){n&&t.push(n),n={path:w(s),detached:!1,bare:!1,prunable:!1,locked:!1};continue}n&&(o==="HEAD"?n.head=s:o==="branch"?n.branch=s:o==="detached"?n.detached=!0:o==="bare"?n.bare=!0:o==="prunable"?n.prunable=!0:o==="locked"&&(n.locked=!0))}return n&&t.push(n),t}function bo(e,t,n=v){return Ee(n.run(e,t))}function ae(e,t){return ir(t)?t:ue(e,t)}function w(e){try{return nr(e)}catch{return ue(e)}}function ve(e,t){return Zn("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function Ee(e){return e?.trim()||void 0}function kt(e,t){let n=Qn("git",["-C",e,...t],{encoding:"utf-8",env:{...process.env,LC_ALL:"C"},maxBuffer:52428800,stdio:["ignore","pipe","pipe"],timeout:3e4,killSignal:"SIGKILL"});if(n.status===0)return{kind:"success",output:n.stdout.trimEnd()};let i=(typeof n.stderr=="string"?n.stderr.trim():"")||n.error?.message||`git exited with status ${n.status??"unknown"}`,o=n.error?.code;return(/not a git repository/i.test(i)||o==="ENOENT"&&er(ue(e)))&&!dr(e)?{kind:"not-repository"}:{kind:"error",message:i}}function dr(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=ue(e);for(;;){try{return tr(or(t,".git")),!0}catch(r){let i=r.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let n=rr(t);if(n===t)return!1;t=n}}import{execFileSync as ti}from"child_process";import{isUtf8 as an}from"buffer";import{createHash as $e}from"crypto";import{closeSync as fn,fstatSync as q,lstatSync as Je,openSync as pn,readdirSync as ni,readFileSync as ri,readSync as un,readlinkSync as ii,realpathSync as Y}from"fs";import{isAbsolute as oi,join as qe,relative as si,resolve as ci,sep as ai}from"path";function fe(e,t,n=[]){let r=Te(e);if(Bt.has(r)||n.some(o=>le(r,o))||t.some(o=>Dt(r,o)))return"config";if(t.some(At)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return"ambient";let i=Lt(r);return t.some(o=>(Nt[o]??[]).includes(i))?"source":"other"}function _t(e,t,n){let r=Te(e);if(Bt.has(r)||n?.some(o=>le(r,o))||Dt(r,t)||At(t)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return!0;let i=Lt(r);return(Nt[t]??[]).includes(i)}function jo(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!Rt(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!Rt(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(gr)?null:t}function It(e){return{...e,files:e.files.map(({semanticHash:t,...n})=>n)}}function xo(e,t){return!e||!t?e===t:JSON.stringify(It(e))===JSON.stringify(It(t))}function Fo(e,t){let n=new Map((e?.files??[]).map(c=>[c.path,c])),r=new Map(t.files.map(c=>[c.path,c])),i=new Set([...n.keys(),...r.keys()]),o=[];for(let c of[...i].sort()){let a=n.get(c),u=r.get(c),f=fe(c,t.languages);!a&&u?o.push({kind:"added",path:c,inputKind:f,after:u}):a&&!u?o.push({kind:"deleted",path:c,inputKind:f,before:a}):a&&u&&(a.hash!==u.hash||a.size!==u.size)&&o.push({kind:"modified",path:c,inputKind:f,before:a,after:u})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(vt(e?.files??[])||vt(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(hr)&&s.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!mr(e,t):!0,uncertainty:[...s].sort()}}function Rt(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function vt(e){return new Set(e.map(t=>t.path)).size!==e.length}function gr(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function hr(e){return e.hash==="unreadable"||e.size<0}function mr(e,t){return Tt(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&Tt(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function Tt(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((i,o)=>i===r[o])}var Bt=new Set([".scipquery.json"]),yr={typescript:["tsconfig.json"],javascript:["package.json"],java:["pom.xml","build.gradle"],scala:["build.sbt"],kotlin:["build.gradle.kts"],rust:["Cargo.toml"],python:["pyproject.toml","setup.py"],ruby:["Gemfile"],go:["go.mod"],cpp:["CMakeLists.txt","Makefile"],c:["CMakeLists.txt","Makefile"],csharp:["*.csproj","*.sln"],vb:["*.vbproj","*.sln"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},Sr={typescript:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],javascript:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.json","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],java:["build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],scala:["plugins.sbt","build.properties"],kotlin:["pom.xml","build.gradle","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],rust:["Cargo.lock","rust-project.json","rust-toolchain","rust-toolchain.toml"],python:["setup.cfg","requirements*.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock"],ruby:["Gemfile.lock","gems.locked"],go:["go.sum","go.work","go.work.sum"],cpp:["compile_commands.json"],c:["compile_commands.json"],csharp:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],vb:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],dart:["pubspec.lock","analysis_options.yaml"],php:["composer.lock"],clojure:[]},Ot=new Map;function Dt(e,t){return yr[t].some(n=>le(e,n))||Sr[t].some(n=>le(e,n))}function le(e,t){let n=Te(t).replace(/^\.\//,"");if(!n)return!1;let r=e.split("/").at(-1)??e,i=n.includes("/")?e:r;if(!n.includes("*")&&!n.includes("?"))return i===n;let o=Ot.get(n);if(!o){let s=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),Ot.set(n,o)}return o.test(i)}function Te(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Lt(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function At(e){return e==="typescript"||e==="javascript"}var Nt={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs",".vue"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import{AsyncLocalStorage as br}from"async_hooks";var Pr=new br;function O(e,t){let n=pe(e);if(!n||n.missing.has(t))return;let r=n.files.get(t);if(r)return r;let i=n.readBaseFile?.(t);return i&&n.files.set(t,i),i}function _(e,t){let n=pe(e);if(n)return n.missing.has(t)?"missing":n.paths.includes(t)?"present":"missing"}function Gt(e,t){return pe(e)?.fingerprints.get(t)}function B(e){return pe(e)?.paths}function pe(e){let t=Pr.getStore();if(t)return t.projectRoot===w(e)?t:void 0}import{createRequire as jr}from"module";import{existsSync as xr,lstatSync as Mt,readdirSync as Fr,statSync as Cr}from"fs";import p from"path";var wr=jr(import.meta.url),zt=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]),kr=18003;function de(e,t=[]){let n=p.resolve(e),r=t.flatMap(a=>Rr(n,a));if(r.length>0)return Wt(n,$t(r));let i=Ir(n),o=$t(i),s=vr(n,o)?[n,...o]:o,c=s.length>0?s:[n];return Wt(n,c)}function Ut(e){return new Set(e.map(t=>t==="."?"tsconfig.json":`${t.replace(/\/$/u,"")}/tsconfig.json`))}function Jt(e){let t=e.split("/").at(-1)?.toLowerCase();return t?.startsWith("tsconfig")===!0&&t.endsWith(".json")}var Er=/^\.scipquery-compiler-shard-\d+\.tsconfig\.json$/;function Bo(e){return`.scipquery-compiler-shard-${e}.tsconfig.json`}function qt(e){return Er.test(e)}function Kt(e,t,n=[]){let r;try{r=wr("@ts-morph/common/dist/typescript.js")}catch{return null}let i=p.resolve(e),o=t==="workspace"?de(i,n):["."],s=new Set;for(let c of o){let a=c==="."?i:p.join(i,c),u=p.join(a,"tsconfig.json"),f=Or(r,i);if(!f.fileExists(u))return null;let l=r.readConfigFile(u,f.readFile);if(l.error)return null;let d=r.parseJsonConfigFileContent(l.config,f,a);if(d.errors.some(m=>m.code!==kr))return null;for(let m of d.fileNames){let h=p.resolve(m);b(i,h)&&s.add(p.relative(i,h).split(p.sep).join("/"))}}return s}function Do(e,t,n,r){let i=p.resolve(e),o=new Set(r);for(let c of n){let a=p.resolve(i,c);if(b(i,a))try{let u=Mt(a);if(u.isSymbolicLink()||u.isFile()&&!o.has(D(i,a)))return!1}catch{}}let s=t==="workspace"?de(i,n):["."];for(let c of s){let a=c==="."?i:p.join(i,c),u=p.join(a,"tsconfig.json");if(!Xt(i,u))continue;let f=D(i,u);if(!o.has(f))return!1;try{if(Mt(u).isSymbolicLink())return!1;let l=Vt(i,u);if(l.includes("extends")||l.includes("\\"))return!1}catch{return!1}}return!0}function Wt(e,t){return[...new Set(t.map(n=>D(e,n)))].sort((n,r)=>n.localeCompare(r))}function Ir(e){let t=B(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>zt.has(s)))return[];let o=p.join(e,...i.split("/"));return Ht(e,o)?[p.dirname(o)]:[]});let n=[],r=[e];for(;r.length>0;){let i=r.pop(),o;try{o=Fr(i,{withFileTypes:!0})}catch{continue}for(let s of o){let c=p.join(i,s.name);if(s.isDirectory()){!zt.has(s.name)&&!s.name.startsWith(".")&&r.push(c);continue}s.isFile()&&Ht(e,c)&&n.push(p.dirname(c))}}return n}function Rr(e,t){let n=t.trim();if(!n)return[];let r=p.resolve(e,n);if(!b(e,r))return[];let i=B(e);if(i){let o=D(e,r);if(i.includes(o)&&Oe(p.basename(r)))return[p.dirname(r)];let s=o==="."?"":`${o}/`;return i.some(c=>c.startsWith(s))?[r]:[]}try{let o=Cr(r);if(o.isDirectory())return[r];if(o.isFile()&&Oe(p.basename(r)))return[p.dirname(r)]}catch{return[]}return[]}function Ht(e,t){if(!Oe(p.basename(t)))return!1;let n=Yt(e,t);return n?p.basename(t)==="tsconfig.json"||"include"in n||"files"in n||"references"in n:!1}function Oe(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function $t(e){let t=[...new Set(e.map(n=>p.resolve(n)))].sort((n,r)=>n.localeCompare(r));return t.length<=1?t:t.filter(n=>!t.some(r=>r!==n&&Br(n,r)))}function vr(e,t){if(t.length===0||t.some(r=>p.resolve(r)===e))return!1;let n=p.join(e,"tsconfig.json");return Xt(e,n)&&Tr(e,n)}function Tr(e,t){let r=Yt(e,t)?.include;return Array.isArray(r)?r.some(i=>typeof i=="string"&&i.trim()!==""&&!i.startsWith("!")&&(i.includes("/")||i.includes("**")||!p.extname(i))):!1}function Yt(e,t){try{let n=JSON.parse(Vt(e,t));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function Xt(e,t){let n=D(e,t),r=_(e,n);return r?r==="present":xr(t)}function Vt(e,t){let n=D(e,t);if(B(e)){let i=O(e,n);if(!i)throw Object.assign(new Error(`Snapshot file ${n} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return H(t,"TypeScript project config")}function Or(e,t){let n=B(t);if(!n)return e.sys;let r=p.resolve(t),i=new Set(n),o=_r(r,n),s=e,c=a=>{let u=p.resolve(a);return b(r,u)?D(r,u):null};return{useCaseSensitiveFileNames:e.sys.useCaseSensitiveFileNames,fileExists(a){let u=c(a);return u===null?e.sys.fileExists(a):i.has(u)},readFile(a){let u=c(a);return u===null?e.sys.readFile(a):O(r,u)?.content.toString("utf8")},readDirectory(a,u,f,l,d){let m=p.resolve(a);return b(r,m)?s.matchFiles(m,u,f,l,e.sys.useCaseSensitiveFileNames,r,d,h=>o.get(p.resolve(h))??{files:[],directories:[]},h=>h):e.sys.readDirectory(a,u,f,l,d)}}}function _r(e,t){let n=new Map,r=new Map,i=o=>{n.has(o)||n.set(o,new Set),r.has(o)||r.set(o,new Set)};i(e);for(let o of t){let s=o.split("/"),c=e;for(let a=0;a<s.length-1;a+=1){let u=s[a];i(c),r.get(c).add(u),c=p.join(c,u),i(c)}n.get(c).add(s.at(-1))}return new Map([...n].map(([o,s])=>[o,{files:[...s].sort(),directories:[...r.get(o)??[]].sort()}]))}function D(e,t){let n=p.relative(e,t);return n?n.split(p.sep).join("/"):"."}function Br(e,t){let n=p.relative(e,t);return!!n&&!n.startsWith("..")&&!p.isAbsolute(n)}import{createHash as De}from"crypto";import{execFileSync as Qt}from"child_process";import{createRequire as Dr}from"module";var Lr=Dr(import.meta.url),Ar=/\.(?:[cm]?[jt]sx?)$/iu,Nr=/\.[jt]sx$/iu,Zt=/(?:^|\/)package\.json$/iu,J,_e=new Map;function en(e,t){if(!Le(e))return;let n=Gr();if(n)try{let r=typeof t=="string"?t:t.toString("utf8"),i=Nr.test(e)?n.LanguageVariant.JSX:n.LanguageVariant.Standard,o=n.createScanner(n.ScriptTarget.Latest,!1,i,r),s=De("sha256").update(`typescript-semantic-v1\0${i}\0`),c=!1,a=!1;for(;;){let u=o.scan();if(u===n.SyntaxKind.EndOfFileToken)break;if(u===n.SyntaxKind.WhitespaceTrivia)continue;if(u===n.SyntaxKind.NewLineTrivia){c&&(a=!0);continue}a&&s.update("line-break\0");let f=o.getTokenText();s.update(`${u}\0${Buffer.byteLength(f)}\0`).update(f).update("\0"),c=!0,a=!1}return s.digest("hex")}catch{return}}function Le(e){return Ar.test(e)}function Ae(e,t){if(Zt.test(e))try{let n=JSON.parse(typeof t=="string"?t:t.toString("utf8"));if(typeof n!="object"||n===null||Array.isArray(n))return;let{scripts:r,...i}=n;return De("sha256").update("typescript-package-json-v1\0").update(Be(i)).digest("hex")}catch{return}}function Ne(e){return Zt.test(e)}function Mo(e,t,n){if(!Ne(t)||!/^[a-f0-9]{64}$/u.test(n))return;let r=`${e}\0${t}\0${n}`;if(_e.has(r))return _e.get(r);let i;try{let o=Qt("git",["-C",e,"log","--all","--format=%H","--max-count=64","--",t],{encoding:"utf8",maxBuffer:1048576,timeout:5e3}).split(/\r?\n/u).filter(Boolean);for(let s of o){let c=Qt("git",["-C",e,"show",`${s}:${t}`],{encoding:null,maxBuffer:4194304,timeout:5e3});if(De("sha256").update(c).digest("hex")===n){i=Ae(t,c);break}}}catch{i=void 0}return _e.set(r,i),i}function Gr(){if(J!==void 0)return J;try{J=Lr("typescript")}catch{J=null}return J}function Be(e){return Array.isArray(e)?`[${e.map(Be).join(",")}]`:typeof e=="object"&&e!==null?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${Be(n)}`).join(",")}}`:JSON.stringify(e)}import{closeSync as tn,existsSync as Me,openSync as Mr,realpathSync as zr,renameSync as Wr,unlinkSync as nn,writeSync as Hr}from"fs";import{dirname as $r,join as Ur}from"path";var Jr="fingerprint-stat-cache.json",rn=1,qr=8*1024*1024,Ge=new Map;function ze(e,t,n,r){let i=on(e),o=i.files.get(t);if(!(!o||!sn(o,n,r)))return i.hits+=1,{hash:o.hash,size:o.fingerprintSize,...o.semanticHash===void 0?{}:{semanticHash:o.semanticHash}}}function We(e,t,n,r,i){if(i.hash==="unreadable"||i.size<0||!Number.isFinite(i.size))return;let o=on(e),s={kind:n,dev:r.dev,ino:r.ino,mtimeMs:r.mtimeMs,ctimeMs:r.ctimeMs,size:r.size,hash:i.hash,fingerprintSize:i.size,...i.semanticHash===void 0?{}:{semanticHash:i.semanticHash}},c=o.files.get(t);c&&Zr(c,s)||(o.files.set(t,s),o.stores+=1,o.dirty=!0)}function He(e){let t=Ge.get(cn(e));if(!(!t?.dirty||!t.cachePath))try{let n=$r(t.cachePath);if(!Me(n))return;ei(t.cachePath,Xr(t)),t.dirty=!1}catch{}}function on(e){let t=cn(e),n=Ge.get(t);if(n)return n;let r=Kr(t),i=Yr(r),o={cachePath:r,files:i,dirty:!1,hits:0,stores:0};return Ge.set(t,o),o}function Kr(e){try{let t=Fe(e);return Me(t)?Ur(t,Jr):null}catch{return null}}function Yr(e){let t=new Map;if(!e||!Me(e))return t;try{let n=JSON.parse(ne(e,{inputKind:"fingerprint stat cache",maxBytes:qr}).toString("utf8"));if(!Vr(n))return t;for(let[r,i]of Object.entries(n.files))i&&t.set(r,i)}catch{return t}return t}function Xr(e){return{version:rn,files:Object.fromEntries(e.files)}}function Vr(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version!==rn||typeof t.files!="object"||t.files===null?!1:Object.values(t.files).every(Qr)}function Qr(e){if(typeof e!="object"||e===null)return!1;let t=e;return(t.kind==="file"||t.kind==="symlink")&&Number.isFinite(t.dev)&&Number.isFinite(t.ino)&&Number.isFinite(t.mtimeMs)&&Number.isFinite(t.ctimeMs)&&Number.isFinite(t.size)&&Number.isFinite(t.fingerprintSize)&&typeof t.hash=="string"&&t.hash!=="unreadable"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function sn(e,t,n){return e.kind===t&&e.dev===n.dev&&e.ino===n.ino&&e.mtimeMs===n.mtimeMs&&e.ctimeMs===n.ctimeMs&&e.size===n.size}function Zr(e,t){return sn(e,t.kind,t)&&e.hash===t.hash&&e.fingerprintSize===t.fingerprintSize&&e.semanticHash===t.semanticHash}function ei(e,t){let n=`${e}.${process.pid}.tmp`;try{nn(n)}catch{}let r=Buffer.from(`${JSON.stringify(t)}
4
- `,"utf8"),i=Mr(n,"wx",384);try{Q(i,r,{writeFile:(o,s,c,a)=>Hr(o,s,c,a)},"fingerprint stat cache")}catch(o){throw tn(i),nn(n),o}tn(i),Wr(n,e)}function cn(e){return zr(e)}var X=64*1024*1024,ui=1024*1024,li=1024,A=class extends Error{constructor(n,r,i,o){super(`${n} ${JSON.stringify(r)} is ${i} bytes; the safety limit is ${o} bytes`);this.inputKind=n;this.inputPath=r;this.observedBytes=i;this.limitBytes=o;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="SCIP_QUERY_INPUT_TOO_LARGE"};function fi(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function Ke(e,t,n={}){let r=E(t),i=Pt(e,()=>Y(e)),o=ci(i,...r.split("/"));if(!b(i,o)||o===i)throw new g(t,"outside-project");let s=Y(o);if(!b(i,s)||s===i)throw new g(t,"outside-project");let c=Je(s);if(!c.isFile())throw new g(t,"not-a-file");let a={projectRoot:i,relativePath:r,absolutePath:s,size:c.size,mtimeMs:c.mtimeMs,device:c.dev,inode:c.ino},u=n.maxBytes??X;if(T(u),a.size>u)throw new A(n.inputKind??"project file",a.relativePath,a.size,u);return a}function pi(e,t,n={}){let r=E(t),i=_(e,r);if(i){if(i==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(r)} does not exist.`),{code:"ENOENT"});let a=O(e,r);if(!a)throw new g(r,"changed-during-read");let u=n.maxBytes??X;if(T(u),a.size>u)throw new A(n.inputKind??"project file",r,a.size,u);return Buffer.from(a.content)}let o=Ke(e,t,n),s=n.maxBytes??X,c=pn(o.absolutePath,"r");try{let a=q(c);if(K(a,o,t),a.size>s)throw new A(n.inputKind??"project file",o.relativePath,a.size,s);let u=ri(c),f=q(c);if(K(f,o,t),u.byteLength!==a.size)throw new g(t,"changed-during-read");return u}finally{fn(c)}}function cs(e,t,n,r={}){if(n.byteLength===0)throw new Error("Project file probe literal must not be empty.");let{matchedLiteralIndexes:i,...o}=di(e,t,[n],r);return{...o,includesLiteral:i.length>0}}function di(e,t,n,r={}){if(n.length===0||n.some(a=>a.byteLength===0))throw new Error("Project file probe literals must not be empty.");let i=E(t),o=_(e,i);if(o){if(o==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(i)} does not exist.`),{code:"ENOENT"});let a=O(e,i);if(!a)throw new g(i,"changed-during-read");let u=r.maxBytes??X;if(T(u),a.size>u)throw new A(r.inputKind??"project file",i,a.size,u);let f=!a.content.includes(0)&&an(a.content),l=n.map(ln),d=f?hi(a.content,n,l):[];return{byteLength:a.size,isUtf8Text:f,matchedLiteralIndexes:d,bytes:d.length>0?Buffer.from(a.content):null,...r.computeSha256?{sha256:a.sha256}:{}}}let s=Ke(e,t,r),c=pn(s.absolutePath,"r");try{let a=q(c);K(a,s,t);let u=r.computeSha256?$e("sha256"):null,f=r.scratchBuffer??Buffer.allocUnsafe(ui);if(f.byteLength===0)throw new Error("Project file probe scratch buffer must not be empty.");let l=0,d=n.map(()=>!1),m=!1,h=!0,P=Buffer.alloc(0),V=n.map(()=>Buffer.alloc(0)),N=n.map(ln);for(;l<a.size;){let j=un(c,f,0,Math.min(f.byteLength,a.size-l),l);if(j<=0)throw new g(t,"changed-during-read");let x=f.subarray(0,j);if(u?.update(x),m||=x.includes(0),h){let S=P.byteLength>0?Buffer.concat([P,x]):x,z=gi(S);h=an(S.subarray(0,z)),P=Buffer.from(S.subarray(z))}for(let S=0;S<n.length;S+=1){if(d[S])continue;let z=n[S],Ve=V[S];d[S]=mi(x,z,Ve,N[S]),V[S]=yi(x,z,Ve)}l+=j}h&&=P.byteLength===0,K(q(c),s,t);let G=!m&&h,M=G?d.flatMap((j,x)=>j?[x]:[]):[],k=null;if(M.length>0){k=Buffer.allocUnsafe(a.size);let j=0;for(;j<k.byteLength;){let x=un(c,k,j,k.byteLength-j,j);if(x<=0)throw new g(t,"changed-during-read");j+=x}K(q(c),s,t)}return{byteLength:a.size,isUtf8Text:G,matchedLiteralIndexes:M,bytes:k,...u?{sha256:u.digest("hex")}:{}}}finally{fn(c)}}function as(e,t,n={}){return pi(e,t,n).toString("utf8")}function K(e,t,n){if(!e.isFile()||e.dev!==t.device||e.ino!==t.inode||e.size!==t.size)throw new g(n,"changed-during-read")}function gi(e){if(e.byteLength===0)return 0;let t=e.byteLength-1,n=0;for(;t>=0&&n<3&&(e[t]&192)===128;)n+=1,t-=1;if(t<0)return e.byteLength;let r=e[t];return((r&128)===0?1:(r&224)===192?2:(r&240)===224?3:(r&248)===240?4:0)>e.byteLength-t?t:e.byteLength}function hi(e,t,n){return t.flatMap((r,i)=>Ue(e,r,n[i])?[i]:[])}function mi(e,t,n,r){if(Ue(e,t,r))return!0;if(n.byteLength===0||t.byteLength===1)return!1;let i=e.subarray(0,Math.min(e.byteLength,t.byteLength-1));return Ue(Buffer.concat([n,i]),t,r)}function Ue(e,t,n){if(n<0)return e.includes(t);let r=t[n],i=e.indexOf(r),o=0;for(;i>=0;){if(o+=1,o>li)return e.includes(t);let s=i-n;if(s>=0&&s+t.byteLength<=e.byteLength&&e.compare(t,0,t.byteLength,s,s+t.byteLength)===0)return!0;i=e.indexOf(r,i+1)}return!1}function ln(e){for(let n=1;n<e.byteLength;n+=1){let r=e[n];if(r>=65&&r<=90)return n}let t=e[0];return t>=65&&t<=90?0:-1}function yi(e,t,n){let r=t.byteLength-1;if(r===0)return Buffer.alloc(0);if(e.byteLength>=r)return Buffer.from(e.subarray(e.byteLength-r));let i=Buffer.concat([n,e]);return Buffer.from(i.subarray(Math.max(0,i.byteLength-r)))}function Ye(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function us(e,t){try{return Ke(e,t),!0}catch(n){if(Ye(n))return!1;throw n}}function Si(e){let t=B(e);return t?t.filter(n=>n&&!he(n)).sort():(Ci(e)??wi(e)).filter(n=>n&&!he(n)).sort()}function bi(e,t={}){let n=(t.includePaths??[]).map(E),r=[...new Set([...Si(e),...n])].filter(s=>!he(s)).filter(s=>!t.language||_t(s,t.language,t.markerFiles)).filter(s=>!t.includePath||t.includePath(s)).sort((s,c)=>s.localeCompare(c)),i=Y(e),o=r.flatMap(s=>dn(e,i,s));return He(i),o}function dn(e,t,n){let r=Gt(e,n);if(r)return[{path:n,size:r.fingerprintSize??r.size,hash:r.sha256}];if(_(e,n)==="present"){let o=O(e,n);if(o)return[{path:n,size:o.fingerprintSize??o.size,hash:o.sha256}]}let i=qe(e,n);try{let o=Je(i);if(o.isSymbolicLink()){let P=ze(t,n,"symlink",ge(o));if(P)return[{path:n,size:P.size,hash:P.hash}];let V=Y(i),N=si(t,V);if(N===".."||N.startsWith(`..${ai}`)||oi(N))throw new Error("external symlink");let G=ii(i),M=$e("sha256").update("symlink\0").update(G).digest("hex"),k=Buffer.byteLength(G);return We(t,n,"symlink",ge(o),{hash:M,size:k}),[{path:n,size:k,hash:M}]}let s=Le(n)||Ne(n),c=ze(t,n,"file",ge(o));if(c&&(!s||c.semanticHash!==void 0))return[{path:n,size:c.size,hash:c.hash,...c.semanticHash===void 0?{}:{semanticHash:c.semanticHash}}];let a=$e("sha256"),u=s,f=[],l=re(i,{inputKind:"project fingerprint input",maxBytes:X},P=>{a.update(P),u&&f.push(Buffer.from(P))}),d=a.digest("hex"),m=u?Buffer.concat(f,l):void 0,h=m?en(n,m)??Ae(n,m):void 0;return We(t,n,"file",ge(o),{hash:d,size:l,...h===void 0?{}:{semanticHash:h}}),[{path:n,size:l,hash:d,...h===void 0?{}:{semanticHash:h}}]}catch(o){return Ye(o)?[]:[{path:n,size:-1,hash:"unreadable"}]}}function ge(e){return{dev:e.dev,ino:e.ino,mtimeMs:e.mtimeMs,ctimeMs:e.ctimeMs,size:e.size}}function gn(e,t,n){let r=Xe(t,n),i=[...r.typescriptProjects.filter(a=>xi(e,a)),...r.clojureConfigPath?[r.clojureConfigPath]:[]],o=r.languages.includes("typescript")?Kt(e,r.typescriptProjectMode,r.typescriptProjects):null,s=r.languages.includes("typescript")?r.typescriptProjectMode==="workspace"?de(e,r.typescriptProjects):["."]:[],c=Ut(s);return{...r,files:bi(e,{includePath:a=>{if(a===".scipquery.json")return!1;let u=fe(a,t,i);return u==="other"||u==="config"&&Jt(a)&&!c.has(a)?!1:u!=="source"||!ji(a)||!o?!0:o.has(a)},includePaths:i})}}function ls(e,t){let n=new Set(t.files.map(o=>o.path)),r=gn(e,t.languages,t),i=new Map(r.files.map(o=>[o.path,o]));return{...Xe(t.languages,t),files:[...t.files.flatMap(o=>{let s=i.get(o.path);return s?[s]:[]}),...r.files.filter(o=>!n.has(o.path))]}}function fs(e,t,n,r,i,o){let s=l=>({mode:"full",fingerprint:gn(e,t,n),reason:l});if(!i)return s("change-journal-unavailable");if(!i.complete)return s(`change-journal-incomplete:${i.incompleteReason??"unknown"}`);if(!o)return s("accepted-generation-unavailable");if(i.baseGeneration!==o)return s("change-journal-base-mismatch");if(!r)return s("prior-project-input-snapshot-unavailable");let c=Xe(t,n);if(!Pi(r,c))return s("project-input-configuration-changed");if(new Set(r.files.map(l=>l.path)).size!==r.files.length)return s("prior-project-input-snapshot-has-duplicate-paths");if(i.entries.length===0)return{mode:"delta",fingerprint:{...c,files:[...r.files].sort((l,d)=>l.path.localeCompare(d.path))},changedPaths:[]};let a=[...c.typescriptProjects,...c.clojureConfigPath?[c.clojureConfigPath]:[]],u=new Map(r.files.map(l=>[l.path,l]));for(let l of i.entries){let d=u.get(l.path);if(fe(l.path,t,a)!=="source")return s("non-source-project-input-changed");if(l.kind==="add"&&d)return s("added-path-already-in-prior-project-input-snapshot");if(l.kind==="delete"&&!d)return s("deleted-path-not-in-prior-project-input-snapshot");if(l.kind==="change"&&!d)return s("changed-path-not-in-prior-project-input-snapshot");if(d&&(d.hash==="unreadable"||d.size<0))return s("changed-path-was-unreadable")}let f=Y(e);for(let l of i.entries){let d=dn(e,f,l.path);if(l.kind==="delete"){if(d.length!==0)return s("deleted-source-is-still-readable");u.delete(l.path);continue}if(d.length!==1||d[0].hash==="unreadable"||d[0].size<0)return s(l.kind==="add"?"added-source-is-not-readable":"changed-source-no-longer-readable");u.set(l.path,d[0])}return He(f),{mode:"delta",fingerprint:{...c,files:[...u.values()].sort((l,d)=>l.path.localeCompare(d.path))},changedPaths:i.entries.map(l=>l.path).sort()}}function Pi(e,t){return e.version===t.version&&JSON.stringify([...e.languages].sort())===JSON.stringify(t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&JSON.stringify([...e.typescriptProjects].sort())===JSON.stringify(t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function ji(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function xi(e,t){let n;try{n=E(t)}catch{return!1}let r=_(e,n);if(r)return r==="present";try{return Je(qe(e,n)).isFile()}catch(i){if(Ye(i))return!1;throw i}}function Xe(e,t){return{version:3,languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:fi(t.typescriptProjects),clojureConfigPath:Fi(t.clojureConfigPath)}}function Fi(e){return e?.trim()||void 0}function Ci(e){try{let t=xt(e,52428800,()=>ti("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:104857600,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}));return[...Ct(t)]}catch{return null}}function wi(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?qe(e,r):e,o;try{o=ni(i,{withFileTypes:!0})}catch{continue}for(let s of o){let c=r?`${r}/${s.name}`:s.name;if(s.isDirectory()){he(c)||n.push(c);continue}t.push(c)}}return t}function he(e){let t=e.split("/");return e==="meta.json"||qt(e)||t[0]===".scipquery"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(n=>ki.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var ki=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);export{rt as a,it as b,kn as c,En as d,I as e,ne as f,Pe as g,H as h,In as i,Rn as j,re as k,vn as l,fe as m,_t as n,jo as o,It as p,xo as q,Fo as r,gr as s,yr as t,Q as u,ye as v,W as w,et as x,Z as y,ee as z,g as A,me as B,Ii as C,Ri as D,b as E,E as F,tt as G,Fe as H,gt as I,Gn as J,eo as K,to as L,no as M,ro as N,io as O,Mo as P,xt as Q,Ct as R,v as S,ho as T,mo as U,yo as V,fr as W,So as X,bo as Y,ae as Z,w as _,de as $,Ut as aa,Jt as ba,Bo as ca,qt as da,Kt as ea,Do as fa,A as ga,fi as ha,Ke as ia,pi as ja,cs as ka,di as la,as as ma,Ye as na,us as oa,Si as pa,bi as qa,gn as ra,ls as sa,fs as ta,Xe as ua};
5
- //# sourceMappingURL=chunk-AK3PYTIK.js.map
@@ -1,11 +0,0 @@
1
- import{c as Y}from"./chunk-ISIQLPJ2.js";import{e as j,k as w,m as H,n as Q,o as Z}from"./chunk-HG722PO7.js";import{F as A,G as D,H as V,J as X,o as K,q as M,u as b,v as $}from"./chunk-GH5YSGZL.js";import{spawn as Se}from"child_process";import{platform as ee}from"os";import{performance as te}from"perf_hooks";var ft={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},h=class extends Error{constructor(n,r,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=a.timedOut??!1,this.reaped=a.reaped??!1,this.stdout=a.stdout??"",this.stderr=a.stderr??"",this.stdoutTruncated=a.stdoutTruncated??!1,this.stderrTruncated=a.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function v(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function ne(e,t,n,r){let s=Math.max(0,r-n);s>0&&e.push(t.subarray(0,s))}function re(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function mt(e){v(e.timeoutMs,"timeoutMs"),v(e.maxStdoutBytes,"maxStdoutBytes"),v(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;v(t,"terminationGraceMs");let n=e.terminationForceMs??t;return v(n,"terminationForceMs"),new Promise((r,s)=>{let a=te.now(),i=ee()!=="win32"&&process.env.SCIP_REINDEX_PROCESS_GROUP_LEADER==="1",c=ee()!=="win32"&&!i,o;try{o=Se(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"]})}catch(d){let f=d instanceof Error?d.message:String(d);s(new h("spawn",e.label,`${e.label} could not start: ${f}`,{cause:d,reaped:!0}));return}let u=[],g=[],l=0,m=0,R=!1,x=!1,p=null,y=!1,z=o.pid===void 0?null:Q(o.pid,c),P=()=>{clearTimeout(U),e.signal?.removeEventListener("abort",I)},E=d=>{if(y||!p)return;y=!0,P();let f=Buffer.concat(u).toString("utf8"),_=Buffer.concat(g).toString("utf8"),N=d.reaped||!d.detail?"":` Process-tree cleanup failed: ${d.detail}`;s(new h(p.kind,e.label,`${p.message}${N}`,{timedOut:p.timedOut,reaped:d.reaped,stdout:f,stderr:_,stdoutTruncated:R,stderrTruncated:x}))},B=d=>{if(!(p||y)){if(p=d,!z){E({reaped:o.pid===void 0,reason:o.pid===void 0?"terminated":"identity-unavailable"});return}Z(z,{gracefulMs:t,forceMs:n}).then(E,f=>{E({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},U=setTimeout(()=>{B({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);U.unref();let I=()=>{B({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",I,{once:!0}),e.signal?.aborted&&I(),o.stdout.on("data",d=>{let f=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?re(u,f,e.maxStdoutBytes):ne(u,f,l,e.maxStdoutBytes),l+=f.length,l>e.maxStdoutBytes&&(R=!0,e.outputLimitBehavior!=="truncate-tail"&&B({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),o.stderr.on("data",d=>{let f=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?re(g,f,e.maxStderrBytes):ne(g,f,m,e.maxStderrBytes),m+=f.length,m>e.maxStderrBytes&&(x=!0,e.outputLimitBehavior!=="truncate-tail"&&B({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),o.on("error",d=>{if(!y&&!p){if(o.pid===void 0){P(),y=!0,s(new h("spawn",e.label,`${e.label} could not start: ${d.message}`,{cause:d,reaped:!0}));return}B({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${d.message}`})}}),o.on("close",(d,f)=>{if(y||p)return;y=!0,P();let _=Buffer.concat(u).toString("utf8"),N=Buffer.concat(g).toString("utf8");r({status:d,signal:f,stdout:_,stderr:N,timedOut:!1,durationMs:te.now()-a,stdoutTruncated:R,stderrTruncated:x})}),e.input===void 0?o.stdin.end():o.stdin.end(e.input)})}import{execFileSync as ie}from"child_process";import{createRequire as Le}from"module";import{existsSync as Ae}from"fs";import{platform as S,arch as se}from"os";var L="v0.8.1",J="https://github.com/sourcegraph/scip",T=`github.com/sourcegraph/scip/cmd/scip@${L}`,ae=Le(import.meta.url),oe="SCIP_QUERY_SCIP_BIN";function we(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let t=e.env[oe];if(t&&e.fileExists(t))return{source:"env",path:t};if(e.platform==="win32"){let n=e.resolveSidecar(e.arch);if(n&&e.fileExists(n))return{source:"sidecar",path:n}}return null}function Te(e){for(let t of e==="arm64"?["arm64","x64"]:[e])try{return ae.resolve(`scip-query-scip-windows/scip-win32-${t}.exe`)}catch{}return null}function W(e=process.env){let t=we({platform:S(),arch:se(),env:e,isOnPath:w,fileExists:Ae,resolveSidecar:Te});return t?.source==="path"?H("scip")??t.path:t?.path??null}function vt(){return W()!==null}function Oe(){let e=W();if(!e)return null;try{return ie(e,["--version"],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function ke(){let e=S(),t=se(),n,r,s;switch(e){case"darwin":n="darwin",s="tar.gz";break;case"linux":n="linux",s="tar.gz";break;default:return null}switch(t){case"arm64":r="arm64";break;case"x64":r="amd64";break;default:return null}let a=`scip-${n}-${r}.${s}`;return{url:`${J}/releases/download/${L}/${a}`,filename:a}}function ht(){let e=ke();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),S()==="darwin"||S()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${T}
2
- `),console.log("Or download that exact release manually:");else if(S()==="win32"){let t=Pe();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 ${oe} to a local scip.exe path.
3
- `),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
4
- `:` ${J}/releases/tag/${L}
5
- `),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function Pe(){let t=ae("../../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}`}function St(e){if(w("go")){e(`Installing immutable ${T} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(ie("go",["install",T],{stdio:"inherit",timeout:3e5,env:process.env}),w("scip")){let t=W(),n=Oe();if(t&&n&&n.includes(L))return e(`Successfully installed ${T}; resolved executable: ${t}; reported version: ${n}.`),!0;e(`go install completed, but the resolved scip executable did not report ${L} (executable: ${t??"unresolved"}; version: ${n??"unavailable"}).`)}}catch(t){let n=t instanceof Error?t.message:String(t);e(`go install failed: ${n}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${J}/releases`),!1}var ue=class extends Error{constructor(t){super(t),this.name="ReindexLockUnavailableError"}};import{existsSync as me,statSync as Ue}from"fs";import{dirname as be,join as xe}from"path";import{appendFileSync as Ee,existsSync as Ie,mkdirSync as _e,renameSync as Ne,rmSync as Me,statSync as $e,truncateSync as De}from"fs";import{basename as Je,dirname as We}from"path";var O=".previous",Ce=".rotation.lock",Fe=2e3,C=class extends Error{constructor(n,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${n}`);this.lockPath=n;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},F=class extends Error{constructor(n){super(`Rotating JSONL lock ownership changed before release: ${n}`);this.lockPath=n;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},de=Object.freeze({monotonicNow:j,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=Y(e,{kind:"rotating-jsonl",detail:{target:Je(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){_e(e,{recursive:!0})},exists:Ie,readBytes(e){return V(e,{maxBytes:A,inputKind:"rotating JSONL segment"})},size(e){return $e(e).size},truncate:De,remove(e){Me(e,{force:!0})},rename:Ne,append:Ee});function le(e,t,n){let r=n.runtime??de,s=JSON.stringify(t);if(s===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let a=Buffer.from(`${s}
6
- `),i=Math.max(1,Math.floor(n.maxSegmentBytes),a.length);return ge(e,n.lockTimeoutMs,r,()=>{r.makeDirectory(We(e));let c=Ge(e,A,r);n.onPhase?.("tail-repaired");let o=`${e}${n.previousSuffix??O}`,u=!1,g=!1;return r.exists(e)&&r.size(e)+a.length>i&&(r.exists(o)&&(r.remove(o),g=!0),n.onPhase?.("previous-pruned"),r.rename(e,o),u=!0,n.onPhase?.("current-rotated")),r.append(e,a),n.onPhase?.("record-appended"),{lineBytes:a.length,segmentLimitBytes:i,repairedTailBytes:c,rotated:u,prunedPrevious:g}})}function ce(e,t={}){let n=t.runtime??de,r=qe(t.maxSegmentBytes);return ge(e,t.lockTimeoutMs,n,()=>{let s=[],a=0,i=`${e}${t.previousSuffix??O}`;for(let c of[i,e]){if(!n.exists(c))continue;let o=ze(fe(c,r,n));s.push(...o.lines),a+=o.partialTailBytes}return{lines:s,ignoredPartialTailBytes:a}})}function ge(e,t,n,r){let s=`${e}${Ce}`,a=Math.max(0,t??Fe),i=n.monotonicNow()+a,c;for(;;){let m=n.tryAcquireLock(s,e);if(m.kind==="acquired"){c=m.lock;break}let R=i-n.monotonicNow();if(R<=0)throw new C(s,a);n.wait(Math.min(5,R))}let o=!1,u,g;try{g=r()}catch(m){o=!0,u=m}let l=!1;try{l=c.release()}catch(m){if(!o)throw m}if(o)throw u;if(!l)throw new F(s);return g}function Ge(e,t,n){if(!n.exists(e))return 0;let r=fe(e,t,n);if(r.length===0||r[r.length-1]===10)return 0;let s=r.lastIndexOf(10),a=s<0?0:s+1;return n.truncate(e,a),r.length-a}function qe(e){let t=e??A;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function fe(e,t,n){let r=n.size(e);if(r>t)throw new D("rotating JSONL segment",e,"too-large",r,t);let s=n.readBytes(e),a=n.size(e);if(a!==r||s.byteLength!==r)throw new D("rotating JSONL segment",e,"changed-during-read",a,t);return s}function ze(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
7
- `).filter(s=>s.length>0),partialTailBytes:e.length-n}}var Ke="reindex-activity.jsonl",k=O,Ve=1024*1024,Xe=1440*60*1e3,pe=e=>X(e,"reindex activity segment");function q(e){return xe(be(e),Ke)}function Be(e){if(e.reused)return 0;let n=(e.shards?.some(r=>!r.reused&&r.strategy==="incremental")??!1?0:G(e.indexPath))+G(e.dbPath);for(let r of e.shards??[]){if(r.reused)continue;let s=r.producedOutputBytes??r.outputBytes;s!==null&&(n+=s)}return n}function je(e){let t=Be(e),n=e.writeTelemetry;return n?Math.max(0,t-n.reflinkedBytes)+n.fallbackCopiedBytes+(n.incrementalWrittenBytes??0):t}function Jt(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=Be(t);return ve(q(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:je(t),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,incrementalWrittenBytes:t.writeTelemetry?.incrementalWrittenBytes??0,byLanguage:nt(t)})}function Wt(e,t){return ve(q(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function Ye(e,t,n=Ve,r){le(e,t,{maxSegmentBytes:n,previousSuffix:k,...r?{runtime:r}:{}})}function He(e,t=new Date,n=Xe,r=pe){let s=t.getTime(),a=s-n,i={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(a).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:{}},c=q(e),o=[];if(r===pe){if(!me(c)&&!me(`${c}${k}`))return i;try{let u=ce(c,{previousSuffix:k});o=u.lines,i.ignoredPartialTailBytes=u.ignoredPartialTailBytes}catch{i.readErrors+=1,i.confidence="unavailable"}}else{let u=0;for(let g of[`${c}${k}`,c])try{o.push(...ut(r(g))),u+=1}catch{i.readErrors+=1}u===0?i.confidence="unavailable":i.readErrors>0&&(i.confidence="partial")}for(let u of o){i.recordsRead+=1;let g=Qe(u);if(!g){i.invalidRecords+=1,i.confidence!=="unavailable"&&(i.confidence="partial");continue}let{record:l}=g,m=Date.parse(l.recordedAt);if(m<a||m>s){i.skippedRecords+=1;continue}if(i.invalidLanguageDetails=(i.invalidLanguageDetails??0)+g.invalidLanguageDetails,i.byTrigger[l.trigger.kind]=(i.byTrigger[l.trigger.kind]??0)+1,l.event==="suppressed"){i.suppressed+=1;continue}i.runs+=1,i[l.result]+=1,i.estimatedLogicalOutputBytes+=l.estimatedLogicalOutputBytes;let R=Ze(l);i.estimatedWriteBytes=(i.estimatedWriteBytes??0)+R,i.reflinkedBytes=(i.reflinkedBytes??0)+(l.reflinkedBytes??0),i.fallbackCopiedBytes=(i.fallbackCopiedBytes??0)+(l.fallbackCopiedBytes??0),l.result!=="failed"&&(g.hasLanguageDetails?i.attributedRuns=(i.attributedRuns??0)+1:i.unattributedRuns=(i.unattributedRuns??0)+1);for(let[x,p]of he(l.byLanguage)){let y=(i.byLanguage??={})[x]??=at();y.runs+=1,y[p.result]+=1,y.producedOutputBytes+=p.producedOutputBytes,y.durationMs+=p.durationMs}ye(l)&&i.oldestRebuildAt===void 0&&(i.oldestRebuildAt=l.recordedAt),ye(l)&&(i.fullRebuilds=(i.fullRebuilds??0)+1),R>0&&i.oldestWriteAt===void 0&&(i.oldestWriteAt=l.recordedAt)}return i.ignoredPartialTailBytes>0&&i.confidence!=="unavailable"&&(i.confidence="partial"),i.languageAttribution=ot(i),i}function ve(e,t){try{return Ye(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function Qe(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!K(n.recordedAt)||!n.trigger||!tt(n.trigger.kind))return null;if(n.event==="suppressed")return n.reason==="completed-index-is-fresh"?{record:n,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(n.event!=="run"||n.result!=="rebuilt"&&n.result!=="reused"&&n.result!=="failed"||!b(n.durationMs)||!b(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!b(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!b(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!b(n.fallbackCopiedBytes)||n.incrementalWrittenBytes!==void 0&&!b(n.incrementalWrittenBytes))return null;let r=n,{byLanguage:s,...a}=r,i=rt(s);return{record:{...a,...i.byLanguage?{byLanguage:i.byLanguage}:{}},hasLanguageDetails:i.hasLanguageDetails,invalidLanguageDetails:i.invalidLanguageDetails}}catch{return null}}function Ze(e){return e.reflinkedBytes===void 0?e.estimatedWriteBytes??e.estimatedLogicalOutputBytes:Math.max(0,e.estimatedLogicalOutputBytes-e.reflinkedBytes)+(e.fallbackCopiedBytes??0)+(e.incrementalWrittenBytes??0)}function Ct(e,t,n=new Date){return t.enabled?et(He(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function et(e,t,n){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,s=e.fullRebuilds??e.rebuilt,a={rebuilt:s,estimatedWriteBytes:r};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:n+t.windowMs,...a,detail:`reindex activity evidence is ${e.confidence}`}:s>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:Re(e.oldestRebuildAt,t.windowMs,n),...a,detail:`${s}/${t.maxRebuilds} expensive full rebuild slots consumed`}:r>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:Re(e.oldestWriteAt,t.windowMs,n),...a,detail:`${r}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...a}:{state:"allowed",...a}}function ye(e){if(e.result!=="rebuilt")return!1;let t=he(e.byLanguage);return t.length===0?!0:t.some(([,n])=>n.result==="rebuilt"&&n.strategy!=="incremental"&&n.strategy!=="reused")}function Re(e,t,n){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+t>n?r+t:n+t}function tt(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 G(e){try{return Ue(e).size}catch{return 0}}function nt(e){let t={};for(let n of e.languages){let r=(e.shards??[]).filter(u=>u.language===n),s=r.find(u=>u.id===n),a=e.reused||(s?s.reused:r.length>0&&r.every(u=>u.reused)),i=G(xe(be(e.dbPath),"language-indexes",`${n}.scip`)),c=i>0?i:s?.outputBytes??i,o=a?0:s?.durationMs??r.filter(u=>!u.reused).reduce((u,g)=>u+g.durationMs,0);t[n]={result:a?"reused":"rebuilt",strategy:a?"reused":s?.strategy??"full",...s?.strategy==="full"&&(s.fallbackReason??s.missReason)?{fallbackReason:s.fallbackReason??s.missReason}:{},outputBytes:c,producedOutputBytes:a?0:s?.producedOutputBytes??c,durationMs:o}}return t}function rt(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let t={},n=0;for(let[s,a]of Object.entries(e)){if(!st(s)||!it(a)){n+=1;continue}t[s]=a}let r=Object.keys(t).length>0;return{...r?{byLanguage:t}:{},hasLanguageDetails:r,invalidLanguageDetails:n}}function it(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")&&M(t.outputBytes)&&M(t.producedOutputBytes)&&b(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function st(e){return $.includes(e)}function he(e){return e?$.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function at(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function ot(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function ut(e){return e.endsWith(`
8
- `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
9
- `)+1))),e.split(`
10
- `).filter(t=>t.length>0)}export{ft as a,h as b,mt as c,W as d,vt as e,Oe as f,ht as g,St as h,ue as i,O as j,le as k,Ke as l,Jt as m,Wt as n,Ct as o};
11
- //# sourceMappingURL=chunk-AMIMMNA4.js.map
@@ -1,2 +0,0 @@
1
- import{c as Q,d as Y,e as I}from"./chunk-BVFYEEBH.js";import{a as _,b as K,c as x,d as G}from"./chunk-57N6LN2A.js";import{a as C,c as J,d as W}from"./chunk-JT6XX7QY.js";import{b as v}from"./chunk-H5EXS3HM.js";import{a as j,b as R,c as A,d as P}from"./chunk-SB25YMEQ.js";import{W as U,_ as T,h as y,x as q,y as f,z as V}from"./chunk-AK3PYTIK.js";import{watch as fe}from"fs";function Le(e){let t=!1,r=!1,i,n=[],s=()=>{r=!0;let o=i;i=void 0,o?.()};for(let o of new Set(e))try{let a=fe(o,{persistent:!1},s);a.on("error",()=>{}),n.push(a)}catch{}return{wait(o){return t||o<=0?(r=!1,Promise.resolve()):new Promise(a=>{let c=setTimeout(()=>{i===d&&(i=void 0),a()},o),d=()=>{clearTimeout(c),i===d&&(i=void 0),a()};i=d,(r||t)&&(r=!1,d())})},close(){if(!t){t=!0;for(let o of n)try{o.close()}catch{}n.length=0}s()}}}import{spawn as qe}from"child_process";import{existsSync as Ce,rmSync as oe}from"fs";import{dirname as nt,resolve as F}from"path";import{fileURLToPath as ot}from"url";import{createHash as me,randomUUID as O}from"crypto";import{existsSync as ve,linkSync as Se,readdirSync as ge,rmSync as m}from"fs";import{basename as ye,dirname as Re,join as u}from"path";var p=1,We=10*6e4,Ie=10080*6e4,k="requests",S="claims",w="completions",B="staging";function Ge(e,t,r={}){let i=r.now?.()??new Date,n=Ee(r.ttlMs),s=be(r.idempotencyKey),o=s?`key-${me("sha256").update(s).digest("hex")}`:`request-${(r.randomId??O)()}`,a={version:p,requestId:o,...s?{idempotencyKey:s}:{},createdAt:i.toISOString(),deadlineAt:new Date(i.getTime()+n).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},c=ie(e,o),d=M(e,c,a,r.onStage);if(d.published)return{disposition:"accepted",request:a,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let l=D(c);if(!l)throw new Error(`Watch refresh request identity ${o} exists but is malformed.`);return{disposition:"duplicate",request:l}}function Je(e,t={}){let r=t.now?.()??new Date,i=`claim-${(t.randomId??O)()}`,n=Math.max(1,Math.floor(t.limit??64)),s=ee(e).sort(Ae),o=[];for(let a of s){if(o.length>=n)break;if(z(e,a.requestId))continue;if(Date.parse(a.deadlineAt)<=r.getTime()){Z(e,{version:p,requestId:a.requestId,outcome:"expired",completedAt:r.toISOString()});continue}let c={version:p,requestId:a.requestId,claimId:i,claimedAt:r.toISOString()};if(M(e,ne(e,a.requestId),c).published){if(z(e,a.requestId)){te(e,a.requestId,i);continue}o.push(a)}}return{claimId:i,requests:o}}function Qe(e,t,r=()=>new Date,i){let n=r().toISOString();for(let s of t.requests)Z(e,{version:p,requestId:s.requestId,claimId:t.claimId,outcome:"completed",completedAt:n});i?.("after-completion"),we(e,t),i?.("after-claim-release")}function we(e,t){for(let r of t.requests)te(e,r.requestId,t.claimId)}function Ye(e){let t=0;for(let r of h(u(e,S)))m(r,{force:!0}),t++;return t>0&&f(u(e,S)),re(e),t}function ze(e){let t=ee(e),r=new Map,i=ke(u(e,k),D);for(let c of h(u(e,w))){let d=E(c);if(!d){i++;continue}r.set(d.requestId,d)}let n=new Set;for(let c of h(u(e,S))){let d=X(c);if(!d){i++;continue}n.add(d.requestId)}let s=t.filter(c=>!r.has(c.requestId)&&!n.has(c.requestId)),o=[...r.values()].filter(c=>c.outcome==="completed").length,a=[...r.values()].filter(c=>c.outcome==="expired").length;return{pending:s.length,claimed:t.filter(c=>!r.has(c.requestId)&&n.has(c.requestId)).length,completed:o,expired:a,invalid:i,...s.length>0?{oldestPendingAt:s.map(c=>c.createdAt).reduce((c,d)=>Pe(c,d))}:{}}}function Be(e,t={}){let r=(t.now?.()??new Date).getTime(),i=Math.max(0,t.retentionMs??Ie),n=0;for(let s of h(u(e,w))){let o=E(s);!o||r-Date.parse(o.completedAt)<i||(m(s,{force:!0}),m(ie(e,o.requestId),{force:!0}),n++)}return n>0&&(f(u(e,w)),f(u(e,k))),re(e),n}function D(e){return L(e,t=>{let r=t;return r.version===p&&g(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&v(r.createdAt)&&v(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function X(e){return L(e,t=>{let r=t;return r.version===p&&g(r.requestId)&&g(r.claimId)&&v(r.claimedAt)})}function E(e){return L(e,t=>{let r=t;return r.version===p&&g(r.requestId)&&(r.claimId===void 0||g(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&v(r.completedAt)})}function Z(e,t){let r=se(e,t.requestId);if(M(e,r,t).published)return;let i=E(r);if(!i||i.requestId!==t.requestId||i.outcome!==t.outcome)throw new Error(`Watch refresh completion ${t.requestId} conflicts with an existing record.`)}function M(e,t,r,i){let n=u(e,B),s=Re(t),o=q(n),a=q(s),c=u(n,`${ye(t)}.${process.pid}.${O()}.tmp`);try{let d=W(c,r,{spacing:2,trailingNewline:!0});i?.("after-staged");try{Se(c,t)}catch(H){if(H.code==="EEXIST")return{published:!1};throw H}let l=V(o,a,d.directorySync,f(s));return i?.("after-published"),{published:!0,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}finally{m(c,{force:!0})}}function ee(e){let t=[];for(let r of h(u(e,k))){let i=D(r);i&&t.push(i)}return t}function te(e,t,r){let i=ne(e,t),n=X(i);!n||n.claimId!==r||(m(i,{force:!0}),f(u(e,S)))}function re(e){for(let t of h(u(e,B),".tmp"))m(t,{force:!0})}function ke(e,t){return h(e).filter(r=>!t(r)).length}function h(e,t=".json"){return ve(e)?ge(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(t)).map(r=>u(e,r.name)).sort():[]}function L(e,t){try{let r=JSON.parse(y(e,"watch refresh request record"));return t(r)?r:null}catch{return null}}function ie(e,t){return u(e,k,`${t}.json`)}function ne(e,t){return u(e,S,`${t}.json`)}function se(e,t){return u(e,w,`${t}.json`)}function z(e,t){return E(se(e,t))!==null}function Ee(e){if(e===void 0)return We;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function be(e){let t=e?.trim();return t?t.slice(0,512):void 0}function g(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function Ae(e,t){return Date.parse(e.createdAt)-Date.parse(t.createdAt)||e.requestId.localeCompare(t.requestId)}function Pe(e,t){return Date.parse(t)<Date.parse(e)?t:e}var Te=6e3,_e=1e3,ce=10;function mt(e,t,r){let i=T(F(e));if(r&&T(r.projectRoot)===i)return{projectRoot:i,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:t};let n=U(i);if(n.kind==="error")throw new Error(`Could not establish Git worktree identity for ${i}: ${n.message}`);return n.kind==="non-git"?{projectRoot:i,worktreeKind:"non-git",cliVersion:t}:{projectRoot:i,worktreeKind:"git",worktreeId:n.identity.worktreeId,cliVersion:t}}function vt(e){let t=e.runtime??De,r=Q(e.cacheDir),i=Y(r.statePath),n=i?de(i,t)?{kind:"live",state:i}:{kind:"stale",state:i,reason:"dead-process"}:{kind:"stopped"},s=xe("stop",n);if(s.kind==="signal-stop")return ae(s.state,e,t),N(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};if(s.kind==="clean-stale")return N(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};let o=le(r.lockPath);return s.kind==="already-stopped"&&o?(de(o,t)&&ae(o,e,t),N(r,o.pid,t),{disposition:"stopped",pid:o.pid}):{disposition:"already-stopped"}}function St(e,t,r={}){let{durability:i="durable",...n}=r;i==="durable"?W(e,t,n):J(e,t,n)}function gt(e){try{let t=JSON.parse(y(e,"watch activity record"));return t.version!==1||!I(t.at)||t.refreshRequestedAt!==void 0&&!I(t.refreshRequestedAt)||t.refreshDetail!==void 0&&typeof t.refreshDetail!="string"?null:{atMs:Date.parse(t.at),...t.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(t.refreshRequestedAt)},...t.refreshDetail===void 0?{}:{refreshDetail:t.refreshDetail}}}catch{return null}}function yt(e,t,r={}){let i=r.pid??process.pid,n=r.isProcessAlive??C,s=()=>{},o=r.readProcessIdentity??A,a=r.now??(()=>new Date),c={..._,wallNow:()=>a().getTime(),isProcessAlive:n,readProcessIdentity:o},d=K(e,{kind:"watch",pid:i,processIdentity:o(i),detail:{projectRoot:F(t)},parseLegacy:b,runtime:c});if(d.kind==="contended"){let l=pe(d.observation);return{acquired:!1,lockPath:e,message:Oe(e,t,l),release:s}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function le(e){return pe(x(e,{parseLegacy:b}))}var b=e=>{let t=he(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function pe(e){if(e.state==="valid"&&e.record?.kind==="watch"){let t=e.record.detail?.projectRoot;return typeof t!="string"?null:{version:1,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},projectRoot:t,startedAt:e.record.startedAt}}return he(e.parsed)}function he(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!I(t.startedAt))return null;let r=t.processIdentity===void 0?null:j(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,pid:t.pid,...r?{processIdentity:r}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function xe(e,t){switch(e){case"status":return{kind:"report",classification:t};case"ensure":switch(t.kind){case"stopped":return{kind:"start"};case"stale":return t.reason==="old-heartbeat"?{kind:"refuse-replace",state:t.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:t.state};case"incompatible":return{kind:"replace",state:t.state};default:return $(t)}case"stop":switch(t.kind){case"stopped":return{kind:"already-stopped"};case"stale":return t.reason==="old-heartbeat"?{kind:"signal-stop",state:t.state}:{kind:"clean-stale",state:t.state};case"live":case"incompatible":return{kind:"signal-stop",state:t.state};default:return $(t)}default:return $(e)}}function Rt(e){return e.idleTimeoutMs===0||e.watcher.state!=="idle"?!1:e.nowMs-e.lastActivityAtMs>=e.idleTimeoutMs}function ae(e,t,r){let{pid:i}=e;if(!r.isProcessAlive(i))return;ue(e,r),r.signalProcess(i);let n=t.stopTimeoutMs??Te,s=r.monotonicNow??P,o=s()+n;for(;s()<=o;){if(!r.isProcessAlive(i))return;r.sleep(ce)}if(!r.forceSignalProcess)throw new Error(`scip-query watch service pid ${i} did not stop within ${n}ms and forced termination is unavailable.`);ue(e,r),r.forceSignalProcess(i);let a=t.forceStopTimeoutMs??_e,c=s()+a;for(;s()<=c;){if(!r.isProcessAlive(i))return;let d=r.readProcessIdentity(i);if(e.processIdentity&&d&&!R(e.processIdentity,d))return;r.sleep(ce)}throw new Error(`scip-query watch service pid ${i} remained alive ${a}ms after forced termination.`)}function N(e,t,r){if(oe(e.statePath,{force:!0}),oe(e.activityPath,{force:!0}),le(e.lockPath)?.pid===t){let n={..._,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},s=x(e.lockPath,{parseLegacy:b,runtime:n});G(e.lockPath,s,{parseLegacy:b,runtime:n})}}function de(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||R(e.processIdentity,r)}function Oe(e,t,r){return`error: scip-query watch is already running for ${F(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}var De={now:Date.now,monotonicNow:P,isProcessAlive:C,readProcessIdentity:A,spawnServer(e,t,r,i){if(!Ce(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);qe(process.execPath,[e,t,r,JSON.stringify(i)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function ue(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its ownership record has no process identity.`);let r=t.readProcessIdentity(e.pid);if(!r)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity is unavailable.`);if(!R(e.processIdentity,r))throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity does not match the ownership record.`)}function $(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}export{Le as a,Ge as b,Je as c,Qe as d,we as e,Ye as f,ze as g,Be as h,mt as i,vt as j,St as k,gt as l,yt as m,Rt as n};
2
- //# sourceMappingURL=chunk-AUY5BL74.js.map
@@ -1,18 +0,0 @@
1
- import{a as G}from"./chunk-QOKYJ33H.js";import{a as O,c as z}from"./chunk-PLYUVM4F.js";import{h as $}from"./chunk-PBUH2P5S.js";import{d as k,g as C,i as j}from"./chunk-TD7VKJ2Y.js";import{C as A}from"./chunk-7JYHQAH2.js";import{Y as R,f as N,xa as _}from"./chunk-GH5YSGZL.js";import{execFileSync as g}from"child_process";import{existsSync as ne}from"fs";import{basename as W}from"path";var ie="Unable to compute git diff.",se={semanticConsumers:$,sourceFallbackConsumers:O},I={resolveCommit:R,readBatch({projectRoot:e,resolvedBase:i,relativePaths:t}){let n=t.map(a=>`${i}:./${a}
2
- `).join("");return g("git",["cat-file","--batch"],{cwd:e,input:n,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]})}};function Ze(e,i={}){let t=i.plan??ae(e,i);return t.note?ce(t.note,t.changedFileLines):t.changedFiles.length===0?le(t.changedFileLines):oe(t.changedFiles,[re(e,t.changedFiles,t.changedFiles,t.changedRanges)])}function ae(e,i={}){let{base:t="HEAD"}=i;try{let n=R(e.config.projectRoot,t),a=de(e.config.projectRoot,n),s=a.changedFileLines,r=be(e,s),o=ye(e,a.changedRanges);return{changedFileLines:s,changedFiles:r,changedRanges:o,renamedFiles:ge(e.config.projectRoot,n,r,a),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:ie}}}function re(e,i,t,n=[],a={}){let s=a.evidenceRuntime??se,r=new z(e),o=new Set(t),l=G(n),u=[],d=new Map,c=i.flatMap(f=>r.definitionsForFile(f)).filter(Ne),m=c.filter(f=>Ce(f,l)),p=ve(e,c,m,l),b=Ie([...m,...p.definitions]).sort((f,h)=>f.relativePath.localeCompare(h.relativePath)||f.startLine-h.startLine),B=b.map(f=>f.symbolId),w=Pe(e,B),ee=Ee(e,B,t),y=b.filter(f=>(w.get(f.symbolId)??0)===0),M=H("semantic-consumers",y.length,()=>s.semanticConsumers(e,y)),P=M.values,E=y.filter(f=>(P.get(f.symbolId)?.size??0)===0),T=H("source-fallback-consumers",E.length,()=>s.sourceFallbackConsumers(e,E)),te=T.values;for(let f of b)Be(e,f,o,u,d,P.get(f.symbolId)??new Set,te.get(f.symbolId)??new Set,w.get(f.symbolId)??0,ee.get(f.symbolId)??new Set);return{changedSymbols:u,consumerEntries:[...d.entries()].map(([f,h])=>({file:f,symbols:[...h].sort()})),attributionNotes:p.notes,evidenceTiers:[M.status,T.status]}}function oe(e,i){let t=new Map,n=i.flatMap(o=>o.changedSymbols),a=i.flatMap(o=>o.attributionNotes??[]),s=we(i);for(let o of i)for(let l of o.consumerEntries){let u=t.get(l.file);u||(u=new Set,t.set(l.file,u));for(let d of l.symbols)u.add(d)}let r=Te(t);return{changedFiles:[...e],changedSymbols:n,affectedConsumers:r,attributionNotes:a,evidenceTiers:s,summary:{totalChangedFiles:e.length,totalChangedSymbols:n.length,totalAffectedFiles:r.length}}}function ce(e,i=[]){return{changedFiles:i,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:X(),summary:{totalChangedFiles:i.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function le(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:X(),summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function de(e,i){let t=g("git",["diff","--name-status","--find-renames",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),n=g("git",["diff","--name-status","--find-renames","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),a=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),s=g("git",["diff","--unified=0",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),r=g("git",["diff","--unified=0","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),o=pe([t,n]);return{changedFileLines:[...new Set([...o.changedFiles,...V(a)])],changedRanges:K([...q(s),...q(r)]),renamedFiles:o.renamedFiles,deletedFiles:o.deletedFiles}}function ue(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePath:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||typeof n.relativePath!="string")throw new TypeError("fileContentAtBase requires projectRoot, base, and relativePath.");let a={projectRoot:n.projectRoot,base:n.base,relativePath:n.relativePath},{relativePath:s}=a,r=J(a);if(r.state==="unavailable")throw new Error(`Base content unavailable for ${s}: ${r.reason}`);return r.state==="present"?r.content:null}function J(e,i=I){return Z(e.relativePath),F({projectRoot:e.projectRoot,base:e.base,relativePaths:[e.relativePath]},i).get(e.relativePath)??{state:"unavailable",reason:`Base-content lookup omitted ${e.relativePath}.`}}function F(e,i=I){for(let r of e.relativePaths)Z(r);let t=[...new Set(e.relativePaths)];if(t.length===0)return new Map;let n;try{n=i.resolveCommit(e.projectRoot,e.base)}catch(r){return S(t,v(r))}let a;try{a=i.readBatch({projectRoot:e.projectRoot,resolvedBase:n,relativePaths:t})}catch(r){return S(t,v(r))}let s;try{s=me(a,t)}catch(r){return S(t,`Malformed git cat-file batch output: ${v(r)}`)}return new Map(t.map(r=>{let o=s.get(r)??null;return[r,o===null?{state:"absent"}:{state:"present",content:o}]}))}function fe(e,i=I){let t=F({projectRoot:e.projectRoot,base:e.base,relativePaths:e.preloadPaths??[]},i);return n=>(t.has(n)||t.set(n,J({projectRoot:e.projectRoot,base:e.base,relativePath:n},i)),t.get(n)??{state:"unavailable",reason:`Base-content reader omitted ${n}.`})}function Ve(e,i,t=[]){let n=typeof e=="string"?{projectRoot:e,base:i,preloadPaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string")throw new TypeError("createBaseContentReader requires projectRoot and base.");let a={projectRoot:n.projectRoot,base:n.base,preloadPaths:n.preloadPaths},s=fe(a);return r=>{let o=s(r);if(o.state==="unavailable")throw new Error(`Base content unavailable for ${r}: ${o.reason}`);return o.state==="present"?o.content:null}}function Ye(e,i=e.changedFiles){let t=new Map(e.renamedFiles.map(n=>[n.to,n.from]));return[...new Set(i.map(n=>t.get(n)??n))]}function Ke(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||!Array.isArray(n.relativePaths))throw new TypeError("fileContentsAtBase requires projectRoot, base, and relativePaths.");let a=F(n),s=new Map;for(let[r,o]of a){if(o.state==="unavailable")throw new Error(`Base content unavailable for ${r}: ${o.reason}`);s.set(r,o.state==="present"?o.content:null)}return s}function Z(e){N(e)}function S(e,i){return new Map(e.map(t=>[t,{state:"unavailable",reason:i}]))}function v(e){let t=(e instanceof Error?e.message:String(e)).replaceAll(/\s+/g," ").trim().slice(0,500);return t===""?"Git base-content lookup failed without a reason.":t}function me(e,i){let t=new Map,n=0;for(let a of i){let s=e.indexOf(10,n);if(s<0)throw new Error("git cat-file batch output ended before object header");let r=e.subarray(n,s).toString("utf-8");if(n=s+1,r.endsWith(" missing")){t.set(a,null);continue}let o=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(r);if(!o)throw new Error(`unexpected git cat-file batch header: ${r}`);let[,l,u]=o,d=Number(u);if(!Number.isFinite(d)||d<0)throw new Error(`unexpected git cat-file batch size: ${r}`);if(n+d>e.length)throw new Error("git cat-file batch output ended before blob payload");let c=e.subarray(n,n+d);t.set(a,l==="blob"?c.toString("utf-8"):null),n+=d,e[n]===10&&(n+=1)}return t}function ge(e,i,t,n){if(t.length===0)return[];let a=new Map,s=new Set;for(let o of n.renamedFiles)t.includes(o.to)&&(a.set(o.to,o),s.add(o.from));let r=n.deletedFiles;if(r.length===0)return[...a.values()].sort((o,l)=>o.to.localeCompare(l.to));for(let o of t){if(a.has(o)||!ne(`${e}/${o}`))continue;let l=r.filter(c=>!s.has(c)).filter(c=>W(c)===W(o));if(l.length===0)continue;let u=_(e,o),d=l.map(c=>({from:c,to:o,similarity:he(ue({projectRoot:e,base:i,relativePath:c})??"",u)})).sort((c,m)=>m.similarity-c.similarity)[0];d&&d.similarity>=.45&&(a.set(o,d),s.add(d.from))}return[...a.values()].sort((o,l)=>o.to.localeCompare(l.to))}function pe(e){let i=new Set,t=new Map,n=new Set;for(let a of e.flatMap(s=>V(s))){let[s,r,o]=a.split(" ");if(!(!s||!r)){if(s.startsWith("R")&&o){i.add(o),t.set(o,{from:r,to:o,similarity:Number(s.slice(1))/100});continue}i.add(r),s.startsWith("D")&&n.add(r)}}return{changedFiles:[...i],renamedFiles:[...t.values()],deletedFiles:[...n]}}function he(e,i){let t=new Set(U(e)),n=new Set(U(i));if(t.size===0&&n.size===0)return 1;if(t.size===0||n.size===0)return 0;let a=0;for(let s of t)n.has(s)&&(a+=1);return 2*a/(t.size+n.size)}function U(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function V(e){return e.split(`
3
- `).map(i=>i.trim()).filter(i=>i.length>0)}function be(e,i){let t=Y(e),n=[];for(let a of i){let s=t(a);s&&!e.isIgnored(s)&&n.push(s)}return n}function ye(e,i){let t=Y(e),n=[];for(let a of i){let s=t(a.file);s&&!e.isIgnored(s)&&n.push({...a,file:s})}return K(n)}function Y(e){let i=e.all(`SELECT relative_path FROM documents
4
- ORDER BY id`).map(n=>n.relative_path),t=new Map(i.map(n=>[n,n]));return n=>{let a=n.replace(/\\/g,"/"),s=t.get(a);return s||(i.find(r=>r.endsWith(a))??null)}}function q(e){let i=[],t=null;for(let n of e.split(`
5
- `)){if(n.startsWith("+++ ")){t=Re(n.slice(4).trim());continue}if(!t||!n.startsWith("@@ "))continue;let a=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(n);if(!a)continue;let s=Math.max(0,Number(a[1])-1),r=a[2]===void 0?1:Number(a[2]);i.push({file:t,startLine:s,endLine:Math.max(s,s+Math.max(r,1)-1)})}return i}function Re(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function K(e){let i=new Set,t=[];for(let n of e){let a=`${n.file}:${n.startLine}:${n.endLine}`;i.has(a)||(i.add(a),t.push(n))}return t}function Ce(e,i){let t=i.get(e.relativePath);return!t||t.length===0?!0:t.some(n=>x(e.startLine,e.endLine,n.startLine,n.endLine))}function Se(e,i,t){let n=new Map,a=[],s=Q(e),r=Fe(t);for(let o of i){let l=s.get(o.file)??[];if(l.some(c=>x(c.startLine,c.endLine,o.startLine,o.endLine)))continue;let u=r.get(o.file)??[],d=xe(u,o);if(d){let c=l.find(m=>m.startLine>=d.startLine&&m.startLine<=d.endLine);if(c){n.set(c.symbolId,c),a.push(D(o,"ast-widened"));continue}}if(u.length===0){let c=[...l].filter(m=>m.startLine<=o.startLine).sort((m,p)=>p.startLine-m.startLine||m.endLine-p.endLine)[0];if(c){n.set(c.symbolId,c),a.push(D(o,"nearest-preceding"));continue}}a.push(D(o,"unattributed"))}return{definitions:[...n.values()],notes:a}}function ve(e,i,t,n){let a=Q(t),s=[],r=[],o=[...new Set(i.map(l=>l.relativePath))];for(let l of o){let u=n.get(l)??[];if(u.length===0)continue;let d=a.get(l)??[];for(let c of u)d.some(m=>x(m.startLine,m.endLine,c.startLine,c.endLine))||s.push(c);s.some(c=>c.file===l)&&r.push(...De(e,l))}return Se(i,s,r)}function De(e,i){let t=A(e,i);return t?t.rootNode.namedChildren.filter(Le).map(n=>({file:i,startLine:n.startPosition.row,endLine:n.endPosition.row})).filter(n=>n.endLine>=n.startLine):[]}function Le(e){return e.endPosition.row<e.startPosition.row?!1:!new Set(["import_statement","comment"]).has(e.type)}function Ie(e){let i=new Map;for(let t of e)i.set(t.symbolId,t);return[...i.values()]}function Q(e){let i=new Map;for(let t of e){let n=i.get(t.relativePath)??[];n.push(t),i.set(t.relativePath,n)}return i}function Fe(e){let i=new Map;for(let t of e){let n=i.get(t.file)??[];n.push(t),i.set(t.file,n)}return i}function xe(e,i){return e.filter(t=>t.startLine<=i.startLine&&t.endLine>=i.endLine).sort((t,n)=>t.endLine-t.startLine-(n.endLine-n.startLine))[0]}function D(e,i){return{file:e.file,startLine:e.startLine,endLine:e.endLine,method:i}}function x(e,i,t,n){return e<=n&&t<=i}function Be(e,i,t,n,a,s,r,o,l){let u=Math.max(o,s.size,r.size);if(!_e(i,u))return;let d=k(i.symbol);n.push({symbol:i.symbol,shortName:d,file:i.relativePath,startLine:i.startLine,endLine:i.endLine,fanIn:u});for(let c of l)L(e,t,a,c,d);for(let c of s)L(e,t,a,c,d);for(let c of r)L(e,t,a,c,d)}function H(e,i,t){try{return{values:t(),status:{tier:e,state:"complete",attemptedSymbols:i}}}catch(n){return{values:new Map,status:{tier:e,state:"failed",attemptedSymbols:i,reason:Me(n)}}}}function we(e){return["semantic-consumers","source-fallback-consumers"].map(i=>{let t=e.map(s=>s.evidenceTiers?.find(r=>r.tier===i)??{tier:i,state:"failed",attemptedSymbols:0,reason:"isolated diff-impact batch omitted its evidence-tier status"}),n=t.reduce((s,r)=>s+r.attemptedSymbols,0),a=[...new Set(t.filter(s=>s.state==="failed").map(s=>s.reason))];return a.length===0?{tier:i,state:"complete",attemptedSymbols:n}:{tier:i,state:"failed",attemptedSymbols:n,reason:a.join("; ").slice(0,500)}})}function X(){return[{tier:"semantic-consumers",state:"complete",attemptedSymbols:0},{tier:"source-fallback-consumers",state:"complete",attemptedSymbols:0}]}function Me(e){let t=(e instanceof Error?e.message:String(e)).replaceAll(/\s+/g," ").trim().slice(0,500);return t===""?"evidence provider failed without a reason":t}function Pe(e,i){if(i.length===0)return new Map;let t=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
6
- FROM mentions m
7
- JOIN chunks c ON m.chunk_id = c.id
8
- WHERE m.symbol_id IN (${i.map(()=>"?").join(",")})
9
- AND m.role != 1
10
- GROUP BY m.symbol_id`,...i);return new Map(t.map(n=>[n.symbol_id,n.fan_in]))}function Ee(e,i,t){if(i.length===0||t.length===0)return new Map;let n=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
11
- FROM mentions m
12
- JOIN chunks c ON m.chunk_id = c.id
13
- JOIN documents ref_d ON c.document_id = ref_d.id
14
- WHERE m.symbol_id IN (${i.map(()=>"?").join(",")})
15
- AND m.role != 1
16
- AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
17
- ${e.pathExclusionsFor("ref_d")}`,...i,...t),a=new Map;for(let s of n){let r=a.get(s.symbol_id);r||(r=new Set,a.set(s.symbol_id,r)),r.add(s.relative_path)}return a}function L(e,i,t,n,a){if(e.isIgnored(n)||i.has(n))return;let s=t.get(n);s||(s=new Set,t.set(n,s)),s.add(a)}function Te(e){return[...e.entries()].map(([i,t])=>({file:i,consumedSymbols:t.size})).sort((i,t)=>t.consumedSymbols-i.consumedSymbols)}function Ne(e){return!(j(e.symbol)||e.parentTypeName!==null&&!C(e.symbol))}function _e(e,i){return C(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&i>0}export{ie as a,Ze as b,ae as c,re as d,oe as e,ue as f,J as g,F as h,fe as i,Ve as j,Ye as k,Ke as l,Se as m};
18
- //# sourceMappingURL=chunk-BDHFVH2M.js.map
@@ -1,8 +0,0 @@
1
- import{b as p}from"./chunk-Q6T2CAJL.js";import{a as T}from"./chunk-DHEQMPLW.js";import{b as N}from"./chunk-4GAQ6FI4.js";import{a as A,e as h,t as D}from"./chunk-TD7VKJ2Y.js";import{w as O}from"./chunk-42W3LFUK.js";import{a as m}from"./chunk-7JYHQAH2.js";import{E as j,d as u}from"./chunk-Q7GBK5T7.js";import{c as l,xa as S,ya as w,za as _}from"./chunk-GH5YSGZL.js";import{existsSync as b,readdirSync as M}from"fs";import{join as d}from"path";var it={files:new Set,pathPrefixes:[]},at={reasonsByFile:new Map},P=/^(?:dist|build|lib|out|output|esm|cjs|umd)\//,ot=/\.(?:d\.ts|d\.mts|d\.cts|ts|tsx|mts|cts|js|jsx|mjs|cjs)$/,C=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],ct=new Set([".git",".next",".turbo","build","coverage","dist","node_modules","out"]),ut=4,ft=u("package-surface",{clearGroups:["whole-project"]}),lt=u("package-operational-surface",{clearGroups:["whole-project"]});function $(t){return ft.get(t,()=>pt(t.config.projectRoot))}function x(t,e){let n=$(t);return n.files.has(e)?!0:n.pathPrefixes.some(r=>e.startsWith(r))}function I(t,e){return $(t).files.has(e)}function gt(t){return lt.get(t,()=>dt(t.config.projectRoot))}function ce(t,e){return gt(t).reasonsByFile.get(e)??[]}function pt(t){let e=new Set,n=[];for(let{manifest:r,packageRoot:s}of L(t))for(let i of St(r))U(t,s,i,e,n);return e.size===0&&n.length===0?it:{files:e,pathPrefixes:n}}function dt(t){let e=new Map;for(let{manifest:n,packageRoot:r}of L(t)){let s=mt(n);for(let a of s)v(t,r,a,"package binary",e);let i=n.scripts;if(!(!i||typeof i!="object")){for(let[a,o]of Object.entries(i))if(typeof o=="string")for(let c of ht(o))v(t,r,c,`package script "${a}"`,e)}}return e.size===0?at:{reasonsByFile:e}}function L(t){let e=[],n=X(t,"");return n&&e.push({manifest:n,packageRoot:""}),V(t,"",e,0),e}function V(t,e,n,r){if(r>=ut)return;let s=d(t,e);if(b(s))for(let i of M(s,{withFileTypes:!0})){if(!i.isDirectory()||ct.has(i.name))continue;let a=e?`${e}/${i.name}`:i.name,o=X(t,a);o&&n.push({manifest:o,packageRoot:a}),V(t,a,n,r+1)}}function X(t,e){let n;try{n=S(t,d(e,"package.json"),{maxBytes:8*1024*1024,inputKind:"package manifest"})}catch(r){if(!w(r))throw r;return null}try{let r=JSON.parse(n);return r&&typeof r=="object"?r:null}catch{return null}}function St(t){let e=[];for(let r of["main","module","types","browser"])typeof t[r]=="string"&&e.push(t[r]);let n=t.bin;if(typeof n=="string")e.push(n);else if(n&&typeof n=="object")for(let r of Object.values(n))typeof r=="string"&&e.push(r);return B(t.exports,e),e}function mt(t){let e=t.bin;return typeof e=="string"?[e]:!e||typeof e!="object"?[]:Object.values(e).filter(n=>typeof n=="string")}function ht(t){let e=[],n=/(?:^|&&|\|\||;)\s*(?:(?:cross-env|env)(?:\s+[A-Za-z_][A-Za-z0-9_]*=\S+)*\s+)?(?:node|bun|tsx|ts-node|vite-node|python3?|deno\s+run)\s+(?:(?:--?[A-Za-z0-9-]+(?:=\S+)?)\s+)*["']?([^"'`\s]+\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs|py))["']?/g;for(let r of t.matchAll(n)){let s=r[1];s&&!s.startsWith("node_modules/")&&!s.startsWith("./node_modules/")&&e.push(s)}return e}function v(t,e,n,r,s){let i=new Set;U(t,e,n,i,[]);for(let a of i){let o=s.get(a)??[];o.includes(r)||o.push(r),s.set(a,o)}}function B(t,e){if(typeof t=="string"){e.push(t);return}if(!(!t||typeof t!="object"))for(let n of Object.values(t))B(n,e)}function U(t,e,n,r,s){let i=n.replace(/\\/g,"/").replace(/^\.\//,"");if(i===""||i.startsWith(".."))return;let a=i.indexOf("*");if(a>=0){let c=i.slice(0,a);for(let g of F(c))g!==""&&s.push(f(e,g));return}let o=i.replace(ot,"");for(let c of F(o)){c===o&&c===i&&r.add(f(e,i));for(let g of C)bt(t,r,e,c+g)}r.add(f(e,i))}function F(t){let e=[t];return P.test(t)&&(e.push(t.replace(P,"src/")),e.push(t.replace(P,""))),e}function bt(t,e,n,r){let s=f(n,r);if(e.add(s),!r.startsWith("src/")||b(d(t,s)))return;let i=C.find(y=>r.endsWith(y));if(!i)return;let a=r.slice(0,-i.length);yt(t,e,n,a,i);let o=a.lastIndexOf("/");if(o<=4)return;let c=a.slice(0,o),g=a.slice(o+1);for(let y of G(t,n,c,`${g}${i}`))e.add(y)}function yt(t,e,n,r,s){let i=f(n,`${r}/index${s}`);b(d(t,i))&&e.add(i)}function G(t,e,n,r){let s=d(t,e,n);if(!b(s))return[];let i=[];for(let a of M(s,{withFileTypes:!0})){let o=`${n}/${a.name}`;a.isDirectory()?i.push(...G(t,e,o,r)):a.isFile()&&a.name===r&&i.push(f(e,o))}return i}function f(t,e){return t?`${t}/${e}`:e}import{existsSync as E,readdirSync as Pt}from"fs";import{dirname as xt,join as k}from"path";var Et={rootFiles:new Set,sourcePrefixes:[]},kt=new Set([".git",".scipquery","node_modules","target"]),Rt=6,Tt=u("rust-library-surface",{clearGroups:["whole-project"]});function W(t,e,n){if(!n.endsWith(".rs")||!jt(wt(t),n))return!1;let r=D(t,n).find(s=>s.symbol===e);return r?Ot(j(t,n)[r.startLine]??""):!1}function wt(t){return Tt.get(t,()=>_t(t.config.projectRoot))}function _t(t){let e=new Set,n=new Set;for(let r of Nt(t)){let s=S(t,k(r,"Cargo.toml"),{maxBytes:8388608,inputKind:"Cargo manifest"}),i=At(s),a=f(r,"src/lib.rs"),o=i?f(r,i):!Dt(s)&&_(t,a)?a:null;if(!o)continue;e.add(o);let c=xt(o).replaceAll("\\","/");n.add(c==="."?"":`${c}/`)}return e.size===0?Et:{rootFiles:e,sourcePrefixes:[...n].sort()}}function jt(t,e){return e.endsWith(".rs")?t.rootFiles.has(e)?!0:vt(e)?!1:t.sourcePrefixes.some(n=>e.startsWith(n)):!1}function Ot(t){return/^\s*pub\s+(?!\()/.test(t)}function Nt(t){if(!E(t))return[];let e=[];return H(t,"",e,0),e}function H(t,e,n,r){let s=k(t,e);if(E(s)&&(E(k(s,"Cargo.toml"))&&n.push(e),!(r>=Rt)))for(let i of Pt(s,{withFileTypes:!0})){if(!i.isDirectory()||kt.has(i.name))continue;let a=e?`${e}/${i.name}`:i.name;H(t,a,n,r+1)}}function At(t){let e=!1;for(let n of t.split(`
2
- `)){let r=n.replace(/\s+#.*$/,"").trim(),s=/^\[([^\]]+)\]$/.exec(r);if(s){e=s[1]==="lib";continue}if(!e)continue;let i=/^path\s*=\s*["']([^"']+)["']/.exec(r)?.[1];if(i)return i.replaceAll("\\","/").replace(/^\.\//,"")}return null}function Dt(t){let e=!1;for(let n of t.split(`
3
- `)){let r=n.replace(/\s+#.*$/,"").trim(),s=/^\[([^\]]+)\]$/.exec(r);if(s){e=s[1]==="package";continue}if(e&&/^autolib\s*=\s*false\b/.test(r))return!0}return!1}function vt(t){return/(?:^|\/)src\/main\.rs$/.test(t)||/(?:^|\/)src\/bin\//.test(t)||/(?:^|\/)(?:examples|tests|benches)\//.test(t)}function Ft(t){return p(t)==="barrel"}function q(t){return Mt.get(t,()=>{let n=m(t,{includeIgnored:!1}).filter(a=>{let o=p(a);return o==="entry"||o==="worker"});if(n.length===0)return new Set;let r=N(t),s=new Set,i=new Set;for(;n.length>0;){let a=n.shift();if(!s.has(a)){s.add(a),p(a)==="barrel"&&i.add(a);for(let o of r.get(a)??[])s.has(o)||n.push(o)}}return i})}var Mt=u("live-barrels",{clearGroups:["whole-project"]});function Ct(t,e){return q(t).has(l(e))}function Ne(t){let e=q(t);return m(t,{includeIgnored:!1}).filter(n=>Ft(n)&&!e.has(n)&&!$t(t,n))}function $t(t,e){let n=l(e),r=A(t).forFile(n,{facts:!0}).facts?.callables;return r&&r.length>0?!0:(t.get(`SELECT COUNT(*) AS n
4
- FROM defn_enclosing_ranges der
5
- JOIN documents d ON d.id = der.document_id
6
- WHERE d.relative_path = ?
7
- AND der.end_line - der.start_line >= 2`,n)?.n??0)>0}function Ae(t,e){let n=l(e),r=p(e);return r==="entry"||r==="worker"||ee(n)||Ct(t,n)}function It(t,e,n){let r=l(n),s=[];x(t,r)&&s.push("package-surface-file"),Xt(t,e,r)&&s.push("transitive-package-surface"),W(t,e,r)&&s.push("rust-public-library"),te(e,r)&&s.push("framework-entrypoint");let i=t.config.entryRoots;return i&&(i.files?.some(a=>l(a)===r)&&s.push("configured-file"),i.pathPrefixes?.some(a=>r.startsWith(l(a)))&&s.push("configured-path-prefix"),i.qualifiedVars?.some(a=>re(e,a))&&s.push("configured-qualified-var"),i.symbolPatterns?.some(a=>{try{return T(a,"entryRoots.symbolPatterns entry").test(e)}catch{return!1}})&&s.push("configured-symbol-pattern")),s}function De(t,e,n){return It(t,e,n).length>0}var Lt=u("package-surface-reachability",{clearGroups:["whole-project"]}),Vt=u("explicit-package-surface-reachability",{clearGroups:["whole-project"]});function Xt(t,e,n){let r=Bt(t).get(n);return r===void 0?!1:r===null||r.has(h(e))}function ve(t,e,n){let r=Ut(t).get(n);return r===void 0?!1:r===null||r.has(h(e))}function Bt(t){return Lt.get(t,()=>Y(t,e=>x(t,e)))}function Ut(t){return Vt.get(t,()=>Y(t,e=>I(t,e)))}function Y(t,e){let n=new Map,r=[];for(let s of m(t,{includeIgnored:!1}))e(s)&&(n.set(s,null),r.push(s));for(;r.length>0;){let s=r.shift(),i=n.get(s);if(i!==void 0)for(let a of O(t,s)){if(!a.sourcePath||t.isIgnored(a.sourcePath))continue;let o=Gt(i,a);o!==void 0&&Wt(n,a.sourcePath,o)&&r.push(a.sourcePath)}}return n}function Gt(t,e){if(t===null)return e.kind==="named"?new Set(e.names):null;if(e.kind==="star")return new Set(t);if(e.kind==="star-as")return e.names.some(r=>t.has(r))?null:void 0;let n=e.names.filter(r=>t.has(r));return n.length>0?new Set(n):void 0}function Wt(t,e,n){if(!t.has(e))return t.set(e,n),!0;let r=t.get(e);if(r===void 0)return!1;if(r===null||n===null)return r===null?!1:(t.set(e,null),!0);let s=!1;for(let i of n)r.has(i)||(r.add(i),s=!0);return s}var Z=new Set(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]),Ht=new Set(["default","generateMetadata","generateStaticParams"]),Kt=new Set(["default","getStaticProps","getServerSideProps","getStaticPaths","config"]),qt=new Set(["default","middleware","config"]),Yt=new Set(["register","onRequestError"]),Zt=new Set(["onRouterTransitionStart"]),Jt=new Set(["default","loader","action","clientLoader","clientAction","headers","links","meta","shouldRevalidate","ErrorBoundary","HydrateFallback"]),Qt=new Set(["load","actions","entries",...Z]),zt=new Set(["default"]);function te(t,e){let n=h(t);return n===""?!1:J(e)?Z.has(n):Q(e)?Ht.has(n):z(e)?Kt.has(n):tt(e)?qt.has(n):et(e)?Yt.has(n):nt(e)?Zt.has(n):rt(e)?Jt.has(n):st(e)?Qt.has(n):ne(e)?zt.has(n):!1}function ee(t){return J(t)||Q(t)||z(t)||tt(t)||et(t)||nt(t)||rt(t)||st(t)}function J(t){return/(?:^|\/)app(?:\/[^/]+)*\/route\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function Q(t){return/(?:^|\/)app(?:\/[^/]+)*\/(?:page|layout|template|loading|error|not-found|global-error|head|default)\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function z(t){return/(?:^|\/)pages\/.+\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function tt(t){return R(t,"(?:middleware|proxy)\\.(?:ts|js|mts|mjs)")}function et(t){return R(t,"instrumentation\\.(?:ts|js|mts|mjs)")}function nt(t){return R(t,"instrumentation-client\\.(?:ts|js|mts|mjs)")}function R(t,e){return new RegExp(`^(?:src/)?${e}$`).test(t)||new RegExp(`(?:^|/)src/${e}$`).test(t)||new RegExp(`(?:^|/)(?:apps|services|packages)/[^/]+/(?:src/)?${e}$`).test(t)}function rt(t){return/(?:^|\/)app\/routes\/.+\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function st(t){return/(?:^|\/)src\/routes\/(?:.*\/)?\+(?:page|page\.server|layout|layout\.server|server)\.(?:ts|js)$/.test(t)}function ne(t){return/(?:^|\/)src\/(?:pages|views|routes)\/.+\.(?:ts|tsx|js|jsx|vue)$/.test(t)}function re(t,e){let n=e.lastIndexOf("/");if(n<0)return!1;let r=e.slice(0,n),s=e.slice(n+1);return t.includes(K(r)+"/")&&t.includes(K(s)+".")}function K(t){return/^[A-Za-z0-9_$+-]+$/.test(t)?t:"`"+t.replace(/`/g,"``")+"`"}export{x as a,ce as b,Ft as c,Ct as d,Ne as e,Ae as f,It as g,De as h,ve as i,ee as j};
8
- //# sourceMappingURL=chunk-BECZLYNU.js.map
@@ -1,10 +0,0 @@
1
- import{a as F}from"./chunk-Z2AWCTN6.js";import{c as E}from"./chunk-BWVQP3LB.js";import{a as M,c as x}from"./chunk-5H5WTJSD.js";import{A,d as S,f as R,t as N}from"./chunk-TD7VKJ2Y.js";import{z as w}from"./chunk-7JYHQAH2.js";function K(t,o,n={}){return _(t,o,n).rows}function q(t,o,n={}){return _(t,o,n)}function _(t,o,n){let{maxDepth:i=5,scope:a}=n,c=i===Number.MAX_SAFE_INTEGER,r=c?null:500,h=M(t,o);if(!h)return{rows:[],coverage:{status:"incomplete",edgeBasis:"reverse-static-call-or-reference-evidence",maxDepth:i,reachedDepth:0,perSymbolEvidenceLimit:r,remainingFrontierSymbols:0,reasons:["The requested symbol could not be resolved."]}};let m=[],u=new Set([h.symbolId]),s=new Set,e=[h],f=0,b=!1;for(let d=1;d<=i&&e.length!==0;d++){f=d;let p=[],C=E(t,e,{...c?{}:{limit:r+1},semanticEvidence:F});for(let v of e){let g=C.get(v.symbolId)??[];r!==null&&g.length>r&&(b=!0);let $=r===null?g:g.slice(0,r);for(let l of P(t,v,a,$)){let D=`${l.file}|${l.shortName}`;if(l.symbolId!==null){if(u.has(l.symbolId))continue;u.add(l.symbolId)}else if(s.has(D))continue;s.add(D),m.push({symbol:l.symbol,shortName:l.shortName,file:l.file,depth:d}),l.symbolId!==null&&l.symbolMatch&&p.push(l.symbolMatch)}}e=p}m.sort((d,p)=>d.depth-p.depth||d.file.localeCompare(p.file));let I=e.length>0,y=[];return I&&y.push(`${e.length} symbol(s) remain eligible beyond depth ${i}.`),b&&y.push(`At least one symbol had more than ${r} incoming evidence row(s).`),y.length===0&&y.push("The discovered reverse evidence frontier was exhausted."),{rows:m,coverage:{status:I||b?"bounded":"accounted",edgeBasis:"reverse-static-call-or-reference-evidence",maxDepth:i,reachedDepth:f,perSymbolEvidenceLimit:r,remainingFrontierSymbols:e.length,reasons:y}}}function P(t,o,n,i){let a=i.filter(s=>!t.isIgnored(s.file)).filter(s=>!n||s.file.includes(n)),c=new Set(a.map(s=>s.file)),r=[];for(let s of L(t,o,n)){if(c.has(s))continue;let e=N(t,s),f=e.length>0?A(e,e[0].startLine):null;r.push({symbol:f?.symbol??s,file:s})}let h=[...a,...r],m=[],u=new Set;for(let s of h){let e=x(t,s.symbol);if(!e){let b=`${s.file}|${s.symbol}`;if(u.has(b))continue;u.add(b),m.push({symbolId:null,symbol:s.symbol,shortName:S(s.symbol),file:s.file,symbolMatch:null});continue}if(e.symbolId===o.symbolId||t.isIgnored(e.relativePath)||!T(e))continue;let f=`${e.symbolId}|${e.relativePath}`;u.has(f)||(u.add(f),m.push({symbolId:e.symbolId,symbol:e.symbol,shortName:S(e.symbol),file:e.relativePath,symbolMatch:e}))}return m}function L(t,o,n){let i=n?"AND consumer_d.relative_path LIKE ?":"",a=[o.symbolId,o.documentId];return n&&a.push(`%${n}%`),new Set(t.all(`SELECT DISTINCT consumer_d.relative_path
2
- FROM mentions m
3
- JOIN chunks c ON m.chunk_id = c.id
4
- JOIN documents consumer_d ON consumer_d.id = c.document_id
5
- WHERE m.symbol_id = ?
6
- AND m.role != 1
7
- AND c.document_id != ?
8
- ${t.pathExclusionsFor("consumer_d")}
9
- ${i}`,...a).map(c=>c.relative_path).filter(c=>!t.isIgnored(c)))}function T(t){if(t.symbol.startsWith("scip-clojure ")||w(t.relativePath)==="clojure")return!0;let o=R(t.symbol);return o==="method"||o==="type"||t.symbol.endsWith("().")}export{K as a,q as b};
10
- //# sourceMappingURL=chunk-BUTEIZKP.js.map
@@ -1,38 +0,0 @@
1
- import{c as K,d as O,e as Q,f as U,n as Y}from"./chunk-AYPDH2LU.js";import{a as H}from"./chunk-4GAQ6FI4.js";import{d as V,e as Z}from"./chunk-MTDBHTSF.js";import{A as J,e as $,g as B,t as N,u as G,z as W}from"./chunk-TD7VKJ2Y.js";import{s as D,x,z as j}from"./chunk-42W3LFUK.js";import{z as k}from"./chunk-7JYHQAH2.js";import{d as A}from"./chunk-Q7GBK5T7.js";import{d as v}from"./chunk-GH5YSGZL.js";function Ie(o,t,n={}){let i=z(o,[t],{additive:n.additive,semantic:n.semantic,semanticEvidence:n.semanticEvidence}),l=n.callableOnly?(i.get(t.symbolId)??[]).filter(s=>B(s.symbol)||s.source==="ast-callsite"):i.get(t.symbolId)??[];return typeof n.limit=="number"?l.slice(0,n.limit):l}function ve(o,t,n){return te(o,[t],n).get(t.symbolId)??[]}function te(o,t,n){let i=se(o)?ce(o,t,{semantic:n.semantic!==!1,semanticEvidence:n.semanticEvidence}):ae(o,n.semanticEvidence);return typeof n.limit!="number"?new Map(t.map(l=>[l.symbolId,i.get(l.symbolId)??[]])):new Map(t.map(l=>[l.symbolId,(i.get(l.symbolId)??[]).slice(0,n.limit)]))}var oe=A("caller-rows",{clearGroups:["whole-project"]}),ie=A("targeted-caller-strategy",{clearGroups:["whole-project"]}),le=2e4;function se(o){return ie.get(o,()=>(o.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>le)}function ae(o,t){return oe.get(o,()=>{let n=G(o),i=z(o,n,{semanticEvidence:t}),l=new Map;for(let c of n)l.set(c.symbol,c.symbolId);let s=new Map,a=new Map;for(let c of n){let f=i.get(c.symbolId);if(!(!f||f.length===0))for(let b of f){let r=l.get(b.symbol);if(r===void 0||r===c.symbolId)continue;let u=s.get(r);u||(u=[],s.set(r,u),a.set(r,new Set));let h=`${c.symbol}|${c.relativePath}`;a.get(r).has(h)||(a.get(r).add(h),u.push({symbol:c.symbol,file:c.relativePath,source:"caller-map-inversion",callEvidence:b.source}))}}return s})}function ce(o,t,n){let i=n.semantic&&n.semanticEvidence?t.flatMap(e=>{let d=re(o,e);return d?[d]:[]}):[],l=new Map(i.map(e=>[e.symbolId,e])),s=n.semanticEvidence?.referenceMap(o,i)??new Map,a=Y(o,t),c=new Set(t.map(e=>e.symbol)),b=[...new Set(t.flatMap(e=>H(o,"reverse",[e.relativePath])))].flatMap(e=>N(o,e)),r=new Map,u=X(o,b);for(let e of b)for(let d of u.get(e.symbolId)??[]){if(!c.has(d.symbol))continue;let g=r.get(d.symbol)??[];g.push({symbol:e.symbol,file:e.relativePath,source:"caller-map-inversion",callEvidence:d.source}),r.set(d.symbol,g)}let h=new Map;for(let e of t){let d=[],g=new Set,S=m=>{if(m.symbol===e.symbol)return;let E=`${m.symbol}|${m.file}`;g.has(E)||(g.add(E),d.push(m))};for(let m of r.get(e.symbol)??[])S(m);for(let m of a.get(e.symbolId)??[])m.file!==e.relativePath&&S({symbol:m.enclosingSymbol??m.file,file:m.file,source:"resolved-reference"});let L=l.get(e.symbolId);if(L)for(let m of s.get(L.symbolId)??[]){if(m.file===e.relativePath||o.isIgnored(m.file))continue;let E=J(N(o,m.file),m.line);S({symbol:E?.symbol??m.file,file:m.file,source:"semantic-reference"})}h.set(e.symbolId,d)}return h}function re(o,t){let n=V().join(", "),i=Z().join(", ");return o.get(`SELECT
2
- d.id AS documentId,
3
- gs.id AS symbolId,
4
- gs.symbol,
5
- d.relative_path AS relativePath,
6
- COALESCE(der.start_line, c.start_line) AS startLine,
7
- COALESCE(der.end_line, c.end_line) AS endLine,
8
- COALESCE(gs.display_name, '') AS leaf,
9
- NULL AS parentTypeName,
10
- CASE WHEN gs.kind IN (${n}) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
11
- CASE WHEN gs.kind IN (${i}) THEN 1 ELSE 0 END AS isTypeLike,
12
- gs.kind AS kind,
13
- gs.documentation AS documentation,
14
- gs.enclosing_symbol AS enclosingSymbol
15
- FROM global_symbols gs
16
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
17
- LEFT JOIN chunks c ON c.document_id = der.document_id
18
- JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
19
- WHERE gs.id = ?
20
- LIMIT 1`,t.symbolId)??null}function z(o,t,n={}){if(t.length===0)return new Map;let i=n.additive??!1,l=[],s=[];for(let r of t)k(r.relativePath)&&D(o,r.relativePath)!==null?l.push(r):s.push(r);let a=new Map,c=new Map,f=r=>{for(let[u,h]of r){let e=a.get(u);e||(e=[],a.set(u,e));let d=c.get(u);d||(d=new Set,c.set(u,d));for(let g of h){let S=`${g.symbol}|${g.chunkId}`;d.has(S)||(d.add(S),e.push(g))}}};l.length>0&&f(X(o,l)),n.semantic!==!1&&n.semanticEvidence&&f(ye(n.semanticEvidence.calleeMap(o,t)));let b=i?t:s;return b.length>0&&f(fe(o,b)),a}function X(o,t){let n=new Map,i=me(t,n),l=U(o);for(let[s,a]of i){let c=D(o,s);if(!c)continue;let f=W(a);for(let b of c){let r=f.get(b.line);if(!r)continue;let u=de(o,s,l,b);u&&u.symbol!==r.symbol&&n.get(r.symbolId).push({symbol:u.symbol,file:u.file,chunkId:b.line,source:"ast-callsite",callsiteLine:b.line})}}return n}function me(o,t){let n=new Map;for(let i of o){let l=n.get(i.relativePath);l?l.push(i):n.set(i.relativePath,[i]),t.set(i.symbolId,[])}for(let i of n.values())i.sort((l,s)=>l.endLine-l.startLine-(s.endLine-s.startLine));return n}function de(o,t,n,i){let l=j(o,t,i.calleeLeaf);if(l){let c=O(t,n.get(l.importedName)??[]).filter(f=>v(l.sourcePath,f.file));return c.length===1?c[0]:null}let s=O(t,n.get(i.calleeLeaf)??[]);if(s.length===0)return null;let a=ue(o,t,s,i.calleeQualifier);return a||Q(o,t,s,i.memberAccess,i.calleeQualifier)}function ue(o,t,n,i){if(!i||k(t)!=="clojure")return null;let s=x(o,t).filter(a=>a.kind==="namespace"&&a.localName===i&&a.sourcePath).map(a=>a.sourcePath);for(let a of s){let c=n.find(f=>v(a,f.file));if(c)return c}return n.find(a=>/`([^`]+)`\//.exec(a.symbol)?.[1]===i)??null}function fe(o,t){if(t.length===0)return new Map;let i=T(t.map(e=>e.documentId)).flatMap(e=>o.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
21
- FROM mentions m
22
- JOIN chunks c ON m.chunk_id = c.id
23
- WHERE m.role != 1
24
- AND c.document_id IN (${e.map(()=>"?").join(",")})`,...e)),l=new Map;for(let e of i)l.has(e.document_id)||l.set(e.document_id,[]),l.get(e.document_id).push(e);let a=T(i.map(e=>e.symbol_id)).flatMap(e=>o.all(`SELECT gs.id AS symbol_id, gs.symbol,
25
- COALESCE(der.document_id, def_chunk.document_id) AS document_id
26
- FROM global_symbols gs
27
- LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
28
- LEFT JOIN (
29
- SELECT m.symbol_id, MIN(c.document_id) AS document_id
30
- FROM mentions m
31
- JOIN chunks c ON m.chunk_id = c.id
32
- WHERE m.role = 1
33
- AND m.symbol_id IN (${e.map(()=>"?").join(",")})
34
- GROUP BY m.symbol_id
35
- ) def_chunk ON def_chunk.symbol_id = gs.id
36
- WHERE gs.id IN (${e.map(()=>"?").join(",")})`,...e,...e)),c=T([...t.map(e=>e.documentId),...a.flatMap(e=>e.document_id===null?[]:[e.document_id])]),f=new Map(c.flatMap(e=>o.all(`SELECT id, relative_path FROM documents
37
- WHERE id IN (${e.map(()=>"?").join(",")})`,...e).map(d=>[d.id,d.relative_path]))),b=new Map;for(let e of a)b.has(e.symbol_id)||b.set(e.symbol_id,{symbol:e.symbol,file:e.document_id!==null?f.get(e.document_id)??"":""});let r=new Map,u=f,h=be(t);for(let[e,d]of h){let S=[...l.get(e)??[]].sort((y,C)=>y.start_line-C.start_line||y.end_line-C.end_line),L=[...d].sort((y,C)=>y.startLine-C.startLine||y.endLine-C.endLine),m=new Set,E=0;for(let y of L){for(;E<S.length&&S[E].start_line<=y.endLine;)m.add(S[E]),E+=1;for(let p of m)p.end_line<y.startLine&&m.delete(p);let C=new Set,P=[],R=null,ee=()=>{if(R)return R;let p=u.get(y.documentId)??"",_=new Set;if(p){let I=K(o,p),w=Math.max(0,y.startLine),F=Math.min(I.length-1,y.endLine);for(let M=w;M<=F;M+=1)for(let ne of I[M])_.add(ne)}return R=_,_};for(let p of m){if(p.symbol_id===y.symbolId)continue;let _=b.get(p.symbol_id);if(!_)continue;if(!(p.start_line>=y.startLine&&p.end_line<=y.endLine)){if(!(p.start_line<=y.endLine&&p.end_line>=y.startLine))continue;let M=$(_.symbol);if(!M||!ee().has(M))continue}let w=`${_.symbol}|${p.chunk_id}`;C.has(w)||(C.add(w),P.push({..._,chunkId:p.chunk_id,source:"scip-chunk"}))}r.set(y.symbolId,P)}}return r}var q=500;function T(o){let t=[...new Set(o)],n=[];for(let i=0;i<t.length;i+=q)n.push(t.slice(i,i+q));return n}function be(o){let t=new Map;for(let n of o){let i=t.get(n.documentId);i?i.push(n):t.set(n.documentId,[n])}return t}function ye(o){let t=new Map;for(let[n,i]of o){let l=[];for(let s of i)l.push({symbol:s.symbol,file:s.file,chunkId:-1,source:"semantic-callee",...s.callsiteLine===void 0?{}:{callsiteLine:s.callsiteLine}});t.set(n,l)}return t}export{Ie as a,ve as b,te as c,z as d};
38
- //# sourceMappingURL=chunk-BWVQP3LB.js.map