codebaseiq 0.1.0 → 0.2.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 (422) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-DQMDCD24.js → chunk-27PHVDKL.js} +2 -2
  4. package/dist/{chunk-ZMI2JSX2.js → chunk-2DMVFAY7.js} +2 -2
  5. package/dist/{chunk-5PUWMSDU.js → chunk-2E6BTWER.js} +2 -2
  6. package/dist/{chunk-YESXMKX3.js → chunk-2F5ERMNI.js} +2 -2
  7. package/dist/chunk-2VKB5CMA.js +60 -0
  8. package/dist/{chunk-NNJ2KZZG.js → chunk-327YK6TB.js} +4 -4
  9. package/dist/chunk-347TXATM.js +2 -0
  10. package/dist/{chunk-VEXUL62T.js → chunk-35YYZD3D.js} +2 -2
  11. package/dist/chunk-36WRYYTE.js +3 -0
  12. package/dist/chunk-37TKC6MB.js +2 -0
  13. package/dist/{chunk-FAJQ7LWY.js → chunk-3AC56WAR.js} +2 -2
  14. package/dist/{chunk-JE3WZ6II.js → chunk-3NUZVLR7.js} +2 -2
  15. package/dist/{chunk-UZGZB3VB.js → chunk-3XFJUWJE.js} +2 -2
  16. package/dist/{chunk-OVTS4DKB.js → chunk-4AOOSCZ7.js} +2 -2
  17. package/dist/{chunk-LU3BMVH2.js → chunk-4IFISPQW.js} +2 -2
  18. package/dist/chunk-4NHWNAWQ.js +11 -0
  19. package/dist/chunk-4O52YNKL.js +5 -0
  20. package/dist/{chunk-HPJRBHVT.js → chunk-54K6556S.js} +2 -2
  21. package/dist/{chunk-HRWGYWRJ.js → chunk-57GCCPLS.js} +2 -2
  22. package/dist/{chunk-J77SU6VA.js → chunk-57KEZDPT.js} +2 -2
  23. package/dist/{chunk-OFBE4NGP.js → chunk-57KFVPVZ.js} +2 -2
  24. package/dist/{chunk-WOQBZPIF.js → chunk-5BDK6QC3.js} +2 -2
  25. package/dist/{chunk-7MGU3HPH.js → chunk-5IO2APSS.js} +2 -2
  26. package/dist/chunk-5NJPH3QZ.js +61 -0
  27. package/dist/{chunk-GW6Z3WGY.js → chunk-5WXOEJ4G.js} +2 -2
  28. package/dist/chunk-5XEVXVTK.js +3 -0
  29. package/dist/{chunk-RR7SX44N.js → chunk-6OVNYYY4.js} +2 -2
  30. package/dist/{chunk-ZV3JV5G5.js → chunk-6SDEQTVY.js} +2 -2
  31. package/dist/{chunk-EF2R3WNQ.js → chunk-6URCE5QY.js} +2 -2
  32. package/dist/{chunk-UCD3H3UZ.js → chunk-6ZV5EDUT.js} +2 -2
  33. package/dist/{chunk-C6SBF2WH.js → chunk-77GHPR2R.js} +2 -2
  34. package/dist/{chunk-YVCIMIOC.js → chunk-7R64XY4Y.js} +2 -2
  35. package/dist/{chunk-VXYS3FZD.js → chunk-7Z7HCZ7J.js} +2 -2
  36. package/dist/{chunk-CO5R3UNA.js → chunk-A67HT5FR.js} +2 -2
  37. package/dist/{chunk-UDS562V4.js → chunk-A7XQT7MH.js} +2 -2
  38. package/dist/{chunk-RDBI2RXU.js → chunk-ACZDU5GK.js} +2 -2
  39. package/dist/{chunk-FETNQCFO.js → chunk-AM5SUGHF.js} +2 -2
  40. package/dist/{chunk-NNOKTMZT.js → chunk-B2E3HZ2A.js} +2 -2
  41. package/dist/{chunk-CVYSU6BX.js → chunk-BH5CE4LN.js} +2 -2
  42. package/dist/chunk-BLKYYQ7C.js +543 -0
  43. package/dist/{chunk-4WKDMDEW.js → chunk-BX2U3QQV.js} +2 -2
  44. package/dist/{chunk-ZKX2FRS6.js → chunk-CANBLFVQ.js} +2 -2
  45. package/dist/{chunk-SMRBZ6EC.js → chunk-CCRZLRWJ.js} +2 -2
  46. package/dist/chunk-CDWSLAPN.js +21 -0
  47. package/dist/chunk-CIVYHK7U.js +22 -0
  48. package/dist/{chunk-L57ZKWVG.js → chunk-CMXW7MFV.js} +2 -2
  49. package/dist/{chunk-T3DGWPXM.js → chunk-CSZOQ7YO.js} +2 -2
  50. package/dist/{chunk-ZZXSWSN6.js → chunk-CWMHWD56.js} +2 -2
  51. package/dist/{chunk-6NW7MU72.js → chunk-CZEIHYMP.js} +2 -2
  52. package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
  53. package/dist/{chunk-XWUOUWYI.js → chunk-DFPAZXLU.js} +2 -2
  54. package/dist/{chunk-MOVBWNIP.js → chunk-DKJXK3HA.js} +2 -2
  55. package/dist/{chunk-XMQ23E27.js → chunk-DLC6JDN7.js} +2 -2
  56. package/dist/chunk-DUKHVPU5.js +4 -0
  57. package/dist/{chunk-ID63777H.js → chunk-DVYG3JTA.js} +2 -2
  58. package/dist/{chunk-NE6IU5ZD.js → chunk-EFFMFK7C.js} +2 -2
  59. package/dist/{chunk-I2T2LLK2.js → chunk-EM5UHLAM.js} +2 -2
  60. package/dist/chunk-EN4AHLL3.js +3 -0
  61. package/dist/chunk-EXMVF3JR.js +3 -0
  62. package/dist/{chunk-SWHMHUKF.js → chunk-FEBLLMTL.js} +2 -2
  63. package/dist/chunk-FIXYHQ3W.js +3 -0
  64. package/dist/{chunk-RKEJ6VTF.js → chunk-FLLXYUOL.js} +2 -2
  65. package/dist/{chunk-KWVHSKHK.js → chunk-FPDL2TUB.js} +2 -2
  66. package/dist/chunk-FQA3KIFX.js +17 -0
  67. package/dist/chunk-FWY2PRIF.js +3 -0
  68. package/dist/chunk-FY5V4V4F.js +2 -0
  69. package/dist/chunk-G2XUZCF2.js +88 -0
  70. package/dist/{chunk-QHRNXP3C.js → chunk-GXVDTHFC.js} +2 -2
  71. package/dist/{chunk-6MUIJMVL.js → chunk-H3CKAL6P.js} +2 -2
  72. package/dist/chunk-H5QXP63L.js +2 -0
  73. package/dist/{chunk-VUIYB2V3.js → chunk-HBQGKMM3.js} +2 -2
  74. package/dist/{chunk-PYAB5SM6.js → chunk-HBXZAGY6.js} +2 -2
  75. package/dist/{chunk-NNO6A2PO.js → chunk-HCMQZPEO.js} +2 -2
  76. package/dist/{chunk-Q65CQ4XL.js → chunk-HHBBGWES.js} +2 -2
  77. package/dist/{chunk-GTXSJDCO.js → chunk-HIEXRDJF.js} +2 -2
  78. package/dist/{chunk-4FC325IF.js → chunk-HYKSLTAR.js} +2 -2
  79. package/dist/{chunk-XLQ3GLWZ.js → chunk-I2KP4AGR.js} +2 -2
  80. package/dist/chunk-I5FCDTK2.js +2 -0
  81. package/dist/{chunk-QKPLA6IC.js → chunk-I645ZF75.js} +2 -2
  82. package/dist/{chunk-FDGD5AB5.js → chunk-IBM3F2BJ.js} +2 -2
  83. package/dist/{chunk-Q72QSKXC.js → chunk-IEL6Q5W3.js} +38 -38
  84. package/dist/{chunk-NCZUNH3E.js → chunk-IGQQUENU.js} +12 -12
  85. package/dist/chunk-IGYAZPRX.js +4 -0
  86. package/dist/chunk-IOVPAZWP.js +3 -0
  87. package/dist/{chunk-OL6KJP3N.js → chunk-IVJJNVSX.js} +2 -2
  88. package/dist/{chunk-AKB7V7TV.js → chunk-IWAMYGPN.js} +2 -2
  89. package/dist/chunk-IYBIBMPF.js +90 -0
  90. package/dist/{chunk-IOP6FWIM.js → chunk-J24VICI5.js} +2 -2
  91. package/dist/{chunk-C7QOQX32.js → chunk-JN5LIBT3.js} +2 -2
  92. package/dist/{chunk-O6QTXQPJ.js → chunk-JOALNFY3.js} +2 -2
  93. package/dist/{chunk-GCHRX4YW.js → chunk-JUO3Z644.js} +2 -2
  94. package/dist/{chunk-BJ6SQAEN.js → chunk-JXHLB7TP.js} +2 -2
  95. package/dist/{chunk-IJ4HMYBE.js → chunk-JYX5UZSZ.js} +2 -2
  96. package/dist/chunk-K2O7SBAU.js +2 -0
  97. package/dist/{chunk-OLF4MA5W.js → chunk-K5G7SPAG.js} +2 -2
  98. package/dist/{chunk-YSNONTJ2.js → chunk-KDYQQJ6X.js} +2 -2
  99. package/dist/{chunk-7NVGT435.js → chunk-KM4QRWI5.js} +2 -2
  100. package/dist/{chunk-HKQUXIFO.js → chunk-KNV5VFDV.js} +2 -2
  101. package/dist/chunk-L3YSDLNB.js +2 -0
  102. package/dist/{chunk-EZNMUY67.js → chunk-LAGDJXFY.js} +2 -2
  103. package/dist/{chunk-ENCCHKM6.js → chunk-LY2NB5XR.js} +4 -4
  104. package/dist/chunk-M4EVGA5S.js +14 -0
  105. package/dist/chunk-M7LAIM77.js +127 -0
  106. package/dist/{chunk-BVAJLC5A.js → chunk-MRGTCMDK.js} +2 -2
  107. package/dist/{chunk-OZYRSMSH.js → chunk-MT5W4DUG.js} +2 -2
  108. package/dist/{chunk-VE5AVNMP.js → chunk-MTMF4N7F.js} +2 -2
  109. package/dist/chunk-N3Q3AWGW.js +545 -0
  110. package/dist/{chunk-TXXOEMZJ.js → chunk-NDGTJHQN.js} +2 -2
  111. package/dist/chunk-NIO346UL.js +2 -0
  112. package/dist/chunk-NJA4MMBD.js +2 -0
  113. package/dist/{chunk-7FND7D7N.js → chunk-NK76RSB6.js} +2 -2
  114. package/dist/{chunk-H3LGFZVK.js → chunk-NTRW52UR.js} +2 -2
  115. package/dist/{chunk-JOIRNPPY.js → chunk-OJFLPVBP.js} +2 -2
  116. package/dist/{chunk-KMITESMT.js → chunk-OMBRP7BB.js} +2 -2
  117. package/dist/{chunk-UP3BUZR5.js → chunk-OVKZM2XI.js} +2 -2
  118. package/dist/{chunk-MVB3DAEY.js → chunk-PARCKE3Q.js} +2 -2
  119. package/dist/{chunk-CAUCPUOF.js → chunk-PFPHS4NO.js} +2 -2
  120. package/dist/chunk-PHPQ24UG.js +22 -0
  121. package/dist/chunk-PLZXWZHY.js +77 -0
  122. package/dist/{chunk-34WBMAYK.js → chunk-PNVZIJ57.js} +2 -2
  123. package/dist/{chunk-SYDJMPES.js → chunk-QKVTWODE.js} +2 -2
  124. package/dist/{chunk-FW53T7EB.js → chunk-QLTFXVUI.js} +2 -2
  125. package/dist/{chunk-PBI2LFKH.js → chunk-QMGWSEPL.js} +2 -2
  126. package/dist/{chunk-CQP3THUZ.js → chunk-QVHZB75Z.js} +2 -2
  127. package/dist/{chunk-6BQ3DSPK.js → chunk-QVWDQTMG.js} +2 -2
  128. package/dist/{chunk-ST7V3SKN.js → chunk-RCPZOPV6.js} +2 -2
  129. package/dist/chunk-RJWAB4VR.js +345 -0
  130. package/dist/chunk-RRPK327J.js +20 -0
  131. package/dist/chunk-RVYLJDXC.js +21 -0
  132. package/dist/chunk-RWKEXCHU.js +3 -0
  133. package/dist/{chunk-L4NRUAGJ.js → chunk-S5SKXCND.js} +2 -2
  134. package/dist/{chunk-RBAS5ZHI.js → chunk-S64NCE2Z.js} +2 -2
  135. package/dist/{chunk-WMPRTGH2.js → chunk-SF34QLK2.js} +2 -2
  136. package/dist/{chunk-ANFVSJWQ.js → chunk-SJZQ2PTZ.js} +2 -2
  137. package/dist/{chunk-4XTAUQFD.js → chunk-SRY26ITJ.js} +2 -2
  138. package/dist/chunk-SV2LEFVM.js +2 -0
  139. package/dist/{chunk-7XAN6GKB.js → chunk-T3YFIJ5P.js} +2 -2
  140. package/dist/chunk-T55YPJGB.js +3 -0
  141. package/dist/chunk-TAJ6UGCO.js +21 -0
  142. package/dist/{chunk-PIOMTC27.js → chunk-TUTSO7UZ.js} +2 -2
  143. package/dist/{chunk-FQKZWM4L.js → chunk-U24M5RQM.js} +5 -5
  144. package/dist/{chunk-XME3HPXZ.js → chunk-U2XX3BT4.js} +2 -2
  145. package/dist/{chunk-SZD2KF7Q.js → chunk-UWB5WMC2.js} +2 -2
  146. package/dist/{chunk-6CS3UQTN.js → chunk-VCL7FK3E.js} +2 -2
  147. package/dist/{chunk-N3IQCBCF.js → chunk-VCWAJPXQ.js} +2 -2
  148. package/dist/{chunk-LZYFLFEH.js → chunk-VG55NFXF.js} +2 -2
  149. package/dist/{chunk-PTAWHLVJ.js → chunk-VLTUX4IF.js} +2 -2
  150. package/dist/{chunk-JEJLSICM.js → chunk-VVCBMH5O.js} +2 -2
  151. package/dist/{chunk-JSOYNVWH.js → chunk-VYZQZ4ZN.js} +2 -2
  152. package/dist/chunk-W3FK73MD.js +8 -0
  153. package/dist/{chunk-UNBY47BC.js → chunk-W6C6QTXJ.js} +2 -2
  154. package/dist/chunk-WH5SYOMD.js +2 -0
  155. package/dist/chunk-WJOQC4P7.js +7 -0
  156. package/dist/chunk-WO47BIPY.js +3 -0
  157. package/dist/chunk-WOOTEWQT.js +239 -0
  158. package/dist/{chunk-UBGWN7I4.js → chunk-X5I2BQGX.js} +2 -2
  159. package/dist/{chunk-PX4RYAAK.js → chunk-XNUWRTYM.js} +2 -2
  160. package/dist/{chunk-ICFDQHAM.js → chunk-XUJM6474.js} +2 -2
  161. package/dist/chunk-XYLV727H.js +21 -0
  162. package/dist/{chunk-TRRC4ZJ7.js → chunk-YFQPWKHR.js} +2 -2
  163. package/dist/{chunk-NEDP5RFQ.js → chunk-YIOQJ45A.js} +2 -2
  164. package/dist/{chunk-Y6KHROC3.js → chunk-YXJ4IAHH.js} +2 -2
  165. package/dist/chunk-YYFV32WR.js +3 -0
  166. package/dist/{chunk-BH5F2Q4O.js → chunk-ZB3V5QM7.js} +2 -2
  167. package/dist/chunk-ZJZQ7Q2Q.js +3 -0
  168. package/dist/{chunk-EMNIHCRB.js → chunk-ZNQCR656.js} +2 -2
  169. package/dist/{chunk-TIIC3ZE7.js → chunk-ZOEDRCR4.js} +2 -2
  170. package/dist/cli-context-TSADTXLB.js +2 -0
  171. package/dist/cli-context-XEPPF4RX.js +3 -0
  172. package/dist/cli-program-KJGQEM72.js +7 -0
  173. package/dist/cli.js +1 -1
  174. package/dist/{code-DlqpBDd0.d.ts → code-CDe-mIjx.d.ts} +1 -1
  175. package/dist/code-viewer-YGDON6SY.js +12 -0
  176. package/dist/code-viewer-ZCTHXQ5C.js +11 -0
  177. package/dist/command-descriptors-5VAB2MZX.js +335 -0
  178. package/dist/command-descriptors-EAHKIRAG.js +337 -0
  179. package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
  180. package/dist/{db-D7sauVFH.d.ts → db-DmRNdCtm.d.ts} +1 -1
  181. package/dist/direct-navigation-B3SGOOBW.js +2 -0
  182. package/dist/direct-navigation-ZL362KXF.js +3 -0
  183. package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-Bs54NWws.d.ts} +1 -1
  184. package/dist/{health-DJaZXg8I.d.ts → health-BnzbSLCE.d.ts} +1 -1
  185. package/dist/index.d.ts +2 -2
  186. package/dist/index.js +1 -1
  187. package/dist/invocation-command-descriptors-CSUGUHTT.js +2 -0
  188. package/dist/invocation-command-descriptors-PPVZOIE5.js +3 -0
  189. package/dist/output-continuation-command-FTVVBVSN.js +2 -0
  190. package/dist/output-continuation-command-ITPRC3YV.js +3 -0
  191. package/dist/project-reindex-7HZSLLLY.js +3 -0
  192. package/dist/project-reindex-NGM3DYBN.js +2 -0
  193. package/dist/queries/affected.d.ts +2 -2
  194. package/dist/queries/affected.js +1 -1
  195. package/dist/queries/anchors.d.ts +2 -2
  196. package/dist/queries/anchors.js +1 -1
  197. package/dist/queries/architecture.d.ts +2 -2
  198. package/dist/queries/architecture.js +1 -1
  199. package/dist/queries/bottlenecks.d.ts +2 -2
  200. package/dist/queries/bottlenecks.js +1 -1
  201. package/dist/queries/by-kind.d.ts +2 -2
  202. package/dist/queries/by-kind.js +1 -1
  203. package/dist/queries/call-graph.d.ts +2 -2
  204. package/dist/queries/call-graph.js +1 -1
  205. package/dist/queries/change-surface.d.ts +2 -2
  206. package/dist/queries/change-surface.js +1 -1
  207. package/dist/queries/cleanup-plan.d.ts +2 -2
  208. package/dist/queries/cleanup-plan.js +1 -1
  209. package/dist/queries/co-change.d.ts +2 -2
  210. package/dist/queries/co-change.js +1 -1
  211. package/dist/queries/code.d.ts +3 -3
  212. package/dist/queries/code.js +1 -1
  213. package/dist/queries/complexity-hotspots.d.ts +2 -2
  214. package/dist/queries/complexity-hotspots.js +1 -1
  215. package/dist/queries/complexity.d.ts +2 -2
  216. package/dist/queries/complexity.js +1 -1
  217. package/dist/queries/context.d.ts +2 -2
  218. package/dist/queries/context.js +1 -1
  219. package/dist/queries/convergence.d.ts +2 -2
  220. package/dist/queries/convergence.js +1 -1
  221. package/dist/queries/coupling.d.ts +2 -2
  222. package/dist/queries/coupling.js +1 -1
  223. package/dist/queries/cycles.d.ts +2 -2
  224. package/dist/queries/cycles.js +1 -1
  225. package/dist/queries/dataflow.d.ts +2 -2
  226. package/dist/queries/dataflow.js +1 -1
  227. package/dist/queries/dead.d.ts +2 -2
  228. package/dist/queries/dead.js +1 -1
  229. package/dist/queries/decorative-checkers.d.ts +2 -2
  230. package/dist/queries/decorative-checkers.js +1 -1
  231. package/dist/queries/deep-chains.d.ts +2 -2
  232. package/dist/queries/deep-chains.js +1 -1
  233. package/dist/queries/dependence-slice.d.ts +3 -3
  234. package/dist/queries/dependence-slice.js +1 -1
  235. package/dist/queries/dependency-depth.d.ts +2 -2
  236. package/dist/queries/dependency-depth.js +1 -1
  237. package/dist/queries/deps.d.ts +2 -2
  238. package/dist/queries/deps.js +1 -1
  239. package/dist/queries/diff-impact.d.ts +2 -2
  240. package/dist/queries/diff-impact.js +1 -1
  241. package/dist/queries/doc-drift.d.ts +2 -2
  242. package/dist/queries/doc-drift.js +1 -1
  243. package/dist/queries/drift.d.ts +2 -2
  244. package/dist/queries/drift.js +1 -1
  245. package/dist/queries/duplicate-bodies.d.ts +2 -2
  246. package/dist/queries/duplicate-bodies.js +1 -1
  247. package/dist/queries/entry-map.d.ts +2 -2
  248. package/dist/queries/entry-map.js +1 -1
  249. package/dist/queries/evidence.d.ts +3 -3
  250. package/dist/queries/evidence.js +1 -1
  251. package/dist/queries/extract-candidates.d.ts +2 -2
  252. package/dist/queries/extract-candidates.js +1 -1
  253. package/dist/queries/fan.d.ts +2 -2
  254. package/dist/queries/fan.js +1 -1
  255. package/dist/queries/files.d.ts +2 -2
  256. package/dist/queries/files.js +1 -1
  257. package/dist/queries/health.d.ts +3 -3
  258. package/dist/queries/health.js +1 -1
  259. package/dist/queries/hierarchy.d.ts +2 -2
  260. package/dist/queries/hierarchy.js +1 -1
  261. package/dist/queries/hotspots.d.ts +2 -2
  262. package/dist/queries/hotspots.js +1 -1
  263. package/dist/queries/imports.d.ts +2 -2
  264. package/dist/queries/imports.js +1 -1
  265. package/dist/queries/incomplete-migration.d.ts +2 -2
  266. package/dist/queries/incomplete-migration.js +1 -1
  267. package/dist/queries/index.d.ts +5 -5
  268. package/dist/queries/index.js +1 -1
  269. package/dist/queries/isolated.d.ts +2 -2
  270. package/dist/queries/isolated.js +1 -1
  271. package/dist/queries/locality-candidates.d.ts +2 -2
  272. package/dist/queries/locality-candidates.js +1 -1
  273. package/dist/queries/members.d.ts +2 -2
  274. package/dist/queries/members.js +1 -1
  275. package/dist/queries/methods.d.ts +2 -2
  276. package/dist/queries/methods.js +1 -1
  277. package/dist/queries/not-implemented.d.ts +2 -2
  278. package/dist/queries/not-implemented.js +1 -1
  279. package/dist/queries/outline.d.ts +2 -2
  280. package/dist/queries/outline.js +1 -1
  281. package/dist/queries/passthrough-candidates.d.ts +2 -2
  282. package/dist/queries/passthrough-candidates.js +1 -1
  283. package/dist/queries/plan-context.d.ts +2 -2
  284. package/dist/queries/plan-context.js +1 -1
  285. package/dist/queries/react-component-duplicates.d.ts +2 -2
  286. package/dist/queries/react-component-duplicates.js +1 -1
  287. package/dist/queries/react-hook-candidates.d.ts +2 -2
  288. package/dist/queries/react-hook-candidates.js +1 -1
  289. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  290. package/dist/queries/react-large-component-pressure.js +1 -1
  291. package/dist/queries/recent-duplicates.d.ts +2 -2
  292. package/dist/queries/recent-duplicates.js +1 -1
  293. package/dist/queries/redundant-reexports.d.ts +2 -2
  294. package/dist/queries/redundant-reexports.js +1 -1
  295. package/dist/queries/reference-neighborhood.d.ts +2 -2
  296. package/dist/queries/reference-neighborhood.js +1 -1
  297. package/dist/queries/reference-reachability.d.ts +2 -2
  298. package/dist/queries/reference-reachability.js +1 -1
  299. package/dist/queries/refs.d.ts +2 -2
  300. package/dist/queries/refs.js +1 -1
  301. package/dist/queries/self-audit.d.ts +2 -2
  302. package/dist/queries/self-audit.js +1 -1
  303. package/dist/queries/similar-chains.d.ts +2 -2
  304. package/dist/queries/similar-chains.js +1 -1
  305. package/dist/queries/similar-files.d.ts +2 -2
  306. package/dist/queries/similar-files.js +1 -1
  307. package/dist/queries/similar-signatures.d.ts +2 -2
  308. package/dist/queries/similar-signatures.js +1 -1
  309. package/dist/queries/similar.d.ts +2 -2
  310. package/dist/queries/similar.js +1 -1
  311. package/dist/queries/slice.d.ts +2 -2
  312. package/dist/queries/slice.js +1 -1
  313. package/dist/queries/source-inspection.d.ts +4 -4
  314. package/dist/queries/source-inspection.js +1 -1
  315. package/dist/queries/source-search.d.ts +2 -2
  316. package/dist/queries/source-search.js +1 -1
  317. package/dist/queries/stale-abstractions.d.ts +2 -2
  318. package/dist/queries/stale-abstractions.js +1 -1
  319. package/dist/queries/stats.d.ts +2 -2
  320. package/dist/queries/surface.d.ts +2 -2
  321. package/dist/queries/surface.js +1 -1
  322. package/dist/queries/symbols.d.ts +2 -2
  323. package/dist/queries/symbols.js +1 -1
  324. package/dist/queries/system-map.d.ts +2 -2
  325. package/dist/queries/system-map.js +1 -1
  326. package/dist/queries/system.d.ts +2 -2
  327. package/dist/queries/system.js +1 -1
  328. package/dist/queries/test-quality.d.ts +2 -2
  329. package/dist/queries/test-quality.js +1 -1
  330. package/dist/queries/trace.d.ts +2 -2
  331. package/dist/queries/trace.js +1 -1
  332. package/dist/queries/twin-ab.d.ts +2 -2
  333. package/dist/queries/twin-ab.js +1 -1
  334. package/dist/queries/twin-drift.d.ts +2 -2
  335. package/dist/queries/twin-drift.js +1 -1
  336. package/dist/queries/unused-imports.d.ts +2 -2
  337. package/dist/queries/unused-imports.js +1 -1
  338. package/dist/queries/unused-params.d.ts +2 -2
  339. package/dist/queries/unused-params.js +1 -1
  340. package/dist/queries/value-flow.d.ts +3 -3
  341. package/dist/queries/value-flow.js +1 -1
  342. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  343. package/dist/queries/vue-component-duplicates.js +1 -1
  344. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  345. package/dist/queries/vue-composable-candidates.js +1 -1
  346. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  347. package/dist/queries/vue-large-view-pressure.js +1 -1
  348. package/dist/queries/wrapper-candidates.d.ts +2 -2
  349. package/dist/queries/wrapper-candidates.js +1 -1
  350. package/dist/reindex-worker.js +1 -1
  351. package/dist/reindex.d.ts +3 -3
  352. package/dist/reindex.js +31 -31
  353. package/dist/runtime.d.ts +24 -4
  354. package/dist/runtime.js +3 -3
  355. package/dist/rust-semantic-session-server.js +1 -1
  356. package/dist/rust-semantic-session-worker.js +1 -1
  357. package/dist/rust-semantic-worker.js +1 -1
  358. package/dist/{scip-cli-B7N3haxa.d.ts → scip-cli-BRFKkHQn.d.ts} +1 -1
  359. package/dist/sentinel-ensure-command-KYYULCFU.js +2 -0
  360. package/dist/sentinel-ensure-command-RIZA3RY7.js +3 -0
  361. package/dist/sentinel-hook.js +39 -0
  362. package/dist/sentinel-worker.js +16 -0
  363. package/dist/typescript-mailbox-worker.js +1 -1
  364. package/dist/watch-server.js +6 -6
  365. package/docs/COMMAND_REFERENCE.md +5 -3
  366. package/docs/schemas/project-config.schema.json +159 -0
  367. package/package.json +9 -5
  368. package/skills/codebaseiq/SKILL.md +1 -1
  369. package/skills/concrete-plan/SKILL.md +1 -1
  370. package/ui/view/api.js +450 -0
  371. package/ui/view/app.js +394 -0
  372. package/ui/view/builder.js +323 -0
  373. package/ui/view/file-panel.js +170 -0
  374. package/ui/view/focus.js +379 -0
  375. package/ui/view/index.html +54 -0
  376. package/ui/view/map.js +424 -0
  377. package/ui/view/styles.css +1125 -0
  378. package/dist/chunk-2X7V4HS4.js +0 -88
  379. package/dist/chunk-3IER7Q6H.js +0 -12
  380. package/dist/chunk-3JSXXYTZ.js +0 -345
  381. package/dist/chunk-476NR5B7.js +0 -2
  382. package/dist/chunk-5VKBFZZU.js +0 -3
  383. package/dist/chunk-ADTBPVUZ.js +0 -21
  384. package/dist/chunk-BFFZDZQV.js +0 -2
  385. package/dist/chunk-BMYOV5GP.js +0 -77
  386. package/dist/chunk-C74PPYLA.js +0 -3
  387. package/dist/chunk-CWONGW6P.js +0 -3
  388. package/dist/chunk-DDZ7VHWV.js +0 -20
  389. package/dist/chunk-DR2LURYU.js +0 -3
  390. package/dist/chunk-ECQBG7PW.js +0 -564
  391. package/dist/chunk-FM5BPL4V.js +0 -60
  392. package/dist/chunk-G6XFR4ZL.js +0 -4
  393. package/dist/chunk-GTIYTDRE.js +0 -562
  394. package/dist/chunk-HOA5YGOH.js +0 -3
  395. package/dist/chunk-KUW32IRO.js +0 -2
  396. package/dist/chunk-LTA3BRZX.js +0 -2
  397. package/dist/chunk-NAUD7LCA.js +0 -2
  398. package/dist/chunk-OGTFJ3XD.js +0 -2
  399. package/dist/chunk-Q5ELPRKQ.js +0 -2
  400. package/dist/chunk-QCN62RTF.js +0 -3
  401. package/dist/chunk-QW7EP6WI.js +0 -21
  402. package/dist/chunk-RU65DDUP.js +0 -215
  403. package/dist/chunk-SELM5MER.js +0 -2
  404. package/dist/chunk-SNNWPCN7.js +0 -4
  405. package/dist/chunk-TFZB6XTM.js +0 -239
  406. package/dist/chunk-UXM43C7T.js +0 -3
  407. package/dist/chunk-VFY6Y2H6.js +0 -61
  408. package/dist/chunk-WE5RZHZ7.js +0 -5
  409. package/dist/chunk-Z54RD7VL.js +0 -3
  410. package/dist/cli-context-3SNLDYBM.js +0 -3
  411. package/dist/cli-context-T3B7W6GG.js +0 -2
  412. package/dist/cli-program-YNOXO72B.js +0 -7
  413. package/dist/command-descriptors-6AOUKWW7.js +0 -346
  414. package/dist/command-descriptors-ZFKJSRUP.js +0 -344
  415. package/dist/direct-navigation-DP4LVMRX.js +0 -3
  416. package/dist/direct-navigation-FLUS3BT6.js +0 -2
  417. package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
  418. package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
  419. package/dist/output-continuation-command-2V2SL4TD.js +0 -2
  420. package/dist/output-continuation-command-65J5IP3O.js +0 -3
  421. package/dist/project-reindex-5JOKXAXT.js +0 -2
  422. package/dist/project-reindex-UQBIKO4M.js +0 -3
