codebaseiq 0.2.0 → 0.3.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 (402) hide show
  1. package/CHANGELOG.md +44 -2
  2. package/README.md +1 -1
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/{chunk-2DMVFAY7.js → chunk-23C5AD3B.js} +2 -2
  5. package/dist/{chunk-WH5SYOMD.js → chunk-2E6OUPCF.js} +2 -2
  6. package/dist/{chunk-RWKEXCHU.js → chunk-2EDX3JT5.js} +2 -2
  7. package/dist/chunk-2I2UHZET.js +2 -0
  8. package/dist/{chunk-CSZOQ7YO.js → chunk-2OMXFE64.js} +2 -2
  9. package/dist/{chunk-EXMVF3JR.js → chunk-2PRONPAS.js} +3 -3
  10. package/dist/{chunk-5WXOEJ4G.js → chunk-356EZBIP.js} +2 -2
  11. package/dist/{chunk-A7XQT7MH.js → chunk-36JC5BG2.js} +2 -2
  12. package/dist/{chunk-RRPK327J.js → chunk-3RR2K7EZ.js} +2 -2
  13. package/dist/{chunk-3NUZVLR7.js → chunk-3RSBGWGL.js} +2 -2
  14. package/dist/{chunk-MTMF4N7F.js → chunk-3VJ3OCRE.js} +2 -2
  15. package/dist/{chunk-IBM3F2BJ.js → chunk-4LK5OIPW.js} +2 -2
  16. package/dist/{chunk-FQA3KIFX.js → chunk-5DSL3NT2.js} +2 -2
  17. package/dist/{chunk-IYBIBMPF.js → chunk-5FWR5HLG.js} +2 -2
  18. package/dist/{chunk-CIVYHK7U.js → chunk-5IC2WZAL.js} +2 -2
  19. package/dist/{chunk-PARCKE3Q.js → chunk-5IZRKWTZ.js} +2 -2
  20. package/dist/{chunk-HHBBGWES.js → chunk-5LL4KEHO.js} +2 -2
  21. package/dist/chunk-5T44HG5Y.js +88 -0
  22. package/dist/{chunk-YFQPWKHR.js → chunk-5ZI2PPI7.js} +2 -2
  23. package/dist/{chunk-T3YFIJ5P.js → chunk-67VJAYVR.js} +2 -2
  24. package/dist/{chunk-DKJXK3HA.js → chunk-6BF3VYEF.js} +2 -2
  25. package/dist/chunk-6JMAVFL4.js +3 -0
  26. package/dist/chunk-6O3KXIDL.js +2 -0
  27. package/dist/{chunk-OJFLPVBP.js → chunk-6VREELBC.js} +2 -2
  28. package/dist/chunk-6WAPPQ5F.js +82 -0
  29. package/dist/{chunk-QLTFXVUI.js → chunk-75KJGYX7.js} +2 -2
  30. package/dist/{chunk-PLZXWZHY.js → chunk-7GAK2F3H.js} +2 -2
  31. package/dist/{chunk-X5I2BQGX.js → chunk-7JELP5YE.js} +2 -2
  32. package/dist/{chunk-W3FK73MD.js → chunk-7UCDGXRW.js} +2 -2
  33. package/dist/{chunk-CMXW7MFV.js → chunk-AEXQYQD7.js} +2 -2
  34. package/dist/{chunk-PHPQ24UG.js → chunk-AQI4N64O.js} +2 -2
  35. package/dist/{chunk-XUJM6474.js → chunk-AURCQHSG.js} +2 -2
  36. package/dist/{chunk-EM5UHLAM.js → chunk-BBP7HVBJ.js} +2 -2
  37. package/dist/{chunk-57KFVPVZ.js → chunk-BFBIMTCJ.js} +2 -2
  38. package/dist/{chunk-VVCBMH5O.js → chunk-BGGB5N53.js} +2 -2
  39. package/dist/{chunk-ZOEDRCR4.js → chunk-BRQL7AFJ.js} +2 -2
  40. package/dist/{chunk-KDYQQJ6X.js → chunk-BWL3PMPT.js} +2 -2
  41. package/dist/{chunk-M7LAIM77.js → chunk-C6WKPKCF.js} +2 -2
  42. package/dist/{chunk-2F5ERMNI.js → chunk-C7OUW52M.js} +2 -2
  43. package/dist/{chunk-N3Q3AWGW.js → chunk-C7QWUBR2.js} +96 -96
  44. package/dist/{chunk-BX2U3QQV.js → chunk-CCIYWXX6.js} +2 -2
  45. package/dist/{chunk-3AC56WAR.js → chunk-CIYA2KZN.js} +2 -2
  46. package/dist/{chunk-35YYZD3D.js → chunk-CR3OG6SQ.js} +2 -2
  47. package/dist/{chunk-VYZQZ4ZN.js → chunk-CVHOQONG.js} +2 -2
  48. package/dist/{chunk-4IFISPQW.js → chunk-CW6AXOLR.js} +2 -2
  49. package/dist/{chunk-NDGTJHQN.js → chunk-D53LWANR.js} +2 -2
  50. package/dist/{chunk-VCWAJPXQ.js → chunk-D7AZAOZX.js} +2 -2
  51. package/dist/{chunk-ACZDU5GK.js → chunk-D7DOB27N.js} +7 -7
  52. package/dist/{chunk-CDWSLAPN.js → chunk-DAKIGMIK.js} +2 -2
  53. package/dist/chunk-DDN2F6GB.js +2 -0
  54. package/dist/{chunk-L3YSDLNB.js → chunk-DVWO7RBC.js} +2 -2
  55. package/dist/{chunk-KNV5VFDV.js → chunk-E52K4L2W.js} +2 -2
  56. package/dist/chunk-EIBGSU2R.js +2 -0
  57. package/dist/chunk-EQNMD62X.js +51 -0
  58. package/dist/{chunk-LY2NB5XR.js → chunk-EXZ7VLRY.js} +2 -2
  59. package/dist/{chunk-YIOQJ45A.js → chunk-F3QSL4W2.js} +2 -2
  60. package/dist/{chunk-JOALNFY3.js → chunk-F74LZWCE.js} +2 -2
  61. package/dist/{chunk-ZB3V5QM7.js → chunk-FEIZXBLH.js} +2 -2
  62. package/dist/{chunk-NJA4MMBD.js → chunk-FH5WG4LE.js} +2 -2
  63. package/dist/{chunk-MRGTCMDK.js → chunk-FOZ74V56.js} +2 -2
  64. package/dist/{chunk-S5SKXCND.js → chunk-FQTIFWLR.js} +2 -2
  65. package/dist/chunk-FTTV7IRX.js +355 -0
  66. package/dist/chunk-FWQGH2N2.js +2 -0
  67. package/dist/{chunk-PFPHS4NO.js → chunk-GDHWOA57.js} +2 -2
  68. package/dist/{chunk-H3CKAL6P.js → chunk-GIDCP7KV.js} +2 -2
  69. package/dist/{chunk-6SDEQTVY.js → chunk-GL6UTNUB.js} +2 -2
  70. package/dist/{chunk-37TKC6MB.js → chunk-GP7C5VAE.js} +2 -2
  71. package/dist/{chunk-U24M5RQM.js → chunk-GQLDYCWS.js} +2 -2
  72. package/dist/{chunk-I5FCDTK2.js → chunk-GQXXOS55.js} +2 -2
  73. package/dist/{chunk-NTRW52UR.js → chunk-GUFPEFBG.js} +2 -2
  74. package/dist/{chunk-B2E3HZ2A.js → chunk-GV2CEZCW.js} +2 -2
  75. package/dist/{chunk-AM5SUGHF.js → chunk-GVAF222T.js} +2 -2
  76. package/dist/{chunk-TAJ6UGCO.js → chunk-GWYZVVKY.js} +3 -3
  77. package/dist/{chunk-NK76RSB6.js → chunk-HENP2O4A.js} +2 -2
  78. package/dist/{chunk-VG55NFXF.js → chunk-HINZQKSY.js} +2 -2
  79. package/dist/{chunk-6OVNYYY4.js → chunk-HQA7EBSK.js} +2 -2
  80. package/dist/{chunk-DLC6JDN7.js → chunk-HVFB3PME.js} +2 -2
  81. package/dist/{chunk-FY5V4V4F.js → chunk-I22IZYDI.js} +2 -2
  82. package/dist/{chunk-RVYLJDXC.js → chunk-ICUL7XRT.js} +2 -2
  83. package/dist/{chunk-QVHZB75Z.js → chunk-IHSLIIL3.js} +2 -2
  84. package/dist/{chunk-PNVZIJ57.js → chunk-ITSJMNUD.js} +2 -2
  85. package/dist/{chunk-XNUWRTYM.js → chunk-IZDPGOZR.js} +2 -2
  86. package/dist/chunk-J3GLP7Q5.js +3 -0
  87. package/dist/{chunk-BH5CE4LN.js → chunk-J7AMBVWF.js} +2 -2
  88. package/dist/{chunk-YXJ4IAHH.js → chunk-JCMFBF4Z.js} +2 -2
  89. package/dist/{chunk-ZJZQ7Q2Q.js → chunk-JFIA2JI3.js} +2 -2
  90. package/dist/{chunk-FIXYHQ3W.js → chunk-JLZLLLW5.js} +2 -2
  91. package/dist/{chunk-2E6BTWER.js → chunk-JSNTHRLQ.js} +2 -2
  92. package/dist/{chunk-77GHPR2R.js → chunk-JX6ZWDOS.js} +2 -2
  93. package/dist/{chunk-SRY26ITJ.js → chunk-JYI7CV25.js} +2 -2
  94. package/dist/chunk-K7JLSGCJ.js +8 -0
  95. package/dist/{chunk-DFPAZXLU.js → chunk-KPZGTB2O.js} +2 -2
  96. package/dist/{chunk-7Z7HCZ7J.js → chunk-LKUTSP4G.js} +2 -2
  97. package/dist/{chunk-HIEXRDJF.js → chunk-LMTSB3TB.js} +2 -2
  98. package/dist/{chunk-BLKYYQ7C.js → chunk-LONKINMJ.js} +95 -95
  99. package/dist/{chunk-SF34QLK2.js → chunk-LQHYYIOB.js} +2 -2
  100. package/dist/{chunk-HBQGKMM3.js → chunk-LZSQ6X7E.js} +2 -2
  101. package/dist/{chunk-RCPZOPV6.js → chunk-M2Y6PCFE.js} +2 -2
  102. package/dist/{chunk-WJOQC4P7.js → chunk-MEUHIDI3.js} +2 -2
  103. package/dist/{chunk-MT5W4DUG.js → chunk-MHWMEZDA.js} +2 -2
  104. package/dist/{chunk-FLLXYUOL.js → chunk-MQW6SJ4P.js} +2 -2
  105. package/dist/{chunk-57KEZDPT.js → chunk-MSI3K7PJ.js} +2 -2
  106. package/dist/chunk-MVRGB4KJ.js +278 -0
  107. package/dist/{chunk-27PHVDKL.js → chunk-MZNMASFM.js} +2 -2
  108. package/dist/{chunk-DVYG3JTA.js → chunk-NBCQZSGR.js} +2 -2
  109. package/dist/{chunk-NIO346UL.js → chunk-NBZKSTXP.js} +2 -2
  110. package/dist/{chunk-UWB5WMC2.js → chunk-NCJILOAK.js} +2 -2
  111. package/dist/{chunk-JN5LIBT3.js → chunk-NDKOVQFG.js} +2 -2
  112. package/dist/{chunk-W6C6QTXJ.js → chunk-NEWHKGVD.js} +2 -2
  113. package/dist/{chunk-HBXZAGY6.js → chunk-O2M3VNDY.js} +2 -2
  114. package/dist/chunk-OFGOOL6U.js +3 -0
  115. package/dist/{chunk-FEBLLMTL.js → chunk-OQUCBKOI.js} +2 -2
  116. package/dist/{chunk-5IO2APSS.js → chunk-P4NVCOM7.js} +2 -2
  117. package/dist/{chunk-SJZQ2PTZ.js → chunk-PFC44E6D.js} +2 -2
  118. package/dist/{chunk-LAGDJXFY.js → chunk-PHNCEUXX.js} +2 -2
  119. package/dist/{chunk-HYKSLTAR.js → chunk-PTQPPPG2.js} +2 -2
  120. package/dist/{chunk-5XEVXVTK.js → chunk-PUVNH4PO.js} +2 -2
  121. package/dist/chunk-Q23IMHXS.js +343 -0
  122. package/dist/{chunk-YYFV32WR.js → chunk-Q3ZCQY2Y.js} +2 -2
  123. package/dist/{chunk-OMBRP7BB.js → chunk-Q4XEU3UH.js} +2 -2
  124. package/dist/{chunk-I645ZF75.js → chunk-QEOWONKY.js} +2 -2
  125. package/dist/{chunk-JXHLB7TP.js → chunk-QMOZZ2VX.js} +2 -2
  126. package/dist/{chunk-2VKB5CMA.js → chunk-RCIGX23V.js} +2 -2
  127. package/dist/{chunk-J24VICI5.js → chunk-RIYJ4L33.js} +2 -2
  128. package/dist/{chunk-M4EVGA5S.js → chunk-RJVAPMHF.js} +3 -3
  129. package/dist/chunk-SB7NASHU.js +2 -0
  130. package/dist/{chunk-3XFJUWJE.js → chunk-SGMNWYTH.js} +2 -2
  131. package/dist/chunk-SMDIEDM4.js +27 -0
  132. package/dist/{chunk-IOVPAZWP.js → chunk-SX72EVMY.js} +2 -2
  133. package/dist/{chunk-WO47BIPY.js → chunk-T5X7DK6C.js} +2 -2
  134. package/dist/{chunk-CZEIHYMP.js → chunk-T6MQNNAC.js} +2 -2
  135. package/dist/chunk-T75DS2E6.js +21 -0
  136. package/dist/{chunk-57GCCPLS.js → chunk-TEANKHUU.js} +2 -2
  137. package/dist/{chunk-T55YPJGB.js → chunk-TJBOJUVN.js} +2 -2
  138. package/dist/{chunk-I2KP4AGR.js → chunk-TJWVT4DO.js} +2 -2
  139. package/dist/{chunk-KM4QRWI5.js → chunk-TNJGTQWO.js} +2 -2
  140. package/dist/{chunk-EFFMFK7C.js → chunk-TOTWJZIX.js} +2 -2
  141. package/dist/{chunk-QMGWSEPL.js → chunk-TPO7XC5Z.js} +2 -2
  142. package/dist/{chunk-54K6556S.js → chunk-U33PMPNW.js} +2 -2
  143. package/dist/{chunk-GXVDTHFC.js → chunk-U7NUXDQO.js} +2 -2
  144. package/dist/chunk-UC2FD2PS.js +4 -0
  145. package/dist/{chunk-TUTSO7UZ.js → chunk-UQE4XFSA.js} +2 -2
  146. package/dist/{chunk-4O52YNKL.js → chunk-UQYQBLJX.js} +2 -2
  147. package/dist/{chunk-FPDL2TUB.js → chunk-USOAJHY7.js} +2 -2
  148. package/dist/{chunk-JUO3Z644.js → chunk-UW6KD57C.js} +2 -2
  149. package/dist/{chunk-VLTUX4IF.js → chunk-VGWZ4MOY.js} +2 -2
  150. package/dist/{chunk-U2XX3BT4.js → chunk-VWYGCMV5.js} +2 -2
  151. package/dist/{chunk-IWAMYGPN.js → chunk-W7YLRXZE.js} +2 -2
  152. package/dist/{chunk-QKVTWODE.js → chunk-WK2IQJPK.js} +2 -2
  153. package/dist/{chunk-S64NCE2Z.js → chunk-WWCV4E6J.js} +2 -2
  154. package/dist/{chunk-IVJJNVSX.js → chunk-XMJ53WG4.js} +2 -2
  155. package/dist/{chunk-IGYAZPRX.js → chunk-XN3EKMLI.js} +2 -2
  156. package/dist/{chunk-FWY2PRIF.js → chunk-XQAVQVIL.js} +2 -2
  157. package/dist/{chunk-JYX5UZSZ.js → chunk-XQPPURLQ.js} +2 -2
  158. package/dist/{chunk-4AOOSCZ7.js → chunk-YHPG3S2U.js} +2 -2
  159. package/dist/{chunk-5BDK6QC3.js → chunk-YRKP7PM7.js} +2 -2
  160. package/dist/{chunk-4NHWNAWQ.js → chunk-YT4DVWUV.js} +2 -2
  161. package/dist/{chunk-5NJPH3QZ.js → chunk-YTJHCGYB.js} +2 -2
  162. package/dist/chunk-Z35GOVEH.js +2 -0
  163. package/dist/{chunk-K5G7SPAG.js → chunk-Z6RL7XOE.js} +4 -4
  164. package/dist/{chunk-OVKZM2XI.js → chunk-ZAFGY22Q.js} +2 -2
  165. package/dist/{chunk-A67HT5FR.js → chunk-ZB4C5TTR.js} +2 -2
  166. package/dist/{chunk-CWMHWD56.js → chunk-ZNH33XIB.js} +2 -2
  167. package/dist/{chunk-ZNQCR656.js → chunk-ZQ62NNKN.js} +2 -2
  168. package/dist/{cli-context-XEPPF4RX.js → cli-context-FJL2JHOE.js} +2 -2
  169. package/dist/{cli-context-TSADTXLB.js → cli-context-PQNWHMCQ.js} +2 -2
  170. package/dist/{cli-program-KJGQEM72.js → cli-program-UO7PZD6V.js} +2 -2
  171. package/dist/cli.js +1 -1
  172. package/dist/{code-CDe-mIjx.d.ts → code-DfX3xeWy.d.ts} +1 -1
  173. package/dist/{code-viewer-YGDON6SY.js → code-viewer-KIXEYQNJ.js} +2 -2
  174. package/dist/{code-viewer-ZCTHXQ5C.js → code-viewer-VHLBLIUM.js} +2 -2
  175. package/dist/{command-descriptors-5VAB2MZX.js → command-descriptors-F5P2V3NW.js} +129 -129
  176. package/dist/{command-descriptors-EAHKIRAG.js → command-descriptors-YCLATF5I.js} +130 -130
  177. package/dist/{db-DmRNdCtm.d.ts → db-BoG_PWYH.d.ts} +1 -1
  178. package/dist/direct-navigation-4XJTXIDT.js +2 -0
  179. package/dist/direct-navigation-J5MVYYAD.js +3 -0
  180. package/dist/{graph-evidence-Bs54NWws.d.ts → graph-evidence-D1jx1Cql.d.ts} +1 -1
  181. package/dist/{health-BnzbSLCE.d.ts → health-DkYBS5BI.d.ts} +1 -1
  182. package/dist/index.d.ts +1 -1
  183. package/dist/index.js +1 -1
  184. package/dist/invocation-command-descriptors-RWV4VAI4.js +2 -0
  185. package/dist/invocation-command-descriptors-U76PN7IY.js +3 -0
  186. package/dist/{scip-cli-BRFKkHQn.d.ts → maintenance-types-CdL5eQii.d.ts} +1 -20
  187. package/dist/output-continuation-command-BL25S26S.js +3 -0
  188. package/dist/output-continuation-command-BTETTXEC.js +2 -0
  189. package/dist/postinstall.js +1 -1
  190. package/dist/project-reindex-CRJU3IFG.js +2 -0
  191. package/dist/project-reindex-TQFCOA2O.js +3 -0
  192. package/dist/queries/affected.d.ts +1 -1
  193. package/dist/queries/affected.js +1 -1
  194. package/dist/queries/anchors.d.ts +1 -1
  195. package/dist/queries/anchors.js +1 -1
  196. package/dist/queries/architecture.d.ts +1 -1
  197. package/dist/queries/architecture.js +1 -1
  198. package/dist/queries/bottlenecks.d.ts +1 -1
  199. package/dist/queries/bottlenecks.js +1 -1
  200. package/dist/queries/by-kind.d.ts +1 -1
  201. package/dist/queries/by-kind.js +1 -1
  202. package/dist/queries/call-graph.d.ts +1 -1
  203. package/dist/queries/call-graph.js +1 -1
  204. package/dist/queries/change-surface.d.ts +1 -1
  205. package/dist/queries/change-surface.js +1 -1
  206. package/dist/queries/cleanup-plan.d.ts +1 -1
  207. package/dist/queries/cleanup-plan.js +1 -1
  208. package/dist/queries/co-change.d.ts +1 -1
  209. package/dist/queries/co-change.js +1 -1
  210. package/dist/queries/code.d.ts +2 -2
  211. package/dist/queries/code.js +1 -1
  212. package/dist/queries/complexity-hotspots.d.ts +1 -1
  213. package/dist/queries/complexity-hotspots.js +1 -1
  214. package/dist/queries/complexity.d.ts +1 -1
  215. package/dist/queries/complexity.js +1 -1
  216. package/dist/queries/context.d.ts +1 -1
  217. package/dist/queries/context.js +1 -1
  218. package/dist/queries/convergence.d.ts +1 -1
  219. package/dist/queries/convergence.js +1 -1
  220. package/dist/queries/coupling.d.ts +1 -1
  221. package/dist/queries/coupling.js +1 -1
  222. package/dist/queries/cycles.d.ts +1 -1
  223. package/dist/queries/cycles.js +1 -1
  224. package/dist/queries/dataflow.d.ts +1 -1
  225. package/dist/queries/dataflow.js +1 -1
  226. package/dist/queries/dead.d.ts +1 -1
  227. package/dist/queries/dead.js +1 -1
  228. package/dist/queries/decorative-checkers.d.ts +1 -1
  229. package/dist/queries/decorative-checkers.js +1 -1
  230. package/dist/queries/deep-chains.d.ts +1 -1
  231. package/dist/queries/deep-chains.js +1 -1
  232. package/dist/queries/dependence-slice.d.ts +2 -2
  233. package/dist/queries/dependence-slice.js +1 -1
  234. package/dist/queries/dependency-depth.d.ts +1 -1
  235. package/dist/queries/dependency-depth.js +1 -1
  236. package/dist/queries/deps.d.ts +1 -1
  237. package/dist/queries/deps.js +1 -1
  238. package/dist/queries/diff-impact.d.ts +1 -1
  239. package/dist/queries/diff-impact.js +1 -1
  240. package/dist/queries/doc-drift.d.ts +1 -1
  241. package/dist/queries/doc-drift.js +1 -1
  242. package/dist/queries/drift.d.ts +1 -1
  243. package/dist/queries/drift.js +1 -1
  244. package/dist/queries/duplicate-bodies.d.ts +1 -1
  245. package/dist/queries/duplicate-bodies.js +1 -1
  246. package/dist/queries/entry-map.d.ts +1 -1
  247. package/dist/queries/entry-map.js +1 -1
  248. package/dist/queries/evidence.d.ts +2 -2
  249. package/dist/queries/evidence.js +1 -1
  250. package/dist/queries/extract-candidates.d.ts +1 -1
  251. package/dist/queries/extract-candidates.js +1 -1
  252. package/dist/queries/fan.d.ts +1 -1
  253. package/dist/queries/fan.js +1 -1
  254. package/dist/queries/files.d.ts +1 -1
  255. package/dist/queries/files.js +1 -1
  256. package/dist/queries/health.d.ts +2 -2
  257. package/dist/queries/health.js +1 -1
  258. package/dist/queries/hierarchy.d.ts +1 -1
  259. package/dist/queries/hierarchy.js +1 -1
  260. package/dist/queries/hotspots.d.ts +1 -1
  261. package/dist/queries/hotspots.js +1 -1
  262. package/dist/queries/imports.d.ts +1 -1
  263. package/dist/queries/imports.js +1 -1
  264. package/dist/queries/incomplete-migration.d.ts +1 -1
  265. package/dist/queries/incomplete-migration.js +1 -1
  266. package/dist/queries/index.d.ts +4 -4
  267. package/dist/queries/index.js +1 -1
  268. package/dist/queries/isolated.d.ts +1 -1
  269. package/dist/queries/isolated.js +1 -1
  270. package/dist/queries/locality-candidates.d.ts +1 -1
  271. package/dist/queries/locality-candidates.js +1 -1
  272. package/dist/queries/members.d.ts +1 -1
  273. package/dist/queries/members.js +1 -1
  274. package/dist/queries/methods.d.ts +1 -1
  275. package/dist/queries/methods.js +1 -1
  276. package/dist/queries/not-implemented.d.ts +1 -1
  277. package/dist/queries/not-implemented.js +1 -1
  278. package/dist/queries/outline.d.ts +1 -1
  279. package/dist/queries/outline.js +1 -1
  280. package/dist/queries/passthrough-candidates.d.ts +1 -1
  281. package/dist/queries/passthrough-candidates.js +1 -1
  282. package/dist/queries/plan-context.d.ts +1 -1
  283. package/dist/queries/plan-context.js +1 -1
  284. package/dist/queries/react-component-duplicates.d.ts +1 -1
  285. package/dist/queries/react-component-duplicates.js +1 -1
  286. package/dist/queries/react-hook-candidates.d.ts +1 -1
  287. package/dist/queries/react-hook-candidates.js +1 -1
  288. package/dist/queries/react-large-component-pressure.d.ts +1 -1
  289. package/dist/queries/react-large-component-pressure.js +1 -1
  290. package/dist/queries/recent-duplicates.d.ts +1 -1
  291. package/dist/queries/recent-duplicates.js +1 -1
  292. package/dist/queries/redundant-reexports.d.ts +1 -1
  293. package/dist/queries/redundant-reexports.js +1 -1
  294. package/dist/queries/reference-neighborhood.d.ts +1 -1
  295. package/dist/queries/reference-neighborhood.js +1 -1
  296. package/dist/queries/reference-reachability.d.ts +1 -1
  297. package/dist/queries/reference-reachability.js +1 -1
  298. package/dist/queries/refs.d.ts +1 -1
  299. package/dist/queries/refs.js +1 -1
  300. package/dist/queries/self-audit.d.ts +1 -1
  301. package/dist/queries/self-audit.js +1 -1
  302. package/dist/queries/similar-chains.d.ts +1 -1
  303. package/dist/queries/similar-chains.js +1 -1
  304. package/dist/queries/similar-files.d.ts +1 -1
  305. package/dist/queries/similar-files.js +1 -1
  306. package/dist/queries/similar-signatures.d.ts +1 -1
  307. package/dist/queries/similar-signatures.js +1 -1
  308. package/dist/queries/similar.d.ts +1 -1
  309. package/dist/queries/similar.js +1 -1
  310. package/dist/queries/slice.d.ts +1 -1
  311. package/dist/queries/slice.js +1 -1
  312. package/dist/queries/source-inspection.d.ts +3 -3
  313. package/dist/queries/source-inspection.js +1 -1
  314. package/dist/queries/source-search.d.ts +1 -1
  315. package/dist/queries/source-search.js +1 -1
  316. package/dist/queries/stale-abstractions.d.ts +1 -1
  317. package/dist/queries/stale-abstractions.js +1 -1
  318. package/dist/queries/stats.d.ts +1 -1
  319. package/dist/queries/surface.d.ts +1 -1
  320. package/dist/queries/surface.js +1 -1
  321. package/dist/queries/symbols.d.ts +1 -1
  322. package/dist/queries/symbols.js +1 -1
  323. package/dist/queries/system-map.d.ts +1 -1
  324. package/dist/queries/system-map.js +1 -1
  325. package/dist/queries/system.d.ts +1 -1
  326. package/dist/queries/system.js +1 -1
  327. package/dist/queries/test-quality.d.ts +1 -1
  328. package/dist/queries/test-quality.js +1 -1
  329. package/dist/queries/trace.d.ts +1 -1
  330. package/dist/queries/trace.js +1 -1
  331. package/dist/queries/twin-ab.d.ts +1 -1
  332. package/dist/queries/twin-ab.js +1 -1
  333. package/dist/queries/twin-drift.d.ts +1 -1
  334. package/dist/queries/twin-drift.js +1 -1
  335. package/dist/queries/unused-imports.d.ts +1 -1
  336. package/dist/queries/unused-imports.js +1 -1
  337. package/dist/queries/unused-params.d.ts +1 -1
  338. package/dist/queries/unused-params.js +1 -1
  339. package/dist/queries/value-flow.d.ts +2 -2
  340. package/dist/queries/value-flow.js +1 -1
  341. package/dist/queries/vue-component-duplicates.d.ts +1 -1
  342. package/dist/queries/vue-component-duplicates.js +1 -1
  343. package/dist/queries/vue-composable-candidates.d.ts +1 -1
  344. package/dist/queries/vue-composable-candidates.js +1 -1
  345. package/dist/queries/vue-large-view-pressure.d.ts +1 -1
  346. package/dist/queries/vue-large-view-pressure.js +1 -1
  347. package/dist/queries/wrapper-candidates.d.ts +1 -1
  348. package/dist/queries/wrapper-candidates.js +1 -1
  349. package/dist/reindex-worker.js +2 -2
  350. package/dist/reindex.d.ts +2 -4
  351. package/dist/reindex.js +71 -32
  352. package/dist/runtime.d.ts +1 -2
  353. package/dist/runtime.js +3 -3
  354. package/dist/rust-semantic-session-server.js +1 -1
  355. package/dist/rust-semantic-session-worker.js +1 -1
  356. package/dist/rust-semantic-worker.js +1 -1
  357. package/dist/sentinel-ensure-command-OSWGCFFL.js +3 -0
  358. package/dist/sentinel-ensure-command-SPW7XQLB.js +2 -0
  359. package/dist/sentinel-worker.js +1 -1
  360. package/dist/typescript-mailbox-worker.js +1 -1
  361. package/dist/watch-server.js +2 -2
  362. package/docs/INDEX_GENERATIONS.md +2 -2
  363. package/docs/NPM_RELEASE.md +323 -0
  364. package/docs/schemas/npm-release-state.schema.json +4 -13
  365. package/package.json +3 -11
  366. package/dist/chunk-2Q2LW5JW.js +0 -14
  367. package/dist/chunk-327YK6TB.js +0 -4
  368. package/dist/chunk-347TXATM.js +0 -2
  369. package/dist/chunk-36WRYYTE.js +0 -3
  370. package/dist/chunk-6OAHRI2D.js +0 -6
  371. package/dist/chunk-6URCE5QY.js +0 -2
  372. package/dist/chunk-6ZV5EDUT.js +0 -5
  373. package/dist/chunk-7R64XY4Y.js +0 -12
  374. package/dist/chunk-CANBLFVQ.js +0 -15
  375. package/dist/chunk-CCRZLRWJ.js +0 -2
  376. package/dist/chunk-G2XUZCF2.js +0 -88
  377. package/dist/chunk-H5QXP63L.js +0 -2
  378. package/dist/chunk-HCMQZPEO.js +0 -2
  379. package/dist/chunk-IEL6Q5W3.js +0 -308
  380. package/dist/chunk-IGQQUENU.js +0 -109
  381. package/dist/chunk-K2O7SBAU.js +0 -2
  382. package/dist/chunk-QVWDQTMG.js +0 -2
  383. package/dist/chunk-RJWAB4VR.js +0 -345
  384. package/dist/chunk-VCL7FK3E.js +0 -3
  385. package/dist/chunk-WOOTEWQT.js +0 -239
  386. package/dist/chunk-XYLV727H.js +0 -21
  387. package/dist/chunk-YMGZZEW4.js +0 -2
  388. package/dist/direct-navigation-B3SGOOBW.js +0 -2
  389. package/dist/direct-navigation-ZL362KXF.js +0 -3
  390. package/dist/invocation-command-descriptors-CSUGUHTT.js +0 -2
  391. package/dist/invocation-command-descriptors-PPVZOIE5.js +0 -3
  392. package/dist/output-continuation-command-FTVVBVSN.js +0 -2
  393. package/dist/output-continuation-command-ITPRC3YV.js +0 -3
  394. package/dist/project-reindex-7HZSLLLY.js +0 -3
  395. package/dist/project-reindex-NGM3DYBN.js +0 -2
  396. package/dist/sentinel-ensure-command-KYYULCFU.js +0 -2
  397. package/dist/sentinel-ensure-command-RIZA3RY7.js +0 -3
  398. package/docs/WINDOWS_SIDECAR_RELEASE.md +0 -424
  399. package/docs/schemas/windows-sidecar-provenance.schema.json +0 -137
  400. package/scripts/build-codebaseiq-windows.mjs +0 -197
  401. package/scripts/codebaseiq-windows-provenance.mjs +0 -364
  402. package/scripts/verify-codebaseiq-windows.mjs +0 -29
