scip-query 0.21.1 → 0.23.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 (399) hide show
  1. package/CHANGELOG.md +317 -0
  2. package/README.md +11 -0
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-XI2CSWEY.js +2 -0
  5. package/dist/call-graph-UONR6JR5.js +2 -0
  6. package/dist/{chunk-JGMD6JGB.js → chunk-2E7CX53V.js} +2 -2
  7. package/dist/chunk-2GRUZAQF.js +43 -0
  8. package/dist/{chunk-RSUH7G5T.js → chunk-2LDBDR6J.js} +2 -2
  9. package/dist/{chunk-4SZJF4GK.js → chunk-2OOY75BW.js} +2 -2
  10. package/dist/{chunk-3YETOKNO.js → chunk-2R3V3PSD.js} +2 -2
  11. package/dist/chunk-2WC2OEDO.js +4 -0
  12. package/dist/{chunk-O4PZFAXA.js → chunk-3AF4TUFK.js} +2 -2
  13. package/dist/{chunk-I2LY3KN7.js → chunk-3D3QG236.js} +2 -2
  14. package/dist/{chunk-DXEJ4FLZ.js → chunk-3FHOF22C.js} +8 -8
  15. package/dist/{chunk-BCTCADNB.js → chunk-3JKSW6LJ.js} +2 -2
  16. package/dist/chunk-3L2ZBPEX.js +133 -0
  17. package/dist/{chunk-4HQYNZ3P.js → chunk-3PJABJSU.js} +2 -2
  18. package/dist/{chunk-GBZCVYWA.js → chunk-3SVF22I5.js} +2 -2
  19. package/dist/{chunk-TP2X2C2Y.js → chunk-3WR4E3A3.js} +2 -2
  20. package/dist/chunk-4FTZ4P5G.js +2 -0
  21. package/dist/{chunk-LJMWILX6.js → chunk-4ILJCCXV.js} +2 -2
  22. package/dist/chunk-4UX2F3JX.js +2 -0
  23. package/dist/chunk-4WNW27SX.js +2 -0
  24. package/dist/chunk-5ENOG4VP.js +61 -0
  25. package/dist/{chunk-YKHL4J3G.js → chunk-64BFSI5I.js} +2 -2
  26. package/dist/chunk-66DVSJQG.js +455 -0
  27. package/dist/{chunk-BYXWXLKM.js → chunk-6HFCYNYE.js} +2 -2
  28. package/dist/{chunk-UBETC3Q2.js → chunk-6I6L7Z62.js} +2 -2
  29. package/dist/{chunk-IZKJQQCQ.js → chunk-6PQNKL3G.js} +2 -2
  30. package/dist/{chunk-ITF3CWS5.js → chunk-6V5CNXL6.js} +2 -2
  31. package/dist/chunk-6VVV4WRR.js +4 -0
  32. package/dist/{chunk-ZQUNCTEZ.js → chunk-7BWFZPPZ.js} +2 -2
  33. package/dist/{chunk-5QM7QT5B.js → chunk-7CYG22FH.js} +2 -2
  34. package/dist/chunk-7F45LJKI.js +2 -0
  35. package/dist/{chunk-QN2AI3D2.js → chunk-7IWV2EG3.js} +2 -2
  36. package/dist/{chunk-5KIJMEPC.js → chunk-AFHTBORT.js} +2 -2
  37. package/dist/chunk-AVRYW5OZ.js +2 -0
  38. package/dist/chunk-B3PYOSCX.js +2 -0
  39. package/dist/{chunk-YF25RQER.js → chunk-B5D7QPBE.js} +2 -2
  40. package/dist/{chunk-PU6XDQ2X.js → chunk-BBCIS4DX.js} +5 -5
  41. package/dist/chunk-BDUVI7TO.js +3 -0
  42. package/dist/{chunk-UXNXOMXJ.js → chunk-BE7ZZTMC.js} +2 -2
  43. package/dist/{chunk-527HV7JY.js → chunk-BHVUJOCQ.js} +2 -2
  44. package/dist/{chunk-4IASLUOP.js → chunk-BJT7LSPK.js} +2 -2
  45. package/dist/chunk-BKVWUP7Y.js +2 -0
  46. package/dist/{chunk-QZCACNV5.js → chunk-BQGB4HBD.js} +2 -2
  47. package/dist/{chunk-QH5Q6M5C.js → chunk-BRV7PIFF.js} +2 -2
  48. package/dist/chunk-CEEZJXEF.js +2 -0
  49. package/dist/{chunk-X5MWO4DM.js → chunk-CIYLO6SI.js} +2 -2
  50. package/dist/chunk-CJZXN4NU.js +2 -0
  51. package/dist/{chunk-V6XENWOF.js → chunk-CNO7TOKL.js} +2 -2
  52. package/dist/{chunk-FUUDUAKM.js → chunk-COF23M5F.js} +2 -2
  53. package/dist/{chunk-GTZFKDP3.js → chunk-CWFP7GM5.js} +2 -2
  54. package/dist/chunk-D2DHWI3D.js +2 -0
  55. package/dist/{chunk-SBFDPHKH.js → chunk-D4N5SQ2M.js} +2 -2
  56. package/dist/{chunk-FCGMQETU.js → chunk-DBRSYFXR.js} +2 -2
  57. package/dist/{chunk-47WX6UC4.js → chunk-DHUIOLDT.js} +2 -2
  58. package/dist/{chunk-KGKCJFWZ.js → chunk-DIRJWYBM.js} +2 -2
  59. package/dist/{chunk-QGVUPYBC.js → chunk-DIUFNHRJ.js} +2 -2
  60. package/dist/{chunk-YLNCTPOI.js → chunk-DTZCKZEU.js} +2 -2
  61. package/dist/{chunk-O3EX5STE.js → chunk-DULC3QFP.js} +2 -2
  62. package/dist/{chunk-B3AREUQK.js → chunk-DYGHBZ2N.js} +2 -2
  63. package/dist/{chunk-AAOEROT3.js → chunk-E5R6AQ73.js} +2 -2
  64. package/dist/{chunk-UM56ZET4.js → chunk-E73UNJTF.js} +2 -2
  65. package/dist/{chunk-6QN4FYQW.js → chunk-EG2CPZMJ.js} +2 -2
  66. package/dist/{chunk-OMVNRPST.js → chunk-EKV5HX33.js} +2 -2
  67. package/dist/{chunk-27OUNZW5.js → chunk-EQHFIL6T.js} +2 -2
  68. package/dist/{chunk-ZGDHC5AT.js → chunk-ESIQ66Z7.js} +2 -2
  69. package/dist/chunk-EVFUMY4R.js +3 -0
  70. package/dist/{chunk-WZRNEVYC.js → chunk-F7DY272B.js} +2 -2
  71. package/dist/chunk-FBN2FGXG.js +2 -0
  72. package/dist/{chunk-HR5JYLVV.js → chunk-FDLOBR6P.js} +2 -2
  73. package/dist/chunk-FESCRNVV.js +5 -0
  74. package/dist/{chunk-MLTKGHD2.js → chunk-FFRKR4EQ.js} +2 -2
  75. package/dist/chunk-FGA2U4OR.js +8 -0
  76. package/dist/{chunk-3KXFB2FM.js → chunk-FIQRSHVM.js} +2 -2
  77. package/dist/{chunk-ZP2WUVZ5.js → chunk-FPYLNQPT.js} +2 -2
  78. package/dist/{chunk-EPLE5O5O.js → chunk-FRUSVINH.js} +2 -2
  79. package/dist/chunk-GAS2LJMP.js +3 -0
  80. package/dist/{chunk-4TOU7HHQ.js → chunk-GSP44ENC.js} +2 -2
  81. package/dist/{chunk-DXYMTQZ4.js → chunk-GUFSG5TX.js} +2 -2
  82. package/dist/chunk-GYIZ4NXB.js +2 -0
  83. package/dist/{chunk-CQVDALWQ.js → chunk-GZIUDL6G.js} +2 -2
  84. package/dist/chunk-HCXEQRFF.js +18 -0
  85. package/dist/{chunk-2LJLEM5B.js → chunk-HEHOQQKH.js} +2 -2
  86. package/dist/{chunk-RNKRYK6B.js → chunk-HKGFPJ4T.js} +2 -2
  87. package/dist/chunk-HLZTEXRA.js +2 -0
  88. package/dist/{chunk-T2PBOVDI.js → chunk-HOENASQM.js} +2 -2
  89. package/dist/{chunk-PX6QNUYF.js → chunk-HVF5VBG6.js} +2 -2
  90. package/dist/{chunk-K2DZCH2K.js → chunk-HYO3NP5Q.js} +2 -2
  91. package/dist/{chunk-MRXBLYRE.js → chunk-I55I7XXP.js} +2 -2
  92. package/dist/{chunk-AQF35NGT.js → chunk-IDFEUFKS.js} +2 -2
  93. package/dist/{chunk-7G2WIVIX.js → chunk-IHGQTTVW.js} +2 -2
  94. package/dist/{chunk-P3UFF22M.js → chunk-IICPE7B2.js} +2 -2
  95. package/dist/{chunk-NT4NVEHU.js → chunk-IL676XCC.js} +2 -2
  96. package/dist/{chunk-OU6SDWAM.js → chunk-ILTDAWEF.js} +2 -2
  97. package/dist/chunk-IW5XQG5G.js +2 -0
  98. package/dist/chunk-IZDPJ2QI.js +2 -0
  99. package/dist/{chunk-J4HUBIVF.js → chunk-J66VOFW6.js} +2 -2
  100. package/dist/chunk-JFMEXGFE.js +2 -0
  101. package/dist/{chunk-DGM2RJ3I.js → chunk-JGKUET5J.js} +2 -2
  102. package/dist/{chunk-BM4OTGSY.js → chunk-JS4PGXMV.js} +2 -2
  103. package/dist/{chunk-OG5UK2K7.js → chunk-JTQVMR42.js} +2 -2
  104. package/dist/chunk-JWTGMPIT.js +80 -0
  105. package/dist/{chunk-3XQLJG7V.js → chunk-JYR66JN5.js} +2 -2
  106. package/dist/chunk-KLFEXGQA.js +2 -0
  107. package/dist/chunk-KYSDI3GE.js +5 -0
  108. package/dist/{chunk-LIWIV26I.js → chunk-L6PJPETJ.js} +2 -2
  109. package/dist/{chunk-6DO3VBLV.js → chunk-LDVT66YM.js} +2 -2
  110. package/dist/chunk-LEECKFCJ.js +2 -0
  111. package/dist/{chunk-BVR44XXB.js → chunk-LMZ5PRUV.js} +2 -2
  112. package/dist/{chunk-KFFQURUZ.js → chunk-LQRQN2XA.js} +2 -2
  113. package/dist/{chunk-YR7VRWNX.js → chunk-LXABEJX3.js} +2 -2
  114. package/dist/{chunk-ARGPDW2Y.js → chunk-M2O5NY6W.js} +2 -2
  115. package/dist/{chunk-7YZGSLW6.js → chunk-MNV5FSBW.js} +2 -2
  116. package/dist/{chunk-XFRHBAIT.js → chunk-MPQ4OTBM.js} +2 -2
  117. package/dist/{chunk-PJBYDCBQ.js → chunk-MV3CDXPI.js} +2 -2
  118. package/dist/{chunk-DK6MB565.js → chunk-MWN53KRN.js} +2 -2
  119. package/dist/chunk-N2ZSIIGR.js +117 -0
  120. package/dist/chunk-N5B2NILC.js +5 -0
  121. package/dist/{chunk-HW7FASEL.js → chunk-NJITK2GP.js} +2 -2
  122. package/dist/{chunk-DUDUIT5P.js → chunk-NOGJXYFO.js} +2 -2
  123. package/dist/chunk-NOYBFVJA.js +554 -0
  124. package/dist/chunk-NWQXSFFU.js +3 -0
  125. package/dist/chunk-ODDUPDP7.js +13 -0
  126. package/dist/chunk-OLIWTZI3.js +3 -0
  127. package/dist/{chunk-JO6FK3Q5.js → chunk-OLNV6I6U.js} +2 -2
  128. package/dist/{chunk-CXT3GZSQ.js → chunk-OR2E3AGZ.js} +2 -2
  129. package/dist/chunk-OSR2GEHQ.js +2 -0
  130. package/dist/{chunk-7MUHSZGN.js → chunk-OSSESPDX.js} +2 -2
  131. package/dist/{chunk-ND3BWIVN.js → chunk-OWOOWNJ5.js} +2 -2
  132. package/dist/{chunk-UEQORB2A.js → chunk-P42EIXTA.js} +2 -2
  133. package/dist/{chunk-PWEQ6CZZ.js → chunk-PJFGPYTU.js} +2 -2
  134. package/dist/{chunk-CNT4ND5O.js → chunk-PP7KNN7L.js} +2 -2
  135. package/dist/{chunk-C52Q3JEQ.js → chunk-PU7T5QYQ.js} +2 -2
  136. package/dist/{chunk-OY7PCALC.js → chunk-PWWAJSKV.js} +2 -2
  137. package/dist/{chunk-LXMW6ZAX.js → chunk-PZL5T7SU.js} +2 -2
  138. package/dist/{chunk-G47MFF47.js → chunk-QBE3YX64.js} +2 -2
  139. package/dist/{chunk-SGSPCEFC.js → chunk-QGVTFRY2.js} +2 -2
  140. package/dist/chunk-QOJONDS7.js +2 -0
  141. package/dist/chunk-QU5XRYB5.js +4 -0
  142. package/dist/{chunk-4ZCLDH6T.js → chunk-QUU5OBVK.js} +2 -2
  143. package/dist/{chunk-N4EFQIRX.js → chunk-RBLQNW26.js} +2 -2
  144. package/dist/chunk-RTQ7NEKG.js +81 -0
  145. package/dist/{chunk-XNF5T4T2.js → chunk-SQXRS7BG.js} +2 -2
  146. package/dist/chunk-SSK6LDPC.js +2 -0
  147. package/dist/chunk-SZHGTCPP.js +7 -0
  148. package/dist/chunk-T4N4P2K5.js +16 -0
  149. package/dist/{chunk-LFWB7TOJ.js → chunk-TA3QKLLU.js} +2 -2
  150. package/dist/chunk-TEBQMNVI.js +43 -0
  151. package/dist/chunk-TPFHAQ2G.js +2 -0
  152. package/dist/chunk-TQPCBMWT.js +5 -0
  153. package/dist/chunk-TQZV7KV4.js +2 -0
  154. package/dist/{chunk-FOP7HD6H.js → chunk-TRNAEQ6P.js} +2 -2
  155. package/dist/chunk-TY7CRN3Z.js +2 -0
  156. package/dist/{chunk-XDOEHEET.js → chunk-UHFYCMZO.js} +2 -2
  157. package/dist/{chunk-E6N6YTVM.js → chunk-UICY4GTQ.js} +2 -2
  158. package/dist/{chunk-AFRS7WJU.js → chunk-UVGEWT4Y.js} +2 -2
  159. package/dist/{chunk-IHGK3SZ7.js → chunk-UXW33INU.js} +2 -2
  160. package/dist/{chunk-RZWBTKXO.js → chunk-VMPRET3I.js} +2 -2
  161. package/dist/{chunk-DZA7MQMU.js → chunk-VNLGKHS6.js} +2 -2
  162. package/dist/chunk-VQILFTEH.js +2 -0
  163. package/dist/chunk-VUPHCS7Y.js +57 -0
  164. package/dist/{chunk-K63CAPS2.js → chunk-VVZSBTSU.js} +2 -2
  165. package/dist/{chunk-IH3K5J6K.js → chunk-VZRNID6A.js} +2 -2
  166. package/dist/{chunk-NSDPPUDY.js → chunk-W5OXRYGE.js} +2 -2
  167. package/dist/chunk-W6STWDQI.js +57 -0
  168. package/dist/chunk-W7CXK74K.js +2 -0
  169. package/dist/chunk-WB3WYIRE.js +4 -0
  170. package/dist/{chunk-WV6R37XV.js → chunk-WDNVY4E7.js} +2 -2
  171. package/dist/{chunk-Z2QB75BS.js → chunk-WIWY3CRX.js} +2 -2
  172. package/dist/chunk-WK46TNUM.js +3 -0
  173. package/dist/chunk-WNTFFKAX.js +12 -0
  174. package/dist/{chunk-U2MNECDU.js → chunk-WOIKCX6A.js} +2 -2
  175. package/dist/{chunk-5BJPJUXF.js → chunk-WUN6KBHV.js} +2 -2
  176. package/dist/chunk-WYCTJDVR.js +2 -0
  177. package/dist/chunk-WYPL7GF7.js +2 -0
  178. package/dist/{chunk-OFZVFIDF.js → chunk-XBGWL66K.js} +2 -2
  179. package/dist/{chunk-3T5U2EQ2.js → chunk-XDQMU3BT.js} +2 -2
  180. package/dist/{chunk-BZCRHP46.js → chunk-XFA4SSO3.js} +2 -2
  181. package/dist/{chunk-4KIPF45P.js → chunk-XGZEP6GR.js} +2 -2
  182. package/dist/chunk-XPDPNWTQ.js +368 -0
  183. package/dist/chunk-XRYABF57.js +8 -0
  184. package/dist/{chunk-KBIC6JHJ.js → chunk-YBGKCQIS.js} +2 -2
  185. package/dist/{chunk-5J3A6RBZ.js → chunk-YEN6CYC7.js} +2 -2
  186. package/dist/{chunk-OA2BO4DR.js → chunk-YF5IB2LF.js} +2 -2
  187. package/dist/{chunk-Q4MRRB3C.js → chunk-YI2AWIHC.js} +2 -2
  188. package/dist/{chunk-YCXQQ3YB.js → chunk-YPWBKGFU.js} +2 -2
  189. package/dist/{chunk-EJHNTAEE.js → chunk-YPWHBBIS.js} +2 -2
  190. package/dist/{chunk-FIO44MVK.js → chunk-YSH6U3L4.js} +2 -2
  191. package/dist/{chunk-HYU4W353.js → chunk-YU5DZUZI.js} +2 -2
  192. package/dist/chunk-YWO5DDRC.js +16 -0
  193. package/dist/{chunk-5Z2H76VD.js → chunk-YXPUP5G2.js} +2 -2
  194. package/dist/{chunk-H2RBDP5S.js → chunk-Z4CDXYNQ.js} +2 -2
  195. package/dist/{chunk-VJAD5WX5.js → chunk-ZF5KHH7C.js} +2 -2
  196. package/dist/chunk-ZOHS7AQV.js +21 -0
  197. package/dist/{chunk-YT4IQBET.js → chunk-ZTI4SBFV.js} +2 -2
  198. package/dist/cli-main.js +2 -2
  199. package/dist/code-MI6F2TTU.js +2 -0
  200. package/dist/code-result-json-FXALY4HE.js +2 -0
  201. package/dist/{command-descriptors-6INSCKLW.js → command-descriptors-P34VABY5.js} +144 -143
  202. package/dist/dataflow-4KEMJPC6.js +2 -0
  203. package/dist/dependence-slice-R7FPWD5M.js +2 -0
  204. package/dist/deps-7EMQUYUT.js +2 -0
  205. package/dist/direct-navigation-6YO234F2.js +3 -0
  206. package/dist/entry-map-KOOLR26E.js +2 -0
  207. package/dist/files-OPIPJIGZ.js +2 -0
  208. package/dist/hierarchy-QPD2CAER.js +2 -0
  209. package/dist/imports-M6HUXRXC.js +2 -0
  210. package/dist/index.js +1 -1
  211. package/dist/members-I5MEFOCT.js +2 -0
  212. package/dist/methods-5JYGGHXA.js +2 -0
  213. package/dist/output-continuation-command-UPQAAKBP.js +3 -0
  214. package/dist/postinstall.js +1 -1
  215. package/dist/project-reindex-UKKQ5PLS.js +3 -0
  216. package/dist/queries/affected.js +1 -1
  217. package/dist/queries/anchors.js +1 -1
  218. package/dist/queries/architecture.js +1 -1
  219. package/dist/queries/bottlenecks.js +1 -1
  220. package/dist/queries/by-kind.js +1 -1
  221. package/dist/queries/call-graph.js +1 -1
  222. package/dist/queries/change-surface.js +1 -1
  223. package/dist/queries/cleanup-plan.js +1 -1
  224. package/dist/queries/co-change.js +1 -1
  225. package/dist/queries/code.js +1 -1
  226. package/dist/queries/complexity-hotspots.js +1 -1
  227. package/dist/queries/complexity.d.ts +11 -0
  228. package/dist/queries/complexity.js +1 -1
  229. package/dist/queries/context.js +1 -1
  230. package/dist/queries/convergence.js +1 -1
  231. package/dist/queries/coupling.js +1 -1
  232. package/dist/queries/cycles.js +1 -1
  233. package/dist/queries/dataflow.js +1 -1
  234. package/dist/queries/dead.js +1 -1
  235. package/dist/queries/decorative-checkers.js +1 -1
  236. package/dist/queries/deep-chains.js +1 -1
  237. package/dist/queries/dependence-slice.js +1 -1
  238. package/dist/queries/dependency-depth.js +1 -1
  239. package/dist/queries/deps.js +1 -1
  240. package/dist/queries/diff-impact.d.ts +9 -0
  241. package/dist/queries/diff-impact.js +1 -1
  242. package/dist/queries/doc-drift.js +1 -1
  243. package/dist/queries/drift.js +1 -1
  244. package/dist/queries/duplicate-bodies.js +1 -1
  245. package/dist/queries/entry-map.js +1 -1
  246. package/dist/queries/evidence.js +1 -1
  247. package/dist/queries/extract-candidates.js +1 -1
  248. package/dist/queries/fan.js +1 -1
  249. package/dist/queries/files.js +1 -1
  250. package/dist/queries/health.js +1 -1
  251. package/dist/queries/hierarchy.js +1 -1
  252. package/dist/queries/hotspots.js +1 -1
  253. package/dist/queries/imports.js +1 -1
  254. package/dist/queries/incomplete-migration.js +1 -1
  255. package/dist/queries/index.js +1 -1
  256. package/dist/queries/isolated.js +1 -1
  257. package/dist/queries/locality-candidates.js +1 -1
  258. package/dist/queries/members.js +1 -1
  259. package/dist/queries/methods.js +1 -1
  260. package/dist/queries/not-implemented.js +1 -1
  261. package/dist/queries/outline.js +1 -1
  262. package/dist/queries/passthrough-candidates.js +1 -1
  263. package/dist/queries/plan-context.js +1 -1
  264. package/dist/queries/react-component-duplicates.js +1 -1
  265. package/dist/queries/react-hook-candidates.js +1 -1
  266. package/dist/queries/react-large-component-pressure.js +1 -1
  267. package/dist/queries/recent-duplicates.js +1 -1
  268. package/dist/queries/redundant-reexports.js +1 -1
  269. package/dist/queries/reference-neighborhood.js +1 -1
  270. package/dist/queries/reference-reachability.js +1 -1
  271. package/dist/queries/refs.js +1 -1
  272. package/dist/queries/self-audit.js +1 -1
  273. package/dist/queries/similar-chains.js +1 -1
  274. package/dist/queries/similar-files.js +1 -1
  275. package/dist/queries/similar-signatures.js +1 -1
  276. package/dist/queries/similar.js +1 -1
  277. package/dist/queries/slice.js +1 -1
  278. package/dist/queries/source-inspection.js +1 -1
  279. package/dist/queries/source-search.js +1 -1
  280. package/dist/queries/stale-abstractions.js +1 -1
  281. package/dist/queries/surface.js +1 -1
  282. package/dist/queries/symbols.js +1 -1
  283. package/dist/queries/system-map.js +1 -1
  284. package/dist/queries/system.js +1 -1
  285. package/dist/queries/test-quality.js +1 -1
  286. package/dist/queries/trace.js +1 -1
  287. package/dist/queries/twin-ab.js +1 -1
  288. package/dist/queries/twin-drift.js +1 -1
  289. package/dist/queries/unused-imports.js +1 -1
  290. package/dist/queries/unused-params.js +1 -1
  291. package/dist/queries/value-flow.js +1 -1
  292. package/dist/queries/vue-component-duplicates.js +1 -1
  293. package/dist/queries/vue-composable-candidates.js +1 -1
  294. package/dist/queries/vue-large-view-pressure.js +1 -1
  295. package/dist/queries/wrapper-candidates.js +1 -1
  296. package/dist/query-service-fastpath.js +5 -5
  297. package/dist/query-service-server.js +3 -3
  298. package/dist/refs-PSU4JZZW.js +2 -0
  299. package/dist/refs-pagination-JG6CJMRC.js +2 -0
  300. package/dist/reindex-worker.js +64 -22
  301. package/dist/reindex.d.ts +3 -2
  302. package/dist/reindex.js +74 -32
  303. package/dist/runtime.d.ts +34 -2
  304. package/dist/runtime.js +4 -4
  305. package/dist/rust-semantic-session-server.js +1 -1
  306. package/dist/rust-semantic-session-worker.js +1 -1
  307. package/dist/rust-semantic-worker.js +1 -1
  308. package/dist/{scip-cli-H-n59izO.d.ts → scip-cli-DOerTq-R.d.ts} +42 -4
  309. package/dist/slice-HYRATV64.js +2 -0
  310. package/dist/surface-VTGDYWF5.js +2 -0
  311. package/dist/symbol-resolution-WD5EU5JE.js +2 -0
  312. package/dist/system-LRQNFOR2.js +2 -0
  313. package/dist/trace-F4B6OLL4.js +2 -0
  314. package/dist/typescript-mailbox-worker.js +1 -1
  315. package/dist/value-flow-VRPZY72V.js +2 -0
  316. package/dist/watch-server.js +3 -3
  317. package/package.json +1 -1
  318. package/dist/by-kind-XXGZGNZ6.js +0 -2
  319. package/dist/call-graph-VGY3R4L3.js +0 -2
  320. package/dist/chunk-3XZELASU.js +0 -2
  321. package/dist/chunk-63TFRBMB.js +0 -2
  322. package/dist/chunk-67FK5KGV.js +0 -3
  323. package/dist/chunk-6LS3IG2I.js +0 -13
  324. package/dist/chunk-6X4KO5A7.js +0 -11
  325. package/dist/chunk-743MEVFJ.js +0 -8
  326. package/dist/chunk-7Z4GMCHM.js +0 -117
  327. package/dist/chunk-ANCHW2R4.js +0 -57
  328. package/dist/chunk-BMKTDJI6.js +0 -16
  329. package/dist/chunk-BZYSGZRK.js +0 -2
  330. package/dist/chunk-C7WSQA6A.js +0 -21
  331. package/dist/chunk-CTO3TRX7.js +0 -2
  332. package/dist/chunk-DNPETNXT.js +0 -2
  333. package/dist/chunk-DZNWXJN2.js +0 -18
  334. package/dist/chunk-E7CJ6O72.js +0 -2
  335. package/dist/chunk-FLSVYEPL.js +0 -2
  336. package/dist/chunk-FSPENGSU.js +0 -4
  337. package/dist/chunk-FYCH2EYQ.js +0 -2
  338. package/dist/chunk-G6VV7ROY.js +0 -2
  339. package/dist/chunk-GSHTVE56.js +0 -3
  340. package/dist/chunk-IGBQVEHE.js +0 -2
  341. package/dist/chunk-IM23CSG5.js +0 -2
  342. package/dist/chunk-IQMGNIGY.js +0 -2
  343. package/dist/chunk-JLZWYDCZ.js +0 -4
  344. package/dist/chunk-JSHDCVUM.js +0 -81
  345. package/dist/chunk-L7WRUNKJ.js +0 -2
  346. package/dist/chunk-LGVTIZPV.js +0 -61
  347. package/dist/chunk-MFBVUQJZ.js +0 -2
  348. package/dist/chunk-MLTSTKXD.js +0 -5
  349. package/dist/chunk-MR4ZKWO6.js +0 -57
  350. package/dist/chunk-NODZYYGC.js +0 -2
  351. package/dist/chunk-NP4JFCLE.js +0 -133
  352. package/dist/chunk-NQXWWE6S.js +0 -8
  353. package/dist/chunk-O2VY47Y5.js +0 -325
  354. package/dist/chunk-PAZSBPJR.js +0 -3
  355. package/dist/chunk-PRLU3I7G.js +0 -79
  356. package/dist/chunk-QLWZUFDT.js +0 -2
  357. package/dist/chunk-SIGVQT43.js +0 -2
  358. package/dist/chunk-SRIZDEWX.js +0 -4
  359. package/dist/chunk-U7DOYZDH.js +0 -2
  360. package/dist/chunk-UAQQR55F.js +0 -2
  361. package/dist/chunk-VRJG7N3I.js +0 -453
  362. package/dist/chunk-W7HN6V4E.js +0 -7
  363. package/dist/chunk-WCIKJ2E3.js +0 -3
  364. package/dist/chunk-WEXQYJY3.js +0 -5
  365. package/dist/chunk-WOPZX5GM.js +0 -2
  366. package/dist/chunk-WZ7V4BQV.js +0 -2
  367. package/dist/chunk-XDQX6LDT.js +0 -4
  368. package/dist/chunk-XIPGCT3D.js +0 -5
  369. package/dist/chunk-XKM5D2XS.js +0 -16
  370. package/dist/chunk-Y2S4YNLH.js +0 -3
  371. package/dist/chunk-YA72ZUKO.js +0 -2
  372. package/dist/chunk-YBWE6J32.js +0 -43
  373. package/dist/chunk-YDTK77JP.js +0 -43
  374. package/dist/chunk-Z2KGMIL4.js +0 -2
  375. package/dist/chunk-Z67JOKRE.js +0 -554
  376. package/dist/chunk-ZMS4YCY7.js +0 -2
  377. package/dist/chunk-ZNW5A5VX.js +0 -3
  378. package/dist/code-AXLJBZ6T.js +0 -2
  379. package/dist/code-result-json-CTZHAQXJ.js +0 -2
  380. package/dist/dataflow-AFXY423Q.js +0 -2
  381. package/dist/dependence-slice-2G4X6VSJ.js +0 -2
  382. package/dist/deps-LMCAV5DO.js +0 -2
  383. package/dist/direct-navigation-2ONV22Y2.js +0 -3
  384. package/dist/entry-map-ZOC3VXO5.js +0 -2
  385. package/dist/files-WJQJLHMH.js +0 -2
  386. package/dist/hierarchy-ASNIHAX4.js +0 -2
  387. package/dist/imports-JICEKDKK.js +0 -2
  388. package/dist/members-C5H2K3MS.js +0 -2
  389. package/dist/methods-KZOZHSD4.js +0 -2
  390. package/dist/output-continuation-command-NX3RH3TP.js +0 -3
  391. package/dist/project-reindex-A2SXUH2H.js +0 -3
  392. package/dist/refs-ZOORVRQC.js +0 -2
  393. package/dist/refs-pagination-SRCUOYRD.js +0 -2
  394. package/dist/slice-NOTBWA7S.js +0 -2
  395. package/dist/surface-BTBCLKNA.js +0 -2
  396. package/dist/symbol-resolution-SVSMX4RN.js +0 -2
  397. package/dist/system-2EIUFP6B.js +0 -2
  398. package/dist/trace-BB2GHQPG.js +0 -2
  399. package/dist/value-flow-OA7AHSUG.js +0 -2