@@ -0,0 +1,239 @@
1
+ import{a as $e,d as Dt}from"./chunk-6OAHRI2D.js";import{a as te,c as ne}from"./chunk-5NJPH3QZ.js";import{a as kn}from"./chunk-ILMHV3KM.js";import{a as en,b as tn,d as We,e as on}from"./chunk-HBXZAGY6.js";import{P as Xt,Q as Yt,R as Kt,T as Zt,X as Fn,Y as ze,a as It,b as Et,c as ce,d as me,e as Qt,g as Vt}from"./chunk-IGQQUENU.js";import{a as Q,b as ge,c as ee,d as Gt,e as Ut,f as Wt,g as qt,h as Ht}from"./chunk-H5QXP63L.js";import{b as Ft,c as kt}from"./chunk-2Q2LW5JW.js";import{a as Je,c as Se,d as jn,f as Tn}from"./chunk-IBM3F2BJ.js";import{s as Ge}from"./chunk-M7LAIM77.js";import{A as pn,B as gn,C as fn,D as mn,E as hn,F as yn,G as qe,I as N,J as he,K as Sn,M as He,N as bn,O as Pn,P as ye,S as xn,T as Rn,U as vn,c as Z,d as le,e as Le,g as Me,h as jt,i as At,j as T,l as Nt,o as F,p as L,q as M,r as Ue,s as nn,t as rn,u as an,v as sn,w as cn,x as dn,y as ln,z as un}from"./chunk-XYLV727H.js";import{e as fe}from"./chunk-4NHWNAWQ.js";import{a as q,b as Tt}from"./chunk-2VKB5CMA.js";import{i as W,j as J,l as Lt,m as Be,n as Mt,r as Jt,s as zt,u as In,x as En,y as wn,z as _n}from"./chunk-ACZDU5GK.js";import{i as ue,j as H}from"./chunk-R2NOK63J.js";import{a as vt,b as K,c as U,d as b}from"./chunk-6URCE5QY.js";import{$ as Ct,E as Ne,O as Ce,T as pe,Y as Ot,Z as z,a as xt,c as Ae,f as Y,g as oe,ga as $t,h as se,ha as Bt,i as Rt,n as wt,o as _t,p as de,r as I}from"./chunk-4O52YNKL.js";import{createHash as Bi}from"crypto";import{existsSync as _,mkdirSync as Fe,readdirSync as Dr,renameSync as Or,rmSync as V,statSync as Gi}from"fs";import{basename as Te,dirname as h,extname as Ui,join as E,resolve as Ir}from"path";import{platform as Wi}from"os";import{execFileSync as zr}from"child_process";import{constants as Qr,copyFileSync as Dn,statSync as Vr}from"fs";import{platform as Xr}from"os";var Yr=Object.freeze({size:e=>Vr(e).size,clone:Zr,copy:(e,t)=>Dn(e,t)}),Kr=new Set(["ENOSYS","ENOTSUP","EOPNOTSUPP","EINVAL","EXDEV","ENOTTY"]);function C(e,t,n=Yr){let r=n.size(e);try{return n.clone(e,t),{method:"reflink",bytes:r}}catch(a){if(!ta(a))throw a}return n.copy(e,t),{method:"copy",bytes:r}}function Zr(e,t){if(Xr()!=="darwin"){Dn(e,t,Qr.COPYFILE_FICLONE_FORCE);return}try{zr("/bin/cp",["-c",e,t],{timeout:6e4,maxBuffer:64*1024,stdio:["ignore","ignore","pipe"],windowsHide:!0})}catch(n){throw ea(n)}}function ea(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 ta(e){let t=e?.code;return t!==void 0&&Kr.has(t)}function On(){return{reflinkedBytes:0,fallbackCopiedBytes:0}}function $(e,t){t.method==="reflink"?e.reflinkedBytes+=t.bytes:e.fallbackCopiedBytes+=t.bytes}import{dirname as na,join as ra}from"path";function An(e={}){return{id:"runtime-boundaries",facts:["runtime-boundary-observation","runtime-boundary-link"],run:({projectRoot:t,dbPath:n,onStatus:r})=>{let a=new F({projectRoot:t,dbPath:n,indexPath:e.indexPath??ra(na(n),"index.scip")}),i,o=!1,s=!1;try{let l=e.reuseExisting||e.affectedFiles?Zt(a):null;e.reuseExisting&&l?.extractorVersion===Xt?(i=l,o=!0):(i=Yt(a,{...l?{previousGraph:l}:{},...e.affectedFiles?{affectedFiles:e.affectedFiles}:{}}),s=(i.coverage.filesReused??0)>0)}finally{a.close()}o||Kt(n,i);let d={reused:o,incrementallyUpdated:s,observations:i.observations.length,links:i.links.length,frontiers:i.frontiers.length,filesScanned:i.coverage.filesScanned,errors:i.coverage.extractionErrors.length,phases:i.coverage.phases};return r?.(d.reused?`Reused ${d.observations} cached runtime-boundary observation(s) and ${d.links} link(s).`:d.incrementallyUpdated?`Incrementally refreshed runtime-boundary observations (${d.filesScanned-(i.coverage.filesReused??0)} file(s) extracted, ${i.coverage.filesReused??0} reused) and rebuilt ${d.links} link(s).`:`Extracted ${d.observations} runtime-boundary observation(s), ${d.links} link(s), and ${d.frontiers} unresolved frontier(s).`),!o&&i.coverage.phases&&r?.(`Runtime-boundary phases: ${i.coverage.phases.map(l=>`${l.id} ${l.durationMs.toFixed(0)}ms`).join(", ")}.`),d}}}import{createHash as ia}from"crypto";import{existsSync as oa}from"fs";import{dirname as sa,join as Mn}from"path";function Qe(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 be(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 a=new Set(n),i=Qe(e),o=new Set(i.reasons);return r.some(s=>!a.has(s))&&o.add("changed-file-outside-project"),t===null?(o.add("dependency-graph-unavailable"),Ln(r,a,o)):o.size>0?Ln(r,a,o):{mode:"closure",changedFiles:r,affectedFiles:aa(r,t,a),reasons:[]}}function Ln(e,t,n){return{mode:"full-project",changedFiles:e,affectedFiles:[...t].sort(),reasons:[...n].sort()}}function aa(e,t,n){let r=new Map;for(let[o,s]of t)if(n.has(o))for(let d of s){if(!n.has(d))continue;let l=r.get(d)??new Set;l.add(o),r.set(d,l)}let a=new Set(e),i=[...e];for(let o=0;o<i.length;o+=1){let s=i[o];if(s!==void 0)for(let d of r.get(s)??[])a.has(d)||(a.add(d),i.push(d))}return[...a].sort()}var ca="<global-symbols>";function da(e){let t=[];for(let n of e.all(`
2
+ SELECT relative_path, language, position_encoding, text
3
+ FROM documents
4
+ `))t.push({relativePath:n.relative_path,kind:"document",values:[n.language,n.position_encoding,n.text]});for(let n of e.all(`
5
+ SELECT d.relative_path,
6
+ c.chunk_index,
7
+ c.start_line,
8
+ c.end_line,
9
+ hex(c.occurrences) AS occurrences_hex
10
+ FROM chunks c
11
+ JOIN documents d ON d.id = c.document_id
12
+ `))t.push({relativePath:n.relative_path,kind:"chunk",values:[n.chunk_index,n.start_line,n.end_line,n.occurrences_hex]});for(let n of e.all(`
13
+ SELECT d.relative_path,
14
+ r.start_line,
15
+ r.start_char,
16
+ r.end_line,
17
+ r.end_char,
18
+ g.symbol,
19
+ g.display_name,
20
+ g.kind,
21
+ g.documentation,
22
+ CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
23
+ g.enclosing_symbol,
24
+ CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
25
+ FROM defn_enclosing_ranges r
26
+ JOIN documents d ON d.id = r.document_id
27
+ JOIN global_symbols g ON g.id = r.symbol_id
28
+ `))t.push({relativePath:n.relative_path,kind:"definition",values:Ve(n,[n.start_line,n.start_char,n.end_line,n.end_char])});for(let n of e.all(`
29
+ SELECT d.relative_path,
30
+ c.chunk_index,
31
+ m.role,
32
+ g.symbol,
33
+ g.display_name,
34
+ g.kind,
35
+ g.documentation,
36
+ CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
37
+ g.enclosing_symbol,
38
+ CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
39
+ FROM mentions m
40
+ JOIN chunks c ON c.id = m.chunk_id
41
+ JOIN documents d ON d.id = c.document_id
42
+ JOIN global_symbols g ON g.id = m.symbol_id
43
+ `))t.push({relativePath:n.relative_path,kind:"mention",values:Ve(n,[n.chunk_index,n.role])});for(let n of e.all(`
44
+ SELECT g.symbol,
45
+ g.display_name,
46
+ g.kind,
47
+ g.documentation,
48
+ CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
49
+ g.enclosing_symbol,
50
+ CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
51
+ FROM global_symbols g
52
+ WHERE NOT EXISTS (
53
+ SELECT 1 FROM defn_enclosing_ranges r WHERE r.symbol_id = g.id
54
+ ) AND NOT EXISTS (
55
+ SELECT 1 FROM mentions m WHERE m.symbol_id = g.id
56
+ )
57
+ `))t.push({relativePath:ca,kind:"global-symbol",values:Ve(n)});return la(t)}function la(e){let t=new Map;for(let r of e){let a=JSON.stringify([r.kind,r.values]),i=t.get(r.relativePath)??[];i.push(a),t.set(r.relativePath,i)}let n=new Map;for(let[r,a]of[...t].sort(([i],[o])=>i.localeCompare(o))){let i=ia("sha256");for(let o of a.sort())i.update(String(Buffer.byteLength(o))),i.update(":"),i.update(o),i.update(`
58
+ `);n.set(r,i.digest("hex"))}return n}function ua(e,t){let n=[],r=[],a=[],i=[],o=new Set([...e.keys(),...t.keys()]);for(let s of[...o].sort()){let d=e.get(s),l=t.get(s);d===void 0?n.push(s):l===void 0?a.push(s):d!==l?r.push(s):i.push(s)}return{addedFiles:n,modifiedFiles:r,deletedFiles:a,changedFiles:[...n,...r,...a].sort(),unchangedFiles:i}}function Xe(e,t,n){let r=new Set(e.affectedFiles),a=new Set(t.changedFiles),i=e.mode==="full-project"?[]:t.changedFiles.filter(d=>!r.has(d)),o=e.affectedFiles.filter(d=>!a.has(d)).sort(),s=t.changedFiles.length-i.length;return{passed:i.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:i,extraFiles:o}}function Ye(e,t=ha){let n=t.wallNow===void 0&&t.monotonicNow===void 0,r=t.monotonicNow??t.now,a=t.wallNow??t.now,i=r(),o=(l,c)=>{let p=r();return Wn(e.refreshResult,l,n?p:a(),Math.max(0,p-i),c)};if(!t.databaseExists(e.previousDbPath))return o("prior-index-unavailable");if(!t.databaseExists(e.candidateDbPath))return o("candidate-index-unavailable");let s=null,d=null;try{s=t.openDatabase(e.projectRoot,e.previousDbPath,e.previousIndexPath),d=t.openDatabase(e.projectRoot,e.candidateDbPath,e.candidateIndexPath);let l=[...new Set([...t.indexedPaths(s),...t.indexedPaths(d)])].sort(),c=de(e.previousSnapshot,e.currentSnapshot),p=new Set(l),u=c.changes.length>0&&!Qe(c).fullProject&&c.changes.every(w=>p.has(w.path)),g=be(c,u?t.dependencyGraph(s):new Map,l),m=ua(t.factDigests(s),t.factDigests(d)),x=r();return{version:1,status:"evaluated",refreshResult:e.refreshResult,recordedAt:new Date(n?x:a()).toISOString(),durationMs:Math.max(0,x-i),manifest:c,plan:g,comparison:m,evaluation:Xe(g,m,l.length)}}catch(l){return o("oracle-error",l instanceof Error?l.message:String(l))}finally{Nn(s),Nn(d)}}function Bn(e,t,n,r=Date.now()){return Wn(e,t,r,0,n)}function Gn(e){let t=sa(e);return{latestPath:Mn(t,"affected-shadow-latest.json"),historyPath:Mn(t,"affected-shadow.jsonl")}}function Xo(e,t=n=>Rt(n,"affected-shadow source file")){let n=Gn(e),r;try{r=JSON.parse(t(n.latestPath))}catch(f){let y=xa(f),P=y?"telemetry-missing":Pa(f);return D(n,P,y?void 0:f instanceof Error?f.message:String(f))}if(L(r)&&typeof r.version=="number"&&r.version!==1)return D(n,"unsupported-record-version",`Unsupported version ${r.version}.`);if(!Sa(r))return D(n,"telemetry-malformed");if(r.status==="unavailable")return ba(r.reason)?{state:"unavailable",...n,reason:r.reason,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,...typeof r.error=="string"?{error:r.error}:{}}:D(n,"telemetry-malformed");if(r.status!=="evaluated")return D(n,"telemetry-malformed");let a=r.plan,i=r.comparison,o=r.evaluation;if(!L(r.manifest)||!L(a)||!L(i)||!L(o))return D(n,"telemetry-malformed");let s=a.mode,d=M(a.affectedFiles),l=M(a.reasons),c=M(i.changedFiles),p=M(o.predictedFiles),u=M(o.actualFiles),g=M(o.missingFiles),m=o.recall,x=o.affectedRatio;if(s!=="none"&&s!=="closure"&&s!=="full-project"||d===null||l===null||c===null||p===null||u===null||g===null||typeof o.passed!="boolean"||!Cn(m)||!Cn(x))return D(n,"telemetry-malformed");let w=u.length===0?1:(u.length-g.length)/u.length;return!$n(d,p)||!$n(c,u)||o.passed!==(g.length===0)||Math.abs(m-w)>Number.EPSILON||g.some(f=>!u.includes(f)||p.includes(f))?D(n,"telemetry-malformed"):{state:o.passed?"passing":"failing",...n,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,mode:s,recall:m,affectedRatio:x,predictedFiles:p,actualFiles:u,missingFiles:g,fallbackReasons:l}}function Yo(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 Un(e,t,n=ya){let r=Gn(e);return n.appendHistory(r.historyPath,t),n.writeLatest(r.latestPath,t),r}var pa=8*1024*1024,ga=en;function fa(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 ma(e,t,n=pa){tn(e,fa(t),{maxSegmentBytes:n,previousSuffix:ga})}function Ve(e,t=[]){let n=[];for(let r of t)n.push(r);return n.push(e.symbol,e.display_name,e.kind,e.documentation,e.signature_hex,e.enclosing_symbol,e.relationships_hex),n}var ha={now:()=>Date.now(),wallNow:()=>Date.now(),monotonicNow:b,databaseExists:e=>oa(e),openDatabase:(e,t,n)=>new F({projectRoot:e,dbPath:t,indexPath:n}),indexedPaths:e=>fe(e),dependencyGraph:e=>me(e),factDigests:e=>da(e)},ya={appendHistory:ma,writeLatest:(e,t)=>Jt(e,t,{spacing:2,trailingNewline:!0})};function Wn(e,t,n,r,a){return{version:1,status:"unavailable",refreshResult:e,recordedAt:new Date(n).toISOString(),durationMs:r,reason:t,...a?{error:a}:{}}}function Nn(e){try{e?.close()}catch{}}function Sa(e){return L(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 ba(e){return e==="prior-index-unavailable"||e==="candidate-index-unavailable"||e==="oracle-error"}function Cn(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function $n(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function D(e,t,n){return{state:"unavailable",...e,reason:t,...n?{error:n}:{}}}function Pa(e){return e instanceof SyntaxError?"telemetry-malformed":"telemetry-unreadable"}function xa(e){return e instanceof Error&&e.code==="ENOENT"}import{readdirSync as Ra}from"fs";import{isAbsolute as qn,join as va,resolve as Ia}from"path";var Pe="@sourcegraph/scip-typescript@0.4.0",Hn="scip-python-plus@0.7.5",Jn="github.com/sourcegraph/scip-go@v0.2.7",zn="scip-dotnet@0.2.14",Ea="scip_dart@1.6.2",wa={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:t,indexerBinary:n,projectPath:r})=>r?{binary:n,args:["index","--output",e,"--no-progress-bar",r]}:t?{binary:n,args:["index","--pnpm-workspaces","--output",e,"--no-progress-bar"]}:{binary:n,args:["index","--output",e,"--no-progress-bar"]},markerFiles:[...I.typescript],installMethods:[{label:"npm",identity:Pe,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",Pe]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},javascript:{language:"javascript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--no-progress-bar"]}),markerFiles:[...I.javascript],installMethods:[{label:"npm",identity:Pe,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",Pe]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},java:{language:"java",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[...I.java],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},scala:{language:"scala",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[...I.scala],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},kotlin:{language:"kotlin",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[...I.kotlin],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},rust:{language:Q.language,indexerBinary:Q.indexerBinary,checkCommand:`${Q.indexerBinary} --version`,indexArgs:({outputPath:e})=>({binary:Q.indexerBinary,args:["scip",".","--output",e]}),markerFiles:[...I.rust],installMethods:[],installUrl:Q.installUrl},python:{language:"python",indexerBinary:"scip-python-plus",binaryAliases:["scip-python"],checkCommand:"scip-python-plus --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--project-name","project"]}),markerFiles:[...I.python],installMethods:[{label:"npm",identity:Hn,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",Hn]}],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 a=["-root",e,"-output",t];return r&&a.push("-config",qn(r)?r:Ia(e,r)),{binary:n,args:a}},markerFiles:[...I.clojure],installMethods:[],installUrl:"https://github.com/PlunderStruck/scip-clojure"},ruby:{language:"ruby",indexerBinary:"scip-ruby",checkCommand:"scip-ruby --version",indexArgs:({indexerBinary:e})=>({binary:e,args:["--dir","."]}),defaultOutputPath:"index.scip",markerFiles:[...I.ruby],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-ruby/releases"},go:{language:"go",indexerBinary:"scip-go",checkCommand:"scip-go --version",indexArgs:({outputPath:e})=>({binary:"scip-go",args:["--output",e]}),markerFiles:[...I.go],installMethods:[{label:"go install",identity:Jn,destination:"Go bin directory (GOBIN or GOPATH/bin)",prerequisite:"go",binary:"go",args:["install",Jn]}],installUrl:"https://github.com/sourcegraph/scip-go"},cpp:{language:"cpp",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:[...I.cpp],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},c:{language:"c",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:[...I.c],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},csharp:{language:"csharp",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",Qn(e,[".sln",".csproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...I.csharp],installMethods:[{label:"dotnet",identity:zn,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",Qn(e,[".sln",".vbproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...I.vb],installMethods:[{label:"dotnet",identity:zn,destination:"dotnet global tool directory",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet","--version","0.2.14"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},dart:{language:"dart",indexerBinary:"scip-dart",checkCommand:"scip-dart --version",indexArgs:({indexerBinary:e,outputPath:t})=>({binary:e,args:["--output",t]}),markerFiles:[...I.dart],installMethods:[{label:"dart pub",identity:Ea,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})=>qn(e)?{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",e]}:{binary:e,args:[]},defaultOutputPath:"index.scip",markerFiles:[...I.php],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function Vn(e){if(!(e.projectPath||e.pnpmWorkspaces)){if(e.language==="typescript")return"{}";if(e.language==="javascript")return'{"compilerOptions":{"allowJs":true}}'}}function Ke(e){return wa[e]}function Qn(e,t){let n;try{n=Ra(e)}catch{return null}for(let r of t)for(let a of n)if(a.endsWith(r))return va(e,a);return null}import{createHash as _a}from"crypto";import{existsSync as Xn,rmSync as Yn}from"fs";import{resolve as ja}from"path";import er from"better-sqlite3";var Ta={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}]},Fa={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 tr(e){let t=b(),n=ka(e.affectedFiles);if(Da(e.previousDbPath,e.miniDbPath,e.candidateDbPath),Yn(e.candidateDbPath,{force:!0}),!Xn(e.previousDbPath))throw new Error("previous SQLite generation is unavailable");if(!Xn(e.miniDbPath))throw new Error("incremental SQLite mini database is unavailable");Kn(e.previousDbPath,"previous SQLite generation",!1),Kn(e.miniDbPath,"incremental SQLite mini database");let r=C(e.previousDbPath,e.candidateDbPath);e.writeTelemetry&&$(e.writeTelemetry,r);let a=null;try{a=new er(q(e.candidateDbPath),{fileMustExist:!0}),a.pragma("busy_timeout = 5000"),a.pragma("foreign_keys = ON"),a.prepare("ATTACH DATABASE ? AS incremental").run(q(e.miniDbPath)),Ze(a,"main","candidate SQLite generation"),Ze(a,"incremental","incremental SQLite mini database"),Oa(a,n),Aa(a,n.length);let i=et(a,"main",!0),o=O(a,"SELECT COUNT(*) AS value FROM main.documents");a.transaction(()=>{La(a),Ma(a),Na(a),e.onStage?.("after-delete"),Ca(a),e.onStage?.("after-symbol-reconciliation"),$a(a),e.onStage?.("after-insert"),Ba(a),Ga(a,n.length,o),e.onStage?.("before-commit")}).immediate(),nr(a,"main","candidate SQLite generation");let l=[...Ua(a)].filter(([c,p])=>i.get(c)!==p).map(([c])=>c).sort();return a.exec("DETACH DATABASE incremental"),a.close(),a=null,{candidateDbPath:e.candidateDbPath,affectedDocumentCount:n.length,changedDocumentPaths:l,durationMs:b()-t}}catch(i){try{a?.close()}finally{Yn(e.candidateDbPath,{force:!0})}throw new Error(`Incremental SQLite publication rejected: ${i instanceof Error?i.message:String(i)}`,{cause:i})}}function ka(e){if(e.length===0)throw new Error("incremental SQLite publication requires affected documents");let t=[...e].sort();for(let n of t)if(!n||n.startsWith("/")||n.includes("\\")||n.split("/").includes(".."))throw new Error(`invalid affected document path: ${n}`);if(new Set(t).size!==t.length)throw new Error("incremental SQLite publication contains duplicate affected documents");return t}function Da(e,t,n){let r=[e,t,n].map(a=>ja(a));if(new Set(r).size!==r.length)throw new Error("previous, mini, and candidate SQLite paths must be distinct")}function Kn(e,t,n=!0){let r=new er(q(e),{readonly:!0,fileMustExist:!0});try{Ze(r,"main",t),n&&nr(r,"main",t)}finally{r.close()}}function Ze(e,t,n){for(let[r,a]of Object.entries(Ta)){let o=e.prepare(`PRAGMA ${t}.table_info('${r}')`).all().map(({name:s,type:d,notnull:l,pk:c})=>({name:s,type:d.toUpperCase(),notnull:l,pk:c}));if(JSON.stringify(o)!==JSON.stringify(a))throw new Error(`${n} schema changed for table ${r}`)}for(let[r,a]of Object.entries(Fa)){let i=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(i?.tbl_name!==a.table||JSON.stringify(o)!==JSON.stringify(a.columns))throw new Error(`${n} schema changed for index ${r}`)}Zn(e,t,"documents",["relative_path"],n),Zn(e,t,"global_symbols",["symbol"],n)}function Zn(e,t,n,r,a){if(!e.prepare(`PRAGMA ${t}.index_list('${n}')`).all().some(s=>{if(s.unique!==1)return!1;let d=e.prepare(`PRAGMA ${t}.index_info('${s.name}')`).all().map(l=>l.name);return JSON.stringify(d)===JSON.stringify(r)}))throw new Error(`${a} lost the unique ${n}(${r.join(", ")}) constraint`)}function nr(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 Oa(e,t){e.exec("CREATE TEMP TABLE incremental_affected_paths (relative_path TEXT PRIMARY KEY) WITHOUT ROWID");let n=e.prepare("INSERT INTO temp.incremental_affected_paths(relative_path) VALUES (?)");e.transaction(a=>{for(let i of a)n.run(i)})(t)}function Aa(e,t){let n=O(e,"SELECT COUNT(*) AS value FROM incremental.documents"),r=O(e,`SELECT COUNT(*) AS value
59
+ FROM main.documents d
60
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`),a=e.prepare(`SELECT p.relative_path
61
+ FROM temp.incremental_affected_paths p
62
+ LEFT JOIN incremental.documents d ON d.relative_path = p.relative_path
63
+ WHERE d.id IS NULL
64
+ LIMIT 1`).pluck().get(),i=e.prepare(`SELECT d.relative_path
65
+ FROM incremental.documents d
66
+ LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
67
+ WHERE p.relative_path IS NULL
68
+ LIMIT 1`).pluck().get();if(n!==t||r!==t||a!==void 0||i!==void 0)throw new Error("incremental SQLite mini database does not exactly match the affected document set")}function La(e){e.exec(`
69
+ CREATE TEMP TABLE incremental_old_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
70
+ INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
71
+ SELECT g.symbol
72
+ FROM main.defn_enclosing_ranges r
73
+ JOIN main.documents d ON d.id = r.document_id
74
+ JOIN main.global_symbols g ON g.id = r.symbol_id
75
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path;
76
+ INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
77
+ SELECT g.symbol
78
+ FROM main.mentions m
79
+ JOIN main.chunks c ON c.id = m.chunk_id
80
+ JOIN main.documents d ON d.id = c.document_id
81
+ JOIN main.global_symbols g ON g.id = m.symbol_id
82
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
83
+ WHERE m.role = 1;
84
+
85
+ CREATE TEMP TABLE incremental_new_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
86
+ INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
87
+ SELECT g.symbol
88
+ FROM incremental.defn_enclosing_ranges r
89
+ JOIN incremental.global_symbols g ON g.id = r.symbol_id;
90
+ INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
91
+ SELECT g.symbol
92
+ FROM incremental.mentions m
93
+ JOIN incremental.global_symbols g ON g.id = m.symbol_id
94
+ WHERE m.role = 1;
95
+ `)}function Ma(e){let t=e.prepare(`WITH changed_symbols AS (
96
+ SELECT symbol FROM temp.incremental_old_defined_symbols
97
+ UNION
98
+ SELECT symbol FROM temp.incremental_new_defined_symbols
99
+ ), unaffected_definitions AS (
100
+ SELECT g.symbol
101
+ FROM main.defn_enclosing_ranges r
102
+ JOIN main.documents d ON d.id = r.document_id
103
+ JOIN main.global_symbols g ON g.id = r.symbol_id
104
+ LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
105
+ WHERE p.relative_path IS NULL
106
+ UNION
107
+ SELECT g.symbol
108
+ FROM main.mentions m
109
+ JOIN main.chunks c ON c.id = m.chunk_id
110
+ JOIN main.documents d ON d.id = c.document_id
111
+ JOIN main.global_symbols g ON g.id = m.symbol_id
112
+ LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
113
+ WHERE m.role = 1 AND p.relative_path IS NULL
114
+ )
115
+ SELECT u.symbol
116
+ FROM unaffected_definitions u
117
+ JOIN changed_symbols c ON c.symbol = u.symbol
118
+ LIMIT 1`).pluck().get();if(typeof t=="string")throw new Error(`symbol definition is shared by affected and unaffected documents: ${t}`)}function Na(e){e.exec(`
119
+ DELETE FROM main.mentions
120
+ WHERE chunk_id IN (
121
+ SELECT c.id
122
+ FROM main.chunks c
123
+ JOIN main.documents d ON d.id = c.document_id
124
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
125
+ );
126
+ DELETE FROM main.chunks
127
+ WHERE document_id IN (
128
+ SELECT d.id
129
+ FROM main.documents d
130
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
131
+ );
132
+ DELETE FROM main.defn_enclosing_ranges
133
+ WHERE document_id IN (
134
+ SELECT d.id
135
+ FROM main.documents d
136
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
137
+ );
138
+ DELETE FROM main.documents
139
+ WHERE relative_path IN (SELECT relative_path FROM temp.incremental_affected_paths);
140
+ `)}function Ca(e){e.exec(`
141
+ UPDATE main.global_symbols
142
+ SET display_name = NULL,
143
+ kind = NULL,
144
+ documentation = NULL,
145
+ signature = NULL,
146
+ enclosing_symbol = NULL,
147
+ relationships = NULL
148
+ WHERE symbol IN (SELECT symbol FROM temp.incremental_old_defined_symbols);
149
+
150
+ INSERT OR IGNORE INTO main.global_symbols(
151
+ symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
152
+ )
153
+ SELECT symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
154
+ FROM incremental.global_symbols;
155
+
156
+ UPDATE main.global_symbols
157
+ SET display_name = (
158
+ SELECT source.display_name FROM incremental.global_symbols source
159
+ WHERE source.symbol = main.global_symbols.symbol
160
+ ),
161
+ kind = (
162
+ SELECT source.kind FROM incremental.global_symbols source
163
+ WHERE source.symbol = main.global_symbols.symbol
164
+ ),
165
+ documentation = (
166
+ SELECT source.documentation FROM incremental.global_symbols source
167
+ WHERE source.symbol = main.global_symbols.symbol
168
+ ),
169
+ signature = (
170
+ SELECT source.signature FROM incremental.global_symbols source
171
+ WHERE source.symbol = main.global_symbols.symbol
172
+ ),
173
+ enclosing_symbol = (
174
+ SELECT source.enclosing_symbol FROM incremental.global_symbols source
175
+ WHERE source.symbol = main.global_symbols.symbol
176
+ ),
177
+ relationships = (
178
+ SELECT source.relationships FROM incremental.global_symbols source
179
+ WHERE source.symbol = main.global_symbols.symbol
180
+ )
181
+ WHERE symbol IN (SELECT symbol FROM temp.incremental_new_defined_symbols);
182
+ `)}function $a(e){let t=O(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.documents"),n=O(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.chunks"),r=O(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.defn_enclosing_ranges");e.prepare(`INSERT INTO main.documents(id, language, relative_path, position_encoding, text)
183
+ SELECT id + ?, language, relative_path, position_encoding, text
184
+ FROM incremental.documents`).run(t),e.prepare(`INSERT INTO main.chunks(id, document_id, chunk_index, start_line, end_line, occurrences)
185
+ SELECT id + ?, document_id + ?, chunk_index, start_line, end_line, occurrences
186
+ FROM incremental.chunks`).run(n,t),e.prepare(`INSERT INTO main.mentions(chunk_id, symbol_id, role)
187
+ SELECT m.chunk_id + ?, target.id, m.role
188
+ FROM incremental.mentions m
189
+ JOIN incremental.global_symbols source ON source.id = m.symbol_id
190
+ JOIN main.global_symbols target ON target.symbol = source.symbol`).run(n),e.prepare(`INSERT INTO main.defn_enclosing_ranges(
191
+ id, document_id, symbol_id, start_line, start_char, end_line, end_char
192
+ )
193
+ SELECT r.id + ?, r.document_id + ?, target.id,
194
+ r.start_line, r.start_char, r.end_line, r.end_char
195
+ FROM incremental.defn_enclosing_ranges r
196
+ JOIN incremental.global_symbols source ON source.id = r.symbol_id
197
+ JOIN main.global_symbols target ON target.symbol = source.symbol`).run(r,t)}function Ba(e){e.exec(`
198
+ DELETE FROM main.global_symbols
199
+ WHERE NOT EXISTS (SELECT 1 FROM main.mentions m WHERE m.symbol_id = main.global_symbols.id)
200
+ AND NOT EXISTS (
201
+ SELECT 1 FROM main.defn_enclosing_ranges r WHERE r.symbol_id = main.global_symbols.id
202
+ );
203
+ `)}function Ga(e,t,n){let r=O(e,"SELECT COUNT(*) AS value FROM main.documents"),a=O(e,`SELECT COUNT(*) AS value
204
+ FROM main.documents d
205
+ JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`);if(r!==n||a!==t)throw new Error("candidate SQLite document counts changed unexpectedly");let i=e.prepare("SELECT relative_path FROM main.documents GROUP BY relative_path HAVING COUNT(*) > 1 LIMIT 1").pluck().get(),o=e.prepare("SELECT symbol FROM main.global_symbols GROUP BY symbol HAVING COUNT(*) > 1 LIMIT 1").pluck().get();if(i!==void 0||o!==void 0)throw new Error("candidate SQLite generation contains duplicate document paths or symbols")}function Ua(e){let t=et(e,"main",!0),n=et(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 et(e,t,n){let r=n?"JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path":"",a=e.prepare(`SELECT d.relative_path, d.language, d.position_encoding, d.text
206
+ FROM ${t}.documents d
207
+ ${r}
208
+ ORDER BY d.relative_path`).all(),i=e.prepare(`SELECT d.relative_path, c.chunk_index, c.start_line, c.end_line, hex(c.occurrences) AS occurrences
209
+ FROM ${t}.chunks c
210
+ JOIN ${t}.documents d ON d.id = c.document_id
211
+ ${r}
212
+ ORDER BY d.relative_path, c.chunk_index, c.start_line, c.end_line, c.id`).all(),o=e.prepare(`SELECT d.relative_path, r.start_line, r.start_char, r.end_line, r.end_char,
213
+ g.symbol, g.display_name, g.kind, g.documentation,
214
+ CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature,
215
+ g.enclosing_symbol,
216
+ CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships
217
+ FROM ${t}.defn_enclosing_ranges r
218
+ JOIN ${t}.documents d ON d.id = r.document_id
219
+ JOIN ${t}.global_symbols g ON g.id = r.symbol_id
220
+ ${r}
221
+ ORDER BY d.relative_path, r.start_line, r.start_char, r.end_line, r.end_char, g.symbol`).all(),s=e.prepare(`SELECT d.relative_path, c.chunk_index, m.role, g.symbol
222
+ FROM ${t}.mentions m
223
+ JOIN ${t}.chunks c ON c.id = m.chunk_id
224
+ JOIN ${t}.documents d ON d.id = c.document_id
225
+ JOIN ${t}.global_symbols g ON g.id = m.symbol_id
226
+ ${r}
227
+ ORDER BY d.relative_path, c.chunk_index, m.role, g.symbol`).all(),d=new Map;for(let[c,p]of Object.entries({documents:a,chunks:i,definitions:o,mentions:s}))for(let u of p){let g=JSON.stringify([c,u]),m=d.get(u.relative_path)??[];m.push(g),d.set(u.relative_path,m)}let l=new Map;for(let[c,p]of[...d].sort(([u],[g])=>u.localeCompare(g))){let u=_a("sha256");for(let g of p.sort())u.update(g).update(`
228
+ `);l.set(c,u.digest("hex"))}return l}function O(e,t){return e.prepare(t).get().value}import Wa from"better-sqlite3";var xe="idx_mentions_definitions",qa=["symbol_id","chunk_id"];function tt(e){let t=new Wa(q(e)),n=[],r=[],a=[];try{return t.transaction(()=>{Ha(t,n),Re(t,"idx_global_symbols_symbol")?.join("\0")==="symbol"&&rr(t,"global_symbols").some(s=>s.name!=="idx_global_symbols_symbol"&&s.unique&&s.columns.join("\0")==="symbol")?(t.exec('DROP INDEX "idx_global_symbols_symbol"'),r.push("idx_global_symbols_symbol")):Re(t,"idx_global_symbols_symbol")&&a.push("idx_global_symbols_symbol");let i=Re(t,"idx_chunks_doc_id"),o=rr(t,"chunks").some(s=>s.name!=="idx_chunks_doc_id"&&s.columns.length>1&&s.columns[0]==="document_id");i?.join("\0")==="document_id"&&o?(t.exec('DROP INDEX "idx_chunks_doc_id"'),r.push("idx_chunks_doc_id")):i&&a.push("idx_chunks_doc_id"),t.exec("ANALYZE")})(),{added:n,removed:r,retained:a,analyzed:!0}}catch(i){if(i.code==="SQLITE_NOTADB")return{added:[],removed:[],retained:[],analyzed:!1,skippedReason:"not-a-sqlite-database"};throw i}finally{t.close()}}function Ha(e,t){let n=ar(e,xe);if(n){let r=n.columns.join("\0")===qa.join("\0"),a=/\bWHERE\s+role\s*=\s*1\b/iu.test(n.sql??"");if(!r||!a||n.table!=="mentions")throw new Error(`${xe} exists with an incompatible definition`);return}e.exec(`CREATE INDEX "${xe}" ON mentions(symbol_id, chunk_id) WHERE role = 1`),t.push(xe)}function rr(e,t){return e.prepare(`PRAGMA index_list('${t.replaceAll("'","''")}')`).all().map(n=>({name:n.name,unique:n.unique===1,columns:Re(e,n.name)??[]}))}function Re(e,t){return ar(e,t)?.columns??null}function ar(e,t){let n=e.prepare("SELECT tbl_name, sql FROM sqlite_master WHERE type = 'index' AND name = ?").get(t);if(!n)return null;let r=e.prepare(`PRAGMA index_info('${t.replaceAll("'","''")}')`).all().map(a=>a.name);return{table:n.tbl_name,sql:n.sql,columns:r}}import{createHash as Ja}from"crypto";import{existsSync as nt,readdirSync as za}from"fs";import{dirname as rt,join as ve,relative as Qa,resolve as at,sep as ir}from"path";function or(e,t){let n=t.includes("."),r={};for(let i of t)r[i]=[];let a=[];for(let i of e){let o=lr(i.path,t);o?r[o].push(i):n?r["."].push(i):a.push(i)}return{files:r,shared:a}}function sr(e,t){let n=new Map;for(let a of e){let i=t[a]?.packageName;i&&n.set(i,a)}let r=new Map;for(let a of e)r.set(a,new Set);for(let a of e){let i=t[a],o=r.get(a);if(!i||i.parseFailed){for(let s of e)s!==a&&o.add(s);continue}for(let s of i.dependencyNames){let d=n.get(s);d&&d!==a&&o.add(d)}for(let s of[...i.pathsTargets,...i.referencesPaths]){let d=lr(s,e);d&&d!==a&&o.add(d)}}return Va(e,r)}function cr(e,t,n){let r={};for(let a of e){let i=new Map;for(let o of t.files[a]??[])i.set(o.path,o);for(let o of n[a]??[])for(let s of t.files[o]??[])i.set(s.path,s);for(let o of t.shared)i.set(o.path,o);r[a]={files:[...i.values()].sort((o,s)=>o.path.localeCompare(s.path))}}return r}function it(e){if(e===".")return"root";let t=Ja("sha256").update(e).digest("hex").slice(0,8);return`${e.split("/").join("__")}-${t}`}function dr(e,t){let n=at(e),r={};for(let a of t)r[a]=Xa(n,a);return r}function lr(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 Va(e,t){let n={};for(let r of e){let a=new Set,i=[...t.get(r)??[]];for(;i.length>0;){let o=i.pop();if(!(o===r||a.has(o))){a.add(o);for(let s of t.get(o)??[])s!==r&&!a.has(s)&&i.push(s)}}n[r]=[...a].sort((o,s)=>o.localeCompare(s))}return n}function Xa(e,t){let n=t==="."?e:ve(e,t),r=Ya(n),a=Ka(n),i=a?Za(a,e):{pathsTargets:[],referencesPaths:[],failed:!1};return{packageName:r.name,dependencyNames:r.dependencyNames,pathsTargets:i.pathsTargets,referencesPaths:i.referencesPaths,parseFailed:r.failed||i.failed}}function Ya(e){let t=ve(e,"package.json");if(!nt(t))return{name:void 0,dependencyNames:[],failed:!1};let n=ot(t);if(!n.ok)return{name:void 0,dependencyNames:[],failed:!0};let r=typeof n.value.name=="string"?n.value.name:void 0,a=new Set;for(let i of["dependencies","devDependencies","peerDependencies"]){let o=n.value[i];if(o&&typeof o=="object"&&!Array.isArray(o))for(let s of Object.keys(o))a.add(s)}return{name:r,dependencyNames:[...a],failed:!1}}function Ka(e){let t=ve(e,"tsconfig.json");if(nt(t))return t;let n;try{n=za(e).filter(r=>/^tsconfig.*\.json$/.test(r))}catch{return}return n.sort((r,a)=>r.localeCompare(a)),n.length>0?ve(e,n[0]):void 0}function Za(e,t){let n=ot(e);if(!n.ok)return{pathsTargets:[],referencesPaths:[],failed:!0};let r=ei(n.value,e,t),a=ur(e,n.value,t,0);return{pathsTargets:a.pathsTargets,referencesPaths:r,failed:a.failed}}function ei(e,t,n){let r=e.references;if(!Array.isArray(r))return[];let a=rt(t),i=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 d=pr(s,a,n);d&&i.add(d)}return[...i]}function ur(e,t,n,r){let a=ti(t);if(a)return{pathsTargets:ni(a,rt(e),n),failed:!1};if(r>=5)return{pathsTargets:[],failed:!1};let i=ri(t.extends,e,n);if(!i)return{pathsTargets:[],failed:!1};let o=ot(i);return o.ok?ur(i,o.value,n,r+1):{pathsTargets:[],failed:!0}}function ti(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 ni(e,t,n){let r=new Set;for(let a of Object.values(e))if(Array.isArray(a))for(let i of a){if(typeof i!="string")continue;let o=pr(i,t,n);o&&r.add(o)}return[...r]}function ri(e,t,n){let r=Array.isArray(e)?e.at(-1):e;if(typeof r!="string"||r.trim()===""||!r.startsWith(".")&&!r.startsWith("/"))return;let a=at(rt(t),r);if(a.endsWith(".json")||(a=`${a}.json`),!a.split(ir).includes("node_modules")&&Ne(n,a)&&nt(a))return a}function pr(e,t,n){let r=e.replace(/\/?\*+$/,""),a=at(t,r===""?".":r);if(!Ne(n,a))return;let o=Qa(n,a).split(ir).join("/");return o===""?".":o}function ai(e){let t="",n=0,r=!1,a=e.length;for(;n<a;){let i=e[n];if(r){if(t+=i,i==="\\"&&n+1<a){t+=e[n+1],n+=2;continue}i==='"'&&(r=!1),n+=1;continue}if(i==='"'){r=!0,t+=i,n+=1;continue}if(i==="/"&&e[n+1]==="/"){for(n+=2;n<a&&e[n]!==`
229
+ `;)n+=1;continue}if(i==="/"&&e[n+1]==="*"){for(n+=2;n<a&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}t+=i,n+=1}return t}function ot(e){try{let t=oe(e,{maxBytes:xt,inputKind:"TypeScript project manifest"}),n=JSON.parse(ai(t));return n&&typeof n=="object"&&!Array.isArray(n)?{ok:!0,value:n}:{ok:!1}}catch{return{ok:!1}}}import{createHash as mi}from"crypto";import{existsSync as st,statSync as hi,writeFileSync as ct}from"fs";import{join as yi}from"path";import{randomUUID as ii}from"crypto";import{existsSync as oi}from"fs";var si=12e4,ci=5,Ie=class{projectRoot;cacheDir;baseGeneration;timeoutMs;runtime;mailboxLimits;constructor(t,n={}){this.projectRoot=Ot(t.projectRoot),this.cacheDir=t.cacheDir,this.baseGeneration=t.baseGeneration,this.timeoutMs=n.timeoutMs??gi(),this.runtime=n.runtime??fi,this.mailboxLimits=n.mailboxLimits??{}}request(t){let n=Fn(this.cacheDir),r=jn(this.cacheDir),a=ze(n.statePath);if(!gr(a,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript index service is not running.");let i=this.runtime.now(),o=i+this.timeoutMs,s=(this.runtime.monotonicNow??b)()+this.timeoutMs,d=En("typescript-index-v4",{baseGeneration:this.baseGeneration,request:t}),l=wn(d),c=_n(r,{mailboxVersion:In,operationKey:d,clientId:this.runtime.randomId(),enqueuedAtMs:i,deadlineAtMs:o,protocolVersion:Se,id:l,baseGeneration:this.baseGeneration,request:t},{nowMs:i,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??b)()<=s;){if(oi(c.responsePath))return di(oe(c.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript index mailbox response"}),l,d,this.baseGeneration,t.producerIdentity,t.affectedFiles);let p=ze(n.statePath);if(!gr(p,this.projectRoot,this.runtime))throw new Error("TypeScript index service stopped while processing a request.");this.runtime.sleep(ci)}throw new Error(`TypeScript index service timed out after ${this.timeoutMs}ms.`)}};function gr(e,t,n){let r=e?.processIdentity?n.readProcessIdentity?.(e.pid):null;return e!==null&&e.projectRoot===t&&e.typescriptIndex?.protocolVersion===Se&&n.isProcessAlive(e.pid)&&(!e.processIdentity||r!=null&&K(e.processIdentity,r))}function di(e,t,n,r,a,i){let o=JSON.parse(e);if(o.protocolVersion!==Se||o.id!==t||o.operationKey!==n||o.ok===!0&&o.baseGeneration!==r)throw new Error("TypeScript index service wrote an incompatible response.");if(o.ok!==!0)throw new Error(typeof o.error=="string"?o.error:"TypeScript index service request failed.");let s=li(o.response,a),d=[...new Set(i)].sort(),l=s.fragments.map(c=>c.relativePath).sort();if(JSON.stringify(l)!==JSON.stringify(d))throw new Error("TypeScript index service omitted or added an affected document.");return s}function li(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,a=n.fragments.map(i=>{if(!i||typeof i.relativePath!="string"||i.bytesBase64!==null&&typeof i.bytesBase64!="string"||typeof i.occurrences!="number"||!Number.isInteger(i.occurrences)||i.occurrences<0||typeof i.symbols!="number"||!Number.isInteger(i.symbols)||i.symbols<0||!Array.isArray(i.referenceFragments)||!i.referenceFragments.every(ui)||r.has(i.relativePath))throw new Error("TypeScript index service wrote an invalid fragment.");r.add(i.relativePath);let o=i.bytesBase64===null?null:pi(i.bytesBase64);return{relativePath:i.relativePath,bytes:o,occurrences:i.occurrences,symbols:i.symbols,referenceFragments:i.referenceFragments}});return{producerIdentity:n.producerIdentity,cold:n.cold,durationMs:n.durationMs,fragments:a}}function ui(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 pi(e){let t=Buffer.from(e,"base64");if(t.toString("base64")!==e)throw new Error("TypeScript index service wrote invalid base64.");return t}function gi(){let e=Number(process.env.SCIP_TYPESCRIPT_INDEX_TIMEOUT_MS);return Number.isInteger(e)&&e>0?e:si}var fi={now:Date.now,monotonicNow:b,randomId:ii,sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)},isProcessAlive:J,readProcessIdentity:U};function Si(e){let t=e.projectMode==="workspace"?e.workspaceProjects??[]:["."];if(t.length===0)return{eligible:!1,reason:"workspace project roots unavailable"};if(t.length===1&&t[0]==="."&&!e.rootTsconfigExists)return{eligible:!1,reason:"root tsconfig unavailable"};if(!e.previousSnapshot)return{eligible:!1,reason:"prior project snapshot unavailable"};if(e.graph===null)return{eligible:!1,reason:"dependency graph unavailable"};if(e.projectFiles.length===0)return{eligible:!1,reason:"prior TypeScript documents unavailable"};let n=de(e.previousSnapshot,e.currentSnapshot);if(n.changes.length===0)return{eligible:!1,reason:"no changed project inputs"};if(n.changes.some(c=>c.kind!=="modified"||c.inputKind!=="source"||!Ge(c.path)))return{eligible:!1,reason:"change is not a modified TypeScript source file"};let r=be(n,e.graph,e.projectFiles);if(r.mode!=="closure"||r.affectedFiles.length===0)return{eligible:!1,reason:r.reasons.length>0?`affected set widened: ${r.reasons.join(", ")}`:"empty affected set"};let a=bi(r,t,e.graph);if(!a)return{eligible:!1,reason:"affected files cross or ambiguously match TypeScript projects"};let i=fr(e.currentSnapshot,e.projectFiles,e.producerIdentity),o=fr(e.previousSnapshot,e.projectFiles,e.producerIdentity);if(i!==o)return{eligible:!1,reason:"TypeScript fragment project identity changed"};let s=hr(e.previousSnapshot,e.projectFiles,e.graph,e.producerIdentity,e.projectFiles);if(!s)return{eligible:!1,reason:"prior document identity unavailable"};let d=hr(e.currentSnapshot,e.projectFiles,e.graph,e.producerIdentity,r.affectedFiles);if(!d)return{eligible:!1,reason:"next document identity unavailable"};let l=a.length===1?a[0]:void 0;return{eligible:!0,manifest:n,plan:r,projectIdentity:i,previousFragmentGeneration:mr(e.previousSnapshot,e.producerIdentity),nextFragmentGeneration:mr(e.currentSnapshot,e.producerIdentity),previousDocumentIdentities:s,nextDocumentIdentities:d,projects:a,...l?{tsconfigPath:l.tsconfigPath,projectArgument:l.projectArgument}:{}}}function bi(e,t,n){let r=new Map;for(let i of e.affectedFiles){let o=Pi(i,t);if(!o)return null;let s=r.get(o)??[];s.push(i),r.set(o,s)}let a=[];for(let[i,o]of[...r].sort(([s],[d])=>s.localeCompare(d))){let s=new Set(o),d=e.changedFiles.filter(l=>s.has(l)||o.some(c=>xi(c,l,n)));if(d.length===0)return null;a.push({projectArgument:i,tsconfigPath:i==="."?"tsconfig.json":`${i}/tsconfig.json`,modifiedFiles:d,affectedFiles:[...o].sort()})}return a}function Pi(e,t){let n=t.filter(i=>i==="."||e===i||e.startsWith(`${i}/`));if(n.length===0)return null;let r=[...new Set(n)].sort((i,o)=>Ee(o)-Ee(i)||i.localeCompare(o)),a=r[0];return r[1]&&Ee(r[1])===Ee(a)?null:a}function Ee(e){return e==="."?0:e.split("/").filter(Boolean).length}function xi(e,t,n){let r=new Set,a=[e];for(let i=0;i<a.length;i+=1){let o=a[i];if(!(!o||r.has(o))){r.add(o);for(let s of n.get(o)??[]){if(s===t)return!0;r.has(s)||a.push(s)}}}return!1}function yr(e){let t=b();try{if(!st(e.previousDbPath)||!st(e.previousShardPath))throw new Error("prior TypeScript graph or language shard unavailable");let n=performance.now(),r=Je();if(!r.available)throw new Error(r.reason);let a=performance.now()-n;n=performance.now();let i=new F({projectRoot:e.projectRoot,dbPath:e.previousDbPath,indexPath:e.previousIndexPath}),o,s;try{o=fe(i,{includeIgnored:!1}).filter(Ge).sort(),s=me(i)}finally{i.close()}let d=performance.now()-n,l=Si({projectMode:e.projectMode,workspaceProjects:e.projectMode==="workspace"?z(e.projectRoot,e.currentSnapshot.typescriptProjects):void 0,previousSnapshot:e.previousSnapshot,currentSnapshot:e.currentSnapshot,projectFiles:o,graph:s,producerIdentity:r.producerIdentity,rootTsconfigExists:st(yi(e.projectRoot,"tsconfig.json"))});if(!l.eligible)throw new Error(l.reason);let c=Tn(e.previousDbPath);if(!c)throw new Error("published TypeScript base generation unavailable");n=performance.now();let p=new Ie({projectRoot:e.projectRoot,cacheDir:e.cacheDir,baseGeneration:c}),u=l.projects.map(S=>p.request({kind:"emit-documents",tsconfigPath:S.tsconfigPath,projectArgument:S.projectArgument,projectIdentity:l.projectIdentity,producerIdentity:r.producerIdentity,modifiedFiles:S.modifiedFiles,affectedFiles:S.affectedFiles})),g=u.flatMap(S=>S.fragments),m=performance.now()-n,x=hi(e.previousShardPath).size>=pn;n=performance.now();let w=x?null:Y(e.previousShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:Ae}),f=x?{completeIndexBytes:null,affectedIndexBytes:sn(g)}:ln({packageVersion:r.packageVersion,baseIndexBytes:w,fragments:g}),y=performance.now()-n;n=performance.now(),x?gn({cacheDir:e.cacheDir,previousGenerationIdentity:l.previousFragmentGeneration,nextGenerationIdentity:l.nextFragmentGeneration,producerIdentity:r.producerIdentity,projectIdentity:l.projectIdentity,baseShardCurrent:e.baseShardCurrent,fragments:g}):(cn({cacheDir:e.cacheDir,packageVersion:r.packageVersion,indexBytes:w,producerIdentity:r.producerIdentity,projectIdentity:l.projectIdentity,generationIdentity:l.previousFragmentGeneration,documentIdentities:l.previousDocumentIdentities,allowUntrackedDocuments:!0}),dn({cacheDir:e.cacheDir,previousGenerationIdentity:l.previousFragmentGeneration,producerIdentity:r.producerIdentity,projectIdentity:l.projectIdentity,generationIdentity:l.nextFragmentGeneration,fragments:g,documentIdentities:l.nextDocumentIdentities}));let P=performance.now()-n;n=performance.now(),f.completeIndexBytes&&ct(e.candidateShardPath,f.completeIndexBytes),ct(e.candidateAffectedScipPath,f.affectedIndexBytes);let v=performance.now()-n,R={scipPath:x?e.previousShardPath:e.candidateShardPath,candidateScipPath:e.candidateShardPath,affectedScipPath:e.candidateAffectedScipPath,completeScipUpdated:!x,durationMs:b()-t,cold:u.some(S=>S.cold),changedFiles:l.plan.changedFiles,affectedFiles:l.plan.affectedFiles,producerIdentity:r.producerIdentity,previousFragmentGeneration:l.previousFragmentGeneration,nextFragmentGeneration:l.nextFragmentGeneration,manifest:l.manifest,plan:l.plan,projectFileCount:o.length,referenceFragmentsByFile:new Map(g.map(S=>[S.relativePath,S.referenceFragments])),timings:{runtimeMs:a,graphMs:d,requestMs:m,serviceMs:u.reduce((S,B)=>S+B.durationMs,0),assemblyMs:y,fragmentStoreMs:P,writeMs:v}};return e.onStatus(`Incremental TypeScript index emitted ${R.affectedFiles.length} affected document(s) across ${l.projects.length} project(s) in ${(R.durationMs/1e3).toFixed(3)}s (${R.cold?"cold":"warm"} service; ${x?"whole SCIP deferred":"whole SCIP current"}; runtime ${a.toFixed(0)}ms, graph ${d.toFixed(0)}ms, request ${m.toFixed(0)}ms, assembly ${y.toFixed(0)}ms, fragments ${P.toFixed(0)}ms, write ${v.toFixed(0)}ms).`),R}catch(n){return e.onStatus(`Incremental TypeScript index unavailable: ${n instanceof Error?n.message:String(n)}. Falling back to the whole-project indexer.`),null}}function Sr(e){let t=Je();if(!t.available)throw new Error(t.reason);let n=fn({cacheDir:e.cacheDir,generationIdentity:e.generationIdentity,baseIndexBytes:Y(e.baseShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:Ae}),packageVersion:t.packageVersion});ct(e.candidateShardPath,n)}function fr(e,t,n){let r=e.files.filter(a=>wt(a.path,e.languages)!=="source").map(a=>({path:a.path,size:a.size,hash:a.hash})).sort((a,i)=>a.path.localeCompare(i.path));return dt(JSON.stringify({version:1,producerIdentity:n,pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:[...e.typescriptProjects].sort(),projectFiles:[...t].sort(),nonSourceInputs:r}))}function mr(e,t){return dt(JSON.stringify({version:1,producerIdentity:t,snapshot:e}))}function hr(e,t,n,r,a){let i=new Set(e.files.map(d=>d.path)),o=Qt({projectFiles:t.filter(d=>i.has(d)),snapshot:e,graph:n,engineIdentity:r}),s=new Map;for(let d of a){let l=o.identityFor(d,"typescript-scip-document-v1");if(l.key){s.set(d,l.key);continue}if(i.has(d))return null;s.set(d,dt(JSON.stringify({version:1,producerIdentity:r,generatedDocument:d})))}return s}function dt(e){return mi("sha256").update(e).digest("hex")}import{closeSync as Ri,existsSync as we,fstatSync as vi,lstatSync as Ii,openSync as Ei,renameSync as ut,rmSync as _e,statSync as wi,writeSync as _i}from"fs";import{cpus as ji}from"os";import{join as pt}from"path";function Ti(e,t){if(e.temporaryRootConfigContent===void 0)return null;let n=pt(t,"tsconfig.json"),r=Buffer.from(e.temporaryRootConfigContent,"utf8"),a;try{a=Ei(n,"wx",384)}catch(i){if(i.code==="EEXIST")return null;throw i}try{_i(a,r);let i=vi(a);return{path:n,content:r,device:i.dev,inode:i.ino}}finally{Ri(a)}}function Fi(e){if(e)try{let t=Ii(e.path);if(!t.isFile()||t.dev!==e.device||t.ino!==e.inode||t.size!==e.content.byteLength)return;let n;try{n=Y(e.path,{maxBytes:e.content.byteLength,inputKind:"temporary TypeScript index configuration"})}catch{return}if(!n.equals(e.content))return;_e(e.path)}catch(t){if(t.code!=="ENOENT")throw t}}function ki(e,t,n){if(!e.defaultOutputPath)return;let r=pt(t,e.defaultOutputPath);n!==r&&we(r)&&ut(r,n)}function Di(e,t,n){if(!e.defaultOutputPath)return null;let r=pt(t,e.defaultOutputPath);if(r===n)return null;let a=`${n}.default-output-backup`;return _e(a,{force:!0}),we(r)?(ut(r,a),{defaultOutputPath:r,backupPath:a}):{defaultOutputPath:r,backupPath:null}}function Oi(e){e&&(_e(e.defaultOutputPath,{force:!0}),e.backupPath&&we(e.backupPath)&&ut(e.backupPath,e.defaultOutputPath))}function Ai(e,t){if(e<=1)return 1;let n=Number(process.env.CODEBASEIQ_INDEXER_CONCURRENCY??0),r=Number.isFinite(t)&&t&&t>0?t:Number.isFinite(n)&&n>0?n:Math.min(8,Math.max(1,ji().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function Pr(e,t,n,r,a){T(a,"Reindex cancelled by its owner.");let i=e.filter(c=>c.config.defaultOutputPath),o=e.filter(c=>!c.config.defaultOutputPath),s=[],d=Ai(o.length,r),l=await kn(o,d,c=>lt(c,t,n,a));if(d>1){let c=new Map;for(let p of l.filter(u=>u.result.skipped&&u.retryable)){let u=o.find(g=>g.id===p.result.id);u&&(n(`Retrying ${u.label} indexer serially after parallel failure...`),T(a,"Reindex cancelled by its owner."),c.set(u.id,(await lt(u,t,n,a)).result))}s.push(...l.map(({result:p})=>c.get(p.id)??p))}else s.push(...l.map(({result:c})=>c));for(let c of i)T(a,"Reindex cancelled by its owner."),s.push((await lt(c,t,n,a)).result);return s.sort((c,p)=>e.findIndex(u=>u.id===c.id)-e.findIndex(u=>u.id===p.id))}async function lt(e,t,n,r){T(r,"Reindex cancelled by its owner."),n(`Indexing ${e.label} with ${e.resolvedBinary}...`),_e(e.scipPath,{force:!0});let a=Di(e.config,t,e.scipPath),i=Ti(e,t),o=[e.binary,...e.args].join(" "),s=b();try{e.trustedProjectTool&&qt(t,e.trustedProjectTool);let l=kt(e.binary,e.args),c=await ce({command:l.binary,args:l.args,label:`${e.label} indexer`,cwd:t,env:e.env,timeoutMs:Li(),maxStdoutBytes:50*1024*1024,maxStderrBytes:50*1024*1024,signal:r});if(c.status!==0){let p=c.stderr.trim();throw new Error(`${e.resolvedBinary} exited with status ${c.status}${p?`:
230
+ ${p}`:""}`)}ki(e.config,t,e.scipPath)}catch(l){if(r?.aborted)throw At(r,"Reindex cancelled by its owner.");let c=l instanceof Error?l.message:String(l),p=`${e.resolvedBinary} indexer failed: ${c.split(`
231
+ `)[0]}`,u=e.label===e.language?p:`${e.label}: ${p}`;return n(`Skipping ${e.label}: ${p}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:b()-s,command:o,skipped:{language:e.language,reason:u}},retryable:Mi(l)}}finally{Oi(a),Fi(i)}if(!we(e.scipPath)){let l=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`,c=e.label===e.language?l:`${e.label}: ${l}`;return n(`Skipping ${e.label}: ${l}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:b()-s,command:o,skipped:{language:e.language,reason:c}},retryable:!1}}let d;try{d=wi(e.scipPath).size}catch{d=void 0}return{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:b()-s,command:o,outputBytes:d},retryable:!1}}function Li(){let e=Number(process.env.CODEBASEIQ_INDEXER_TIMEOUT_MS);return Number.isFinite(e)&&e>0?Math.floor(e):It.indexer}function Mi(e){return e instanceof Et?e.kind==="spawn"&&br(e.cause):br(e)}function br(e){let t=e?.code;return t==="EAGAIN"||t==="ENOMEM"||t==="EMFILE"||t==="ENFILE"||t==="ETXTBSY"}import{execFileSync as Rr}from"child_process";import{homedir as xr,platform as Ni}from"os";import{delimiter as Ci,join as je}from"path";function vr(e,t){let n=e.installMethods,r=ge(e);if(!n?.length)return t(`No auto-install method available for ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1;for(let a of n){if(!a.identity||!a.destination){t(`Refusing ${a.label} installation for ${r}: the installer descriptor lacks an immutable identity or destination.`);continue}if(!Ft(a.prerequisite))continue;let i=$i(a);t(`Installing immutable ${a.identity} via ${a.label} into ${i}; expected executable: ${r}.`);try{Rr(a.binary,a.args,{stdio:"inherit",windowsHide:!0,timeout:3e5,env:process.env,shell:Ni()==="win32"});let o=ee(e);if(o){let s=o===e.indexerBinary?"":` (using ${o})`;return t(`Successfully installed ${a.identity} via ${a.label}${s}; resolved executable: ${o}.`),!0}t(`${a.label} command completed but ${r} was not found on PATH`)}catch(o){let s=o instanceof Error?o.message:String(o);t(`${a.label} install failed: ${s}`)}}return t(`Could not auto-install ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1}function $i(e){if(e.binary==="npm")return gt("npm",["root","-g"])??e.destination;if(e.binary==="go"){let t=gt("go",["env","GOBIN"]);if(t)return t;let n=gt("go",["env","GOPATH"]);if(n)return je(n.split(Ci)[0],"bin")}return e.binary==="dotnet"?je(process.env.DOTNET_CLI_HOME??xr(),".dotnet","tools"):e.binary==="dart"?je(process.env.PUB_CACHE??je(xr(),".pub-cache"),"bin"):e.destination}function gt(e,t){try{return Rr(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL",env:process.env}).trim()||null}catch{return null}}async function gd(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log}=e,a=e.skipAutoInstall===!0||e.installMissing!==!0,i=Ji(e),o=Date.now(),s=b();Fe(h(i.outputScip),{recursive:!0}),Fe(h(i.outputDb),{recursive:!0});let d=e.languages??Ue(t);if(d.length===0)throw new Error("No supported languages detected in this project. Looked for: tsconfig.json, Cargo.toml, go.mod, pyproject.toml, etc.");r(`Detected languages: ${d.join(", ")}`);let l=ue("reindex.fingerprint",()=>Bt(t,d,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),{languages:d.length}),c,p;if(e.skipIfUnchanged!==!1&&!Sn(t,i.outputDb)&&Ir(i.outputScip)===Ir(E(h(i.outputDb),"index.scip"))){let f=pe(t);if(c=f?.clean?he(f,l):void 0,f&&!f.clean&&!Hi(i)){let y=bn(f,d,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath});if(y)try{ye({snapshot:y.snapshot,manifest:y.manifest,targetCacheDir:h(i.outputDb),targetProjectRoot:t,persistLease:!1}),vn(y.snapshot,h(i.outputDb)),r(`Forked shared baseline ${y.snapshot.generationId.slice(0,12)} for dirty worktree reindex`)}catch(P){r(`Shared baseline fork failed; continuing locally: ${A(P)}`)}}else if(c){let y=He(c);if(y){if(!qi(i,l))try{ye({snapshot:c,manifest:y,targetCacheDir:h(i.outputDb),targetProjectRoot:t}),r(`Attached shared generation ${c.generationId.slice(0,12)}`)}catch(P){r(`Shared generation attach failed; continuing locally: ${A(P)}`)}}else{let P=await xn(c);if(P.kind==="owner")p=P.release;else if(P.kind==="generation-ready"){let v=He(c);if(v)try{ye({snapshot:c,manifest:v,targetCacheDir:h(i.outputDb),targetProjectRoot:t,action:"waited"}),r(`Attached shared generation ${c.generationId.slice(0,12)} after waiting`)}catch(R){r(`Shared generation attach failed after waiting; continuing locally: ${A(R)}`)}}else r("Shared generation build lock timed out; continuing with an isolated local reindex")}}}let g=Nt(E(h(i.outputDb),"cache-lifecycle.lock"),{waitMs:3e4});if(!g)throw p?.(),new Error(`Could not acquire codebaseiq cache lifecycle lock for ${h(i.outputDb)}.`);let m;try{m=await H("reindex.lock",()=>Po(E(h(i.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:r}),{languages:d.length})}catch(f){throw g.release(),p?.(),f}let x=null,w=On();try{yn(i.outputDb,i.outputScip,i.metaPath);let f=Xi(h(i.outputDb));f.removed>0&&r(`Removed ${f.removed} abandoned reindex workspace(s)`);for(let G of f.errors)r(`Could not remove abandoned reindex workspace: ${G}`);let y=null,P=ue("reindex.reuse-check",()=>(y=zi({opts:e,paths:i,languages:d,fingerprint:l,start:o,monotonicStart:s,onStatus:r}),y),()=>({languages:d.length,reused:y!==null}));if(P){Er({snapshot:c,paths:i,projectRoot:t,fingerprint:l,onStatus:r});let G=We(i.outputDb,P);return G.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${G.reason}`),Ce(t,h(i.outputDb)),P}await H("reindex.scip-cli-ready",()=>po(a,r));let v=Vi(i);x=v.runDir;let R,S=await H("reindex.fresh",async()=>(R=await Yi({opts:e,languages:d,projectRoot:t,paths:i,tempPaths:v,fingerprint:l,start:o,monotonicStart:s,maxHeapMb:n,skipAutoInstall:a,onStatus:r,writeTelemetry:w}),R),()=>({languages:d.length,reused:R?.reused,skipped:R?.skipped.length}));Er({snapshot:c,paths:i,projectRoot:t,fingerprint:l,onStatus:r});let B=We(i.outputDb,S);return B.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${B.reason}`),Ce(t,h(i.outputDb)),S}catch(f){let y=Oe({trigger:e.trigger,result:"failed",start:o,monotonicStart:s,error:f instanceof Error?f.message:String(f)});Jr(i.metaPath,y);let P=on(i.outputDb,y);throw P.state==="failed"&&r(`Warning: failed reindex activity telemetry was not recorded: ${P.reason}`),f}finally{if(x){let f=x;try{W(()=>V(f,{recursive:!0,force:!0}))}catch(y){r(`Warning: temporary reindex workspace was left behind: ${A(y)}`)}}m(),g.release(),p?.()}}function Er(e){if(e.snapshot)try{let t=pe(e.projectRoot),n=t?he(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=Pn({snapshot:e.snapshot,sourceCacheDir:h(e.paths.outputDb),sourceProjectRoot:e.projectRoot,sourceStillValid:()=>{let a=pe(e.projectRoot);return(a?he(a,e.fingerprint):void 0)?.generationId===e.snapshot?.generationId}});Rn(e.snapshot,h(e.paths.outputDb),"built"),e.onStatus(r.kind==="published"?`Published shared generation ${e.snapshot.generationId.slice(0,12)} (${r.achievedDurability})`:`Shared generation ${e.snapshot.generationId.slice(0,12)} was already available (${r.achievedDurability})`)}catch(t){e.onStatus(`Shared generation publication failed; local index remains valid: ${A(t)}`)}}function qi(e,t){if(!_(e.outputScip)||!_(e.outputDb)||!Hr(e.metaPath,t))return!1;let n=N(e.outputDb,e.metaPath);return n.state!=="invalid"&&n.state!=="drifted"}function Hi(e){if(!_(e.outputScip)||!_(e.outputDb)||!X(e.metaPath))return!1;let t=N(e.outputDb,e.metaPath);return t.state!=="invalid"&&t.state!=="drifted"}function A(e){return e instanceof Error?e.message:String(e)}function ht(e,t,n,r,a,i){try{ne(An({indexPath:n,reuseExisting:a,affectedFiles:i}),{projectRoot:e,dbPath:t,onStatus:r})}catch(o){r(`Runtime-boundary extraction unavailable: ${o instanceof Error?o.message:String(o)}.`)}}function Ji(e){let t=e.outputScip??E(e.projectRoot,"index.scip"),n=e.outputDb??E(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:E(h(n),"meta.json")}}function zi(e){let t=N(e.paths.outputDb,e.paths.metaPath);if(e.opts.skipIfUnchanged===!1||!_(e.paths.outputScip)||!_(e.paths.outputDb)||!Hr(e.paths.metaPath,e.fingerprint)||t.state==="invalid"||t.state==="drifted")return null;ne(te(),{projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),ht(e.opts.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0),N(e.paths.outputDb,e.paths.metaPath).state==="drifted"&&(qe(e.paths.outputDb,e.paths.metaPath),e.onStatus("Published refreshed SQLite generation after post-index augmentation"));let n=b()-e.monotonicStart,r=Oe({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:e.languages,skipped:[]});return Jr(e.paths.metaPath,r),e.onStatus(`Index unchanged; reused existing SQLite index in ${(n/1e3).toFixed(1)}s`),{languages:e.languages,indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:n,reused:!0,skipped:[],lastRefresh:r,shards:Qi(e.paths,e.opts.projectRoot,e.languages,e.opts)}}function Qi(e,t,n,r){let a=Wr(t,n,r);return n.map(i=>({id:i,language:i,reused:!0,fingerprint:re(a[i]),outputBytes:ae(St(e.outputDb,i)),durationMs:0}))}function Vi(e){let t=Tt(E(h(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:E(t,Te(e.outputScip)),tempOutputDb:E(t,Te(e.outputDb)),tempMetaPath:E(t,Te(e.metaPath))}}function Xi(e){let t=[],n;try{n=Dr(e,{withFileTypes:!0})}catch(a){return{removed:0,errors:[A(a)]}}let r=0;for(let a of n)if(!(!a.name.startsWith("reindex-")||!a.isDirectory()))try{V(E(e,a.name),{recursive:!0,force:!0}),r+=1}catch(i){t.push(`${a.name}: ${A(i)}`)}return{removed:r,errors:t}}async function Yi(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},n,r=await H("reindex.language-indexers",async()=>(n=await Zi(e,t),n),()=>({languages:e.languages.length,indexed:n?.indexedOutputs.length,reused:n?.reusedLanguages.length,skipped:n?.skippedLanguages.length})),{indexedOutputs:a,skippedLanguages:i,reusedLanguages:o,languageFingerprints:s,shards:d,typescriptProjectShardContext:l,incrementalTypeScript:c}=r;if(o.length>0&&e.onStatus(`Reused ${o.length} cached language shard(s): ${o.join(", ")}`),Ki({run:e,indexedOutputs:a,skippedLanguages:i,reusedLanguages:o})){let g=ue("reindex.publish",()=>co(e,a,i,o,s,l),{mode:"metadata-only",languages:a.length,reused:o.length}),m=g.durationMs;return e.onStatus(`All language shards unchanged; reused existing SQLite index in ${(m/1e3).toFixed(1)}s`),{languages:a.map(x=>x.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:m,reused:!0,skipped:i,lastRefresh:g,shards:d,writeTelemetry:e.writeTelemetry}}let p=await H("reindex.publish",()=>so(e,t,a,i,o,s,l,c),{mode:c?"incremental-or-fallback":"full",languages:a.length,reused:o.length,skipped:i.length}),u=p.durationMs;return e.onStatus(`Done in ${(u/1e3).toFixed(1)}s`),{languages:a.map(g=>g.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:u,reused:!1,skipped:i,lastRefresh:p,shards:d,writeTelemetry:e.writeTelemetry}}function Ki(e){if(e.run.opts.skipIfUnchanged===!1||e.skippedLanguages.length>0||!_(e.run.paths.outputScip)||!_(e.run.paths.outputDb))return!1;let t=N(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(a=>a.language));return e.run.languages.length>0&&r.size===e.run.languages.length&&e.indexedOutputs.length===e.run.languages.length&&e.run.languages.every(a=>n.has(a)&&r.has(a))}async function Zi(e,t){let n=ao({paths:e.paths,projectRoot:e.projectRoot,languages:e.languages,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath}),r=[],a=new Set;for(let[j,Pt]of n)Pt.reused&&(r.push({language:j,scipPath:Pt.scipPath}),a.add(j));for(let j of a)e.onStatus(`Reusing cached ${j} SCIP shard (language inputs unchanged).`);let i=n.get("typescript"),o=N(e.paths.outputDb,e.paths.metaPath),s=X(e.paths.metaPath),d=o.state==="legacy"||o.state==="current",l=s?.scipCompanion!=="deferred"&&(o.state!=="current"||o.generation.publication?.scipCompanion!=="deferred"),c=i&&!i.reused&&d?yr({projectRoot:e.projectRoot,cacheDir:h(e.paths.outputDb),previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,previousShardPath:i.scipPath,candidateShardPath:ie(e.tempPaths.tempOutputScip,"typescript-incremental",0),candidateAffectedScipPath:ie(e.tempPaths.tempOutputScip,"typescript-affected",0),baseShardCurrent:l,previousSnapshot:yt(e.paths.metaPath),currentSnapshot:e.fingerprint,projectMode:e.opts.typescriptProjectMode,onStatus:e.onStatus}):null,p=new Set(c?["typescript"]:[]),u=c?void 0:eo(e,n),{preparedRuns:g,skippedLanguages:m,languageOutputScipPaths:x}=go({languages:e.languages.filter(j=>!a.has(j)&&!p.has(j)),tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:t,skipAutoInstall:e.skipAutoInstall,trustProjectTools:e.opts.trustProjectTools===!0,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,preDiscoveredTypeScriptProjects:u?.allProjects,clojureConfigPath:e.opts.clojureConfigPath,onStatus:e.onStatus}),w=u?g.filter(j=>j.language!=="typescript"||u.missedProjectIds.has(j.id)):g,f=await Pr(w,e.projectRoot,e.onStatus,e.opts.indexerConcurrency,e.opts.signal),y=[];if(u){no(e.paths.outputDb,f,e.writeTelemetry);let j=x.typescript??e.tempPaths.tempOutputScip;y=ro({outputDb:e.paths.outputDb,tempOutputScip:e.tempPaths.tempOutputScip,outputScipPath:j,reusedProjects:u.reusedProjects,writeTelemetry:e.writeTelemetry})}let P=[...f,...y],{indexedOutputs:v}=mo(P,m),R=c?[{language:"typescript",scipPath:c.scipPath}]:[],S=[...r,...R,...v];ho(S,m,e.languages,e.opts.allowPartial,e.onStatus);let B=c?[{id:"typescript",language:"typescript",label:"typescript (incremental documents)",scipPath:c.scipPath,outputScipPath:c.scipPath,durationMs:c.durationMs,command:"watch-service:typescript-index",outputBytes:ae(c.scipPath)??void 0}]:[],G=io(n,[...f,...B],u?{outputDb:e.paths.outputDb,classification:u.classification}:void 0);return{indexedOutputs:S,skippedLanguages:m,reusedLanguages:[...a],languageFingerprints:oo(n,e.languages),shards:G,typescriptProjectShardContext:u?{projects:u.allProjects,fingerprints:u.fingerprints}:void 0,incrementalTypeScript:c??void 0}}function eo(e,t){let n=t.get("typescript");if(!n||n.reused||e.opts.typescriptProjectMode!=="workspace")return;let r=z(e.projectRoot,e.opts.typescriptProjects);if(r.length===0)return;let a=dr(e.projectRoot,r),i=or(n.fingerprint.files,r),o=sr(r,a),s=cr(r,i,o),d=X(e.paths.metaPath),c=to(d,s,m=>_(De(e.paths.outputDb,m))),p=[...c.entries()].filter(([,m])=>m.reused).map(([m])=>m),u=new Set(p),g=new Set(r.filter(m=>!u.has(m)).map(m=>`typescript:${m}`));return{allProjects:r,fingerprints:s,classification:c,reusedProjects:p,missedProjectIds:g}}function to(e,t,n){let r=new Map;for(let a of Object.keys(t)){let i=t[a];if(!e){r.set(a,{reused:!1,reason:"no reindex metadata found",fingerprint:i});continue}let o=e.version===Z&&Me(e).typescriptProjectShardReuse?e.typescriptProjectShards?.[a]:void 0;if(!o){r.set(a,{reused:!1,reason:"no cached fingerprint for this project",fingerprint:i});continue}if(!n(a)){r.set(a,{reused:!1,reason:"cached shard file missing on disk",fingerprint:i});continue}if(k(o)!==k(i)){r.set(a,{reused:!1,reason:"project inputs changed since last index",fingerprint:i});continue}r.set(a,{reused:!0,fingerprint:i})}return r}function no(e,t,n){for(let r of t){if(r.skipped||!r.id.startsWith("typescript:"))continue;let a=r.id.slice(11),i=De(e,a);Fe(h(i),{recursive:!0}),$(n,C(r.scipPath,i))}}function ro(e){return e.reusedProjects.map((t,n)=>{let r=De(e.outputDb,t),a=ie(e.tempOutputScip,"typescript-project-cached",n);return $(e.writeTelemetry,C(r,a)),{id:`typescript:${t}`,language:"typescript",label:`typescript (${t})`,scipPath:a,outputScipPath:e.outputScipPath,durationMs:0,command:"cached",outputBytes:ae(a)??void 0}})}function ao(e){let t=X(e.paths.metaPath),n=Wr(e.projectRoot,e.languages,e),r=new Map;for(let a of e.languages){let i=St(e.paths.outputDb,a),o=n[a];if(!t){r.set(a,{reused:!1,reason:"no reindex metadata found",fingerprint:o,scipPath:i});continue}if(t.version!==Z){r.set(a,{reused:!1,reason:`metadata version ${String(t.version??"unknown")} predates per-language shard caching`,fingerprint:o,scipPath:i});continue}if(a==="typescript"&&t.scipCompanion==="deferred"){r.set(a,{reused:!1,reason:"whole TypeScript SCIP companion is deferred behind changed-document overlays",fingerprint:o,scipPath:i});continue}if(!Me(t).languageShardReuse||!t.languageFingerprints){r.set(a,{reused:!1,reason:"no per-language fingerprints recorded in metadata",fingerprint:o,scipPath:i});continue}let s=t.languageFingerprints[a];if(!s){r.set(a,{reused:!1,reason:"no cached fingerprint for this language",fingerprint:o,scipPath:i});continue}if(!_(i)){r.set(a,{reused:!1,reason:"cached shard file missing on disk",fingerprint:o,scipPath:i});continue}if(k(s)!==k(o)){r.set(a,{reused:!1,reason:"language inputs changed since last index",fingerprint:o,scipPath:i});continue}r.set(a,{reused:!0,fingerprint:o,scipPath:i})}return r}function io(e,t,n){let r=[];for(let[a,i]of e)i.reused&&r.push({id:a,language:a,reused:!0,fingerprint:re(i.fingerprint),outputBytes:ae(i.scipPath),durationMs:0});for(let a of t){let i=e.get(a.language),o=n&&a.id.startsWith("typescript:")?a.id.slice(11):null,s=o?n.classification.get(o):void 0;r.push({id:a.id,language:a.language,reused:!1,missReason:s?.reason??i?.reason??a.skipped?.reason,fingerprint:s?re(s.fingerprint):i?re(i.fingerprint):"unknown",outputBytes:a.outputBytes??null,durationMs:a.durationMs,command:a.command})}if(n)for(let[a,i]of n.classification)i.reused&&r.push({id:`typescript:${a}`,language:"typescript",reused:!0,fingerprint:re(i.fingerprint),outputBytes:ae(De(n.outputDb,a)),durationMs:0});return r}function re(e){return Bi("sha256").update(k(e)).digest("hex").slice(0,16)}function ae(e){try{return Gi(e).size}catch{return null}}function oo(e,t){let n={};for(let r of t){let a=e.get(r);a&&(n[r]=a.fingerprint)}return n}async function so(e,t,n,r,a,i,o,s){T(e.opts.signal,"Reindex cancelled by its owner.");let d=!s||s.completeScipUpdated,l=!1;d&&(wr(e.paths.outputDb,n,e.writeTelemetry),l=_r(n,e.tempPaths.tempOutputScip,e.onStatus));let c=await yo({run:e,env:t,indexedOutputs:n,skippedLanguages:r,reusedLanguages:a,incrementalTypeScript:s,completeScipAvailable:d,completeScipSanitized:l,materializeFullFallback:async()=>{if(T(e.opts.signal,"Reindex cancelled by its owner."),!s||s.completeScipUpdated)return l;e.onStatus("Materializing the deferred whole TypeScript SCIP companion for full conversion..."),Sr({cacheDir:h(e.paths.outputDb),generationIdentity:s.nextFragmentGeneration,baseShardPath:s.scipPath,candidateShardPath:s.candidateScipPath});let v=n.map(R=>R.language==="typescript"?{language:R.language,scipPath:s.candidateScipPath}:R);return wr(e.paths.outputDb,v,e.writeTelemetry),l=_r(v,e.tempPaths.tempOutputScip,e.onStatus),l}});T(e.opts.signal,"Reindex cancelled by its owner."),ne(te(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),ht(e.projectRoot,e.tempPaths.tempOutputDb,e.tempPaths.tempOutputScip,e.onStatus,!1,s?.affectedFiles);let p=tt(e.tempPaths.tempOutputDb);if(p.added.length>0&&e.onStatus(`Added SQLite query indexes: ${p.added.join(", ")}`),p.removed.length>0&&e.onStatus(`Removed redundant SQLite indexes: ${p.removed.join(", ")}`),c.mode==="incremental"&&s){let v=null,R=null;try{v=new F({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,indexPath:e.tempPaths.tempOutputScip}),R=new F({projectRoot:e.projectRoot,dbPath:e.paths.outputDb,indexPath:e.paths.outputScip});let S=Vt(v,e.fingerprint,s.referenceFragmentsByFile,R);e.onStatus(`Cached exact TypeScript reference fragments for ${S} affected document(s).`)}catch(S){e.onStatus(`Exact TypeScript reference fragment prefill unavailable: ${S instanceof Error?S.message:String(S)}.`)}finally{v?.close(),R?.close()}}let u=yt(e.paths.metaPath),g=c.mode==="incremental"&&s?bo(s,c.changedDocumentPaths):Ye({projectRoot:e.projectRoot,previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.tempPaths.tempOutputDb,candidateIndexPath:e.tempPaths.tempOutputScip,previousSnapshot:u,currentSnapshot:e.fingerprint,refreshResult:"rebuilt"}),m=Oe({trigger:e.opts.trigger,result:"rebuilt",start:e.start,monotonicStart:e.monotonicStart,languages:n.map(v=>v.language),skipped:[...r]}),x=c.mode==="incremental"&&c.scipCompanion==="deferred",w={...i};x&&delete w.typescript;let{metadata:f,pruneProjects:y}=Lr({run:e,indexedOutputs:n,skippedLanguages:r,reusedLanguages:a,languageFingerprints:w,typescriptProjectShardContext:o,lastRefresh:m});f.scipCompanion=x?"deferred":"current",Mr(e.paths.outputDb,y),bt(e.tempPaths.tempMetaPath,f);let P=hn({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:c.mode==="incremental"&&c.scipCompanion==="deferred",publication:c.mode==="incremental"?{mode:"incremental",validation:"passed",converterDurationMs:c.converterDurationMs,affectedDocumentCount:s?.affectedFiles.length,changedDocumentCount:c.changedDocumentPaths.length,producerDurationMs:s?.timings.serviceMs,materializationDurationMs:s?.durationMs,patchDurationMs:c.patchDurationMs,scipCompanion:c.scipCompanion,...c.scipCompanion==="deferred"&&s?{typescriptOverlayGeneration:s.nextFragmentGeneration}:{}}:{mode:"full",validation:"passed",converterDurationMs:c.converterDurationMs,scipCompanion:"current",...c.fallbackReason?{fallbackReason:c.fallbackReason}:{}}});return P.achievedDurability==="file-flushed"&&e.onStatus(`Published local generation ${P.currentGeneration.slice(0,12)} (file-flushed; directory sync unsupported)`),mn(h(e.paths.outputDb),c.mode==="incremental"&&c.scipCompanion==="deferred"?[s.nextFragmentGeneration]:[]),un(h(e.paths.outputDb),s?.completeScipUpdated?[s.nextFragmentGeneration]:[]),Ar(e.paths.outputDb,g,e.onStatus),m}function co(e,t,n,r,a,i){let o=yt(e.paths.metaPath),s=null;try{$(e.writeTelemetry,C(e.paths.outputDb,e.tempPaths.tempOutputDb))}catch(u){s=Bn("reused","oracle-error",`Could not snapshot the prior database: ${u instanceof Error?u.message:String(u)}`)}ne(te(),{projectRoot:e.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),ht(e.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0);let d=tt(e.paths.outputDb);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(", ")}`),s??=Ye({projectRoot:e.projectRoot,previousDbPath:e.tempPaths.tempOutputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.paths.outputDb,candidateIndexPath:e.paths.outputScip,previousSnapshot:o,currentSnapshot:e.fingerprint,refreshResult:"reused"});let l=Oe({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:t.map(u=>u.language),skipped:[...n]}),{metadata:c,pruneProjects:p}=Lr({run:e,indexedOutputs:t,skippedLanguages:n,reusedLanguages:r,languageFingerprints:a,typescriptProjectShardContext:i,lastRefresh:l});return Mr(e.paths.outputDb,p),bt(e.paths.metaPath,c),qe(e.paths.outputDb,e.paths.metaPath),Ar(e.paths.outputDb,s,e.onStatus),l}function yt(e){return _t(X(e)?.fingerprint)}function Ar(e,t,n){try{Un(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 Lr(e){let t=lo({mode:e.run.opts.typescriptProjectMode,skippedLanguages:e.skippedLanguages,reusedLanguages:e.reusedLanguages,context:e.typescriptProjectShardContext,metaPath:e.run.paths.metaPath});return{metadata:{version:Z,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 lo(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=X(e.metaPath),n=t?.version===Z?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 Mr(e,t){let n=qr(e);if(t===null){W(()=>V(n,{recursive:!0,force:!0}));return}let r;try{r=Dr(n)}catch{return}for(let a of uo(r,t))W(()=>V(E(n,a),{force:!0}))}function uo(e,t){let n=new Set(t.map(r=>`${it(r)}.scip`));return e.filter(r=>!n.has(r))}function wr(e,t,n){for(let r of t){let a=St(e,r.language);Fe(h(a),{recursive:!0}),r.scipPath!==a&&$(n,C(r.scipPath,a))}}async function po(e,t){if(!$e()){if(Wi()==="win32")throw new Error("The scip CLI was not found. On Windows it ships via the npm sidecar package codebaseiq-windows (installed automatically with codebaseiq). Reinstall codebaseiq with optional dependencies enabled, or follow 'codebaseiq setup' guidance for the exact sidecar package version, or set CODEBASEIQ_SCIP_BIN to a local scip.exe path.");if(e)throw new Error(`The scip CLI is required but not found on PATH.
232
+ To install the reviewed version, run: codebaseiq reindex --install-missing
233
+ Or install manually from: https://github.com/sourcegraph/scip/releases`);if(t("scip CLI not found on PATH. Attempting auto-install..."),!Dt(t))throw new Error(`The scip CLI is required but could not be installed.
234
+ Install manually from: https://github.com/sourcegraph/scip/releases`)}}function go(e){let t=[],n=[],r=e.languages.map((i,o)=>({language:i,scipPath:e.languages.length>1?ie(e.tempOutputScip,i,o):e.tempOutputScip})),a=Object.fromEntries(r.map(({language:i,scipPath:o})=>[i,o]));for(let{language:i,scipPath:o}of r){let s=fo({...e,language:i,scipPath:o});for(let d of s)"skipped"in d?Nr(n,d.skipped):t.push(d.prepared)}return{preparedRuns:t,skippedLanguages:n,languageOutputScipPaths:a}}function fo(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[ft({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=e.preDiscoveredTypeScriptProjects??z(e.projectRoot,e.typescriptProjects);return t.length===0?[ft({...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)=>ft({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:ie(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function ft(e){let t=Ke(e.language),n=ge(t),r=Ut(t,e.projectRoot),a=e.trustProjectTools&&r?Wt(t,e.projectRoot):null,i=ee(t);if(!a&&!i&&r){let c=`${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}: ${c}`),{skipped:{language:e.language,reason:c}}}if(!a&&!i&&!Gt(t)){if(e.skipAutoInstall){let c=`${n} not found on PATH. To install the reviewed version, run: codebaseiq reindex --install-missing${t.installUrl?` (manual source: ${t.installUrl})`:""}`;return e.onStatus(`Skipping ${e.language}: ${c}`),{skipped:{language:e.language,reason:c}}}if(e.onStatus(`${n} not found. Attempting auto-install...`),!vr(t,e.onStatus)){let c=`${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}: ${c}`),{skipped:{language:e.language,reason:c}}}}let o=a?.canonicalPath??ee(t);if(!o){let c=`${n} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${c}`),{skipped:{language:e.language,reason:c}}}let{binary:s,args:d}=t.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:o,projectPath:e.projectPath,configPath:e.language==="clojure"?e.clojureConfigPath:void 0}),l=Vn({language:e.language,projectPath:e.projectPath,pnpmWorkspaces:e.pnpmWorkspaces});if(a&&!a.executable){let c=`${a.relativePath} is not executable; refusing project-local indexer.`;return e.onStatus(`Skipping ${e.language}: ${c}`),{skipped:{language:e.language,reason:c}}}return a&&e.onStatus(`Trusted project-local ${e.language} indexer ${a.relativePath} (${a.sha256.slice(0,12)}\u2026, ${a.canonicalPath}).`),{prepared:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,config:t,resolvedBinary:o,binary:s,args:d,env:Ht(t,e.env,o),...l===void 0?{}:{temporaryRootConfigContent:l},...a?{trustedProjectTool:a}:{}}}}function mo(e,t){let n=new Map;for(let a of e)if(a.skipped)Nr(t,a.skipped);else{let i=`${a.language}\0${a.outputScipPath}`,o=n.get(i)??{language:a.language,outputScipPath:a.outputScipPath,scipPaths:[]};o.scipPaths.push(a.scipPath),n.set(i,o)}let r=[];for(let a of n.values())if(a.scipPaths.length>1)rn(a.scipPaths,a.outputScipPath),r.push({language:a.language,scipPath:a.outputScipPath});else{let i=a.scipPaths[0];i!==a.outputScipPath&&Or(i,a.outputScipPath),r.push({language:a.language,scipPath:a.outputScipPath})}return{indexedOutputs:r}}function Nr(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 ho(e,t,n,r,a){if(e.length===0){let i=t.map(o=>` - ${o.language}: ${o.reason}`).join(`
235
+ `);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
236
+ `+i)}if(t.length!==0&&(a(`Indexed ${e.length} language output(s); skipped or incomplete: ${t.map(i=>i.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.
237
+ `+t.map(i=>` - ${i.language}: ${i.reason}`).join(`
238
+ `))}function _r(e,t,n){if(e.length>1){n(`Merging ${e.length} language indexes...`);let r=performance.now(),a=an(e.map(i=>i.scipPath),t);return $r(a,n),n(`Merged and sanitized SCIP indexes in ${(performance.now()-r).toFixed(0)}ms.`),!0}else e[0].scipPath!==t&&Or(e[0].scipPath,t);return!1}async function yo(e){let t;if(So(e)){let a=E(e.run.tempPaths.runDir,"typescript-affected.db");try{Cr(e.incrementalTypeScript.affectedScipPath,e.run.onStatus),e.run.onStatus(`Converting ${e.incrementalTypeScript.affectedFiles.length} affected TypeScript document(s) to SQLite...`);let i=performance.now();await jr(e.incrementalTypeScript.affectedScipPath,a,e.env,e.run.onStatus,!1,e.run.opts.signal),e.run.onStatus(`Converted affected SCIP documents in ${(performance.now()-i).toFixed(0)}ms.`);let o=tr({previousDbPath:e.run.paths.outputDb,miniDbPath:a,candidateDbPath:e.run.tempPaths.tempOutputDb,affectedFiles:e.incrementalTypeScript.affectedFiles,writeTelemetry:e.run.writeTelemetry});return e.run.onStatus(`Patched ${o.affectedDocumentCount} SQLite document(s) in ${(o.durationMs/1e3).toFixed(3)}s.`),{mode:"incremental",changedDocumentPaths:o.changedDocumentPaths,patchDurationMs:o.durationMs,converterDurationMs:performance.now()-i,scipCompanion:e.incrementalTypeScript.completeScipUpdated?"current":"deferred"}}catch(i){T(e.run.opts.signal,"Reindex cancelled by its owner."),t=i instanceof Error?i.message:String(i),W(()=>V(a,{force:!0})),W(()=>V(e.run.tempPaths.tempOutputDb,{force:!0})),e.run.onStatus(`Incremental SQLite publication unavailable: ${t}. Falling back to complete conversion.`)}}let n=e.completeScipSanitized;e.completeScipAvailable||(n=await e.materializeFullFallback());let r=performance.now();return await jr(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 So(e){if(!e.incrementalTypeScript||e.skippedLanguages.length>0||!_(e.run.paths.outputDb)||!_(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 bo(e,t){let n=b(),r=[...t].sort(),a=new Set(r),i={addedFiles:[],modifiedFiles:r,deletedFiles:[],changedFiles:r,unchangedFiles:e.affectedFiles.filter(o=>!a.has(o)).sort()};return{version:1,status:"evaluated",refreshResult:"rebuilt",recordedAt:new Date().toISOString(),durationMs:b()-n,manifest:e.manifest,plan:e.plan,comparison:i,evaluation:Xe(e.plan,i,e.projectFileCount)}}async function jr(e,t,n,r,a=!1,i){if(T(i,"Reindex cancelled by its owner."),r("Converting to SQLite..."),!_(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{a||Cr(e,r);let o=$e();if(!o)throw new Error("scip CLI is not available");let s=await ce({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:i});if(s.status!==0)throw new Error(`scip expt-convert exited with ${s.status}${s.stderr.trim()?`: ${s.stderr.trim()}`:""}`)}catch(o){T(i,"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 Cr(e,t){let n=nn(e);$r(n,t)}function $r(e,t){e.removedDefinitionOccurrences!==0&&t(`Sanitized ${e.removedDefinitionOccurrences} invalid definition occurrences across ${e.touchedDocuments} documents before SQLite conversion.`)}function ie(e,t,n){let r=Ui(e)||".scip",a=Te(e,r);return E(h(e),`${a}.${n+1}.${t}${r}`)}async function Po(e,t){for(let n=0;n<2;n++){let r=xo(e,t);if(r)return r;let a=Ro(e);if(a&&Ur(t.trigger,a)){t.onStatus(`Manual reindex preempting watcher refresh started at ${a.startedAt}.`);let i;try{i=await Io(a)}catch(s){throw new Error(`Could not verify the watcher's in-progress reindex owner (pid ${a.pid}); refusing to steal an active lock: ${A(s)}`,{cause:s})}if(!i)throw new Error(`Could not confirm the watcher's in-progress reindex (pid ${a.pid}) terminated for ${h(e)}; refusing to steal an active lock.`);let o=Be(e,{parseLegacy:ke});if(!Mt(e,o,{parseLegacy:ke}))throw new Error(`Reindex lock ownership changed before preemption completed for ${h(e)}.`);continue}throw new Error(`Another codebaseiq reindex is already running for ${h(e)}.`)}throw new Error(`Could not acquire codebaseiq reindex lock for ${h(e)}.`)}function xo(e,t){let n=U(process.pid),r=Lt(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:ke});if(r.kind==="acquired"&&r.reclaimed){let a=Br(r.reclaimed,e);a&&Ur(t.trigger,a)?t.onStatus(`Manual reindex preempting watcher refresh started at ${a.startedAt}; its prior owner was already stale.`):t.onStatus(`Recovered an abandoned or incomplete reindex lock for ${h(e)}.`)}return r.kind==="acquired"?()=>{r.lock.release()}:null}function Ro(e){return Br(Be(e,{parseLegacy:ke}),e)}var ke=e=>{let t=Gr(e,"");return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function Br(e,t){if(e.state==="valid"&&e.record?.kind==="reindex"){let n=e.record.detail??{};return{version:2,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},...n.processGroupLeader===!0?{processGroupLeader:!0}:{},projectRoot:typeof n.projectRoot=="string"?n.projectRoot:h(t),startedAt:e.record.startedAt,trigger:n.trigger}}return Gr(e.parsed,t)}function Gr(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=vt(n.processIdentity);return r?.pid===n.pid?{processIdentity:r}:{}})(),...n.processGroupLeader===!0?{processGroupLeader:!0}:{},projectRoot:typeof n.projectRoot=="string"?n.projectRoot:h(t),startedAt:typeof n.startedAt=="string"?n.startedAt:"unknown",trigger:n.trigger}}catch{return null}}function Ur(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 Io(e){return!J(e.pid)||(mt(e),Tr(e,"SIGTERM"),await Fr(e,2e3))?!0:(mt(e),Tr(e,"SIGKILL"),Fr(e,1e3))}function Tr(e,t){if(e.processGroupLeader)try{process.kill(-e.pid,t);return}catch{if(!J(e.pid))return;mt(e)}try{process.kill(e.pid,t)}catch{}}async function Fr(e,t){let n=b()+t;for(;b()<n;){if(kr(e))return!0;await Eo(50)}return kr(e)}function mt(e){if(!e.processIdentity)throw new Error(`Refusing to signal reindex pid ${e.pid}: its ownership record has no process identity.`);let t=U(e.pid);if(!t)throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity is unavailable.`);if(!K(e.processIdentity,t))throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity does not match the ownership record.`)}function kr(e){if(!J(e.pid))return!0;if(!e.processIdentity)return!1;let t=U(e.pid);return t!==null&&!K(e.processIdentity,t)}function Eo(e){return new Promise(t=>setTimeout(t,e))}function Wr(e,t,n){return Object.fromEntries(t.map(r=>{let a=r==="typescript"?Ct(n.typescriptProjects):[],i=r==="clojure"?wo(n.clojureConfigPath):void 0,o=[...Ke(r).markerFiles,...a,...i?[i]:[]],s=r==="typescript"?{typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:a}:{typescriptProjectMode:"single",typescriptProjects:[]};return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&&_o(n),...s,clojureConfigPath:i,files:$t(e,{language:r,markerFiles:o})}]}))}function wo(e){return e?.trim()||void 0}function _o(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function St(e,t){return E(h(e),"language-indexes",`${t}.scip`)}function qr(e){return E(h(e),"language-indexes","typescript-projects")}function De(e,t){return E(qr(e),`${it(t)}.scip`)}function X(e){try{return Le(le(se(e,"reindex metadata")))}catch{return null}}function Hr(e,t){try{let n=le(se(e,"reindex metadata"));if(n.kind!=="legacy"&&n.kind!=="supported")return!1;let r=n.metadata;return n.capabilities.publishableGeneration&&jt(r)&&k(r.fingerprint)===k(t)&&k([...r.indexedLanguages??[]].sort())===k(t.languages)}catch{return!1}}function bt(e,t){zt(e,t,{spacing:2,trailingNewline:!0})}function Jr(e,t){try{let n=Le(le(se(e,"reindex metadata")));if(!n)return;bt(e,{...n,lastRefresh:t})}catch{}}function Oe(e){return{trigger:e.trigger??{kind:"unknown"},result:e.result,startedAt:new Date(e.start).toISOString(),completedAt:new Date().toISOString(),durationMs:b()-e.monotonicStart,indexedLanguages:e.languages?[...e.languages]:void 0,skipped:e.skipped?[...e.skipped]:void 0,error:e.error}}function k(e){return JSON.stringify(e)}export{Xo as a,Yo as b,Ke as c,vr as d,gd as e};
239
+ //# sourceMappingURL=chunk-WOOTEWQT.js.map
@@ -1,2 +1,2 @@
1
- import{a as _}from"./chunk-SELM5MER.js";import{f as L,g as A}from"./chunk-T3DGWPXM.js";import{a as R}from"./chunk-QHRNXP3C.js";import{b as D}from"./chunk-B75HZHUP.js";import{c as E}from"./chunk-7FND7D7N.js";import{a as w}from"./chunk-BGBBVSH4.js";import{f as I,h as x}from"./chunk-C7QOQX32.js";import{d as N}from"./chunk-FETNQCFO.js";import{b as T,c as h}from"./chunk-O6QTXQPJ.js";import{a as g}from"./chunk-ADTBPVUZ.js";import{u as S}from"./chunk-BMYOV5GP.js";var F={caller:3,"entry-surface":2,rooted:1},O=/not\s*yet\s*implement|not\s*implement|unimplement|\bnyi\b|\btodo\b|\bstub\b|not\s*supported|coming\s*soon/i,P=/^throw\s+new\s+[\w.]*Error\s*\(([\s\S]*)\)\s*;?$/,C=/^return(\s+(null|undefined|false|0|''|""|``|\[\]|\{\}))?\s*;?$/,v=/\/\/\s*TODO\b|\/\*\s*TODO\b/i,K=/(?:=>|\))\s*(?::\s*[^{;=]+)?\s*\{\s*\}\s*;?\s*$/;function et(e,n={}){let{scope:o,limit:r=30,scanLimit:l,semantic:a=!0}=n,s=new E(e),t=D(s.productionCallableDefinitions({scope:o,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),l),c=[];for(let i of t){let m=M(e,i);m&&c.push(m)}if(c.length===0)return[];let d=j(e,c,t),f=c.filter(i=>!d.has(i.def.symbol));if(f.length===0)return[];let p=_(e,s).forDefinitions(f.map(i=>i.def),{semantic:a}),u=[];for(let i of f){let m=p.get(i.def.symbolId);if(m?.semanticIncomplete||m?.semanticUnavailable)continue;let b=m?.realConsumers.length??0,y=B(e,i.def,b);y&&u.push({symbol:i.def.symbol,shortName:N(i.def.symbol),file:i.def.relativePath,startLine:i.def.startLine,endLine:i.def.endLine,loc:w(i.def),stubKind:i.stubKind,reachability:y,callerFanIn:b,stubText:i.stubText})}return u.sort((i,m)=>F[m.reachability]-F[i.reachability]||m.callerFanIn-i.callerFanIn||i.file.localeCompare(m.file)||i.startLine-m.startLine),r?u.slice(0,r):u}function B(e,n,o){return o>0?"caller":x(e,n.symbol,n.relativePath)?"rooted":I(e,n.relativePath)?"entry-surface":null}function M(e,n){let o=L(e,n);if(!o)return null;let r=A(o),l=r.trim();if(l==="")return!z(o)||!R(e,n)?null:{def:n,stubKind:"empty-body",stubText:"(empty body)"};let a=h(r),s=T(r),t=U(a,s);if(t.length!==1)return null;let c=t[0];return $(c)?{def:n,stubKind:"throw-stub",stubText:c.trim()}:v.test(r)&&C.test(c.trim())?{def:n,stubKind:"todo-return-default",stubText:l}:null}function U(e,n){let o=[],r=0,l="";for(let a=0;a<n.length;a+=1){let s=n[a];if(s==="("||s==="["||s==="{"?r+=1:(s===")"||s==="]"||s==="}")&&(r=Math.max(0,r-1)),s===";"&&r===0){o.push(l),l="";continue}l+=e[a]??""}return l.trim()&&o.push(l),o.map(a=>a.trim()).filter(a=>a.length>0)}function $(e){let n=P.exec(e.trim());return n?O.test(n[1]??""):!1}function z(e){return K.test(e.trimEnd())}function j(e,n,o){let r=new Set,l=new Set(n.map(t=>t.def.parentTypeName).filter(t=>t!==null));if(l.size===0)return r;let a=k(e,l),s=new Map;for(let t of o){if(!t.parentTypeName)continue;let c=s.get(t.leaf)??new Set;c.add(t.parentTypeName),s.set(t.leaf,c)}for(let t of n){let c=t.def.parentTypeName;if(!c)continue;let d=a.get(c);if(!d||d.size===0)continue;let f=s.get(t.def.leaf)??new Set;[...d].every(u=>f.has(u))&&r.add(t.def.symbol)}return r}var Y=/\bclass\s+([A-Za-z_$][\w$]*)\s+extends\s+([A-Za-z_$][\w$]*)/g;function k(e,n){let o=new Map;for(let r of g(e,{includeIgnored:!1})){let l=S(e,r);if(l)for(let a of l.matchAll(Y)){let s=a[1],t=a[2];if(!s||!t||!n.has(t))continue;let c=o.get(t)??new Set;c.add(s),o.set(t,c)}}return o}export{et as a};
2
- //# sourceMappingURL=chunk-UBGWN7I4.js.map
1
+ import{a as _}from"./chunk-NIO346UL.js";import{f as L,g as A}from"./chunk-CSZOQ7YO.js";import{a as R}from"./chunk-GXVDTHFC.js";import{b as D}from"./chunk-B75HZHUP.js";import{c as E}from"./chunk-NK76RSB6.js";import{a as w}from"./chunk-BGBBVSH4.js";import{f as I,h as x}from"./chunk-JN5LIBT3.js";import{d as N}from"./chunk-AM5SUGHF.js";import{b as T,c as h}from"./chunk-JOALNFY3.js";import{a as g}from"./chunk-RVYLJDXC.js";import{w as S}from"./chunk-PLZXWZHY.js";var F={caller:3,"entry-surface":2,rooted:1},O=/not\s*yet\s*implement|not\s*implement|unimplement|\bnyi\b|\btodo\b|\bstub\b|not\s*supported|coming\s*soon/i,P=/^throw\s+new\s+[\w.]*Error\s*\(([\s\S]*)\)\s*;?$/,C=/^return(\s+(null|undefined|false|0|''|""|``|\[\]|\{\}))?\s*;?$/,v=/\/\/\s*TODO\b|\/\*\s*TODO\b/i,K=/(?:=>|\))\s*(?::\s*[^{;=]+)?\s*\{\s*\}\s*;?\s*$/;function et(e,n={}){let{scope:o,limit:r=30,scanLimit:l,semantic:a=!0}=n,s=new E(e),t=D(s.productionCallableDefinitions({scope:o,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),l),c=[];for(let i of t){let m=M(e,i);m&&c.push(m)}if(c.length===0)return[];let d=j(e,c,t),f=c.filter(i=>!d.has(i.def.symbol));if(f.length===0)return[];let p=_(e,s).forDefinitions(f.map(i=>i.def),{semantic:a}),u=[];for(let i of f){let m=p.get(i.def.symbolId);if(m?.semanticIncomplete||m?.semanticUnavailable)continue;let b=m?.realConsumers.length??0,y=B(e,i.def,b);y&&u.push({symbol:i.def.symbol,shortName:N(i.def.symbol),file:i.def.relativePath,startLine:i.def.startLine,endLine:i.def.endLine,loc:w(i.def),stubKind:i.stubKind,reachability:y,callerFanIn:b,stubText:i.stubText})}return u.sort((i,m)=>F[m.reachability]-F[i.reachability]||m.callerFanIn-i.callerFanIn||i.file.localeCompare(m.file)||i.startLine-m.startLine),r?u.slice(0,r):u}function B(e,n,o){return o>0?"caller":x(e,n.symbol,n.relativePath)?"rooted":I(e,n.relativePath)?"entry-surface":null}function M(e,n){let o=L(e,n);if(!o)return null;let r=A(o),l=r.trim();if(l==="")return!z(o)||!R(e,n)?null:{def:n,stubKind:"empty-body",stubText:"(empty body)"};let a=h(r),s=T(r),t=U(a,s);if(t.length!==1)return null;let c=t[0];return $(c)?{def:n,stubKind:"throw-stub",stubText:c.trim()}:v.test(r)&&C.test(c.trim())?{def:n,stubKind:"todo-return-default",stubText:l}:null}function U(e,n){let o=[],r=0,l="";for(let a=0;a<n.length;a+=1){let s=n[a];if(s==="("||s==="["||s==="{"?r+=1:(s===")"||s==="]"||s==="}")&&(r=Math.max(0,r-1)),s===";"&&r===0){o.push(l),l="";continue}l+=e[a]??""}return l.trim()&&o.push(l),o.map(a=>a.trim()).filter(a=>a.length>0)}function $(e){let n=P.exec(e.trim());return n?O.test(n[1]??""):!1}function z(e){return K.test(e.trimEnd())}function j(e,n,o){let r=new Set,l=new Set(n.map(t=>t.def.parentTypeName).filter(t=>t!==null));if(l.size===0)return r;let a=k(e,l),s=new Map;for(let t of o){if(!t.parentTypeName)continue;let c=s.get(t.leaf)??new Set;c.add(t.parentTypeName),s.set(t.leaf,c)}for(let t of n){let c=t.def.parentTypeName;if(!c)continue;let d=a.get(c);if(!d||d.size===0)continue;let f=s.get(t.def.leaf)??new Set;[...d].every(u=>f.has(u))&&r.add(t.def.symbol)}return r}var Y=/\bclass\s+([A-Za-z_$][\w$]*)\s+extends\s+([A-Za-z_$][\w$]*)/g;function k(e,n){let o=new Map;for(let r of g(e,{includeIgnored:!1})){let l=S(e,r);if(l)for(let a of l.matchAll(Y)){let s=a[1],t=a[2];if(!s||!t||!n.has(t))continue;let c=o.get(t)??new Set;c.add(s),o.set(t,c)}}return o}export{et as a};
2
+ //# sourceMappingURL=chunk-X5I2BQGX.js.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-35NLDRZC.js";import{c as p}from"./chunk-C7QOQX32.js";import{a as u}from"./chunk-TIIC3ZE7.js";import{a as f}from"./chunk-NNOKTMZT.js";function $(n,e={}){return C(n,e).cycles}function C(n,e={}){return b(n,e)}function w(n,e={}){return b(n,e).cycles}function b(n,e={}){let{scope:t,maxDepth:o=10,edgeBasis:r="symbol-references"}=e,s=f(n,t,r==="imports"?{scipEdges:"imports-only",sourceEdges:"imports-only"}:void 0),{components:a}=g(s),l=a.filter(i=>D(s,i)).map(i=>{let c=[...i].sort(),d=S(s,c),y=x(d);return{path:d,component:c,edgeBasis:r,witness:!0,classification:y==="real"?"dependency-cycle":"module-structure-candidate",kind:y}});return l.sort((i,c)=>i.kind!==c.kind?i.kind==="real"?-1:1:i.path.length-c.path.length),{cycles:l,truncated:!1,edgeBasis:r,maxDepth:o}}function D(n,e){if(e.length>1)return!0;let t=e[0];return t!==void 0&&n.get(t)?.has(t)===!0}function S(n,e){let t=e[0];if(!t)return[];let o=new Set(e);for(let r of[...n.get(t)??[]].filter(s=>o.has(s)).sort()){if(r===t)return[t,t];let s=B(n,r,t,o);if(s)return[t,...s]}throw new Error(`Cyclic component did not contain a witness path from ${t}.`)}function B(n,e,t,o){let r=[e],s=new Map([[e,null]]);for(let a=0;a<r.length;a+=1){let l=r[a];if(l===t){let i=[];for(let c=l;c!==null;c=s.get(c)??null)i.push(c);return i.reverse()}for(let i of[...n.get(l)??[]].filter(c=>o.has(c)).sort())s.has(i)||(s.set(i,l),r.push(i))}return null}function x(n){for(let o of n){let r=u(o);if(r==="test"||r==="barrel"||r==="entry")return"module-hierarchy"}if(n.length!==3)return"real";let[e,t]=n;return!e||!t?"real":p(e)||p(t)||m(e,t)||m(t,e)||h(e,t)||h(t,e)||u(e)==="entry"||u(t)==="entry"?"module-hierarchy":"real"}function m(n,e){if(!/\.rs$/.test(n)||!/\.rs$/.test(e))return!1;let t=e.replace(/\.rs$/,"/");return n.startsWith(t)?!n.slice(t.length).includes("/"):!1}function h(n,e){if(!/\.rs$/.test(n)||!/\.rs$/.test(e))return!1;let t=n.replace(/\.rs$/,""),o=e.replace(/\.rs$/,"");if(t===o+"_tests"||t===o+"/tests")return!0;let r=n.split("/"),s=e.split("/");if(r.length===s.length&&r.includes("tests")&&s.includes("src")){let a=r[r.length-1],l=s[s.length-1];if(a&&a===l)return!0}return!1}export{$ as a,C as b,w as c,b as d};
2
- //# sourceMappingURL=chunk-PX4RYAAK.js.map
1
+ import{a as g}from"./chunk-35NLDRZC.js";import{c as p}from"./chunk-JN5LIBT3.js";import{a as u}from"./chunk-ZOEDRCR4.js";import{a as f}from"./chunk-B2E3HZ2A.js";function $(n,e={}){return C(n,e).cycles}function C(n,e={}){return b(n,e)}function w(n,e={}){return b(n,e).cycles}function b(n,e={}){let{scope:t,maxDepth:o=10,edgeBasis:r="symbol-references"}=e,s=f(n,t,r==="imports"?{scipEdges:"imports-only",sourceEdges:"imports-only"}:void 0),{components:a}=g(s),l=a.filter(i=>D(s,i)).map(i=>{let c=[...i].sort(),d=S(s,c),y=x(d);return{path:d,component:c,edgeBasis:r,witness:!0,classification:y==="real"?"dependency-cycle":"module-structure-candidate",kind:y}});return l.sort((i,c)=>i.kind!==c.kind?i.kind==="real"?-1:1:i.path.length-c.path.length),{cycles:l,truncated:!1,edgeBasis:r,maxDepth:o}}function D(n,e){if(e.length>1)return!0;let t=e[0];return t!==void 0&&n.get(t)?.has(t)===!0}function S(n,e){let t=e[0];if(!t)return[];let o=new Set(e);for(let r of[...n.get(t)??[]].filter(s=>o.has(s)).sort()){if(r===t)return[t,t];let s=B(n,r,t,o);if(s)return[t,...s]}throw new Error(`Cyclic component did not contain a witness path from ${t}.`)}function B(n,e,t,o){let r=[e],s=new Map([[e,null]]);for(let a=0;a<r.length;a+=1){let l=r[a];if(l===t){let i=[];for(let c=l;c!==null;c=s.get(c)??null)i.push(c);return i.reverse()}for(let i of[...n.get(l)??[]].filter(c=>o.has(c)).sort())s.has(i)||(s.set(i,l),r.push(i))}return null}function x(n){for(let o of n){let r=u(o);if(r==="test"||r==="barrel"||r==="entry")return"module-hierarchy"}if(n.length!==3)return"real";let[e,t]=n;return!e||!t?"real":p(e)||p(t)||m(e,t)||m(t,e)||h(e,t)||h(t,e)||u(e)==="entry"||u(t)==="entry"?"module-hierarchy":"real"}function m(n,e){if(!/\.rs$/.test(n)||!/\.rs$/.test(e))return!1;let t=e.replace(/\.rs$/,"/");return n.startsWith(t)?!n.slice(t.length).includes("/"):!1}function h(n,e){if(!/\.rs$/.test(n)||!/\.rs$/.test(e))return!1;let t=n.replace(/\.rs$/,""),o=e.replace(/\.rs$/,"");if(t===o+"_tests"||t===o+"/tests")return!0;let r=n.split("/"),s=e.split("/");if(r.length===s.length&&r.includes("tests")&&s.includes("src")){let a=r[r.length-1],l=s[s.length-1];if(a&&a===l)return!0}return!1}export{$ as a,C as b,w as c,b as d};
2
+ //# sourceMappingURL=chunk-XNUWRTYM.js.map
@@ -1,3 +1,3 @@
1
- import{c as S}from"./chunk-ID63777H.js";import{a as y,b as h}from"./chunk-AKB7V7TV.js";import{a as f}from"./chunk-KMITESMT.js";import{d as v}from"./chunk-Y6KHROC3.js";import{c as p}from"./chunk-PTAWHLVJ.js";import{b as d}from"./chunk-UZGZB3VB.js";import{d as l,t as m}from"./chunk-FETNQCFO.js";import{v as u}from"./chunk-BMYOV5GP.js";function B(i,r,c={}){let t=g(i,r,c);if(t.kind!=="matched")return t;let{referenceEvidence:n,claimSupport:e,...s}=t;return s}function g(i,r,c={}){let t=d(i,r);if(!t.match)return{kind:"missing",query:r};if(t.total>1)return{kind:"ambiguous",query:r,total:t.total,candidates:[{symbol:t.match.symbol,shortName:l(t.match.symbol),relativePath:t.match.relativePath,startLine:t.match.startLine},...t.candidates]};let n=t.match,e=R(c.parts),s=e.includes("definition")||e.includes("references")?S(i,n.symbol,{semantic:c.semantic,referenceContext:c.referenceContext}):{definitions:[],referencedBy:[],referenceEvidence:[],claimSupport:null},o=e.includes("callers")||e.includes("callees")?f(i,n.symbol,{semantic:c.semantic}):null,a=c.relatedSourceLines??80;return{kind:"matched",query:r,symbol:n.symbol,shortName:l(n.symbol),file:n.relativePath,parts:e,definition:e.includes("definition")?v(i,n.symbol):null,referenceWindows:e.includes("references")?L(i,s.referencedBy):[],callers:e.includes("callers")?E(i,o?.callers??[],a):[],callees:e.includes("callees")?E(i,o?.callees??[],a):[],dependencies:e.includes("dependencies")?y(i,n.relativePath):[],consumers:e.includes("consumers")?h(i,n.relativePath):[],referenceEvidence:s.referenceEvidence,claimSupport:s.claimSupport}}function L(i,r){let c=r.filter(n=>n.sourceStartLine!==null&&n.sourceEndLine!==null&&n.source!==null).sort((n,e)=>n.relativePath.localeCompare(e.relativePath)||n.sourceStartLine-e.sourceStartLine||n.line-e.line),t=[];for(let n of c){let e=t[t.length-1];if(e&&e.relativePath===n.relativePath&&n.sourceStartLine<=e.endLine+1){e.endLine=Math.max(e.endLine,n.sourceEndLine),e.references.push(b(n)),e.source=u(i,e.relativePath).slice(e.startLine,e.endLine+1).join(`
1
+ import{c as S}from"./chunk-DVYG3JTA.js";import{a as y,b as h}from"./chunk-IWAMYGPN.js";import{a as f}from"./chunk-OMBRP7BB.js";import{d as v}from"./chunk-YXJ4IAHH.js";import{c as p}from"./chunk-VLTUX4IF.js";import{b as d}from"./chunk-3XFJUWJE.js";import{d as l,t as m}from"./chunk-AM5SUGHF.js";import{x as u}from"./chunk-PLZXWZHY.js";function B(i,r,c={}){let t=g(i,r,c);if(t.kind!=="matched")return t;let{referenceEvidence:n,claimSupport:e,...s}=t;return s}function g(i,r,c={}){let t=d(i,r);if(!t.match)return{kind:"missing",query:r};if(t.total>1)return{kind:"ambiguous",query:r,total:t.total,candidates:[{symbol:t.match.symbol,shortName:l(t.match.symbol),relativePath:t.match.relativePath,startLine:t.match.startLine},...t.candidates]};let n=t.match,e=R(c.parts),s=e.includes("definition")||e.includes("references")?S(i,n.symbol,{semantic:c.semantic,referenceContext:c.referenceContext}):{definitions:[],referencedBy:[],referenceEvidence:[],claimSupport:null},o=e.includes("callers")||e.includes("callees")?f(i,n.symbol,{semantic:c.semantic}):null,a=c.relatedSourceLines??80;return{kind:"matched",query:r,symbol:n.symbol,shortName:l(n.symbol),file:n.relativePath,parts:e,definition:e.includes("definition")?v(i,n.symbol):null,referenceWindows:e.includes("references")?L(i,s.referencedBy):[],callers:e.includes("callers")?E(i,o?.callers??[],a):[],callees:e.includes("callees")?E(i,o?.callees??[],a):[],dependencies:e.includes("dependencies")?y(i,n.relativePath):[],consumers:e.includes("consumers")?h(i,n.relativePath):[],referenceEvidence:s.referenceEvidence,claimSupport:s.claimSupport}}function L(i,r){let c=r.filter(n=>n.sourceStartLine!==null&&n.sourceEndLine!==null&&n.source!==null).sort((n,e)=>n.relativePath.localeCompare(e.relativePath)||n.sourceStartLine-e.sourceStartLine||n.line-e.line),t=[];for(let n of c){let e=t[t.length-1];if(e&&e.relativePath===n.relativePath&&n.sourceStartLine<=e.endLine+1){e.endLine=Math.max(e.endLine,n.sourceEndLine),e.references.push(b(n)),e.source=u(i,e.relativePath).slice(e.startLine,e.endLine+1).join(`
2
2
  `);continue}t.push({relativePath:n.relativePath,startLine:n.sourceStartLine,endLine:n.sourceEndLine,source:n.source,references:[b(n)]})}return t}function b(i){return{line:i.line,enclosingSymbol:i.enclosingSymbol,enclosingShort:i.enclosingShort}}function R(i){let r=i&&i.length>0?i:["definition","references"];return[...new Set(r)]}function E(i,r,c){let t=[],n=new Set;for(let e of r){if(n.has(e.symbol))continue;n.add(e.symbol);let s=(e.file?m(i,e.file).find(a=>a.symbol===e.symbol):void 0)??d(i,e.symbol).match;if(!s)continue;let o=p(i,s.relativePath,s.startLine,s.endLine,c);o&&t.push({...o,symbol:e.symbol,shortName:e.shortName,omittedLines:Math.max(0,s.endLine-o.endLine)})}return t}export{B as a,g as b};
3
- //# sourceMappingURL=chunk-ICFDQHAM.js.map
3
+ //# sourceMappingURL=chunk-XUJM6474.js.map