@@ -1,8 +1,8 @@
1
- import{a as w}from"./chunk-ILMHV3KM.js";import{a as F,b as x,d as T,e as H,f as b,g as _,h as N}from"./chunk-EXMVF3JR.js";import{a as B,b as q}from"./chunk-5IO2APSS.js";import{d as f}from"./chunk-6URCE5QY.js";import{ca as W,da as j}from"./chunk-4O52YNKL.js";import m from"process";import{existsSync as Se}from"fs";import{dirname as M,join as ve,resolve as E,sep as Le}from"path";import{fileURLToPath as ze}from"url";import{spawn as ae}from"child_process";import{platform as $}from"os";var c=class extends Error{},p=class extends Error{},v=class extends Error{constructor(r,n,i){super(`rust-analyzer LSP request ${n} failed: ${i}`);this.code=r}code},ue=3e4,le=16*1024,ce=64*1024*1024,U=64*1024,J=256*1024*1024,g=Buffer.from(`\r
1
+ import{a as w}from"./chunk-ILMHV3KM.js";import{a as F,b as x,d as T,e as H,f as b,g as _,h as N}from"./chunk-2PRONPAS.js";import{a as W,b as j}from"./chunk-P4NVCOM7.js";import{a as f}from"./chunk-6O3KXIDL.js";import{ca as B,da as q}from"./chunk-UQYQBLJX.js";import m from"process";import{existsSync as Se}from"fs";import{dirname as M,join as ve,resolve as E,sep as Le}from"path";import{fileURLToPath as ze}from"url";import{spawn as ae}from"child_process";import{platform as $}from"os";var c=class extends Error{},p=class extends Error{},v=class extends Error{constructor(r,n,i){super(`rust-analyzer LSP request ${n} failed: ${i}`);this.code=r}code},ue=3e4,le=16*1024,ce=64*1024*1024,U=64*1024,J=256*1024*1024,g=Buffer.from(`\r
2
2
  \r
3
3
  `,"ascii"),L=class{constructor(e,r={}){this.transport=e;this.requestTimeoutMs=r.requestTimeoutMs??ue,this.configuration=r.configuration??{};let n=de(r.maxHeaderBytes,r.maxMessageBytes);this.maxHeaderBytes=n.maxHeaderBytes,this.maxMessageBytes=n.maxMessageBytes,this.monotonicNow=r.monotonicNow??f,this.headerBuffer=Buffer.allocUnsafe(this.maxHeaderBytes+g.length),this.transport.onData(i=>this.handleData(i)),this.transport.onClose((i,s)=>this.failTransport(new Error(we(i,s)),!1)),this.transport.onError(i=>this.failTransport(i,!0))}transport;nextId=1;pending=new Map;diagnosedUris=new Set;diagnosticWaiters=new Map;readinessWaiters=new Set;requestTimeoutMs;configuration;maxHeaderBytes;maxMessageBytes;monotonicNow;headerBuffer;headerLength=0;bodyBuffer=null;bodyLength=0;transportFailure=null;transportKilled=!1;transportKillPromise=null;currentServerStatusGeneration=0;latestServerStatus=null;shutdownStarted=!1;async initialize(e,r={}){let n=e.capabilities??{},i=n.experimental&&typeof n.experimental=="object"&&!Array.isArray(n.experimental)?n.experimental:{},s=await this.request("initialize",{...e,capabilities:{...n,experimental:{...i,serverStatusNotification:!0}}},r);return this.notify("initialized",{}),s}async references(e,r={}){let n=await this.request("textDocument/references",e,r);return Array.isArray(n)?n:[]}async definition(e,r={}){let n=await this.request("textDocument/definition",e,r);return he(n)}async prepareCallHierarchy(e,r={}){let n=await this.request("textDocument/prepareCallHierarchy",e,r);return Array.isArray(n)?n:[]}async outgoingCalls(e,r={}){let n=await this.request("callHierarchy/outgoingCalls",{item:e},r);return Array.isArray(n)?n:[]}async hover(e,r={}){let n=await this.request("textDocument/hover",e,r);return n&&typeof n=="object"?n:null}async readinessBarrier(e={}){try{await this.request("codebaseiq/readinessBarrier",null,e)}catch(r){if(r instanceof v&&r.code===-32601)return;throw r}}serverStatusGeneration(){return this.currentServerStatusGeneration}serverStatusSnapshot(){let e=this.latestServerStatus;return e?{generation:e.generation,status:{...e.status}}:null}waitForQuiescence(e,r){if(this.transportFailure)return Promise.reject(this.transportFailure);let n=this.latestServerStatus;if(n&&n.generation>e){if(n.status.health==="error")return Promise.reject(G());if(n.status.quiescent)return Promise.resolve(n.status)}return new Promise((i,s)=>{let o={afterGeneration:e,resolve:i,reject:s,timeout:setTimeout(()=>{this.readinessWaiters.delete(o),s(new Error(`rust-analyzer readiness timed out after ${r}ms`))},r)};this.readinessWaiters.add(o)})}didOpenTextDocument(e){this.notify("textDocument/didOpen",{textDocument:e})}waitForDiagnostics(e,r){return this.transportFailure?Promise.resolve(!1):this.diagnosedUris.has(e)?Promise.resolve(!0):new Promise(n=>{let i=u=>{clearTimeout(s),n(u)},s=setTimeout(()=>{let u=this.diagnosticWaiters.get(e)?.filter(l=>l!==i);u&&u.length>0?this.diagnosticWaiters.set(e,u):this.diagnosticWaiters.delete(e),n(!1)},r),o=this.diagnosticWaiters.get(e)??[];o.push(i),this.diagnosticWaiters.set(e,o)})}async shutdown(e={}){if(!this.shutdownStarted){this.shutdownStarted=!0;try{await this.request("shutdown",null,e),this.notify("exit",null)}catch(r){throw this.notify("exit",null),this.killTransportOnce(),r}}}async shutdownAndReap(e={}){let r;try{await this.shutdown(e)}catch(n){r=n}try{await this.killTransportOnce()}catch(n){throw new Error(`rust-analyzer process-tree cleanup failed: ${n instanceof Error?n.message:String(n)}`,{cause:n})}if(r)throw r}request(e,r,n={}){if(this.transportFailure)return Promise.reject(this.transportFailure);let i=z(n.timeoutMs??this.requestTimeoutMs,n.deadlineMs,this.monotonicNow),s=this.nextId++,o={jsonrpc:"2.0",id:s,method:e,params:r};return new Promise((u,l)=>{let d=setTimeout(()=>{let y=i.deadlineLimited?new c(`rust-analyzer readiness deadline expired during LSP request ${e}`):new Error(`rust-analyzer LSP request ${e} timed out after ${i.timeoutMs}ms`);this.cancelAndFailTimedOutRequest(s,y)},i.timeoutMs);this.pending.set(s,{method:e,deadlineMs:n.deadlineMs,resolve:y=>u(y),reject:l,timeout:d}),this.transport.write(S(o))})}notify(e,r){this.transportFailure||this.transport.write(S({jsonrpc:"2.0",method:e,params:r}))}handleData(e){if(this.transportFailure||e.length===0)return;let r=0;for(;r<e.length&&!this.transportFailure;){if(this.bodyBuffer){let o=Math.min(e.length-r,this.bodyBuffer.length-this.bodyLength);if(e.copy(this.bodyBuffer,this.bodyLength,r,r+o),r+=o,this.bodyLength+=o,this.bodyLength===this.bodyBuffer.length){let u=this.bodyBuffer.toString("utf8");this.bodyBuffer=null,this.bodyLength=0;let l;try{l=Re(u)}catch{this.failProtocol("rust-analyzer LSP response body was not a valid JSON object");continue}try{this.dispatchMessage(l)}catch{this.failTransport(new Error("rust-analyzer LSP message handling failed"),!0)}}continue}if(this.headerLength===this.headerBuffer.length){this.failProtocol(`rust-analyzer LSP header exceeded ${this.maxHeaderBytes} byte limit`);return}if(this.headerBuffer[this.headerLength++]=e[r++],!this.headerDelimiterComplete())continue;let n=this.headerLength-g.length;if(n>this.maxHeaderBytes){this.failProtocol(`rust-analyzer LSP header exceeded ${this.maxHeaderBytes} byte limit`);return}let i=this.headerBuffer.subarray(0,n).toString("ascii");this.headerLength=0;let s;try{s=fe(i,this.maxMessageBytes)}catch(o){this.failProtocol(o instanceof Error?o.message:String(o));return}this.bodyBuffer=Buffer.allocUnsafe(s),this.bodyLength=0,s===0&&(this.bodyBuffer=null,this.failProtocol("rust-analyzer LSP response body was not a valid JSON object"))}}headerDelimiterComplete(){if(this.headerLength<g.length)return!1;let e=this.headerLength-g.length;return this.headerBuffer.subarray(e,this.headerLength).equals(g)}failProtocol(e){this.failTransport(new p(e),!0)}failTransport(e,r){this.transportFailure||(this.transportFailure=e,this.headerLength=0,this.bodyBuffer=null,this.bodyLength=0,r&&this.killTransportOnce().catch(()=>{}),this.rejectPending(e),this.resolveDiagnosticWaiters(!1))}killTransportOnce(){return this.transportKilled?this.transportKillPromise??Promise.resolve():(this.transportKilled=!0,this.transportKillPromise=Promise.resolve(this.transport.kill()),this.transportKillPromise)}async cancelAndFailTimedOutRequest(e,r){let n=this.pending.get(e);if(!n)return;this.pending.delete(e);try{this.transport.write(S({jsonrpc:"2.0",method:"$/cancelRequest",params:{id:e}}))}catch{}this.transportFailure||(this.transportFailure=r,this.headerLength=0,this.bodyBuffer=null,this.bodyLength=0);let i=r;try{await this.killTransportOnce()}catch(s){i=new Error(`${r.message}; rust-analyzer cleanup failed: ${s instanceof Error?s.message:String(s)}`,{cause:s})}n.reject(i),this.rejectPending(i),this.resolveDiagnosticWaiters(!1)}dispatchMessage(e){if(this.recordDiagnosticNotification(e),this.recordServerStatusNotification(e),e.id!==void 0&&e.id!==null&&e.method){this.respondToServerRequest(e);return}if(e.id===void 0||e.id===null)return;let r=this.pending.get(e.id);if(r){if(clearTimeout(r.timeout),this.pending.delete(e.id),e.error){r.reject(new v(e.error.code,r.method,e.error.message));return}if(r.deadlineMs!==void 0&&this.monotonicNow()>=r.deadlineMs){r.reject(new c(`rust-analyzer readiness deadline expired during LSP request ${r.method}`));return}r.resolve(e.result)}}recordDiagnosticNotification(e){if(e.method!=="textDocument/publishDiagnostics")return;let r=e.params,n=r&&typeof r=="object"&&typeof r.uri=="string"?r.uri:null;if(!n)return;this.diagnosedUris.add(n);let i=this.diagnosticWaiters.get(n)??[];this.diagnosticWaiters.delete(n),i.forEach(s=>s(!0))}recordServerStatusNotification(e){if(e.method!=="experimental/serverStatus"||e.id!==void 0||!me(e.params))return;let r=e.params,n={health:r.health,quiescent:r.quiescent,...typeof r.message=="string"?{message:r.message}:{}},i=++this.currentServerStatusGeneration;if(this.latestServerStatus={generation:i,status:n},n.health==="error"){this.rejectReadinessWaiters(G());return}if(n.quiescent)for(let s of this.readinessWaiters)i<=s.afterGeneration||(clearTimeout(s.timeout),this.readinessWaiters.delete(s),s.resolve(n))}respondToServerRequest(e){if(e.id===void 0||e.id===null||!e.method)return;let r=e.method==="workspace/configuration"?this.workspaceConfiguration(e.params):null;this.transport.write(S({jsonrpc:"2.0",id:e.id,result:r}))}workspaceConfiguration(e){return(e&&typeof e=="object"&&Array.isArray(e.items)?e.items:[]).map(n=>typeof n.section=="string"?pe(this.configuration,n.section):this.configuration)}rejectPending(e){for(let[r,n]of this.pending)clearTimeout(n.timeout),n.reject(e),this.pending.delete(r);this.rejectReadinessWaiters(e)}resolveDiagnosticWaiters(e){for(let r of this.diagnosticWaiters.values())r.forEach(n=>n(e));this.diagnosticWaiters.clear()}rejectReadinessWaiters(e){for(let r of this.readinessWaiters)clearTimeout(r.timeout),r.reject(e),this.readinessWaiters.delete(r)}};function de(t=le,e=ce){if(!Number.isSafeInteger(t)||t<=0)throw new TypeError("maxHeaderBytes must be a positive safe integer.");if(!Number.isSafeInteger(e)||e<=0)throw new TypeError("maxMessageBytes must be a positive safe integer.");if(t>U)throw new RangeError(`maxHeaderBytes cannot exceed ${U} bytes for rust-analyzer LSP.`);if(t+g.length+e>J)throw new RangeError(`Combined rust-analyzer LSP header and message limits cannot exceed ${J} bytes.`);return{maxHeaderBytes:t,maxMessageBytes:e}}function fe(t,e){let r=[];for(let s of t.split(`\r
4
- `)){let o=s.indexOf(":");o<0||s.slice(0,o).trim().toLowerCase()!=="content-length"||r.push(s.slice(o+1).trim())}if(r.length===0)throw new p("rust-analyzer LSP response missing Content-Length header");if(r.length>1){let s=new Set(r).size>1?"rust-analyzer LSP response has conflicting Content-Length headers":"rust-analyzer LSP response has duplicate Content-Length headers";throw new p(s)}let n=r[0];if(!/^\d+$/.test(n))throw new p("rust-analyzer LSP Content-Length must be a non-negative safe integer");let i=Number(n);if(!Number.isSafeInteger(i))throw new p("rust-analyzer LSP Content-Length must be a non-negative safe integer");if(i>e)throw new p(`rust-analyzer LSP Content-Length exceeds ${e} byte message limit`);return i}function z(t,e,r=f){if(e===void 0)return{timeoutMs:t,deadlineLimited:!1};let n=e-r();if(n<=0)throw new c("rust-analyzer readiness deadline expired before LSP operation");return{timeoutMs:Math.min(t,n),deadlineLimited:n<=t}}function me(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return(e.health==="ok"||e.health==="warning"||e.health==="error")&&typeof e.quiescent=="boolean"&&(e.message===void 0||e.message===null||typeof e.message=="string")}function G(){return new c("rust-analyzer reported error health before reaching readiness")}function pe(t,e){let r=e.startsWith("rust-analyzer.")?e.slice(14):e;if(r===""||r==="rust-analyzer")return t;let n=t;for(let i of r.split(".")){if(!n||typeof n!="object")return null;n=n[i]}return n??null}function he(t){return t?(Array.isArray(t)?t:[t]).flatMap(r=>ye(r)?[r]:ge(r)?[{uri:r.targetUri,range:r.targetSelectionRange}]:[]):[]}function ye(t){return!!(t&&typeof t=="object"&&typeof t.uri=="string")}function ge(t){return!!(t&&typeof t=="object"&&typeof t.targetUri=="string")}function K(t,e,r=process.env,n){let i=ae(t,[],{cwd:e,env:r,detached:$()!=="win32",stdio:["pipe","pipe","pipe"],windowsHide:!0}),s=i.pid===void 0?null:B(i.pid,$()!=="win32"),o=s?F(n,s):null,u=null;return i.on("close",()=>x(o)),{write(l){i.stdin.write(l)},onData(l){i.stdout.on("data",l)},onClose(l){i.on("close",l)},onError(l){i.on("error",l)},kill(){if(!s){i.kill();return}return u??=q(s,{gracefulMs:1e3,forceMs:1e3}).then(l=>{if(!l.reaped)throw new Error(l.detail??`rust-analyzer process tree ${s.rootPid} was not reaped.`);x(o)}),u}}}function S(t){let e=JSON.stringify(t);return`Content-Length: ${Buffer.byteLength(e,"utf8")}\r
4
+ `)){let o=s.indexOf(":");o<0||s.slice(0,o).trim().toLowerCase()!=="content-length"||r.push(s.slice(o+1).trim())}if(r.length===0)throw new p("rust-analyzer LSP response missing Content-Length header");if(r.length>1){let s=new Set(r).size>1?"rust-analyzer LSP response has conflicting Content-Length headers":"rust-analyzer LSP response has duplicate Content-Length headers";throw new p(s)}let n=r[0];if(!/^\d+$/.test(n))throw new p("rust-analyzer LSP Content-Length must be a non-negative safe integer");let i=Number(n);if(!Number.isSafeInteger(i))throw new p("rust-analyzer LSP Content-Length must be a non-negative safe integer");if(i>e)throw new p(`rust-analyzer LSP Content-Length exceeds ${e} byte message limit`);return i}function z(t,e,r=f){if(e===void 0)return{timeoutMs:t,deadlineLimited:!1};let n=e-r();if(n<=0)throw new c("rust-analyzer readiness deadline expired before LSP operation");return{timeoutMs:Math.min(t,n),deadlineLimited:n<=t}}function me(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return(e.health==="ok"||e.health==="warning"||e.health==="error")&&typeof e.quiescent=="boolean"&&(e.message===void 0||e.message===null||typeof e.message=="string")}function G(){return new c("rust-analyzer reported error health before reaching readiness")}function pe(t,e){let r=e.startsWith("rust-analyzer.")?e.slice(14):e;if(r===""||r==="rust-analyzer")return t;let n=t;for(let i of r.split(".")){if(!n||typeof n!="object")return null;n=n[i]}return n??null}function he(t){return t?(Array.isArray(t)?t:[t]).flatMap(r=>ye(r)?[r]:ge(r)?[{uri:r.targetUri,range:r.targetSelectionRange}]:[]):[]}function ye(t){return!!(t&&typeof t=="object"&&typeof t.uri=="string")}function ge(t){return!!(t&&typeof t=="object"&&typeof t.targetUri=="string")}function K(t,e,r=process.env,n){let i=ae(t,[],{cwd:e,env:r,detached:$()!=="win32",stdio:["pipe","pipe","pipe"],windowsHide:!0}),s=i.pid===void 0?null:W(i.pid,$()!=="win32"),o=s?F(n,s):null,u=null;return i.on("close",()=>x(o)),{write(l){i.stdin.write(l)},onData(l){i.stdout.on("data",l)},onClose(l){i.on("close",l)},onError(l){i.on("error",l)},kill(){if(!s){i.kill();return}return u??=j(s,{gracefulMs:1e3,forceMs:1e3}).then(l=>{if(!l.reaped)throw new Error(l.detail??`rust-analyzer process tree ${s.rootPid} was not reaped.`);x(o)}),u}}}function S(t){let e=JSON.stringify(t);return`Content-Length: ${Buffer.byteLength(e,"utf8")}\r
5
5
  \r
6
6
  ${e}`}function Re(t){let e=JSON.parse(t);if(!e||typeof e!="object")throw new Error("rust-analyzer LSP response was not a JSON object");return e}function we(t,e){return`rust-analyzer LSP transport closed${e?` by ${e}`:t===null?"":` with code ${t}`}`}async function Q(t,e,r,n=f){let i=r-n();if(i<=0)throw new c("rust-analyzer readiness deadline expired before quiescence");try{let s=await t.waitForQuiescence(e,i);if(P(r,n,"during quiescence"),s.health==="error")throw new c("rust-analyzer reported error health before reaching readiness");if(!s.quiescent)throw new c("rust-analyzer did not report quiescence before reaching readiness");return s}catch(s){throw s instanceof c?s:new c(s instanceof Error?s.message:String(s))}}async function tt(t,e,r,n,i,s=f,o=D){let u=await Q(t,e,n,s);if(r===0)return u;let l=t.serverStatusSnapshot();if(!l)throw new c("rust-analyzer status is unavailable after initial document open");return await be(t,l,r,n,i,s,o)??u}async function be(t,e,r,n,i,s=f,o=D){if(r===0)return null;if(!e)throw new c("rust-analyzer status is unavailable before document open");Y(e.status,"before document open");try{await t.readinessBarrier({deadlineMs:n}),P(n,s,"during post-open synchronization")}catch(d){throw d instanceof c?d:new c(d instanceof Error?d.message:String(d))}let u=t.serverStatusSnapshot();if(!u||u.generation<e.generation)throw new c("rust-analyzer status is unavailable after document open");let l;return u.generation===e.generation?(Y(u.status,"after document open"),l=u.status):l=await Q(t,e.generation,n,s),await C(i,n,s,o),l}async function rt(t,e,r,n=f){let i=z(e,r,n);await t(i.timeoutMs),P(r,n,"during diagnostics")}async function C(t,e,r=f,n=D){if(t<=0)return;if(z(t,e,r).deadlineLimited)throw new c("rust-analyzer readiness deadline cannot accommodate delay");await n(t),P(e,r,"during delay")}async function nt(t,e){try{return await t()}catch(r){throw r instanceof c&&await e(),r}}function it(t){return t instanceof c?{ok:!1,error:t.message}:null}function P(t,e,r){if(t-e()<=0)throw new c(`rust-analyzer readiness deadline expired ${r}`)}function Y(t,e){if(t.health==="error")throw new c(`rust-analyzer reported error health ${e}`);if(!t.quiescent)throw new c(`rust-analyzer did not report quiescence ${e}`)}function D(t){return new Promise(e=>setTimeout(e,t))}async function Pe(t){let e=t.includeReferences!==!1,r=t.includeCallees===!0,n=t.includeSignatures===!0,i={timeoutMs:t.requestTimeoutMs},s=Ae(t),o=X(t),u=V(t),l=ee(t),d=Oe(t.projectRoot,s),y=Ie(t.projectRoot,d),k=ke(d),h=new L(K(t.rustAnalyzerBinary,y),{requestTimeoutMs:t.requestTimeoutMs,configuration:k});try{let A=await h.initialize({processId:m.pid,rootUri:T(y,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:k});if(e&&!A.capabilities.referencesProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/references support.",references:o.map(a=>[a.symbolId,[]]),...r?{callees:u.map(a=>[a.symbolId,[]])}:{}};if(r&&!A.capabilities.callHierarchyProvider)return{available:!1,reason:"rust-analyzer initialized without call hierarchy support.",references:o.map(a=>[a.symbolId,[]]),callees:u.map(a=>[a.symbolId,[]]),...n?{signatures:l.map(a=>[a.symbolId,null])}:{}};if(n&&!A.capabilities.hoverProvider)return{available:!1,reason:"rust-analyzer initialized without hover support.",references:o.map(a=>[a.symbolId,[]]),...r?{callees:u.map(a=>[a.symbolId,[]])}:{},signatures:l.map(a=>[a.symbolId,null])};let ie=Be(h,t.projectRoot,s);await qe(h,ie,t.diagnosticsTimeoutMs??1e4),await ne(t.settleDelayMs??5e3);let I=e?await w(o,t.concurrency??8,async a=>{let O=await te(h,b(t.projectRoot,a,!1),{requestTimeoutMs:t.requestTimeoutMs,retryTimeoutMs:t.referenceRetryTimeoutMs});return{symbolId:a.symbolId,references:N(_(t.projectRoot,O.locations)),complete:O.complete}}):o.map(a=>({symbolId:a.symbolId,references:[],complete:!0})),se=r?await w(u,t.concurrency??8,async a=>({symbolId:a.symbolId,callees:await je(h,t.projectRoot,a,i)})):[],oe=n?await w(l,t.concurrency??8,async a=>({symbolId:a.symbolId,signature:await xe(h,t.projectRoot,a,i)})):[];return{available:!0,references:I.filter(a=>a.complete).map(a=>[a.symbolId,a.references]),incompleteReferenceSymbolIds:I.filter(a=>!a.complete).map(a=>a.symbolId),...r?{callees:se.map(a=>[a.symbolId,a.callees])}:{},...n?{signatures:oe.map(a=>[a.symbolId,a.signature])}:{}}}finally{await h.shutdown().catch(()=>{})}}function X(t){return t.referenceDefinitions??t.definitions}function V(t){return t.calleeDefinitions??t.definitions}function ee(t){return t.signatureDefinitions??t.definitions}function Ae(t){return[...t.includeReferences!==!1?X(t):[],...t.includeCallees===!0?V(t):[],...t.includeSignatures===!0?ee(t):[]]}async function xe(t,e,r,n={}){let i=b(e,r,!1),s=await Te(t,{textDocument:i.textDocument,position:i.position},n);return Ce(s)}async function Te(t,e,r={}){try{return await t.hover(e,r)}catch(n){if(R(n),!(n instanceof Error?n.message:String(n)).includes("content modified"))return null;await re(r.deadlineMs);try{return await t.hover(e,r)}catch(s){return R(s),null}}}function Ce(t){if(!t)return null;let e=De(t.contents),r=/```(?:rust)?\s*([\s\S]*?)```/i.exec(e),n=r?r[1]:e;for(let i of n.split(/\r?\n/)){let s=i.replace(/^`+|`+$/g,"").trim();if(s&&Ee(s))return s}return null}function De(t){return typeof t=="string"?t:Array.isArray(t)?t.map(Me).join(`
7
- `):"value"in t?t.value:""}function Me(t){return typeof t=="string"?t:t.value}function Ee(t){return/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:const\s+)?(?:unsafe\s+)?(?:extern\s+(?:"[^"]+"\s+)?)?(?:fn|struct|enum|trait|type|const|static|mod)\b/.test(t)}function ke(t){return{...t.length>0?{linkedProjects:t}:{},references:{excludeImports:!1,excludeTests:!1}}}function Ie(t,e){return e.length===1?M(e[0]):E(t)}function Oe(t,e){let r=E(t),n=[],i=new Set;for(let s of e){let o=M(E(r,s.relativePath));for(;$e(r,o);){let u=ve(o,"Cargo.toml");if(Se(u)){i.has(u)||(i.add(u),n.push(u));break}let l=M(o);if(l===o)break;o=l}}return n}function Be(t,e,r){let n=new Set,i=[];for(let s of r)if(!n.has(s.relativePath)){n.add(s.relativePath);try{let o=T(e,s.relativePath);t.didOpenTextDocument({uri:o,languageId:"rust",version:1,text:W(e,s.relativePath,{inputKind:"indexed Rust source file"})}),i.push(o)}catch(o){if(!j(o))throw o}}return i}async function qe(t,e,r){await Promise.all(e.map(n=>t.waitForDiagnostics(n,r).catch(()=>!1)))}async function ht(t,e){return(await te(t,e)).locations}async function te(t,e,r={}){try{return{locations:await t.references(e,{timeoutMs:r.requestTimeoutMs,deadlineMs:r.deadlineMs}),complete:!0}}catch(n){R(n);let i=n instanceof Error?n.message:String(n);if(Z(n))return{locations:[],complete:!1};if(!i.includes("content modified"))return{locations:[],complete:!0};await re(r.deadlineMs);try{return{locations:await t.references(e,We(r)),complete:!0}}catch(s){return R(s),{locations:[],complete:!Z(s)}}}}function We(t){return{...t.retryTimeoutMs&&t.retryTimeoutMs>0?{timeoutMs:t.retryTimeoutMs}:{},...t.deadlineMs!==void 0?{deadlineMs:t.deadlineMs}:{}}}function Z(t){let e=t instanceof Error?t.message:String(t);return e.includes("rust-analyzer LSP request")&&e.includes("timed out after")}async function je(t,e,r,n={}){let i=b(e,r,!1),s=await Fe(t,{textDocument:i.textDocument,position:i.position},n),o=(await Promise.all(s.map(u=>He(t,u,n)))).flat();return Ne(_e(e,o))}async function Fe(t,e,r={}){try{return await t.prepareCallHierarchy(e,r)}catch(n){return R(n),[]}}async function He(t,e,r={}){try{return await t.outgoingCalls(e,r)}catch(n){return R(n),[]}}async function re(t){if(t===void 0){await ne(1e3);return}await C(1e3,t)}function R(t){if(t instanceof c)throw t}function _e(t,e){return e.map(r=>({symbol:r.to.name,file:H(t,r.to.uri),line:r.to.selectionRange.start.line,...r.fromRanges[0]===void 0?{}:{callsiteLine:r.fromRanges[0].start.line}}))}function Ne(t){let e=new Set,r=[];for(let n of t){let i=`${n.symbol}\0${n.file}\0${n.line}\0${n.callsiteLine??""}`;e.has(i)||(e.add(i),r.push(n))}return r.sort((n,i)=>n.file.localeCompare(i.file)||n.line-i.line||n.symbol.localeCompare(i.symbol))}function ne(t){return t<=0?Promise.resolve():new Promise(e=>setTimeout(e,t))}function $e(t,e){return e===t||e.startsWith(`${t}${Le}`)}async function Ue(){return new Promise((t,e)=>{let r=[];m.stdin.on("data",n=>r.push(n)),m.stdin.on("error",e),m.stdin.on("end",()=>t(Buffer.concat(r).toString("utf8")))})}async function Je(){try{let t=JSON.parse(await Ue()),e=await Pe(t);m.stdout.write(JSON.stringify(e))}catch(t){let e={available:!1,reason:t instanceof Error?t.message:String(t),references:[]};m.stdout.write(JSON.stringify(e)),m.exitCode=1}}m.argv[1]&&ze(import.meta.url)===m.argv[1]&&Je();export{L as a,K as b,tt as c,be as d,rt as e,nt as f,it as g,Pe as h,X as i,V as j,ee as k,Ae as l,xe as m,Te as n,Ce as o,ke as p,Ie as q,Oe as r,Be as s,qe as t,ht as u,te as v,je as w,ne as x};
8
- //# sourceMappingURL=chunk-K5G7SPAG.js.map
7
+ `):"value"in t?t.value:""}function Me(t){return typeof t=="string"?t:t.value}function Ee(t){return/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:const\s+)?(?:unsafe\s+)?(?:extern\s+(?:"[^"]+"\s+)?)?(?:fn|struct|enum|trait|type|const|static|mod)\b/.test(t)}function ke(t){return{...t.length>0?{linkedProjects:t}:{},references:{excludeImports:!1,excludeTests:!1}}}function Ie(t,e){return e.length===1?M(e[0]):E(t)}function Oe(t,e){let r=E(t),n=[],i=new Set;for(let s of e){let o=M(E(r,s.relativePath));for(;$e(r,o);){let u=ve(o,"Cargo.toml");if(Se(u)){i.has(u)||(i.add(u),n.push(u));break}let l=M(o);if(l===o)break;o=l}}return n}function Be(t,e,r){let n=new Set,i=[];for(let s of r)if(!n.has(s.relativePath)){n.add(s.relativePath);try{let o=T(e,s.relativePath);t.didOpenTextDocument({uri:o,languageId:"rust",version:1,text:B(e,s.relativePath,{inputKind:"indexed Rust source file"})}),i.push(o)}catch(o){if(!q(o))throw o}}return i}async function qe(t,e,r){await Promise.all(e.map(n=>t.waitForDiagnostics(n,r).catch(()=>!1)))}async function ht(t,e){return(await te(t,e)).locations}async function te(t,e,r={}){try{return{locations:await t.references(e,{timeoutMs:r.requestTimeoutMs,deadlineMs:r.deadlineMs}),complete:!0}}catch(n){R(n);let i=n instanceof Error?n.message:String(n);if(Z(n))return{locations:[],complete:!1};if(!i.includes("content modified"))return{locations:[],complete:!0};await re(r.deadlineMs);try{return{locations:await t.references(e,We(r)),complete:!0}}catch(s){return R(s),{locations:[],complete:!Z(s)}}}}function We(t){return{...t.retryTimeoutMs&&t.retryTimeoutMs>0?{timeoutMs:t.retryTimeoutMs}:{},...t.deadlineMs!==void 0?{deadlineMs:t.deadlineMs}:{}}}function Z(t){let e=t instanceof Error?t.message:String(t);return e.includes("rust-analyzer LSP request")&&e.includes("timed out after")}async function je(t,e,r,n={}){let i=b(e,r,!1),s=await Fe(t,{textDocument:i.textDocument,position:i.position},n),o=(await Promise.all(s.map(u=>He(t,u,n)))).flat();return Ne(_e(e,o))}async function Fe(t,e,r={}){try{return await t.prepareCallHierarchy(e,r)}catch(n){return R(n),[]}}async function He(t,e,r={}){try{return await t.outgoingCalls(e,r)}catch(n){return R(n),[]}}async function re(t){if(t===void 0){await ne(1e3);return}await C(1e3,t)}function R(t){if(t instanceof c)throw t}function _e(t,e){return e.map(r=>({symbol:r.to.name,file:H(t,r.to.uri),line:r.to.selectionRange.start.line,...r.fromRanges[0]===void 0?{}:{callsiteLine:r.fromRanges[0].start.line}}))}function Ne(t){let e=new Set,r=[];for(let n of t){let i=`${n.symbol}\0${n.file}\0${n.line}\0${n.callsiteLine??""}`;e.has(i)||(e.add(i),r.push(n))}return r.sort((n,i)=>n.file.localeCompare(i.file)||n.line-i.line||n.symbol.localeCompare(i.symbol))}function ne(t){return t<=0?Promise.resolve():new Promise(e=>setTimeout(e,t))}function $e(t,e){return e===t||e.startsWith(`${t}${Le}`)}async function Ue(){return new Promise((t,e)=>{let r=[];m.stdin.on("data",n=>r.push(n)),m.stdin.on("error",e),m.stdin.on("end",()=>t(Buffer.concat(r).toString("utf8")))})}async function Je(){try{let t=JSON.parse(await Ue()),e=await Pe(t);m.stdout.write(JSON.stringify(e))}catch(t){let e={available:!1,reason:t instanceof Error?t.message:String(t),references:[]};m.stdout.write(JSON.stringify(e)),m.exitCode=1}}m.argv[1]&&ze(import.meta.url)===m.argv[1]&&Je();export{L as a,K as b,tt as c,be as d,rt as e,nt as f,it as g,Pe as h,X as i,V as j,ee as k,Ae as l,xe as m,Te as n,Ce as o,ke as p,Ie as q,Oe as r,Be as s,qe as t,ht as u,te as v,je as w,ne as x};
8
+ //# sourceMappingURL=chunk-Z6RL7XOE.js.map
@@ -1,4 +1,4 @@
1
- import{c as f}from"./chunk-NK76RSB6.js";import{a as b,d as g}from"./chunk-JN5LIBT3.js";import{d as m}from"./chunk-AM5SUGHF.js";import{o as u,p as _,q as a}from"./chunk-JOALNFY3.js";import{a as l}from"./chunk-RVYLJDXC.js";import{w as p}from"./chunk-PLZXWZHY.js";function B(e,t={}){let{scope:o,limit:r}=t,i=new f(e),s=T([...x(e,o),...y(e,i,o)]);return F(s),r?s.slice(0,r):s}function x(e,t){let o=[];for(let r of N(e,t)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||g(e,r.barrel_path)||p(e,r.barrel_path)&&a(e,r.barrel_path).length===0)continue;let i=I(e,r),s=i?.barrel_consumers??0,n=i?.direct_consumers??0;s!==0||n!==0||o.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:m(r.symbol),originalFile:r.original_path,barrelConsumers:s,directConsumers:n,...h(e,r.barrel_path)})}return o}function N(e,t){let o=t?"AND barrel_d.relative_path LIKE ?":"",r=t?[`%${t}%`]:[];return e.all(`WITH barrel_refs AS MATERIALIZED (
1
+ import{c as f}from"./chunk-HENP2O4A.js";import{a as b,d as g}from"./chunk-NDKOVQFG.js";import{d as m}from"./chunk-GVAF222T.js";import{o as u,p as _,q as a}from"./chunk-F74LZWCE.js";import{a as l}from"./chunk-ICUL7XRT.js";import{w as p}from"./chunk-7GAK2F3H.js";function B(e,t={}){let{scope:o,limit:r}=t,i=new f(e),s=T([...x(e,o),...y(e,i,o)]);return F(s),r?s.slice(0,r):s}function x(e,t){let o=[];for(let r of N(e,t)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||g(e,r.barrel_path)||p(e,r.barrel_path)&&a(e,r.barrel_path).length===0)continue;let i=I(e,r),s=i?.barrel_consumers??0,n=i?.direct_consumers??0;s!==0||n!==0||o.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:m(r.symbol),originalFile:r.original_path,barrelConsumers:s,directConsumers:n,...h(e,r.barrel_path)})}return o}function N(e,t){let o=t?"AND barrel_d.relative_path LIKE ?":"",r=t?[`%${t}%`]:[];return e.all(`WITH barrel_refs AS MATERIALIZED (
2
2
  SELECT DISTINCT
3
3
  barrel_d.id AS barrel_doc_id,
4
4
  barrel_d.relative_path AS barrel_path,
@@ -71,4 +71,4 @@ import{c as f}from"./chunk-NK76RSB6.js";import{a as b,d as g}from"./chunk-JN5LIB
71
71
  ${e.pathExclusionsFor("consumer_d")}
72
72
  GROUP BY consumer_d.id
73
73
  )`,t.barrel_doc_id,t.symbol_id,t.barrel_doc_id,t.original_doc_id)}function y(e,t,o){let r=[],i=C(e);for(let s of O(e,o))E(i,s,s)>0||r.push(...D(e,t,s,i));return r}function O(e,t){return l(e,{scope:t,includeIgnored:!1}).filter(o=>a(e,o).length>0||u(e,o).length>0)}function D(e,t,o,r){let i=a(e,o).filter(n=>n.sourcePath&&!e.isIgnored(n.sourcePath)).flatMap(n=>R(e,t,o,n.sourcePath,r,[A(n.specifier)])),s=u(e,o).filter(n=>n.sourcePath&&!e.isIgnored(n.sourcePath)).flatMap(n=>R(e,t,o,n.sourcePath,r,n.kind==="named"&&n.names.length>0?n.names:[n.kind==="star"?`* from ${n.sourcePath}`:`* namespace from ${n.sourcePath}`]));return[...i,...s]}function R(e,t,o,r,i,s){let n=t.definitionsForFile(r);return s.map(c=>{let d=n.find(S=>S.leaf===c);return{barrelFile:o,symbol:d?.symbol??`source-reexport:${o}:${c}`,shortName:d?m(d.symbol):c,originalFile:r,barrelConsumers:0,directConsumers:E(i,r,o),...h(e,o)}})}function A(e){return e.split("::").at(-1)?.split("/").at(-1)?.replace(/\.[^.]+$/,"")??e}function h(e,t){return b(e,t)?{actionTier:"signal",surfaceEvidence:["barrel file is declared on the package public surface"],recommendation:"Review the package API before removing this re-export; local consumers are zero, but external consumers may import through the public barrel."}:{actionTier:"direct",surfaceEvidence:[],recommendation:"Remove this unused re-export when the barrel is not part of an external API surface."}}function C(e){let t=new Map;for(let o of l(e,{includeIgnored:!1}))for(let r of _(e,o)){if(!r.sourcePath)continue;let i=t.get(r.sourcePath)??new Set;i.add(o),t.set(r.sourcePath,i)}return t}function E(e,t,o){let r=e.get(t);return r?r.size-(r.has(o)?1:0):0}function T(e){let t=new Set,o=[];for(let r of e){let i=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;t.has(i)||(t.add(i),o.push(r))}return o}function F(e){e.sort((t,o)=>o.directConsumers-t.directConsumers||t.barrelFile.localeCompare(o.barrelFile)||t.shortName.localeCompare(o.shortName))}export{B as a};
74
- //# sourceMappingURL=chunk-OVKZM2XI.js.map
74
+ //# sourceMappingURL=chunk-ZAFGY22Q.js.map
@@ -1,2 +1,2 @@
1
- import{a as c}from"./chunk-B2E3HZ2A.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
2
- //# sourceMappingURL=chunk-A67HT5FR.js.map
1
+ import{a as c}from"./chunk-GV2CEZCW.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
2
+ //# sourceMappingURL=chunk-ZB4C5TTR.js.map
@@ -1,2 +1,2 @@
1
- import{d}from"./chunk-OTOKVOJ3.js";import{M as p}from"./chunk-RVYLJDXC.js";function y(t,e={}){let{minTotalLines:i=800,minTemplateLines:n=300,minScriptLines:r=300,minStyleLines:u=500,limit:o=20,scope:a,scanLimit:l,filePattern:m}=e;return p(t).vueProfiles({scope:a,scanLimit:l}).filter(s=>!m||s.file.includes(m)).map(s=>L(s,{minTotalLines:i,minTemplateLines:n,minScriptLines:r,minStyleLines:u})).filter(s=>s!==null).sort((s,c)=>c.totalLines-s.totalLines||s.file.localeCompare(c.file)).slice(0,o)}function L(t,e){let i=d(t,b(e),"total"),{reasons:n}=i;if(n.length===0)return null;let r=i.dominantPressure,u=i.pressureKinds.includes("total")?[...new Set([...i.pressureKinds,r])]:i.pressureKinds,o=g(t.file),a=x(r,o),l=t.totalLines+t.delegatedComposableLines;return{file:t.file,totalLines:l,sfcLines:t.sfcLines,templateLines:t.templateLines,scriptLines:t.scriptLines,styleLines:t.styleLines,externalScriptLines:t.externalScriptLines,externalScriptPaths:t.externalScriptPaths,customBlockLines:t.customBlockLines,delegatedComposableLines:t.delegatedComposableLines,delegatedComposablePaths:t.delegatedComposablePaths,dominantPressure:r,pressureKinds:u,contextKind:o,recommendationKind:a,recommendation:f(a,o),reasons:n,loc:l}}function b(t){return[{axis:"total",value:e=>e.totalLines+e.delegatedComposableLines,qualifies:(e,i)=>i>=t.minTotalLines,reason:(e,i)=>e.delegatedComposableLines>0?`${i} total line(s) (${e.totalLines} component + ${e.delegatedComposableLines} delegated composable line(s) across ${e.delegatedComposablePaths.length} file(s))`:`${i} total component line(s)`,dominantEligible:!1},{axis:"template",value:e=>e.templateLines,qualifies:(e,i)=>i>=t.minTemplateLines,reason:(e,i)=>`${i} template line(s)`},{axis:"script",value:e=>e.scriptLines-e.externalScriptLines,qualifies:e=>e.scriptLines>=t.minScriptLines,reason:e=>`${e.scriptLines} script line(s)`},{axis:"style",value:e=>e.styleLines,qualifies:(e,i)=>i>=t.minStyleLines,reason:(e,i)=>`${i} style line(s)`},{axis:"external-script",value:e=>e.externalScriptLines,qualifies:(e,i)=>i>=t.minScriptLines},{axis:"custom-block",value:e=>e.customBlockLines,qualifies:()=>!1}]}function g(t){return t.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).some(n=>w.has(n))||/(?:view|page|route)\.vue$/i.test(t)||/(?:^|\/)(views|pages|routes)\//i.test(t)?"route-page":"component"}function x(t,e){return t==="style"?"style-decomposition":t==="template"?"template-decomposition":t==="external-script"?"external-script-boundary":t==="custom-block"?"custom-block-review":e==="route-page"?"route-page-decomposition":t==="script"?"script-behavior-extraction":"total-size-review"}function f(t,e){switch(t){case"template-decomposition":return e==="route-page"?"Split route template sections into named panels before extracting script behavior.":"Split repeated template sections into named presentational components.";case"script-behavior-extraction":return"Extract independent script behavior into composables, controllers, or feature modules.";case"style-decomposition":return"Review UI/style decomposition; move repeated styling to component or style primitives, not composables.";case"external-script-boundary":return"Review the external script boundary and split controller/composable modules by workflow.";case"custom-block-review":return"Review custom block ownership before splitting template or script code.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"total-size-review":return"Review the largest block first, then split by the dominant reason to change."}}var w=new Set(["landing","page","pages","route","routes","view","views"]);export{y as a};
2
- //# sourceMappingURL=chunk-CWMHWD56.js.map
1
+ import{d}from"./chunk-OTOKVOJ3.js";import{M as p}from"./chunk-ICUL7XRT.js";function y(t,e={}){let{minTotalLines:i=800,minTemplateLines:n=300,minScriptLines:r=300,minStyleLines:u=500,limit:o=20,scope:a,scanLimit:l,filePattern:m}=e;return p(t).vueProfiles({scope:a,scanLimit:l}).filter(s=>!m||s.file.includes(m)).map(s=>L(s,{minTotalLines:i,minTemplateLines:n,minScriptLines:r,minStyleLines:u})).filter(s=>s!==null).sort((s,c)=>c.totalLines-s.totalLines||s.file.localeCompare(c.file)).slice(0,o)}function L(t,e){let i=d(t,b(e),"total"),{reasons:n}=i;if(n.length===0)return null;let r=i.dominantPressure,u=i.pressureKinds.includes("total")?[...new Set([...i.pressureKinds,r])]:i.pressureKinds,o=g(t.file),a=x(r,o),l=t.totalLines+t.delegatedComposableLines;return{file:t.file,totalLines:l,sfcLines:t.sfcLines,templateLines:t.templateLines,scriptLines:t.scriptLines,styleLines:t.styleLines,externalScriptLines:t.externalScriptLines,externalScriptPaths:t.externalScriptPaths,customBlockLines:t.customBlockLines,delegatedComposableLines:t.delegatedComposableLines,delegatedComposablePaths:t.delegatedComposablePaths,dominantPressure:r,pressureKinds:u,contextKind:o,recommendationKind:a,recommendation:f(a,o),reasons:n,loc:l}}function b(t){return[{axis:"total",value:e=>e.totalLines+e.delegatedComposableLines,qualifies:(e,i)=>i>=t.minTotalLines,reason:(e,i)=>e.delegatedComposableLines>0?`${i} total line(s) (${e.totalLines} component + ${e.delegatedComposableLines} delegated composable line(s) across ${e.delegatedComposablePaths.length} file(s))`:`${i} total component line(s)`,dominantEligible:!1},{axis:"template",value:e=>e.templateLines,qualifies:(e,i)=>i>=t.minTemplateLines,reason:(e,i)=>`${i} template line(s)`},{axis:"script",value:e=>e.scriptLines-e.externalScriptLines,qualifies:e=>e.scriptLines>=t.minScriptLines,reason:e=>`${e.scriptLines} script line(s)`},{axis:"style",value:e=>e.styleLines,qualifies:(e,i)=>i>=t.minStyleLines,reason:(e,i)=>`${i} style line(s)`},{axis:"external-script",value:e=>e.externalScriptLines,qualifies:(e,i)=>i>=t.minScriptLines},{axis:"custom-block",value:e=>e.customBlockLines,qualifies:()=>!1}]}function g(t){return t.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).some(n=>w.has(n))||/(?:view|page|route)\.vue$/i.test(t)||/(?:^|\/)(views|pages|routes)\//i.test(t)?"route-page":"component"}function x(t,e){return t==="style"?"style-decomposition":t==="template"?"template-decomposition":t==="external-script"?"external-script-boundary":t==="custom-block"?"custom-block-review":e==="route-page"?"route-page-decomposition":t==="script"?"script-behavior-extraction":"total-size-review"}function f(t,e){switch(t){case"template-decomposition":return e==="route-page"?"Split route template sections into named panels before extracting script behavior.":"Split repeated template sections into named presentational components.";case"script-behavior-extraction":return"Extract independent script behavior into composables, controllers, or feature modules.";case"style-decomposition":return"Review UI/style decomposition; move repeated styling to component or style primitives, not composables.";case"external-script-boundary":return"Review the external script boundary and split controller/composable modules by workflow.";case"custom-block-review":return"Review custom block ownership before splitting template or script code.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"total-size-review":return"Review the largest block first, then split by the dominant reason to change."}}var w=new Set(["landing","page","pages","route","routes","view","views"]);export{y as a};
2
+ //# sourceMappingURL=chunk-ZNH33XIB.js.map
@@ -1,4 +1,4 @@
1
- import{c as S}from"./chunk-SF34QLK2.js";import{c as m}from"./chunk-NK76RSB6.js";import{h as y}from"./chunk-VCL7FK3E.js";import{a as h}from"./chunk-ZOEDRCR4.js";import{p}from"./chunk-JOALNFY3.js";import{a as g}from"./chunk-RVYLJDXC.js";import f from"path";function W(e,t){let{scope:i,minDeviation:r=5,limit:n=50}=t??{},a=t?.semantic!==!1,u=t?.includePatternDeviations===!0,o=new m(e).fileDependencyGraph(i),l=S(e,{scope:i}),c=x([...D(e,o,{scope:i,semantic:a}),...R(l.forbiddenEdges),...u?E(o,r):[]]);return t?.includeArchitecture===!0&&(c.architecture=l),n<=0||c.results.length<=n?c:{...c,results:c.results.slice(0,n),totalResults:c.results.length}}function D(e,t,i){let r=_(e,i.scope),n=[],a=new Set;for(let[s,o]of t){if(d(s))continue;let l=r.get(s)??new Set;for(let c of o)d(c)||l.has(c)||v(e,s,c,i)||(n.push({file:s,dep:c}),a.add(s))}a.size>0&&w(e,r,{paths:[...a]});let u=[];for(let{file:s,dep:o}of n)(r.get(s)??new Set).has(o)||u.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${s} to ${o}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return u}function v(e,t,i,r){return C(e,t,i)||M(e,t,i)||O(i)||P(e,t,i)||N(i)?!0:r.semantic&&A(e,t,i)}function R(e){return e.flatMap(t=>{let i=t.examples[0];return i?[{file:i.fromFile,kind:"architecture-violation",description:`${t.from} depends on forbidden boundary ${t.to} through ${t.fileEdgeCount} file edge(s)`,dep:i.toFile,detail:`${t.from} may not depend on ${t.to}`,actionTier:"direct",policyBasis:"explicit",architecture:{fromBoundary:t.from,toBoundary:t.to,fileEdgeCount:t.fileEdgeCount,importerCount:t.importerCount,importedFileCount:t.importedFileCount,examples:t.examples},evidenceReasons:[`configured dependency row for ${t.from} does not allow ${t.to}`,`${t.fileEdgeCount} file edge(s) connect ${t.importerCount} importer(s) to ${t.importedFileCount} imported file(s)`,...t.examples.map(r=>`${r.fromFile} imports ${r.toFile}`)],recommendation:"Move the dependency behind an allowed boundary, reverse the dependency through an owned interface, or deliberately update the project architecture rule."}]:[]})}function E(e,t){let i=[];for(let[r,n]of k(e)){let a=n.filter(s=>!d(s));if(a.length<t)continue;let u=I(e,a);for(let s of a)for(let o of e.get(s)??[])d(o)||(u.get(o)??0)===1&&f.dirname(o)!==r&&f.dirname(o)!==f.dirname(r)&&i.push({file:s,kind:"pattern-deviation",description:`Only file in ${r}/ that depends on ${o}`,dep:o,actionTier:"signal",evidenceReasons:[`${a.length} sibling file(s) in ${r}/ were compared`,`${s} is the only non-skipped sibling depending on ${o}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."})}return i}function x(e){let t=e.filter(i=>i.kind==="architecture-violation").length;return{results:e,unusedImports:e.filter(i=>i.kind==="unused-import").length,architectureViolations:t,layerViolations:t,patternDeviations:e.filter(i=>i.kind==="pattern-deviation").length}}function k(e){let t=new Map;for(let i of e.keys()){let r=f.dirname(i),n=t.get(r);n||(n=[],t.set(r,n)),n.push(i)}return t}function I(e,t){let i=new Map;for(let r of t)for(let n of e.get(r)??[])d(n)||i.set(n,(i.get(n)??0)+1);return i}function _(e,t){let i=new Map;return $(e,i,t),i}function $(e,t,i){for(let r of F(e,i))b(e,t,r.from_file,r.to_file)}function F(e,t){let i=t?"AND d1.relative_path LIKE ?":"",r=t?[`%${t}%`]:[];return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
1
+ import{c as S}from"./chunk-LQHYYIOB.js";import{c as m}from"./chunk-HENP2O4A.js";import{h as y}from"./chunk-J3GLP7Q5.js";import{a as h}from"./chunk-BRQL7AFJ.js";import{p}from"./chunk-F74LZWCE.js";import{a as g}from"./chunk-ICUL7XRT.js";import f from"path";function W(e,t){let{scope:i,minDeviation:r=5,limit:n=50}=t??{},a=t?.semantic!==!1,u=t?.includePatternDeviations===!0,o=new m(e).fileDependencyGraph(i),l=S(e,{scope:i}),c=x([...D(e,o,{scope:i,semantic:a}),...R(l.forbiddenEdges),...u?E(o,r):[]]);return t?.includeArchitecture===!0&&(c.architecture=l),n<=0||c.results.length<=n?c:{...c,results:c.results.slice(0,n),totalResults:c.results.length}}function D(e,t,i){let r=_(e,i.scope),n=[],a=new Set;for(let[s,o]of t){if(d(s))continue;let l=r.get(s)??new Set;for(let c of o)d(c)||l.has(c)||v(e,s,c,i)||(n.push({file:s,dep:c}),a.add(s))}a.size>0&&w(e,r,{paths:[...a]});let u=[];for(let{file:s,dep:o}of n)(r.get(s)??new Set).has(o)||u.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${s} to ${o}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return u}function v(e,t,i,r){return C(e,t,i)||M(e,t,i)||O(i)||P(e,t,i)||N(i)?!0:r.semantic&&A(e,t,i)}function R(e){return e.flatMap(t=>{let i=t.examples[0];return i?[{file:i.fromFile,kind:"architecture-violation",description:`${t.from} depends on forbidden boundary ${t.to} through ${t.fileEdgeCount} file edge(s)`,dep:i.toFile,detail:`${t.from} may not depend on ${t.to}`,actionTier:"direct",policyBasis:"explicit",architecture:{fromBoundary:t.from,toBoundary:t.to,fileEdgeCount:t.fileEdgeCount,importerCount:t.importerCount,importedFileCount:t.importedFileCount,examples:t.examples},evidenceReasons:[`configured dependency row for ${t.from} does not allow ${t.to}`,`${t.fileEdgeCount} file edge(s) connect ${t.importerCount} importer(s) to ${t.importedFileCount} imported file(s)`,...t.examples.map(r=>`${r.fromFile} imports ${r.toFile}`)],recommendation:"Move the dependency behind an allowed boundary, reverse the dependency through an owned interface, or deliberately update the project architecture rule."}]:[]})}function E(e,t){let i=[];for(let[r,n]of k(e)){let a=n.filter(s=>!d(s));if(a.length<t)continue;let u=I(e,a);for(let s of a)for(let o of e.get(s)??[])d(o)||(u.get(o)??0)===1&&f.dirname(o)!==r&&f.dirname(o)!==f.dirname(r)&&i.push({file:s,kind:"pattern-deviation",description:`Only file in ${r}/ that depends on ${o}`,dep:o,actionTier:"signal",evidenceReasons:[`${a.length} sibling file(s) in ${r}/ were compared`,`${s} is the only non-skipped sibling depending on ${o}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."})}return i}function x(e){let t=e.filter(i=>i.kind==="architecture-violation").length;return{results:e,unusedImports:e.filter(i=>i.kind==="unused-import").length,architectureViolations:t,layerViolations:t,patternDeviations:e.filter(i=>i.kind==="pattern-deviation").length}}function k(e){let t=new Map;for(let i of e.keys()){let r=f.dirname(i),n=t.get(r);n||(n=[],t.set(r,n)),n.push(i)}return t}function I(e,t){let i=new Map;for(let r of t)for(let n of e.get(r)??[])d(n)||i.set(n,(i.get(n)??0)+1);return i}function _(e,t){let i=new Map;return $(e,i,t),i}function $(e,t,i){for(let r of F(e,i))b(e,t,r.from_file,r.to_file)}function F(e,t){let i=t?"AND d1.relative_path LIKE ?":"",r=t?[`%${t}%`]:[];return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -15,4 +15,4 @@ import{c as S}from"./chunk-SF34QLK2.js";import{c as m}from"./chunk-NK76RSB6.js";
15
15
  AND m.role != 1
16
16
  ${e.pathExclusionsFor("d1","d2")}
17
17
  ${i}`,...r)}function w(e,t,i={}){new m(e).scanSourceReferences({paths:i.paths??g(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},n=>{n.target.relativePath!==n.sourceFile&&(e.isIgnored(n.target.relativePath)||b(e,t,n.sourceFile,n.target.relativePath))})}function b(e,t,i,r){if(e.isIgnored(i)||e.isIgnored(r))return;let n=t.get(i);n||(n=new Set,t.set(i,n)),n.add(r)}function O(e){return e.includes("types")||e.endsWith(".d.ts")}function A(e,t,i){let r=y(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.some(n=>n.isUsed)}function C(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.some(n=>n.used)}function M(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.every(n=>n.isTypeOnly===!0)}function N(e){return e.endsWith(".vue")}function P(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length===0?!1:r.every(n=>n.kind==="side-effect"||n.kind==="namespace"&&n.usedMembers.length===0&&!n.used)}function d(e){let t=h(e);return!!(t==="entry"||t==="barrel"||t==="test"||t==="worker"||T(f.basename(e)))}function T(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{W as a};
18
- //# sourceMappingURL=chunk-ZNQCR656.js.map
18
+ //# sourceMappingURL=chunk-ZQ62NNKN.js.map
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{$ as b,_ as a,aa as c,ba as d,ca as e,da as f,ea as g,fa as h,ga as i,ha as j,ia as k,ja as l,ka as m,la as n,ma as o,na as p}from"./chunk-W3FK73MD.js";import"./chunk-G2XUZCF2.js";import"./chunk-DUKHVPU5.js";export{b as activateCliProjectContext,n as collect,c as currentCliDatabase,o as formatBytes,p as formatStatus,i as openDb,j as openProjectDb,f as prepareWorktreeIndex,h as residentQueryLaneEligible,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,k as rootIndexFallbackWarning,l as setResidentDatabaseProvider,g as sharedCachePreparationEligible,m as withDb};
3
- //# sourceMappingURL=cli-context-XEPPF4RX.js.map
2
+ import{$ as b,_ as a,aa as c,ba as d,ca as e,da as f,ea as g,fa as h,ga as i,ha as j,ia as k,ja as l,ka as m,la as n,ma as o,na as p}from"./chunk-7UCDGXRW.js";import"./chunk-5T44HG5Y.js";import"./chunk-DUKHVPU5.js";export{b as activateCliProjectContext,n as collect,c as currentCliDatabase,o as formatBytes,p as formatStatus,i as openDb,j as openProjectDb,f as prepareWorktreeIndex,h as residentQueryLaneEligible,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,k as rootIndexFallbackWarning,l as setResidentDatabaseProvider,g as sharedCachePreparationEligible,m as withDb};
3
+ //# sourceMappingURL=cli-context-FJL2JHOE.js.map
@@ -1,2 +1,2 @@
1
- import{da as a,ea as b,fa as c,ga as d,ha as e,ia as f,ja as g,ka as h,la as i,ma as j,na as k,oa as l,pa as m,qa as n,ra as o,sa as p}from"./chunk-WJOQC4P7.js";import"./chunk-XYLV727H.js";import"./chunk-2VKB5CMA.js";import"./chunk-ACZDU5GK.js";import"./chunk-R2NOK63J.js";import"./chunk-6URCE5QY.js";import"./chunk-4O52YNKL.js";export{b as activateCliProjectContext,n as collect,c as currentCliDatabase,o as formatBytes,p as formatStatus,i as openDb,j as openProjectDb,f as prepareWorktreeIndex,h as residentQueryLaneEligible,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,k as rootIndexFallbackWarning,l as setResidentDatabaseProvider,g as sharedCachePreparationEligible,m as withDb};
2
- //# sourceMappingURL=cli-context-TSADTXLB.js.map
1
+ import{da as a,ea as b,fa as c,ga as d,ha as e,ia as f,ja as g,ka as h,la as i,ma as j,na as k,oa as l,pa as m,qa as n,ra as o,sa as p}from"./chunk-MEUHIDI3.js";import"./chunk-T75DS2E6.js";import"./chunk-RCIGX23V.js";import"./chunk-D7DOB27N.js";import"./chunk-R2NOK63J.js";import"./chunk-6O3KXIDL.js";import"./chunk-UQYQBLJX.js";export{b as activateCliProjectContext,n as collect,c as currentCliDatabase,o as formatBytes,p as formatStatus,i as openDb,j as openProjectDb,f as prepareWorktreeIndex,h as residentQueryLaneEligible,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,k as rootIndexFallbackWarning,l as setResidentDatabaseProvider,g as sharedCachePreparationEligible,m as withDb};
2
+ //# sourceMappingURL=cli-context-PQNWHMCQ.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import{c as K}from"./chunk-RWKEXCHU.js";import{c as Q}from"./chunk-B3UYV66Z.js";import{a as J}from"./chunk-T55YPJGB.js";import{a as h}from"./chunk-YYFV32WR.js";import"./chunk-362QOSFD.js";import{c as F,d as H,e as q,f as W,g as B,h as G}from"./chunk-FIXYHQ3W.js";import{j as _,l as V,n as U}from"./chunk-PHPQ24UG.js";import{p as L,q as z}from"./chunk-CIVYHK7U.js";import"./chunk-N3Q3AWGW.js";import"./chunk-B2OB55RR.js";import{a as v,b as I}from"./chunk-XZEE23VG.js";import{$ as p,N as A,O as R,_ as j,ba as $,ea as k,ka as T}from"./chunk-W3FK73MD.js";import{e as M}from"./chunk-RJWAB4VR.js";import"./chunk-D62CTZX6.js";import{aa as P,ba as O,ca as N,da as S,ea as D,l as s}from"./chunk-G2XUZCF2.js";import{d as E,r as x}from"./chunk-DUKHVPU5.js";import{Command as Pe,Help as Oe}from"commander";import{Option as se}from"commander";function y(e){return e.evidence?e.evidence:ae.has(e.id)?"mixed":e.heuristic?"heuristic":"graph-fact"}var ae=new Set(["health","context","co-change"]);function X(e){if(e.claims){if(e.claims.origin==="mixed"&&!e.claims.families?.length)throw new Error(`Mixed command ${e.id} must declare at least one claim family.`);return e.claims}let t=y(e);if(t==="mixed")throw new Error(`Mixed command ${e.id} must declare claim families.`);let n=e.agent?H(e.agent.operation):[];return n.length>0&&n.every(o=>o==="repository-observation"||o==="repository-preview")?{origin:t==="heuristic"?"heuristic":"compiler-graph",observedSources:["index-generation"],producerValidation:{status:"not-evaluated"}}:{origin:"unknown",observedSources:["process"],producerValidation:{status:"not-evaluated"}}}var Y;function Z(){return Y||{argv:process.argv.slice(2),execPath:process.execPath,...process.argv[1]!==void 0?{scriptPath:process.argv[1]}:{},cwd:process.cwd()}}function ee(e,t){return W(new Map(t.map(n=>[n.id,y(n)]))),G(new Map(t.map(n=>[n.id,X(n)]))),B(new Map(t.flatMap(n=>n.agent?[[n.id,{...n.agent,resultUnits:me(n)}]]:[]))),t.map(n=>{let i=n.hidden?e.command(n.command,{hidden:!0}):e.command(n.command);i.description(n.description),n.helpAfter&&i.addHelpText("after",`
2
+ import{c as K}from"./chunk-2EDX3JT5.js";import{c as Q}from"./chunk-B3UYV66Z.js";import{a as J}from"./chunk-TJBOJUVN.js";import{a as h}from"./chunk-Q3ZCQY2Y.js";import"./chunk-362QOSFD.js";import{c as F,d as H,e as q,f as W,g as B,h as G}from"./chunk-JLZLLLW5.js";import{j as _,l as V,n as U}from"./chunk-AQI4N64O.js";import{p as L,q as z}from"./chunk-5IC2WZAL.js";import"./chunk-C7QWUBR2.js";import"./chunk-B2OB55RR.js";import{a as v,b as I}from"./chunk-XZEE23VG.js";import{$ as p,N as A,O as R,_ as j,ba as $,ea as k,ka as T}from"./chunk-7UCDGXRW.js";import{e as M}from"./chunk-FTTV7IRX.js";import"./chunk-D62CTZX6.js";import{aa as P,ba as O,ca as N,da as S,ea as D,l as s}from"./chunk-5T44HG5Y.js";import{d as E,r as x}from"./chunk-DUKHVPU5.js";import{Command as Pe,Help as Oe}from"commander";import{Option as se}from"commander";function y(e){return e.evidence?e.evidence:ae.has(e.id)?"mixed":e.heuristic?"heuristic":"graph-fact"}var ae=new Set(["health","context","co-change"]);function X(e){if(e.claims){if(e.claims.origin==="mixed"&&!e.claims.families?.length)throw new Error(`Mixed command ${e.id} must declare at least one claim family.`);return e.claims}let t=y(e);if(t==="mixed")throw new Error(`Mixed command ${e.id} must declare claim families.`);let n=e.agent?H(e.agent.operation):[];return n.length>0&&n.every(o=>o==="repository-observation"||o==="repository-preview")?{origin:t==="heuristic"?"heuristic":"compiler-graph",observedSources:["index-generation"],producerValidation:{status:"not-evaluated"}}:{origin:"unknown",observedSources:["process"],producerValidation:{status:"not-evaluated"}}}var Y;function Z(){return Y||{argv:process.argv.slice(2),execPath:process.execPath,...process.argv[1]!==void 0?{scriptPath:process.argv[1]}:{},cwd:process.cwd()}}function ee(e,t){return W(new Map(t.map(n=>[n.id,y(n)]))),G(new Map(t.map(n=>[n.id,X(n)]))),B(new Map(t.flatMap(n=>n.agent?[[n.id,{...n.agent,resultUnits:me(n)}]]:[]))),t.map(n=>{let i=n.hidden?e.command(n.command,{hidden:!0}):e.command(n.command);i.description(n.description),n.helpAfter&&i.addHelpText("after",`
3
3
  ${n.helpAfter.trim()}
4
4
  `);for(let o of n.arguments??[])i.argument(o.name);for(let o of n.options??[])if(o.hidden){let r=new se(o.flags,o.description).hideHelp();o.parser&&r.argParser(o.parser),Object.hasOwn(o,"defaultValue")&&r.default(o.defaultValue),i.addOption(r)}else o.parser&&Object.hasOwn(o,"defaultValue")?i.option(o.flags,o.description,o.parser,o.defaultValue):o.parser?i.option(o.flags,o.description,o.parser):Object.hasOwn(o,"defaultValue")?i.option(o.flags,o.description,o.defaultValue):i.option(o.flags,o.description);return i.action(async(...o)=>{try{let r=i.optsWithGlobals();ce(r);let a=Z(),d=()=>n.id===_?n.handler(...o):V({command:n.id,producerVersion:s,invocationPrefix:a.scriptPath?[a.execPath,a.scriptPath]:["codebaseiq"],argv:[...a.argv],cwd:a.cwd,json:r.json===!0,sourceSession:r.session!==!1,reemitSource:r.reemit===!0,...typeof r.outputPageSize=="number"?{pageSize:r.outputPageSize}:{},...typeof r.outputCursor=="string"?{cursor:r.outputCursor}:{}},()=>n.handler(...o)),c=n.agent?F(n.agent.operation,{args:o.slice(0,-1),options:r}):void 0;await(c?q(c,d):d())}catch(r){de(r)}finally{p(void 0),R()}}),{descriptor:n,command:i}})}function ce(e){if(e.resultOnly===!0&&e.json!==!0)throw new Error("--result-only requires --json.");if(e.compact===!0&&e.json!==!0)throw new Error("--compact requires --json.")}function me(e){let t=e.agent?.resultUnits;if(t?.kind==="field"&&t.field.trim()==="")throw new Error(`Command ${e.id} declares an empty result-unit field.`);return t||(e.renderShape==="list"||e.renderShape==="table"||e.renderShape==="grouped-by-file"?{kind:"rows"}:{kind:"report"})}function de(e){let t=e instanceof Error?e.message:String(e);console.error(`error: ${I(t)}`),process.exitCode=1}import{existsSync as le,mkdirSync as pe,writeFileSync as ue}from"fs";import{homedir as fe}from"os";import{join as g}from"path";var he=1440*60*1e3,ne="update-check.json",ge="https://registry.npmjs.org/codebaseiq/latest";async function oe(e={}){let t=e.env??process.env;if(t.CODEBASEIQ_UPDATE_CHECK==="0"||t.NO_UPDATE_NOTIFIER)return;let n=e.cacheDir??ye(t),i=e.now??Date.now(),o=e.currentVersion??s,r=be(n),a=r&&i-r.checkedAt<he?r.latestVersion:await we(n,e.fetchLatestVersion??xe,i);if(!a||!ve(a,o))return;(e.writeNotice??(c=>console.error(c)))(Ce(o,a))}function Ce(e,t){return[`codebaseiq update available: ${e} -> ${t}.`,"Agent: tell your human to update with: npm install -g codebaseiq@latest",""].join(`
5
5
  `)}function ve(e,t){let n=te(e),i=te(t);if(!n||!i)return e!==t;for(let o=0;o<n.length;o++){let r=n[o]-i[o];if(r>0)return!0;if(r<0)return!1}return!1}function ye(e){let t=e.XDG_CACHE_HOME||g(fe(),".cache");return g(t,"codebaseiq")}function be(e){let t=g(e,ne);if(!le(t))return null;try{let n=JSON.parse(x(t,"update notice cache"));return typeof n.checkedAt=="number"&&(typeof n.latestVersion=="string"||n.latestVersion===null)?{checkedAt:n.checkedAt,latestVersion:n.latestVersion}:null}catch{return null}}async function we(e,t,n){let i;try{i=await t()}catch{i=null}return Ee(e,{checkedAt:n,latestVersion:i}),i}function Ee(e,t){try{pe(e,{recursive:!0}),ue(g(e,ne),`${JSON.stringify(t,null,2)}
6
6
  `)}catch{}}async function xe(){let e=await fetch(ge,{signal:AbortSignal.timeout(1e3)});if(!e.ok)return null;let t=await e.json();return typeof t.version=="string"?t.version:null}function te(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}async function ct(e={}){let t=new Pe;e.resident&&t.exitOverride(),e.terminalOutput&&t.configureOutput({writeOut:o=>process.stdout.write(v(o)),writeErr:o=>process.stderr.write(v(o))}),t.name("codebaseiq").description("Language-agnostic code intelligence CLI powered by SCIP indexes").version(s).option("--output-page-size <characters>","Return bounded output pages with an exact continuation command",U).option("--output-cursor <cursor>","Continue a bounded output page").option("--no-session","Disable the explicit exploration evidence ledger").option("--reemit","Recovery only: render source and graph evidence again instead of citing session receipts").option("--help-all","Display every command, including compatibility and deprecated controls");let n=await K(e.invocationCommand);ee(t,n);let i=new Oe;return t.configureHelp({formatHelp:(o,r)=>o===t?Q(t,n):i.formatHelp(o,r)}),t.hook("preAction",async(o,r)=>{let a=r.name();if(e.resident){await e.resident.preAction(a);return}let d=k(a),c=L(a);if(!d&&!c){ie(),await re(a);return}let m=j(),u=E(m);A(u);let C=$(m,u);p(C),ie(),await re(a);let{config:b,paths:w}=C;if(d){let l=await J({commandName:a,projectRoot:m,config:b,paths:w,dbPathSource:C.dbPathSource,gitContext:u});process.env.CODEBASEIQ_DEBUG&&console.error(`evidence-freshness: ${l.source}`),l.service.kind==="failed"&&console.error(`warning: codebaseiq watch service did not start: ${l.service.message}`),(l.service.kind==="failed"||l.service.kind==="skipped")&&h(m,s);return}if(!c){h(m,s);return}let f=z({commandName:a,projectRoot:m,cacheDir:w.cacheDir,cliVersion:s,config:b,gitContext:u});f.kind==="failed"&&console.error(`warning: codebaseiq watch service did not start: ${f.message}`),(f.kind==="failed"||f.kind==="skipped")&&h(m,s)}),t.hook("postAction",()=>p(void 0)),{program:t,descriptors:n}}async function re(e){e.startsWith("__")||await oe({commandName:e})}function ie(){if(N(),!P()||S())return;let e=null;try{e=T(t=>M(t))}catch{}D({command:O()??`codebaseiq ${process.argv.slice(2).join(" ")}`,toolVersion:s,projectFingerprint:e})}export{ct as createCliProgram};
7
- //# sourceMappingURL=cli-program-KJGQEM72.js.map
7
+ //# sourceMappingURL=cli-program-UO7PZD6V.js.map
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{b as n}from"./chunk-ZJZQ7Q2Q.js";import{d as s}from"./chunk-XZEE23VG.js";import"./chunk-D62CTZX6.js";import"./chunk-DUKHVPU5.js";import{realpathSync as p}from"fs";import{fileURLToPath as y}from"url";import{constants as a,setPriority as u}from"os";var m="CODEBASEIQ_PROCESS_PRIORITY";function P(r=process.env){let o=r[m]?.trim().toLowerCase();return o==="low"||o==="idle"?o:null}function c(r=process.env,o=u){let e=P(r);if(e===null)return null;let t=e==="idle"?a.priority.PRIORITY_LOW:a.priority.PRIORITY_BELOW_NORMAL;try{o(t)}catch{}return e}f()&&(c(),s(),await d());async function d(){let r=process.argv.includes("--help-all");if(!r){let i=await n(process.argv.slice(2));if(i.served)return;process.env.CODEBASEIQ_DEBUG&&console.error(`query-lane: ${i.reason}`)}let{normalizeLegacyEvidenceInvocation:o}=await import("./invocation-command-descriptors-PPVZOIE5.js");o(process.argv);let{createCliProgram:e}=await import("./cli-program-KJGQEM72.js"),{program:t,descriptors:l}=await e({...process.argv[2]!==void 0?{invocationCommand:process.argv[2]}:{},terminalOutput:!0});if(r){let{renderRootCommandHelp:i}=await import("./command-panels-SZONPMLJ.js");process.stdout.write(i(t,l,{includeCompatibility:!0}));return}await t.parseAsync()}function f(){if(!process.argv[1])return!1;let r=y(import.meta.url);try{return p(r)===p(process.argv[1])}catch{return r===process.argv[1]}}
2
+ import{b as n}from"./chunk-JFIA2JI3.js";import{d as s}from"./chunk-XZEE23VG.js";import"./chunk-D62CTZX6.js";import"./chunk-DUKHVPU5.js";import{realpathSync as p}from"fs";import{fileURLToPath as y}from"url";import{constants as a,setPriority as u}from"os";var m="CODEBASEIQ_PROCESS_PRIORITY";function P(r=process.env){let o=r[m]?.trim().toLowerCase();return o==="low"||o==="idle"?o:null}function c(r=process.env,o=u){let e=P(r);if(e===null)return null;let t=e==="idle"?a.priority.PRIORITY_LOW:a.priority.PRIORITY_BELOW_NORMAL;try{o(t)}catch{}return e}f()&&(c(),s(),await d());async function d(){let r=process.argv.includes("--help-all");if(!r){let i=await n(process.argv.slice(2));if(i.served)return;process.env.CODEBASEIQ_DEBUG&&console.error(`query-lane: ${i.reason}`)}let{normalizeLegacyEvidenceInvocation:o}=await import("./invocation-command-descriptors-U76PN7IY.js");o(process.argv);let{createCliProgram:e}=await import("./cli-program-UO7PZD6V.js"),{program:t,descriptors:l}=await e({...process.argv[2]!==void 0?{invocationCommand:process.argv[2]}:{},terminalOutput:!0});if(r){let{renderRootCommandHelp:i}=await import("./command-panels-SZONPMLJ.js");process.stdout.write(i(t,l,{includeCompatibility:!0}));return}await t.parseAsync()}function f(){if(!process.argv[1])return!1;let r=y(import.meta.url);try{return p(r)===p(process.argv[1])}catch{return r===process.argv[1]}}
3
3
  //# sourceMappingURL=cli.js.map
@@ -1,5 +1,5 @@
1
1
  import { S as SourceObservationFreshness } from './repository-text-C0Q8VYdN.js';
2
- import { S as ScipDatabase } from './db-DmRNdCtm.js';
2
+ import { S as ScipDatabase } from './db-BoG_PWYH.js';
3
3
  import { OutlineNode } from './queries/outline.js';
4
4
 
5
5
  interface BindingDefinitionEvidence {
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as ke}from"./chunk-T55YPJGB.js";import{a as Me,b as Fe}from"./chunk-FQA3KIFX.js";import{r as xe}from"./chunk-CIVYHK7U.js";import{H as ee,X as Ee,f as ve,v as Re,w as Z}from"./chunk-N3Q3AWGW.js";import"./chunk-B2OB55RR.js";import"./chunk-XZEE23VG.js";import{K as ge,_ as be,a as I,b as pe,ba as X,c as me,ha as he}from"./chunk-W3FK73MD.js";import"./chunk-EN4AHLL3.js";import{Ha as Se,ca as Q,ga as q,ha as C,ia as U,k as O,m as ye,ta as we}from"./chunk-RJWAB4VR.js";import"./chunk-D62CTZX6.js";import{E as ue,F as le,X as de,Z as fe,l as z}from"./chunk-G2XUZCF2.js";import{d as oe,i as Y,j as se,k as ie,p as ae,r as ce}from"./chunk-DUKHVPU5.js";import{rmSync as En}from"fs";import{createConnection as xn}from"net";import{basename as Mn,join as Fn,resolve as dt}from"path";import{spawn as wt}from"child_process";var St=/^https?:\/\//iu,vt=2e3;function Le(e,t={}){let n=t.platform??process.platform,r=t.env??process.env;if(!St.test(e))return Promise.resolve({launched:!1});if(Et(r.CI))return Promise.resolve({launched:!1});if(n!=="win32"&&n!=="darwin"&&!r.DISPLAY&&!r.WAYLAND_DISPLAY)return Promise.resolve({launched:!1});let{command:s,args:o}=Rt(n,e);return new Promise(i=>{let a;try{a=(t.spawn??wt)(s,o,{detached:!0,stdio:"ignore",windowsHide:!0})}catch{i({launched:!1});return}let d=m=>{clearTimeout(p),i({launched:m})},p=setTimeout(()=>d(!0),vt);a.once("spawn",()=>d(!0)),a.on("error",()=>d(!1)),a.unref()})}function Rt(e,t){return e==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",t]}:e==="darwin"?{command:"open",args:[t]}:{command:"xdg-open",args:[t]}}function Et(e){return e!==void 0&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}var xt=5;function j(e){let t=e.trim().replace(/\\/g,"/");for(;t.startsWith("./");)t=t.slice(2);return t=t.replace(/^\/+/,"").replace(/\/+$/,""),t==="."?"":t}function Mt(e,t,n,r){let s=j(n),o=s?`${s}/`:"",i=[...new Set(e)].filter(l=>l.startsWith(o)).sort(F);if(i.length===0)return null;let a=new Set(i),d=new Map;for(let l of i){let f=l.slice(o.length),w=f.indexOf("/"),c=w<0?l:`${o}${f.slice(0,w)}`,u=d.get(c)??{kind:w<0?"file":"dir",files:[]};u.files.push(l),d.set(c,u)}let p=new Map,m=[];for(let[l,f]of d){let w=f.kind==="dir"?Ft(f.files):l;for(let c of f.files)p.set(c,w);m.push({id:w,kind:f.kind,name:f.kind==="dir"?w.slice(o.length):l.slice(o.length),path:w,files:f.files.length,internalEdges:0,cycle:null})}m.sort((l,f)=>(l.kind===f.kind?0:l.kind==="dir"?-1:1)||F(l.name,f.name));let b=new Map(m.map(l=>[l.id,l])),M=s?s.split("/"):[],y=new Map,R=new Map,x=0,E=(l,f,w)=>{x+=1;let c=`${l}\0${f}`,u=y.get(c)??{from:l,to:f,count:0,cycle:!1,samples:[]};u.count+=1,u.samples.length<xt&&u.samples.push(w),y.set(c,u)},P=l=>{let f=kt(M,l);return R.has(f)||R.set(f,{id:f,kind:"external",path:f}),f};for(let l of[...t.keys()].sort(F)){let f=a.has(l);for(let w of[...t.get(l)].sort(F)){let c=a.has(w);if(!f&&!c||!f&&l.startsWith(o)||!c&&w.startsWith(o))continue;let u={from:l,to:w};if(f&&c){let g=p.get(l),h=p.get(w);g===h?(x+=1,b.get(g).internalEdges+=1):E(g,h,u)}else f?E(p.get(l),P(w),u):E(P(l),p.get(w),u)}}let S=Lt(m,y);for(let l of m)l.cycle=S.get(l.id)??null;for(let l of y.values()){let f=S.get(l.from);l.cycle=f!==void 0&&f===S.get(l.to)}return{scope:s,basis:r,breadcrumbs:Dt(M),nodes:m,external:[...R.values()].sort((l,f)=>F(l.path,f.path)),edges:[...y.values()].sort((l,f)=>F(l.from,f.from)||F(l.to,f.to)),totals:{files:i.length,edges:x}}}function De(e,t){return Mt(O(e,{includeIgnored:!1}),Oe(e,t.basis),t.scope,t.basis)}function Pe(e,t){let n=O(e,{includeIgnored:!1}),r=j(t);for(;r;){let s=`${r}/`;if(n.some(i=>i.startsWith(s)))return r;let o=r.lastIndexOf("/");r=o<0?"":r.slice(0,o)}return""}function Ve(e,t,n){let r=j(t);if(!O(e,{includeIgnored:!1}).includes(r))return null;let s=Oe(e,n),o=[];for(let[i,a]of s)a.has(r)&&o.push(i);return{file:r,dependsOn:[...s.get(r)??[]].sort(F),dependedOnBy:o.sort(F)}}function Oe(e,t){return t==="imports"?Q(e,void 0,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}):Q(e)}function Ft(e){let t=e.map(r=>r.split("/").slice(0,-1)),n=[...t[0]];for(let r of t){let s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s+=1;n.length=s}return n.join("/")}function kt(e,t){let n=t.split("/"),r=0;for(;r<e.length&&r<n.length&&e[r]===n[r];)r+=1;return n.slice(0,r+1).join("/")}function Lt(e,t){let n=new Map(e.map(o=>[o.id,new Set]));for(let o of t.values())n.has(o.from)&&n.has(o.to)&&n.get(o.from).add(o.to);let r=Ee(n).components.filter(o=>o.length>1).map(o=>[...o].sort(F)).sort((o,i)=>F(o[0],i[0])),s=new Map;return r.forEach((o,i)=>{for(let a of o)s.set(a,i+1)}),s}function Dt(e){return[{name:"root",path:""},...e.map((t,n)=>({name:t,path:e.slice(0,n+1).join("/")}))]}function F(e,t){return e<t?-1:e>t?1:0}var Ce=["callers","callees","contracts","data","state","runtime"],Pt={families:["execution","identity","contract","dataflow","state","runtime"],subtypes:["call","result-callback","references","uses-contract-symbol","argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result","reads-resource","writes-resource","deletes-resource","enqueues-resource","consumes-resource","runtime-handoff","discriminator-dispatch"],direction:"both",maxDepth:1,maxEdges:2e3},Ne={exact:0,derived:1,mixed:2,candidate:3,unknown:4},N="root",Vt=new Set(["source-construct","runtime-boundary-participant","call-result","argument-expression","static-value"]);function _e(e,t){let n=t.trim();if(!n)return{status:"missing"};let r=Se(e,n),s=r.match;if(!s)return{status:"missing"};let o=new Map,i=(a,d,p)=>{o.has(a)||o.set(a,{symbol:a,name:q(a),file:d,line:p})};i(s.symbol,s.relativePath,s.startLine);for(let a of r.candidates)i(a.symbol,a.relativePath,a.startLine);return o.size===1&&At(n,s)?{status:"matched",symbol:s.symbol}:{status:"ambiguous",candidates:[...o.values()],total:r.total}}function $e(e,t,n={}){let r=ee(e,{symbols:[t]},Pt),s=r.targets[0]?.nodeIds[0],o=s?Bt(r,s):null,i=s&&o?qe(r,s,It(o)):Tt(r);if(!n.statements)return i;let a=ee(e,{symbols:[t]},{view:"complete",maxDepth:1,maxEdges:400});return{...i,statements:{inventory:a.inventory??[],edges:a.edges.map(jt)}}}function qe(e,t,n){let r=new Map(Ce.map(i=>[i,new Map])),s=[];for(let i of e.edges){let a=Te(i.from,t,n),d=Te(i.to,t,n);if(!a||!d)continue;let p,m;if(a===N&&d!==N)p=!1,m=d;else if(d===N&&a!==N)p=!0,m=a;else continue;if(i.family==="identity"){p&&i.subtype==="references"&&s.push({target:m,edge:i});continue}let b=Ot(i,p);b&&je(r.get(b),m,i,!1)}let o=r.get("callers");for(let{target:i,edge:a}of s){let d=o.get(i.key);(!d||d.reference)&&je(o,i,a,!0)}return{lanes:Object.fromEntries(Ce.map(i=>[i,Nt(r.get(i))])),coverage:{status:e.coverage.status,omittedEdges:e.coverage.omittedEdges}}}function Ot(e,t){let{family:n,subtype:r}=e;return n==="execution"&&(r==="call"||r==="result-callback")?t?"callers":"callees":n==="contract"&&r==="uses-contract-symbol"?t?null:"contracts":n==="dataflow"&&(r.endsWith("-to-parameter")||r==="return-to-call-result")?"data":n==="state"?"state":n==="runtime"?"runtime":null}function Te(e,t,n){if(e.id===t)return N;if(e.kind==="symbol"&&e.symbol)return Be(e.symbol,e.label,e);if(e.kind==="structural-region")return{key:`region:${e.id}`,kind:"region",label:e.label};if(e.kind==="program-resource"||e.kind==="runtime-state-resource")return{key:`resource:${e.id}`,kind:"resource",label:e.label,...te(e),...e.kind==="program-resource"&&Ie(e,n)?{local:!0}:{}};if(Ie(e,n))return N;if(e.location&&Vt.has(e.kind))return{key:`location:${e.id}`,kind:"location",label:e.label,...te(e)};let r=Ct(e);return r?Be(r,q(r),e):null}function Be(e,t,n){return{key:`symbol:${e}`,kind:"symbol",label:t,symbol:e,...te(n)}}function te(e){return e.location?{file:e.location.file,line:e.location.line}:{}}function Ie(e,t){return e.location!==null&&e.location.file===t.file&&e.location.line>=t.startLine&&e.location.line<=t.endLine}function Ct(e){if(e.kind!=="parameter")return null;let[t,n]=e.id.split(":");return t==="parameter"&&n?decodeURIComponent(n):null}function je(e,t,n,r){let s=e.get(t.key);if(!s){e.set(t.key,{kind:t.kind,label:t.label,...t.symbol?{symbol:t.symbol}:{},...t.file!==void 0?{file:t.file,line:t.line}:{},subtypes:[n.subtype],count:1,strength:n.evidenceStrength,...t.local?{local:!0}:{},...r?{reference:!0}:{}});return}s.count+=1,s.subtypes.includes(n.subtype)||s.subtypes.push(n.subtype),Ne[n.evidenceStrength]<Ne[s.strength]&&(s.strength=n.evidenceStrength)}function Nt(e){return[...e.values()].map(t=>({...t,subtypes:[...t.subtypes].sort()})).sort((t,n)=>Ae(t.label,n.label)||Ae(t.file??"",n.file??"")||(t.line??0)-(n.line??0))}function Tt(e){return qe({...e,edges:[]},"",{file:"",startLine:0,endLine:-1})}function Bt(e,t){for(let n of e.edges){if(n.from.id===t)return n.from;if(n.to.id===t)return n.to}return null}function It(e){return e.location?{file:e.location.file,startLine:e.location.line,endLine:e.location.endLine??e.location.line}:{file:"",startLine:0,endLine:-1}}function jt(e){return{id:e.id,family:e.family,subtype:e.subtype,from:e.from,to:e.to,strength:e.evidenceStrength,methods:e.evidenceMethods}}function At(e,t){if(e===t.symbol)return!0;let n=e.replace(/\\/g,"/").replace(/\(\)$/u,""),r=C(t.symbol);if(n===q(t.symbol).replace(/\(\)$/u,"")||n===r)return!0;let s=e.match(/^(.+):(\d+)(?:-(\d+))?$/);if(s){let i=ye(s[1]);return t.relativePath===i||t.relativePath.endsWith(`/${i}`)}let o=n.lastIndexOf("/");return o>0&&n.slice(o+1)===r&&t.relativePath.toLowerCase().includes(n.slice(0,o).toLowerCase())}function Ae(e,t){return e<t?-1:e>t?1:0}function Ue(e){let t=e.published??fe,n=e.open(),r=null,s=o=>{try{o.close()}catch{}};return{acquire(){if(!n)throw new Error("The viewer database is closed.");let o=t(e.dbPath);if(o!==null&&o!==n.generation.identity&&o!==r)try{let i=e.open();s(n),n=i,r=o}catch{}return n},generation(){return n?.generation.identity??null},close(){let o=n;n=void 0,o&&s(o)}}}import{posix as Ge,resolve as _t}from"path";var He=400,We=2e3,$t=["callers","callees","contracts","data","state","runtime"],qt=4096,Ut=/:\d+(?:-\d+)?$/u,Gt=/^\s*```[^\n]*\n[\s\S]*?```[^\S\n]*(?:\n|$)/u;function Ye(e,t){return{status:200,body:{projectRoot:t.projectRoot,projectName:t.meta.projectName,cliVersion:t.meta.cliVersion,generation:D(e),watcher:{state:t.meta.watcherState()},builder:{available:t.meta.builder.available,modes:[...I],defaultMode:t.meta.builder.defaultMode}}}}function ze(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path")??"",o=B(s);if(o===null)return L(e,`Path is outside the project: ${T(s)}`,{nearest:""});let i=n.queries.normalizeMapScope(o),a=n.queries.codeMapScope(e,{scope:i,basis:r});return a?{status:200,body:{...a,generation:D(e)}}:L(e,`No indexed files under "${i}".`,{nearest:n.queries.nearestMapScope(e,i)})}function Xe(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path");if(!s)return k(e,"path is required.");let o=B(s);if(o===null||o===""||!n.queries.isIndexedFile(e,o))return L(e,`No indexed file at "${T(s)}".`);let i=n.queries.codeMapFile(e,o,r);return{status:200,body:{file:o,breadcrumbs:Yt(o),editorUri:ne(n.projectRoot,o,1),outline:tt(e,o,n),dependsOn:i?.dependsOn??[],dependedOnBy:i?.dependedOnBy??[],stale:n.queries.fileIsStale(e,o),generation:D(e)}}}function Qe(e,t,n){let r=t.get("symbol"),s=t.get("focus"),o=r||s;if(!o)return k(e,"symbol or focus is required.");if(o.length>qt)return k(e,"The selector is too long.");let i=r||"";if(!r){let S=n.queries.resolveFocus(e,o);if(S.status==="ambiguous")return{status:200,body:{status:"ambiguous",candidates:S.candidates.map(l=>({symbol:l.symbol,name:l.name,file:l.file,line:l.line+1})),total:S.total,generation:D(e)}};if(S.status==="missing")return L(e,`No symbol matches "${T(o)}".`);i=S.symbol}let a=Ut.test(i)?null:n.queries.code(e,i);if(!a||a.symbol!==i||a.symbol===a.relativePath||!n.queries.isIndexedFile(e,a.relativePath))return L(e,`No indexed definition for "${T(i)}".`);let d=a.relativePath,p=nt(tt(e,d,n),i),m=n.queries.fileSymbolFacts(e,d);if(!p&&!m.has(i))return L(e,`No indexed definition for "${T(i)}".`);let b=m.get(i),M=t.get("statements")==="1",y=n.queries.symbolFocusLanes(e,i,M?{statements:!0}:void 0),R=a.startLine+1,x=a.source.split(`
2
+ import{a as ke}from"./chunk-TJBOJUVN.js";import{a as Me,b as Fe}from"./chunk-5DSL3NT2.js";import{r as xe}from"./chunk-5IC2WZAL.js";import{H as ee,X as Ee,f as ve,v as Re,w as Z}from"./chunk-C7QWUBR2.js";import"./chunk-B2OB55RR.js";import"./chunk-XZEE23VG.js";import{K as ge,_ as be,a as I,b as pe,ba as X,c as me,ha as he}from"./chunk-7UCDGXRW.js";import"./chunk-EN4AHLL3.js";import{Ha as Se,ca as Q,ga as q,ha as C,ia as U,k as O,m as ye,ta as we}from"./chunk-FTTV7IRX.js";import"./chunk-D62CTZX6.js";import{E as ue,F as le,X as de,Z as fe,l as z}from"./chunk-5T44HG5Y.js";import{d as oe,i as Y,j as se,k as ie,p as ae,r as ce}from"./chunk-DUKHVPU5.js";import{rmSync as En}from"fs";import{createConnection as xn}from"net";import{basename as Mn,join as Fn,resolve as dt}from"path";import{spawn as wt}from"child_process";var St=/^https?:\/\//iu,vt=2e3;function Le(e,t={}){let n=t.platform??process.platform,r=t.env??process.env;if(!St.test(e))return Promise.resolve({launched:!1});if(Et(r.CI))return Promise.resolve({launched:!1});if(n!=="win32"&&n!=="darwin"&&!r.DISPLAY&&!r.WAYLAND_DISPLAY)return Promise.resolve({launched:!1});let{command:s,args:o}=Rt(n,e);return new Promise(i=>{let a;try{a=(t.spawn??wt)(s,o,{detached:!0,stdio:"ignore",windowsHide:!0})}catch{i({launched:!1});return}let d=m=>{clearTimeout(p),i({launched:m})},p=setTimeout(()=>d(!0),vt);a.once("spawn",()=>d(!0)),a.on("error",()=>d(!1)),a.unref()})}function Rt(e,t){return e==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",t]}:e==="darwin"?{command:"open",args:[t]}:{command:"xdg-open",args:[t]}}function Et(e){return e!==void 0&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}var xt=5;function j(e){let t=e.trim().replace(/\\/g,"/");for(;t.startsWith("./");)t=t.slice(2);return t=t.replace(/^\/+/,"").replace(/\/+$/,""),t==="."?"":t}function Mt(e,t,n,r){let s=j(n),o=s?`${s}/`:"",i=[...new Set(e)].filter(l=>l.startsWith(o)).sort(F);if(i.length===0)return null;let a=new Set(i),d=new Map;for(let l of i){let f=l.slice(o.length),w=f.indexOf("/"),c=w<0?l:`${o}${f.slice(0,w)}`,u=d.get(c)??{kind:w<0?"file":"dir",files:[]};u.files.push(l),d.set(c,u)}let p=new Map,m=[];for(let[l,f]of d){let w=f.kind==="dir"?Ft(f.files):l;for(let c of f.files)p.set(c,w);m.push({id:w,kind:f.kind,name:f.kind==="dir"?w.slice(o.length):l.slice(o.length),path:w,files:f.files.length,internalEdges:0,cycle:null})}m.sort((l,f)=>(l.kind===f.kind?0:l.kind==="dir"?-1:1)||F(l.name,f.name));let b=new Map(m.map(l=>[l.id,l])),M=s?s.split("/"):[],y=new Map,R=new Map,x=0,E=(l,f,w)=>{x+=1;let c=`${l}\0${f}`,u=y.get(c)??{from:l,to:f,count:0,cycle:!1,samples:[]};u.count+=1,u.samples.length<xt&&u.samples.push(w),y.set(c,u)},P=l=>{let f=kt(M,l);return R.has(f)||R.set(f,{id:f,kind:"external",path:f}),f};for(let l of[...t.keys()].sort(F)){let f=a.has(l);for(let w of[...t.get(l)].sort(F)){let c=a.has(w);if(!f&&!c||!f&&l.startsWith(o)||!c&&w.startsWith(o))continue;let u={from:l,to:w};if(f&&c){let g=p.get(l),h=p.get(w);g===h?(x+=1,b.get(g).internalEdges+=1):E(g,h,u)}else f?E(p.get(l),P(w),u):E(P(l),p.get(w),u)}}let S=Lt(m,y);for(let l of m)l.cycle=S.get(l.id)??null;for(let l of y.values()){let f=S.get(l.from);l.cycle=f!==void 0&&f===S.get(l.to)}return{scope:s,basis:r,breadcrumbs:Dt(M),nodes:m,external:[...R.values()].sort((l,f)=>F(l.path,f.path)),edges:[...y.values()].sort((l,f)=>F(l.from,f.from)||F(l.to,f.to)),totals:{files:i.length,edges:x}}}function De(e,t){return Mt(O(e,{includeIgnored:!1}),Oe(e,t.basis),t.scope,t.basis)}function Pe(e,t){let n=O(e,{includeIgnored:!1}),r=j(t);for(;r;){let s=`${r}/`;if(n.some(i=>i.startsWith(s)))return r;let o=r.lastIndexOf("/");r=o<0?"":r.slice(0,o)}return""}function Ve(e,t,n){let r=j(t);if(!O(e,{includeIgnored:!1}).includes(r))return null;let s=Oe(e,n),o=[];for(let[i,a]of s)a.has(r)&&o.push(i);return{file:r,dependsOn:[...s.get(r)??[]].sort(F),dependedOnBy:o.sort(F)}}function Oe(e,t){return t==="imports"?Q(e,void 0,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}):Q(e)}function Ft(e){let t=e.map(r=>r.split("/").slice(0,-1)),n=[...t[0]];for(let r of t){let s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s+=1;n.length=s}return n.join("/")}function kt(e,t){let n=t.split("/"),r=0;for(;r<e.length&&r<n.length&&e[r]===n[r];)r+=1;return n.slice(0,r+1).join("/")}function Lt(e,t){let n=new Map(e.map(o=>[o.id,new Set]));for(let o of t.values())n.has(o.from)&&n.has(o.to)&&n.get(o.from).add(o.to);let r=Ee(n).components.filter(o=>o.length>1).map(o=>[...o].sort(F)).sort((o,i)=>F(o[0],i[0])),s=new Map;return r.forEach((o,i)=>{for(let a of o)s.set(a,i+1)}),s}function Dt(e){return[{name:"root",path:""},...e.map((t,n)=>({name:t,path:e.slice(0,n+1).join("/")}))]}function F(e,t){return e<t?-1:e>t?1:0}var Ce=["callers","callees","contracts","data","state","runtime"],Pt={families:["execution","identity","contract","dataflow","state","runtime"],subtypes:["call","result-callback","references","uses-contract-symbol","argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result","reads-resource","writes-resource","deletes-resource","enqueues-resource","consumes-resource","runtime-handoff","discriminator-dispatch"],direction:"both",maxDepth:1,maxEdges:2e3},Ne={exact:0,derived:1,mixed:2,candidate:3,unknown:4},N="root",Vt=new Set(["source-construct","runtime-boundary-participant","call-result","argument-expression","static-value"]);function _e(e,t){let n=t.trim();if(!n)return{status:"missing"};let r=Se(e,n),s=r.match;if(!s)return{status:"missing"};let o=new Map,i=(a,d,p)=>{o.has(a)||o.set(a,{symbol:a,name:q(a),file:d,line:p})};i(s.symbol,s.relativePath,s.startLine);for(let a of r.candidates)i(a.symbol,a.relativePath,a.startLine);return o.size===1&&At(n,s)?{status:"matched",symbol:s.symbol}:{status:"ambiguous",candidates:[...o.values()],total:r.total}}function $e(e,t,n={}){let r=ee(e,{symbols:[t]},Pt),s=r.targets[0]?.nodeIds[0],o=s?Bt(r,s):null,i=s&&o?qe(r,s,It(o)):Tt(r);if(!n.statements)return i;let a=ee(e,{symbols:[t]},{view:"complete",maxDepth:1,maxEdges:400});return{...i,statements:{inventory:a.inventory??[],edges:a.edges.map(jt)}}}function qe(e,t,n){let r=new Map(Ce.map(i=>[i,new Map])),s=[];for(let i of e.edges){let a=Te(i.from,t,n),d=Te(i.to,t,n);if(!a||!d)continue;let p,m;if(a===N&&d!==N)p=!1,m=d;else if(d===N&&a!==N)p=!0,m=a;else continue;if(i.family==="identity"){p&&i.subtype==="references"&&s.push({target:m,edge:i});continue}let b=Ot(i,p);b&&je(r.get(b),m,i,!1)}let o=r.get("callers");for(let{target:i,edge:a}of s){let d=o.get(i.key);(!d||d.reference)&&je(o,i,a,!0)}return{lanes:Object.fromEntries(Ce.map(i=>[i,Nt(r.get(i))])),coverage:{status:e.coverage.status,omittedEdges:e.coverage.omittedEdges}}}function Ot(e,t){let{family:n,subtype:r}=e;return n==="execution"&&(r==="call"||r==="result-callback")?t?"callers":"callees":n==="contract"&&r==="uses-contract-symbol"?t?null:"contracts":n==="dataflow"&&(r.endsWith("-to-parameter")||r==="return-to-call-result")?"data":n==="state"?"state":n==="runtime"?"runtime":null}function Te(e,t,n){if(e.id===t)return N;if(e.kind==="symbol"&&e.symbol)return Be(e.symbol,e.label,e);if(e.kind==="structural-region")return{key:`region:${e.id}`,kind:"region",label:e.label};if(e.kind==="program-resource"||e.kind==="runtime-state-resource")return{key:`resource:${e.id}`,kind:"resource",label:e.label,...te(e),...e.kind==="program-resource"&&Ie(e,n)?{local:!0}:{}};if(Ie(e,n))return N;if(e.location&&Vt.has(e.kind))return{key:`location:${e.id}`,kind:"location",label:e.label,...te(e)};let r=Ct(e);return r?Be(r,q(r),e):null}function Be(e,t,n){return{key:`symbol:${e}`,kind:"symbol",label:t,symbol:e,...te(n)}}function te(e){return e.location?{file:e.location.file,line:e.location.line}:{}}function Ie(e,t){return e.location!==null&&e.location.file===t.file&&e.location.line>=t.startLine&&e.location.line<=t.endLine}function Ct(e){if(e.kind!=="parameter")return null;let[t,n]=e.id.split(":");return t==="parameter"&&n?decodeURIComponent(n):null}function je(e,t,n,r){let s=e.get(t.key);if(!s){e.set(t.key,{kind:t.kind,label:t.label,...t.symbol?{symbol:t.symbol}:{},...t.file!==void 0?{file:t.file,line:t.line}:{},subtypes:[n.subtype],count:1,strength:n.evidenceStrength,...t.local?{local:!0}:{},...r?{reference:!0}:{}});return}s.count+=1,s.subtypes.includes(n.subtype)||s.subtypes.push(n.subtype),Ne[n.evidenceStrength]<Ne[s.strength]&&(s.strength=n.evidenceStrength)}function Nt(e){return[...e.values()].map(t=>({...t,subtypes:[...t.subtypes].sort()})).sort((t,n)=>Ae(t.label,n.label)||Ae(t.file??"",n.file??"")||(t.line??0)-(n.line??0))}function Tt(e){return qe({...e,edges:[]},"",{file:"",startLine:0,endLine:-1})}function Bt(e,t){for(let n of e.edges){if(n.from.id===t)return n.from;if(n.to.id===t)return n.to}return null}function It(e){return e.location?{file:e.location.file,startLine:e.location.line,endLine:e.location.endLine??e.location.line}:{file:"",startLine:0,endLine:-1}}function jt(e){return{id:e.id,family:e.family,subtype:e.subtype,from:e.from,to:e.to,strength:e.evidenceStrength,methods:e.evidenceMethods}}function At(e,t){if(e===t.symbol)return!0;let n=e.replace(/\\/g,"/").replace(/\(\)$/u,""),r=C(t.symbol);if(n===q(t.symbol).replace(/\(\)$/u,"")||n===r)return!0;let s=e.match(/^(.+):(\d+)(?:-(\d+))?$/);if(s){let i=ye(s[1]);return t.relativePath===i||t.relativePath.endsWith(`/${i}`)}let o=n.lastIndexOf("/");return o>0&&n.slice(o+1)===r&&t.relativePath.toLowerCase().includes(n.slice(0,o).toLowerCase())}function Ae(e,t){return e<t?-1:e>t?1:0}function Ue(e){let t=e.published??fe,n=e.open(),r=null,s=o=>{try{o.close()}catch{}};return{acquire(){if(!n)throw new Error("The viewer database is closed.");let o=t(e.dbPath);if(o!==null&&o!==n.generation.identity&&o!==r)try{let i=e.open();s(n),n=i,r=o}catch{}return n},generation(){return n?.generation.identity??null},close(){let o=n;n=void 0,o&&s(o)}}}import{posix as Ge,resolve as _t}from"path";var He=400,We=2e3,$t=["callers","callees","contracts","data","state","runtime"],qt=4096,Ut=/:\d+(?:-\d+)?$/u,Gt=/^\s*```[^\n]*\n[\s\S]*?```[^\S\n]*(?:\n|$)/u;function Ye(e,t){return{status:200,body:{projectRoot:t.projectRoot,projectName:t.meta.projectName,cliVersion:t.meta.cliVersion,generation:D(e),watcher:{state:t.meta.watcherState()},builder:{available:t.meta.builder.available,modes:[...I],defaultMode:t.meta.builder.defaultMode}}}}function ze(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path")??"",o=B(s);if(o===null)return L(e,`Path is outside the project: ${T(s)}`,{nearest:""});let i=n.queries.normalizeMapScope(o),a=n.queries.codeMapScope(e,{scope:i,basis:r});return a?{status:200,body:{...a,generation:D(e)}}:L(e,`No indexed files under "${i}".`,{nearest:n.queries.nearestMapScope(e,i)})}function Xe(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path");if(!s)return k(e,"path is required.");let o=B(s);if(o===null||o===""||!n.queries.isIndexedFile(e,o))return L(e,`No indexed file at "${T(s)}".`);let i=n.queries.codeMapFile(e,o,r);return{status:200,body:{file:o,breadcrumbs:Yt(o),editorUri:ne(n.projectRoot,o,1),outline:tt(e,o,n),dependsOn:i?.dependsOn??[],dependedOnBy:i?.dependedOnBy??[],stale:n.queries.fileIsStale(e,o),generation:D(e)}}}function Qe(e,t,n){let r=t.get("symbol"),s=t.get("focus"),o=r||s;if(!o)return k(e,"symbol or focus is required.");if(o.length>qt)return k(e,"The selector is too long.");let i=r||"";if(!r){let S=n.queries.resolveFocus(e,o);if(S.status==="ambiguous")return{status:200,body:{status:"ambiguous",candidates:S.candidates.map(l=>({symbol:l.symbol,name:l.name,file:l.file,line:l.line+1})),total:S.total,generation:D(e)}};if(S.status==="missing")return L(e,`No symbol matches "${T(o)}".`);i=S.symbol}let a=Ut.test(i)?null:n.queries.code(e,i);if(!a||a.symbol!==i||a.symbol===a.relativePath||!n.queries.isIndexedFile(e,a.relativePath))return L(e,`No indexed definition for "${T(i)}".`);let d=a.relativePath,p=nt(tt(e,d,n),i),m=n.queries.fileSymbolFacts(e,d);if(!p&&!m.has(i))return L(e,`No indexed definition for "${T(i)}".`);let b=m.get(i),M=t.get("statements")==="1",y=n.queries.symbolFocusLanes(e,i,M?{statements:!0}:void 0),R=a.startLine+1,x=a.source.split(`
3
3
  `),E=x.length>He,P=E?x.slice(0,He):x;return{status:200,body:{status:"matched",definition:{symbol:i,name:C(i),file:d,startLine:R,endLine:a.endLine+1,signature:p?.entry.signature??null,documentation:Wt(b?.documentation),editorUri:ne(n.projectRoot,d,R)},parent:p?.parent?{symbol:p.parent.symbol,name:p.parent.name}:null,members:(p?.entry.children??[]).map(S=>({symbol:S.symbol,name:S.name,line:S.startLine})),lanes:Qt(y.lanes,n.projectRoot),fileImports:n.queries.codeMapFile(e,d,"imports")?.dependsOn??[],coverage:y.coverage,source:{startLine:R,endLine:R+P.length-1,text:P.join(`
4
4
  `),truncated:E,stale:et(a)},...M&&y.statements?{statements:Jt(y.statements)}:{},generation:D(e)}}}function Ze(e,t,n){let r=t.get("file");if(!r)return k(e,"file is required.");let s=t.get("start"),o=t.get("end"),i=s===null?1:Ke(s);if(i===null)return k(e,"start must be a positive integer.");let a=o===null?i+We-1:Ke(o);if(a===null||a<i)return k(e,"end must be an integer at or after start.");let d=B(r);if(d===null||d===""||!n.queries.isIndexedFile(e,d))return L(e,`No indexed file at "${T(r)}".`);let p=Math.min(a,i+We-1),m=n.queries.code(e,`${d}:${i}-${p}`);return m?{status:200,body:{file:d,startLine:m.startLine+1,endLine:m.endLine+1,text:m.source,stale:et(m),generation:D(e)}}:L(e,`Lines ${i}-${p} are outside "${d}".`)}function B(e){if([...e].some(r=>r.charCodeAt(0)<32))return null;let t=e.replaceAll("\\","/");if(t.startsWith("/")||/^[A-Za-z]:/u.test(t))return null;let n=t.split("/").filter(r=>r!==""&&r!==".");return n.includes("..")?null:n.join("/")}function ne(e,t,n){return Ht(_t(e,t),n)}function Ht(e,t){let r=e.replaceAll("\\","/").replace(/[%#? ]/gu,s=>encodeURIComponent(s));return`vscode://file${r.startsWith("/")?"":"/"}${r}:${t}`}function Wt(e){if(!e)return null;let t=e.replace(Gt,"").trim();return t===""?null:t}function et(e){return e.freshness?.semantic.state==="stale"}function Jt(e){return{...e,edges:e.edges.map(Kt)}}function Kt(e){return{...e,from:Je(e.from),to:Je(e.to)}}function Je(e){let{location:t}=e;return t?{...e,location:{...t,line:t.line+1,...t.endLine!==void 0?{endLine:t.endLine+1}:{}}}:e}function Yt(e){let t=[{name:"root",path:""}],n="";for(let r of e.split("/"))n=n===""?r:`${n}/${r}`,t.push({name:r,path:n});return t}function tt(e,t,n){let r=n.queries.fileSymbolFacts(e,t),s=Xt(t),o=n.queries.outline(e,t).flatMap(a=>U(a.symbol)==="namespace"&&s.has(C(a.symbol))?a.children:[a]),i=(a,d)=>({symbol:a.symbol,name:C(a.symbol),kind:r.get(a.symbol)?.kind??zt(a.symbol,d),startLine:a.startLine+1,endLine:a.endLine+1,signature:a.signature,children:a.children.map(p=>i(p,a.symbol))});return o.map(a=>i(a))}function zt(e,t){let n=U(e);return n==="method"?t!==void 0&&U(t)==="type"?"method":"function":n==="term"?"variable":n??"unknown"}function Xt(e){let t=Ge.basename(e);return new Set([t,t.slice(0,Math.max(0,t.length-Ge.extname(t).length))])}function nt(e,t,n=null){for(let r of e){if(r.symbol===t)return{entry:r,parent:n};let s=nt(r.children,t,r);if(s)return s}return null}function Qt(e,t){let n={};for(let r of $t)n[r]=(e[r]??[]).map(s=>{let{line:o,...i}=s,a={...i};return o!==void 0&&(a.line=o+1),s.file!==void 0&&(a.editorUri=ne(t,s.file,(o??0)+1)),a});return n}function rt(e){return e===null||e===""?"references":e==="references"||e==="imports"?e:null}function Ke(e){if(!/^\d{1,9}$/u.test(e))return null;let t=Number(e);return t>=1?t:null}function D(e){return e.generation.identity}function k(e,t){return{status:400,body:{error:t,generation:D(e)}}}function L(e,t,n={}){return{status:404,body:{error:t,...n,generation:D(e)}}}function T(e){return e.length>200?`${e.slice(0,200)}...`:e}import{createHash as ct,randomBytes as Zt,timingSafeEqual as en}from"crypto";import{existsSync as A}from"fs";import{createServer as tn}from"http";import{createRequire as nn}from"module";import{dirname as rn,join as H}from"path";import{fileURLToPath as on}from"url";var _="127.0.0.1",sn=80,an="__CODEBASEIQ_TOKEN__",cn="x-codebaseiq-token",ot=64*1024,un=18e4,st=50,it=["reuse","rework","compose"],ln="cytoscape.esm.min.mjs",dn=["index.html","styles.css","app.js","api.js","map.js","file-panel.js","focus.js","builder.js"],fn={".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".js":"text/javascript; charset=utf-8"},pn=["default-src 'self'","script-src 'self'","style-src 'self' 'unsafe-inline'","img-src 'self' data:","connect-src 'self'","frame-ancestors 'none'"].join("; ");function mn(){for(let e of["../ui/view/","../../../ui/view/"]){let t=on(new URL(e,import.meta.url));if(A(H(t,"index.html")))return t}}function gn(){try{let e=nn(import.meta.url).resolve("cytoscape"),t=H(rn(e),ln);return A(t)?t:void 0}catch{return}}function at(e,t){return{body:ae(e,{maxBytes:ie,inputKind:"viewer asset"}),contentType:t}}function bn(e,t){let n=e.uiDirectory??mn();if(!n||!A(H(n,"index.html")))throw new Error("The viewer UI files were not found; reinstall codebaseiq or rebuild the package.");let r=new Map;for(let i of dn){let a=H(n,i);if(!A(a))continue;let d=at(a,fn[i.slice(i.lastIndexOf("."))]??"application/octet-stream");r.set(i,i==="index.html"?{...d,body:Buffer.from(d.body.toString("utf8").replaceAll(an,t),"utf8")}:d)}let s=e.cytoscapePath??gn(),o=s&&A(s)?at(s,"text/javascript"):void 0;return{assets:r,...o?{vendor:o}:{}}}async function ut(e){let t=e.token??Zt(24).toString("base64url"),{assets:n,vendor:r}=bn(e,t),s=e.builderTimeoutMs??un,o=ct("sha256").update(t).digest(),i=0,a=!1,d=new Set,p=()=>lt(i),m=()=>yn(i),b=(c,u,g)=>{let h=JSON.stringify({generation:e.database.generation(),...g});c.writeHead(u,{...G(),"Content-Type":"application/json; charset=utf-8","Content-Length":Buffer.byteLength(h)}),c.end(h)},M=(c,u)=>{c.writeHead(200,{...G(),"Content-Type":u.contentType,"Content-Length":u.body.byteLength,...u.contentType.startsWith("text/html")?{"Content-Security-Policy":pn}:{}}),c.end(u.body)},y=(c,u,g,h={})=>{c.writeHead(u,{...G(),"Content-Type":"text/plain; charset=utf-8","Content-Length":Buffer.byteLength(g),...h}),c.end(g)},R=(c,u,g)=>{let h=hn.get(u);if(!h){b(c,404,{error:"Not found."});return}let v=h(e.database.acquire(),g,e.routes);b(c,v.status,v.body)},x=(c,u)=>{if(u==="/"){let v=n.get("index.html");v?M(c,v):y(c,404,"Not found.");return}if(u==="/favicon.ico"){c.writeHead(204,G()),c.end();return}if(u==="/vendor/cytoscape.mjs"&&r){M(c,r);return}let g=u.startsWith("/assets/")?u.slice(8):void 0,h=g===void 0?void 0:n.get(g);h?M(c,h):y(c,404,"Not found.")},E=async(c,u)=>{let g=c.headers.origin;if(g!==void 0&&!m().has(g)){b(u,403,{error:"Origin is not allowed."});return}if(!wn(c.headers["content-type"])){b(u,415,{error:"Content-Type must be application/json."});return}if(!Sn(o,c.headers[cn])){b(u,403,{error:"The viewer token is missing or wrong; reload the page."});return}let h=e.builder;if(!h){b(u,501,{error:"The symbol builder is not available in this viewer."});return}if(a){b(u,409,{error:"A builder query is already running."});return}a=!0;try{let v=await vn(c,ot);if(v===void 0){b(u,400,{error:`The request body must be at most ${ot/1024} KiB.`});return}let V=Rn(v);if(!V.ok){b(u,400,{error:V.error});return}await P(u,h,V.request,V.diagnostics)}finally{a=!1}},P=async(c,u,g,h)=>{let v=new AbortController;d.add(v);let V=()=>{c.writableEnded||v.abort(new Error("The client disconnected."))};c.on("close",V);let W;try{let $=await new Promise(J=>{W=setTimeout(()=>{v.abort(new Error("The builder query timed out.")),J({kind:"timeout"})},s),u(g,v.signal).then(K=>J({kind:"done",response:K}),K=>J({kind:"failed",error:K}))});if(c.destroyed)return;$.kind==="timeout"?b(c,504,{error:`The builder query took longer than ${Math.round(s/1e3)} s.`}):$.kind==="failed"?b(c,502,{error:re($.error)}):b(c,200,{...$.response,...h.length>0?{probeDiagnostics:h}:{}})}finally{W&&clearTimeout(W),c.off("close",V),d.delete(v)}},S=async(c,u)=>{if(!p().has((c.headers.host??"").toLowerCase())){y(u,403,"Forbidden host.");return}let g;try{g=new URL(c.url??"/",`http://${_}`)}catch{y(u,400,"Bad request.");return}let h=c.method??"GET";if(g.pathname==="/api/builder"){h==="POST"?await E(c,u):b(u,405,{error:"Use POST."});return}if(h!=="GET"&&h!=="HEAD"){y(u,405,"Method not allowed.",{Allow:"GET, HEAD"});return}g.pathname.startsWith("/api/")?R(u,g.pathname,g.searchParams):x(u,g.pathname)},l=tn((c,u)=>{S(c,u).catch(g=>{if(u.headersSent){u.destroy();return}b(u,500,{error:re(g)})})});await new Promise((c,u)=>{l.once("error",u),l.listen({host:_,port:e.port??0},()=>{l.off("error",u),c()})}),l.on("error",c=>{process.stderr.write(`codebaseiq view: server error: ${re(c)}
5
5
  `)});let f=l.address();i=typeof f=="object"&&f?f.port:0;let w=`http://${_}:${i}`;return{port:i,origin:w,url:`${w}/`,token:t,close(){for(let c of d)c.abort(new Error("The viewer is shutting down."));return new Promise(c=>{l.close(()=>c()),l.closeAllConnections()})}}}var hn=new Map([["/api/meta",(e,t,n)=>Ye(e,n)],["/api/scope",ze],["/api/file",Xe],["/api/symbol",Qe],["/api/source",Ze]]);function lt(e){let t=new Set([`${_}:${e}`,`localhost:${e}`]);return e===sn&&(t.add(_),t.add("localhost")),t}function yn(e){return new Set([...lt(e)].map(t=>`http://${t}`))}function G(){return{"Cache-Control":"no-store","X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer"}}function wn(e){return e!==void 0&&e.split(";")[0].trim().toLowerCase()==="application/json"}function Sn(e,t){return typeof t!="string"||t===""?!1:en(ct("sha256").update(t).digest(),e)}function vn(e,t){return new Promise((n,r)=>{let s=[],o=0,i=!1;e.on("data",a=>{o+=a.byteLength,o>t?(i=!0,s.length=0):i||s.push(a)}),e.on("end",()=>n(i?void 0:Buffer.concat(s).toString("utf8"))),e.on("error",r)})}function Rn(e){let t;try{t=JSON.parse(e)}catch{return{ok:!1,error:"The request body must be valid JSON."}}if(typeof t!="object"||t===null||Array.isArray(t))return{ok:!1,error:"The request body must be a JSON object."};let n=t,r={},s=[];if(n.description!==void 0){if(typeof n.description!="string")return{ok:!1,error:"description must be a string."};n.description.trim()!==""&&(r.description=n.description)}if(n.probes!==void 0){let o=me(n.probes);s=o.diagnostics,(pe(o.probes)||o.probes.kinds.length>0)&&(r.probes=o.probes)}if(n.mode!==void 0){if(typeof n.mode!="string"||!I.includes(n.mode))return{ok:!1,error:`mode must be one of ${I.join(", ")}.`};r.mode=n.mode}if(n.bucket!==void 0){if(typeof n.bucket!="string"||!it.includes(n.bucket))return{ok:!1,error:`bucket must be one of ${it.join(", ")}.`};r.bucket=n.bucket}if(n.limit!==void 0){let o=n.limit;if(typeof o!="number"||!Number.isInteger(o)||o<1||o>st)return{ok:!1,error:`limit must be an integer from 1 to ${st}.`};r.limit=o}return r.description===void 0&&r.probes===void 0?{ok:!1,error:"Give a description or at least one probe."}:{ok:!0,request:r,diagnostics:s}}function re(e){return e instanceof Error?e.message:String(e)}var kn="view-server.json",ft="127.0.0.1",Ln=1e3,Dn=5e3,Pn=2e3,gt={isProcessAlive:se,canConnect(e,t){return new Promise(n=>{let r=xn({host:ft,port:e}),s=o=>{r.destroy(),n(o)};r.setTimeout(t,()=>s(!1)),r.once("connect",()=>s(!0)),r.once("error",()=>s(!1))})},async fetchProjectRoot(e,t){try{let n=await fetch(`http://${ft}:${e}/api/meta`,{signal:AbortSignal.timeout(t)});if(!n.ok)return{kind:"answered",projectRoot:void 0};let r=await n.json();return{kind:"answered",projectRoot:typeof r.projectRoot=="string"?r.projectRoot:void 0}}catch{return{kind:"unanswered"}}}};function pt(e,t){let n=new URL(e);return t.focus!==void 0?n.searchParams.set("focus",t.focus):t.file!==void 0?n.searchParams.set("file",t.file):t.scope!==void 0&&n.searchParams.set("scope",t.scope),n.toString()}async function bt(e,t,n=gt){let r=ht(e);if(!r||!n.isProcessAlive(r.pid)||!await n.canConnect(r.port,Ln))return;let s=await n.fetchProjectRoot(r.port,Dn);if(s.kind==="unanswered")return r;let o=s.projectRoot;if(!(o===void 0||Y(dt(o))!==Y(dt(t))))return r}async function Vn(e,t,n=gt){let r=await bt(e,t.projectRoot,n);if(r&&r.pid!==t.pid)return process.stderr.write(`warning: a viewer (pid ${r.pid}, ${r.url}) is already recorded for this project, so this one is not.
@@ -9,4 +9,4 @@ import{a as ke}from"./chunk-T55YPJGB.js";import{a as Me,b as Fe}from"./chunk-FQA
9
9
  `)}function Cn(e,t){return e?.code==="EADDRINUSE"&&t?new Error(`Port ${t} is already in use; choose another with --port.`):e instanceof Error?e:new Error(String(e))}function Nn(e,t){try{let n=ge(e.projectRoot,e.config),r=Fe({settings:n,storeRoot:Me(e.paths.cacheDir),languages:Bn(t.acquire()),openDb:()=>t.acquire(),env:Tn(process.env)});return{run:(s,o)=>r.query(s,{signal:o}),defaultMode:n.mode,close:()=>r.close()}}catch(n){return process.stderr.write(`codebaseiq view: the symbol builder is unavailable: ${yt(n)}
10
10
  `),{defaultMode:"agent",close:()=>{}}}}function Tn(e){return Object.fromEntries(Object.entries(e).filter(([t])=>t!=="CLAUDECODE"&&!t.startsWith("CODEX_")))}function Bn(e){let t=e.generation.metadataRaw;return(t?le(ue(t))?.indexedLanguages:void 0)??[]}function In(e,t,n){let r;return()=>{let s=Date.now();if(r&&s-r.at<Pn)return r.value;let o;try{let{classification:i}=xe({projectRoot:e,cacheDir:t.paths.cacheDir,cliVersion:z,...n?{gitContext:n}:{}});o=i.kind==="live"?i.state.watcher.state:i.kind}catch{o="unknown"}return r={at:s,value:o},o}}function jn(){let e=new WeakMap;return{normalizeMapScope:j,codeMapScope:De,nearestMapScope:Pe,codeMapFile:Ve,isIndexedFile(t,n){let r=e.get(t);return r||(r=new Set(O(t,{includeIgnored:!1})),e.set(t,r)),r.has(n)},outline:Re,fileSymbolFacts(t,n){let r=new Map;for(let s of we(t,n))r.set(s.symbol,{kind:s.kind===null?null:An(s.kind),documentation:s.documentation});return r},resolveFocus:_e,symbolFocusLanes:$e,code:Z,fileIsStale(t,n){return Z(t,`${n}:1-1`)?.freshness?.semantic.state==="stale"}}}function An(e){let t=ve(e).toLowerCase();return t==="unknown"||t==="unspecifiedkind"?null:t}function _n(e){let t=()=>{let s=ht(e.stateFile);s?.pid===e.state.pid&&s.startedAt===e.state.startedAt&&En(e.stateFile,{force:!0})},n=!1,r=()=>{n||(n=!0,e.server.close().finally(()=>{e.builder.close(),e.database.close(),t(),console.log(`
11
11
  Stopped.`),process.exit(0)}))};process.on("SIGINT",r),process.on("SIGTERM",r),process.on("exit",t)}function yt(e){return e instanceof Error?e.message:String(e)}export{kn as VIEW_STATE_FILE,jn as createViewerQueries,bt as findRunningViewer,ht as readViewerState,Vn as recordRunningViewer,jr as runCodeViewer,Tn as viewerBuilderEnvironment,pt as viewerDeepLink};
12
- //# sourceMappingURL=code-viewer-YGDON6SY.js.map
12
+ //# sourceMappingURL=code-viewer-KIXEYQNJ.js.map
@@ -1,4 +1,4 @@
1
- import{a as Me,b as Fe}from"./chunk-M4EVGA5S.js";import"./chunk-ILMHV3KM.js";import"./chunk-IGYAZPRX.js";import{a as ke}from"./chunk-L3YSDLNB.js";import{l as ve}from"./chunk-TAJ6UGCO.js";import{D as ee,T as xe,a as Re,n as Ee,o as Z}from"./chunk-BLKYYQ7C.js";import"./chunk-ZZ3MWF33.js";import{d as X,r as ge}from"./chunk-IGQQUENU.js";import"./chunk-YUKYB54I.js";import"./chunk-HCMQZPEO.js";import"./chunk-P5XHIJHI.js";import"./chunk-H5QXP63L.js";import"./chunk-2Q2LW5JW.js";import"./chunk-EXMVF3JR.js";import"./chunk-5IO2APSS.js";import"./chunk-3AC56WAR.js";import{H as me}from"./chunk-M7LAIM77.js";import"./chunk-FWY2PRIF.js";import{c as q,d as C,e as U}from"./chunk-DRENNWRG.js";import"./chunk-SV2LEFVM.js";import{N as ye,a as I,b as be,c as he,da as we,ga as Q,ma as Se}from"./chunk-WJOQC4P7.js";import"./chunk-IYBIBMPF.js";import{d as ae,e as ce,n as fe}from"./chunk-XYLV727H.js";import{e as O,g as pe}from"./chunk-4NHWNAWQ.js";import"./chunk-2VKB5CMA.js";import{j as ue,r as de}from"./chunk-ACZDU5GK.js";import"./chunk-R2NOK63J.js";import"./chunk-6URCE5QY.js";import{G as Y,T as le,Y as z,a as oe,f as se,h as ie}from"./chunk-4O52YNKL.js";import{rmSync as En}from"fs";import{createConnection as xn}from"net";import{basename as Mn,join as Fn,resolve as dt}from"path";import{spawn as wt}from"child_process";var St=/^https?:\/\//iu,vt=2e3;function Le(e,t={}){let n=t.platform??process.platform,r=t.env??process.env;if(!St.test(e))return Promise.resolve({launched:!1});if(Et(r.CI))return Promise.resolve({launched:!1});if(n!=="win32"&&n!=="darwin"&&!r.DISPLAY&&!r.WAYLAND_DISPLAY)return Promise.resolve({launched:!1});let{command:s,args:o}=Rt(n,e);return new Promise(i=>{let a;try{a=(t.spawn??wt)(s,o,{detached:!0,stdio:"ignore",windowsHide:!0})}catch{i({launched:!1});return}let d=m=>{clearTimeout(p),i({launched:m})},p=setTimeout(()=>d(!0),vt);a.once("spawn",()=>d(!0)),a.on("error",()=>d(!1)),a.unref()})}function Rt(e,t){return e==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",t]}:e==="darwin"?{command:"open",args:[t]}:{command:"xdg-open",args:[t]}}function Et(e){return e!==void 0&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}var xt=5;function j(e){let t=e.trim().replace(/\\/g,"/");for(;t.startsWith("./");)t=t.slice(2);return t=t.replace(/^\/+/,"").replace(/\/+$/,""),t==="."?"":t}function Mt(e,t,n,r){let s=j(n),o=s?`${s}/`:"",i=[...new Set(e)].filter(l=>l.startsWith(o)).sort(F);if(i.length===0)return null;let a=new Set(i),d=new Map;for(let l of i){let f=l.slice(o.length),w=f.indexOf("/"),c=w<0?l:`${o}${f.slice(0,w)}`,u=d.get(c)??{kind:w<0?"file":"dir",files:[]};u.files.push(l),d.set(c,u)}let p=new Map,m=[];for(let[l,f]of d){let w=f.kind==="dir"?Ft(f.files):l;for(let c of f.files)p.set(c,w);m.push({id:w,kind:f.kind,name:f.kind==="dir"?w.slice(o.length):l.slice(o.length),path:w,files:f.files.length,internalEdges:0,cycle:null})}m.sort((l,f)=>(l.kind===f.kind?0:l.kind==="dir"?-1:1)||F(l.name,f.name));let b=new Map(m.map(l=>[l.id,l])),M=s?s.split("/"):[],y=new Map,R=new Map,x=0,E=(l,f,w)=>{x+=1;let c=`${l}\0${f}`,u=y.get(c)??{from:l,to:f,count:0,cycle:!1,samples:[]};u.count+=1,u.samples.length<xt&&u.samples.push(w),y.set(c,u)},P=l=>{let f=kt(M,l);return R.has(f)||R.set(f,{id:f,kind:"external",path:f}),f};for(let l of[...t.keys()].sort(F)){let f=a.has(l);for(let w of[...t.get(l)].sort(F)){let c=a.has(w);if(!f&&!c||!f&&l.startsWith(o)||!c&&w.startsWith(o))continue;let u={from:l,to:w};if(f&&c){let g=p.get(l),h=p.get(w);g===h?(x+=1,b.get(g).internalEdges+=1):E(g,h,u)}else f?E(p.get(l),P(w),u):E(P(l),p.get(w),u)}}let S=Lt(m,y);for(let l of m)l.cycle=S.get(l.id)??null;for(let l of y.values()){let f=S.get(l.from);l.cycle=f!==void 0&&f===S.get(l.to)}return{scope:s,basis:r,breadcrumbs:Dt(M),nodes:m,external:[...R.values()].sort((l,f)=>F(l.path,f.path)),edges:[...y.values()].sort((l,f)=>F(l.from,f.from)||F(l.to,f.to)),totals:{files:i.length,edges:x}}}function De(e,t){return Mt(O(e,{includeIgnored:!1}),Oe(e,t.basis),t.scope,t.basis)}function Pe(e,t){let n=O(e,{includeIgnored:!1}),r=j(t);for(;r;){let s=`${r}/`;if(n.some(i=>i.startsWith(s)))return r;let o=r.lastIndexOf("/");r=o<0?"":r.slice(0,o)}return""}function Ve(e,t,n){let r=j(t);if(!O(e,{includeIgnored:!1}).includes(r))return null;let s=Oe(e,n),o=[];for(let[i,a]of s)a.has(r)&&o.push(i);return{file:r,dependsOn:[...s.get(r)??[]].sort(F),dependedOnBy:o.sort(F)}}function Oe(e,t){return t==="imports"?X(e,void 0,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}):X(e)}function Ft(e){let t=e.map(r=>r.split("/").slice(0,-1)),n=[...t[0]];for(let r of t){let s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s+=1;n.length=s}return n.join("/")}function kt(e,t){let n=t.split("/"),r=0;for(;r<e.length&&r<n.length&&e[r]===n[r];)r+=1;return n.slice(0,r+1).join("/")}function Lt(e,t){let n=new Map(e.map(o=>[o.id,new Set]));for(let o of t.values())n.has(o.from)&&n.has(o.to)&&n.get(o.from).add(o.to);let r=xe(n).components.filter(o=>o.length>1).map(o=>[...o].sort(F)).sort((o,i)=>F(o[0],i[0])),s=new Map;return r.forEach((o,i)=>{for(let a of o)s.set(a,i+1)}),s}function Dt(e){return[{name:"root",path:""},...e.map((t,n)=>({name:t,path:e.slice(0,n+1).join("/")}))]}function F(e,t){return e<t?-1:e>t?1:0}var Ce=["callers","callees","contracts","data","state","runtime"],Pt={families:["execution","identity","contract","dataflow","state","runtime"],subtypes:["call","result-callback","references","uses-contract-symbol","argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result","reads-resource","writes-resource","deletes-resource","enqueues-resource","consumes-resource","runtime-handoff","discriminator-dispatch"],direction:"both",maxDepth:1,maxEdges:2e3},Ne={exact:0,derived:1,mixed:2,candidate:3,unknown:4},N="root",Vt=new Set(["source-construct","runtime-boundary-participant","call-result","argument-expression","static-value"]);function _e(e,t){let n=t.trim();if(!n)return{status:"missing"};let r=ge(e,n),s=r.match;if(!s)return{status:"missing"};let o=new Map,i=(a,d,p)=>{o.has(a)||o.set(a,{symbol:a,name:q(a),file:d,line:p})};i(s.symbol,s.relativePath,s.startLine);for(let a of r.candidates)i(a.symbol,a.relativePath,a.startLine);return o.size===1&&At(n,s)?{status:"matched",symbol:s.symbol}:{status:"ambiguous",candidates:[...o.values()],total:r.total}}function $e(e,t,n={}){let r=ee(e,{symbols:[t]},Pt),s=r.targets[0]?.nodeIds[0],o=s?Bt(r,s):null,i=s&&o?qe(r,s,It(o)):Tt(r);if(!n.statements)return i;let a=ee(e,{symbols:[t]},{view:"complete",maxDepth:1,maxEdges:400});return{...i,statements:{inventory:a.inventory??[],edges:a.edges.map(jt)}}}function qe(e,t,n){let r=new Map(Ce.map(i=>[i,new Map])),s=[];for(let i of e.edges){let a=Te(i.from,t,n),d=Te(i.to,t,n);if(!a||!d)continue;let p,m;if(a===N&&d!==N)p=!1,m=d;else if(d===N&&a!==N)p=!0,m=a;else continue;if(i.family==="identity"){p&&i.subtype==="references"&&s.push({target:m,edge:i});continue}let b=Ot(i,p);b&&je(r.get(b),m,i,!1)}let o=r.get("callers");for(let{target:i,edge:a}of s){let d=o.get(i.key);(!d||d.reference)&&je(o,i,a,!0)}return{lanes:Object.fromEntries(Ce.map(i=>[i,Nt(r.get(i))])),coverage:{status:e.coverage.status,omittedEdges:e.coverage.omittedEdges}}}function Ot(e,t){let{family:n,subtype:r}=e;return n==="execution"&&(r==="call"||r==="result-callback")?t?"callers":"callees":n==="contract"&&r==="uses-contract-symbol"?t?null:"contracts":n==="dataflow"&&(r.endsWith("-to-parameter")||r==="return-to-call-result")?"data":n==="state"?"state":n==="runtime"?"runtime":null}function Te(e,t,n){if(e.id===t)return N;if(e.kind==="symbol"&&e.symbol)return Be(e.symbol,e.label,e);if(e.kind==="structural-region")return{key:`region:${e.id}`,kind:"region",label:e.label};if(e.kind==="program-resource"||e.kind==="runtime-state-resource")return{key:`resource:${e.id}`,kind:"resource",label:e.label,...te(e),...e.kind==="program-resource"&&Ie(e,n)?{local:!0}:{}};if(Ie(e,n))return N;if(e.location&&Vt.has(e.kind))return{key:`location:${e.id}`,kind:"location",label:e.label,...te(e)};let r=Ct(e);return r?Be(r,q(r),e):null}function Be(e,t,n){return{key:`symbol:${e}`,kind:"symbol",label:t,symbol:e,...te(n)}}function te(e){return e.location?{file:e.location.file,line:e.location.line}:{}}function Ie(e,t){return e.location!==null&&e.location.file===t.file&&e.location.line>=t.startLine&&e.location.line<=t.endLine}function Ct(e){if(e.kind!=="parameter")return null;let[t,n]=e.id.split(":");return t==="parameter"&&n?decodeURIComponent(n):null}function je(e,t,n,r){let s=e.get(t.key);if(!s){e.set(t.key,{kind:t.kind,label:t.label,...t.symbol?{symbol:t.symbol}:{},...t.file!==void 0?{file:t.file,line:t.line}:{},subtypes:[n.subtype],count:1,strength:n.evidenceStrength,...t.local?{local:!0}:{},...r?{reference:!0}:{}});return}s.count+=1,s.subtypes.includes(n.subtype)||s.subtypes.push(n.subtype),Ne[n.evidenceStrength]<Ne[s.strength]&&(s.strength=n.evidenceStrength)}function Nt(e){return[...e.values()].map(t=>({...t,subtypes:[...t.subtypes].sort()})).sort((t,n)=>Ae(t.label,n.label)||Ae(t.file??"",n.file??"")||(t.line??0)-(n.line??0))}function Tt(e){return qe({...e,edges:[]},"",{file:"",startLine:0,endLine:-1})}function Bt(e,t){for(let n of e.edges){if(n.from.id===t)return n.from;if(n.to.id===t)return n.to}return null}function It(e){return e.location?{file:e.location.file,startLine:e.location.line,endLine:e.location.endLine??e.location.line}:{file:"",startLine:0,endLine:-1}}function jt(e){return{id:e.id,family:e.family,subtype:e.subtype,from:e.from,to:e.to,strength:e.evidenceStrength,methods:e.evidenceMethods}}function At(e,t){if(e===t.symbol)return!0;let n=e.replace(/\\/g,"/").replace(/\(\)$/u,""),r=C(t.symbol);if(n===q(t.symbol).replace(/\(\)$/u,"")||n===r)return!0;let s=e.match(/^(.+):(\d+)(?:-(\d+))?$/);if(s){let i=pe(s[1]);return t.relativePath===i||t.relativePath.endsWith(`/${i}`)}let o=n.lastIndexOf("/");return o>0&&n.slice(o+1)===r&&t.relativePath.toLowerCase().includes(n.slice(0,o).toLowerCase())}function Ae(e,t){return e<t?-1:e>t?1:0}function Ue(e){let t=e.published??fe,n=e.open(),r=null,s=o=>{try{o.close()}catch{}};return{acquire(){if(!n)throw new Error("The viewer database is closed.");let o=t(e.dbPath);if(o!==null&&o!==n.generation.identity&&o!==r)try{let i=e.open();s(n),n=i,r=o}catch{}return n},generation(){return n?.generation.identity??null},close(){let o=n;n=void 0,o&&s(o)}}}import{posix as Ge,resolve as _t}from"path";var He=400,We=2e3,$t=["callers","callees","contracts","data","state","runtime"],qt=4096,Ut=/:\d+(?:-\d+)?$/u,Gt=/^\s*```[^\n]*\n[\s\S]*?```[^\S\n]*(?:\n|$)/u;function Ye(e,t){return{status:200,body:{projectRoot:t.projectRoot,projectName:t.meta.projectName,cliVersion:t.meta.cliVersion,generation:D(e),watcher:{state:t.meta.watcherState()},builder:{available:t.meta.builder.available,modes:[...I],defaultMode:t.meta.builder.defaultMode}}}}function ze(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path")??"",o=B(s);if(o===null)return L(e,`Path is outside the project: ${T(s)}`,{nearest:""});let i=n.queries.normalizeMapScope(o),a=n.queries.codeMapScope(e,{scope:i,basis:r});return a?{status:200,body:{...a,generation:D(e)}}:L(e,`No indexed files under "${i}".`,{nearest:n.queries.nearestMapScope(e,i)})}function Xe(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path");if(!s)return k(e,"path is required.");let o=B(s);if(o===null||o===""||!n.queries.isIndexedFile(e,o))return L(e,`No indexed file at "${T(s)}".`);let i=n.queries.codeMapFile(e,o,r);return{status:200,body:{file:o,breadcrumbs:Yt(o),editorUri:ne(n.projectRoot,o,1),outline:tt(e,o,n),dependsOn:i?.dependsOn??[],dependedOnBy:i?.dependedOnBy??[],stale:n.queries.fileIsStale(e,o),generation:D(e)}}}function Qe(e,t,n){let r=t.get("symbol"),s=t.get("focus"),o=r||s;if(!o)return k(e,"symbol or focus is required.");if(o.length>qt)return k(e,"The selector is too long.");let i=r||"";if(!r){let S=n.queries.resolveFocus(e,o);if(S.status==="ambiguous")return{status:200,body:{status:"ambiguous",candidates:S.candidates.map(l=>({symbol:l.symbol,name:l.name,file:l.file,line:l.line+1})),total:S.total,generation:D(e)}};if(S.status==="missing")return L(e,`No symbol matches "${T(o)}".`);i=S.symbol}let a=Ut.test(i)?null:n.queries.code(e,i);if(!a||a.symbol!==i||a.symbol===a.relativePath||!n.queries.isIndexedFile(e,a.relativePath))return L(e,`No indexed definition for "${T(i)}".`);let d=a.relativePath,p=nt(tt(e,d,n),i),m=n.queries.fileSymbolFacts(e,d);if(!p&&!m.has(i))return L(e,`No indexed definition for "${T(i)}".`);let b=m.get(i),M=t.get("statements")==="1",y=n.queries.symbolFocusLanes(e,i,M?{statements:!0}:void 0),R=a.startLine+1,x=a.source.split(`
1
+ import{a as Me,b as Fe}from"./chunk-RJVAPMHF.js";import"./chunk-ILMHV3KM.js";import"./chunk-XN3EKMLI.js";import{a as ke}from"./chunk-DVWO7RBC.js";import{l as ve}from"./chunk-GWYZVVKY.js";import{D as ee,T as xe,a as Re,n as Ee,o as Z}from"./chunk-LONKINMJ.js";import"./chunk-ZZ3MWF33.js";import{a as X,o as ge}from"./chunk-6WAPPQ5F.js";import"./chunk-YUKYB54I.js";import"./chunk-DDN2F6GB.js";import"./chunk-P5XHIJHI.js";import"./chunk-EQNMD62X.js";import"./chunk-2PRONPAS.js";import"./chunk-P4NVCOM7.js";import"./chunk-CIYA2KZN.js";import{H as me}from"./chunk-C6WKPKCF.js";import"./chunk-XQAVQVIL.js";import{c as q,d as C,e as U}from"./chunk-DRENNWRG.js";import"./chunk-SV2LEFVM.js";import{N as ye,a as I,b as be,c as he,da as we,ga as Q,ma as Se}from"./chunk-MEUHIDI3.js";import"./chunk-5FWR5HLG.js";import{d as ae,e as ce,n as fe}from"./chunk-T75DS2E6.js";import{e as O,g as pe}from"./chunk-YT4DVWUV.js";import"./chunk-RCIGX23V.js";import{j as ue,r as de}from"./chunk-D7DOB27N.js";import"./chunk-R2NOK63J.js";import"./chunk-6O3KXIDL.js";import{G as Y,T as le,Y as z,a as oe,f as se,h as ie}from"./chunk-UQYQBLJX.js";import{rmSync as En}from"fs";import{createConnection as xn}from"net";import{basename as Mn,join as Fn,resolve as dt}from"path";import{spawn as wt}from"child_process";var St=/^https?:\/\//iu,vt=2e3;function Le(e,t={}){let n=t.platform??process.platform,r=t.env??process.env;if(!St.test(e))return Promise.resolve({launched:!1});if(Et(r.CI))return Promise.resolve({launched:!1});if(n!=="win32"&&n!=="darwin"&&!r.DISPLAY&&!r.WAYLAND_DISPLAY)return Promise.resolve({launched:!1});let{command:s,args:o}=Rt(n,e);return new Promise(i=>{let a;try{a=(t.spawn??wt)(s,o,{detached:!0,stdio:"ignore",windowsHide:!0})}catch{i({launched:!1});return}let d=m=>{clearTimeout(p),i({launched:m})},p=setTimeout(()=>d(!0),vt);a.once("spawn",()=>d(!0)),a.on("error",()=>d(!1)),a.unref()})}function Rt(e,t){return e==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",t]}:e==="darwin"?{command:"open",args:[t]}:{command:"xdg-open",args:[t]}}function Et(e){return e!==void 0&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}var xt=5;function j(e){let t=e.trim().replace(/\\/g,"/");for(;t.startsWith("./");)t=t.slice(2);return t=t.replace(/^\/+/,"").replace(/\/+$/,""),t==="."?"":t}function Mt(e,t,n,r){let s=j(n),o=s?`${s}/`:"",i=[...new Set(e)].filter(l=>l.startsWith(o)).sort(F);if(i.length===0)return null;let a=new Set(i),d=new Map;for(let l of i){let f=l.slice(o.length),w=f.indexOf("/"),c=w<0?l:`${o}${f.slice(0,w)}`,u=d.get(c)??{kind:w<0?"file":"dir",files:[]};u.files.push(l),d.set(c,u)}let p=new Map,m=[];for(let[l,f]of d){let w=f.kind==="dir"?Ft(f.files):l;for(let c of f.files)p.set(c,w);m.push({id:w,kind:f.kind,name:f.kind==="dir"?w.slice(o.length):l.slice(o.length),path:w,files:f.files.length,internalEdges:0,cycle:null})}m.sort((l,f)=>(l.kind===f.kind?0:l.kind==="dir"?-1:1)||F(l.name,f.name));let b=new Map(m.map(l=>[l.id,l])),M=s?s.split("/"):[],y=new Map,R=new Map,x=0,E=(l,f,w)=>{x+=1;let c=`${l}\0${f}`,u=y.get(c)??{from:l,to:f,count:0,cycle:!1,samples:[]};u.count+=1,u.samples.length<xt&&u.samples.push(w),y.set(c,u)},P=l=>{let f=kt(M,l);return R.has(f)||R.set(f,{id:f,kind:"external",path:f}),f};for(let l of[...t.keys()].sort(F)){let f=a.has(l);for(let w of[...t.get(l)].sort(F)){let c=a.has(w);if(!f&&!c||!f&&l.startsWith(o)||!c&&w.startsWith(o))continue;let u={from:l,to:w};if(f&&c){let g=p.get(l),h=p.get(w);g===h?(x+=1,b.get(g).internalEdges+=1):E(g,h,u)}else f?E(p.get(l),P(w),u):E(P(l),p.get(w),u)}}let S=Lt(m,y);for(let l of m)l.cycle=S.get(l.id)??null;for(let l of y.values()){let f=S.get(l.from);l.cycle=f!==void 0&&f===S.get(l.to)}return{scope:s,basis:r,breadcrumbs:Dt(M),nodes:m,external:[...R.values()].sort((l,f)=>F(l.path,f.path)),edges:[...y.values()].sort((l,f)=>F(l.from,f.from)||F(l.to,f.to)),totals:{files:i.length,edges:x}}}function De(e,t){return Mt(O(e,{includeIgnored:!1}),Oe(e,t.basis),t.scope,t.basis)}function Pe(e,t){let n=O(e,{includeIgnored:!1}),r=j(t);for(;r;){let s=`${r}/`;if(n.some(i=>i.startsWith(s)))return r;let o=r.lastIndexOf("/");r=o<0?"":r.slice(0,o)}return""}function Ve(e,t,n){let r=j(t);if(!O(e,{includeIgnored:!1}).includes(r))return null;let s=Oe(e,n),o=[];for(let[i,a]of s)a.has(r)&&o.push(i);return{file:r,dependsOn:[...s.get(r)??[]].sort(F),dependedOnBy:o.sort(F)}}function Oe(e,t){return t==="imports"?X(e,void 0,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}):X(e)}function Ft(e){let t=e.map(r=>r.split("/").slice(0,-1)),n=[...t[0]];for(let r of t){let s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s+=1;n.length=s}return n.join("/")}function kt(e,t){let n=t.split("/"),r=0;for(;r<e.length&&r<n.length&&e[r]===n[r];)r+=1;return n.slice(0,r+1).join("/")}function Lt(e,t){let n=new Map(e.map(o=>[o.id,new Set]));for(let o of t.values())n.has(o.from)&&n.has(o.to)&&n.get(o.from).add(o.to);let r=xe(n).components.filter(o=>o.length>1).map(o=>[...o].sort(F)).sort((o,i)=>F(o[0],i[0])),s=new Map;return r.forEach((o,i)=>{for(let a of o)s.set(a,i+1)}),s}function Dt(e){return[{name:"root",path:""},...e.map((t,n)=>({name:t,path:e.slice(0,n+1).join("/")}))]}function F(e,t){return e<t?-1:e>t?1:0}var Ce=["callers","callees","contracts","data","state","runtime"],Pt={families:["execution","identity","contract","dataflow","state","runtime"],subtypes:["call","result-callback","references","uses-contract-symbol","argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result","reads-resource","writes-resource","deletes-resource","enqueues-resource","consumes-resource","runtime-handoff","discriminator-dispatch"],direction:"both",maxDepth:1,maxEdges:2e3},Ne={exact:0,derived:1,mixed:2,candidate:3,unknown:4},N="root",Vt=new Set(["source-construct","runtime-boundary-participant","call-result","argument-expression","static-value"]);function _e(e,t){let n=t.trim();if(!n)return{status:"missing"};let r=ge(e,n),s=r.match;if(!s)return{status:"missing"};let o=new Map,i=(a,d,p)=>{o.has(a)||o.set(a,{symbol:a,name:q(a),file:d,line:p})};i(s.symbol,s.relativePath,s.startLine);for(let a of r.candidates)i(a.symbol,a.relativePath,a.startLine);return o.size===1&&At(n,s)?{status:"matched",symbol:s.symbol}:{status:"ambiguous",candidates:[...o.values()],total:r.total}}function $e(e,t,n={}){let r=ee(e,{symbols:[t]},Pt),s=r.targets[0]?.nodeIds[0],o=s?Bt(r,s):null,i=s&&o?qe(r,s,It(o)):Tt(r);if(!n.statements)return i;let a=ee(e,{symbols:[t]},{view:"complete",maxDepth:1,maxEdges:400});return{...i,statements:{inventory:a.inventory??[],edges:a.edges.map(jt)}}}function qe(e,t,n){let r=new Map(Ce.map(i=>[i,new Map])),s=[];for(let i of e.edges){let a=Te(i.from,t,n),d=Te(i.to,t,n);if(!a||!d)continue;let p,m;if(a===N&&d!==N)p=!1,m=d;else if(d===N&&a!==N)p=!0,m=a;else continue;if(i.family==="identity"){p&&i.subtype==="references"&&s.push({target:m,edge:i});continue}let b=Ot(i,p);b&&je(r.get(b),m,i,!1)}let o=r.get("callers");for(let{target:i,edge:a}of s){let d=o.get(i.key);(!d||d.reference)&&je(o,i,a,!0)}return{lanes:Object.fromEntries(Ce.map(i=>[i,Nt(r.get(i))])),coverage:{status:e.coverage.status,omittedEdges:e.coverage.omittedEdges}}}function Ot(e,t){let{family:n,subtype:r}=e;return n==="execution"&&(r==="call"||r==="result-callback")?t?"callers":"callees":n==="contract"&&r==="uses-contract-symbol"?t?null:"contracts":n==="dataflow"&&(r.endsWith("-to-parameter")||r==="return-to-call-result")?"data":n==="state"?"state":n==="runtime"?"runtime":null}function Te(e,t,n){if(e.id===t)return N;if(e.kind==="symbol"&&e.symbol)return Be(e.symbol,e.label,e);if(e.kind==="structural-region")return{key:`region:${e.id}`,kind:"region",label:e.label};if(e.kind==="program-resource"||e.kind==="runtime-state-resource")return{key:`resource:${e.id}`,kind:"resource",label:e.label,...te(e),...e.kind==="program-resource"&&Ie(e,n)?{local:!0}:{}};if(Ie(e,n))return N;if(e.location&&Vt.has(e.kind))return{key:`location:${e.id}`,kind:"location",label:e.label,...te(e)};let r=Ct(e);return r?Be(r,q(r),e):null}function Be(e,t,n){return{key:`symbol:${e}`,kind:"symbol",label:t,symbol:e,...te(n)}}function te(e){return e.location?{file:e.location.file,line:e.location.line}:{}}function Ie(e,t){return e.location!==null&&e.location.file===t.file&&e.location.line>=t.startLine&&e.location.line<=t.endLine}function Ct(e){if(e.kind!=="parameter")return null;let[t,n]=e.id.split(":");return t==="parameter"&&n?decodeURIComponent(n):null}function je(e,t,n,r){let s=e.get(t.key);if(!s){e.set(t.key,{kind:t.kind,label:t.label,...t.symbol?{symbol:t.symbol}:{},...t.file!==void 0?{file:t.file,line:t.line}:{},subtypes:[n.subtype],count:1,strength:n.evidenceStrength,...t.local?{local:!0}:{},...r?{reference:!0}:{}});return}s.count+=1,s.subtypes.includes(n.subtype)||s.subtypes.push(n.subtype),Ne[n.evidenceStrength]<Ne[s.strength]&&(s.strength=n.evidenceStrength)}function Nt(e){return[...e.values()].map(t=>({...t,subtypes:[...t.subtypes].sort()})).sort((t,n)=>Ae(t.label,n.label)||Ae(t.file??"",n.file??"")||(t.line??0)-(n.line??0))}function Tt(e){return qe({...e,edges:[]},"",{file:"",startLine:0,endLine:-1})}function Bt(e,t){for(let n of e.edges){if(n.from.id===t)return n.from;if(n.to.id===t)return n.to}return null}function It(e){return e.location?{file:e.location.file,startLine:e.location.line,endLine:e.location.endLine??e.location.line}:{file:"",startLine:0,endLine:-1}}function jt(e){return{id:e.id,family:e.family,subtype:e.subtype,from:e.from,to:e.to,strength:e.evidenceStrength,methods:e.evidenceMethods}}function At(e,t){if(e===t.symbol)return!0;let n=e.replace(/\\/g,"/").replace(/\(\)$/u,""),r=C(t.symbol);if(n===q(t.symbol).replace(/\(\)$/u,"")||n===r)return!0;let s=e.match(/^(.+):(\d+)(?:-(\d+))?$/);if(s){let i=pe(s[1]);return t.relativePath===i||t.relativePath.endsWith(`/${i}`)}let o=n.lastIndexOf("/");return o>0&&n.slice(o+1)===r&&t.relativePath.toLowerCase().includes(n.slice(0,o).toLowerCase())}function Ae(e,t){return e<t?-1:e>t?1:0}function Ue(e){let t=e.published??fe,n=e.open(),r=null,s=o=>{try{o.close()}catch{}};return{acquire(){if(!n)throw new Error("The viewer database is closed.");let o=t(e.dbPath);if(o!==null&&o!==n.generation.identity&&o!==r)try{let i=e.open();s(n),n=i,r=o}catch{}return n},generation(){return n?.generation.identity??null},close(){let o=n;n=void 0,o&&s(o)}}}import{posix as Ge,resolve as _t}from"path";var He=400,We=2e3,$t=["callers","callees","contracts","data","state","runtime"],qt=4096,Ut=/:\d+(?:-\d+)?$/u,Gt=/^\s*```[^\n]*\n[\s\S]*?```[^\S\n]*(?:\n|$)/u;function Ye(e,t){return{status:200,body:{projectRoot:t.projectRoot,projectName:t.meta.projectName,cliVersion:t.meta.cliVersion,generation:D(e),watcher:{state:t.meta.watcherState()},builder:{available:t.meta.builder.available,modes:[...I],defaultMode:t.meta.builder.defaultMode}}}}function ze(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path")??"",o=B(s);if(o===null)return L(e,`Path is outside the project: ${T(s)}`,{nearest:""});let i=n.queries.normalizeMapScope(o),a=n.queries.codeMapScope(e,{scope:i,basis:r});return a?{status:200,body:{...a,generation:D(e)}}:L(e,`No indexed files under "${i}".`,{nearest:n.queries.nearestMapScope(e,i)})}function Xe(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path");if(!s)return k(e,"path is required.");let o=B(s);if(o===null||o===""||!n.queries.isIndexedFile(e,o))return L(e,`No indexed file at "${T(s)}".`);let i=n.queries.codeMapFile(e,o,r);return{status:200,body:{file:o,breadcrumbs:Yt(o),editorUri:ne(n.projectRoot,o,1),outline:tt(e,o,n),dependsOn:i?.dependsOn??[],dependedOnBy:i?.dependedOnBy??[],stale:n.queries.fileIsStale(e,o),generation:D(e)}}}function Qe(e,t,n){let r=t.get("symbol"),s=t.get("focus"),o=r||s;if(!o)return k(e,"symbol or focus is required.");if(o.length>qt)return k(e,"The selector is too long.");let i=r||"";if(!r){let S=n.queries.resolveFocus(e,o);if(S.status==="ambiguous")return{status:200,body:{status:"ambiguous",candidates:S.candidates.map(l=>({symbol:l.symbol,name:l.name,file:l.file,line:l.line+1})),total:S.total,generation:D(e)}};if(S.status==="missing")return L(e,`No symbol matches "${T(o)}".`);i=S.symbol}let a=Ut.test(i)?null:n.queries.code(e,i);if(!a||a.symbol!==i||a.symbol===a.relativePath||!n.queries.isIndexedFile(e,a.relativePath))return L(e,`No indexed definition for "${T(i)}".`);let d=a.relativePath,p=nt(tt(e,d,n),i),m=n.queries.fileSymbolFacts(e,d);if(!p&&!m.has(i))return L(e,`No indexed definition for "${T(i)}".`);let b=m.get(i),M=t.get("statements")==="1",y=n.queries.symbolFocusLanes(e,i,M?{statements:!0}:void 0),R=a.startLine+1,x=a.source.split(`
2
2
  `),E=x.length>He,P=E?x.slice(0,He):x;return{status:200,body:{status:"matched",definition:{symbol:i,name:C(i),file:d,startLine:R,endLine:a.endLine+1,signature:p?.entry.signature??null,documentation:Wt(b?.documentation),editorUri:ne(n.projectRoot,d,R)},parent:p?.parent?{symbol:p.parent.symbol,name:p.parent.name}:null,members:(p?.entry.children??[]).map(S=>({symbol:S.symbol,name:S.name,line:S.startLine})),lanes:Qt(y.lanes,n.projectRoot),fileImports:n.queries.codeMapFile(e,d,"imports")?.dependsOn??[],coverage:y.coverage,source:{startLine:R,endLine:R+P.length-1,text:P.join(`
3
3
  `),truncated:E,stale:et(a)},...M&&y.statements?{statements:Jt(y.statements)}:{},generation:D(e)}}}function Ze(e,t,n){let r=t.get("file");if(!r)return k(e,"file is required.");let s=t.get("start"),o=t.get("end"),i=s===null?1:Ke(s);if(i===null)return k(e,"start must be a positive integer.");let a=o===null?i+We-1:Ke(o);if(a===null||a<i)return k(e,"end must be an integer at or after start.");let d=B(r);if(d===null||d===""||!n.queries.isIndexedFile(e,d))return L(e,`No indexed file at "${T(r)}".`);let p=Math.min(a,i+We-1),m=n.queries.code(e,`${d}:${i}-${p}`);return m?{status:200,body:{file:d,startLine:m.startLine+1,endLine:m.endLine+1,text:m.source,stale:et(m),generation:D(e)}}:L(e,`Lines ${i}-${p} are outside "${d}".`)}function B(e){if([...e].some(r=>r.charCodeAt(0)<32))return null;let t=e.replaceAll("\\","/");if(t.startsWith("/")||/^[A-Za-z]:/u.test(t))return null;let n=t.split("/").filter(r=>r!==""&&r!==".");return n.includes("..")?null:n.join("/")}function ne(e,t,n){return Ht(_t(e,t),n)}function Ht(e,t){let r=e.replaceAll("\\","/").replace(/[%#? ]/gu,s=>encodeURIComponent(s));return`vscode://file${r.startsWith("/")?"":"/"}${r}:${t}`}function Wt(e){if(!e)return null;let t=e.replace(Gt,"").trim();return t===""?null:t}function et(e){return e.freshness?.semantic.state==="stale"}function Jt(e){return{...e,edges:e.edges.map(Kt)}}function Kt(e){return{...e,from:Je(e.from),to:Je(e.to)}}function Je(e){let{location:t}=e;return t?{...e,location:{...t,line:t.line+1,...t.endLine!==void 0?{endLine:t.endLine+1}:{}}}:e}function Yt(e){let t=[{name:"root",path:""}],n="";for(let r of e.split("/"))n=n===""?r:`${n}/${r}`,t.push({name:r,path:n});return t}function tt(e,t,n){let r=n.queries.fileSymbolFacts(e,t),s=Xt(t),o=n.queries.outline(e,t).flatMap(a=>U(a.symbol)==="namespace"&&s.has(C(a.symbol))?a.children:[a]),i=(a,d)=>({symbol:a.symbol,name:C(a.symbol),kind:r.get(a.symbol)?.kind??zt(a.symbol,d),startLine:a.startLine+1,endLine:a.endLine+1,signature:a.signature,children:a.children.map(p=>i(p,a.symbol))});return o.map(a=>i(a))}function zt(e,t){let n=U(e);return n==="method"?t!==void 0&&U(t)==="type"?"method":"function":n==="term"?"variable":n??"unknown"}function Xt(e){let t=Ge.basename(e);return new Set([t,t.slice(0,Math.max(0,t.length-Ge.extname(t).length))])}function nt(e,t,n=null){for(let r of e){if(r.symbol===t)return{entry:r,parent:n};let s=nt(r.children,t,r);if(s)return s}return null}function Qt(e,t){let n={};for(let r of $t)n[r]=(e[r]??[]).map(s=>{let{line:o,...i}=s,a={...i};return o!==void 0&&(a.line=o+1),s.file!==void 0&&(a.editorUri=ne(t,s.file,(o??0)+1)),a});return n}function rt(e){return e===null||e===""?"references":e==="references"||e==="imports"?e:null}function Ke(e){if(!/^\d{1,9}$/u.test(e))return null;let t=Number(e);return t>=1?t:null}function D(e){return e.generation.identity}function k(e,t){return{status:400,body:{error:t,generation:D(e)}}}function L(e,t,n={}){return{status:404,body:{error:t,...n,generation:D(e)}}}function T(e){return e.length>200?`${e.slice(0,200)}...`:e}import{createHash as ct,randomBytes as Zt,timingSafeEqual as en}from"crypto";import{existsSync as A}from"fs";import{createServer as tn}from"http";import{createRequire as nn}from"module";import{dirname as rn,join as H}from"path";import{fileURLToPath as on}from"url";var _="127.0.0.1",sn=80,an="__CODEBASEIQ_TOKEN__",cn="x-codebaseiq-token",ot=64*1024,un=18e4,st=50,it=["reuse","rework","compose"],ln="cytoscape.esm.min.mjs",dn=["index.html","styles.css","app.js","api.js","map.js","file-panel.js","focus.js","builder.js"],fn={".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".js":"text/javascript; charset=utf-8"},pn=["default-src 'self'","script-src 'self'","style-src 'self' 'unsafe-inline'","img-src 'self' data:","connect-src 'self'","frame-ancestors 'none'"].join("; ");function mn(){for(let e of["../ui/view/","../../../ui/view/"]){let t=on(new URL(e,import.meta.url));if(A(H(t,"index.html")))return t}}function gn(){try{let e=nn(import.meta.url).resolve("cytoscape"),t=H(rn(e),ln);return A(t)?t:void 0}catch{return}}function at(e,t){return{body:se(e,{maxBytes:oe,inputKind:"viewer asset"}),contentType:t}}function bn(e,t){let n=e.uiDirectory??mn();if(!n||!A(H(n,"index.html")))throw new Error("The viewer UI files were not found; reinstall codebaseiq or rebuild the package.");let r=new Map;for(let i of dn){let a=H(n,i);if(!A(a))continue;let d=at(a,fn[i.slice(i.lastIndexOf("."))]??"application/octet-stream");r.set(i,i==="index.html"?{...d,body:Buffer.from(d.body.toString("utf8").replaceAll(an,t),"utf8")}:d)}let s=e.cytoscapePath??gn(),o=s&&A(s)?at(s,"text/javascript"):void 0;return{assets:r,...o?{vendor:o}:{}}}async function ut(e){let t=e.token??Zt(24).toString("base64url"),{assets:n,vendor:r}=bn(e,t),s=e.builderTimeoutMs??un,o=ct("sha256").update(t).digest(),i=0,a=!1,d=new Set,p=()=>lt(i),m=()=>yn(i),b=(c,u,g)=>{let h=JSON.stringify({generation:e.database.generation(),...g});c.writeHead(u,{...G(),"Content-Type":"application/json; charset=utf-8","Content-Length":Buffer.byteLength(h)}),c.end(h)},M=(c,u)=>{c.writeHead(200,{...G(),"Content-Type":u.contentType,"Content-Length":u.body.byteLength,...u.contentType.startsWith("text/html")?{"Content-Security-Policy":pn}:{}}),c.end(u.body)},y=(c,u,g,h={})=>{c.writeHead(u,{...G(),"Content-Type":"text/plain; charset=utf-8","Content-Length":Buffer.byteLength(g),...h}),c.end(g)},R=(c,u,g)=>{let h=hn.get(u);if(!h){b(c,404,{error:"Not found."});return}let v=h(e.database.acquire(),g,e.routes);b(c,v.status,v.body)},x=(c,u)=>{if(u==="/"){let v=n.get("index.html");v?M(c,v):y(c,404,"Not found.");return}if(u==="/favicon.ico"){c.writeHead(204,G()),c.end();return}if(u==="/vendor/cytoscape.mjs"&&r){M(c,r);return}let g=u.startsWith("/assets/")?u.slice(8):void 0,h=g===void 0?void 0:n.get(g);h?M(c,h):y(c,404,"Not found.")},E=async(c,u)=>{let g=c.headers.origin;if(g!==void 0&&!m().has(g)){b(u,403,{error:"Origin is not allowed."});return}if(!wn(c.headers["content-type"])){b(u,415,{error:"Content-Type must be application/json."});return}if(!Sn(o,c.headers[cn])){b(u,403,{error:"The viewer token is missing or wrong; reload the page."});return}let h=e.builder;if(!h){b(u,501,{error:"The symbol builder is not available in this viewer."});return}if(a){b(u,409,{error:"A builder query is already running."});return}a=!0;try{let v=await vn(c,ot);if(v===void 0){b(u,400,{error:`The request body must be at most ${ot/1024} KiB.`});return}let V=Rn(v);if(!V.ok){b(u,400,{error:V.error});return}await P(u,h,V.request,V.diagnostics)}finally{a=!1}},P=async(c,u,g,h)=>{let v=new AbortController;d.add(v);let V=()=>{c.writableEnded||v.abort(new Error("The client disconnected."))};c.on("close",V);let W;try{let $=await new Promise(J=>{W=setTimeout(()=>{v.abort(new Error("The builder query timed out.")),J({kind:"timeout"})},s),u(g,v.signal).then(K=>J({kind:"done",response:K}),K=>J({kind:"failed",error:K}))});if(c.destroyed)return;$.kind==="timeout"?b(c,504,{error:`The builder query took longer than ${Math.round(s/1e3)} s.`}):$.kind==="failed"?b(c,502,{error:re($.error)}):b(c,200,{...$.response,...h.length>0?{probeDiagnostics:h}:{}})}finally{W&&clearTimeout(W),c.off("close",V),d.delete(v)}},S=async(c,u)=>{if(!p().has((c.headers.host??"").toLowerCase())){y(u,403,"Forbidden host.");return}let g;try{g=new URL(c.url??"/",`http://${_}`)}catch{y(u,400,"Bad request.");return}let h=c.method??"GET";if(g.pathname==="/api/builder"){h==="POST"?await E(c,u):b(u,405,{error:"Use POST."});return}if(h!=="GET"&&h!=="HEAD"){y(u,405,"Method not allowed.",{Allow:"GET, HEAD"});return}g.pathname.startsWith("/api/")?R(u,g.pathname,g.searchParams):x(u,g.pathname)},l=tn((c,u)=>{S(c,u).catch(g=>{if(u.headersSent){u.destroy();return}b(u,500,{error:re(g)})})});await new Promise((c,u)=>{l.once("error",u),l.listen({host:_,port:e.port??0},()=>{l.off("error",u),c()})}),l.on("error",c=>{process.stderr.write(`codebaseiq view: server error: ${re(c)}
4
4
  `)});let f=l.address();i=typeof f=="object"&&f?f.port:0;let w=`http://${_}:${i}`;return{port:i,origin:w,url:`${w}/`,token:t,close(){for(let c of d)c.abort(new Error("The viewer is shutting down."));return new Promise(c=>{l.close(()=>c()),l.closeAllConnections()})}}}var hn=new Map([["/api/meta",(e,t,n)=>Ye(e,n)],["/api/scope",ze],["/api/file",Xe],["/api/symbol",Qe],["/api/source",Ze]]);function lt(e){let t=new Set([`${_}:${e}`,`localhost:${e}`]);return e===sn&&(t.add(_),t.add("localhost")),t}function yn(e){return new Set([...lt(e)].map(t=>`http://${t}`))}function G(){return{"Cache-Control":"no-store","X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer"}}function wn(e){return e!==void 0&&e.split(";")[0].trim().toLowerCase()==="application/json"}function Sn(e,t){return typeof t!="string"||t===""?!1:en(ct("sha256").update(t).digest(),e)}function vn(e,t){return new Promise((n,r)=>{let s=[],o=0,i=!1;e.on("data",a=>{o+=a.byteLength,o>t?(i=!0,s.length=0):i||s.push(a)}),e.on("end",()=>n(i?void 0:Buffer.concat(s).toString("utf8"))),e.on("error",r)})}function Rn(e){let t;try{t=JSON.parse(e)}catch{return{ok:!1,error:"The request body must be valid JSON."}}if(typeof t!="object"||t===null||Array.isArray(t))return{ok:!1,error:"The request body must be a JSON object."};let n=t,r={},s=[];if(n.description!==void 0){if(typeof n.description!="string")return{ok:!1,error:"description must be a string."};n.description.trim()!==""&&(r.description=n.description)}if(n.probes!==void 0){let o=he(n.probes);s=o.diagnostics,(be(o.probes)||o.probes.kinds.length>0)&&(r.probes=o.probes)}if(n.mode!==void 0){if(typeof n.mode!="string"||!I.includes(n.mode))return{ok:!1,error:`mode must be one of ${I.join(", ")}.`};r.mode=n.mode}if(n.bucket!==void 0){if(typeof n.bucket!="string"||!it.includes(n.bucket))return{ok:!1,error:`bucket must be one of ${it.join(", ")}.`};r.bucket=n.bucket}if(n.limit!==void 0){let o=n.limit;if(typeof o!="number"||!Number.isInteger(o)||o<1||o>st)return{ok:!1,error:`limit must be an integer from 1 to ${st}.`};r.limit=o}return r.description===void 0&&r.probes===void 0?{ok:!1,error:"Give a description or at least one probe."}:{ok:!0,request:r,diagnostics:s}}function re(e){return e instanceof Error?e.message:String(e)}var kn="view-server.json",ft="127.0.0.1",Ln=1e3,Dn=5e3,Pn=2e3,gt={isProcessAlive:ue,canConnect(e,t){return new Promise(n=>{let r=xn({host:ft,port:e}),s=o=>{r.destroy(),n(o)};r.setTimeout(t,()=>s(!1)),r.once("connect",()=>s(!0)),r.once("error",()=>s(!1))})},async fetchProjectRoot(e,t){try{let n=await fetch(`http://${ft}:${e}/api/meta`,{signal:AbortSignal.timeout(t)});if(!n.ok)return{kind:"answered",projectRoot:void 0};let r=await n.json();return{kind:"answered",projectRoot:typeof r.projectRoot=="string"?r.projectRoot:void 0}}catch{return{kind:"unanswered"}}}};function pt(e,t){let n=new URL(e);return t.focus!==void 0?n.searchParams.set("focus",t.focus):t.file!==void 0?n.searchParams.set("file",t.file):t.scope!==void 0&&n.searchParams.set("scope",t.scope),n.toString()}async function bt(e,t,n=gt){let r=ht(e);if(!r||!n.isProcessAlive(r.pid)||!await n.canConnect(r.port,Ln))return;let s=await n.fetchProjectRoot(r.port,Dn);if(s.kind==="unanswered")return r;let o=s.projectRoot;if(!(o===void 0||z(dt(o))!==z(dt(t))))return r}async function Vn(e,t,n=gt){let r=await bt(e,t.projectRoot,n);if(r&&r.pid!==t.pid)return process.stderr.write(`warning: a viewer (pid ${r.pid}, ${r.url}) is already recorded for this project, so this one is not.
@@ -8,4 +8,4 @@ import{a as Me,b as Fe}from"./chunk-M4EVGA5S.js";import"./chunk-ILMHV3KM.js";imp
8
8
  `)}function Cn(e,t){return e?.code==="EADDRINUSE"&&t?new Error(`Port ${t} is already in use; choose another with --port.`):e instanceof Error?e:new Error(String(e))}function Nn(e,t){try{let n=ye(e.projectRoot,e.config),r=Fe({settings:n,storeRoot:Me(e.paths.cacheDir),languages:Bn(t.acquire()),openDb:()=>t.acquire(),env:Tn(process.env)});return{run:(s,o)=>r.query(s,{signal:o}),defaultMode:n.mode,close:()=>r.close()}}catch(n){return process.stderr.write(`codebaseiq view: the symbol builder is unavailable: ${yt(n)}
9
9
  `),{defaultMode:"agent",close:()=>{}}}}function Tn(e){return Object.fromEntries(Object.entries(e).filter(([t])=>t!=="CLAUDECODE"&&!t.startsWith("CODEX_")))}function Bn(e){let t=e.generation.metadataRaw;return(t?ce(ae(t))?.indexedLanguages:void 0)??[]}function In(e,t,n){let r;return()=>{let s=Date.now();if(r&&s-r.at<Pn)return r.value;let o;try{let{classification:i}=ve({projectRoot:e,cacheDir:t.paths.cacheDir,cliVersion:Y,...n?{gitContext:n}:{}});o=i.kind==="live"?i.state.watcher.state:i.kind}catch{o="unknown"}return r={at:s,value:o},o}}function jn(){let e=new WeakMap;return{normalizeMapScope:j,codeMapScope:De,nearestMapScope:Pe,codeMapFile:Ve,isIndexedFile(t,n){let r=e.get(t);return r||(r=new Set(O(t,{includeIgnored:!1})),e.set(t,r)),r.has(n)},outline:Ee,fileSymbolFacts(t,n){let r=new Map;for(let s of me(t,n))r.set(s.symbol,{kind:s.kind===null?null:An(s.kind),documentation:s.documentation});return r},resolveFocus:_e,symbolFocusLanes:$e,code:Z,fileIsStale(t,n){return Z(t,`${n}:1-1`)?.freshness?.semantic.state==="stale"}}}function An(e){let t=Re(e).toLowerCase();return t==="unknown"||t==="unspecifiedkind"?null:t}function _n(e){let t=()=>{let s=ht(e.stateFile);s?.pid===e.state.pid&&s.startedAt===e.state.startedAt&&En(e.stateFile,{force:!0})},n=!1,r=()=>{n||(n=!0,e.server.close().finally(()=>{e.builder.close(),e.database.close(),t(),console.log(`
10
10
  Stopped.`),process.exit(0)}))};process.on("SIGINT",r),process.on("SIGTERM",r),process.on("exit",t)}function yt(e){return e instanceof Error?e.message:String(e)}export{kn as VIEW_STATE_FILE,jn as createViewerQueries,bt as findRunningViewer,ht as readViewerState,Vn as recordRunningViewer,jr as runCodeViewer,Tn as viewerBuilderEnvironment,pt as viewerDeepLink};
11
- //# sourceMappingURL=code-viewer-ZCTHXQ5C.js.map
11
+ //# sourceMappingURL=code-viewer-VHLBLIUM.js.map