@@ -1,325 +0,0 @@
1
- #!/usr/bin/env node
2
- import{Ae as Bt,Be as $,C as Ue,Ca as W,Ce as _r,Da as Ot,De as $t,Ed as yr,Ee as Ke,Fa as fe,Fd as br,Fe as Dr,Ga as Q,Gd as _e,Ge as Lr,Ha as We,He as Or,Ia as Yn,Id as Sr,Ie as jr,Ja as jt,Je as Cr,Ka as Qn,Kd as De,Ke as Mr,Ld as ze,Le as Nr,M as Gn,Md as Rr,Me as Br,N as Y,Ne as $r,O as pe,Oe as Vr,P as ge,Pe as Ye,Qa as Zn,Re as J,S as Ge,Sb as rr,Se as Qe,Ta as Ct,Tb as ir,Ue as Ur,Va as er,Vd as xr,Wd as vr,We as Vt,Xd as Mt,Xe as Gr,Ye as Wr,Ze,_a as qe,_d as be,a as $e,af as qr,b as Bn,bf as Jr,c as Tt,cf as Hr,d as $n,dc as ar,ea as Dt,eb as Z,ec as Je,ee as Pr,ef as zr,f as Te,fb as ee,fc as or,ff as Xr,g as _,gb as tr,gc as sr,gf as et,ha as Wn,hc as cr,id as me,jd as ur,kd as lr,l as Ft,ld as he,ma as qn,mb as R,md as He,me as Ir,n as le,nb as te,nd as Fe,ne as wr,o as At,ob as nr,od as dr,oe as kr,p as Vn,pd as pr,q as Ve,qa as Jn,qd as gr,qe as Er,r as _t,ra as Hn,rd as fr,re as Tr,s as de,sa as zn,sd as mr,se as C,t as N,ta as Xn,u as B,ud as ye,ue as Xe,v as Un,vd as hr,ve as Nt,wa as Kn,wd as Ae,we as Fr,xd as q,ya as Lt,yd as P,ye as Ar}from"./chunk-VRJG7N3I.js";import{createHash as cd}from"crypto";import{existsSync as j,mkdirSync as xt,mkdtempSync as ud,readdirSync as so,renameSync as co,rmSync as ke,statSync as ld}from"fs";import{basename as Rt,dirname as x,extname as dd,join as F,resolve as Ka}from"path";import{platform as pd}from"os";import{execFileSync as Kr}from"child_process";import{createRequire as _o}from"module";import{existsSync as Do}from"fs";import{platform as Le,arch as Yr}from"os";var Oe="v0.8.1",Ut="https://github.com/sourcegraph/scip",tt=`github.com/sourcegraph/scip/cmd/scip@${Oe}`,Qr=_o(import.meta.url),Zr="SCIP_QUERY_SCIP_BIN";function Lo(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let t=e.env[Zr];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 Oo(e){for(let t of e==="arm64"?["arm64","x64"]:[e])try{return Qr.resolve(`scip-query-scip-windows/scip-win32-${t}.exe`)}catch{}return null}function Se(e=process.env){let t=Lo({platform:Le(),arch:Yr(),env:e,isOnPath:me,fileExists:Do,resolveSidecar:Oo});return t?.source==="path"?lr("scip")??t.path:t?.path??null}function op(){return Se()!==null}function jo(){let e=Se();if(!e)return null;try{return Kr(e,["--version"],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function Co(){let e=Le(),t=Yr(),n,r,i;switch(e){case"darwin":n="darwin",i="tar.gz";break;case"linux":n="linux",i="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}.${i}`;return{url:`${Ut}/releases/download/${Oe}/${a}`,filename:a}}function sp(){let e=Co();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),Le()==="darwin"||Le()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${tt}
3
- `),console.log("Or download that exact release manually:");else if(Le()==="win32"){let t=Mo();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 ${Zr} to a local scip.exe path.
4
- `),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
5
- `:` ${Ut}/releases/tag/${Oe}
6
- `),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function Mo(){let t=Qr("../../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 ei(e){if(me("go")){e(`Installing immutable ${tt} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(Kr("go",["install",tt],{stdio:"inherit",timeout:3e5,env:process.env}),me("scip")){let t=Se(),n=jo();if(t&&n&&n.includes(Oe))return e(`Successfully installed ${tt}; resolved executable: ${t}; reported version: ${n}.`),!0;e(`go install completed, but the resolved scip executable did not report ${Oe} (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: ${Ut}/releases`),!1}var Re=class extends Error{constructor(t){super(t),this.name="ReindexLockUnavailableError"}};import{execFileSync as No}from"child_process";import{constants as Bo,copyFileSync as ti,statSync as $o}from"fs";import{platform as Vo}from"os";var Uo=Object.freeze({size:e=>$o(e).size,clone:Wo,copy:(e,t)=>ti(e,t)}),Go=new Set(["ENOSYS","ENOTSUP","EOPNOTSUPP","EINVAL","EXDEV","ENOTTY"]);function ne(e,t,n=Uo){let r=n.size(e);try{return n.clone(e,t),{method:"reflink",bytes:r}}catch(i){if(!Jo(i))throw i}return n.copy(e,t),{method:"copy",bytes:r}}function Wo(e,t){if(Vo()!=="darwin"){ti(e,t,Bo.COPYFILE_FICLONE_FORCE);return}try{No("/bin/cp",["-c",e,t],{timeout:6e4,maxBuffer:64*1024,stdio:["ignore","ignore","pipe"]})}catch(n){throw qo(n)}}function qo(e){let t=e?.stderr,n=Buffer.isBuffer(t)?t.toString("utf8"):t??"";return/operation not supported|not supported/i.test(n)?Object.assign(e instanceof Error?e:new Error(String(e)),{code:"ENOTSUP"}):/cross-device link/i.test(n)?Object.assign(e instanceof Error?e:new Error(String(e)),{code:"EXDEV"}):e}function Jo(e){let t=e?.code;return t!==void 0&&Go.has(t)}function ni(){return{reflinkedBytes:0,fallbackCopiedBytes:0,incrementalWrittenBytes:0}}function re(e,t){t.method==="reflink"?e.reflinkedBytes+=t.bytes:e.fallbackCopiedBytes+=t.bytes}function nt(e,t){if(!Number.isSafeInteger(t)||t<0)throw new Error("incremental write bytes must be a non-negative integer");e.incrementalWrittenBytes=(e.incrementalWrittenBytes??0)+t}import Ho from"better-sqlite3";import{execFileSync as zo}from"child_process";import{existsSync as Xo,readdirSync as Ko}from"fs";import{extname as rt,join as Yo}from"path";function ie(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:t=>ri({projectRoot:t.projectRoot,dbPath:t.dbPath,extensions:e.extensions,onStatus:t.onStatus})}}function ri(e){let t=new Set((e.extensions??rr).map(a=>a.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!Xo(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let n=_r(e.projectRoot),r=Qo(e.projectRoot,t).filter(a=>!n.isIgnored(a)),i=new Ho(e.dbPath);try{let a=es(i,r),o=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
7
- VALUES (?, ?, NULL, ?)`),c=i.transaction(l=>{let d=0;for(let p of l){if(a.has(p))continue;let g=qn(e.projectRoot,p,{inputKind:"auxiliary source file"}),f=o.run(ts(p),p,g);d+=Number(f.changes)}return d})(r),u={scanned:r.length,inserted:c,existing:r.length-c};return e.onStatus?.(`Augmented SQLite documents with ${c} auxiliary source file${c===1?"":"s"} (${u.existing} already present).`),u}finally{i.close()}}function Qo(e,t){let n=Zo(e,t);if(n)return n;let r=[],i=a=>{let o=a?Yo(e,a):e,s;try{s=Ko(o,{withFileTypes:!0})}catch{return}for(let c of s){if(ir.has(c.name))continue;let u=a?`${a}/${c.name}`:c.name;if(c.isDirectory()){i(u);continue}t.has(rt(c.name).toLowerCase())&&r.push(u)}};return i(""),r.sort()}function Zo(e,t){try{return zo("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}).split(`
8
- `).filter(r=>r&&t.has(rt(r).toLowerCase())).sort()}catch{return null}}function es(e,t){let n=new Set,r=500;for(let i=0;i<t.length;i+=r){let a=t.slice(i,i+r),o=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${a.map(()=>"?").join(",")})`).all(...a);for(let s of o)n.add(s.relative_path)}return n}function ts(e){return rt(e).toLowerCase()===".vue"?"vue":rt(e).replace(/^\./,"").toLowerCase()||"source"}import{dirname as ns,join as rs}from"path";function ii(e={}){return{id:"runtime-boundaries",facts:["runtime-boundary-observation","runtime-boundary-link"],run:({projectRoot:t,dbPath:n,onStatus:r})=>{let i=new $({projectRoot:t,dbPath:n,indexPath:e.indexPath??rs(ns(n),"index.scip"),...e.evidenceDbPath?{evidenceDbPath:e.evidenceDbPath}:{}}),a,o=!1,s=!1;try{let u=e.reuseExisting||e.affectedFiles?Er(i):null;e.reuseExisting&&u?.extractorVersion===Ir?(a=u,o=!0):(a=wr(i,{...u?{previousGraph:u}:{},...e.affectedFiles?{affectedFiles:e.affectedFiles}:{},...e.forceDerivedRebuild?{forceDerivedRebuild:!0}:{},profileSpan:R}),s=(a.coverage.filesReused??0)>0)}finally{i.close()}o||kr(n,a);let c={reused:o,incrementallyUpdated:s,observations:a.observations.length,links:a.links.length,frontiers:a.frontiers.length,filesScanned:a.coverage.filesScanned,errors:a.coverage.extractionErrors.length,phases:a.coverage.phases};return r?.(c.reused?`Reused ${c.observations} cached runtime-boundary observation(s) and ${c.links} link(s).`:c.incrementallyUpdated?`Incrementally refreshed runtime-boundary observations (${c.filesScanned-(a.coverage.filesReused??0)} file(s) extracted, ${a.coverage.filesReused??0} reused) and rebuilt ${c.links} link(s).`:`Extracted ${c.observations} runtime-boundary observation(s), ${c.links} link(s), and ${c.frontiers} unresolved frontier(s).`),!o&&a.coverage.phases&&r?.(`Runtime-boundary phases: ${a.coverage.phases.map(u=>`${u.id} ${u.durationMs.toFixed(0)}ms`).join(", ")}.`),c}}}import{createHash as Ss}from"crypto";import{existsSync as Rs}from"fs";import{dirname as xs,join as li}from"path";function Gt(e){let t=new Set;for(let n of e.uncertainty)t.add(n);e.projectIdentityChanged&&t.add("project-identity-changed");for(let n of e.changes)n.kind==="added"&&t.add("file-added"),n.kind==="deleted"&&t.add("file-deleted"),n.inputKind==="config"&&t.add("configuration-changed"),n.inputKind==="ambient"&&t.add("ambient-declaration-changed"),n.inputKind==="other"&&t.add("unclassified-input");return{fullProject:t.size>0,reasons:[...t].sort()}}function je(e,t,n){let r=e.changes.map(s=>s.path).sort();if(r.length===0&&!e.projectIdentityChanged&&e.uncertainty.length===0)return{mode:"none",changedFiles:r,affectedFiles:[],reasons:[]};let i=new Set(n),a=Gt(e),o=new Set(a.reasons);return r.some(s=>!i.has(s))&&o.add("changed-file-outside-project"),t===null?(o.add("dependency-graph-unavailable"),ai(r,i,o)):o.size>0?ai(r,i,o):{mode:"closure",changedFiles:r,affectedFiles:is(r,t,i),reasons:[]}}function ai(e,t,n){return{mode:"full-project",changedFiles:e,affectedFiles:[...t].sort(),reasons:[...n].sort()}}function is(e,t,n){let r=new Map;for(let[o,s]of t)if(n.has(o))for(let c of s){if(!n.has(c))continue;let u=r.get(c)??new Set;u.add(o),r.set(c,u)}let i=new Set(e),a=[...e];for(let o=0;o<a.length;o+=1){let s=a[o];if(s!==void 0)for(let c of r.get(s)??[])i.has(c)||(i.add(c),a.push(c))}return[...i].sort()}import{appendFileSync as as,existsSync as os,mkdirSync as ss,renameSync as cs,rmSync as us,statSync as ls,truncateSync as ds}from"fs";import{basename as ps,dirname as gs}from"path";var xe=".previous",fs=".rotation.lock",ms=2e3,Wt=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"},qt=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"},oi=Object.freeze({monotonicNow:P,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=Xe(e,{kind:"rotating-jsonl",detail:{target:ps(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){ss(e,{recursive:!0})},exists:os,readBytes(e){return de(e,{maxBytes:Ve,inputKind:"rotating JSONL segment"})},size(e){return ls(e).size},truncate:ds,remove(e){us(e,{force:!0})},rename:cs,append:as});function it(e,t,n){let r=n.runtime??oi,i=JSON.stringify(t);if(i===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let a=Buffer.from(`${i}
9
- `),o=Math.max(1,Math.floor(n.maxSegmentBytes),a.length);return ci(e,n.lockTimeoutMs,r,()=>{r.makeDirectory(gs(e));let s=hs(e,Ve,r);n.onPhase?.("tail-repaired");let c=`${e}${n.previousSuffix??xe}`,u=!1,l=!1;return r.exists(e)&&r.size(e)+a.length>o&&(r.exists(c)&&(r.remove(c),l=!0),n.onPhase?.("previous-pruned"),r.rename(e,c),u=!0,n.onPhase?.("current-rotated")),r.append(e,a),n.onPhase?.("record-appended"),{lineBytes:a.length,segmentLimitBytes:o,repairedTailBytes:s,rotated:u,prunedPrevious:l}})}function si(e,t={}){let n=t.runtime??oi,r=ys(t.maxSegmentBytes);return ci(e,t.lockTimeoutMs,n,()=>{let i=[],a=0,o=`${e}${t.previousSuffix??xe}`;for(let s of[o,e]){if(!n.exists(s))continue;let c=bs(ui(s,r,n));i.push(...c.lines),a+=c.partialTailBytes}return{lines:i,ignoredPartialTailBytes:a}})}function ci(e,t,n,r){let i=`${e}${fs}`,a=Math.max(0,t??ms),o=n.monotonicNow()+a,s;for(;;){let p=n.tryAcquireLock(i,e);if(p.kind==="acquired"){s=p.lock;break}let g=o-n.monotonicNow();if(g<=0)throw new Wt(i,a);n.wait(Math.min(5,g))}let c=!1,u,l;try{l=r()}catch(p){c=!0,u=p}let d=!1;try{d=s.release()}catch(p){if(!c)throw p}if(c)throw u;if(!d)throw new qt(i);return l}function hs(e,t,n){if(!n.exists(e))return 0;let r=ui(e,t,n);if(r.length===0||r[r.length-1]===10)return 0;let i=r.lastIndexOf(10),a=i<0?0:i+1;return n.truncate(e,a),r.length-a}function ys(e){let t=e??Ve;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function ui(e,t,n){let r=n.size(e);if(r>t)throw new _t("rotating JSONL segment",e,"too-large",r,t);let i=n.readBytes(e),a=n.size(e);if(a!==r||i.byteLength!==r)throw new _t("rotating JSONL segment",e,"changed-during-read",a,t);return i}function bs(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
10
- `).filter(i=>i.length>0),partialTailBytes:e.length-n}}var vs="<global-symbols>";function Ps(e){let t=[];for(let n of e.all(`
11
- SELECT relative_path, language, position_encoding, text
12
- FROM documents
13
- `))t.push({relativePath:n.relative_path,kind:"document",values:[n.language,n.position_encoding,n.text]});for(let n of e.all(`
14
- SELECT d.relative_path,
15
- c.chunk_index,
16
- c.start_line,
17
- c.end_line,
18
- hex(c.occurrences) AS occurrences_hex
19
- FROM chunks c
20
- JOIN documents d ON d.id = c.document_id
21
- `))t.push({relativePath:n.relative_path,kind:"chunk",values:[n.chunk_index,n.start_line,n.end_line,n.occurrences_hex]});for(let n of e.all(`
22
- SELECT d.relative_path,
23
- r.start_line,
24
- r.start_char,
25
- r.end_line,
26
- r.end_char,
27
- g.symbol,
28
- g.display_name,
29
- g.kind,
30
- g.documentation,
31
- CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
32
- g.enclosing_symbol,
33
- CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
34
- FROM defn_enclosing_ranges r
35
- JOIN documents d ON d.id = r.document_id
36
- JOIN global_symbols g ON g.id = r.symbol_id
37
- `))t.push({relativePath:n.relative_path,kind:"definition",values:Jt(n,[n.start_line,n.start_char,n.end_line,n.end_char])});for(let n of e.all(`
38
- SELECT d.relative_path,
39
- c.chunk_index,
40
- m.role,
41
- g.symbol,
42
- g.display_name,
43
- g.kind,
44
- g.documentation,
45
- CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
46
- g.enclosing_symbol,
47
- CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
48
- FROM mentions m
49
- JOIN chunks c ON c.id = m.chunk_id
50
- JOIN documents d ON d.id = c.document_id
51
- JOIN global_symbols g ON g.id = m.symbol_id
52
- `))t.push({relativePath:n.relative_path,kind:"mention",values:Jt(n,[n.chunk_index,n.role])});for(let n of e.all(`
53
- SELECT g.symbol,
54
- g.display_name,
55
- g.kind,
56
- g.documentation,
57
- CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
58
- g.enclosing_symbol,
59
- CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
60
- FROM global_symbols g
61
- WHERE NOT EXISTS (
62
- SELECT 1 FROM defn_enclosing_ranges r WHERE r.symbol_id = g.id
63
- ) AND NOT EXISTS (
64
- SELECT 1 FROM mentions m WHERE m.symbol_id = g.id
65
- )
66
- `))t.push({relativePath:vs,kind:"global-symbol",values:Jt(n)});return Is(t)}function Is(e){let t=new Map;for(let r of e){let i=JSON.stringify([r.kind,r.values]),a=t.get(r.relativePath)??[];a.push(i),t.set(r.relativePath,a)}let n=new Map;for(let[r,i]of[...t].sort(([a],[o])=>a.localeCompare(o))){let a=Ss("sha256");for(let o of i.sort())a.update(String(Buffer.byteLength(o))),a.update(":"),a.update(o),a.update(`
67
- `);n.set(r,a.digest("hex"))}return n}function ws(e,t){let n=[],r=[],i=[],a=[],o=new Set([...e.keys(),...t.keys()]);for(let s of[...o].sort()){let c=e.get(s),u=t.get(s);c===void 0?n.push(s):u===void 0?i.push(s):c!==u?r.push(s):a.push(s)}return{addedFiles:n,modifiedFiles:r,deletedFiles:i,changedFiles:[...n,...r,...i].sort(),unchangedFiles:a}}function Ht(e,t,n){let r=new Set(e.affectedFiles),i=new Set(t.changedFiles),a=e.mode==="full-project"?[]:t.changedFiles.filter(c=>!r.has(c)),o=e.affectedFiles.filter(c=>!i.has(c)).sort(),s=t.changedFiles.length-a.length;return{passed:a.length===0,recall:t.changedFiles.length===0?1:s/t.changedFiles.length,affectedRatio:n===0?0:e.affectedFiles.length/n,predictedFiles:[...e.affectedFiles].sort(),actualFiles:[...t.changedFiles],missingFiles:a,extraFiles:o}}function zt(e,t=As){let n=t.wallNow===void 0&&t.monotonicNow===void 0,r=t.monotonicNow??t.now,i=t.wallNow??t.now,a=r(),o=(u,l)=>{let d=r();return yi(e.refreshResult,u,n?d:i(),Math.max(0,d-a),l)};if(!t.databaseExists(e.previousDbPath))return o("prior-index-unavailable");if(!t.databaseExists(e.candidateDbPath))return o("candidate-index-unavailable");let s=null,c=null;try{s=t.openDatabase(e.projectRoot,e.previousDbPath,e.previousIndexPath),c=t.openDatabase(e.projectRoot,e.candidateDbPath,e.candidateIndexPath);let u=[...new Set([...t.indexedPaths(s),...t.indexedPaths(c)])].sort(),l=Te(e.previousSnapshot,e.currentSnapshot),d=new Set(u),p=l.changes.length>0&&!Gt(l).fullProject&&l.changes.every(v=>d.has(v.path)),g=je(l,p?t.dependencyGraph(s):new Map,u),f=ws(t.factDigests(s),t.factDigests(c)),h=r();return{version:1,status:"evaluated",refreshResult:e.refreshResult,recordedAt:new Date(n?h:i()).toISOString(),durationMs:Math.max(0,h-a),manifest:l,plan:g,comparison:f,evaluation:Ht(g,f,u.length)}}catch(u){return o("oracle-error",u instanceof Error?u.message:String(u))}finally{di(s),di(c)}}function fi(e,t,n,r=Date.now()){return yi(e,t,r,0,n)}function mi(e){let t=xs(e);return{latestPath:li(t,"affected-shadow-latest.json"),historyPath:li(t,"affected-shadow.jsonl")}}function Hp(e,t=n=>Un(n,"affected-shadow source file")){let n=mi(e),r;try{r=JSON.parse(t(n.latestPath))}catch(w){let k=js(w),T=k?"telemetry-missing":Os(w);return H(n,T,k?void 0:w instanceof Error?w.message:String(w))}if(Z(r)&&typeof r.version=="number"&&r.version!==1)return H(n,"unsupported-record-version",`Unsupported version ${r.version}.`);if(!Ds(r))return H(n,"telemetry-malformed");if(r.status==="unavailable")return Ls(r.reason)?{state:"unavailable",...n,reason:r.reason,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,...typeof r.error=="string"?{error:r.error}:{}}:H(n,"telemetry-malformed");if(r.status!=="evaluated")return H(n,"telemetry-malformed");let i=r.plan,a=r.comparison,o=r.evaluation;if(!Z(r.manifest)||!Z(i)||!Z(a)||!Z(o))return H(n,"telemetry-malformed");let s=i.mode,c=ee(i.affectedFiles),u=ee(i.reasons),l=ee(a.changedFiles),d=ee(o.predictedFiles),p=ee(o.actualFiles),g=ee(o.missingFiles),f=o.recall,h=o.affectedRatio;if(s!=="none"&&s!=="closure"&&s!=="full-project"||c===null||u===null||l===null||d===null||p===null||g===null||typeof o.passed!="boolean"||!pi(f)||!pi(h))return H(n,"telemetry-malformed");let v=p.length===0?1:(p.length-g.length)/p.length;return!gi(c,d)||!gi(l,p)||o.passed!==(g.length===0)||Math.abs(f-v)>Number.EPSILON||g.some(w=>!p.includes(w)||d.includes(w))?H(n,"telemetry-malformed"):{state:o.passed?"passing":"failing",...n,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,mode:s,recall:f,affectedRatio:h,predictedFiles:d,actualFiles:p,missingFiles:g,fallbackReasons:u}}function zp(e){if(e.state==="unavailable")return`unavailable (${e.reason})`;let t=e.missingFiles.length>0?`, ${e.missingFiles.length} missed`:"",n=e.fallbackReasons.length>0?`; fallback: ${e.fallbackReasons.join(", ")}`:"";return`${e.state}, ${(e.recall*100).toFixed(1)}% recall, ${e.predictedFiles.length} predicted / ${e.actualFiles.length} changed, ${(e.affectedRatio*100).toFixed(1)}% of project${t}${n}`}function hi(e,t,n=_s){let r=mi(e);return n.appendHistory(r.historyPath,t),n.writeLatest(r.latestPath,t),r}var ks=8*1024*1024,Es=xe;function Ts(e){let t={historyVersion:1,sourceVersion:e.version,refreshResult:e.refreshResult,recordedAt:e.recordedAt,durationMs:e.durationMs};return e.status==="unavailable"?{...t,status:"unavailable",reason:e.reason,...e.error?{error:e.error}:{}}:{...t,status:"evaluated",mode:e.plan.mode,passed:e.evaluation.passed,recall:e.evaluation.recall,affectedRatio:e.evaluation.affectedRatio,predictedFileCount:e.evaluation.predictedFiles.length,actualFileCount:e.evaluation.actualFiles.length,missingFileCount:e.evaluation.missingFiles.length,fallbackReasons:[...e.plan.reasons]}}function Fs(e,t,n=ks){it(e,Ts(t),{maxSegmentBytes:n,previousSuffix:Es})}function Jt(e,t=[]){let n=[];for(let r of t)n.push(r);return n.push(e.symbol,e.display_name,e.kind,e.documentation,e.signature_hex,e.enclosing_symbol,e.relationships_hex),n}var As={now:()=>Date.now(),wallNow:()=>Date.now(),monotonicNow:P,databaseExists:e=>Rs(e),openDatabase:(e,t,n)=>new $({projectRoot:e,dbPath:t,indexPath:n}),indexedPaths:e=>qe(e),dependencyGraph:e=>ar(e),factDigests:e=>Ps(e)},_s={appendHistory:Fs,writeLatest:(e,t)=>yr(e,t,{spacing:2,trailingNewline:!0})};function yi(e,t,n,r,i){return{version:1,status:"unavailable",refreshResult:e,recordedAt:new Date(n).toISOString(),durationMs:r,reason:t,...i?{error:i}:{}}}function di(e){try{e?.close()}catch{}}function Ds(e){return Z(e)&&e.version===1&&typeof e.recordedAt=="string"&&(e.refreshResult==="rebuilt"||e.refreshResult==="reused")&&typeof e.durationMs=="number"&&Number.isFinite(e.durationMs)&&e.durationMs>=0}function Ls(e){return e==="prior-index-unavailable"||e==="candidate-index-unavailable"||e==="oracle-error"}function pi(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function gi(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function H(e,t,n){return{state:"unavailable",...e,reason:t,...n?{error:n}:{}}}function Os(e){return e instanceof SyntaxError?"telemetry-malformed":"telemetry-unreadable"}function js(e){return e instanceof Error&&e.code==="ENOENT"}import{readdirSync as Cs}from"fs";import{isAbsolute as bi,join as Ms,resolve as Ns}from"path";var at="@sourcegraph/scip-typescript@0.4.0",Si="scip-python-plus@0.7.5",Ri="github.com/sourcegraph/scip-go@v0.2.7",xi="scip-dotnet@0.2.14",Bs="scip_dart@1.6.2",$s={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:t,indexerBinary:n,projectPath:r})=>r?{binary:n,args:["index","--output",e,"--no-progress-bar","--no-global-caches",r]}:t?{binary:n,args:["index","--pnpm-workspaces","--output",e,"--no-progress-bar","--no-global-caches"]}:{binary:n,args:["index","--output",e,"--no-progress-bar","--no-global-caches"]},markerFiles:[..._.typescript],installMethods:[{label:"npm",identity:at,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",at]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},javascript:{language:"javascript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--no-progress-bar","--no-global-caches"]}),markerFiles:[..._.javascript],installMethods:[{label:"npm",identity:at,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",at]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},java:{language:"java",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[..._.java],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},scala:{language:"scala",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[..._.scala],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},kotlin:{language:"kotlin",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[..._.kotlin],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},rust:{language:he.language,indexerBinary:he.indexerBinary,checkCommand:`${he.indexerBinary} --version`,indexArgs:({outputPath:e})=>({binary:he.indexerBinary,args:["scip",".","--output",e]}),markerFiles:[..._.rust],installMethods:[],installUrl:he.installUrl},python:{language:"python",indexerBinary:"scip-python-plus",binaryAliases:["scip-python"],checkCommand:"scip-python-plus --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--project-name","project"]}),markerFiles:[..._.python],installMethods:[{label:"npm",identity:Si,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",Si]}],installUrl:"https://github.com/PlunderStruck/scip-python",bundledNpmPackage:"scip-python-plus"},clojure:{language:"clojure",indexerBinary:"scip-clojure",projectLocalBinaries:["node_modules/.bin/scip-clojure"],checkCommand:"scip-clojure -h",indexArgs:({projectRoot:e,outputPath:t,indexerBinary:n,configPath:r})=>{let i=["-root",e,"-output",t];return r&&i.push("-config",bi(r)?r:Ns(e,r)),{binary:n,args:i}},markerFiles:[..._.clojure],installMethods:[],installUrl:"https://github.com/PlunderStruck/scip-clojure"},ruby:{language:"ruby",indexerBinary:"scip-ruby",checkCommand:"scip-ruby --version",indexArgs:({indexerBinary:e})=>({binary:e,args:["--dir","."]}),defaultOutputPath:"index.scip",markerFiles:[..._.ruby],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-ruby/releases"},go:{language:"go",indexerBinary:"scip-go",checkCommand:"scip-go --version",indexArgs:({outputPath:e})=>({binary:"scip-go",args:["--output",e]}),markerFiles:[..._.go],installMethods:[{label:"go install",identity:Ri,destination:"Go bin directory (GOBIN or GOPATH/bin)",prerequisite:"go",binary:"go",args:["install",Ri]}],installUrl:"https://github.com/sourcegraph/scip-go"},cpp:{language:"cpp",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:[..._.cpp],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},c:{language:"c",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:[..._.c],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},csharp:{language:"csharp",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",vi(e,[".sln",".csproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[..._.csharp],installMethods:[{label:"dotnet",identity:xi,destination:"dotnet global tool directory",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet","--version","0.2.14"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},vb:{language:"vb",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",vi(e,[".sln",".vbproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[..._.vb],installMethods:[{label:"dotnet",identity:xi,destination:"dotnet global tool directory",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet","--version","0.2.14"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},dart:{language:"dart",indexerBinary:"scip-dart",checkCommand:"scip-dart --version",indexArgs:({indexerBinary:e,outputPath:t})=>({binary:e,args:["--output",t]}),markerFiles:[..._.dart],installMethods:[{label:"dart pub",identity:Bs,destination:"Dart pub global cache",prerequisite:"dart",binary:"dart",args:["pub","global","activate","scip_dart","1.6.2"]}],installUrl:"https://github.com/Workiva/scip-dart/releases"},php:{language:"php",indexerBinary:"scip-php",projectLocalBinaries:["vendor/davidrjenni/scip-php/bin/scip-php","vendor/bin/scip-php"],checkCommand:"scip-php --version",indexArgs:({indexerBinary:e})=>bi(e)?{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",e]}:{binary:e,args:[]},defaultOutputPath:"index.scip",markerFiles:[..._.php],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function Pi(e){if(!(e.projectPath||e.pnpmWorkspaces)){if(e.language==="typescript")return"{}";if(e.language==="javascript")return'{"compilerOptions":{"allowJs":true}}'}}function Xt(e){return $s[e]}function vi(e,t){let n;try{n=Cs(e)}catch{return null}for(let r of t)for(let i of n)if(i.endsWith(r))return Ms(e,i);return null}import{createHash as Vs}from"crypto";import{existsSync as Yt,rmSync as Ii,statSync as Us}from"fs";import{resolve as Gs}from"path";import Ei from"better-sqlite3";var Ws={documents:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"language",type:"TEXT",notnull:0,pk:0},{name:"relative_path",type:"TEXT",notnull:1,pk:0},{name:"position_encoding",type:"TEXT",notnull:0,pk:0},{name:"text",type:"TEXT",notnull:0,pk:0}],chunks:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"document_id",type:"INTEGER",notnull:1,pk:0},{name:"chunk_index",type:"INTEGER",notnull:1,pk:0},{name:"start_line",type:"INTEGER",notnull:1,pk:0},{name:"end_line",type:"INTEGER",notnull:1,pk:0},{name:"occurrences",type:"BLOB",notnull:1,pk:0}],global_symbols:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"symbol",type:"TEXT",notnull:1,pk:0},{name:"display_name",type:"TEXT",notnull:0,pk:0},{name:"kind",type:"INTEGER",notnull:0,pk:0},{name:"documentation",type:"TEXT",notnull:0,pk:0},{name:"signature",type:"BLOB",notnull:0,pk:0},{name:"enclosing_symbol",type:"TEXT",notnull:0,pk:0},{name:"relationships",type:"BLOB",notnull:0,pk:0}],mentions:[{name:"chunk_id",type:"INTEGER",notnull:1,pk:1},{name:"symbol_id",type:"INTEGER",notnull:1,pk:2},{name:"role",type:"INTEGER",notnull:1,pk:3}],defn_enclosing_ranges:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"document_id",type:"INTEGER",notnull:1,pk:0},{name:"symbol_id",type:"INTEGER",notnull:1,pk:0},{name:"start_line",type:"INTEGER",notnull:1,pk:0},{name:"start_char",type:"INTEGER",notnull:1,pk:0},{name:"end_line",type:"INTEGER",notnull:1,pk:0},{name:"end_char",type:"INTEGER",notnull:1,pk:0}]},qs={idx_chunks_line_range:{table:"chunks",columns:["document_id","start_line","end_line"]},idx_defn_enclosing_ranges_document:{table:"defn_enclosing_ranges",columns:["document_id","start_line","end_line"]},idx_defn_enclosing_ranges_symbol_id:{table:"defn_enclosing_ranges",columns:["symbol_id"]},idx_mentions_symbol_id_role:{table:"mentions",columns:["symbol_id","role"]}};function Ti(e){let t=P(),n=wi(e.affectedFiles),r=wi(e.deletedFiles??[],!0),i=new Set(n);if(r.some(s=>!i.has(s)))throw new Error("deleted incremental documents must be included in the affected document set");let a=n.length-r.length;if(Hs(e.previousDbPath,e.miniDbPath,e.candidateDbPath),!Yt(e.previousDbPath))throw new Error("previous SQLite generation is unavailable");if(!Yt(e.miniDbPath))throw new Error("incremental SQLite mini database is unavailable");R("reindex.publish.sqlite-patch.validate-inputs",()=>{Kt(e.previousDbPath,"previous SQLite generation",!1),Kt(e.miniDbPath,"incremental SQLite mini database")}),e.reuseCandidate?R("reindex.publish.sqlite-patch.reuse-candidate",()=>Kt(e.candidateDbPath,"incremental SQLite candidate",!1)):R("reindex.publish.sqlite-patch.clone",()=>{Ii(e.candidateDbPath,{force:!0});let s=ne(e.previousDbPath,e.candidateDbPath);e.writeTelemetry&&re(e.writeTelemetry,s)});let o=null;try{o=R("reindex.publish.sqlite-patch.open",()=>{let g=new Ei(e.candidateDbPath,{fileMustExist:!0});return g.pragma("busy_timeout = 5000"),g.pragma("foreign_keys = ON"),g.prepare("ATTACH DATABASE ? AS incremental").run(e.miniDbPath),Qt(g,"main","candidate SQLite generation"),Qt(g,"incremental","incremental SQLite mini database"),g});let{priorAffectedCount:s,previousFactDigests:c}=R("reindex.publish.sqlite-patch.prepare",()=>(Ks(o,n,r),{...Ys(o,n.length,r.length),previousFactDigests:Zt(o,"main",!0)})),u=z(o,"SELECT COUNT(*) AS value FROM main.documents"),l=o.transaction(()=>{R("reindex.publish.sqlite-patch.transaction.symbol-ownership",()=>Qs(o)),R("reindex.publish.sqlite-patch.transaction.shared-definitions",()=>Zs(o)),R("reindex.publish.sqlite-patch.transaction.delete",()=>ec(o)),e.onStage?.("after-delete"),R("reindex.publish.sqlite-patch.transaction.reconcile-symbols",()=>tc(o)),e.onStage?.("after-symbol-reconciliation"),R("reindex.publish.sqlite-patch.transaction.insert",()=>nc(o)),e.onStage?.("after-insert"),R("reindex.publish.sqlite-patch.transaction.prune-symbols",()=>rc(o,e.trustedPriorGeneration===!0)),R("reindex.publish.sqlite-patch.transaction.validate",()=>ic(o,a,u,s)),e.onStage?.("before-commit")});R("reindex.publish.sqlite-patch.transaction",()=>l.immediate()),e.writeTelemetry&&nt(e.writeTelemetry,2*Js(e.candidateDbPath)),R("reindex.publish.sqlite-patch.integrity",()=>Xs(o,"candidate SQLite generation",!e.deferIntegrity&&e.trustedPriorGeneration!==!0));let d=R("reindex.publish.sqlite-patch.validate-facts",()=>ac(o)),p=[...new Set([...c.keys(),...d.keys()])].filter(g=>c.get(g)!==d.get(g)).sort();return o.exec("DETACH DATABASE incremental"),o.close(),o=null,{candidateDbPath:e.candidateDbPath,affectedDocumentCount:n.length,changedDocumentPaths:p,durationMs:P()-t}}catch(s){try{o?.close()}finally{Ii(e.candidateDbPath,{force:!0})}throw new Error(`Incremental SQLite publication rejected: ${s instanceof Error?s.message:String(s)}`,{cause:s})}}function Js(e){let t=0;for(let n of["-wal","-journal"]){let r=`${e}${n}`;Yt(r)&&(t+=Us(r).size)}return t}function wi(e,t=!1){if(!t&&e.length===0)throw new Error("incremental SQLite publication requires affected documents");let n=[...e].sort();for(let r of n)if(!r||r.startsWith("/")||r.includes("\\")||r.split("/").includes(".."))throw new Error(`invalid affected document path: ${r}`);if(new Set(n).size!==n.length)throw new Error("incremental SQLite publication contains duplicate affected documents");return n}function Hs(e,t,n){let r=[e,t,n].map(i=>Gs(i));if(new Set(r).size!==r.length)throw new Error("previous, mini, and candidate SQLite paths must be distinct")}function Kt(e,t,n=!0){let r=new Ei(e,{readonly:!0,fileMustExist:!0});try{Qt(r,"main",t),n&&zs(r,"main",t)}finally{r.close()}}function Qt(e,t,n){for(let[r,i]of Object.entries(Ws)){let o=e.prepare(`PRAGMA ${t}.table_info('${r}')`).all().map(({name:s,type:c,notnull:u,pk:l})=>({name:s,type:c.toUpperCase(),notnull:u,pk:l}));if(JSON.stringify(o)!==JSON.stringify(i))throw new Error(`${n} schema changed for table ${r}`)}for(let[r,i]of Object.entries(qs)){let a=e.prepare(`SELECT tbl_name FROM ${t}.sqlite_master WHERE type = 'index' AND name = ?`).get(r),o=e.prepare(`PRAGMA ${t}.index_info('${r}')`).all().map(s=>s.name);if(a?.tbl_name!==i.table||JSON.stringify(o)!==JSON.stringify(i.columns))throw new Error(`${n} schema changed for index ${r}`)}ki(e,t,"documents",["relative_path"],n),ki(e,t,"global_symbols",["symbol"],n)}function ki(e,t,n,r,i){if(!e.prepare(`PRAGMA ${t}.index_list('${n}')`).all().some(s=>{if(s.unique!==1)return!1;let c=e.prepare(`PRAGMA ${t}.index_info('${s.name}')`).all().map(u=>u.name);return JSON.stringify(c)===JSON.stringify(r)}))throw new Error(`${i} lost the unique ${n}(${r.join(", ")}) constraint`)}function zs(e,t,n){let r=e.prepare(`PRAGMA ${t}.integrity_check`).pluck().get();if(r!=="ok")throw new Error(`${n} failed integrity_check: ${String(r)}`);if(e.prepare(`PRAGMA ${t}.foreign_key_check`).all().length>0)throw new Error(`${n} failed foreign_key_check`)}function Xs(e,t,n){if(e.pragma("foreign_keys",{simple:!0})!==1)throw new Error(`${t} lost foreign-key enforcement`);if(!n)return;let r=e.prepare("PRAGMA main.quick_check").pluck().get();if(r!=="ok")throw new Error(`${t} failed quick_check: ${String(r)}`)}function Ks(e,t,n){e.exec("CREATE TEMP TABLE incremental_affected_paths (relative_path TEXT PRIMARY KEY) WITHOUT ROWID"),e.exec("CREATE TEMP TABLE incremental_deleted_paths (relative_path TEXT PRIMARY KEY) WITHOUT ROWID");let r=e.prepare("INSERT INTO temp.incremental_affected_paths(relative_path) VALUES (?)"),i=e.prepare("INSERT INTO temp.incremental_deleted_paths(relative_path) VALUES (?)");e.transaction(o=>{for(let s of o)r.run(s);for(let s of n)i.run(s)})(t)}function Ys(e,t,n){let r=z(e,"SELECT COUNT(*) AS value FROM incremental.documents"),i=z(e,`SELECT COUNT(*) AS value
68
- FROM main.documents d
69
- JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`),a=e.prepare(`SELECT p.relative_path
70
- FROM temp.incremental_affected_paths p
71
- LEFT JOIN incremental.documents d ON d.relative_path = p.relative_path
72
- LEFT JOIN temp.incremental_deleted_paths deleted ON deleted.relative_path = p.relative_path
73
- WHERE d.id IS NULL AND deleted.relative_path IS NULL
74
- LIMIT 1`).pluck().get(),o=e.prepare(`SELECT d.relative_path
75
- FROM incremental.documents d
76
- LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
77
- WHERE p.relative_path IS NULL
78
- LIMIT 1`).pluck().get(),s=e.prepare(`SELECT d.relative_path
79
- FROM incremental.documents d
80
- JOIN temp.incremental_deleted_paths deleted ON deleted.relative_path = d.relative_path
81
- LIMIT 1`).pluck().get();if(r!==t-n||a!==void 0||o!==void 0||s!==void 0)throw new Error("incremental SQLite mini database does not exactly match the affected document set");return{priorAffectedCount:i}}function Qs(e){e.exec(`
82
- CREATE TEMP TABLE incremental_old_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
83
- INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
84
- SELECT g.symbol
85
- FROM temp.incremental_affected_paths p
86
- CROSS JOIN main.documents d ON d.relative_path = p.relative_path
87
- CROSS JOIN main.defn_enclosing_ranges r ON r.document_id = d.id
88
- CROSS JOIN main.global_symbols g ON g.id = r.symbol_id;
89
- INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
90
- SELECT g.symbol
91
- FROM temp.incremental_affected_paths p
92
- CROSS JOIN main.documents d ON d.relative_path = p.relative_path
93
- CROSS JOIN main.chunks c ON c.document_id = d.id
94
- CROSS JOIN main.mentions m ON m.chunk_id = c.id
95
- CROSS JOIN main.global_symbols g ON g.id = m.symbol_id
96
- WHERE m.role = 1;
97
-
98
- CREATE TEMP TABLE incremental_new_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
99
- INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
100
- SELECT g.symbol
101
- FROM incremental.defn_enclosing_ranges r
102
- JOIN incremental.global_symbols g ON g.id = r.symbol_id;
103
- INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
104
- SELECT g.symbol
105
- FROM incremental.mentions m
106
- JOIN incremental.global_symbols g ON g.id = m.symbol_id
107
- WHERE m.role = 1;
108
-
109
- CREATE TEMP TABLE incremental_touched_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
110
- INSERT OR IGNORE INTO temp.incremental_touched_symbols(symbol)
111
- SELECT symbol FROM temp.incremental_old_defined_symbols;
112
- INSERT OR IGNORE INTO temp.incremental_touched_symbols(symbol)
113
- SELECT g.symbol
114
- FROM temp.incremental_affected_paths p
115
- CROSS JOIN main.documents d ON d.relative_path = p.relative_path
116
- CROSS JOIN main.chunks c ON c.document_id = d.id
117
- CROSS JOIN main.mentions m ON m.chunk_id = c.id
118
- CROSS JOIN main.global_symbols g ON g.id = m.symbol_id;
119
- INSERT OR IGNORE INTO temp.incremental_touched_symbols(symbol)
120
- SELECT symbol FROM incremental.global_symbols;
121
- `)}function Zs(e){let t=e.prepare(`WITH changed_symbols AS (
122
- SELECT symbol FROM temp.incremental_old_defined_symbols
123
- UNION
124
- SELECT symbol FROM temp.incremental_new_defined_symbols
125
- )
126
- SELECT c.symbol
127
- FROM changed_symbols c
128
- CROSS JOIN main.global_symbols g ON g.symbol = c.symbol
129
- WHERE EXISTS (
130
- SELECT 1
131
- FROM main.defn_enclosing_ranges r
132
- JOIN main.documents d ON d.id = r.document_id
133
- LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
134
- WHERE r.symbol_id = g.id AND p.relative_path IS NULL
135
- ) OR EXISTS (
136
- SELECT 1
137
- FROM main.mentions m
138
- JOIN main.chunks chunk ON chunk.id = m.chunk_id
139
- JOIN main.documents d ON d.id = chunk.document_id
140
- LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
141
- WHERE m.symbol_id = g.id AND m.role = 1 AND p.relative_path IS NULL
142
- )
143
- LIMIT 1`).pluck().get();if(typeof t=="string")throw new Error(`symbol definition is shared by affected and unaffected documents: ${t}`)}function ec(e){e.exec(`
144
- DELETE FROM main.mentions
145
- WHERE chunk_id IN (
146
- SELECT c.id
147
- FROM main.chunks c
148
- JOIN main.documents d ON d.id = c.document_id
149
- JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
150
- );
151
- DELETE FROM main.chunks
152
- WHERE document_id IN (
153
- SELECT d.id
154
- FROM main.documents d
155
- JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
156
- );
157
- DELETE FROM main.defn_enclosing_ranges
158
- WHERE document_id IN (
159
- SELECT d.id
160
- FROM main.documents d
161
- JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
162
- );
163
- DELETE FROM main.documents
164
- WHERE relative_path IN (SELECT relative_path FROM temp.incremental_affected_paths);
165
- `)}function tc(e){e.exec(`
166
- UPDATE main.global_symbols
167
- SET display_name = NULL,
168
- kind = NULL,
169
- documentation = NULL,
170
- signature = NULL,
171
- enclosing_symbol = NULL,
172
- relationships = NULL
173
- WHERE symbol IN (SELECT symbol FROM temp.incremental_old_defined_symbols);
174
-
175
- INSERT OR IGNORE INTO main.global_symbols(
176
- symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
177
- )
178
- SELECT symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
179
- FROM incremental.global_symbols;
180
-
181
- UPDATE main.global_symbols
182
- SET display_name = (
183
- SELECT source.display_name FROM incremental.global_symbols source
184
- WHERE source.symbol = main.global_symbols.symbol
185
- ),
186
- kind = (
187
- SELECT source.kind FROM incremental.global_symbols source
188
- WHERE source.symbol = main.global_symbols.symbol
189
- ),
190
- documentation = (
191
- SELECT source.documentation FROM incremental.global_symbols source
192
- WHERE source.symbol = main.global_symbols.symbol
193
- ),
194
- signature = (
195
- SELECT source.signature FROM incremental.global_symbols source
196
- WHERE source.symbol = main.global_symbols.symbol
197
- ),
198
- enclosing_symbol = (
199
- SELECT source.enclosing_symbol FROM incremental.global_symbols source
200
- WHERE source.symbol = main.global_symbols.symbol
201
- ),
202
- relationships = (
203
- SELECT source.relationships FROM incremental.global_symbols source
204
- WHERE source.symbol = main.global_symbols.symbol
205
- )
206
- WHERE symbol IN (SELECT symbol FROM temp.incremental_new_defined_symbols);
207
- `)}function nc(e){let t=z(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.documents"),n=z(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.chunks"),r=z(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.defn_enclosing_ranges");e.prepare(`INSERT INTO main.documents(id, language, relative_path, position_encoding, text)
208
- SELECT id + ?, language, relative_path, position_encoding, text
209
- FROM incremental.documents`).run(t),e.prepare(`INSERT INTO main.chunks(id, document_id, chunk_index, start_line, end_line, occurrences)
210
- SELECT id + ?, document_id + ?, chunk_index, start_line, end_line, occurrences
211
- FROM incremental.chunks`).run(n,t),e.prepare(`INSERT INTO main.mentions(chunk_id, symbol_id, role)
212
- SELECT m.chunk_id + ?, target.id, m.role
213
- FROM incremental.mentions m
214
- CROSS JOIN incremental.global_symbols source ON source.id = m.symbol_id
215
- CROSS JOIN main.global_symbols target ON target.symbol = source.symbol`).run(n),e.prepare(`INSERT INTO main.defn_enclosing_ranges(
216
- id, document_id, symbol_id, start_line, start_char, end_line, end_char
217
- )
218
- SELECT r.id + ?, r.document_id + ?, target.id,
219
- r.start_line, r.start_char, r.end_line, r.end_char
220
- FROM incremental.defn_enclosing_ranges r
221
- CROSS JOIN incremental.global_symbols source ON source.id = r.symbol_id
222
- CROSS JOIN main.global_symbols target ON target.symbol = source.symbol`).run(r,t)}function rc(e,t){let n=t?"symbol IN (SELECT symbol FROM temp.incremental_touched_symbols) AND":"";e.exec(`
223
- DELETE FROM main.global_symbols
224
- WHERE ${n}
225
- NOT EXISTS (SELECT 1 FROM main.mentions m WHERE m.symbol_id = main.global_symbols.id)
226
- AND NOT EXISTS (
227
- SELECT 1 FROM main.defn_enclosing_ranges r WHERE r.symbol_id = main.global_symbols.id
228
- );
229
- `)}function ic(e,t,n,r){let i=z(e,"SELECT COUNT(*) AS value FROM main.documents"),a=z(e,`SELECT COUNT(*) AS value
230
- FROM main.documents d
231
- JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`),o=n-r+t;if(i!==o||a!==t)throw new Error("candidate SQLite document counts changed unexpectedly")}function ac(e){let t=Zt(e,"main",!0),n=Zt(e,"incremental",!1);if(JSON.stringify([...t])!==JSON.stringify([...n]))throw new Error("candidate SQLite affected document facts differ from the mini database");return t}function Zt(e,t,n){let r=n?"JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path":"",i=e.prepare(`SELECT d.relative_path, d.language, d.position_encoding, d.text
232
- FROM ${t}.documents d
233
- ${r}
234
- ORDER BY d.relative_path`).all(),a=e.prepare(`SELECT d.relative_path, c.chunk_index, c.start_line, c.end_line, hex(c.occurrences) AS occurrences
235
- FROM ${t}.chunks c
236
- JOIN ${t}.documents d ON d.id = c.document_id
237
- ${r}
238
- ORDER BY d.relative_path, c.chunk_index, c.start_line, c.end_line, c.id`).all(),o=e.prepare(`SELECT d.relative_path, r.start_line, r.start_char, r.end_line, r.end_char,
239
- g.symbol, g.display_name, g.kind, g.documentation,
240
- CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature,
241
- g.enclosing_symbol,
242
- CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships
243
- FROM ${t}.defn_enclosing_ranges r
244
- JOIN ${t}.documents d ON d.id = r.document_id
245
- JOIN ${t}.global_symbols g ON g.id = r.symbol_id
246
- ${r}
247
- ORDER BY d.relative_path, r.start_line, r.start_char, r.end_line, r.end_char, g.symbol`).all(),s=e.prepare(`SELECT d.relative_path, c.chunk_index, m.role, g.symbol
248
- FROM ${t}.mentions m
249
- JOIN ${t}.chunks c ON c.id = m.chunk_id
250
- JOIN ${t}.documents d ON d.id = c.document_id
251
- JOIN ${t}.global_symbols g ON g.id = m.symbol_id
252
- ${r}
253
- ORDER BY d.relative_path, c.chunk_index, m.role, g.symbol`).all(),c=new Map;for(let[l,d]of Object.entries({documents:i,chunks:a,definitions:o,mentions:s}))for(let p of d){let g=JSON.stringify([l,p]),f=c.get(p.relative_path)??[];f.push(g),c.set(p.relative_path,f)}let u=new Map;for(let[l,d]of[...c].sort(([p],[g])=>p.localeCompare(g))){let p=Vs("sha256");for(let g of d.sort())p.update(g).update(`
254
- `);u.set(l,p.digest("hex"))}return u}function z(e,t){return e.prepare(t).get().value}import oc from"better-sqlite3";var ot="idx_mentions_definitions",sc=["symbol_id","chunk_id"];function en(e,t={}){let n=new oc(e),r=[],i=[],a=[];try{return n.transaction(()=>{cc(n,r),st(n,"idx_global_symbols_symbol")?.join("\0")==="symbol"&&Fi(n,"global_symbols").some(c=>c.name!=="idx_global_symbols_symbol"&&c.unique&&c.columns.join("\0")==="symbol")?(n.exec('DROP INDEX "idx_global_symbols_symbol"'),i.push("idx_global_symbols_symbol")):st(n,"idx_global_symbols_symbol")&&a.push("idx_global_symbols_symbol");let o=st(n,"idx_chunks_doc_id"),s=Fi(n,"chunks").some(c=>c.name!=="idx_chunks_doc_id"&&c.columns.length>1&&c.columns[0]==="document_id");o?.join("\0")==="document_id"&&s?(n.exec('DROP INDEX "idx_chunks_doc_id"'),i.push("idx_chunks_doc_id")):o&&a.push("idx_chunks_doc_id"),t.analyze!==!1&&n.exec("ANALYZE")})(),{added:r,removed:i,retained:a,analyzed:t.analyze!==!1}}catch(o){if(o.code==="SQLITE_NOTADB")return{added:[],removed:[],retained:[],analyzed:!1,skippedReason:"not-a-sqlite-database"};throw o}finally{n.close()}}function cc(e,t){let n=Ai(e,ot);if(n){let r=n.columns.join("\0")===sc.join("\0"),i=/\bWHERE\s+role\s*=\s*1\b/iu.test(n.sql??"");if(!r||!i||n.table!=="mentions")throw new Error(`${ot} exists with an incompatible definition`);return}e.exec(`CREATE INDEX "${ot}" ON mentions(symbol_id, chunk_id) WHERE role = 1`),t.push(ot)}function Fi(e,t){return e.prepare(`PRAGMA index_list('${t.replaceAll("'","''")}')`).all().map(n=>({name:n.name,unique:n.unique===1,columns:st(e,n.name)??[]}))}function st(e,t){return Ai(e,t)?.columns??null}function Ai(e,t){let n=e.prepare("SELECT tbl_name, sql FROM sqlite_master WHERE type = 'index' AND name = ?").get(t);if(!n)return null;let r=e.prepare(`PRAGMA index_info('${t.replaceAll("'","''")}')`).all().map(i=>i.name);return{table:n.tbl_name,sql:n.sql,columns:r}}import{writeFileSync as uc}from"fs";function ae(e,t){let n=performance.now(),r=e.run(t);return{stageId:e.id,facts:e.facts,durationMs:performance.now()-n,result:r}}async function Di(e){let t=e.readFingerprint(),n=lc(e.cachePath,t);if(n)return e.onCacheHit?.(n.result),n.result;let r=await e.compute();return dc(e.cachePath,e.readFingerprint(),r),r}function lc(e,t){try{let n=JSON.parse(N(e,{maxBytes:le,inputKind:"post-index augmentation cache"}));return _i(n.fingerprint)===_i(t)?{result:n.result}:null}catch{return null}}function dc(e,t,n){uc(e,`${JSON.stringify({updatedAt:new Date().toISOString(),fingerprint:t,result:n},null,2)}
255
- `)}function _i(e){return JSON.stringify(e)}import{existsSync as Li,statSync as pc}from"fs";import{dirname as Mi,join as Ni}from"path";var gc="reindex-activity.jsonl",ct=xe,fc=1024*1024,mc=1440*60*1e3,Oi=e=>B(e,"reindex activity segment");function ut(e){return Ni(Mi(e),gc)}function Bi(e){if(e.reused)return 0;let n=(e.shards?.some(r=>!r.reused&&r.strategy==="incremental")??!1?0:tn(e.indexPath))+tn(e.dbPath);for(let r of e.shards??[]){if(r.reused)continue;let i=r.producedOutputBytes??r.outputBytes;i!==null&&(n+=i)}return n}function hc(e){let t=Bi(e),n=e.writeTelemetry;return n?Math.max(0,t-n.reflinkedBytes)+n.fallbackCopiedBytes+(n.incrementalWrittenBytes??0):t}function nn(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=Bi(t);return rn(ut(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:hc(t),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,incrementalWrittenBytes:t.writeTelemetry?.incrementalWrittenBytes??0,byLanguage:Pc(t)})}function $i(e,t){return rn(ut(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function Rg(e,t,n=new Date){return rn(ut(e),{version:1,event:"suppressed",recordedAt:n.toISOString(),trigger:t,reason:"completed-index-is-fresh"})}function yc(e,t,n=fc,r){it(e,t,{maxSegmentBytes:n,previousSuffix:ct,...r?{runtime:r}:{}})}function bc(e,t=new Date,n=mc,r=Oi){let i=t.getTime(),a=i-n,o={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:{}},s=ut(e),c=[];if(r===Oi){if(!Li(s)&&!Li(`${s}${ct}`))return o;try{let u=si(s,{previousSuffix:ct});c=u.lines,o.ignoredPartialTailBytes=u.ignoredPartialTailBytes}catch{o.readErrors+=1,o.confidence="unavailable"}}else{let u=0;for(let l of[`${s}${ct}`,s])try{c.push(...Fc(r(l))),u+=1}catch{o.readErrors+=1}u===0?o.confidence="unavailable":o.readErrors>0&&(o.confidence="partial")}for(let u of c){o.recordsRead+=1;let l=Sc(u);if(!l){o.invalidRecords+=1,o.confidence!=="unavailable"&&(o.confidence="partial");continue}let{record:d}=l,p=Date.parse(d.recordedAt);if(p<a||p>i){o.skippedRecords+=1;continue}if(o.invalidLanguageDetails=(o.invalidLanguageDetails??0)+l.invalidLanguageDetails,o.byTrigger[d.trigger.kind]=(o.byTrigger[d.trigger.kind]??0)+1,d.event==="suppressed"){o.suppressed+=1;continue}o.runs+=1,o[d.result]+=1,o.estimatedLogicalOutputBytes+=d.estimatedLogicalOutputBytes;let g=Rc(d);o.estimatedWriteBytes=(o.estimatedWriteBytes??0)+g,o.reflinkedBytes=(o.reflinkedBytes??0)+(d.reflinkedBytes??0),o.fallbackCopiedBytes=(o.fallbackCopiedBytes??0)+(d.fallbackCopiedBytes??0),d.result!=="failed"&&(l.hasLanguageDetails?o.attributedRuns=(o.attributedRuns??0)+1:o.unattributedRuns=(o.unattributedRuns??0)+1);for(let[f,h]of Vi(d.byLanguage)){let v=(o.byLanguage??={})[f]??=Ec();v.runs+=1,v[h.result]+=1,v.producedOutputBytes+=h.producedOutputBytes,v.durationMs+=h.durationMs}ji(d)&&o.oldestRebuildAt===void 0&&(o.oldestRebuildAt=d.recordedAt),ji(d)&&(o.fullRebuilds=(o.fullRebuilds??0)+1),g>0&&o.oldestWriteAt===void 0&&(o.oldestWriteAt=d.recordedAt)}return o.ignoredPartialTailBytes>0&&o.confidence!=="unavailable"&&(o.confidence="partial"),o.languageAttribution=Tc(o),o}function rn(e,t){try{return yc(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function Sc(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!Kn(n.recordedAt)||!n.trigger||!vc(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"||!W(n.durationMs)||!W(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!W(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!W(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!W(n.fallbackCopiedBytes)||n.incrementalWrittenBytes!==void 0&&!W(n.incrementalWrittenBytes))return null;let r=n,{byLanguage:i,...a}=r,o=Ic(i);return{record:{...a,...o.byLanguage?{byLanguage:o.byLanguage}:{}},hasLanguageDetails:o.hasLanguageDetails,invalidLanguageDetails:o.invalidLanguageDetails}}catch{return null}}function Rc(e){return e.reflinkedBytes===void 0?e.estimatedWriteBytes??e.estimatedLogicalOutputBytes:Math.max(0,e.estimatedLogicalOutputBytes-e.reflinkedBytes)+(e.fallbackCopiedBytes??0)+(e.incrementalWrittenBytes??0)}function xg(e,t,n=new Date){return t.enabled?xc(bc(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function xc(e,t,n){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,i=e.fullRebuilds??e.rebuilt,a={rebuilt:i,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}`}:i>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:Ci(e.oldestRebuildAt,t.windowMs,n),...a,detail:`${i}/${t.maxRebuilds} expensive full rebuild slots consumed`}:r>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:Ci(e.oldestWriteAt,t.windowMs,n),...a,detail:`${r}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...a}:{state:"allowed",...a}}function ji(e){if(e.result!=="rebuilt")return!1;let t=Vi(e.byLanguage);return t.length===0?!0:t.some(([,n])=>n.result==="rebuilt"&&n.strategy!=="incremental"&&n.strategy!=="reused")}function Ci(e,t,n){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+t>n?r+t:n+t}function vc(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 tn(e){try{return pc(e).size}catch{return 0}}function Pc(e){let t={};for(let n of e.languages){let r=(e.shards??[]).filter(u=>u.language===n),i=r.find(u=>u.id===n),a=e.reused||(i?i.reused:r.length>0&&r.every(u=>u.reused)),o=tn(Ni(Mi(e.dbPath),"language-indexes",`${n}.scip`)),s=o>0?o:i?.outputBytes??o,c=a?0:i?.durationMs??r.filter(u=>!u.reused).reduce((u,l)=>u+l.durationMs,0);t[n]={result:a?"reused":"rebuilt",strategy:a?"reused":i?.strategy??"full",...i?.strategy==="full"&&(i.fallbackReason??i.missReason)?{fallbackReason:i.fallbackReason??i.missReason}:{},outputBytes:s,producedOutputBytes:a?0:i?.producedOutputBytes??s,durationMs:c}}return t}function Ic(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[i,a]of Object.entries(e)){if(!kc(i)||!wc(a)){n+=1;continue}t[i]=a}let r=Object.keys(t).length>0;return{...r?{byLanguage:t}:{},hasLanguageDetails:r,invalidLanguageDetails:n}}function wc(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")&&Lt(t.outputBytes)&&Lt(t.producedOutputBytes)&&W(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function kc(e){return Ot.includes(e)}function Vi(e){return e?Ot.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function Ec(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function Tc(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function Fc(e){return e.endsWith(`
256
- `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
257
- `)+1))),e.split(`
258
- `).filter(t=>t.length>0)}import{createHash as Ac}from"crypto";import{existsSync as an,readdirSync as _c}from"fs";import{dirname as on,join as lt,relative as Dc,resolve as sn,sep as Ui}from"path";function Gi(e,t){let n=t.includes("."),r={};for(let a of t)r[a]=[];let i=[];for(let a of e){let o=Hi(a.path,t);o?r[o].push(a):n?r["."].push(a):i.push(a)}return{files:r,shared:i}}function Wi(e,t){let n=new Map;for(let i of e){let a=t[i]?.packageName;a&&n.set(a,i)}let r=new Map;for(let i of e)r.set(i,new Set);for(let i of e){let a=t[i],o=r.get(i);if(!a||a.parseFailed){for(let s of e)s!==i&&o.add(s);continue}for(let s of a.dependencyNames){let c=n.get(s);c&&c!==i&&o.add(c)}for(let s of[...a.pathsTargets,...a.referencesPaths]){let c=Hi(s,e);c&&c!==i&&o.add(c)}}return Lc(e,r)}function qi(e,t,n){let r={};for(let i of e){let a=new Map;for(let o of t.files[i]??[])a.set(o.path,o);for(let o of n[i]??[])for(let s of t.files[o]??[])a.set(s.path,s);for(let o of t.shared)a.set(o.path,o);r[i]={files:[...a.values()].sort((o,s)=>o.path.localeCompare(s.path))}}return r}function cn(e){if(e===".")return"root";let t=Ac("sha256").update(e).digest("hex").slice(0,8);return`${e.split("/").join("__")}-${t}`}function Ji(e,t){let n=sn(e),r={};for(let i of t)r[i]=Oc(n,i);return r}function Hi(e,t){let n;for(let r of t)r!=="."&&(e===r||e.startsWith(`${r}/`))&&(!n||r.length>n.length)&&(n=r);return n}function Lc(e,t){let n={};for(let r of e){let i=new Set,a=[...t.get(r)??[]];for(;a.length>0;){let o=a.pop();if(!(o===r||i.has(o))){i.add(o);for(let s of t.get(o)??[])s!==r&&!i.has(s)&&a.push(s)}}n[r]=[...i].sort((o,s)=>o.localeCompare(s))}return n}function Oc(e,t){let n=t==="."?e:lt(e,t),r=jc(n),i=Cc(n),a=i?Mc(i,e):{pathsTargets:[],referencesPaths:[],failed:!1};return{packageName:r.name,dependencyNames:r.dependencyNames,pathsTargets:a.pathsTargets,referencesPaths:a.referencesPaths,parseFailed:r.failed||a.failed}}function jc(e){let t=lt(e,"package.json");if(!an(t))return{name:void 0,dependencyNames:[],failed:!1};let n=un(t);if(!n.ok)return{name:void 0,dependencyNames:[],failed:!0};let r=typeof n.value.name=="string"?n.value.name:void 0,i=new Set;for(let a of["dependencies","devDependencies","peerDependencies"]){let o=n.value[a];if(o&&typeof o=="object"&&!Array.isArray(o))for(let s of Object.keys(o))i.add(s)}return{name:r,dependencyNames:[...i],failed:!1}}function Cc(e){let t=lt(e,"tsconfig.json");if(an(t))return t;let n;try{n=_c(e).filter(r=>/^tsconfig.*\.json$/.test(r))}catch{return}return n.sort((r,i)=>r.localeCompare(i)),n.length>0?lt(e,n[0]):void 0}function Mc(e,t){let n=un(e);if(!n.ok)return{pathsTargets:[],referencesPaths:[],failed:!0};let r=Nc(n.value,e,t),i=zi(e,n.value,t,0);return{pathsTargets:i.pathsTargets,referencesPaths:r,failed:i.failed}}function Nc(e,t,n){let r=e.references;if(!Array.isArray(r))return[];let i=on(t),a=new Set;for(let o of r){if(!o||typeof o!="object")continue;let s=o.path;if(typeof s!="string"||s.trim()==="")continue;let c=Xi(s,i,n);c&&a.add(c)}return[...a]}function zi(e,t,n,r){let i=Bc(t);if(i)return{pathsTargets:$c(i,on(e),n),failed:!1};if(r>=5)return{pathsTargets:[],failed:!1};let a=Vc(t.extends,e,n);if(!a)return{pathsTargets:[],failed:!1};let o=un(a);return o.ok?zi(a,o.value,n,r+1):{pathsTargets:[],failed:!0}}function Bc(e){let t=e.compilerOptions;if(!t||typeof t!="object"||Array.isArray(t))return;let n=t.paths;return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0}function $c(e,t,n){let r=new Set;for(let i of Object.values(e))if(Array.isArray(i))for(let a of i){if(typeof a!="string")continue;let o=Xi(a,t,n);o&&r.add(o)}return[...r]}function Vc(e,t,n){let r=Array.isArray(e)?e.at(-1):e;if(typeof r!="string"||r.trim()===""||!r.startsWith(".")&&!r.startsWith("/"))return;let i=sn(on(t),r);if(i.endsWith(".json")||(i=`${i}.json`),!i.split(Ui).includes("node_modules")&&Ft(n,i)&&an(i))return i}function Xi(e,t,n){let r=e.replace(/\/?\*+$/,""),i=sn(t,r===""?".":r);if(!Ft(n,i))return;let o=Dc(n,i).split(Ui).join("/");return o===""?".":o}function Uc(e){let t="",n=0,r=!1,i=e.length;for(;n<i;){let a=e[n];if(r){if(t+=a,a==="\\"&&n+1<i){t+=e[n+1],n+=2;continue}a==='"'&&(r=!1),n+=1;continue}if(a==='"'){r=!0,t+=a,n+=1;continue}if(a==="/"&&e[n+1]==="/"){for(n+=2;n<i&&e[n]!==`
259
- `;)n+=1;continue}if(a==="/"&&e[n+1]==="*"){for(n+=2;n<i&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}t+=a,n+=1}return t}function un(e){try{let t=N(e,{maxBytes:le,inputKind:"TypeScript project manifest"}),n=JSON.parse(Uc(t));return n&&typeof n=="object"&&!Array.isArray(n)?{ok:!0,value:n}:{ok:!1}}catch{return{ok:!1}}}import{createHash as Rn}from"crypto";import{existsSync as Sn,writeFileSync as da}from"fs";import{join as yu}from"path";import{createRequire as Gc}from"module";import{dirname as fn,isAbsolute as Wc,relative as Qi,resolve as K,sep as dn}from"path";var X=Gc(import.meta.url),qc=1,Ki="0.4.0";function Jc(){try{let e=Zi();if(!e.available)return e;let{packageRoot:t}=e,n=X.resolve("typescript",{paths:[t]}),r=X(n),{FileIndexer:i}=X(K(t,"dist/src/FileIndexer.js")),{Input:a}=X(K(t,"dist/src/Input.js")),{Packages:o}=X(K(t,"dist/src/Packages.js")),s=X(K(t,"dist/src/scip.js"));if(!i||!a||!o||!s.scip?.Document||!s.scip.Index)return{available:!1,reason:"scip-typescript document runtime has an unsupported module shape"};let c={packageVersion:e.packageVersion,typescript:r,Document:s.scip.Document,Index:s.scip.Index,FileIndexer:i,Input:a,Packages:o};return{available:!0,runtime:c,producerIdentity:hn(c)}}catch(e){return{available:!1,reason:`scip-typescript document runtime unavailable: ${e instanceof Error?e.message:String(e)}`}}}function mn(){let e=Zi();return e.available?{available:!0,packageVersion:e.packageVersion,typescriptVersion:e.typescriptVersion,producerIdentity:e.producerIdentity}:e}function Zi(){try{let e=X.resolve("@sourcegraph/scip-typescript/package.json"),t=JSON.parse(B(e,"scip-typescript package manifest"));if(t.version!==Ki)return{available:!1,reason:`unsupported scip-typescript version ${String(t.version??"unknown")}; expected ${Ki}`};let n=fn(e),r=X.resolve("typescript/package.json",{paths:[n]}),i=JSON.parse(B(r,"TypeScript package manifest"));return typeof i.version!="string"||!i.version?{available:!1,reason:"scip-typescript TypeScript compiler version is unavailable"}:{available:!0,packageRoot:n,packageVersion:t.version,typescriptVersion:i.version,producerIdentity:ta(t.version,i.version)}}catch(e){return{available:!1,reason:`scip-typescript document producer unavailable: ${e instanceof Error?e.message:String(e)}`}}}function ea(e){let t=e.runtime===void 0?Jc():e.runtime===null?{available:!1,reason:"scip-typescript document runtime unavailable"}:{available:!0,runtime:e.runtime,producerIdentity:hn(e.runtime)};return t.available?{available:!0,emitter:new pn(e,t.runtime)}:t}var pn=class{producerIdentity;workspaceRoot;tsconfigPath;projectRoot;maxFileByteSize;runtime;host;config=null;includedFiles=new Set;program=null;checker=null;symbolTable=new Map;constructorTable=new Map;packages;fragments=new Map;stats={initializations:0,programUpdates:0,documentsEmitted:0,documentsRemoved:0,sourceNodesReused:0,sourceNodesReplaced:0,symbolEntriesPruned:0};constructor(t,n){this.workspaceRoot=K(t.workspaceRoot),this.tsconfigPath=K(this.workspaceRoot,t.tsconfigPath),this.projectRoot=t.projectRoot??zc(this.workspaceRoot,fn(this.tsconfigPath)),this.maxFileByteSize=t.maxFileByteSize??1024*1024,this.runtime=n,this.producerIdentity=hn(n);let r=ln(n.typescript,this.tsconfigPath);this.config=r,this.host=new gn(n.typescript,r.options,this.workspaceRoot),this.packages=new n.Packages(this.projectRoot)}initialize(){let t=performance.now();this.initializeProgram();let n=[];for(let r of this.program.getSourceFiles())this.includedFiles.has(Ie(r.fileName))&&n.push(this.emitSourceFile(r));return this.result(n,t)}advance(t){if(!this.program||!this.checker||!this.config)return this.initializeAndAdvance(t);let n=performance.now(),r=Pe(t.modifiedFiles),i=Pe(t.removedFiles??[]),a=Pe(t.affectedFiles);if(this.fragments.clear(),r.length===0&&i.length===0)return this.validateAffectedPaths(a),this.result(this.emitAffectedFiles(a),n);let o=ln(this.runtime.typescript,this.tsconfigPath);this.config=o,this.includedFiles=new Set(o.fileNames.map(Ie));let s=this.program,c=new Map;for(let u of[...r,...i]){let l=ve(this.workspaceRoot,u),d=s.getSourceFile(l);d&&(c.set(u,d),this.stats.symbolEntriesPruned+=Yi(this.symbolTable,d),this.stats.symbolEntriesPruned+=Yi(this.constructorTable,d)),this.host.invalidate(l)}this.program=this.runtime.typescript.createProgram(o.fileNames,o.options,this.host.compilerHost,s),this.checker=this.program.getTypeChecker(),this.stats.programUpdates+=1,this.validateIncrementalPaths(r,i,a),this.stats.documentsRemoved+=i.length;for(let[u,l]of c)this.program.getSourceFile(ve(this.workspaceRoot,u))===l?this.stats.sourceNodesReused+=1:this.stats.sourceNodesReplaced+=1;return this.result(this.emitAffectedFiles(a),n)}fragment(t){return this.fragments.get(dt(t))??null}snapshotStats(){return{...this.stats}}initializeAndAdvance(t){let n=performance.now();this.initializeProgram();let r=Pe(t.modifiedFiles),i=Pe(t.removedFiles??[]),a=Pe(t.affectedFiles);return this.fragments.clear(),this.validateIncrementalPaths(r,i,a,!0),this.stats.documentsRemoved+=i.length,this.result(this.emitAffectedFiles(a),n)}initializeProgram(){let t=this.config??ln(this.runtime.typescript,this.tsconfigPath);this.includedFiles=new Set(t.fileNames.map(Ie)),this.program=this.runtime.typescript.createProgram(t.fileNames,t.options,this.host.compilerHost),this.checker=this.program.getTypeChecker(),this.stats.initializations+=1}validateIncrementalPaths(t,n,r,i=!1){if(!i&&t.length===0&&n.length===0)throw new Error("incremental TypeScript document update requires a modified or removed file");if(r.length===0&&n.length===0)throw new Error("incremental TypeScript document update requires an affected or removed file");for(let a of t){let o=ve(this.workspaceRoot,a);if(!this.program?.getSourceFile(o))throw new Error(`modified TypeScript dependency is unavailable to the configured project: ${a}`)}for(let a of n){let o=ve(this.workspaceRoot,a);if(this.program?.getSourceFile(o))throw new Error(`removed TypeScript source is still present in the configured project: ${a}`)}this.validateAffectedPaths(r)}validateAffectedPaths(t){for(let n of t){let r=ve(this.workspaceRoot,n);if(!this.includedFiles.has(Ie(r)))throw new Error(`affected TypeScript file is outside the configured project: ${n}`)}}emitAffectedFiles(t){return t.map(n=>{let r=this.program.getSourceFile(ve(this.workspaceRoot,n));if(!r)throw new Error(`affected TypeScript source is unavailable: ${n}`);return this.emitSourceFile(r)})}emitSourceFile(t){if(!this.checker)throw new Error("TypeScript document emitter is not initialized");let n=dt(Qi(this.workspaceRoot,t.fileName)),r=new this.runtime.Document({relative_path:n,occurrences:[]});if(new this.runtime.FileIndexer(this.checker,{cwd:this.workspaceRoot,projectRoot:this.projectRoot,projectDisplayName:this.projectRoot,maxFileByteSizeNumber:this.maxFileByteSize},new this.runtime.Input(t.fileName,t.getText()),r,this.symbolTable,this.constructorTable,this.packages,t).index(),this.stats.documentsEmitted+=1,r.occurrences.length===0)return this.fragments.delete(n),this.stats.documentsRemoved+=1,{relativePath:n,bytes:null,occurrences:0,symbols:r.symbols.length,referenceFragments:[]};let a=r.serializeBinary();return this.fragments.set(n,a),{relativePath:n,bytes:a,occurrences:r.occurrences.length,symbols:r.symbols.length,referenceFragments:Hc(n,r)}}result(t,n){return{producerIdentity:this.producerIdentity,fragments:t,durationMs:performance.now()-n,stats:this.snapshotStats()}}};function Hc(e,t){let n=new Map;for(let r of t.occurrences){if(!r.symbol||(r.symbol_roles&1)!==0||r.range.length<3)continue;let i=r.range[0],a=r.range[1];if(!Number.isInteger(i)||!Number.isInteger(a))continue;let o={targetSymbol:r.symbol,location:{file:e,line:i,column:a}};n.set(`${r.symbol}\0${i}\0${a}`,o)}return[...n.values()].sort((r,i)=>r.targetSymbol.localeCompare(i.targetSymbol)||r.location.line-i.location.line||r.location.column-i.location.column)}var gn=class{compilerHost;sourceFiles=new Map;constructor(t,n,r){let i=t.createCompilerHost(n),a=i.getSourceFile.bind(i);this.compilerHost={...i,getCurrentDirectory:()=>r,getSourceFile:(o,s,c,u)=>{let l=Ie(o);if(this.sourceFiles.has(l))return this.sourceFiles.get(l);let d=a(o,s,c,u);return this.sourceFiles.set(l,d),d}}}invalidate(t){this.sourceFiles.delete(Ie(t))}};function ln(e,t){let n=e.readConfigFile(t,e.sys.readFile);if(n.error)throw new Error(e.formatDiagnostics([n.error],e.createCompilerHost({})));let r=e.parseJsonConfigFileContent(n.config,e.sys,fn(t)),i=r.errors.filter(a=>a.code!==18003);if(i.length>0)throw new Error(e.formatDiagnostics(i,e.createCompilerHost({})));return r}function hn(e){return ta(e.packageVersion,e.typescript.version)}function ta(e,t){return`scip-typescript:${e}:typescript:${t}:document-adapter:${qc}`}function zc(e,t){return dt(Qi(e,t))||"."}function ve(e,t){if(Wc(t))throw new Error(`expected a project-relative path: ${t}`);let n=K(e,t),r=e.endsWith(dn)?e:`${e}${dn}`;if(n!==e&&!n.startsWith(r))throw new Error(`path escapes the project root: ${t}`);return n}function Pe(e){return[...new Set(e.map(dt))].sort()}function dt(e){return e.split(dn).join("/").replace(/^\.\//,"")}function Ie(e){return K(e)}function Yi(e,t){let n=0;for(let r of e.keys())if(Xc(r)){try{if(r.getSourceFile()!==t)continue}catch{continue}e.delete(r),n+=1}return n}function Xc(e){return!!(e&&typeof e=="object"&&"kind"in e&&"getSourceFile"in e)}import{createHash as Kc}from"crypto";import{dirname as Yc,join as na}from"path";var V=5,Qc=4,Zc=2,eu="typescript-index";function ra(e){let t=na(e,eu),n=Sr(t);return{...n,requestDir:n.legacyRequestDir}}function tu(e){let t=JSON.parse(e),n=t.protocolVersion,r=n===Zc,i=n===Qc,a=t.request,o=(r||i)&&a&&typeof a=="object"&&!Array.isArray(a)?{...a,removedFiles:a.removedFiles??[]}:a;if(!r&&!i&&n!==V||typeof t.id!="string"||!t.id||typeof t.baseGeneration!="string"||!t.baseGeneration||typeof t.deadlineAtMs!="number"||!Number.isFinite(t.deadlineAtMs)||!nu(o)||!r&&(t.mailboxVersion!==_e||typeof t.operationKey!="string"||!/^[a-f0-9]{64}$/.test(t.operationKey)||t.id!==ze(t.operationKey)||typeof t.clientId!="string"||!t.clientId||typeof t.enqueuedAtMs!="number"||!Number.isFinite(t.enqueuedAtMs)||t.deadlineAtMs<t.enqueuedAtMs))throw new Error("TypeScript index service received an invalid mailbox request.");if(!r){let c=t,u=De(i?"typescript-index-v4":"typescript-index-v5",{baseGeneration:c.baseGeneration,request:a});if(c.operationKey!==u)throw new Error("TypeScript index service received a mismatched mailbox operation identity.");return{...c,protocolVersion:V,request:o}}let s=De("typescript-index-v2",{id:t.id,baseGeneration:t.baseGeneration,request:a});return{protocolVersion:V,mailboxVersion:_e,id:t.id,operationKey:s,clientId:"legacy-v2",enqueuedAtMs:t.deadlineAtMs,deadlineAtMs:t.deadlineAtMs,baseGeneration:t.baseGeneration,request:o}}function ia(e){try{let t=Yn(Q(B(na(Yc(e),"meta.json"),"reindex metadata")));return t?Kc("sha256").update(t).digest("hex"):null}catch{return null}}function nu(e){if(!e||typeof e!="object")return!1;let t=e,n=yn(t.modifiedFiles)?t.modifiedFiles:null,r=yn(t.removedFiles)?t.removedFiles:null,i=yn(t.affectedFiles)?t.affectedFiles:null;return t.kind==="emit-documents"&&typeof t.tsconfigPath=="string"&&!!t.tsconfigPath&&typeof t.projectArgument=="string"&&!!t.projectArgument&&typeof t.projectIdentity=="string"&&!!t.projectIdentity&&typeof t.producerIdentity=="string"&&!!t.producerIdentity&&n!==null&&new Set(n).size===n.length&&r!==null&&new Set(r).size===r.length&&i!==null&&(i.length>0||r.length>0)&&new Set(i).size===i.length}function yn(e){return Array.isArray(e)&&e.every(t=>typeof t=="string"&&t.length>0)}import{randomUUID as ou}from"crypto";import{existsSync as su,rmSync as cu}from"fs";import{randomUUID as ru}from"crypto";import{getHeapStatistics as iu}from"v8";import{resolve as au}from"path";var pt=class{projectRoot;currentGeneration;createEmitter;wallNow;monotonicNow;maxActiveSessions;softMemoryLimitBytes;memoryUsage;active=new Map;requests=0;sessionsCreated=0;sessionsReplaced=0;sessionsEvicted=0;lastRequestAtMs=null;lastDurationMs=null;lastError=null;unavailable=!1;constructor(t){if(this.projectRoot=au(t.projectRoot),this.currentGeneration=t.currentGeneration,this.createEmitter=t.createEmitter??ea,this.wallNow=t.wallNow??t.now??Date.now,this.monotonicNow=t.monotonicNow??t.now??P,t.maxActiveSessions!==void 0&&(!Number.isInteger(t.maxActiveSessions)||t.maxActiveSessions<1))throw new Error("TypeScript index maxActiveSessions must be a positive integer.");if(this.maxActiveSessions=t.maxActiveSessions??8,t.softMemoryLimitMb!==void 0&&(!Number.isInteger(t.softMemoryLimitMb)||t.softMemoryLimitMb<1))throw new Error("TypeScript index softMemoryLimitMb must be a positive integer.");this.softMemoryLimitBytes=t.softMemoryLimitMb===void 0?null:t.softMemoryLimitMb*1024*1024,this.memoryUsage=t.memoryUsage??(()=>({heapUsedBytes:process.memoryUsage().heapUsed,heapLimitBytes:iu().heap_size_limit}))}handle(t,n){let r=this.monotonicNow();try{if(this.currentGeneration()!==t)throw new Error("TypeScript index request does not match the currently published generation.");let i=this.emitterFor(n);if(i.emitter.producerIdentity!==n.producerIdentity)throw new Error("TypeScript index producer identity changed.");let a=i.emitter.snapshotStats(),o=i.emitter.advance({modifiedFiles:n.modifiedFiles,removedFiles:n.removedFiles,affectedFiles:n.affectedFiles}),s=this.monotonicNow()-r;return this.requests+=1,this.lastRequestAtMs=this.wallNow(),this.lastDurationMs=s,this.lastError=null,this.unavailable=!1,{producerIdentity:o.producerIdentity,cold:o.stats.initializations>a.initializations,durationMs:s,fragments:o.fragments.map(c=>({relativePath:c.relativePath,bytesBase64:c.bytes===null?null:Buffer.from(c.bytes).toString("base64"),occurrences:c.occurrences,symbols:c.symbols,referenceFragments:c.referenceFragments}))}}catch(i){throw this.lastError=i instanceof Error?i.message:String(i),i}}status(t){let n=[...this.active.values()].map(o=>o.emitter.snapshotStats()),r=o=>n.reduce((s,c)=>s+c[o],0),i=this.memoryUsage(),a=this.softMemoryLimitBytes!==null&&i.heapUsedBytes>=this.softMemoryLimitBytes;return{protocolVersion:V,state:this.unavailable?"unavailable":this.lastError?"error":this.active.size>0?"ready":"idle",requests:this.requests,sessionsCreated:this.sessionsCreated,sessionsReplaced:this.sessionsReplaced,sessionsEvicted:this.sessionsEvicted,activeSessions:this.active.size,maxActiveSessions:this.maxActiveSessions,heapUsedBytes:i.heapUsedBytes,heapLimitBytes:i.heapLimitBytes,...this.softMemoryLimitBytes===null?{}:{softMemoryLimitBytes:this.softMemoryLimitBytes},retireRequested:a,initializations:r("initializations"),programUpdates:r("programUpdates"),documentsEmitted:r("documentsEmitted"),documentsRemoved:r("documentsRemoved"),...this.lastRequestAtMs===null?{}:{lastRequestAt:new Date(this.lastRequestAtMs).toISOString()},...this.lastDurationMs===null?{}:{lastDurationMs:this.lastDurationMs},...this.lastError?{lastError:this.lastError}:{},...t?{mailbox:t}:{}}}close(){this.active.clear()}emitterFor(t){let n=`${t.tsconfigPath}\0${t.projectArgument}`,r=this.active.get(n);if(r?.projectIdentity===t.projectIdentity)return this.active.delete(n),this.active.set(n,r),r;if(r)this.active.delete(n);else if(this.active.size>=this.maxActiveSessions){let o=this.active.keys().next().value;o!==void 0&&(this.active.delete(o),this.sessionsEvicted+=1)}let i=this.createEmitter({workspaceRoot:this.projectRoot,tsconfigPath:t.tsconfigPath,projectRoot:t.projectArgument});if(!i.available)throw this.unavailable=!0,new Error(i.reason);r&&(this.sessionsReplaced+=1);let a={projectIdentity:t.projectIdentity,emitter:i.emitter};return this.active.set(n,a),this.sessionsCreated+=1,a}};var zg=`typescript-index-${process.pid}-${ru()}`,aa=q(process.pid),Xg={pid:process.pid,...aa?{processIdentity:aa}:{}};var uu=12e4,lu=5,Ce=class extends Error{name="TypeScriptIndexMemoryPressureError"},gt=class{projectRoot;cacheDir;baseGeneration;timeoutMs;runtime;mailboxLimits;emitLocally;requireService;localHost=null;constructor(t,n={}){this.projectRoot=Gn(t.projectRoot),this.cacheDir=t.cacheDir,this.baseGeneration=t.baseGeneration,this.timeoutMs=n.timeoutMs??mu(),this.runtime=n.runtime??hu,this.mailboxLimits=n.mailboxLimits??{},this.emitLocally=n.emitLocally,this.requireService=n.requireService===!0}request(t){let n=vr(this.cacheDir),r=ra(this.cacheDir),i=Mt(n.statePath);if(!oa(i,this.projectRoot,this.runtime))return this.requestLocally(t);let a=this.runtime.now(),o=a+this.timeoutMs,s=(this.runtime.monotonicNow??P)()+this.timeoutMs,c=De("typescript-index-v5",{baseGeneration:this.baseGeneration,request:t}),u=ze(c),l=Rr(r,{mailboxVersion:_e,operationKey:c,clientId:this.runtime.randomId(),enqueuedAtMs:a,deadlineAtMs:o,protocolVersion:V,id:u,baseGeneration:this.baseGeneration,request:t},{nowMs:a,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??P)()<=s;){if(su(l.responsePath))try{return du(N(l.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript index mailbox response"}),u,c,this.baseGeneration,t.producerIdentity,t.affectedFiles)}finally{cu(l.responsePath,{force:!0})}let d=Mt(n.statePath);if(!oa(d,this.projectRoot,this.runtime))return this.requestLocally(t);this.runtime.sleep(lu)}return this.requestLocally(t)}requestLocally(t){if(this.requireService)throw new Error("TypeScript incremental index service unavailable; refusing to load the whole compiler graph inside the reindex process");return this.emitLocally?bn(this.emitLocally(t),t.producerIdentity,t.affectedFiles):(this.localHost??=new pt({projectRoot:this.projectRoot,currentGeneration:()=>this.baseGeneration}),bn(sa(this.localHost.handle(this.baseGeneration,t),t.producerIdentity),t.producerIdentity,t.affectedFiles))}};function oa(e,t,n){let r=e?.processIdentity?n.readProcessIdentity?.(e.pid):null,i=e?Date.parse(e.heartbeatAt):Number.NaN;return e!==null&&e.projectRoot===t&&e.typescriptIndex?.protocolVersion===V&&n.isProcessAlive(e.pid)&&Number.isFinite(i)&&n.now()-i<=xr&&(!e.processIdentity||r!=null&&Ae(e.processIdentity,r))}function du(e,t,n,r,i,a){let o=JSON.parse(e);if(o.protocolVersion!==V||o.id!==t||o.operationKey!==n||o.ok===!0&&o.baseGeneration!==r)throw new Error("TypeScript index service wrote an incompatible response.");if(o.ok!==!0){let s=typeof o.error=="string"?o.error:"TypeScript index service request failed.";throw pu(s)?new Ce(s):new Error(s)}return bn(sa(o.response,i),i,a)}function pu(e){let t=e.toLowerCase();return t.includes("out of memory")||t.includes("memory limit")||t.includes("allocation failed")||t.includes("err_worker_out_of_memory")}function bn(e,t,n){if(e.producerIdentity!==t)throw new Error("TypeScript index service wrote an invalid response.");let r=[...new Set(n)].sort(),i=e.fragments.map(a=>a.relativePath).sort();if(JSON.stringify(i)!==JSON.stringify(r))throw new Error("TypeScript index service omitted or added an affected document.");return e}function sa(e,t){if(!e||typeof e!="object")throw new Error("TypeScript index service wrote an invalid response.");let n=e;if(n.producerIdentity!==t||typeof n.cold!="boolean"||typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)||!Array.isArray(n.fragments))throw new Error("TypeScript index service wrote an invalid response.");let r=new Set,i=n.fragments.map(a=>{if(!a||typeof a.relativePath!="string"||a.bytesBase64!==null&&typeof a.bytesBase64!="string"||typeof a.occurrences!="number"||!Number.isInteger(a.occurrences)||a.occurrences<0||typeof a.symbols!="number"||!Number.isInteger(a.symbols)||a.symbols<0||!Array.isArray(a.referenceFragments)||!a.referenceFragments.every(gu)||r.has(a.relativePath))throw new Error("TypeScript index service wrote an invalid fragment.");r.add(a.relativePath);let o=a.bytesBase64===null?null:fu(a.bytesBase64);return{relativePath:a.relativePath,bytes:o,occurrences:a.occurrences,symbols:a.symbols,referenceFragments:a.referenceFragments}});return{producerIdentity:n.producerIdentity,cold:n.cold,durationMs:n.durationMs,fragments:i}}function gu(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.targetSymbol=="string"&&!!t.location&&typeof t.location.file=="string"&&Number.isInteger(t.location.line)&&Number.isInteger(t.location.column)}function fu(e){let t=Buffer.from(e,"base64");if(t.toString("base64")!==e)throw new Error("TypeScript index service wrote invalid base64.");return t}function mu(){let e=Number(process.env.SCIP_TYPESCRIPT_INDEX_TIMEOUT_MS);return Number.isInteger(e)&&e>0?e:uu}var hu={now:Date.now,monotonicNow:P,randomId:ou,sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)},isProcessAlive:ye,readProcessIdentity:q};var bu=128,Su=256;function Ru(e){let t=e.projectMode==="workspace"?e.workspaceProjects??[]:["."],n=pe(t);if(t.length===0)return{eligible:!1,reason:"workspace project roots unavailable"};if(t.length===1&&t[0]==="."&&!e.rootTsconfigExists)return{eligible:!1,reason:"root tsconfig unavailable"};if(!e.previousSnapshot)return{eligible:!1,reason:"prior project snapshot unavailable"};if(e.graph===null)return{eligible:!1,reason:"dependency graph unavailable"};if(e.projectFiles.length===0)return{eligible:!1,reason:"prior TypeScript documents unavailable"};let r=Te(e.previousSnapshot,e.currentSnapshot);if(r.changes.length===0)return{eligible:!1,reason:"no changed project inputs"};let i=r.changes.filter(m=>m.inputKind==="source"&&be(m.path)),a=pa(r,n),o={...r,changes:a},s=i.filter(m=>m.kind==="added").map(m=>m.path),c=i.filter(m=>m.kind==="deleted").map(m=>m.path),u=i.filter(m=>m.kind==="modified"),l=mt(e.currentSnapshot,e.producerIdentity,n),d=mt(e.previousSnapshot,e.producerIdentity,n),p=ga(r,a,l,d),g=!p&&ma(r);if(i.length===0&&!p)return{eligible:!1,reason:"change does not affect the configured TypeScript project"};let f=e.currentSnapshot.files.filter(m=>$e(m.path,e.currentSnapshot.languages)==="source"&&be(m.path)).map(m=>m.path).sort(),h=new Set(f),v=p?e.projectFiles.filter(m=>!h.has(m)).sort():[...c].sort(),w=p?o:{...r,changes:i},k=p?{eligible:!0,plan:{...je(o,e.graph,[...new Set([...f,...v])]),mode:"full-project"}}:vu(u,s,v,e.graph,e.projectFiles);if(!k.eligible)return k;let T=k.plan,D=new Set(v),b=Pu(T,t,e.graph,D);if(!b)return{eligible:!1,reason:"affected files cross or ambiguously match TypeScript projects"};let y=b.length===1?b[0]:void 0;return{eligible:!0,manifest:w,plan:T,projectIdentity:l,previousFragmentGeneration:la(e.previousSnapshot,e.producerIdentity),nextFragmentGeneration:la(e.currentSnapshot,e.producerIdentity),projects:b,deletedFiles:v,replaceProject:p,dependencyGraphUnchanged:g,...y?{tsconfigPath:y.tsconfigPath,projectArgument:y.projectArgument}:{}}}function pa(e,t){return e.changes.filter(n=>n.inputKind==="source"&&be(n.path)||n.inputKind==="config"&&(!ge(n.path)||t.has(n.path))&&xu(n)||n.inputKind==="ambient")}function xu(e){return e.kind!=="modified"||e.before.semanticHash===void 0||e.after.semanticHash===void 0||e.before.semanticHash!==e.after.semanticHash}function ga(e,t,n,r){return n!==r||e.projectIdentityChanged||e.uncertainty.length>0||t.length>Su||t.some(i=>i.inputKind==="config"||i.inputKind==="ambient")}function vu(e,t,n,r,i){if(e.length===0)return t.length===0&&n.length===0?{eligible:!1,reason:"empty affected set"}:{eligible:!0,plan:{mode:"closure",changedFiles:[...new Set([...t,...n])].sort(),affectedFiles:[...new Set([...t,...ca(n,r,i)])].sort(),reasons:[]}};let a=je({version:1,changes:e.filter(fa),projectIdentityChanged:!1,uncertainty:[]},r,i);return a.mode==="full-project"?{eligible:!1,reason:a.reasons.length>0?`affected set widened: ${a.reasons.join(", ")}`:"empty affected set"}:{eligible:!0,plan:{mode:"closure",changedFiles:[...new Set([...e.map(o=>o.path),...t,...n])].sort(),affectedFiles:[...new Set([...a.affectedFiles,...e.map(o=>o.path),...t,...ca(n,r,i)])].sort(),reasons:[]}}}function fa(e){return e.kind!=="modified"?!0:e.before.semanticHash===void 0||e.after.semanticHash===void 0||e.before.semanticHash!==e.after.semanticHash}function ma(e){let t=e.changes.filter(n=>n.inputKind==="source"&&be(n.path));return t.length>0&&t.every(n=>n.kind==="modified"&&!fa(n))}function Pu(e,t,n,r){let i=new Map;for(let o of e.affectedFiles){let s=Iu(o,t);if(!s)return null;let c=i.get(s)??[];c.push(o),i.set(s,c)}let a=[];for(let[o,s]of[...i].sort(([c],[u])=>c.localeCompare(u))){let c=new Set(s),u=e.changedFiles.filter(p=>!r.has(p)&&(c.has(p)||s.some(g=>ua(g,p,n)))),l=e.changedFiles.filter(p=>r.has(p)&&(c.has(p)||s.some(g=>ua(g,p,n)))),d=s.filter(p=>!r.has(p));if(u.length===0&&l.length===0&&d.length===0)return null;a.push({projectArgument:o,tsconfigPath:o==="."?"tsconfig.json":`${o}/tsconfig.json`,modifiedFiles:u,removedFiles:l,affectedFiles:[...d].sort()})}return a}function ca(e,t,n){let r=new Set(n),i=new Map;for(let[s,c]of t)if(r.has(s))for(let u of c){let l=i.get(u)??new Set;l.add(s),i.set(u,l)}let a=new Set(e),o=[...e];for(let s=0;s<o.length;s+=1){let c=o[s];if(c)for(let u of i.get(c)??[])a.has(u)||(a.add(u),o.push(u))}return[...a].sort()}function Iu(e,t){let n=t.filter(a=>a==="."||e===a||e.startsWith(`${a}/`));if(n.length===0)return null;let r=[...new Set(n)].sort((a,o)=>ft(o)-ft(a)||a.localeCompare(o)),i=r[0];return r[1]&&ft(r[1])===ft(i)?null:i}function ft(e){return e==="."?0:e.split("/").filter(Boolean).length}function ua(e,t,n){let r=new Set,i=[e];for(let a=0;a<i.length;a+=1){let o=i[a];if(!(!o||r.has(o))){r.add(o);for(let s of n.get(o)??[]){if(s===t)return!0;r.has(s)||i.push(s)}}}return!1}function ha(e){let t=P();try{if(!Sn(e.previousDbPath)||!Sn(e.previousShardPath))throw new Error("prior TypeScript graph or language shard unavailable");let n=performance.now(),r=mn();if(!r.available)throw new Error(r.reason);let i=performance.now()-n;n=performance.now();let a=new $({projectRoot:e.projectRoot,dbPath:e.previousDbPath,indexPath:e.previousIndexPath}),o=ku(e.projectRoot,e.previousSnapshot,e.currentSnapshot),s=e.projectMode==="workspace"?Y(e.projectRoot,e.currentSnapshot.typescriptProjects):["."],c=pe(s),u,l,d;try{u=qe(a,{includeIgnored:!1}).filter(be).sort();let I=o?Te(o,e.currentSnapshot):null,E=I&&o&&ga(I,pa(I,c),mt(e.currentSnapshot,r.producerIdentity,c),mt(o,r.producerIdentity,c)),M=I!==null&&!E&&ma(I);E?(d=or(a,"none")??void 0,l=new Map):M?l=new Map:(d=Je(a),l=d.graph)}finally{a.close()}let p=performance.now()-n,g=Ru({projectMode:e.projectMode,workspaceProjects:e.projectMode==="workspace"?s:void 0,previousSnapshot:o,currentSnapshot:e.currentSnapshot,projectFiles:u,graph:l,producerIdentity:r.producerIdentity,rootTsconfigExists:Sn(yu(e.projectRoot,"tsconfig.json"))});if(!g.eligible)throw new Error(g.reason);let f=ia(e.previousDbPath);if(!f)throw new Error("published TypeScript base generation unavailable");n=performance.now();let h=new gt({projectRoot:e.projectRoot,cacheDir:e.cacheDir,baseGeneration:f},{requireService:!0}),v=g.projects.flatMap(I=>{let E=wu(I.affectedFiles,bu);return(E.length>0?E:[[]]).map((Et,ue)=>({project:I,affectedFiles:Et,removedFiles:ue===0?I.removedFiles:[],firstForProject:ue===0}))}),w=[],k=new Map,T=[],D=!1,b=0,y=0,m=0,A=g.previousFragmentGeneration;for(let[I,E]of v.entries()){let M=h.request({kind:"emit-documents",tsconfigPath:E.project.tsconfigPath,projectArgument:E.project.projectArgument,projectIdentity:g.projectIdentity,producerIdentity:r.producerIdentity,modifiedFiles:E.firstForProject?E.project.modifiedFiles:[],removedFiles:E.firstForProject?E.project.removedFiles:[],affectedFiles:E.affectedFiles});D||=M.cold,T.push(M.durationMs);let Et=E.removedFiles.map(Be=>({relativePath:Be,bytes:null,occurrences:0,symbols:0,referenceFragments:[]})),ue=[...M.fragments,...Et];if(!g.replaceProject)for(let Be of ue)k.set(Be.relativePath,Be.referenceFragments);let Eo=performance.now(),To=Dr(M.fragments);b+=performance.now()-Eo;let Mn=I===0?e.candidateAffectedScipPath:`${e.candidateAffectedScipPath}.batch-${I}.scip`,Fo=performance.now();da(Mn,To),m+=performance.now()-Fo;let Ao=performance.now(),Nn=I===v.length-1?g.nextFragmentGeneration:Eu({previousGenerationIdentity:A,targetGenerationIdentity:g.nextFragmentGeneration,fragments:ue});Or({cacheDir:e.cacheDir,previousGenerationIdentity:A,nextGenerationIdentity:Nn,producerIdentity:r.producerIdentity,projectIdentity:g.projectIdentity,baseShardCurrent:I===0?e.baseShardCurrent:!1,fragments:ue,allowProjectIdentityChange:g.replaceProject&&I===0,allowLegacyProjectIdentityMigration:!0}),y+=performance.now()-Ao,A=Nn,w.push({scipPath:Mn,affectedFiles:[...E.affectedFiles,...E.removedFiles].sort(),deletedFiles:[...E.removedFiles].sort()})}let L=performance.now()-n,S={scipPath:e.previousShardPath,candidateScipPath:e.candidateShardPath,affectedScipPath:e.candidateAffectedScipPath,affectedBatches:w,completeScipUpdated:!1,durationMs:P()-t,cold:D,changedFiles:g.plan.changedFiles,affectedFiles:g.plan.affectedFiles,deletedFiles:g.deletedFiles,producerIdentity:r.producerIdentity,previousFragmentGeneration:g.previousFragmentGeneration,nextFragmentGeneration:g.nextFragmentGeneration,manifest:g.manifest,plan:g.plan,projectFileCount:u.length,dependencyGraphSnapshot:d,dependencyGraphUnchanged:g.dependencyGraphUnchanged,referenceFragmentsByFile:k,timings:{runtimeMs:i,graphMs:p,requestMs:L,serviceMs:T.reduce((I,E)=>I+E,0),assemblyMs:b,fragmentStoreMs:y,writeMs:m}};return e.onStatus(`${g.replaceProject?"Bounded TypeScript project refresh":"Incremental TypeScript index"} emitted ${S.affectedFiles.length-S.deletedFiles.length} document(s), removed ${S.deletedFiles.length}, and produced ${w.length} bounded batch(es) across ${g.projects.length} project(s) in ${(S.durationMs/1e3).toFixed(3)}s (${S.cold?"cold":"warm"} service; whole SCIP deferred; runtime ${i.toFixed(0)}ms, graph ${p.toFixed(0)}ms, request ${L.toFixed(0)}ms, assembly ${b.toFixed(0)}ms, fragments ${y.toFixed(0)}ms, write ${m.toFixed(0)}ms).`),S}catch(n){let r=n instanceof Error?n.message:String(n);if(e.onUnavailable?.(r),n instanceof Ce)throw e.onStatus(`Incremental TypeScript index stopped after memory pressure survived one cold Worker retry: ${r}. Preserving the accepted index instead of starting a memory-heavier whole-project rebuild.`),n;return e.onStatus(`Incremental TypeScript index unavailable: ${r}.`),null}}function wu(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function ku(e,t,n){if(!t)return null;let r=new Map(n.files.map(o=>[o.path,o])),i=!1,a=t.files.map(o=>{let s=r.get(o.path);if(o.semanticHash!==void 0||s?.semanticHash===void 0)return o;let c=Ge(e,o.path,o.hash);return c===void 0?o:(i=!0,{...o,semanticHash:c})});return i?{...t,files:a}:t}function Eu(e){let t=Rn("sha256");t.update("typescript-overlay-batch-v1\0"),t.update(e.previousGenerationIdentity),t.update("\0"),t.update(e.targetGenerationIdentity);for(let n of[...e.fragments].sort((r,i)=>r.relativePath.localeCompare(i.relativePath)))t.update("\0path\0"),t.update(n.relativePath),n.bytes===null?t.update("\0deleted"):(t.update("\0bytes\0"),t.update(Rn("sha256").update(n.bytes).digest()));return t.digest("hex")}function xn(e){let t=mn();if(!t.available)throw new Error(t.reason);let n=jr({cacheDir:e.cacheDir,generationIdentity:e.generationIdentity,baseIndexBytes:de(e.baseShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:Vn}),packageVersion:t.packageVersion});da(e.candidateShardPath,n)}function mt(e,t,n){let r=e.files.filter(i=>{let a=$e(i.path,e.languages);return a==="ambient"||a==="config"&&(!ge(i.path)||n.has(i.path))}).map(i=>{let o=$e(i.path,e.languages)==="config"?i.semanticHash:void 0;return{path:i.path,size:o===void 0?i.size:0,hash:o??i.hash}}).sort((i,a)=>i.path.localeCompare(a.path));return`typescript-project-v3:${ya(JSON.stringify({version:3,producerIdentity:t,pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:[...e.typescriptProjects].sort(),nonSourceInputs:r}))}`}function la(e,t){return ya(JSON.stringify({version:1,producerIdentity:t,snapshot:$n(e)}))}function ya(e){return Rn("sha256").update(e).digest("hex")}import{closeSync as Tu,existsSync as ht,fstatSync as Fu,lstatSync as Au,openSync as _u,renameSync as In,rmSync as yt,statSync as Du,writeSync as Lu}from"fs";import{cpus as Ou}from"os";import{join as wn}from"path";var vn=Symbol("no-error");async function ba(e,t,n){if(e.length===0)return[];let r=new Array(e.length),i=Number.isFinite(t)?Math.max(1,Math.floor(t)):1,a=Math.min(e.length,i),o=0,s=vn,c=!0,u=Array.from({length:a},async()=>{for(;c&&o<e.length;){let l=o++;try{r[l]=await n(e[l])}catch(d){s===vn&&(s=d),c=!1}}});if(await Promise.all(u),s!==vn)throw s;return r}var Sa=8*1024;function ju(e,t){if(e.temporaryRootConfigContent===void 0)return null;let n=wn(t,"tsconfig.json"),r=Buffer.from(e.temporaryRootConfigContent,"utf8"),i;try{i=_u(n,"wx",384)}catch(a){if(a.code==="EEXIST")return null;throw a}try{Lu(i,r);let a=Fu(i);return{path:n,content:r,device:a.dev,inode:a.ino}}finally{Tu(i)}}function Cu(e){if(e)try{let t=Au(e.path);if(!t.isFile()||t.dev!==e.device||t.ino!==e.inode||t.size!==e.content.byteLength)return;let n;try{n=de(e.path,{maxBytes:e.content.byteLength,inputKind:"temporary TypeScript index configuration"})}catch{return}if(!n.equals(e.content))return;yt(e.path)}catch(t){if(t.code!=="ENOENT")throw t}}function Mu(e,t,n){if(!e.defaultOutputPath)return;let r=wn(t,e.defaultOutputPath);n!==r&&ht(r)&&In(r,n)}function Nu(e,t,n){if(!e.defaultOutputPath)return null;let r=wn(t,e.defaultOutputPath);if(r===n)return null;let i=`${n}.default-output-backup`;return yt(i,{force:!0}),ht(r)?(In(r,i),{defaultOutputPath:r,backupPath:i}):{defaultOutputPath:r,backupPath:null}}function Bu(e){e&&(yt(e.defaultOutputPath,{force:!0}),e.backupPath&&ht(e.backupPath)&&In(e.backupPath,e.defaultOutputPath))}function $u(e,t){if(e<=1)return 1;let n=Number(process.env.SCIP_QUERY_INDEXER_CONCURRENCY??0),r=Number.isFinite(t)&&t&&t>0?t:Number.isFinite(n)&&n>0?n:Math.min(8,Math.max(1,Ou().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function xa(e,t,n,r,i){C(i,"Reindex cancelled by its owner.");let a=e.filter(l=>l.config.defaultOutputPath),o=e.filter(l=>!l.config.defaultOutputPath),s=[],c=$u(o.length,r),u=await ba(o,c,l=>Pn(l,t,n,i));if(c>1){let l=new Map;for(let d of u.filter(p=>p.result.skipped&&p.retryable)){let p=o.find(g=>g.id===d.result.id);p&&(n(`Retrying ${p.label} indexer serially after parallel failure...`),C(i,"Reindex cancelled by its owner."),l.set(p.id,(await Pn(p,t,n,i)).result))}s.push(...u.map(({result:d})=>l.get(d.id)??d))}else s.push(...u.map(({result:l})=>l));for(let l of a)C(i,"Reindex cancelled by its owner."),s.push((await Pn(l,t,n,i)).result);return s.sort((l,d)=>e.findIndex(p=>p.id===l.id)-e.findIndex(p=>p.id===d.id))}async function Pn(e,t,n,r){C(r,"Reindex cancelled by its owner."),n(`Indexing ${e.label} with ${e.resolvedBinary}...`),yt(e.scipPath,{force:!0});let i=Nu(e.config,t,e.scipPath),a=ju(e,t),o=[e.binary,...e.args].join(" "),s=P();try{e.trustedProjectTool&&fr(t,e.trustedProjectTool);let u=ur(e.binary,e.args),l=await et({command:u.binary,args:u.args,label:`${e.label} indexer`,cwd:t,env:e.env,timeoutMs:Vu(),maxStdoutBytes:50*1024*1024,maxStderrBytes:50*1024*1024,signal:r});if(l.status!==0){let d=l.stderr.trim();throw new Error(`${e.resolvedBinary} exited with status ${l.status}${d?`:
260
- ${d}`:""}`)}Mu(e.config,t,e.scipPath)}catch(u){if(r?.aborted)throw Tr(r,"Reindex cancelled by its owner.");let l=u instanceof Error?u.message:String(u),d=l.length<=Sa?l:`${l.slice(0,Sa)}
261
- [indexer failure detail truncated]`,p=`${e.resolvedBinary} indexer failed: ${d}`,g=e.label===e.language?p:`${e.label}: ${p}`;return n(`Skipping ${e.label}: ${p}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:P()-s,command:o,skipped:{language:e.language,reason:g}},retryable:Uu(u)}}finally{Bu(i),Cu(a)}if(!ht(e.scipPath)){let u=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`,l=e.label===e.language?u:`${e.label}: ${u}`;return n(`Skipping ${e.label}: ${u}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:P()-s,command:o,skipped:{language:e.language,reason:l}},retryable:!1}}let c;try{c=Du(e.scipPath).size}catch{c=void 0}return{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:P()-s,command:o,outputBytes:c},retryable:!1}}function Vu(){let e=Number(process.env.SCIP_QUERY_INDEXER_TIMEOUT_MS);return Number.isFinite(e)&&e>0?Math.floor(e):zr.indexer}function Uu(e){return e instanceof Xr?e.kind==="spawn"&&Ra(e.cause):Ra(e)}function Ra(e){let t=e?.code;return t==="EAGAIN"||t==="ENOMEM"||t==="EMFILE"||t==="ENFILE"||t==="ETXTBSY"}import{execFileSync as Pa}from"child_process";import{homedir as va,platform as Gu}from"os";import{delimiter as Wu,join as bt}from"path";function Ia(e,t){let n=e.installMethods,r=He(e);if(!n?.length)return t(`No auto-install method available for ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1;for(let i of n){if(!i.identity||!i.destination){t(`Refusing ${i.label} installation for ${r}: the installer descriptor lacks an immutable identity or destination.`);continue}if(!me(i.prerequisite))continue;let a=qu(i);t(`Installing immutable ${i.identity} via ${i.label} into ${a}; expected executable: ${r}.`);try{Pa(i.binary,i.args,{stdio:"inherit",timeout:3e5,env:process.env,shell:Gu()==="win32"});let o=Fe(e);if(o){let s=o===e.indexerBinary?"":` (using ${o})`;return t(`Successfully installed ${i.identity} via ${i.label}${s}; resolved executable: ${o}.`),!0}t(`${i.label} command completed but ${r} was not found on PATH`)}catch(o){let s=o instanceof Error?o.message:String(o);t(`${i.label} install failed: ${s}`)}}return t(`Could not auto-install ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1}function qu(e){if(e.binary==="npm")return kn("npm",["root","-g"])??e.destination;if(e.binary==="go"){let t=kn("go",["env","GOBIN"]);if(t)return t;let n=kn("go",["env","GOPATH"]);if(n)return bt(n.split(Wu)[0],"bin")}return e.binary==="dotnet"?bt(process.env.DOTNET_CLI_HOME??va(),".dotnet","tools"):e.binary==="dart"?bt(process.env.PUB_CACHE??bt(va(),".pub-cache"),"bin"):e.destination}function kn(e,t){try{return Pa(e,t,{stdio:["ignore","pipe","ignore"],encoding:"utf8",timeout:1e4,killSignal:"SIGKILL",env:process.env}).trim()||null}catch{return null}}import Nl from"better-sqlite3";import{existsSync as Bl}from"fs";import{dirname as $l,join as Vl,resolve as Ul}from"path";import{randomUUID as Hu}from"crypto";import{mkdtempSync as zu,rmSync as Xu,statSync as ka}from"fs";import{tmpdir as Ku}from"os";import{join as Ea}from"path";import{Worker as Yu}from"worker_threads";function Ju(){return{"missing-source-file":0,"missing-service-script":0,"no-definition":0,"same-file-definition":0,"unindexed-definition":0}}function we(){return{skippedReferences:0,skippedReferenceReasons:Ju(),skippedReferenceSamples:[]}}function St(e,t){e.skippedReferences+=t.skippedReferences;for(let n of Object.keys(e.skippedReferenceReasons)){e.skippedReferenceReasons[n]+=t.skippedReferenceReasons[n];for(let r of t.skippedReferenceSamples.filter(i=>i.reason===n))e.skippedReferenceSamples.filter(a=>a.reason===n&&a.sourceFile===r.sourceFile).length<2&&e.skippedReferenceSamples.push(r)}}var Qu=3e5,Ta=64*1024*1024,Zu={createResultDirectory:()=>zu(Ea(Ku(),"scip-query-vue-workers-")),spawn:(e,t)=>new Yu(e,{workerData:t}),resultSize:e=>ka(e).size,readResult:e=>N(e,{maxBytes:Ta,inputKind:"Vue worker result"}),removeResultDirectory:e=>Xu(e,{recursive:!0,force:!0})};function Fa(e){return e.length>=8&&_a(e.length)>1}async function Aa(e,t=Zu){let n=_a(e.vueFiles.length),r=pl(e.vueFiles),i=fl(r,n),a=new URL("./augment-vue-worker.js",import.meta.url),o=e.timeoutMs??ll(),s=e.maxResultBytes??dl();wa("timeoutMs",o),wa("maxResultBytes",s);let c=Hu(),u=t.createResultDirectory(),l=[],d,p,g;try{for(let h=0;h<i.length;h++){let v=h,w=i[h]??[],k=w.map(b=>b.taskId),T=Ea(u,`${v}.json`),D=t.spawn(a,{projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,tasks:w,resultPath:T,runId:c,workerId:v,taskIds:k});l.push({workerId:v,taskIds:k,resultPath:T,handle:D,completion:el(D,v)})}await tl(l,o);let f=l.sort((h,v)=>h.workerId-v.workerId).map(h=>rl(h,c,s,t));g={occurrences:f.flatMap(h=>h.occurrences),...we()};for(let h of f)St(g,h)}catch(f){d=f}finally{let f=await nl(l);if(f.length===0)try{t.removeResultDirectory(u)}catch(h){f.push(h)}if(f.length>0){let h=d===void 0?f:[d,...f];p=new AggregateError(h,`Vue worker cleanup failed: ${ul(h[0])}`)}}if(p)throw p;if(d!==void 0)throw d;if(!g)throw new Error("Vue workers completed without producing a merged result.");return g}function el(e,t){return new Promise((n,r)=>{let i=!1,a=c=>{i||(i=!0,e.off("error",o),e.off("exit",s),c?r(c):n())},o=c=>{a(new Error(`Vue reference worker ${t} failed: ${c.message}`,{cause:c}))},s=c=>{a(c===0?void 0:new Error(`Vue reference worker ${t} exited with code ${c}`))};e.once("error",o),e.once("exit",s)})}async function tl(e,t){let n;try{await Promise.race([Promise.all(e.map(r=>r.completion)),new Promise((r,i)=>{n=setTimeout(()=>i(new Error(`Vue reference workers timed out after ${(t/1e3).toFixed(3)}s`)),t),n.unref()})])}finally{n&&clearTimeout(n)}}async function nl(e){return(await Promise.allSettled(e.map(async n=>n.handle.terminate()))).flatMap(n=>n.status==="rejected"?[n.reason]:[])}function rl(e,t,n,r){let i=r.resultSize(e.resultPath);if(!Number.isSafeInteger(i)||i<0||i>n)throw new Error(`Vue reference worker ${e.workerId} result is ${i} bytes; limit is ${n} bytes`);let a;try{a=JSON.parse(r.readResult(e.resultPath))}catch(o){throw new Error(`Vue reference worker ${e.workerId} produced invalid JSON`,{cause:o})}if(!Me(a)||a.version!==1||a.runId!==t||a.workerId!==e.workerId)throw new Error(`Vue reference worker ${e.workerId} result identity does not match its assignment`);if(!cl(a.taskIds,e.taskIds))throw new Error(`Vue reference worker ${e.workerId} result task identities do not match its assignment`);if(a.ok===!1)throw typeof a.error!="string"?new Error(`Vue reference worker ${e.workerId} failure payload is malformed`):new Error(`Vue reference worker ${e.workerId} failed: ${a.error}`);if(a.ok!==!0||!il(a.result))throw new Error(`Vue reference worker ${e.workerId} success payload is malformed`);return a.result}function il(e){if(!Me(e)||!Array.isArray(e.occurrences)||!e.occurrences.every(al)||!U(e.skippedReferences)||!Me(e.skippedReferenceReasons))return!1;for(let t of["missing-source-file","missing-service-script","no-definition","same-file-definition","unindexed-definition"])if(!U(e.skippedReferenceReasons[t]))return!1;return Array.isArray(e.skippedReferenceSamples)&&e.skippedReferenceSamples.every(ol)}function al(e){return Me(e)&&typeof e.sourceFile=="string"&&U(e.sourceLine)&&U(e.sourceStartChar)&&U(e.sourceEndChar)&&typeof e.sourceToken=="string"&&typeof e.definitionFile=="string"&&U(e.symbolId)}function ol(e){return Me(e)&&typeof e.sourceFile=="string"&&U(e.sourceLine)&&U(e.sourceStartChar)&&U(e.sourceEndChar)&&typeof e.token=="string"&&sl(e.reason)}function sl(e){return e==="missing-source-file"||e==="missing-service-script"||e==="no-definition"||e==="same-file-definition"||e==="unindexed-definition"}function U(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Me(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function cl(e,t){return Array.isArray(e)&&e.length===t.length&&e.every((n,r)=>typeof n=="string"&&n===t[r])}function wa(e,t){if(!Number.isSafeInteger(t)||t<=0)throw new TypeError(`${e} must be a positive safe integer.`)}function ul(e){return e instanceof Error?e.message:String(e)}function _a(e){let t=Number(process.env.SCIP_QUERY_AUGMENT_VUE_WORKERS??0),n=Number.isFinite(t)&&t>0?t:1;return Math.max(1,Math.min(e,n))}function ll(){let e=Number(process.env.SCIP_QUERY_AUGMENT_VUE_WORKER_TIMEOUT_MS??0);return Number.isFinite(e)&&e>0?e:Qu}function dl(){let e=Number(process.env.SCIP_QUERY_AUGMENT_VUE_WORKER_RESULT_MAX_BYTES??0);return Number.isSafeInteger(e)&&e>0?e:Ta}function pl(e){let t=gl(),n=[];for(let r of e){let i=Da(r),a=Math.max(1,Math.ceil(i/t));for(let o=0;o<a;o++)n.push({taskId:`${n.length}:${r}:${o}`,fileName:r,startOffset:Math.floor(i*o/a),endOffset:o===a-1?Number.POSITIVE_INFINITY:Math.floor(i*(o+1)/a),countFileSkip:o===0})}return n}function gl(){return Number.POSITIVE_INFINITY}function fl(e,t){let n=Array.from({length:t},()=>({tasks:[],weight:0})),r=e.map(i=>({task:i,weight:ml(i)})).sort((i,a)=>a.weight-i.weight);for(let i of r){let a=n.reduce((o,s)=>s.weight<o.weight?s:o);a.tasks.push(i.task),a.weight+=i.weight}return n.map(i=>i.tasks).filter(i=>i.length>0)}function ml(e){return Number.isFinite(e.endOffset)?Math.max(1,e.endOffset-e.startOffset):Math.max(1,Da(e.fileName)-e.startOffset)}function Da(e){try{return ka(e).size}catch{return 1}}import{createRequire as hl}from"module";import{existsSync as yl}from"fs";import{dirname as La,extname as bl,join as Oa,relative as Sl,resolve as Rl}from"path";import{pathToFileURL as xl}from"url";function vl(e){e.transaction(()=>{e.prepare(`
262
- DELETE FROM mentions
263
- WHERE chunk_id IN (
264
- SELECT c.id
265
- FROM chunks c
266
- JOIN documents d ON d.id = c.document_id
267
- WHERE d.language = 'vue' OR d.relative_path LIKE '%.vue'
268
- )
269
- `).run(),e.prepare(`
270
- DELETE FROM chunks
271
- WHERE document_id IN (
272
- SELECT id
273
- FROM documents
274
- WHERE language = 'vue' OR relative_path LIKE '%.vue'
275
- )
276
- `).run()})()}function ja(e,t){return e.prepare(`
277
- SELECT relative_path AS relativePath
278
- FROM documents
279
- WHERE language = 'vue' OR relative_path LIKE '%.vue'
280
- ORDER BY relative_path
281
- `).all().map(r=>Rl(t,r.relativePath))}function Ca(e,t){let{vueCore:n,ts:r,volarTs:i}=Pl(e),{parsed:a,vueOptions:o}=Il(n,r,t),s=La(t),c=n.createVueLanguagePlugin(r,a.options,o,g=>g),u=wl(n,r,c),l=kl(s,a),{languageServiceHost:d}=i.createLanguageServiceHost(r,r.sys,u,g=>g,l),p=r.createLanguageService(d);return{ts:r,language:u,languageService:p,fileNames:a.fileNames,configDir:s}}function Pl(e){let t=hl(xl(Oa(e,"package.json")).href);return{vueCore:En(t,"@vue/language-core",e),ts:En(t,"typescript",e),volarTs:En(t,"@volar/typescript",e)}}function Il(e,t,n){let r=t.readConfigFile(n,t.sys.readFile);if(r.error||!r.config)throw new Error(`Failed to read ${n}`);let a=e.createParsedCommandLine(t,t.sys,n).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(a.globalTypesPath=e.createGlobalTypesWriter(a,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(r.config,t.sys,La(n),void 0,n,void 0,e.getAllExtensions(a).map(o=>({extension:o.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:a}}function wl(e,t,n){let r={},i=e.createLanguage([n],new Map,a=>{if(!yl(a))return;let o=N(a,{maxBytes:At,inputKind:"Vue language-service source file"});r.current?.scripts.set(a,t.ScriptSnapshot.fromString(o),n.getLanguageId(a)??Dl(a))});return r.current=i,i}function kl(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function En(e,t,n){try{return e(t)}catch(r){throw(typeof r=="object"&&r!==null&&"code"in r?r.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${n}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:r}):r}}function Ma(e,t,n){let r=El(e);return i=>{if(!i.name)return null;let a=G(t,i.fileName),o=n.get(i.fileName);if(!o)return null;let s=n.positionAt(o,i.textSpan.start),c=r.get(a);if(!c)return null;let u=c.starts.find(d=>d.line===s.line&&d.displayName===i.name);if(u)return u.symbolId;let l=c.containingByLine.get(s.line);return l&&l.displayName===i.name?l.symbolId:Tl(c.starts,s.line,2,i.name)}}function El(e){let t=e.prepare(`
282
- SELECT
283
- d.relative_path AS relativePath,
284
- der.start_line AS startLine,
285
- der.end_line AS endLine,
286
- der.symbol_id AS symbolId,
287
- gs.display_name AS displayName
288
- FROM defn_enclosing_ranges der
289
- JOIN documents d ON d.id = der.document_id
290
- JOIN global_symbols gs ON gs.id = der.symbol_id
291
- ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
292
- `).all(),n=new Map;for(let r of t){let i=n.get(r.relativePath);i||(i={containingByLine:new Map,starts:[]},n.set(r.relativePath,i)),i.starts.push({line:r.startLine,symbolId:r.symbolId,displayName:r.displayName});for(let a=r.startLine;a<=r.endLine;a++)i.containingByLine.set(a,{symbolId:r.symbolId,displayName:r.displayName})}for(let r of n.values())r.starts.sort((i,a)=>i.line-a.line);return n}function Tl(e,t,n,r){let i=0,a=e.length-1;for(;i<=a;){let s=Math.floor((i+a)/2);e[s].line<t?i=s+1:a=s-1}let o=null;for(let s of[a,i]){let c=e[s];if(!c||c.displayName!==r)continue;let u=Math.abs(c.line-t);u>n||(!o||u<o.distance)&&(o={distance:u,symbolId:c.symbolId})}return o?.symbolId??null}function Na(e,t,n){let r=jl(t),i=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),a=e.prepare(`
293
- INSERT OR IGNORE INTO global_symbols (symbol, display_name, kind, documentation)
294
- VALUES (?, ?, ?, ?)
295
- `),o=0,s=new Map;return e.transaction(()=>{for(let u of n){let l=G(t,u),d=Ha(r.name,r.version,l);a.run(d,"default",7,`Vue component|${l}`);let p=Cl(i,r,t,u);p&&(o++,s.set(u,p))}})(),{get(u){return s.get(u)??null},syntheticSymbols:o}}function Ba(e,t,n,r,i){return e.transaction(()=>(vl(e),Fl(e,t,n,r),Al(e,i)))()}function Fl(e,t,n,r){let i=e.prepare("SELECT id FROM documents WHERE relative_path = ?"),a=e.prepare(`
296
- INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
297
- VALUES (?, ?, ?, ?, X'00')
298
- `),o=e.prepare(`
299
- INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
300
- VALUES (?, ?, 1)
301
- `);for(let s of n){let c=r.get(s);if(!c)continue;let u=G(t,s),l=i.get(u);if(!l)continue;let d=a.run(l.id,-1,0,0);o.run(Number(d.lastInsertRowid),c)}}function $a(e,t,n,r,i){if(e.fileName.endsWith(".vue")){let a=r.language.scripts.get(e.fileName),o=a?.generated?.languagePlugin.typescript?.getServiceScript(a.generated.root)?.code;if(a&&o){let s=r.language.maps.get(o,a);if(Tn(s,e.textSpan.start)!==null)return n.get(e.fileName)}return e.fileName.startsWith(i)?n.get(e.fileName):null}return t(e)}function Va(e){let t=new Set,n=[];for(let r of e){let i=Ua(r);t.has(i)||(t.add(i),n.push(r))}return n}function Ua(e){return[e.sourceFile,e.sourceLine,e.sourceStartChar,e.sourceEndChar,e.symbolId].join(":")}function Al(e,t){let n=Ol(e,[...new Set(t.map(c=>c.sourceFile))]),r=e.prepare(`
302
- INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
303
- VALUES (?, ?, ?, ?, X'00')
304
- `),i=e.prepare(`
305
- INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
306
- VALUES (?, ?, 0)
307
- `),a=new Set,o=0,s=0;for(let c of t){let u=Ua(c);if(a.has(u))continue;a.add(u);let l=n.get(c.sourceFile);if(!l)continue;let d=r.run(l,s++,c.sourceLine,c.sourceLine),p=i.run(Number(d.lastInsertRowid),c.symbolId);o+=Number(p.changes)}return o}function*Ga(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,n=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),r;for(;r=t.exec(e);){let i=r[0];n.has(i)||(yield{text:i,start:r.index,end:r.index+i.length})}}function Wa(e,t){for(let[n]of e.toGeneratedLocation(t,r=>!!r.navigation))return n;return null}function Tn(e,t){let n=e;for(let[r]of n.toSourceLocation(t,i=>!!i.navigation))return r;return null}function _l(e,t){let n=0,r=e.lineStarts.length-1;for(;n<=r;){let a=Math.floor((n+r)/2);e.lineStarts[a]<=t?n=a+1:r=a-1}let i=Math.max(0,r);return{line:i,character:t-e.lineStarts[i]}}function qa(e,t){return G(e,t).startsWith("node_modules/")}function G(e,t){return Sl(e,t).replaceAll("\\","/")}function Dl(e){switch(bl(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function Ja(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let n=N(t,{maxBytes:At,inputKind:"Vue source file"}),r={text:n,lineStarts:Ll(n)};return e.set(t,r),r}catch{return e.set(t,null),null}},positionAt:_l}}function Ll(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t.push(n+1);return t}function Ol(e,t){let n=new Map,r=500;for(let i=0;i<t.length;i+=r){let a=t.slice(i,i+r),o=e.prepare(`SELECT id, relative_path AS relativePath FROM documents WHERE relative_path IN (${a.map(()=>"?").join(",")})`).all(...a);for(let s of o)n.set(s.relativePath,s.id)}return n}function jl(e){try{let t=JSON.parse(N(Oa(e,"package.json"),{maxBytes:le,inputKind:"project package manifest"}));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Cl(e,t,n,r){let i=G(n,r),a=Ha(t.name,t.version,i);return e.get(a)?.id??null}function Ha(e,t,n){let r=n.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${r}/default.`}async function Gl(e){return ae(ie(),{projectRoot:e.projectRoot,dbPath:e.dbPath}),Wl(e)}async function Wl(e){let t=Ul(e.projectRoot,e.tsconfig);if(!Bl(t))throw new Error(`Vue tsconfig not found at ${t}`);let n=new Nl(e.dbPath);try{let r=ja(n,e.projectRoot),i=Vl($l(e.dbPath),"augment-vue-meta.json");return await Di({cachePath:i,readFingerprint:()=>zl(n,e.projectRoot,e.tsconfig),compute:()=>ql({db:n,projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,configPath:t,vueFiles:r,onStatus:e.onStatus}),onCacheHit:a=>e.onStatus?.(`Vue references unchanged; reused ${a.resolvedReferences} cached resolved references.`)})}finally{n.close()}}async function ql(e){let t=Na(e.db,e.projectRoot,e.vueFiles),n=Fa(e.vueFiles)?await Aa({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles}):Hl(e,t);return Jl(e,t,n)}function Jl(e,t,n){let r=Va(n.occurrences),i=Ba(e.db,e.projectRoot,e.vueFiles,t,r),a={vueFiles:e.vueFiles.length,resolvedReferences:r.length,resolvedReferenceSamples:rd(e.db,r,20),insertedMentions:i,skippedReferences:n.skippedReferences,skippedReferenceReasons:n.skippedReferenceReasons,skippedReferenceSamples:nd(n.skippedReferenceSamples,20),syntheticSymbols:t.syntheticSymbols};return e.onStatus?.(`Resolved ${a.resolvedReferences} Vue references with Volar; inserted ${a.insertedMentions} mentions.`),a}function Hl(e,t){let n=Xl({db:e.db,projectRoot:e.projectRoot,configPath:e.configPath,vueSymbolLookup:t});return Kl({...n,vueFiles:n.context.fileNames.filter(r=>r.endsWith(".vue"))})}function zl(e,t,n){let r=e.prepare(`
308
- SELECT
309
- (SELECT COUNT(*) FROM documents) AS documents,
310
- (SELECT COUNT(*) FROM global_symbols) AS symbols,
311
- (SELECT COUNT(*) FROM chunks) AS chunks,
312
- (SELECT COUNT(*) FROM mentions) AS mentions,
313
- (SELECT COUNT(*) FROM defn_enclosing_ranges) AS ranges,
314
- (SELECT MAX(id) FROM chunks) AS maxChunkId,
315
- (SELECT MAX(id) FROM global_symbols) AS maxSymbolId
316
- `).get();return{version:3,tsconfig:n,files:Jn(t),db:r}}function Xl(e){let t=Ja();return{projectRoot:e.projectRoot,context:Ca(e.projectRoot,e.configPath),symbolLookup:Ma(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function Kl(e){let t=[],n=we(),r=e.tasks??e.vueFiles.map(i=>({fileName:i,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let i of r){let a=Yl(e,i);t.push(...a.occurrences),St(n,a)}return{occurrences:t,...n}}function Yl(e,t){let n=e.sourceReader.get(t.fileName);if(!n)return za(e.projectRoot,t,"missing-source-file");let r=e.context.language.scripts.get(t.fileName),i=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!i)return za(e.projectRoot,t,"missing-service-script");let a=e.context.language.maps.get(i,r),o=G(e.projectRoot,t.fileName),s=[...Ga(n.text)],c={tokens:s.filter(u=>u.start>=t.startOffset&&u.start<t.endOffset),tokenByStart:new Map(s.map(u=>[u.start,u])),tokenTextCounts:ad(s),processedStarts:new Set};return Ql({...e,fileName:t.fileName,sourceInfo:n,sourceFile:o,map:a,tokenContext:c})}function Ql(e){let t=[],n=we();for(let r of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(r.start)||Zl(e.sourceInfo.text,r.start))continue;let i=Wa(e.map,r.start);if(i===null)continue;let o=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(l=>!qa(e.projectRoot,l.fileName));if(!o){Fn(n,e.sourceReader,e.sourceInfo,e.sourceFile,r,"no-definition");continue}let s=G(e.projectRoot,o.fileName),c=ed(e.sourceFile,r.text,s);if(c){Fn(n,e.sourceReader,e.sourceInfo,e.sourceFile,r,c);continue}let u=$a(o,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(u===null){Fn(n,e.sourceReader,e.sourceInfo,e.sourceFile,r,"unindexed-definition");continue}Xa(t,e.sourceReader,e.sourceInfo,e.sourceFile,r,s,u),e.tokenContext.processedStarts.add(r.start),id(t,e,r,i,s,u)}return{occurrences:t,...n}}function Zl(e,t){let n=e.lastIndexOf(`
317
- `,t-1)+1,r=e.slice(n,t);return/\bfrom\s+['"][^'"]*$/.test(r)||/\bimport\s*\(\s*['"][^'"]*$/.test(r)}function ed(e,t,n){return n===e?"same-file-definition":n.endsWith(".vue")&&t!==n.split("/").at(-1)?.replace(/\.vue$/,"")?"unindexed-definition":null}function za(e,t,n){let r=we();return t.countFileSkip&&(r.skippedReferences=1,r.skippedReferenceReasons[n]=1,r.skippedReferenceSamples.push({sourceFile:G(e,t.fileName),sourceLine:0,sourceStartChar:0,sourceEndChar:0,token:"",reason:n})),{occurrences:[],...r}}function Fn(e,t,n,r,i,a){if(e.skippedReferences++,e.skippedReferenceReasons[a]++,e.skippedReferenceSamples.filter(s=>s.reason===a&&s.sourceFile===r).length>=2)return;let o=t.positionAt(n,i.start);e.skippedReferenceSamples.push({sourceFile:r,sourceLine:o.line,sourceStartChar:o.character,sourceEndChar:o.character+i.text.length,token:i.text,reason:a})}function An(e,t){let n=new Map;for(let a of e){let o=n.get(a.sourceFile)??[];o.push(a),n.set(a.sourceFile,o)}let r=[...n.keys()].sort(),i=[];for(let a=0;i.length<t;a++){let o=!1;for(let s of r){let c=n.get(s)?.[a];if(c&&(i.push(c),o=!0,i.length===t))break}if(!o)break}return i}function td(e,t){let n=An(e.filter(a=>a.sourceFile!==a.definitionFile),Math.ceil(t/2)),r=new Set(n.map(a=>`${a.sourceFile}:${a.sourceLine}:${a.sourceStartChar}:${a.sourceEndChar}:${a.symbolId}`)),i=An(e.filter(a=>!r.has(`${a.sourceFile}:${a.sourceLine}:${a.sourceStartChar}:${a.sourceEndChar}:${a.symbolId}`)),t-n.length);return[...n,...i]}function nd(e,t){let n=[...new Set(e.map(i=>i.reason))].sort(),r=[];for(let[i,a]of n.entries()){let o=n.length-i,s=Math.ceil((t-r.length)/o);r.push(...An(e.filter(c=>c.reason===a),s))}return r.slice(0,t)}function rd(e,t,n){let r=e.prepare("SELECT symbol FROM global_symbols WHERE id = ?");return td(t,n).map(({symbolId:i,...a})=>({...a,definitionSymbol:r.get(i)?.symbol??`symbol-id:${i}`}))}function id(e,t,n,r,i,a){if(!((t.tokenContext.tokenTextCounts.get(n.text)??0)<=1))for(let o of od(t.context.languageService,t.fileName,r+1,t.map,n,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(o))continue;let s=t.tokenContext.tokenByStart.get(o);s&&(Xa(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,i,a),t.tokenContext.processedStarts.add(o))}}function Xa(e,t,n,r,i,a,o){let s=t.positionAt(n,i.start);e.push({sourceFile:r,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+i.text.length,sourceToken:i.text,definitionFile:a,symbolId:o})}function ad(e){let t=new Map;for(let n of e)t.set(n.text,(t.get(n.text)??0)+1);return t}function od(e,t,n,r,i,a){let o=e.getDocumentHighlights?.(t,n,[t])??[],s=[];for(let c of o)if(c.fileName===t)for(let u of c.highlightSpans){let l=sd(r,u.textSpan.start,a,i.text);l!==null&&s.push(l)}return s}function sd(e,t,n,r){let i=n.get(t);if(i?.text===r)return i.start;let a=Tn(e,t);if(a===null)return null;let o=n.get(a);return o?.text===r?o.start:null}async function uo(e){let{projectRoot:t,onStatus:n=console.log}=e,r=e.maxHeapMb??md(process.env.NODE_OPTIONS)??8192,i=e.skipAutoInstall===!0||e.installMissing!==!0,a=yd(e),o=Date.now(),s=P();xt(x(a.outputScip),{recursive:!0}),xt(x(a.outputDb),{recursive:!0});let c=e.languages??$t(t);if(c.length===0)throw new Error("No supported languages detected in this project. Looked for: tsconfig.json, Cargo.toml, go.mod, pyproject.toml, etc.");n(`Detected languages: ${c.join(", ")}`);let u=Pt(a.metaPath),l=R("reindex.fingerprint",()=>Xn(t,c,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath},u,e.changeJournal,Bt(a.outputDb)),{languages:c.length}),d=l.fingerprint,p=l.mode==="delta"?e.changeJournal?.entries.filter(y=>y.kind!=="add").length??0:0,g=Math.max(0,(u?.files.length??0)-p);n(l.mode==="delta"?`Project fingerprint revalidated ${l.changedPaths.length} changed path(s), reused ${g} accepted file fingerprint(s), and accepted ${d.files.length} input(s)`:`Project fingerprint used full scan: ${l.reason}`);let f=await gd({opts:e,paths:a,languages:c,fingerprint:d,onStatus:n}),h=f.snapshot,v=f.releaseBuildLock,w=vo(e.trigger),k=Ar(F(x(a.outputDb),"cache-lifecycle.lock"),{waitMs:w?1e3:3e4});if(!k)throw v?.(),new Re(w?`Could not acquire scip-query cache lifecycle lock for ${x(a.outputDb)}; another refresh is publishing, so the watcher will retry.`:`Could not acquire scip-query cache lifecycle lock for ${x(a.outputDb)}. A watch daemon or another reindex may hold it. Run "scip-query watch --stop", retry the reindex, then restart with "scip-query watch --daemon".`);let T;try{T=await te("reindex.lock",()=>Jd(F(x(a.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:n}),{languages:c.length})}catch(y){throw k.release(),v?.(),y}let D=null,b=ni();try{l.mode==="delta"&&Bt(a.outputDb)!==e.changeJournal?.baseGeneration&&(d=Hn(t,c,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),l={mode:"full",fingerprint:d,reason:"accepted-generation-changed-before-lock"},h=void 0,v?.(),v=void 0,n("Project fingerprint used full scan: accepted-generation-changed-before-lock")),Vr(a.outputDb,a.outputScip,a.metaPath);let y=xd(x(a.outputDb));y.removed>0&&n(`Removed ${y.removed} abandoned reindex workspace(s)`);for(let M of y.errors)n(`Could not remove abandoned reindex workspace: ${M}`);let m=null,A=R("reindex.reuse-check",()=>(m=bd({opts:e,paths:a,languages:c,fingerprint:d,start:o,monotonicStart:s,onStatus:n}),m),()=>({languages:c.length,reused:m!==null}));if(A){Qa({snapshot:h,paths:a,projectRoot:t,fingerprint:d,onStatus:n});let M=nn(a.outputDb,A);return M.state==="failed"&&n(`Warning: reindex succeeded, but activity telemetry was not recorded: ${M.reason}`),Dt(t,x(a.outputDb)),A}await te("reindex.scip-cli-ready",()=>Nd(i,n));let L=Rd(a);D=L.runDir;let S,I=await te("reindex.fresh",async()=>(S=await vd({opts:e,languages:c,projectRoot:t,paths:a,tempPaths:L,fingerprint:d,start:o,monotonicStart:s,maxHeapMb:r,skipAutoInstall:i,onStatus:n,writeTelemetry:b}),S),()=>({languages:c.length,reused:S?.reused,skipped:S?.skipped.length}));Qa({snapshot:h,paths:a,projectRoot:t,fingerprint:d,onStatus:n});let E=nn(a.outputDb,I);return E.state==="failed"&&n(`Warning: reindex succeeded, but activity telemetry was not recorded: ${E.reason}`),Dt(t,x(a.outputDb)),I}catch(y){let m=kt({trigger:e.trigger,result:"failed",start:o,monotonicStart:s,error:y instanceof Error?y.message:String(y)});ko(a.metaPath,m);let A=$i(a.outputDb,m);throw A.state==="failed"&&n(`Warning: failed reindex activity telemetry was not recorded: ${A.reason}`),y}finally{D&&ke(D,{recursive:!0,force:!0}),T(),k.release(),v?.()}}async function gd(e){let{opts:t,paths:n,languages:r,fingerprint:i,onStatus:a}=e,o=t.projectRoot;if(!(t.skipIfUnchanged!==!1&&!Ur(o,n.outputDb)&&Ka(n.outputScip)===Ka(F(x(n.outputDb),"index.scip"))))return{snapshot:void 0,releaseBuildLock:void 0};let c=Ue(o),u=c?.clean?Qe(c,i):void 0;if(c&&!c.clean&&!Za(n))return Ya({context:c,languages:r,opts:t,paths:n,fingerprint:i,projectRoot:o,onStatus:a,successMessage:"dirty worktree reindex",failurePrefix:"Shared baseline fork failed"}),{snapshot:u,releaseBuildLock:void 0};if(!u)return{snapshot:void 0,releaseBuildLock:void 0};let l=Vt(u);if(l){if(!fd(n,i))try{Ze({snapshot:u,manifest:l,targetCacheDir:x(n.outputDb),targetProjectRoot:o}),a(`Attached shared generation ${u.generationId.slice(0,12)}`)}catch(p){a(`Shared generation attach failed; continuing locally: ${oe(p)}`)}return{snapshot:u,releaseBuildLock:void 0}}c&&!Za(n)&&Ya({context:c,languages:r,opts:t,paths:n,fingerprint:i,projectRoot:o,onStatus:a,successMessage:"cold worktree reindex",failurePrefix:"Compatible shared baseline fork failed",compatible:!0});let d=await qr(u);if(d.kind==="owner")return{snapshot:u,releaseBuildLock:d.release};if(d.kind==="generation-ready"){let p=Vt(u);if(p)try{Ze({snapshot:u,manifest:p,targetCacheDir:x(n.outputDb),targetProjectRoot:o,action:"waited"}),a(`Attached shared generation ${u.generationId.slice(0,12)} after waiting`)}catch(g){a(`Shared generation attach failed after waiting; continuing locally: ${oe(g)}`)}}else a("Shared generation build lock timed out; continuing with an isolated local reindex");return{snapshot:u,releaseBuildLock:void 0}}function Ya(e){let t=Gr(e.context,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath},e.fingerprint);if(t)try{Ze({snapshot:t.snapshot,manifest:t.manifest,targetCacheDir:x(e.paths.outputDb),targetProjectRoot:e.projectRoot,persistLease:!1}),Hr(t.snapshot,x(e.paths.outputDb)),e.onStatus(`Forked ${e.compatible?"compatible ":""}shared baseline ${t.snapshot.generationId.slice(0,12)} for ${e.successMessage}`)}catch(n){e.onStatus(`${e.failurePrefix}; continuing locally: ${oe(n)}`)}}function Qa(e){if(e.snapshot)try{let t=Ue(e.projectRoot),n=t?Qe(t,e.fingerprint):void 0;if(!n||n.generationId!==e.snapshot.generationId){e.onStatus("Skipped shared generation publication because the worktree changed during indexing");return}let r=Wr({snapshot:e.snapshot,sourceCacheDir:x(e.paths.outputDb),sourceProjectRoot:e.projectRoot,sourceStillValid:()=>{let i=Ue(e.projectRoot);return(i?Qe(i,e.fingerprint):void 0)?.generationId===e.snapshot?.generationId}});Jr(e.snapshot,x(e.paths.outputDb),"built"),e.onStatus(r.kind==="published"?`Published shared generation ${e.snapshot.generationId.slice(0,12)} (${r.achievedDurability})`:`Shared generation ${e.snapshot.generationId.slice(0,12)} was already available (${r.achievedDurability})`)}catch(t){e.onStatus(`Shared generation publication failed; local index remains valid: ${oe(t)}`)}}function fd(e,t){if(!j(e.outputScip)||!j(e.outputDb)||wo(e.metaPath,t)===null)return!1;let n=J(e.outputDb,e.metaPath);return n.state!=="invalid"&&n.state!=="drifted"}function Za(e){if(!j(e.outputScip)||!j(e.outputDb)||!ce(e.metaPath))return!1;let t=J(e.outputDb,e.metaPath);return t.state!=="invalid"&&t.state!=="drifted"}function oe(e){return e instanceof Error?e.message:String(e)}function md(e){let t=e?.match(/--max[-_]old[-_]space[-_]size(?:=|\s+)(\d+)/u);if(!t)return;let n=Number.parseInt(t[1],10);return Number.isInteger(n)&&n>0?n:void 0}function hd(e,t){return[(e??"").replace(/(?:^|\s)--max[-_]old[-_]space[-_]size(?:=|\s+)\d+/gu," ").trim(),`--max-old-space-size=${t}`].filter(Boolean).join(" ")}function Ln(e,t,n,r,i,a,o,s=!1){try{ae(ii({indexPath:n,evidenceDbPath:o,reuseExisting:i,affectedFiles:a,forceDerivedRebuild:s}),{projectRoot:e,dbPath:t,onStatus:r})}catch(c){r(`Runtime-boundary extraction unavailable: ${c instanceof Error?c.message:String(c)}.`)}}function yd(e){let t=e.outputScip??F(e.projectRoot,"index.scip"),n=e.outputDb??F(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:F(x(n),"meta.json")}}function bd(e){let t=J(e.paths.outputDb,e.paths.metaPath),n=wo(e.paths.metaPath,e.fingerprint);if(e.opts.skipIfUnchanged===!1||!j(e.paths.outputScip)||!j(e.paths.outputDb)||n===null||t.state==="invalid"||t.state==="drifted")return null;let r=Ke(e.paths.outputDb,e.fingerprint,e.languages);if(r.state!=="complete")return e.onStatus(On("Accepted SQLite index",r)),null;ae(ie(),{projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),Ln(e.opts.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0),J(e.paths.outputDb,e.paths.metaPath).state==="drifted"&&(Ye(e.paths.outputDb,e.paths.metaPath),e.onStatus("Published refreshed SQLite generation after post-index augmentation")),n==="operational-config-compatible"&&(ep(e.paths.metaPath,e.fingerprint,e.languages,e.opts),Ye(e.paths.outputDb,e.paths.metaPath),e.onStatus("Migrated operational .scipquery.json metadata without rerunning language indexers."));let i=P()-e.monotonicStart,a=kt({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:e.languages,skipped:[]});return ko(e.paths.metaPath,a),e.onStatus(`Index unchanged; reused existing SQLite index in ${(i/1e3).toFixed(1)}s`),{languages:e.languages,indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:i,reused:!0,skipped:[],lastRefresh:a,shards:Sd(e.paths,e.languages,e.opts,e.fingerprint)}}function Sd(e,t,n,r){let i=jn(r,t,n);return t.map(a=>({id:a,language:a,reused:!0,strategy:"reused",fingerprint:Ne(i[a]),outputBytes:se(Cn(e.outputDb,a)),durationMs:0}))}function Rd(e){let t=ud(F(x(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:F(t,Rt(e.outputScip)),tempOutputDb:F(t,Rt(e.outputDb)),tempMetaPath:F(t,Rt(e.metaPath))}}function xd(e){let t=[],n;try{n=so(e,{withFileTypes:!0})}catch(i){return{removed:0,errors:[oe(i)]}}let r=0;for(let i of n)if(!(!i.name.startsWith("reindex-")||!i.isDirectory()))try{ke(F(e,i.name),{recursive:!0,force:!0}),r+=1}catch(a){t.push(`${i.name}: ${oe(a)}`)}return{removed:r,errors:t}}async function vd(e){let t={...process.env,NODE_OPTIONS:hd(process.env.NODE_OPTIONS,e.maxHeapMb)},n,r=await te("reindex.language-indexers",async()=>(n=await Id(e,t),n),()=>({languages:e.languages.length,indexed:n?.indexedOutputs.length,reused:n?.reusedLanguages.length,skipped:n?.skippedLanguages.length})),{indexedOutputs:i,skippedLanguages:a,reusedLanguages:o,languageFingerprints:s,shards:c,typescriptProjectShardContext:u,incrementalTypeScript:l}=r;if(o.length>0&&e.onStatus(`Reused ${o.length} cached language shard(s): ${o.join(", ")}`),Pd({run:e,indexedOutputs:i,skippedLanguages:a,reusedLanguages:o})){let g=R("reindex.publish",()=>Od(e,i,a,o,s,u),{mode:"metadata-only",languages:i.length,reused:o.length}),f=g.durationMs;return e.onStatus(`All language shards unchanged; reused existing SQLite index in ${(f/1e3).toFixed(1)}s`),{languages:i.map(h=>h.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:f,reused:!0,skipped:a,lastRefresh:g,shards:c,writeTelemetry:e.writeTelemetry}}let d=await te("reindex.publish",()=>Dd(e,t,i,a,o,s,u,l),{mode:l?"incremental-or-fallback":"full",languages:i.length,reused:o.length,skipped:a.length}),p=d.durationMs;return e.onStatus(`Done in ${(p/1e3).toFixed(1)}s`),{languages:i.map(g=>g.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:p,reused:!1,skipped:a,lastRefresh:d,shards:c,writeTelemetry:e.writeTelemetry}}function Pd(e){if(e.run.opts.skipIfUnchanged===!1||e.skippedLanguages.length>0||!j(e.run.paths.outputScip)||!j(e.run.paths.outputDb))return!1;let t=J(e.run.paths.outputDb,e.run.paths.metaPath);if(t.state==="invalid"||t.state==="drifted")return!1;let n=new Set(e.reusedLanguages),r=new Set(e.indexedOutputs.map(i=>i.language));return e.run.languages.length>0&&r.size===e.run.languages.length&&e.indexedOutputs.length===e.run.languages.length&&e.run.languages.every(i=>n.has(i)&&r.has(i))}async function Id(e,t){let n=Fd({paths:e.paths,projectRoot:e.projectRoot,languages:e.languages,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath,projectFingerprint:e.fingerprint}),r=[],i=new Set;for(let[S,I]of n)I.reused&&(r.push({language:S,scipPath:I.scipPath}),i.add(S));for(let S of i)e.onStatus(`Reusing cached ${S} SCIP shard (language inputs unchanged).`);let a=n.get("typescript"),o=J(e.paths.outputDb,e.paths.metaPath),s=ce(e.paths.metaPath),c=o.state==="legacy"||o.state==="current",u=s?.scipCompanion!=="deferred"&&(o.state!=="current"||o.generation.publication?.scipCompanion!=="deferred"),l,d=a&&!a.reused&&c?ha({projectRoot:e.projectRoot,cacheDir:x(e.paths.outputDb),previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,previousShardPath:a.scipPath,candidateShardPath:Ee(e.tempPaths.tempOutputScip,"typescript-incremental",0),candidateAffectedScipPath:Ee(e.tempPaths.tempOutputScip,"typescript-affected",0),baseShardCurrent:u,previousSnapshot:Pt(e.paths.metaPath),currentSnapshot:e.fingerprint,projectMode:e.opts.typescriptProjectMode,onStatus:e.onStatus,onUnavailable:S=>{l=S}}):null,p=new Set(d?["typescript"]:[]);if(e.opts.allowExpensiveRebuild===!1){let S=e.languages.filter(I=>!i.has(I)&&!p.has(I));if(S.length>0){let I=S.length===1&&S[0]==="typescript"&&l?`: ${l}`:"";throw new Error(`Incremental indexing is unavailable for ${S.join(", ")}${I}. The accepted index was preserved because whole-project rebuilds are disabled; run scip-query reindex --allow-expensive-rebuild only when you explicitly want that fallback.`)}}let g=d||i.has("typescript")?void 0:wd(e,n),{preparedRuns:f,skippedLanguages:h,languageOutputScipPaths:v}=Bd({languages:e.languages.filter(S=>!i.has(S)&&!p.has(S)),tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:t,skipAutoInstall:e.skipAutoInstall,trustProjectTools:e.opts.trustProjectTools===!0,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,preDiscoveredTypeScriptProjects:g?.allProjects,clojureConfigPath:e.opts.clojureConfigPath,onStatus:e.onStatus}),w=g?f.filter(S=>S.language!=="typescript"||g.missedProjectIds.has(S.id)):f,k=await xa(w,e.projectRoot,e.onStatus,e.opts.indexerConcurrency,e.opts.signal);if(tr())for(let S of k)nr({type:"span",name:`reindex.language-indexer.${S.id}`,durationMs:Math.round(S.durationMs),ok:!S.skipped,language:S.language,indexerCommand:S.command,outputBytes:S.outputBytes,measurement:"indexer-run-result"});let T=[];if(g){Ed(e.paths.outputDb,k,e.writeTelemetry);let S=v.typescript??e.tempPaths.tempOutputScip;T=Td({outputDb:e.paths.outputDb,tempOutputScip:e.tempPaths.tempOutputScip,outputScipPath:S,reusedProjects:g.reusedProjects,writeTelemetry:e.writeTelemetry})}let D=[...k,...T],{indexedOutputs:b}=Vd(D,h),y=d?[{language:"typescript",scipPath:d.scipPath}]:[],m=[...r,...y,...b];Ud(m,h,e.languages,e.opts.allowPartial,e.onStatus);let A=d?[{id:"typescript",language:"typescript",label:"typescript (incremental documents)",scipPath:d.scipPath,outputScipPath:d.scipPath,durationMs:d.durationMs,command:"watch-service:typescript-index",outputBytes:se(d.scipPath)??void 0,producedOutputBytes:se(d.affectedScipPath)??void 0}]:[],L=Ad(n,[...k,...A],g?{outputDb:e.paths.outputDb,classification:g.classification}:void 0,l);return{indexedOutputs:m,skippedLanguages:h,reusedLanguages:[...i],languageFingerprints:_d(n,e.languages),shards:L,typescriptProjectShardContext:g?{projects:g.allProjects,fingerprints:g.fingerprints}:void 0,incrementalTypeScript:d??void 0}}function wd(e,t){let n=t.get("typescript");if(!n||n.reused||n.cacheIntegrityFailed||e.opts.typescriptProjectMode!=="workspace")return;let r=Y(e.projectRoot,e.opts.typescriptProjects);if(r.length===0)return;let i=Ji(e.projectRoot,r),a=Gi(n.fingerprint.files,r),o=Wi(r,i),s=qi(r,a,o),c=ce(e.paths.metaPath),l=kd(c,s,f=>j(It(e.paths.outputDb,f))),d=[...l.entries()].filter(([,f])=>f.reused).map(([f])=>f),p=new Set(d),g=new Set(r.filter(f=>!p.has(f)).map(f=>`typescript:${f}`));return{allProjects:r,fingerprints:s,classification:l,reusedProjects:d,missedProjectIds:g}}function kd(e,t,n){let r=new Map;for(let i of Object.keys(t)){let a=t[i];if(!e){r.set(i,{reused:!1,reason:"no reindex metadata found",fingerprint:a});continue}let o=e.version===fe&&jt(e).typescriptProjectShardReuse?e.typescriptProjectShards?.[i]:void 0;if(!o){r.set(i,{reused:!1,reason:"no cached fingerprint for this project",fingerprint:a});continue}if(!n(i)){r.set(i,{reused:!1,reason:"cached shard file missing on disk",fingerprint:a});continue}if(O(o)!==O(a)){r.set(i,{reused:!1,reason:"project inputs changed since last index",fingerprint:a});continue}r.set(i,{reused:!0,fingerprint:a})}return r}function Ed(e,t,n){for(let r of t){if(r.skipped||!r.id.startsWith("typescript:"))continue;let i=r.id.slice(11),a=It(e,i);xt(x(a),{recursive:!0}),re(n,ne(r.scipPath,a))}}function Td(e){return e.reusedProjects.map((t,n)=>{let r=It(e.outputDb,t),i=Ee(e.tempOutputScip,"typescript-project-cached",n);return re(e.writeTelemetry,ne(r,i)),{id:`typescript:${t}`,language:"typescript",label:`typescript (${t})`,scipPath:i,outputScipPath:e.outputScipPath,durationMs:0,command:"cached",outputBytes:se(i)??void 0}})}function Fd(e){let t=ce(e.paths.metaPath),n=jn(e.projectFingerprint,e.languages,e),r=t&&j(e.paths.outputDb)?Ke(e.paths.outputDb,e.projectFingerprint,e.languages):null,i=new Map;for(let a of e.languages){let o=Cn(e.paths.outputDb,a),s=n[a];if(!t){i.set(a,{reused:!1,reason:"no reindex metadata found",fingerprint:s,scipPath:o});continue}if(t.version!==fe){i.set(a,{reused:!1,reason:`metadata version ${String(t.version??"unknown")} predates per-language shard caching`,fingerprint:s,scipPath:o});continue}if(!jt(t).languageShardReuse||!t.languageFingerprints){i.set(a,{reused:!1,reason:"no per-language fingerprints recorded in metadata",fingerprint:s,scipPath:o});continue}let c=t.languageFingerprints[a];if(!c){i.set(a,{reused:!1,reason:"no cached fingerprint for this language",fingerprint:s,scipPath:o});continue}if(!j(o)){i.set(a,{reused:!1,reason:"cached shard file missing on disk",fingerprint:s,scipPath:o});continue}let u=a==="typescript"?Yd(e.projectRoot,c):c;if(O(u)!==O(s)){i.set(a,{reused:!1,reason:"language inputs changed since last index",fingerprint:s,scipPath:o});continue}if(r?.state==="unavailable"||r?.state==="incomplete"&&r.affectedLanguages.includes(a)){i.set(a,{reused:!1,reason:On("accepted SQLite index",r),cacheIntegrityFailed:!0,fingerprint:s,scipPath:o});continue}i.set(a,{reused:!0,fingerprint:s,scipPath:o})}return i}function Ad(e,t,n,r){let i=[];for(let[a,o]of e)o.reused&&i.push({id:a,language:a,reused:!0,strategy:"reused",fingerprint:Ne(o.fingerprint),outputBytes:se(o.scipPath),durationMs:0});for(let a of t){let o=e.get(a.language),s=n&&a.id.startsWith("typescript:")?a.id.slice(11):null,c=s?n.classification.get(s):void 0;i.push({id:a.id,language:a.language,reused:!1,strategy:a.command==="watch-service:typescript-index"?"incremental":"full",missReason:c?.reason??o?.reason??a.skipped?.reason,fallbackReason:a.language==="typescript"?r:void 0,fingerprint:c?Ne(c.fingerprint):o?Ne(o.fingerprint):"unknown",outputBytes:a.outputBytes??null,producedOutputBytes:a.producedOutputBytes,durationMs:a.durationMs,command:a.command})}if(n)for(let[a,o]of n.classification)o.reused&&i.push({id:`typescript:${a}`,language:"typescript",reused:!0,strategy:"reused",fingerprint:Ne(o.fingerprint),outputBytes:se(It(n.outputDb,a)),durationMs:0});return i}function Ne(e){return cd("sha256").update(O(e)).digest("hex").slice(0,16)}function se(e){try{return ld(e).size}catch{return null}}function _d(e,t){let n={};for(let r of t){let i=e.get(r);i&&(n[r]=i.fingerprint)}return n}async function Dd(e,t,n,r,i,a,o,s){C(e.opts.signal,"Reindex cancelled by its owner.");let c=!s||s.completeScipUpdated,u=!1;c&&(u=R("reindex.publish.scip-output",()=>{let b=Md({run:e,indexedOutputs:n,incrementalTypeScript:s});return eo(e.paths.outputDb,b,e.writeTelemetry),to(b,e.tempPaths.tempOutputScip,e.onStatus)}));let l=await te("reindex.publish.sqlite-output",()=>Gd({run:e,env:t,indexedOutputs:n,skippedLanguages:r,reusedLanguages:i,incrementalTypeScript:s,completeScipAvailable:c,completeScipSanitized:u,materializeFullFallback:async()=>{if(C(e.opts.signal,"Reindex cancelled by its owner."),!s||s.completeScipUpdated)return u;e.onStatus("Materializing the deferred whole TypeScript SCIP companion for full conversion..."),xn({cacheDir:x(e.paths.outputDb),generationIdentity:s.nextFragmentGeneration,baseShardPath:s.scipPath,candidateShardPath:s.candidateScipPath});let b=n.map(y=>y.language==="typescript"?{language:y.language,scipPath:s.candidateScipPath}:y);return eo(e.paths.outputDb,b,e.writeTelemetry),u=to(b,e.tempPaths.tempOutputScip,e.onStatus),u}}));C(e.opts.signal,"Reindex cancelled by its owner."),R("reindex.publish.auxiliary-documents",()=>{ae(ie(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus})}),R("reindex.publish.runtime-boundaries",()=>{let b=s?.plan.mode==="full-project",y=s?.dependencyGraphUnchanged===!0;b?e.onStatus("Rebuilding compiler-derived runtime-boundary relationships while retaining unchanged per-file extraction facts."):y&&e.onStatus("Reusing runtime-boundary relationships because TypeScript semantics are unchanged."),Ln(e.projectRoot,e.tempPaths.tempOutputDb,e.tempPaths.tempOutputScip,e.onStatus,y,y?void 0:b?s?.changedFiles:s?.affectedFiles,F(x(e.paths.outputDb),Zn),b)});let d=R("reindex.publish.sqlite-layout",()=>en(e.tempPaths.tempOutputDb,{analyze:Ld(s,l.mode)}));d.added.length>0&&e.onStatus(`Added SQLite query indexes: ${d.added.join(", ")}`),d.removed.length>0&&e.onStatus(`Removed redundant SQLite indexes: ${d.removed.join(", ")}`),R("reindex.publish.coverage",()=>fo(e,e.tempPaths.tempOutputDb,n.map(b=>b.language)));let p,g=null;l.mode==="incremental"&&s&&R("reindex.publish.reference-fragments",()=>{if(s.dependencyGraphUnchanged){let m=new $({projectRoot:e.projectRoot,dbPath:e.paths.outputDb,indexPath:e.paths.outputScip});try{g=Ct(m),e.onStatus("Preserved exact TypeScript reference fragments and dependency relationships because only trivia changed.")}finally{m.close()}return}let b=null,y=null;try{b=R("reindex.publish.reference-fragments.open-candidate",()=>new $({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,indexPath:e.tempPaths.tempOutputScip})),y=R("reindex.publish.reference-fragments.open-evidence",()=>new $({projectRoot:e.projectRoot,dbPath:e.paths.outputDb,indexPath:e.paths.outputScip})),p=s.dependencyGraphSnapshot?R("reindex.publish.reference-fragments.dependency-graph",()=>cr(b,s.dependencyGraphSnapshot,s.affectedFiles,s.deletedFiles))??void 0:void 0;let m=new Set(s.deletedFiles),A=m.size===0?s.referenceFragmentsByFile:new Map([...s.referenceFragmentsByFile].filter(([S])=>!m.has(S))),L=R("reindex.publish.reference-fragments.seed",()=>Pr(b,e.fingerprint,A,y,p,new Set(s.affectedFiles)));e.onStatus(`Cached exact TypeScript reference fragments for ${L.affectedFiles} affected document(s) and carried ${L.carriedFiles} unaffected document(s) forward.`),L.skippedAffectedFiles>0&&e.onStatus(`Skipped exact TypeScript reference fragment prefill for ${L.skippedAffectedFiles} affected document(s) whose semantic identity was unavailable.`)}catch(m){e.onStatus(`Exact TypeScript reference fragment prefill unavailable: ${m instanceof Error?m.message:String(m)}.`)}finally{b?.close(),y?.close()}});let f=Pt(e.paths.metaPath),h=R("reindex.publish.affected-shadow",()=>l.mode==="incremental"&&s?qd(s,l.changedDocumentPaths):zt({projectRoot:e.projectRoot,previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.tempPaths.tempOutputDb,candidateIndexPath:e.tempPaths.tempOutputScip,previousSnapshot:f,currentSnapshot:e.fingerprint,refreshResult:"rebuilt"})),v=kt({trigger:e.opts.trigger,result:"rebuilt",start:e.start,monotonicStart:e.monotonicStart,languages:n.map(b=>b.language),skipped:[...r]}),w=l.mode==="incremental"&&l.scipCompanion==="deferred",{metadata:k,pruneProjects:T}=po({run:e,indexedOutputs:n,skippedLanguages:r,reusedLanguages:i,languageFingerprints:a,typescriptProjectShardContext:o,lastRefresh:v});k.scipCompanion=w?"deferred":"current",R("reindex.publish.metadata",()=>{go(e),mo(e.paths.outputDb,T),wt(e.tempPaths.tempMetaPath,k)});let D=R("reindex.publish.generation-handoff",()=>$r({tempOutputScip:e.tempPaths.tempOutputScip,tempOutputDb:e.tempPaths.tempOutputDb,tempMetaPath:e.tempPaths.tempMetaPath,outputScip:e.paths.outputScip,outputDb:e.paths.outputDb,metaPath:e.paths.metaPath,preserveOutputScip:l.mode==="incremental"&&l.scipCompanion==="deferred",publication:l.mode==="incremental"?{mode:"incremental",validation:"passed",converterDurationMs:l.converterDurationMs,affectedDocumentCount:s?.affectedFiles.length,changedDocumentCount:l.changedDocumentPaths.length,producerDurationMs:s?.timings.serviceMs,materializationDurationMs:s?.durationMs,patchDurationMs:l.patchDurationMs,scipCompanion:l.scipCompanion,...l.scipCompanion==="deferred"&&s?{typescriptOverlayGeneration:s.nextFragmentGeneration}:{}}:{mode:"full",validation:"passed",converterDurationMs:l.converterDurationMs,scipCompanion:"current",...l.fallbackReason?{fallbackReason:l.fallbackReason}:{}}}));return D.achievedDurability==="file-flushed"&&e.onStatus(`Published local generation ${D.currentGeneration.slice(0,12)} (file-flushed; directory sync unsupported)`),l.mode==="incremental"&&s&&R("reindex.publish.dependency-graph",()=>{let b=null;try{b=new $({projectRoot:e.projectRoot,dbPath:e.paths.outputDb,indexPath:e.paths.outputScip});let y=s.plan.mode==="full-project"&&s.plan.reasons.length===0?s.changedFiles:s.affectedFiles,m=!1;if(s.dependencyGraphUnchanged){let A=Ct(b),L=g&&A?er(b,"file-dependency-graph",g,A):0;m=L>0,e.onStatus(m?`Carried ${L} unchanged dependency graph product(s) forward without rebuilding them.`:"No persisted dependency graph product required rekeying; the next graph consumer can materialize it.")}else s.dependencyGraphSnapshot?m=sr(b,s.dependencyGraphSnapshot,y,p):Je(b);s.dependencyGraphUnchanged||e.onStatus(m?`Carried the dependency graph forward by replacing ${y.length} changed dependency owner(s).`:"Materialized a fresh dependency graph for the accepted generation because no compatible prior graph was available.")}catch(y){e.onStatus(`Dependency graph carry-forward unavailable: ${y instanceof Error?y.message:String(y)}. The next graph consumer will rebuild it.`)}finally{b?.close()}}),R("reindex.publish.cleanup",()=>{Cr(x(e.paths.outputDb),l.mode==="incremental"&&l.scipCompanion==="deferred"?[s.nextFragmentGeneration]:[]),Lr(x(e.paths.outputDb),s?.completeScipUpdated?[s.nextFragmentGeneration]:[])}),R("reindex.publish.shadow-telemetry",()=>lo(e.paths.outputDb,h,e.onStatus)),v}function Ld(e,t){return t!=="incremental"||!e||e.plan.mode==="full-project"?!0:e.affectedFiles.length*20>=e.projectFileCount}function Od(e,t,n,r,i,a){let o=Pt(e.paths.metaPath),s=null;try{re(e.writeTelemetry,ne(e.paths.outputDb,e.tempPaths.tempOutputDb))}catch(p){s=fi("reused","oracle-error",`Could not snapshot the prior database: ${p instanceof Error?p.message:String(p)}`)}ae(ie(),{projectRoot:e.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),Ln(e.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0);let c=en(e.paths.outputDb);c.added.length>0&&e.onStatus(`Added SQLite query indexes: ${c.added.join(", ")}`),c.removed.length>0&&e.onStatus(`Removed redundant SQLite indexes: ${c.removed.join(", ")}`),fo(e,e.paths.outputDb,t.map(p=>p.language)),s??=zt({projectRoot:e.projectRoot,previousDbPath:e.tempPaths.tempOutputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.paths.outputDb,candidateIndexPath:e.paths.outputScip,previousSnapshot:o,currentSnapshot:e.fingerprint,refreshResult:"reused"});let u=kt({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:t.map(p=>p.language),skipped:[...n]}),{metadata:l,pruneProjects:d}=po({run:e,indexedOutputs:t,skippedLanguages:n,reusedLanguages:r,languageFingerprints:i,typescriptProjectShardContext:a,lastRefresh:u});return go(e),mo(e.paths.outputDb,d),wt(e.paths.metaPath,l),Ye(e.paths.outputDb,e.paths.metaPath),lo(e.paths.outputDb,s,e.onStatus),u}function Pt(e){return Tt(ce(e)?.fingerprint)}function lo(e,t,n){try{hi(e,t),t.status==="evaluated"?n(`Affected-set shadow: ${(t.evaluation.recall*100).toFixed(1)}% recall; ${t.plan.affectedFiles.length} predicted, ${t.comparison.changedFiles.length} changed.`):n(`Affected-set shadow unavailable: ${t.reason}.`)}catch(r){n(`Affected-set shadow telemetry unavailable: ${r instanceof Error?r.message:String(r)}`)}}function po(e){let t=jd({mode:e.run.opts.typescriptProjectMode,skippedLanguages:e.skippedLanguages,reusedLanguages:e.reusedLanguages,context:e.typescriptProjectShardContext,metaPath:e.run.paths.metaPath});return{metadata:{version:fe,status:e.skippedLanguages.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.run.fingerprint,sqliteLayoutVersion:1,languageFingerprints:e.languageFingerprints,typescriptProjectShards:t.field,requestedLanguages:e.run.languages,indexedLanguages:e.indexedOutputs.map(n=>n.language),skipped:[...e.skippedLanguages],lastRefresh:e.lastRefresh},pruneProjects:t.pruneProjects}}function go(e){C(e.opts.signal,"Reindex cancelled by its owner.");let t=zn(e.projectRoot,e.fingerprint);if(O(t)===O(e.fingerprint))return;let n=new Map(e.fingerprint.files.map(a=>[a.path,a])),r=new Map(t.files.map(a=>[a.path,a])),i=[...new Set([...n.keys(),...r.keys()])].filter(a=>O(n.get(a))!==O(r.get(a))).slice(0,5);throw new Error(`Project inputs changed during reindex (${i.join(", ")||"unknown path"}); refusing to publish artifacts built from a different filesystem snapshot.`)}function fo(e,t,n){let r=Ke(t,e.fingerprint,n);if(r.state!=="complete")throw new Error(`${On("Candidate SQLite index",r)} Refusing to publish it.`)}function On(e,t){if(t.state==="unavailable")return`${e} document coverage could not be verified (${t.reason}); rebuilding cached language shards.`;let n=t.missingPaths.length>0?` First missing path: ${t.missingPaths[0]}.`:"";return`${e} is missing ${t.missingDocumentCount} fingerprinted source document${t.missingDocumentCount===1?"":"s"}; rebuilding affected language shards.${n}`}function jd(e){if(e.mode!=="workspace")return{field:void 0,pruneProjects:null};if(e.skippedLanguages.some(t=>t.language==="typescript"))return{field:void 0,pruneProjects:null};if(e.reusedLanguages.includes("typescript")){let t=ce(e.metaPath),n=t?.version===fe?t.typescriptProjectShards:void 0;return{field:n,pruneProjects:n?Object.keys(n):[]}}return e.context?{field:e.context.fingerprints,pruneProjects:e.context.projects}:{field:void 0,pruneProjects:[]}}function mo(e,t){let n=Io(e);if(t===null){ke(n,{recursive:!0,force:!0});return}let r;try{r=so(n)}catch{return}for(let i of Cd(r,t))ke(F(n,i),{force:!0})}function Cd(e,t){let n=new Set(t.map(r=>`${cn(r)}.scip`));return e.filter(r=>!n.has(r))}function Md(e){if(e.incrementalTypeScript?.completeScipUpdated)return[...e.indexedOutputs];let t=e.indexedOutputs.find(o=>o.language==="typescript");if(!t)return[...e.indexedOutputs];let n=J(e.run.paths.outputDb,e.run.paths.metaPath),r=n.state==="current"?n.generation.publication?.typescriptOverlayGeneration:void 0;if(!(n.state==="current"?n.generation.publication?.scipCompanion==="deferred":ce(e.run.paths.metaPath)?.scipCompanion==="deferred")||!r)return[...e.indexedOutputs];let a=Ee(e.run.tempPaths.tempOutputScip,"typescript-deferred",0);return e.run.onStatus("Materializing the deferred whole TypeScript SCIP companion for complete publication..."),xn({cacheDir:x(e.run.paths.outputDb),generationIdentity:r,baseShardPath:t.scipPath,candidateShardPath:a}),e.indexedOutputs.map(o=>o.language==="typescript"?{language:o.language,scipPath:a}:o)}function eo(e,t,n){for(let r of t){let i=Cn(e,r.language);xt(x(i),{recursive:!0}),r.scipPath!==i&&re(n,ne(r.scipPath,i))}}async function Nd(e,t){if(!Se()){if(pd()==="win32")throw new Error("The scip CLI was not found. On Windows it ships via the npm sidecar package scip-query-scip-windows (installed automatically with scip-query). Reinstall scip-query with optional dependencies enabled, or follow 'scip-query setup' guidance for the exact sidecar package version, or set SCIP_QUERY_SCIP_BIN to a local scip.exe path.");if(e)throw new Error(`The scip CLI is required but not found on PATH.
318
- To install the reviewed version, run: scip-query reindex --install-missing
319
- Or install manually from: https://github.com/sourcegraph/scip/releases`);if(t("scip CLI not found on PATH. Attempting auto-install..."),!ei(t))throw new Error(`The scip CLI is required but could not be installed.
320
- Install manually from: https://github.com/sourcegraph/scip/releases`)}}function Bd(e){let t=[],n=[],r=e.languages.map((a,o)=>({language:a,scipPath:e.languages.length>1?Ee(e.tempOutputScip,a,o):e.tempOutputScip})),i=Object.fromEntries(r.map(({language:a,scipPath:o})=>[a,o]));for(let{language:a,scipPath:o}of r){let s=$d({...e,language:a,scipPath:o});for(let c of s)"skipped"in c?ho(n,c.skipped):t.push(c.prepared)}return{preparedRuns:t,skippedLanguages:n,languageOutputScipPaths:i}}function $d(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[_n({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=e.preDiscoveredTypeScriptProjects??Y(e.projectRoot,e.typescriptProjects);return t.length===0?[_n({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})]:(e.onStatus(`Indexing TypeScript workspace as ${t.length} project shard(s).`),t.map((n,r)=>_n({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:Ee(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function _n(e){let t=Xt(e.language),n=He(t),r=pr(t,e.projectRoot),i=e.trustProjectTools&&r?gr(t,e.projectRoot):null,a=Fe(t);if(!i&&!a&&r){let l=`${n} is available only as repository-local code at ${r}. Review that exact tool and rerun with --trust-project-tools.`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}if(!i&&!a&&!dr(t)){if(e.skipAutoInstall){let l=`${n} not found on PATH. To install the reviewed version, run: scip-query reindex --install-missing${t.installUrl?` (manual source: ${t.installUrl})`:""}`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}if(e.onStatus(`${n} not found. Attempting auto-install...`),!Ia(t,e.onStatus)){let l=`${n} could not be auto-installed. ${t.installUrl?`Install manually from ${t.installUrl}`:`Install ${n} and put it on PATH.`}`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}}let o=i?.canonicalPath??Fe(t);if(!o){let l=`${n} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}let{binary:s,args:c}=t.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:o,projectPath:e.projectPath,configPath:e.language==="clojure"?e.clojureConfigPath:void 0}),u=Pi({language:e.language,projectPath:e.projectPath,pnpmWorkspaces:e.pnpmWorkspaces});if(i&&!i.executable){let l=`${i.relativePath} is not executable; refusing project-local indexer.`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}return i&&e.onStatus(`Trusted project-local ${e.language} indexer ${i.relativePath} (${i.sha256.slice(0,12)}\u2026, ${i.canonicalPath}).`),{prepared:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,config:t,resolvedBinary:o,binary:s,args:c,env:mr(t,e.env,o),...u===void 0?{}:{temporaryRootConfigContent:u},...i?{trustedProjectTool:i}:{}}}}function Vd(e,t){let n=new Map;for(let i of e)if(i.skipped)ho(t,i.skipped);else{let a=`${i.language}\0${i.outputScipPath}`,o=n.get(a)??{language:i.language,outputScipPath:i.outputScipPath,scipPaths:[]};o.scipPaths.push(i.scipPath),n.set(a,o)}let r=[];for(let i of n.values())if(i.scipPaths.length>1)Nr(i.scipPaths,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath});else{let a=i.scipPaths[0];a!==i.outputScipPath&&co(a,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath})}return{indexedOutputs:r}}function ho(e,t){let n=e.find(r=>r.language===t.language);if(!n){e.push(t);return}n.reason.includes(t.reason)||(n.reason=`${n.reason}; ${t.reason}`)}function Ud(e,t,n,r,i){if(e.length===0){let a=t.map(o=>` - ${o.language}: ${o.reason}`).join(`
321
- `);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
322
- `+a)}if(t.length!==0&&(i(`Indexed ${e.length} language output(s); skipped or incomplete: ${t.map(a=>a.language).join(", ")}.`),!r))throw new Error(`Failed to index all required languages; preserving the previous index. Pass --allow-partial to intentionally write an incomplete index.
323
- `+t.map(a=>` - ${a.language}: ${a.reason}`).join(`
324
- `))}function to(e,t,n){if(e.length>1){n(`Merging ${e.length} language indexes...`);let r=performance.now(),i=Br(e.map(a=>a.scipPath),t);return bo(i,n),n(`Merged and sanitized SCIP indexes in ${(performance.now()-r).toFixed(0)}ms.`),!0}else e[0].scipPath!==t&&co(e[0].scipPath,t);return!1}async function Gd(e){let t;if(Wd(e))try{let i=e.incrementalTypeScript.affectedBatches.length>0?e.incrementalTypeScript.affectedBatches:[{scipPath:e.incrementalTypeScript.affectedScipPath,affectedFiles:e.incrementalTypeScript.affectedFiles,deletedFiles:e.incrementalTypeScript.deletedFiles}],a=new Set,o=0,s=0;for(let[c,u]of i.entries()){let l=F(e.run.tempPaths.runDir,`typescript-affected-${c}.db`);yo(u.scipPath,e.run.onStatus),e.run.onStatus(`Converting bounded TypeScript batch ${c+1}/${i.length} (${u.affectedFiles.length-u.deletedFiles.length} emitted, ${u.deletedFiles.length} removed) to SQLite...`);let d=performance.now();await no(u.scipPath,l,e.env,e.run.onStatus,!0,e.run.opts.signal),o+=performance.now()-d,nt(e.run.writeTelemetry,se(l)??0);let p=Ti({previousDbPath:e.run.paths.outputDb,miniDbPath:l,candidateDbPath:e.run.tempPaths.tempOutputDb,affectedFiles:u.affectedFiles,deletedFiles:u.deletedFiles,reuseCandidate:c>0,deferIntegrity:c<i.length-1,trustedPriorGeneration:!0,writeTelemetry:e.run.writeTelemetry});s+=p.durationMs;for(let g of p.changedDocumentPaths)a.add(g);ke(l,{force:!0})}return e.run.onStatus(`Patched ${e.incrementalTypeScript.affectedFiles.length} SQLite document path(s) across ${i.length} bounded batch(es) in ${(s/1e3).toFixed(3)}s.`),{mode:"incremental",changedDocumentPaths:[...a].sort(),patchDurationMs:s,converterDurationMs:o,scipCompanion:e.incrementalTypeScript.completeScipUpdated?"current":"deferred"}}catch(i){if(C(e.run.opts.signal,"Reindex cancelled by its owner."),t=i instanceof Error?i.message:String(i),ke(e.run.tempPaths.tempOutputDb,{force:!0}),e.run.opts.allowExpensiveRebuild===!1)throw new Error(`Bounded incremental SQLite publication failed and the whole-project fallback is disabled: ${t}`,{cause:i});e.run.onStatus(`Incremental SQLite publication unavailable: ${t}. Falling back to complete conversion.`)}let n=e.completeScipSanitized;e.completeScipAvailable||(n=await e.materializeFullFallback());let r=performance.now();return await no(e.run.tempPaths.tempOutputScip,e.run.tempPaths.tempOutputDb,e.env,e.run.onStatus,n,e.run.opts.signal),{mode:"full",converterDurationMs:performance.now()-r,...t?{fallbackReason:t}:{}}}function Wd(e){if(!e.incrementalTypeScript||e.skippedLanguages.length>0||!j(e.run.paths.outputDb)||!j(e.run.paths.outputScip))return!1;let t=new Set(e.reusedLanguages);return e.indexedOutputs.length===e.run.languages.length&&e.run.languages.every(n=>n==="typescript"||t.has(n))}function qd(e,t){let n=P(),r=[...t].sort(),i=new Set(r),a={addedFiles:[],modifiedFiles:r,deletedFiles:[],changedFiles:r,unchangedFiles:e.affectedFiles.filter(o=>!i.has(o)).sort()};return{version:1,status:"evaluated",refreshResult:"rebuilt",recordedAt:new Date().toISOString(),durationMs:P()-n,manifest:e.manifest,plan:e.plan,comparison:a,evaluation:Ht(e.plan,a,e.projectFileCount)}}async function no(e,t,n,r,i=!1,a){if(C(a,"Reindex cancelled by its owner."),r("Converting to SQLite..."),!j(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{i||yo(e,r);let o=Se();if(!o)throw new Error("scip CLI is not available");let s=await et({command:o,args:["expt-convert","--output",t,e],label:"SCIP SQLite conversion",env:n,maxStdoutBytes:50*1024*1024,maxStderrBytes:50*1024*1024,timeoutMs:3e5,signal:a});if(s.status!==0)throw new Error(`scip expt-convert exited with ${s.status}${s.stderr.trim()?`: ${s.stderr.trim()}`:""}`)}catch(o){C(a,"Reindex cancelled by its owner.");let s=o instanceof Error?o.message:String(o);throw new Error(`Failed to convert SCIP index to SQLite: ${s}`,{cause:o})}}function yo(e,t){let n=Mr(e);bo(n,t)}function bo(e,t){e.removedDefinitionOccurrences!==0&&t(`Sanitized ${e.removedDefinitionOccurrences} invalid definition occurrences across ${e.touchedDocuments} documents before SQLite conversion.`)}function Ee(e,t,n){let r=dd(e)||".scip",i=Rt(e,r);return F(x(e),`${i}.${n+1}.${t}${r}`)}async function Jd(e,t){for(let n=0;n<2;n++){let r=Hd(e,t);if(r)return r;let i=zd(e);if(i&&xo(t.trigger,i)){t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}.`);let a;try{a=await Xd(i)}catch(s){throw new Error(`Could not verify the watcher's in-progress reindex owner (pid ${i.pid}); refusing to steal an active lock: ${oe(s)}`,{cause:s})}if(!a)throw new Error(`Could not confirm the watcher's in-progress reindex (pid ${i.pid}) terminated for ${x(e)}; refusing to steal an active lock.`);let o=Nt(e,{parseLegacy:vt});if(!Fr(e,o,{parseLegacy:vt}))throw new Error(`Reindex lock ownership changed before preemption completed for ${x(e)}.`);continue}throw new Re(`Another scip-query reindex is already running for ${x(e)}.`)}throw new Re(`Could not acquire scip-query reindex lock for ${x(e)}.`)}function Hd(e,t){let n=q(process.pid),r=Xe(e,{kind:"reindex",processIdentity:n,detail:{projectRoot:t.projectRoot,...process.env.SCIP_REINDEX_PROCESS_GROUP_LEADER==="1"?{processGroupLeader:!0}:{},...t.trigger?{trigger:t.trigger}:{}},parseLegacy:vt});if(r.kind==="acquired"&&r.reclaimed){let i=So(r.reclaimed,e);i&&xo(t.trigger,i)?t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}; its prior owner was already stale.`):t.onStatus(`Recovered an abandoned or incomplete reindex lock for ${x(e)}.`)}return r.kind==="acquired"?()=>{r.lock.release()}:null}function zd(e){return So(Nt(e,{parseLegacy:vt}),e)}var vt=e=>{let t=Ro(e,"");return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function So(e,t){if(e.state==="valid"&&e.record?.kind==="reindex"){let n=e.record.detail??{};return{version:2,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},...n.processGroupLeader===!0?{processGroupLeader:!0}:{},projectRoot:typeof n.projectRoot=="string"?n.projectRoot:x(t),startedAt:e.record.startedAt,trigger:n.trigger}}return Ro(e.parsed,t)}function Ro(e,t){try{let n=e;return typeof n.pid!="number"||!Number.isInteger(n.pid)||n.pid<=0?null:{version:n.version===2?2:1,pid:n.pid,...n.processIdentity===void 0?{}:(()=>{let r=hr(n.processIdentity);return r?.pid===n.pid?{processIdentity:r}:{}})(),...n.processGroupLeader===!0?{processGroupLeader:!0}:{},projectRoot:typeof n.projectRoot=="string"?n.projectRoot:x(t),startedAt:typeof n.startedAt=="string"?n.startedAt:"unknown",trigger:n.trigger}}catch{return null}}function xo(e,t){return e?.kind==="manual-cli"&&vo(t?.trigger)}function vo(e){return e?.kind==="watch-source"||e?.kind==="watch-git-head"||e?.kind==="watch-git-index"||e?.kind==="watch-git-state"}async function Xd(e){return!ye(e.pid)||(Dn(e),ro(e,"SIGTERM"),await io(e,2e3))?!0:(Dn(e),ro(e,"SIGKILL"),io(e,1e3))}function ro(e,t){if(e.processGroupLeader)try{process.kill(-e.pid,t);return}catch{if(!ye(e.pid))return;Dn(e)}try{process.kill(e.pid,t)}catch{}}async function io(e,t){let n=P()+t;for(;P()<n;){if(ao(e))return!0;await Kd(50)}return ao(e)}function Dn(e){if(!e.processIdentity)throw new Error(`Refusing to signal reindex pid ${e.pid}: its ownership record has no process identity.`);let t=q(e.pid);if(!t)throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity is unavailable.`);if(!Ae(e.processIdentity,t))throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity does not match the ownership record.`)}function ao(e){if(!ye(e.pid))return!0;if(!e.processIdentity)return!1;let t=q(e.pid);return t!==null&&!Ae(e.processIdentity,t)}function Kd(e){return new Promise(t=>setTimeout(t,e))}function jn(e,t,n){return Object.fromEntries(t.map(r=>{let i=r==="typescript"?Wn(n.typescriptProjects):[],a=r==="clojure"?Qd(n.clojureConfigPath):void 0,o=[...Xt(r).markerFiles,...i,...a?[a]:[]],s=r==="typescript"?{typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:i}:{typescriptProjectMode:"single",typescriptProjects:[]};return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&&Zd(n),...s,clojureConfigPath:a,files:e.files.filter(c=>Bn(c.path,r,o)).map(c=>Po(c,r))}]}))}function Po(e,t){let n=t==="typescript"&&/(?:^|\/)package\.json$/iu.test(e.path)?e.semanticHash:void 0;return{path:e.path,size:n===void 0?e.size:0,hash:n??e.hash}}function Yd(e,t){let n=Tt(t);if(!n)return t;let r=n.typescriptProjectMode==="workspace"?Y(e,n.typescriptProjects):["."],i=pe(r);return{...n,files:n.files.filter(a=>!ge(a.path)||i.has(a.path)).map(a=>{let o=a.semanticHash??Ge(e,a.path,a.hash);return Po(o===void 0?a:{...a,semanticHash:o},"typescript")})}}function Qd(e){return e?.trim()||void 0}function Zd(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function Cn(e,t){return F(x(e),"language-indexes",`${t}.scip`)}function Io(e){return F(x(e),"language-indexes","typescript-projects")}function It(e,t){return F(Io(e),`${cn(t)}.scip`)}function ce(e){try{return We(Q(B(e,"reindex metadata")))}catch{return null}}function wo(e,t){try{let n=Q(B(e,"reindex metadata"));if(n.kind!=="legacy"&&n.kind!=="supported")return null;let r=n.metadata;return!n.capabilities.publishableGeneration||!Qn(r)||O([...r.indexedLanguages??[]].sort())!==O(t.languages)?null:O(r.fingerprint)===O(t)?"exact":O(oo(r.fingerprint))===O(oo(t))?"operational-config-compatible":null}catch{return null}}function oo(e){if(typeof e!="object"||e===null||Array.isArray(e))return e;let t=e;return Array.isArray(t.files)?{...t,files:t.files.filter(n=>typeof n!="object"||n===null||Array.isArray(n)||n.path!==".scipquery.json")}:e}function ep(e,t,n,r){let i=We(Q(B(e,"reindex metadata")));i&&wt(e,{...i,fingerprint:t,...i.version===fe?{languageFingerprints:jn(t,n,r)}:{}})}function wt(e,t){br(e,t,{spacing:2,trailingNewline:!0})}function ko(e,t){try{let n=We(Q(B(e,"reindex metadata")));if(!n)return;wt(e,{...n,lastRefresh:t})}catch{}}function kt(e){return{trigger:e.trigger??{kind:"unknown"},result:e.result,startedAt:new Date(e.start).toISOString(),completedAt:new Date().toISOString(),durationMs:P()-e.monotonicStart,indexedLanguages:e.languages?[...e.languages]:void 0,skipped:e.skipped?[...e.skipped]:void 0,error:e.error}}function O(e){return JSON.stringify(e)}function wh(e,t,n,r){return uo({projectRoot:e,languages:r.languages?.length?r.languages:t.languages,outputScip:n.indexPath,outputDb:n.dbPath,pnpmWorkspaces:t.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:t.indexer?.typescript?.projectMode,typescriptProjects:t.indexer?.typescript?.projects,maxHeapMb:t.indexer?.typescript?.maxHeapMb,clojureConfigPath:t.indexer?.clojure?.configPath,skipIfUnchanged:r.force!==!0,allowPartial:r.allowPartial===!0,allowExpensiveRebuild:r.allowExpensiveRebuild===!0,skipAutoInstall:r.skipAutoInstall===!0,installMissing:r.installMissing===!0,trustProjectTools:r.trustProjectTools===!0,indexerConcurrency:r.indexerConcurrency??t.indexerConcurrency,trigger:r.trigger,...r.onStatus?{onStatus:r.onStatus}:{}})}export{op as a,sp as b,ri as c,Hp as d,zp as e,Xt as f,gc as g,Rg as h,bc as i,xg as j,V as k,ra as l,tu as m,Ia as n,Gl as o,uo as p,wh as q};
325
- //# sourceMappingURL=chunk-O2VY47Y5.js.map