scip-query 0.20.0 → 0.21.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 (586) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +255 -884
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-CI3O6PQG.js +2 -0
  5. package/dist/call-graph-6QTUTXH7.js +2 -0
  6. package/dist/call-graph-evidence-lZa2dwQA.d.ts +11 -0
  7. package/dist/change-analysis-types-CCtoCHbC.d.ts +9 -0
  8. package/dist/chunk-26CT72HM.js +2 -0
  9. package/dist/{chunk-7PIO7NKH.js → chunk-2COFMIVK.js} +2 -2
  10. package/dist/chunk-2H4IAJHO.js +2 -0
  11. package/dist/chunk-2I3RSUWX.js +16 -0
  12. package/dist/chunk-2RP27XLR.js +2 -0
  13. package/dist/chunk-2ZBMOQGG.js +3 -0
  14. package/dist/{chunk-HX4GQPZP.js → chunk-32A42O5B.js} +3 -3
  15. package/dist/chunk-35ELD3RM.js +2 -0
  16. package/dist/chunk-35IW3P4H.js +2 -0
  17. package/dist/{chunk-DQGFVPUV.js → chunk-3653GTR7.js} +3 -3
  18. package/dist/chunk-3EX7DNBC.js +2 -0
  19. package/dist/chunk-3FQ3KMCD.js +2 -0
  20. package/dist/{chunk-5E4WNAVD.js → chunk-3PII3JI5.js} +2 -2
  21. package/dist/chunk-3TNRNKAT.js +2 -0
  22. package/dist/chunk-3VLJ2DCA.js +2 -0
  23. package/dist/{chunk-XSRF6Q77.js → chunk-46JLFIGA.js} +2 -2
  24. package/dist/chunk-4DCKBY6T.js +5 -0
  25. package/dist/chunk-4EXFZP6H.js +2 -0
  26. package/dist/chunk-4IIMPWMR.js +29 -0
  27. package/dist/chunk-4ILHWBYF.js +2 -0
  28. package/dist/chunk-4N6QSEMZ.js +10 -0
  29. package/dist/chunk-4OE2JO6I.js +2 -0
  30. package/dist/{chunk-7BAVHKMJ.js → chunk-4S4DF62J.js} +9 -9
  31. package/dist/chunk-4UUCUASK.js +554 -0
  32. package/dist/chunk-5236NQV3.js +2 -0
  33. package/dist/chunk-54EOGFBR.js +2 -0
  34. package/dist/{chunk-LY4WC4AD.js → chunk-5H7IWVXJ.js} +2 -2
  35. package/dist/chunk-5IZTXSOL.js +117 -0
  36. package/dist/{chunk-AZJQQKDD.js → chunk-5SE323LF.js} +2 -2
  37. package/dist/chunk-5ZJH6DDE.js +2 -0
  38. package/dist/chunk-63MBA7EG.js +3 -0
  39. package/dist/chunk-6BJ7SOY7.js +2 -0
  40. package/dist/chunk-6GJAP4OE.js +2 -0
  41. package/dist/chunk-6IEVHGWG.js +26 -0
  42. package/dist/chunk-6SWA6B24.js +7 -0
  43. package/dist/chunk-6T7H2AFY.js +3 -0
  44. package/dist/chunk-73Z33VFI.js +4 -0
  45. package/dist/chunk-7COHFNJK.js +38 -0
  46. package/dist/chunk-7HU2IJ2T.js +3 -0
  47. package/dist/chunk-7IOAZRVL.js +60 -0
  48. package/dist/chunk-7KCZELVM.js +2 -0
  49. package/dist/chunk-7PPYXENX.js +2 -0
  50. package/dist/chunk-7TWP3MCP.js +2 -0
  51. package/dist/chunk-AA7K3XLM.js +21 -0
  52. package/dist/chunk-AJVMVE7X.js +7 -0
  53. package/dist/chunk-ANWGXPPN.js +4 -0
  54. package/dist/chunk-APLKXICZ.js +3 -0
  55. package/dist/{chunk-JDOEX4E6.js → chunk-AQDWTCDC.js} +2 -2
  56. package/dist/chunk-AUP6YI5M.js +2 -0
  57. package/dist/chunk-B7ECWJAZ.js +2 -0
  58. package/dist/{chunk-ZHXX42OH.js → chunk-BATIVRU2.js} +4 -4
  59. package/dist/chunk-BBEDPVPB.js +4 -0
  60. package/dist/chunk-BBWPOMGU.js +2 -0
  61. package/dist/chunk-BD6CV7PN.js +2 -0
  62. package/dist/{chunk-XKWKXZKW.js → chunk-BHE44MHT.js} +2 -2
  63. package/dist/chunk-BOJ5SVE2.js +2 -0
  64. package/dist/chunk-BZYSGZRK.js +2 -0
  65. package/dist/chunk-CA5RE6H7.js +2 -0
  66. package/dist/chunk-CKDOY6JA.js +2 -0
  67. package/dist/chunk-CN2WGM7D.js +2 -0
  68. package/dist/chunk-COTMS5KM.js +3 -0
  69. package/dist/chunk-CSDDOUA4.js +3 -0
  70. package/dist/chunk-CT5SI2I4.js +2 -0
  71. package/dist/chunk-D5EKVZPI.js +2 -0
  72. package/dist/{chunk-FKSELJQF.js → chunk-D5W4UZY5.js} +2 -2
  73. package/dist/{chunk-RUJURYSV.js → chunk-DEUGHURX.js} +2 -2
  74. package/dist/chunk-DHKBIOXF.js +7 -0
  75. package/dist/chunk-DMQ7ZKJG.js +81 -0
  76. package/dist/chunk-DMUGTKMD.js +2 -0
  77. package/dist/chunk-DOPCR5BY.js +2 -0
  78. package/dist/chunk-DRENNWRG.js +2 -0
  79. package/dist/chunk-E4EJBGDZ.js +2 -0
  80. package/dist/chunk-E7BJXRNV.js +2 -0
  81. package/dist/chunk-EA4SH4U5.js +5 -0
  82. package/dist/{chunk-L7AW2QB5.js → chunk-EKZRF57O.js} +2 -2
  83. package/dist/chunk-ELNRLMC5.js +29 -0
  84. package/dist/chunk-F4FNK44D.js +2 -0
  85. package/dist/chunk-F7WQ337U.js +308 -0
  86. package/dist/chunk-FEQIQ26E.js +2 -0
  87. package/dist/chunk-FGB567HK.js +23 -0
  88. package/dist/chunk-FHV7NMFU.js +29 -0
  89. package/dist/chunk-FN6EJM6Q.js +2 -0
  90. package/dist/chunk-FTSQNONX.js +2 -0
  91. package/dist/chunk-FUG6RPYY.js +6 -0
  92. package/dist/chunk-G2F6T5BV.js +2 -0
  93. package/dist/chunk-G6OGPXJW.js +9 -0
  94. package/dist/chunk-GFLTPNWV.js +3 -0
  95. package/dist/chunk-GTDP2SKQ.js +2 -0
  96. package/dist/chunk-H46QMB7E.js +2 -0
  97. package/dist/chunk-H5EXS3HM.js +2 -0
  98. package/dist/chunk-HEOMG7IM.js +8 -0
  99. package/dist/chunk-HG5YI7PV.js +2 -0
  100. package/dist/{chunk-7SQQWSY3.js → chunk-HGKEAP7F.js} +2 -2
  101. package/dist/chunk-HUZNZ3H2.js +2 -0
  102. package/dist/chunk-HWLCBKFE.js +2 -0
  103. package/dist/chunk-I3U2FN2T.js +13 -0
  104. package/dist/{chunk-JAYYFEQY.js → chunk-I7PFL5P3.js} +2 -2
  105. package/dist/{chunk-2HPVVXM5.js → chunk-ICHBVITH.js} +2 -2
  106. package/dist/chunk-ICUQONOG.js +38 -0
  107. package/dist/chunk-IDPLC3FI.js +5 -0
  108. package/dist/{chunk-A73XVBCR.js → chunk-IGKKTHJR.js} +2 -2
  109. package/dist/chunk-IOKWFRFQ.js +4 -0
  110. package/dist/chunk-IPAL6DP2.js +3 -0
  111. package/dist/chunk-IUJ3ZFEE.js +7 -0
  112. package/dist/chunk-IXJ26KJJ.js +16 -0
  113. package/dist/chunk-IYV2YBHM.js +2 -0
  114. package/dist/chunk-JVZNWJBH.js +2 -0
  115. package/dist/chunk-K5MZYZV7.js +3 -0
  116. package/dist/{chunk-3G66UZBH.js → chunk-KFK7GF5C.js} +2 -2
  117. package/dist/chunk-KTRGJLY7.js +18 -0
  118. package/dist/chunk-KW6B5OL4.js +2 -0
  119. package/dist/chunk-KWARB5FZ.js +2 -0
  120. package/dist/chunk-LHTT5C3Z.js +2 -0
  121. package/dist/chunk-LPGDO2XA.js +3 -0
  122. package/dist/chunk-LXLD46LH.js +21 -0
  123. package/dist/chunk-MEI3PTUK.js +2 -0
  124. package/dist/chunk-MJNV7OCG.js +5 -0
  125. package/dist/chunk-MO226P4Q.js +4 -0
  126. package/dist/{chunk-3CLX5EOX.js → chunk-MOBF2GH6.js} +2 -2
  127. package/dist/chunk-MXNGIEPU.js +3 -0
  128. package/dist/chunk-MYUKI5VN.js +4 -0
  129. package/dist/{chunk-TFRAYKN6.js → chunk-N5C65OFK.js} +2 -2
  130. package/dist/{chunk-PXY7F6Y4.js → chunk-O2RM7E7L.js} +5 -5
  131. package/dist/chunk-OFUBXBYX.js +3 -0
  132. package/dist/chunk-OFY4HTMI.js +2 -0
  133. package/dist/chunk-OIRWZIYL.js +38 -0
  134. package/dist/chunk-OIVZ7PW6.js +438 -0
  135. package/dist/chunk-ORBKAUCH.js +4 -0
  136. package/dist/chunk-OUB4J26T.js +2 -0
  137. package/dist/chunk-OVPS2ILI.js +20 -0
  138. package/dist/chunk-PHSPBQM6.js +5 -0
  139. package/dist/{chunk-JVYA47YU.js → chunk-PIZY2GX6.js} +2 -2
  140. package/dist/chunk-PNISDVYC.js +3 -0
  141. package/dist/chunk-PQOL42AW.js +2 -0
  142. package/dist/chunk-PUVZNFVY.js +11 -0
  143. package/dist/chunk-PZEI2TVL.js +4 -0
  144. package/dist/{chunk-ZK26BAQL.js → chunk-Q2J2VZZT.js} +2 -2
  145. package/dist/chunk-Q7HB7BFJ.js +2 -0
  146. package/dist/{chunk-ZTETIQ35.js → chunk-QBANU5BQ.js} +2 -2
  147. package/dist/chunk-QD7IFBCR.js +10 -0
  148. package/dist/chunk-QDCCHMVZ.js +2 -0
  149. package/dist/chunk-QLQBZOJH.js +3 -0
  150. package/dist/{chunk-PQCI4SQX.js → chunk-QXR5QPSF.js} +2 -2
  151. package/dist/chunk-R2MOKIVO.js +2 -0
  152. package/dist/{chunk-EN3O7VJA.js → chunk-RFWAUHVW.js} +2 -2
  153. package/dist/chunk-RGCJ4646.js +16 -0
  154. package/dist/{chunk-BPAPWKP6.js → chunk-S3RTPPLQ.js} +8 -8
  155. package/dist/chunk-S73HBCGI.js +11 -0
  156. package/dist/chunk-SDPA5DKN.js +210 -0
  157. package/dist/chunk-SEUJVWT2.js +3 -0
  158. package/dist/chunk-SF7X6QNW.js +2 -0
  159. package/dist/chunk-SKUMCCC5.js +2 -0
  160. package/dist/chunk-SSSJO4RG.js +2 -0
  161. package/dist/chunk-SWFAFA4G.js +49 -0
  162. package/dist/chunk-SYUNTKO2.js +2 -0
  163. package/dist/chunk-T6FRID7Y.js +3 -0
  164. package/dist/chunk-TGWNNMPF.js +3 -0
  165. package/dist/chunk-TM5XEDDR.js +4 -0
  166. package/dist/chunk-TNOHGHZQ.js +2 -0
  167. package/dist/chunk-U2GPTA5U.js +3 -0
  168. package/dist/{chunk-SXP2MBJH.js → chunk-U7DR7MJD.js} +2 -2
  169. package/dist/chunk-U7LRSQG6.js +3 -0
  170. package/dist/chunk-UL4VJUMD.js +2 -0
  171. package/dist/chunk-UNORWZIJ.js +16 -0
  172. package/dist/chunk-UQ7XPRWU.js +2 -0
  173. package/dist/{chunk-6SHPK5ZE.js → chunk-URMZLV2N.js} +2 -2
  174. package/dist/chunk-URTX2BEA.js +6 -0
  175. package/dist/chunk-UZFCZ7SJ.js +2 -0
  176. package/dist/{chunk-KMKTIO2G.js → chunk-V7LQZTTZ.js} +2 -2
  177. package/dist/chunk-VETXXOYU.js +3 -0
  178. package/dist/chunk-VGRUM7JI.js +3 -0
  179. package/dist/{chunk-WXZLAAWK.js → chunk-VNKYRJKN.js} +2 -2
  180. package/dist/chunk-VWLIOEEF.js +11 -0
  181. package/dist/chunk-WB6LGCFB.js +6 -0
  182. package/dist/{chunk-W4ETQAXM.js → chunk-WK4FD4PG.js} +2 -2
  183. package/dist/{chunk-O64IZ6UX.js → chunk-WKPZCQLI.js} +2 -2
  184. package/dist/chunk-WSG3DK5H.js +2 -0
  185. package/dist/chunk-WULAPQUD.js +38 -0
  186. package/dist/chunk-WZQFY5S7.js +4 -0
  187. package/dist/chunk-X434XZAI.js +2 -0
  188. package/dist/chunk-X7PJJYKX.js +29 -0
  189. package/dist/chunk-XDAUYDFT.js +2 -0
  190. package/dist/chunk-XITQLISP.js +2 -0
  191. package/dist/chunk-XRXCANFQ.js +4 -0
  192. package/dist/chunk-XVDMJMES.js +3 -0
  193. package/dist/chunk-XXJ7WL3F.js +35 -0
  194. package/dist/chunk-Y4XQ7LES.js +9 -0
  195. package/dist/chunk-YIEFEPG6.js +16 -0
  196. package/dist/chunk-YRVERHJR.js +49 -0
  197. package/dist/{chunk-CJST5ETY.js → chunk-YUFWLWIC.js} +2 -2
  198. package/dist/chunk-YUKYB54I.js +1 -0
  199. package/dist/chunk-Z3GCK3PD.js +3 -0
  200. package/dist/chunk-ZBNL3QCY.js +4 -0
  201. package/dist/chunk-ZD3Z54IW.js +2 -0
  202. package/dist/chunk-ZDVDSDFG.js +4 -0
  203. package/dist/{chunk-32LVLCLN.js → chunk-ZHSARYVS.js} +3 -3
  204. package/dist/{chunk-BDCC2NPY.js → chunk-ZW44MCJM.js} +2 -2
  205. package/dist/{chunk-N5W4YZMK.js → chunk-ZYREOING.js} +2 -2
  206. package/dist/cli-main.js +8 -0
  207. package/dist/cli.js +1 -3
  208. package/dist/code-CczEvHui.d.ts +121 -0
  209. package/dist/code-EQL6ZBLH.js +2 -0
  210. package/dist/code-result-json-6E4J6LGZ.js +2 -0
  211. package/dist/command-descriptors-QH3G2OVD.js +346 -0
  212. package/dist/{config-types-jVM3D7MA.d.ts → config-types-Cm-VSEBb.d.ts} +189 -23
  213. package/dist/dataflow-2BLMUZBP.js +2 -0
  214. package/dist/{db-B5PM5yNk.d.ts → db-LKJXAlNS.d.ts} +1 -1
  215. package/dist/dependence-slice-MGAJDZXB.js +2 -0
  216. package/dist/deps-GQMUYVKW.js +2 -0
  217. package/dist/direct-navigation-6RUJKLAV.js +3 -0
  218. package/dist/entry-map-V2NQP5JU.js +2 -0
  219. package/dist/exploration-topology-BG4v30HZ.d.ts +256 -0
  220. package/dist/file-dep-graph-Bqg3t3Px.d.ts +4 -0
  221. package/dist/file-kind-BKCVMNUf.d.ts +10 -0
  222. package/dist/files-VM53I4IU.js +2 -0
  223. package/dist/graph-evidence-CbUPCSKV.d.ts +126 -0
  224. package/dist/graph-exploration-contract-CqDsnPQL.d.ts +7 -0
  225. package/dist/{health-Do5TKSJI.d.ts → health-Wl5G_LRt.d.ts} +33 -34
  226. package/dist/hierarchy-D553WRSZ.js +2 -0
  227. package/dist/imports-DOZAJWLW.js +2 -0
  228. package/dist/index.d.ts +4 -31
  229. package/dist/index.js +1 -1
  230. package/dist/members-HE67475K.js +2 -0
  231. package/dist/methods-K5JK4PPH.js +2 -0
  232. package/dist/next-anchor-candidates-BwMczMvX.d.ts +90 -0
  233. package/dist/output-continuation-command-LKBUTNRL.js +3 -0
  234. package/dist/output-pagination-VAWOGX4R.js +19 -0
  235. package/dist/postinstall.js +1 -1
  236. package/dist/project-reindex-4ARU6QCM.js +3 -0
  237. package/dist/queries/affected.d.ts +22 -4
  238. package/dist/queries/affected.js +1 -1
  239. package/dist/queries/anchors.d.ts +123 -0
  240. package/dist/queries/anchors.js +2 -0
  241. package/dist/queries/architecture.d.ts +3 -2
  242. package/dist/queries/architecture.js +1 -1
  243. package/dist/queries/bottlenecks.d.ts +26 -7
  244. package/dist/queries/bottlenecks.js +1 -1
  245. package/dist/queries/by-kind.d.ts +2 -2
  246. package/dist/queries/by-kind.js +1 -1
  247. package/dist/queries/call-graph.d.ts +17 -3
  248. package/dist/queries/call-graph.js +1 -1
  249. package/dist/queries/change-surface.d.ts +2 -2
  250. package/dist/queries/change-surface.js +1 -1
  251. package/dist/queries/cleanup-plan.d.ts +2 -2
  252. package/dist/queries/cleanup-plan.js +1 -1
  253. package/dist/queries/co-change.d.ts +2 -2
  254. package/dist/queries/co-change.js +1 -1
  255. package/dist/queries/code.d.ts +5 -26
  256. package/dist/queries/code.js +1 -1
  257. package/dist/queries/complexity-hotspots.d.ts +2 -2
  258. package/dist/queries/complexity-hotspots.js +1 -1
  259. package/dist/queries/complexity.d.ts +2 -2
  260. package/dist/queries/complexity.js +1 -1
  261. package/dist/queries/context.d.ts +145 -0
  262. package/dist/queries/context.js +2 -0
  263. package/dist/queries/convergence.d.ts +2 -2
  264. package/dist/queries/convergence.js +1 -1
  265. package/dist/queries/coupling.d.ts +8 -3
  266. package/dist/queries/coupling.js +1 -1
  267. package/dist/queries/cycles.d.ts +34 -7
  268. package/dist/queries/cycles.js +1 -1
  269. package/dist/queries/dataflow.d.ts +40 -14
  270. package/dist/queries/dataflow.js +1 -1
  271. package/dist/queries/dead.d.ts +2 -2
  272. package/dist/queries/dead.js +1 -1
  273. package/dist/queries/decorative-checkers.d.ts +3 -3
  274. package/dist/queries/decorative-checkers.js +1 -1
  275. package/dist/queries/deep-chains.d.ts +4 -38
  276. package/dist/queries/deep-chains.js +1 -1
  277. package/dist/queries/dependence-slice.d.ts +47 -0
  278. package/dist/queries/dependence-slice.js +2 -0
  279. package/dist/queries/dependency-depth.d.ts +49 -0
  280. package/dist/queries/dependency-depth.js +2 -0
  281. package/dist/queries/deps.d.ts +4 -2
  282. package/dist/queries/deps.js +1 -1
  283. package/dist/queries/diff-impact.d.ts +3 -3
  284. package/dist/queries/diff-impact.js +1 -1
  285. package/dist/queries/doc-drift.d.ts +4 -4
  286. package/dist/queries/doc-drift.js +1 -1
  287. package/dist/queries/drift.d.ts +2 -2
  288. package/dist/queries/drift.js +1 -1
  289. package/dist/queries/duplicate-bodies.d.ts +2 -2
  290. package/dist/queries/duplicate-bodies.js +1 -1
  291. package/dist/queries/entry-map.d.ts +121 -0
  292. package/dist/queries/entry-map.js +2 -0
  293. package/dist/queries/evidence.d.ts +70 -0
  294. package/dist/queries/evidence.js +2 -0
  295. package/dist/queries/extract-candidates.d.ts +2 -2
  296. package/dist/queries/extract-candidates.js +1 -1
  297. package/dist/queries/fan.d.ts +18 -5
  298. package/dist/queries/fan.js +1 -1
  299. package/dist/queries/files.d.ts +2 -2
  300. package/dist/queries/files.js +1 -1
  301. package/dist/queries/health.d.ts +4 -3
  302. package/dist/queries/health.js +1 -1
  303. package/dist/queries/hierarchy.d.ts +5 -3
  304. package/dist/queries/hierarchy.js +1 -1
  305. package/dist/queries/hotspots.d.ts +11 -5
  306. package/dist/queries/hotspots.js +1 -1
  307. package/dist/queries/imports.d.ts +2 -2
  308. package/dist/queries/imports.js +1 -1
  309. package/dist/queries/incomplete-migration.d.ts +4 -4
  310. package/dist/queries/incomplete-migration.js +1 -1
  311. package/dist/queries/index.d.ts +56 -136
  312. package/dist/queries/index.js +1 -1
  313. package/dist/queries/isolated.d.ts +2 -2
  314. package/dist/queries/isolated.js +1 -1
  315. package/dist/queries/locality-candidates.d.ts +2 -2
  316. package/dist/queries/locality-candidates.js +1 -1
  317. package/dist/queries/members.d.ts +2 -2
  318. package/dist/queries/members.js +1 -1
  319. package/dist/queries/methods.d.ts +2 -2
  320. package/dist/queries/methods.js +1 -1
  321. package/dist/queries/not-implemented.d.ts +3 -3
  322. package/dist/queries/not-implemented.js +1 -1
  323. package/dist/queries/outline.d.ts +2 -2
  324. package/dist/queries/outline.js +1 -1
  325. package/dist/queries/passthrough-candidates.d.ts +5 -9
  326. package/dist/queries/passthrough-candidates.js +1 -1
  327. package/dist/queries/plan-context.d.ts +27 -64
  328. package/dist/queries/plan-context.js +1 -1
  329. package/dist/queries/react-component-duplicates.d.ts +2 -2
  330. package/dist/queries/react-component-duplicates.js +1 -1
  331. package/dist/queries/react-hook-candidates.d.ts +2 -2
  332. package/dist/queries/react-hook-candidates.js +1 -1
  333. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  334. package/dist/queries/react-large-component-pressure.js +1 -1
  335. package/dist/queries/recent-duplicates.d.ts +2 -2
  336. package/dist/queries/recent-duplicates.js +1 -1
  337. package/dist/queries/redundant-reexports.d.ts +2 -2
  338. package/dist/queries/redundant-reexports.js +1 -1
  339. package/dist/queries/reference-neighborhood.d.ts +4 -0
  340. package/dist/queries/reference-neighborhood.js +2 -0
  341. package/dist/queries/reference-reachability.d.ts +48 -0
  342. package/dist/queries/reference-reachability.js +2 -0
  343. package/dist/queries/refs.d.ts +2 -2
  344. package/dist/queries/refs.js +1 -1
  345. package/dist/queries/self-audit.d.ts +2 -2
  346. package/dist/queries/self-audit.js +1 -1
  347. package/dist/queries/similar-chains.d.ts +2 -2
  348. package/dist/queries/similar-chains.js +1 -1
  349. package/dist/queries/similar-files.d.ts +2 -2
  350. package/dist/queries/similar-files.js +1 -1
  351. package/dist/queries/similar-signatures.d.ts +2 -2
  352. package/dist/queries/similar-signatures.js +1 -1
  353. package/dist/queries/similar.d.ts +2 -2
  354. package/dist/queries/similar.js +1 -1
  355. package/dist/queries/slice.d.ts +3 -36
  356. package/dist/queries/slice.js +1 -1
  357. package/dist/queries/source-inspection.d.ts +209 -0
  358. package/dist/queries/source-inspection.js +2 -0
  359. package/dist/queries/source-search.d.ts +13 -0
  360. package/dist/queries/source-search.js +2 -0
  361. package/dist/queries/stale-abstractions.d.ts +2 -2
  362. package/dist/queries/stale-abstractions.js +1 -1
  363. package/dist/queries/stats.d.ts +2 -2
  364. package/dist/queries/surface.d.ts +13 -4
  365. package/dist/queries/surface.js +1 -1
  366. package/dist/queries/symbols.d.ts +2 -2
  367. package/dist/queries/symbols.js +1 -1
  368. package/dist/queries/system-map.d.ts +449 -0
  369. package/dist/queries/system-map.js +2 -0
  370. package/dist/queries/system.d.ts +5 -3
  371. package/dist/queries/system.js +1 -1
  372. package/dist/queries/test-quality.d.ts +2 -2
  373. package/dist/queries/test-quality.js +1 -1
  374. package/dist/queries/trace.d.ts +47 -3
  375. package/dist/queries/trace.js +1 -1
  376. package/dist/queries/twin-ab.d.ts +3 -3
  377. package/dist/queries/twin-ab.js +1 -1
  378. package/dist/queries/twin-drift.d.ts +3 -3
  379. package/dist/queries/twin-drift.js +1 -1
  380. package/dist/queries/unused-imports.d.ts +2 -2
  381. package/dist/queries/unused-imports.js +1 -1
  382. package/dist/queries/unused-params.d.ts +2 -2
  383. package/dist/queries/unused-params.js +1 -1
  384. package/dist/queries/value-flow.d.ts +43 -0
  385. package/dist/queries/value-flow.js +2 -0
  386. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  387. package/dist/queries/vue-component-duplicates.js +1 -1
  388. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  389. package/dist/queries/vue-composable-candidates.js +1 -1
  390. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  391. package/dist/queries/vue-large-view-pressure.js +1 -1
  392. package/dist/queries/wrapper-candidates.d.ts +2 -2
  393. package/dist/queries/wrapper-candidates.js +1 -1
  394. package/dist/query-service-fastpath.js +6 -0
  395. package/dist/query-service-server.js +5 -0
  396. package/dist/refs-NBHKL4UQ.js +2 -0
  397. package/dist/refs-pagination-BBVTIHMH.js +2 -0
  398. package/dist/reindex-worker.js +27 -45
  399. package/dist/reindex.d.ts +62 -42
  400. package/dist/reindex.js +32 -33
  401. package/dist/repository-text-C0Q8VYdN.d.ts +19 -0
  402. package/dist/runtime.d.ts +286 -7
  403. package/dist/runtime.js +4 -3
  404. package/dist/rust-semantic-session-server.js +1 -1
  405. package/dist/rust-semantic-session-worker.js +1 -1
  406. package/dist/rust-semantic-worker.js +1 -1
  407. package/dist/{scip-cli-BnEwZRLJ.d.ts → scip-cli-CppzF5MK.d.ts} +33 -2
  408. package/dist/slice-U6S6LBSB.js +2 -0
  409. package/dist/source-search-types-Dwz8KeuW.d.ts +79 -0
  410. package/dist/source-snippet-_wrcgmZc.d.ts +15 -0
  411. package/dist/stats-OOJ74B32.js +2 -0
  412. package/dist/surface-C7SS5CDQ.js +2 -0
  413. package/dist/symbol-resolution-3FVEKDTJ.js +2 -0
  414. package/dist/system-6K2NOO5C.js +2 -0
  415. package/dist/trace-II5K2TMH.js +2 -0
  416. package/dist/typescript-mailbox-worker.js +1 -1
  417. package/dist/value-flow-MKFUUE5B.js +2 -0
  418. package/dist/watch-server.js +3 -2
  419. package/docs/AGENT_GUIDE.md +133 -476
  420. package/docs/AI_FAILURE_MODES.md +30 -301
  421. package/docs/API.md +1 -1
  422. package/docs/API_EVOLUTION.md +6 -0
  423. package/docs/CLI_JSON_OUTPUT.md +207 -29
  424. package/docs/COMMAND_REFERENCE.md +255 -154
  425. package/docs/CONFIGURATION_WRITE_SAFETY.md +14 -13
  426. package/docs/DETECTOR_EVIDENCE_CONTRACTS.md +84 -0
  427. package/docs/DETECTOR_GUIDE.md +46 -138
  428. package/docs/DURABILITY.md +7 -1
  429. package/docs/INDEX_GENERATIONS.md +6 -0
  430. package/docs/LOCK_PROTOCOL.md +8 -0
  431. package/docs/REINDEX_METADATA_COMPATIBILITY.md +13 -3
  432. package/docs/SECURITY_MODEL.md +39 -42
  433. package/docs/accuracy-audit-checklist.md +4 -0
  434. package/docs/accuracy-hardening-goal.md +9 -2
  435. package/docs/analyzer-inventory.md +59 -264
  436. package/docs/analyzer-validation-protocol.md +62 -170
  437. package/docs/architecture-coherence-vision.md +18 -12
  438. package/docs/locality-analyzer-design.md +1 -1
  439. package/docs/schemas/cli-json-envelope.schema.json +212 -27
  440. package/docs/schemas/cli-json-export-receipt.schema.json +25 -0
  441. package/docs/schemas/cli-output-page.schema.json +1 -1
  442. package/docs/schemas/observation-receipt.schema.json +164 -0
  443. package/docs/schemas/project-config.schema.json +27 -45
  444. package/docs/schemas/suppression-record.schema.json +1 -34
  445. package/package.json +65 -8
  446. package/skills/concrete-plan/SKILL.md +8 -0
  447. package/skills/concrete-plan/agents/openai.yaml +4 -0
  448. package/skills/scip-explore/SKILL.md +3 -85
  449. package/skills/scip-explore/agents/openai.yaml +3 -3
  450. package/skills/scip-integrity-audit/SKILL.md +185 -0
  451. package/skills/scip-integrity-audit/agents/openai.yaml +4 -0
  452. package/skills/scip-plan/SKILL.md +67 -49
  453. package/skills/scip-plan/agents/openai.yaml +3 -3
  454. package/skills/scip-query/SKILL.md +77 -77
  455. package/skills/scip-query/agents/openai.yaml +3 -3
  456. package/skills/scip-setup/SKILL.md +10 -102
  457. package/skills/scip-setup/agents/openai.yaml +3 -3
  458. package/dist/chunk-26QA6FAI.js +0 -8
  459. package/dist/chunk-2KAZEZ6M.js +0 -2
  460. package/dist/chunk-3ORVDL3H.js +0 -2
  461. package/dist/chunk-46XGSFNI.js +0 -2
  462. package/dist/chunk-4MAK2HOY.js +0 -6
  463. package/dist/chunk-4TURLRL5.js +0 -16
  464. package/dist/chunk-4UQVNCQE.js +0 -2
  465. package/dist/chunk-55Q3WLZX.js +0 -2
  466. package/dist/chunk-5I5G2QOX.js +0 -3
  467. package/dist/chunk-6LDJQXAH.js +0 -2
  468. package/dist/chunk-6O5TICIZ.js +0 -3
  469. package/dist/chunk-7O5IKBTZ.js +0 -16
  470. package/dist/chunk-7S5E7KWT.js +0 -2
  471. package/dist/chunk-7WPLAODU.js +0 -5
  472. package/dist/chunk-AFHORGLH.js +0 -42
  473. package/dist/chunk-AIE7TFJW.js +0 -9
  474. package/dist/chunk-AQOFWNQJ.js +0 -1
  475. package/dist/chunk-B2PX5I6M.js +0 -2
  476. package/dist/chunk-B75HZHUP.js +0 -2
  477. package/dist/chunk-B7PBSLZN.js +0 -2
  478. package/dist/chunk-BBW6JFHN.js +0 -2
  479. package/dist/chunk-BNXCIFVY.js +0 -2
  480. package/dist/chunk-BS2NMXQZ.js +0 -4
  481. package/dist/chunk-C3KV2II6.js +0 -2
  482. package/dist/chunk-C43RDDP4.js +0 -20
  483. package/dist/chunk-DAFAHMNB.js +0 -42
  484. package/dist/chunk-DQLPXMH6.js +0 -8
  485. package/dist/chunk-EKZTZXHZ.js +0 -117
  486. package/dist/chunk-EW2NTSFA.js +0 -18
  487. package/dist/chunk-F3Z4OUDS.js +0 -8
  488. package/dist/chunk-FJH2NW7J.js +0 -66
  489. package/dist/chunk-FTFP6O3L.js +0 -11
  490. package/dist/chunk-FYLK2DEJ.js +0 -2
  491. package/dist/chunk-GH74ASD6.js +0 -11
  492. package/dist/chunk-GMXWZP2B.js +0 -2
  493. package/dist/chunk-GOUBFH5O.js +0 -3
  494. package/dist/chunk-HLF2TX6R.js +0 -2
  495. package/dist/chunk-HX7M4BDI.js +0 -30
  496. package/dist/chunk-HZ72SESS.js +0 -128
  497. package/dist/chunk-IB2N4FIY.js +0 -10
  498. package/dist/chunk-IZYYAFN5.js +0 -2
  499. package/dist/chunk-JFGGXWQF.js +0 -947
  500. package/dist/chunk-JN4NMBEX.js +0 -8
  501. package/dist/chunk-JW56N3KI.js +0 -4
  502. package/dist/chunk-JZ2OXNWB.js +0 -2
  503. package/dist/chunk-KFZNKUNT.js +0 -2
  504. package/dist/chunk-L5GJNV2T.js +0 -8
  505. package/dist/chunk-L7JDSCDF.js +0 -4
  506. package/dist/chunk-LU47HG23.js +0 -14
  507. package/dist/chunk-LVY7NPF7.js +0 -2
  508. package/dist/chunk-MKCDWWGV.js +0 -4
  509. package/dist/chunk-MNE7YG56.js +0 -2
  510. package/dist/chunk-MRXBEXSY.js +0 -26
  511. package/dist/chunk-MV7OWDUX.js +0 -2
  512. package/dist/chunk-NGEXCJJW.js +0 -11
  513. package/dist/chunk-NIW6JDC5.js +0 -29
  514. package/dist/chunk-PBUQFCNB.js +0 -16
  515. package/dist/chunk-POAVPHH7.js +0 -2
  516. package/dist/chunk-QZ4JVECJ.js +0 -2
  517. package/dist/chunk-RDO52JGY.js +0 -2
  518. package/dist/chunk-RJT3TUUZ.js +0 -2
  519. package/dist/chunk-RVLDN63O.js +0 -4
  520. package/dist/chunk-RXOXSKY3.js +0 -2
  521. package/dist/chunk-S7OYBOCK.js +0 -2
  522. package/dist/chunk-SMNXQT5Z.js +0 -3
  523. package/dist/chunk-SRAFT254.js +0 -2
  524. package/dist/chunk-T7YQSHPQ.js +0 -3
  525. package/dist/chunk-UJCOIXDY.js +0 -2
  526. package/dist/chunk-UJPRPGCO.js +0 -13
  527. package/dist/chunk-WCCFZ7V7.js +0 -113
  528. package/dist/chunk-WUPW3UN3.js +0 -3
  529. package/dist/chunk-X54AGLVX.js +0 -2
  530. package/dist/chunk-Y2MVPNKY.js +0 -5
  531. package/dist/chunk-YKUU5AIC.js +0 -3
  532. package/dist/chunk-YLCJLTPL.js +0 -2
  533. package/dist/chunk-YTQVETEO.js +0 -2
  534. package/dist/chunk-Z4N3MZYA.js +0 -38
  535. package/dist/chunk-ZJOOT3BG.js +0 -2
  536. package/dist/command-descriptors-DSS46KXI.js +0 -642
  537. package/dist/diff-gate-types-B0QYpDv1.d.ts +0 -11
  538. package/dist/direct-navigation-6YHV6IB5.js +0 -3
  539. package/dist/queries/diff-gate.d.ts +0 -253
  540. package/dist/queries/diff-gate.js +0 -2
  541. package/docs/COMMITTED_RECORD_COMPATIBILITY.md +0 -154
  542. package/docs/analyzer-validation-ledger.md +0 -516
  543. package/docs/schemas/outcome-event-record.schema.json +0 -95
  544. package/skills/_shared/SKILL.md +0 -101
  545. package/skills/_shared/agents/openai.yaml +0 -4
  546. package/skills/_shared/references/agent-contract-catalog.md +0 -105
  547. package/skills/_shared/references/command-catalog.md +0 -118
  548. package/skills/_shared/references/detector-precision-and-diffgate.md +0 -59
  549. package/skills/_shared/references/evidence-and-dead-code.md +0 -25
  550. package/skills/scip-audit/SKILL.md +0 -77
  551. package/skills/scip-audit/agents/openai.yaml +0 -4
  552. package/skills/scip-audit/references/claims.md +0 -98
  553. package/skills/scip-audit/references/cleanup.md +0 -100
  554. package/skills/scip-audit/references/directory.md +0 -222
  555. package/skills/scip-audit/references/frontend.md +0 -130
  556. package/skills/scip-audit/references/integrity.md +0 -154
  557. package/skills/scip-audit/references/maintainability.md +0 -162
  558. package/skills/scip-audit/references/twin-drift.md +0 -104
  559. package/skills/scip-diagnose/SKILL.md +0 -52
  560. package/skills/scip-diagnose/agents/openai.yaml +0 -4
  561. package/skills/scip-diagnose/references/debug.md +0 -117
  562. package/skills/scip-diagnose/references/probe-reachability.md +0 -77
  563. package/skills/scip-diagnose/references/root-cause.md +0 -145
  564. package/skills/scip-diagnose/references/triage.md +0 -119
  565. package/skills/scip-explore/references/diagrams.md +0 -40
  566. package/skills/scip-explore/references/language-playbook.md +0 -49
  567. package/skills/scip-improve/SKILL.md +0 -56
  568. package/skills/scip-improve/agents/openai.yaml +0 -4
  569. package/skills/scip-improve/references/cleanup-batches.md +0 -53
  570. package/skills/scip-improve/references/directory-moves.md +0 -53
  571. package/skills/scip-improve/references/doc-reconcile.md +0 -30
  572. package/skills/scip-improve/references/frontend-extraction.md +0 -39
  573. package/skills/scip-improve/references/maintainability-mechanism.md +0 -43
  574. package/skills/scip-improve/references/twin-drift.md +0 -35
  575. package/skills/scip-plan/references/api-impact.md +0 -19
  576. package/skills/scip-plan/references/conductor.md +0 -41
  577. package/skills/scip-plan/references/high-assurance.md +0 -43
  578. package/skills/scip-plan/references/hyper-optimization.md +0 -50
  579. package/skills/scip-plan/references/tla-model.md +0 -88
  580. package/skills/scip-setup/references/bootstrap-workflow.md +0 -119
  581. package/skills/scip-setup/references/language-verification.md +0 -61
  582. package/skills/scip-setup/references/lifecycle-commands.md +0 -119
  583. package/skills/scip-setup/references/per-repo-triage.md +0 -24
  584. package/skills/scip-verify/SKILL.md +0 -229
  585. package/skills/scip-verify/agents/openai.yaml +0 -4
  586. package/skills/scip-verify/references/calibrate-detectors.md +0 -170
@@ -1,8 +0,0 @@
1
- import{e as se,f as ae,g as ce,j as H,k as de,l as U,m as q,q as A,s as le,t as ue,u as fe}from"./chunk-BS2NMXQZ.js";import{i as F,j,k as ie,m as oe}from"./chunk-2KAZEZ6M.js";import{a as re,e as J,f as ne}from"./chunk-C3KV2II6.js";import{createHash as he,randomUUID as Je}from"crypto";import{chmodSync as ye,existsSync as S,linkSync as Fe,lstatSync as C,readdirSync as z,realpathSync as y,unlinkSync as je,writeSync as He}from"fs";import{homedir as Ue}from"os";import{basename as qe,dirname as k,isAbsolute as me,join as u,resolve as I}from"path";import{createRequire as $e}from"module";var De=$e(import.meta.url),ge=Me().version;function Me(){for(let e of["../package.json","../../package.json"])try{return De(e)}catch{}return{version:"0.0.0"}}var xe=1,b=".scip-query-cache-owner.json",We=16*1024,Re=Object.freeze({...H,randomToken:()=>Je(),linkFile:(e,r)=>Fe(e,r),removeFile:e=>je(e),writeFile:(e,r,t,n)=>He(e,r,t,n)});function T(e,r){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${r}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"SCIP_QUERY_UNSAFE_CACHE_PATH",configuredPath:e,reason:r})}function h(e,r){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${r}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"SCIP_QUERY_CACHE_OWNERSHIP",cacheDir:e,reason:r})}function Ve(e,r){let t=y(e),n=process.env.SCIP_QUERY_CACHE_DIR;return n?W(t,I(n)):r?.dbPath?W(t,Ye(t,r.dbPath)):W(t,ze(t))}function Se(){let e=process.env.XDG_CACHE_HOME;return u(e||u(Ue(),".cache"),"scip-query")}function ze(e){let r=I(e);try{r=y(r)}catch{}let t=he("sha256").update(r).digest("hex").slice(0,12);return u(Se(),"projects",t)}function Vt(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let r=u(Se(),"repositories",e);return ve(r),y(r)}function zt(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function Gt(e,r){let t=Ve(e,r);return{cacheDir:t,dbPath:u(t,"index.db"),indexPath:u(t,"index.scip"),metaPath:u(t,"meta.json")}}function W(e,r,t=Re){return Ge(e,r,t).cacheDir}function Ge(e,r,t=Re){let n=y(e),o=S(r)?"synced":ve(r,t),i=y(r),s=u(i,b);if(S(s))return V(n,i),G(s),v(i),{kind:"existing",cacheDir:i};pe(i),et(i),pe(i);let d=`${JSON.stringify({schemaVersion:xe,canonicalProjectRoot:n,canonicalCacheDir:i,creatorVersion:ge},null,2)}
2
- `;try{let l=tt(s,d,t),f=q(o,l);return{kind:"published",cacheDir:i,achievedDurability:f==="synced"?"directory-durable":"file-flushed",directorySync:f}}catch(l){if(nt(l))return V(n,i),{kind:"existing",cacheDir:i};throw l}}function V(e,r){let t=y(e),n=y(r);return Ke(n,t,n)}function Yt(e,r){return S(u(r,b))?(V(e,r),we(r),!0):!1}function Ye(e,r){let t;try{t=ne(r)}catch(s){throw s instanceof re?T(r,s.reason):s}let n=I(e,...t.split("/"));if(n===e||!J(e,n))throw T(r,"outside-project");let o=Xe(n),i=y(o);if(!J(e,i)&&i!==e)throw T(r,"symlink-escape");return n}function Xe(e){let r=e;for(;!S(r);){let t=k(r);if(t===r)throw T(e,"no-existing-ancestor");r=t}return r}function Ke(e,r,t){let n=u(e,b);if(!S(n)||C(n).isSymbolicLink())throw h(e,"missing regular ownership record");let o=C(n);if(!o.isFile()||o.size>We)throw h(e,"invalid ownership record file");let i=oe(n,"cache ownership record"),s=Qe(i,e);if(s.canonicalProjectRoot!==r)throw h(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==t)throw h(e,"ownership record names a different cache directory");return{record:s,ownerSha256:he("sha256").update(i).digest("hex"),physicalCacheDir:e}}function Qe(e,r){try{let t=JSON.parse(e);if(t.schemaVersion!==xe||typeof t.canonicalProjectRoot!="string"||typeof t.canonicalCacheDir!="string"||typeof t.creatorVersion!="string"||!me(t.canonicalProjectRoot)||!me(t.canonicalCacheDir))throw new Error("invalid fields");return t}catch(t){throw h(r,`malformed ownership record: ${t instanceof Error?t.message:String(t)}`)}}function pe(e){let r=z(e).filter(t=>t!==b&&!Ze(t));if(r.length>0)throw h(e,`unrecognized existing entries: ${r.slice(0,3).join(", ")}`)}function Ze(e){return e.startsWith(`${b}.tmp-`)||[".scipquery-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function et(e){for(let r of z(e)){let t=u(e,r),n=C(t);if(n.isSymbolicLink())throw h(e,`legacy cache entry ${r} is a symlink`);if(n.isDirectory())v(t);else if(n.isFile())G(t);else throw h(e,`legacy cache entry ${r} is not a file or directory`)}v(e)}function we(e){let r=C(e);if(r.isSymbolicLink())throw h(e,"managed cache tree contains a symlink");if(r.isFile()){G(e);return}if(!r.isDirectory())throw h(e,"managed cache tree contains a special file");v(e);for(let t of z(e))we(u(e,t))}function ve(e,r=H){let t=de(e,r);return v(e),t}function tt(e,r,t){let n=`${e}.tmp-${process.pid}-${t.randomToken()}`,o,i=!1;try{o=t.openFile(n,"wx",384),i=!0,ae(o,Buffer.from(r),t,"cache ownership record"),t.syncFile(o),t.closeFile(o),o=void 0,t.linkFile(n,e);let s=U(k(e),t);return t.removeFile(n),i=!1,q(s,U(k(e),t))}finally{if(o!==void 0)try{t.closeFile(o)}catch{}if(i)try{t.removeFile(n)}catch{}}}function v(e){process.platform!=="win32"&&ye(e,448)}function G(e){process.platform!=="win32"&&ye(e,384)}function rt(e){if(S(e))return y(e);let r=y(k(e));return u(r,qe(e))}function Xt(e){return rt(I(e))}function nt(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{execFileSync as be}from"child_process";import{createRequire as it}from"module";import{existsSync as ot}from"fs";import{platform as P,arch as Pe}from"os";var O="v0.8.1",Y="https://github.com/sourcegraph/scip",_=`github.com/sourcegraph/scip/cmd/scip@${O}`,Oe=it(import.meta.url),Ee="SCIP_QUERY_SCIP_BIN";function st(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let r=e.env[Ee];if(r&&e.fileExists(r))return{source:"env",path:r};if(e.platform==="win32"){let t=e.resolveSidecar(e.arch);if(t&&e.fileExists(t))return{source:"sidecar",path:t}}return null}function at(e){for(let r of e==="arm64"?["arm64","x64"]:[e])try{return Oe.resolve(`scip-query-scip-windows/scip-win32-${r}.exe`)}catch{}return null}function X(e=process.env){let r=st({platform:P(),arch:Pe(),env:e,isOnPath:A,fileExists:ot,resolveSidecar:at});return r?.source==="path"?le("scip")??r.path:r?.path??null}function nr(){return X()!==null}function ct(){let e=X();if(!e)return null;try{return be(e,["--version"],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function dt(){let e=P(),r=Pe(),t,n,o;switch(e){case"darwin":t="darwin",o="tar.gz";break;case"linux":t="linux",o="tar.gz";break;default:return null}switch(r){case"arm64":n="arm64";break;case"x64":n="amd64";break;default:return null}let i=`scip-${t}-${n}.${o}`;return{url:`${Y}/releases/download/${O}/${i}`,filename:i}}function ir(){let e=dt();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),P()==="darwin"||P()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${_}
3
- `),console.log("Or download that exact release manually:");else if(P()==="win32"){let r=lt();console.log("On Windows the scip binary ships via the npm sidecar package scip-query-scip-windows,"),console.log("installed automatically with scip-query. If it is missing:"),console.log(` npm install -g ${r}`),console.log(`Or set ${Ee} to a local scip.exe path.
4
- `),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
5
- `:` ${Y}/releases/tag/${O}
6
- `),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function lt(){let r=Oe("../../package.json").optionalDependencies?.["scip-query-scip-windows"];if(!r||!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(r))throw new Error("scip-query package metadata does not declare an exact Windows sidecar version.");return`scip-query-scip-windows@${r}`}function or(e){if(A("go")){e(`Installing immutable ${_} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(be("go",["install",_],{stdio:"inherit",timeout:3e5,env:process.env}),A("scip")){let r=X(),t=ct();if(r&&t&&t.includes(O))return e(`Successfully installed ${_}; resolved executable: ${r}; reported version: ${t}.`),!0;e(`go install completed, but the resolved scip executable did not report ${O} (executable: ${r??"unresolved"}; version: ${t??"unavailable"}).`)}}catch(r){let t=r instanceof Error?r.message:String(r);e(`go install failed: ${t}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${Y}/releases`),!1}import{statSync as Et}from"fs";import{dirname as Bt,join as At}from"path";import{appendFileSync as ut,existsSync as ft,mkdirSync as gt,renameSync as mt,rmSync as pt,statSync as ht,truncateSync as yt}from"fs";import{basename as xt,dirname as Rt}from"path";var Z=".previous",St=".rotation.lock",wt=2e3,K=class extends Error{constructor(t,n){super(`Timed out after ${n}ms waiting for rotating JSONL lock: ${t}`);this.lockPath=t;this.timeoutMs=n;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},Q=class extends Error{constructor(t){super(`Rotating JSONL lock ownership changed before release: ${t}`);this.lockPath=t;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},vt=Object.freeze({monotonicNow:se,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,r){let t=ce(e,{kind:"rotating-jsonl",detail:{target:xt(r)}});return t.kind==="acquired"?{kind:"acquired",lock:t.lock}:{kind:"contended"}},makeDirectory(e){gt(e,{recursive:!0})},exists:ft,readBytes(e){return ie(e,{maxBytes:F,inputKind:"rotating JSONL segment"})},size(e){return ht(e).size},truncate:yt,remove(e){pt(e,{force:!0})},rename:mt,append:ut});function Be(e,r,t){let n=t.runtime??vt,o=JSON.stringify(r);if(o===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let i=Buffer.from(`${o}
7
- `),s=Math.max(1,Math.floor(t.maxSegmentBytes),i.length);return bt(e,t.lockTimeoutMs,n,()=>{n.makeDirectory(Rt(e));let m=Pt(e,F,n);t.onPhase?.("tail-repaired");let d=`${e}${t.previousSuffix??Z}`,l=!1,f=!1;return n.exists(e)&&n.size(e)+i.length>s&&(n.exists(d)&&(n.remove(d),f=!0),t.onPhase?.("previous-pruned"),n.rename(e,d),l=!0,t.onPhase?.("current-rotated")),n.append(e,i),t.onPhase?.("record-appended"),{lineBytes:i.length,segmentLimitBytes:s,repairedTailBytes:m,rotated:l,prunedPrevious:f}})}function bt(e,r,t,n){let o=`${e}${St}`,i=Math.max(0,r??wt),s=t.monotonicNow()+i,m;for(;;){let p=t.tryAcquireLock(o,e);if(p.kind==="acquired"){m=p.lock;break}let g=s-t.monotonicNow();if(g<=0)throw new K(o,i);t.wait(Math.min(5,g))}let d=!1,l,f;try{f=n()}catch(p){d=!0,l=p}let R=!1;try{R=m.release()}catch(p){if(!d)throw p}if(d)throw l;if(!R)throw new Q(o);return f}function Pt(e,r,t){if(!t.exists(e))return 0;let n=Ot(e,r,t);if(n.length===0||n[n.length-1]===10)return 0;let o=n.lastIndexOf(10),i=o<0?0:o+1;return t.truncate(e,i),n.length-i}function Ot(e,r,t){let n=t.size(e);if(n>r)throw new j("rotating JSONL segment",e,"too-large",n,r);let o=t.readBytes(e),i=t.size(e);if(i!==n||o.byteLength!==n)throw new j("rotating JSONL segment",e,"changed-during-read",i,r);return o}var Tt="reindex-activity.jsonl",Ct=Z,kt=1024*1024,yr=1440*60*1e3;function Te(e){return At(Bt(e),Tt)}function It(e){if(e.reused)return 0;let r=Ae(e.indexPath)+Ae(e.dbPath);for(let t of e.shards??[])!t.reused&&t.outputBytes!==null&&(r+=t.outputBytes);return r}function xr(e,r){let t=r.lastRefresh;return t?Ce(Te(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:t.result,durationMs:t.durationMs,estimatedLogicalOutputBytes:It(r)}):{state:"failed",reason:"reindex result has no refresh metadata"}}function Rr(e,r){return Ce(Te(e),{version:1,event:"run",recordedAt:r.completedAt,trigger:r.trigger,result:"failed",durationMs:r.durationMs,estimatedLogicalOutputBytes:0})}function _t(e,r,t=kt,n){Be(e,r,{maxSegmentBytes:t,previousSuffix:Ct,...n?{runtime:n}:{}})}function Ce(e,r){try{return _t(e,r),{state:"recorded"}}catch(t){return{state:"failed",reason:t instanceof Error?t.message:String(t)}}}function Ae(e){try{return Et(e).size}catch{return 0}}import{spawn as Lt}from"child_process";import{platform as ke}from"os";import{performance as Ie}from"perf_hooks";var Or={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},B=class extends Error{constructor(t,n,o,i={}){super(o,i.cause===void 0?void 0:{cause:i.cause});this.kind=t;this.label=n;this.name="BoundedProcessError",this.timedOut=i.timedOut??!1,this.reaped=i.reaped??!1,this.stdout=i.stdout??"",this.stderr=i.stderr??"",this.stdoutTruncated=i.stdoutTruncated??!1,this.stderrTruncated=i.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function E(e,r){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${r} must be a positive finite number.`)}function _e(e,r,t,n){let o=Math.max(0,n-t);o>0&&e.push(r.subarray(0,o))}function Le(e,r,t){let n=Buffer.concat([...e,r]);e.length=0,e.push(n.subarray(Math.max(0,n.length-t)))}function Er(e){E(e.timeoutMs,"timeoutMs"),E(e.maxStdoutBytes,"maxStdoutBytes"),E(e.maxStderrBytes,"maxStderrBytes");let r=e.terminationGraceMs??1e3;E(r,"terminationGraceMs");let t=e.terminationForceMs??r;return E(t,"terminationForceMs"),new Promise((n,o)=>{let i=Ie.now(),s;try{let a=ke()!=="win32";s=Lt(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:a?!0:e.detached,stdio:["pipe","pipe","pipe"]})}catch(a){o(new B("spawn",e.label,`${e.label} could not start.`,{cause:a,reaped:!0}));return}let m=[],d=[],l=0,f=0,R=!1,p=!1,g=null,x=!1,Ne=ke()!=="win32",ee=s.pid===void 0?null:ue(s.pid,Ne),L=()=>{clearTimeout(te),e.signal?.removeEventListener("abort",$)},N=a=>{if(x||!g)return;x=!0,L();let c=Buffer.concat(m).toString("utf8"),D=Buffer.concat(d).toString("utf8"),M=a.reaped||!a.detail?"":` Process-tree cleanup failed: ${a.detail}`;o(new B(g.kind,e.label,`${g.message}${M}`,{timedOut:g.timedOut,reaped:a.reaped,stdout:c,stderr:D,stdoutTruncated:R,stderrTruncated:p}))},w=a=>{if(!(g||x)){if(g=a,!ee){N({reaped:s.pid===void 0,reason:s.pid===void 0?"terminated":"identity-unavailable"});return}fe(ee,{gracefulMs:r,forceMs:t}).then(N,c=>{N({reaped:!1,reason:"signal-failed",detail:c instanceof Error?c.message:String(c)})})}},te=setTimeout(()=>{w({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);te.unref();let $=()=>{w({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",$,{once:!0}),e.signal?.aborted&&$(),s.stdout.on("data",a=>{let c=Buffer.isBuffer(a)?a:Buffer.from(a);e.outputLimitBehavior==="truncate-tail"?Le(m,c,e.maxStdoutBytes):_e(m,c,l,e.maxStdoutBytes),l+=c.length,l>e.maxStdoutBytes&&(R=!0,e.outputLimitBehavior!=="truncate-tail"&&w({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),s.stderr.on("data",a=>{let c=Buffer.isBuffer(a)?a:Buffer.from(a);e.outputLimitBehavior==="truncate-tail"?Le(d,c,e.maxStderrBytes):_e(d,c,f,e.maxStderrBytes),f+=c.length,f>e.maxStderrBytes&&(p=!0,e.outputLimitBehavior!=="truncate-tail"&&w({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),s.on("error",a=>{if(!x&&!g){if(s.pid===void 0){L(),x=!0,o(new B("spawn",e.label,`${e.label} could not start: ${a.message}`,{cause:a,reaped:!0}));return}w({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${a.message}`})}}),s.on("close",(a,c)=>{if(x||g)return;x=!0,L();let D=Buffer.concat(m).toString("utf8"),M=Buffer.concat(d).toString("utf8");n({status:a,signal:c,stdout:D,stderr:M,timedOut:!1,durationMs:Ie.now()-i,stdoutTruncated:R,stderrTruncated:p})}),e.input===void 0?s.stdin.end():s.stdin.end(e.input)})}export{ge as a,ze as b,Vt as c,zt as d,Gt as e,Yt as f,Xt as g,X as h,nr as i,ct as j,ir as k,or as l,Z as m,Be as n,Tt as o,xr as p,Rr as q,Or as r,B as s,Er as t};
8
- //# sourceMappingURL=chunk-JN4NMBEX.js.map
@@ -1,4 +0,0 @@
1
- import{a as M}from"./chunk-ZTETIQ35.js";import{c as C}from"./chunk-4TURLRL5.js";import{b as f,c as I}from"./chunk-UJCOIXDY.js";import{h as d}from"./chunk-HX7M4BDI.js";import{d as h}from"./chunk-MTDBHTSF.js";import{d as g}from"./chunk-EKZTZXHZ.js";import{f as y}from"./chunk-UJPRPGCO.js";var x=new Set(h());function N(e,n){let{scope:o,minLoc:r=10,limit:i=30,scanLimit:t}=n??{},s=new I(e);return M({candidates:()=>s.productionCallableDefinitions({scope:o,minLoc:r,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof t=="number"&&t>0}),scanLimit:t,filterCandidate:S,profile:{name:"complexity-hotspots"},prepare:a=>{let l=B(e,a),m=n?.semantic!==!1,c=m?d(e):null;c?.materializeReferences(a,{prefetchCallees:!0});let u=s.crossFileCallerMap(a,{semantic:!1});return{callerMap:c?f(u,c.callerMap(a)):u,calleeMap:s.calleeMap(a,{semantic:m}),languageByFile:l,clojureCallableIds:D(e,a,l),branchEstimates:C(e,a)}},evaluate:(a,l)=>L(a,l,r),orderResults:(a,l)=>l.score-a.score||l.loc-a.loc,limit:i})}function S(e){return e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&x.has(e.kind):!0}function L(e,n,o){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let r=e.endLine-e.startLine+1;if(r<o)return null;let i=n.callerMap.get(e.symbolId)?.size??0,t=n.calleeMap.get(e.symbolId)??[],s=new Set,a=new Set;for(let p of t){let b=`${p.symbol}|${p.file}`;s.add(b),p.file!==e.relativePath&&a.add(b)}let l=a.size,m=s.size,c=n.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},u=c.branches+1;return{symbol:e.symbol,shortName:g(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r,fanIn:i,fanOut:l,calleeCount:m,branches:c.branches,estimateBasis:c.estimateBasis,score:Math.round(r/50*(i/5)*Math.max(l/5,1)*Math.max(u/5,1)*100)/100}}function B(e,n){let o=[...new Set(n.map(t=>t.relativePath))];if(o.length===0)return new Map;let r=o.map(()=>"?").join(", "),i=e.all(`SELECT relative_path, language
2
- FROM documents
3
- WHERE relative_path IN (${r})`,...o);return new Map(i.map(t=>[t.relative_path,t.language?.toLowerCase()??null]))}function D(e,n,o){let r=new Set,i=new Map;for(let t of n){if(o.get(t.relativePath)!=="clojure")continue;let s=i.get(t.relativePath);s||(s=new Set((y(e,t.relativePath)?.callables??[]).map(a=>`${a.name}:${a.startLine}`)),i.set(t.relativePath,s)),s.has(`${t.leaf}:${t.startLine}`)&&r.add(t.symbolId)}return r}export{N as a};
4
- //# sourceMappingURL=chunk-JW56N3KI.js.map
@@ -1,2 +0,0 @@
1
- import{c as P}from"./chunk-UJCOIXDY.js";import{n as O,o as C}from"./chunk-7O5IKBTZ.js";import{h as x,k as v,o as T}from"./chunk-HX7M4BDI.js";import{d as A}from"./chunk-EKZTZXHZ.js";import{f as b}from"./chunk-UJPRPGCO.js";import{x as g}from"./chunk-GH74ASD6.js";function U(e,n={}){let{samples:o=50,scope:r,maxDisagreements:u=5}=n,l=new P(e),a=K(l.productionCallableDefinitions({scope:r,minLoc:2,requireFunctionLikeSymbol:!0}),o),c=z(e,a);if(a.length===0||!c)return{available:!1,sampleSize:a.length,oracleCoverage:0,scores:[],topDisagreements:[]};let t={references:Q(),callees:Q()},i=[],f=0,m=c==="semantic"?T(e,a):new Map,I=c==="source"?_(e,l,a):null;for(let s of a){let p=S(s,c==="semantic"?v(e,s).map(d=>d.file):[...I?.referencesBySymbolId.get(s.symbolId)??[]]),L=S(s,c==="semantic"?(m.get(s.symbolId)??[]).map(d=>d.file):[...I?.calleesBySymbolId.get(s.symbolId)??[]]);f+=1;let k=S(s,O(e,s,{semanticEvidence:C}).map(d=>d.file)),w=S(s,(l.calleeMap([s],{semantic:!1}).get(s.symbolId)??[]).map(d=>d.file)),R=y(c,"references"),B=y(c,"callees");M(t.references,s,"references",k,p,R,i),M(t.callees,s,"callees",w,L,B,i)}return i.sort((s,p)=>p.cheapOnly.length+p.oracleOnly.length-(s.cheapOnly.length+s.oracleOnly.length)),{available:!0,sampleSize:a.length,oracleCoverage:a.length>0?D(f/a.length):0,oracleKind:c,scores:["references","callees"].map(s=>F(s,t[s],c)),topDisagreements:i.slice(0,u)}}function Q(){return{comparedSymbols:0,agreed:0,cheapTotal:0,oracleTotal:0,skippedOraclePartial:0}}function K(e,n){let o=[...e].sort((l,a)=>l.symbolId-a.symbolId);if(o.length<=n)return o;let r=o.length/n,u=[];for(let l=0;l<n;l++)u.push(o[Math.floor(l*r)]);return u}function z(e,n){let o=n[0];if(!o)return null;if(h(e,o))return"source";try{if(x(e).capability("semantic-references",o.relativePath).available)return"semantic"}catch{}return n.some(r=>h(e,r))?"source":null}function S(e,n){let o=new Set;for(let r of n)r!==e.relativePath&&o.add(r);return o}function M(e,n,o,r,u,l,a){if(!l&&u.size===0){e.skippedOraclePartial+=1;return}e.comparedSymbols+=1,e.cheapTotal+=r.size,e.oracleTotal+=u.size;let c=[],t=[];for(let i of r)u.has(i)?e.agreed+=1:c.push(i);for(let i of u)r.has(i)||t.push(i);(c.length>0||t.length>0)&&a.push({symbol:A(n.symbol),question:o,cheapOnly:c,oracleOnly:t})}var E={references:!0,callees:!1};function F(e,n,o){let r=n.oracleTotal>0?n.agreed/n.oracleTotal:1,u=n.cheapTotal-n.agreed,l=y(o,e);return{question:e,comparedSymbols:n.comparedSymbols,precision:l&&n.cheapTotal>0?D(n.agreed/n.cheapTotal):null,recall:D(r),unverified:u,skippedOraclePartial:n.skippedOraclePartial}}function y(e,n){return e==="semantic"?E[n]:!1}function h(e,n){return g(n.relativePath)==="clojure"&&b(e,n.relativePath)!==null}function _(e,n,o){let r=new Map,u=new Map,l=o.filter(t=>h(e,t)),a=new Map;for(let t of l){let i=a.get(t.leaf)??[];i.push(t),a.set(t.leaf,i)}for(let t of n.sourceFiles()){if(g(t)!=="clojure")continue;let i=b(e,t);if(i)for(let f of i.fileIdentifiers)for(let m of a.get(f)??[])j(r,m.symbolId,t)}let c=new Map;for(let t of n.scopedDefinitions()){if(g(t.relativePath)!=="clojure")continue;let i=c.get(t.leaf)??[];i.push(t),c.set(t.leaf,i)}for(let t of l){let i=b(e,t.relativePath);if(i){for(let f of i.callSites)if(!(f.line<t.startLine||f.line>t.endLine))for(let m of c.get(f.calleeLeaf)??[])j(u,t.symbolId,m.relativePath)}}return{referencesBySymbolId:r,calleesBySymbolId:u}}function j(e,n,o){let r=e.get(n);if(r){r.add(o);return}e.set(n,new Set([o]))}function D(e){return Math.round(e*1e3)/1e3}export{U as a};
2
- //# sourceMappingURL=chunk-JZ2OXNWB.js.map
@@ -1,2 +0,0 @@
1
- import{execFileSync as c,spawnSync as A}from"child_process";import{platform as f}from"os";var u=f()==="win32";function r(e){let n=u?"where":"which";try{return c(n,[e],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var h=/\.(?:c|m)?js$/i,S=/\.(?:exe|com)$/i;function R(e,n){return h.test(e)?{binary:process.execPath,args:[e,...n]}:{binary:e,args:[...n]}}function y(e,n){return c(e,n,{stdio:["ignore","pipe","ignore"],encoding:"utf8",timeout:1e4,killSignal:"SIGKILL"})}function p(e,n={}){let t=n.isWindows??u,m=n.lookup??y,l;try{l=m(t?"where":"which",[e])}catch{return null}let a=l.split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return t?a.find(i=>S.test(i))??null:a[0]??null}import{execFileSync as g}from"child_process";import{createRequire as w}from"module";import{existsSync as x}from"fs";import{platform as v,arch as b}from"os";var s="v0.8.1",I="https://github.com/sourcegraph/scip",o=`github.com/sourcegraph/scip/cmd/scip@${s}`,$=w(import.meta.url),P="SCIP_QUERY_SCIP_BIN";function E(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let n=e.env[P];if(n&&e.fileExists(n))return{source:"env",path:n};if(e.platform==="win32"){let t=e.resolveSidecar(e.arch);if(t&&e.fileExists(t))return{source:"sidecar",path:t}}return null}function _(e){for(let n of e==="arm64"?["arm64","x64"]:[e])try{return $.resolve(`scip-query-scip-windows/scip-win32-${n}.exe`)}catch{}return null}function d(e=process.env){let n=E({platform:v(),arch:b(),env:e,isOnPath:r,fileExists:x,resolveSidecar:_});return n?.source==="path"?p("scip")??n.path:n?.path??null}function B(){let e=d();if(!e)return null;try{return g(e,["--version"],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function W(e){if(r("go")){e(`Installing immutable ${o} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(g("go",["install",o],{stdio:"inherit",timeout:3e5,env:process.env}),r("scip")){let n=d(),t=B();if(n&&t&&t.includes(s))return e(`Successfully installed ${o}; resolved executable: ${n}; reported version: ${t}.`),!0;e(`go install completed, but the resolved scip executable did not report ${s} (executable: ${n??"unresolved"}; version: ${t??"unavailable"}).`)}}catch(n){let t=n instanceof Error?n.message:String(n);e(`go install failed: ${t}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${I}/releases`),!1}export{r as a,R as b,p as c,d,W as e};
2
- //# sourceMappingURL=chunk-KFZNKUNT.js.map
@@ -1,8 +0,0 @@
1
- import{a as U,b as G}from"./chunk-IZYYAFN5.js";import{b as w,d as a,f as N,n as z}from"./chunk-AIE7TFJW.js";import{a as V,b as D}from"./chunk-MNE7YG56.js";import{d as A,e as _,f as j,h as v}from"./chunk-46XGSFNI.js";import{statSync as Ae}from"fs";import{dirname as ve,join as we}from"path";import{appendFileSync as ue,existsSync as ce,mkdirSync as le,renameSync as fe,rmSync as me,statSync as pe,truncateSync as ge}from"fs";import{basename as ye,dirname as xe}from"path";var B=".previous",Re=".rotation.lock",be=2e3,C=class extends Error{constructor(r,n){super(`Timed out after ${n}ms waiting for rotating JSONL lock: ${r}`);this.lockPath=r;this.timeoutMs=n;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},J=class extends Error{constructor(r){super(`Rotating JSONL lock ownership changed before release: ${r}`);this.lockPath=r;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},H=Object.freeze({monotonicNow:V,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let r=z(e,{kind:"rotating-jsonl",detail:{target:ye(t)}});return r.kind==="acquired"?{kind:"acquired",lock:r.lock}:{kind:"contended"}},makeDirectory(e){le(e,{recursive:!0})},exists:ce,readBytes(e){return j(e,{maxBytes:A,inputKind:"rotating JSONL segment"})},size(e){return pe(e).size},truncate:ge,remove(e){me(e,{force:!0})},rename:fe,append:ue});function K(e,t,r){let n=r.runtime??H,o=JSON.stringify(t);if(o===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let s=Buffer.from(`${o}
2
- `),i=Math.max(1,Math.floor(r.maxSegmentBytes),s.length);return Y(e,r.lockTimeoutMs,n,()=>{n.makeDirectory(xe(e));let f=Se(e,A,n);r.onPhase?.("tail-repaired");let u=`${e}${r.previousSuffix??B}`,l=!1,c=!1;return n.exists(e)&&n.size(e)+s.length>i&&(n.exists(u)&&(n.remove(u),c=!0),r.onPhase?.("previous-pruned"),n.rename(e,u),l=!0,r.onPhase?.("current-rotated")),n.append(e,s),r.onPhase?.("record-appended"),{lineBytes:s.length,segmentLimitBytes:i,repairedTailBytes:f,rotated:l,prunedPrevious:c}})}function X(e,t={}){let r=t.runtime??H,n=he(t.maxSegmentBytes);return Y(e,t.lockTimeoutMs,r,()=>{let o=[],s=0,i=`${e}${t.previousSuffix??B}`;for(let f of[i,e]){if(!r.exists(f))continue;let u=Te(Q(f,n,r));o.push(...u.lines),s+=u.partialTailBytes}return{lines:o,ignoredPartialTailBytes:s}})}function Y(e,t,r,n){let o=`${e}${Re}`,s=Math.max(0,t??be),i=r.monotonicNow()+s,f;for(;;){let x=r.tryAcquireLock(o,e);if(x.kind==="acquired"){f=x.lock;break}let y=i-r.monotonicNow();if(y<=0)throw new C(o,s);r.wait(Math.min(5,y))}let u=!1,l,c;try{c=n()}catch(x){u=!0,l=x}let R=!1;try{R=f.release()}catch(x){if(!u)throw x}if(u)throw l;if(!R)throw new J(o);return c}function Se(e,t,r){if(!r.exists(e))return 0;let n=Q(e,t,r);if(n.length===0||n[n.length-1]===10)return 0;let o=n.lastIndexOf(10),s=o<0?0:o+1;return r.truncate(e,s),n.length-s}function he(e){let t=e??A;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function Q(e,t,r){let n=r.size(e);if(n>t)throw new _("rotating JSONL segment",e,"too-large",n,t);let o=r.readBytes(e),s=r.size(e);if(s!==n||o.byteLength!==n)throw new _("rotating JSONL segment",e,"changed-during-read",s,t);return o}function Te(e){let t=e.lastIndexOf(10),r=t<0?0:t+1;return{lines:e.subarray(0,r).toString("utf8").split(`
3
- `).filter(o=>o.length>0),partialTailBytes:e.length-r}}var Be="reindex-activity.jsonl",W=B,Ee=1024*1024,Pe=1440*60*1e3,Z=e=>v(e,"reindex activity segment");function E(e){return we(ve(e),Be)}function Oe(e){if(e.reused)return 0;let t=ee(e.indexPath)+ee(e.dbPath);for(let r of e.shards??[])!r.reused&&r.outputBytes!==null&&(t+=r.outputBytes);return t}function lt(e,t){let r=t.lastRefresh;return r?F(E(e),{version:1,event:"run",recordedAt:r.completedAt,trigger:r.trigger,result:r.result,durationMs:r.durationMs,estimatedLogicalOutputBytes:Oe(t)}):{state:"failed",reason:"reindex result has no refresh metadata"}}function ft(e,t){return F(E(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function mt(e,t,r=new Date){return F(E(e),{version:1,event:"suppressed",recordedAt:r.toISOString(),trigger:t,reason:"completed-index-is-fresh"})}function ke(e,t,r=Ee,n){K(e,t,{maxSegmentBytes:r,previousSuffix:W,...n?{runtime:n}:{}})}function pt(e,t=new Date,r=Pe,n=Z){let o=t.getTime(),s=o-r,i={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(s).toISOString(),windowEndedAt:t.toISOString(),runs:0,rebuilt:0,reused:0,failed:0,suppressed:0,estimatedLogicalOutputBytes:0,byTrigger:{}},f=E(e),u=[];if(n===Z)try{let l=X(f,{previousSuffix:W});u=l.lines,i.ignoredPartialTailBytes=l.ignoredPartialTailBytes}catch{i.readErrors+=1,i.confidence="unavailable"}else{let l=0;for(let c of[`${f}${W}`,f])try{u.push(...Me(n(c))),l+=1}catch{i.readErrors+=1}l===0?i.confidence="unavailable":i.readErrors>0&&(i.confidence="partial")}for(let l of u){i.recordsRead+=1;let c=Le(l);if(!c){i.invalidRecords+=1,i.confidence!=="unavailable"&&(i.confidence="partial");continue}let R=Date.parse(c.recordedAt);if(R<s||R>o){i.skippedRecords+=1;continue}if(i.byTrigger[c.trigger.kind]=(i.byTrigger[c.trigger.kind]??0)+1,c.event==="suppressed"){i.suppressed+=1;continue}i.runs+=1,i[c.result]+=1,i.estimatedLogicalOutputBytes+=c.estimatedLogicalOutputBytes}return i.ignoredPartialTailBytes>0&&i.confidence!=="unavailable"&&(i.confidence="partial"),i}function F(e,t){try{return ke(e,t),{state:"recorded"}}catch(r){return{state:"failed",reason:r instanceof Error?r.message:String(r)}}}function Le(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let r=t;return r.version!==1||!w(r.recordedAt)||!r.trigger||!Ie(r.trigger.kind)?null:r.event==="suppressed"?r.reason==="completed-index-is-fresh"?r:null:r.event!=="run"||r.result!=="rebuilt"&&r.result!=="reused"&&r.result!=="failed"||!N(r.durationMs)||!N(r.estimatedLogicalOutputBytes)?null:r}catch{return null}}function Ie(e){return e==="manual-cli"||e==="setup"||e==="watch-source"||e==="watch-startup"||e==="watch-demand"||e==="watch-git-head"||e==="watch-git-index"||e==="watch-git-state"||e==="unknown"}function ee(e){try{return Ae(e).size}catch{return 0}}function Me(e){return e.endsWith(`
4
- `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
5
- `)+1))),e.split(`
6
- `).filter(t=>t.length>0)}import{join as P}from"path";var St=5;var _e="watch.lock",Ne="watch-state.json",Ce="watch-activity.json",Je="watch-refresh-requests";function ht(e){return{lockPath:P(e,_e),statePath:P(e,Ne),activityPath:P(e,Ce),refreshRequestsPath:P(e,Je)}}function Tt(e){try{return We(JSON.parse(v(e,"watch service state")))}catch{return null}}function We(e){if(!e||typeof e!="object")return null;let t=e;if(t.version!==1||typeof t.protocolVersion!="number"||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||t.worktreeId!==void 0&&(typeof t.worktreeId!="string"||t.worktreeId.length===0)||typeof t.cliVersion!="string"||!g(t.startedAt)||!g(t.heartbeatAt)||!g(t.lastActivityAt)||!Fe(t.watcher)||t.idleDeadlineAt!==void 0&&!g(t.idleDeadlineAt))return null;if(t.processIdentity!==void 0){let r=D(t.processIdentity);if(!r||r.pid!==t.pid)return null;t.processIdentity=r}return t.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(t.indexGeneration)||t.lastError!==void 0&&!qe(t.lastError)||t.lastRefresh!==void 0&&!$e(t.lastRefresh)||t.reindexActivity!==void 0&&!je(t.reindexActivity)||t.refreshRequests!==void 0&&!Ve(t.refreshRequests)||t.typescriptSemantic!==void 0&&!De(t.typescriptSemantic)||t.typescriptIndex!==void 0&&!ze(t.typescriptIndex)?null:t}function g(e){return w(e)}function Fe(e){if(!e||typeof e!="object"||!("state"in e))return!1;let t=e;switch(t.state){case"idle":return!0;case"waiting":return p(t.changedFiles)&&p(t.reindexAt);case"indexing":return p(t.startedAt);case"cooldown":return p(t.until)&&typeof t.dirty=="boolean";case"draining":return p(t.startedAt)&&typeof t.reason=="string";default:return!1}}function qe(e){if(!e||typeof e!="object")return!1;let t=e;return g(t.at)&&typeof t.message=="string"}function $e(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.trigger?.kind=="string"&&typeof t.result=="string"&&g(t.startedAt)&&g(t.completedAt)&&p(t.durationMs)}function je(e){if(!e||typeof e!="object")return!1;let t=e;return t.confidence!==void 0&&t.confidence!=="complete"&&t.confidence!=="partial"&&t.confidence!=="unavailable"||t.recordsRead!==void 0&&!a(t.recordsRead)||t.invalidRecords!==void 0&&!a(t.invalidRecords)||t.skippedRecords!==void 0&&!a(t.skippedRecords)||t.readErrors!==void 0&&!a(t.readErrors)||t.ignoredPartialTailBytes!==void 0&&!a(t.ignoredPartialTailBytes)||!g(t.windowStartedAt)||!g(t.windowEndedAt)||!a(t.runs)||!a(t.rebuilt)||!a(t.reused)||!a(t.failed)||!a(t.suppressed)||!p(t.estimatedLogicalOutputBytes)||t.estimatedLogicalOutputBytes<0||!t.byTrigger||typeof t.byTrigger!="object"?!1:Object.values(t.byTrigger).every(r=>r===void 0||a(r))}function Ve(e){if(!e||typeof e!="object")return!1;let t=e;return a(t.pending)&&a(t.claimed)&&a(t.completed)&&a(t.expired)&&a(t.invalid)&&(t.oldestPendingAt===void 0||g(t.oldestPendingAt))}function De(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&(t.state==="idle"||t.state==="ready"||t.state==="unavailable"||t.state==="error")&&p(t.requests)&&p(t.sessionsCreated)&&p(t.sessionsReused)&&p(t.sessionsRefreshed)&&p(t.sessionsReplaced)&&p(t.projectsCreated)&&(t.lastRequestAt===void 0||g(t.lastRequestAt))&&(t.lastError===void 0||typeof t.lastError=="string")&&(t.busyUntil===void 0||g(t.busyUntil))&&(t.mailbox===void 0||te(t.mailbox))}function ze(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&(t.state==="idle"||t.state==="ready"||t.state==="unavailable"||t.state==="error")&&a(t.requests)&&a(t.sessionsCreated)&&a(t.sessionsReplaced)&&a(t.initializations)&&a(t.programUpdates)&&a(t.documentsEmitted)&&a(t.documentsRemoved)&&(t.lastRequestAt===void 0||g(t.lastRequestAt))&&(t.lastDurationMs===void 0||p(t.lastDurationMs)&&t.lastDurationMs>=0)&&(t.lastError===void 0||typeof t.lastError=="string")&&(t.busyUntil===void 0||g(t.busyUntil))&&(t.mailbox===void 0||te(t.mailbox))}function te(e){if(!e||typeof e!="object")return!1;let t=e;return a(t.pending)&&a(t.inflight)&&a(t.responses)&&a(t.deadLetters)&&a(t.invalid)&&a(t.totalItems)&&p(t.totalBytes)&&t.totalBytes>=0&&t.totalItems===t.pending+t.inflight+t.responses+t.deadLetters&&(t.oldestPendingAt===void 0||g(t.oldestPendingAt))}function p(e){return typeof e=="number"&&Number.isFinite(e)}var Ue=new Map([[8,"\u2408"],[9,"\u2409"],[10,"\u2424"],[13,"\u240D"]]);function Ge(e,t={}){let r=t.allowNewlines??!0,n=t.allowTabs??!0,o="";for(let s=0;s<e.length;){let i=e.charCodeAt(s);if(i===27){s=He(e,s);continue}if(i===155){s=re(e,s+1);continue}if(i===144||i===152||i===157||i===158||i===159){s=ne(e,s+1);continue}if(Ye(i)){i===10&&r?o+=`
7
- `:i===9&&n?o+=" ":o+=Ue.get(i)??"\uFFFD",s+=1;continue}if(Qe(i)){o+="\uFFFD",s+=1;continue}o+=e[s],s+=1}return o}function vt(e){return Ge(e,{allowNewlines:!1,allowTabs:!1})}function He(e,t){let r=e.charCodeAt(t+1);if(Number.isNaN(r))return e.length;if(r===91)return re(e,t+2);if(r===80||r===88||r===93||r===94||r===95)return ne(e,t+2);let n=t+1;for(;n<e.length&&Ke(e.charCodeAt(n));)n+=1;return n<e.length&&Xe(e.charCodeAt(n))?n+1:t+1}function re(e,t){let r=t;for(;r<e.length;){let n=e.charCodeAt(r);if(r+=1,n>=64&&n<=126)return r}return e.length}function ne(e,t){let r=t;for(;r<e.length;){let n=e.charCodeAt(r);if(n===7||n===156)return r+1;if(n===27&&e.charCodeAt(r+1)===92)return r+2;r+=1}return e.length}function Ke(e){return e>=32&&e<=47}function Xe(e){return e>=48&&e<=126}function Ye(e){return e<=31||e>=127&&e<=159}function Qe(e){return e===1564||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297}import{spawn as Ze}from"child_process";import{platform as ie}from"os";import{performance as se}from"perf_hooks";var kt={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},T=class extends Error{constructor(r,n,o,s={}){super(o,s.cause===void 0?void 0:{cause:s.cause});this.kind=r;this.label=n;this.name="BoundedProcessError",this.timedOut=s.timedOut??!1,this.reaped=s.reaped??!1,this.stdout=s.stdout??"",this.stderr=s.stderr??"",this.stdoutTruncated=s.stdoutTruncated??!1,this.stderrTruncated=s.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function h(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function oe(e,t,r,n){let o=Math.max(0,n-r);o>0&&e.push(t.subarray(0,o))}function ae(e,t,r){let n=Buffer.concat([...e,t]);e.length=0,e.push(n.subarray(Math.max(0,n.length-r)))}function Lt(e){h(e.timeoutMs,"timeoutMs"),h(e.maxStdoutBytes,"maxStdoutBytes"),h(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;h(t,"terminationGraceMs");let r=e.terminationForceMs??t;return h(r,"terminationForceMs"),new Promise((n,o)=>{let s=se.now(),i;try{let d=ie()!=="win32";i=Ze(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:d?!0:e.detached,stdio:["pipe","pipe","pipe"]})}catch(d){o(new T("spawn",e.label,`${e.label} could not start.`,{cause:d,reaped:!0}));return}let f=[],u=[],l=0,c=0,R=!1,x=!1,y=null,b=!1,de=ie()!=="win32",q=i.pid===void 0?null:U(i.pid,de),O=()=>{clearTimeout($),e.signal?.removeEventListener("abort",L)},k=d=>{if(b||!y)return;b=!0,O();let m=Buffer.concat(f).toString("utf8"),I=Buffer.concat(u).toString("utf8"),M=d.reaped||!d.detail?"":` Process-tree cleanup failed: ${d.detail}`;o(new T(y.kind,e.label,`${y.message}${M}`,{timedOut:y.timedOut,reaped:d.reaped,stdout:m,stderr:I,stdoutTruncated:R,stderrTruncated:x}))},S=d=>{if(!(y||b)){if(y=d,!q){k({reaped:i.pid===void 0,reason:i.pid===void 0?"terminated":"identity-unavailable"});return}G(q,{gracefulMs:t,forceMs:r}).then(k,m=>{k({reaped:!1,reason:"signal-failed",detail:m instanceof Error?m.message:String(m)})})}},$=setTimeout(()=>{S({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);$.unref();let L=()=>{S({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",L,{once:!0}),e.signal?.aborted&&L(),i.stdout.on("data",d=>{let m=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?ae(f,m,e.maxStdoutBytes):oe(f,m,l,e.maxStdoutBytes),l+=m.length,l>e.maxStdoutBytes&&(R=!0,e.outputLimitBehavior!=="truncate-tail"&&S({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),i.stderr.on("data",d=>{let m=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?ae(u,m,e.maxStderrBytes):oe(u,m,c,e.maxStderrBytes),c+=m.length,c>e.maxStderrBytes&&(x=!0,e.outputLimitBehavior!=="truncate-tail"&&S({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),i.on("error",d=>{if(!b&&!y){if(i.pid===void 0){O(),b=!0,o(new T("spawn",e.label,`${e.label} could not start: ${d.message}`,{cause:d,reaped:!0}));return}S({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${d.message}`})}}),i.on("close",(d,m)=>{if(b||y)return;b=!0,O();let I=Buffer.concat(f).toString("utf8"),M=Buffer.concat(u).toString("utf8");n({status:d,signal:m,stdout:I,stderr:M,timedOut:!1,durationMs:se.now()-s,stdoutTruncated:R,stderrTruncated:x})}),e.input===void 0?i.stdin.end():i.stdin.end(e.input)})}export{B as a,K as b,Be as c,lt as d,ft as e,mt as f,pt as g,St as h,ht as i,Tt as j,g as k,kt as l,T as m,Lt as n,vt as o};
8
- //# sourceMappingURL=chunk-L5GJNV2T.js.map
@@ -1,4 +0,0 @@
1
- import{a as r}from"./chunk-AFHORGLH.js";import{b as l}from"./chunk-S7OYBOCK.js";import{x as n}from"./chunk-EKZTZXHZ.js";function R(e,i){let s=l(e,i);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let a=s.map(()=>"?").join(", "),o=e.all(`SELECT relative_path FROM documents
2
- WHERE relative_path IN (${a})
3
- ORDER BY relative_path`,...s).map(t=>t.relative_path).filter(t=>!e.isIgnored(t)),m=n(e,o,{onlyDocumented:!0,sort:!0}).map(({relativePath:t,...f})=>f),p=r(e,"forward",s).filter(t=>!e.isIgnored(t)),d=r(e,"reverse",s).filter(t=>!e.isIgnored(t));return{files:o,symbols:m,dependsOn:p,dependedOnBy:d}}export{R as a};
4
- //# sourceMappingURL=chunk-L7JDSCDF.js.map
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- import{$a as ne,A as y,Ee as Je,Fa as S,Ga as H,Gd as ce,Ha as W,Ia as E,Ja as U,Ma as te,Na as _e,Oa as Le,Pa as C,Qa as re,Xa as qe,Ya as Me,_a as k,ab as De,cb as se,db as Ne,eb as He,f as T,hb as ie,he as ze,ie as Ve,oe as Fe,p as We,pb as oe,qb as $,rb as ae,sb as Ue,tb as $e,ub as Be,wf as Ke,xd as B,yd as Ge,zd as je}from"./chunk-JFGGXWQF.js";import{spawn as dr}from"child_process";import{existsSync as pr,rmSync as Xe}from"fs";import{dirname as hr,resolve as J}from"path";import{fileURLToPath as lr}from"url";import{createHash as jt,randomUUID as Ye}from"crypto";import{existsSync as zt,linkSync as Vt,readdirSync as Ft,rmSync as Jt}from"fs";import{basename as Kt,dirname as Yt,join as I}from"path";var j=1,Qt=10*6e4,Rn=10080*6e4,ue="requests",Xt="claims",Zt="completions",er="staging";function Qe(e,t,r={}){let n=r.now?.()??new Date,s=ar(r.ttlMs),i=cr(r.idempotencyKey),c=i?`key-${jt("sha256").update(i).digest("hex")}`:`request-${(r.randomId??Ye)()}`,o={version:j,requestId:c,...i?{idempotencyKey:i}:{},createdAt:n.toISOString(),deadlineAt:new Date(n.getTime()+s).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},a=or(e,c),u=nr(e,a,o,r.onStage);if(u.published)return{disposition:"accepted",request:o,achievedDurability:u.achievedDurability,directorySync:u.directorySync};let d=de(a);if(!d)throw new Error(`Watch refresh request identity ${c} exists but is malformed.`);return{disposition:"duplicate",request:d}}function On(e){let t=sr(e),r=new Map,n=ir(I(e,ue),de);for(let a of G(I(e,Zt))){let u=rr(a);if(!u){n++;continue}r.set(u.requestId,u)}let s=new Set;for(let a of G(I(e,Xt))){let u=tr(a);if(!u){n++;continue}s.add(u.requestId)}let i=t.filter(a=>!r.has(a.requestId)&&!s.has(a.requestId)),c=[...r.values()].filter(a=>a.outcome==="completed").length,o=[...r.values()].filter(a=>a.outcome==="expired").length;return{pending:i.length,claimed:t.filter(a=>!r.has(a.requestId)&&s.has(a.requestId)).length,completed:c,expired:o,invalid:n,...i.length>0?{oldestPendingAt:i.map(a=>a.createdAt).reduce((a,u)=>ur(a,u))}:{}}}function de(e){return pe(e,t=>{let r=t;return r.version===j&&_(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&T(r.createdAt)&&T(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function tr(e){return pe(e,t=>{let r=t;return r.version===j&&_(r.requestId)&&_(r.claimId)&&T(r.claimedAt)})}function rr(e){return pe(e,t=>{let r=t;return r.version===j&&_(r.requestId)&&(r.claimId===void 0||_(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&T(r.completedAt)})}function nr(e,t,r,n){let s=I(e,er),i=Yt(t),c=te(s),o=te(i),a=I(s,`${Kt(t)}.${process.pid}.${Ye()}.tmp`);try{let u=re(a,r,{spacing:2,trailingNewline:!0});n?.("after-staged");try{Vt(a,t)}catch(h){if(h.code==="EEXIST")return{published:!1};throw h}let d=Le(c,o,u.directorySync,_e(i));return n?.("after-published"),{published:!0,achievedDurability:d==="synced"?"directory-durable":"file-flushed",directorySync:d}}finally{Jt(a,{force:!0})}}function sr(e){let t=[];for(let r of G(I(e,ue))){let n=de(r);n&&t.push(n)}return t}function ir(e,t){return G(e).filter(r=>!t(r)).length}function G(e,t=".json"){return zt(e)?Ft(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(t)).map(r=>I(e,r.name)).sort():[]}function pe(e,t){try{let r=JSON.parse(y(e,"watch refresh request record"));return t(r)?r:null}catch{return null}}function or(e,t){return I(e,ue,`${t}.json`)}function ar(e){if(e===void 0)return Qt;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function cr(e){let t=e?.trim();return t?t.slice(0,512):void 0}function _(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function ur(e,t){return Date.parse(t)<Date.parse(e)?t:e}var Ze=5e3,fr=6e3,gr=1e3,le=10,mr=new Set(["bench","config-validate","hook-context","hook-stop","init","reindex","setup","setup-agent","setup-ci","setup-hooks","uninstall","watch","work-audit"]);function Hn(e){let t=e.classification;if(t.kind!=="live")return;let{state:r}=t;return r.watcher.state==="idle"&&r.lastError===void 0?r.indexGeneration:void 0}function yr(e,t=process.env){return t.SCIP_QUERY_SKIP_WATCH_SERVICE!=="1"&&!e.startsWith("__")&&!mr.has(e)}function Un(e){let t=e.env??process.env;if(t.SCIP_QUERY_SKIP_WATCH_SERVICE==="1")return{kind:"skipped",reason:"environment"};if(!yr(e.commandName,t))return{kind:"skipped",reason:"excluded-command"};if(e.config.watch?.enabled!==!0)return{kind:"skipped",reason:"disabled"};try{let r=Sr({projectRoot:e.projectRoot,cacheDir:e.cacheDir,cliVersion:e.cliVersion,gitContext:e.gitContext,runtime:e.runtime});return{kind:r.disposition,state:r.state}}catch(r){return{kind:"failed",message:r instanceof Error?r.message:String(r)}}}function rt(e,t,r){let n=ie(J(e));if(r&&ie(r.projectRoot)===n)return{projectRoot:n,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:t};let s=Ne(n);if(s.kind==="error")throw new Error(`Could not establish Git worktree identity for ${n}: ${s.message}`);return s.kind==="non-git"?{projectRoot:n,worktreeKind:"non-git",cliVersion:t}:{projectRoot:n,worktreeKind:"git",worktreeId:s.identity.worktreeId,cliVersion:t}}function $n(e){return V(e,rt(e.projectRoot,e.cliVersion,e.gitContext))}function V(e,t){let r=e.runtime??ye,n=k(e.cacheDir),s=ne(n.statePath),i=me(n.lockPath);return{identity:t,classification:vr(s,t,r.now(),r.isProcessAlive),lock:i,lockIsLive:i!==null&&r.isProcessAlive(i.pid),paths:n}}function Sr(e){let t=e.runtime??ye,r=rt(e.projectRoot,e.cliVersion,e.gitContext),n=V(e,r),s=fe("ensure",n.classification);if(s.kind==="reuse")return z(n.paths.activityPath,t),{disposition:"reused",state:s.state};if(s.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${s.state.pid} is still alive but its heartbeat is old. Refusing automatic replacement because civil-clock age alone cannot authorize a process signal.`);if(s.kind==="replace")ge(s.state,e,t),L(n.paths,s.state.pid,t);else if(s.kind==="start"){if(n.lockIsLive){let o=et(e,r,t,Math.min(e.startupTimeoutMs??1e3,1e3));if(o)return z(n.paths.activityPath,t),{disposition:"reused",state:o};throw new Error(`scip-query watch is already running for ${J(e.projectRoot)} (pid ${n.lock?.pid}; lock: ${n.paths.lockPath}) without compatible daemon state. Stop the foreground watcher before starting the service.`)}n.classification.kind==="stale"&&L(n.paths,n.classification.state.pid,t)}else throw new Error(`Unexpected ensure action: ${s.kind}`);if(n=V(e,r),s=fe("ensure",n.classification),s.kind==="reuse")return z(n.paths.activityPath,t),{disposition:"reused",state:s.state};if(s.kind==="refuse-replace")throw new Error(`scip-query watch service pid ${s.state.pid} remains alive with an old heartbeat; automatic replacement is not authorized.`);let i=e.serverPath??lr(new URL("./watch-server.js",import.meta.url));t.spawnServer(i,r.projectRoot,e.cliVersion,e.watchOverrides??{});let c=et(e,r,t,e.startupTimeoutMs??Ze);if(!c)throw new Error(`scip-query watch service did not become ready within ${e.startupTimeoutMs??Ze}ms.`);return z(n.paths.activityPath,t),{disposition:"started",state:c}}function nt(e){let t=e.runtime??ye,r=k(e.cacheDir),n=ne(r.statePath),s=n?t.isProcessAlive(n.pid)?{kind:"live",state:n}:{kind:"stale",state:n,reason:"dead-process"}:{kind:"stopped"},i=fe("stop",s);if(i.kind==="signal-stop")return ge(i.state,e,t),L(r,i.state.pid,t),{disposition:"stopped",pid:i.state.pid};if(i.kind==="clean-stale")return L(r,i.state.pid,t),{disposition:"stopped",pid:i.state.pid};let c=me(r.lockPath);return i.kind==="already-stopped"&&c&&t.isProcessAlive(c.pid)?(ge(c,e,t),L(r,c.pid,t),{disposition:"stopped",pid:c.pid}):{disposition:"already-stopped"}}function st(e,t=Date.now()){C(e,{version:1,at:new Date(t).toISOString()})}function Bn(e,t,r=Date.now(),n={}){Qe(k(hr(e)).refreshRequestsPath,t,{...n,now:()=>new Date(r)}),st(e,r)}function Gn(e,t,r={}){let n=r.pid??process.pid,s=r.isProcessAlive??S,i=()=>{},c=r.readProcessIdentity??E,o=r.now??(()=>new Date),a={...oe,wallNow:()=>o().getTime(),isProcessAlive:s,readProcessIdentity:c},u=$(e,{kind:"watch",pid:n,processIdentity:c(n),detail:{projectRoot:J(t)},parseLegacy:F,runtime:a});if(u.kind==="contended"){let d=it(u.observation);return{acquired:!1,lockPath:e,message:wr(e,t,d),release:i}}return{acquired:!0,lockPath:e,message:"",release:()=>{u.lock.release()}}}function me(e){return it(ae(e,{parseLegacy:F}))}var F=e=>{let t=ot(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function it(e){if(e.state==="valid"&&e.record?.kind==="watch"){let t=e.record.detail?.projectRoot;return typeof t!="string"?null:{version:1,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},projectRoot:t,startedAt:e.record.startedAt}}return ot(e.parsed)}function ot(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!De(t.startedAt))return null;let r=t.processIdentity===void 0?null:H(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,pid:t.pid,...r?{processIdentity:r}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function vr(e,t,r,n){if(!e)return{kind:"stopped"};if(e.protocolVersion!==qe)return{kind:"incompatible",state:e,reason:"protocol"};if(e.projectRoot!==t.projectRoot)return{kind:"incompatible",state:e,reason:"project"};let s=t.worktreeKind==="git"?t.worktreeId:void 0;if(e.worktreeId!==s)return{kind:"incompatible",state:e,reason:"worktree"};if(e.cliVersion!==t.cliVersion)return{kind:"incompatible",state:e,reason:"cli-version"};if(!n(e.pid))return{kind:"stale",state:e,reason:"dead-process"};let i=Date.parse(e.heartbeatAt);return r-i>Me?{kind:"stale",state:e,reason:"old-heartbeat"}:{kind:"live",state:e}}function fe(e,t){switch(e){case"status":return{kind:"report",classification:t};case"ensure":switch(t.kind){case"stopped":return{kind:"start"};case"stale":return t.reason==="old-heartbeat"?{kind:"refuse-replace",state:t.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:t.state};case"incompatible":return{kind:"replace",state:t.state};default:return he(t)}case"stop":switch(t.kind){case"stopped":return{kind:"already-stopped"};case"stale":return t.reason==="old-heartbeat"?{kind:"signal-stop",state:t.state}:{kind:"clean-stale",state:t.state};case"live":case"incompatible":return{kind:"signal-stop",state:t.state};default:return he(t)}default:return he(e)}}function et(e,t,r,n){let s=r.monotonicNow??U,i=s()+n;for(;s()<=i;){let c=V(e,t).classification;if(c.kind==="live")return c.state;r.sleep(le)}return null}function ge(e,t,r){let{pid:n}=e;if(!r.isProcessAlive(n))return;tt(e,r),r.signalProcess(n);let s=t.stopTimeoutMs??fr,i=r.monotonicNow??U,c=i()+s;for(;i()<=c;){if(!r.isProcessAlive(n))return;r.sleep(le)}if(!r.forceSignalProcess)throw new Error(`scip-query watch service pid ${n} did not stop within ${s}ms and forced termination is unavailable.`);tt(e,r),r.forceSignalProcess(n);let o=t.forceStopTimeoutMs??gr,a=i()+o;for(;i()<=a;){if(!r.isProcessAlive(n))return;let u=r.readProcessIdentity(n);if(e.processIdentity&&u&&!W(e.processIdentity,u))return;r.sleep(le)}throw new Error(`scip-query watch service pid ${n} remained alive ${o}ms after forced termination.`)}function L(e,t,r){if(Xe(e.statePath,{force:!0}),Xe(e.activityPath,{force:!0}),me(e.lockPath)?.pid===t&&!r.isProcessAlive(t)){let s={...oe,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},i=ae(e.lockPath,{parseLegacy:F,runtime:s});Ue(e.lockPath,i,{parseLegacy:F,runtime:s})}}function wr(e,t,r){return`error: scip-query watch is already running for ${J(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}function z(e,t){try{(t.recordActivity??st)(e,t.now())}catch(r){let n=Ir(r);if(n!=="EPERM"&&n!=="EACCES"&&n!=="EROFS")throw r}}function Ir(e){return e.code}var ye={now:Date.now,monotonicNow:U,isProcessAlive:S,readProcessIdentity:E,spawnServer(e,t,r,n){if(!pr(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);dr(process.execPath,[e,t,r,JSON.stringify(n)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function tt(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its ownership record has no process identity.`);let r=t.readProcessIdentity(e.pid);if(!r)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity is unavailable.`);if(!W(e.processIdentity,r))throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity does not match the ownership record.`)}function he(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}import{createHash as Y,randomUUID as br}from"crypto";import{chmodSync as Cr,closeSync as ve,fstatSync as at,lstatSync as Rr,mkdirSync as Or,openSync as ht,readSync as Pr,readdirSync as lt,renameSync as Er,rmSync as ft,statSync as kr,writeSync as Ar}from"fs";import{tmpdir as xr}from"os";import{join as M}from"path";import{StringDecoder as gt}from"string_decoder";import{InvalidArgumentError as ct}from"commander";var Tr="scip-query-output-page",Wr=1,K=12e3,A=256,x=1e5,ut=4096,we=32e6,_r=64*1024*1024,Lr=256*1024*1024,qr=32,Ie=32768,Oe=3600*1e3,mt=3;function yt(){return M(xr(),`scip-query-output-pages-${typeof process.getuid=="function"?process.getuid():"user"}`)}var b=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,St=1,Mr="quota.lock",Dr=2e3,Nr=5,dt=1024*1024,Hr=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)),Se,Ur=Object.freeze({maxSnapshotBytes:_r,maxAggregateBytes:Lr,maxSnapshotCount:qr});var $r={writeStdout:e=>{process.stdout.write(e)},writeStderr:e=>{process.stderr.write(e)}};async function ss(e,t,r=$r){let n=e.pageSize??K,s=e.snapshotRoot??yt(),i=Kr(e.snapshotLimits),c=e.maxOutputCharacters??we;if(!Number.isSafeInteger(c)||c<=0)throw new Error("Output character safety limit must be a positive integer.");let o=Math.min(c,we);if(vt(n),e.cursor!==void 0&&e.cursor.length>ut)throw new Error(`Output cursor exceeds the ${ut}-character limit. Run the command again without --output-cursor.`);if(e.json&&e.pageSize===void 0&&e.cursor===void 0){await Br(e,t,r);return}let a=Et(e.argv),u=xt(e.invocationPrefix),d=Pt(e.command,e.cwd,u,a),h=e.cursor===void 0?void 0:an(e.cursor,d),l=h?.snapshotId,p;if(h)try{p=zr(h,n,o,s,e.onSnapshotRead)}catch(v){let Z=v instanceof Error?v.message:String(v);throw new Error(`${Z} Restart with: ${kt(u,a,n)}`,{cause:v})}else{let v=new Ce(d,u,e.command,e.cwd,a,n,o,s,i,!e.json),Z=Gr(ee=>v.write(ee)),Te=!1;try{await t(),Te=!0}finally{Z(),Te||v.abort()}let P;try{P=v.complete()}catch(ee){throw v.abort(),ee}l=P.snapshotId,p={content:P.content,offset:0,pageIndex:0,pageCount:P.pageCount,totalCharacters:P.totalCharacters,outputHash:P.outputHash}}let g=p.offset+p.content.length,f=p.pageIndex+1>=p.pageCount,O=f?void 0:sn({filteredArgv:a,invocationPrefix:u,invocationHash:d,nextPageIndex:p.pageIndex+1,outputHash:p.outputHash,pageSize:n,snapshotId:tn(l)});if(p.offset===0&&f&&e.cursor===void 0){r.writeStdout(p.content),l&&R(l,s);return}let xe={kind:Tr,schemaVersion:Wr,producer:{name:"scip-query",version:e.producerVersion},command:e.command,contentType:e.json?"application/json":"text/plain",agentInstruction:O?"INCOMPLETE EVIDENCE: do not draw conclusions or report completion from this partial page. Run page.continuation.command exactly, then repeat until page.complete is true.":"OUTPUT COMPLETE: all rendered characters have been retrieved. Evaluate the command result's own coverage separately.",page:O?{offset:p.offset,returnedCharacters:p.content.length,totalCharacters:p.totalCharacters,omittedCharacters:p.totalCharacters-p.content.length,remainingCharacters:p.totalCharacters-g,complete:!1,outputHash:p.outputHash,continuation:O}:{offset:p.offset,returnedCharacters:p.content.length,totalCharacters:p.totalCharacters,omittedCharacters:p.totalCharacters-p.content.length,remainingCharacters:p.totalCharacters-g,complete:!0,outputHash:p.outputHash},content:p.content};if(e.json){r.writeStdout(`${JSON.stringify(xe)}
3
- `),f&&l&&R(l,s);return}r.writeStdout(pn(xe)),f&&l&&R(l,s)}function is(e){if(!/^\d+$/u.test(e))throw new ct(`Output page size must be an integer from ${A} through ${x}.`);let t=Number(e);try{vt(t)}catch{throw new ct(`Output page size must be an integer from ${A} through ${x}.`)}return t}function vt(e){if(!Number.isSafeInteger(e)||e<A||e>x)throw new Error(`Output page size must be an integer from ${A} through ${x}.`)}async function Br(e,t,r){let n=new be(K,e.maxOutputCharacters??we),s=process.stdout.write,i=!1,c=`${Je(`scip-query: JSON output exceeds ${K} characters and may be truncated by the client. Do not use possibly partial client output as evidence. Read every page with: ${kt(xt(e.invocationPrefix),Et(e.argv),K)}`)}
4
- `;process.stdout.write=((o,a,u)=>{let d=n.push(o,a);return d!==void 0&&(i||(i=!0,r.writeStderr(c)),s.call(process.stdout,d)),wt(a,u),!0});try{await t();let o=n.finish();o.crossedPageBoundary&&!i&&(i=!0,r.writeStderr(c)),o.bytes.length>0&&s.call(process.stdout,o.bytes),i&&r.writeStderr(c)}finally{process.stdout.write=s}}function Gr(e){let t=process.stdout.write;return process.stdout.write=((r,n,s)=>{let i=jr(r,n);return e(i),wt(n,s),!0}),()=>{process.stdout.write=t}}function jr(e,t){return typeof e=="string"?Buffer.from(e,typeof t=="string"?t:"utf8"):Buffer.from(e)}function wt(e,t){let r=typeof e=="function"?e:t;typeof r=="function"&&r()}var be=class{constructor(t,r){this.limit=t;this.maxOutputCharacters=r}limit;maxOutputCharacters;decoder=new gt("utf8");chunks=[];overflowed=!1;totalCharacters=0;push(t,r){let n=typeof t=="string"?Buffer.from(t,typeof r=="string"?r:"utf8"):Buffer.from(t);if(this.addCharacters(this.decoder.write(n)),this.overflowed)return n;if(this.chunks.push(n),this.totalCharacters<=this.limit)return;this.overflowed=!0;let s=Buffer.concat(this.chunks);return this.chunks.length=0,s}finish(){this.addCharacters(this.decoder.end());let t=this.totalCharacters>this.limit,r=Buffer.concat(this.chunks);return this.chunks.length=0,{bytes:r,crossedPageBoundary:t}}addCharacters(t){if(this.totalCharacters+=t.length,!Number.isSafeInteger(this.totalCharacters)||this.totalCharacters>this.maxOutputCharacters)throw new Error(`Command output exceeds the ${this.maxOutputCharacters}-character safety limit. Narrow the query before retrying.`)}},Ce=class{constructor(t,r,n,s,i,c,o,a,u,d){this.invocationHash=t;this.invocationPrefix=r;this.command=n;this.cwd=s;this.argv=i;this.pageSize=c;this.maxOutputCharacters=o;this.snapshotRoot=a;this.limits=u;this.preferLineBoundaries=d;Pe(a),this.snapshotId=br(),this.temporaryPath=w(a,this.snapshotId,"tmp")}invocationHash;invocationPrefix;command;cwd;argv;pageSize;maxOutputCharacters;snapshotRoot;limits;preferLineBoundaries;snapshotId;temporaryPath;decoder=new gt("utf8");hash=Y("sha256");pages=[];descriptor=null;pending="";firstPageContent="";totalCharacters=0;pageCharacterOffset=0;byteLength=0;reservedBytes=0;opened=!1;finished=!1;write(t){if(this.finished)throw new Error("Output snapshot writer is closed.");this.appendDecoded(this.decoder.write(t))}complete(){if(this.finished)throw new Error("Output snapshot writer is closed.");if(this.appendDecoded(this.decoder.end()),this.finished=!0,!this.opened){let s=this.pending,i=Buffer.from(s);return this.assertWithinByteLimit(i.length),this.hash.update(i),this.pending="",{content:s,totalCharacters:this.totalCharacters,outputHash:this.hash.digest("hex"),pageCount:1}}if((this.pending.length>0||this.pages.length===0)&&(this.flushPage(this.pending),this.pending=""),this.descriptor===null)throw new Error("Output snapshot writer is not open.");ve(this.descriptor),this.descriptor=null;let t=this.hash.digest("hex"),r=w(this.snapshotRoot,this.snapshotId,"output"),n=w(this.snapshotRoot,this.snapshotId,"json");try{Er(this.temporaryPath,r);let s={version:mt,snapshotId:this.snapshotId,invocationHash:this.invocationHash,invocationPrefix:[...this.invocationPrefix],command:this.command,cwd:this.cwd,argv:[...this.argv],outputHash:t,pageSize:this.pageSize,pages:this.pages,totalCharacters:this.totalCharacters,byteLength:this.byteLength,createdAtMs:Date.now()};return C(n,s),pt(this.snapshotRoot,this.snapshotId,this.byteLength,"complete",this.limits),this.reservedBytes=this.byteLength,{content:this.firstPageContent,totalCharacters:this.totalCharacters,outputHash:t,pageCount:this.pages.length,snapshotId:this.snapshotId}}catch(s){throw R(this.snapshotId,this.snapshotRoot),s}}abort(){this.descriptor!==null&&(ve(this.descriptor),this.descriptor=null),this.finished=!0,R(this.snapshotId,this.snapshotRoot)}appendDecoded(t){if(t.length===0)return;let r=this.totalCharacters+t.length;if(!Number.isSafeInteger(r)||r>this.maxOutputCharacters)throw new Error(`Command output exceeds the ${this.maxOutputCharacters}-character safety limit. Narrow the query before retrying.`);for(this.totalCharacters=r,this.pending+=t,this.assertWithinByteLimit(this.byteLength+Buffer.byteLength(this.pending));this.pending.length>this.pageSize;){this.open();let n=nn(this.pending,this.pageSize,this.preferLineBoundaries),s=this.pending.slice(0,n);this.pending=this.pending.slice(n),this.flushPage(s)}}open(){if(!this.opened){Yr(this.snapshotRoot,this.snapshotId,0,this.limits);try{this.descriptor=ht(this.temporaryPath,"wx",384),this.opened=!0}catch(t){throw Qr(this.snapshotRoot,this.snapshotId),t}}}flushPage(t){if(this.descriptor===null)throw new Error("Output snapshot writer is not open.");if(this.pages.length>=Ie)throw new Error(`Command output requires more than ${Ie} snapshot pages. Retry with a larger --output-page-size or narrow the query.`);let r=Buffer.from(t),n=this.byteLength+r.length;if(this.assertWithinByteLimit(n),n>this.reservedBytes){let c=Math.min(this.limits.maxSnapshotBytes,Math.ceil(n/dt)*dt);pt(this.snapshotRoot,this.snapshotId,c,"active",this.limits),this.reservedBytes=c}let s=0;for(;s<r.length;){let c=Ar(this.descriptor,r,s,r.length-s);if(c<=0)throw new Error("Output snapshot write made no progress.");s+=c}let i={characterOffset:this.pageCharacterOffset,characterLength:t.length,byteOffset:this.byteLength,byteLength:r.length,hash:Y("sha256").update(r).digest("hex")};this.pages.length===0&&(this.firstPageContent=t),this.pages.push(i),this.hash.update(r),this.pageCharacterOffset+=t.length,this.byteLength=n}assertWithinByteLimit(t){if(!Number.isSafeInteger(t)||t>this.limits.maxSnapshotBytes)throw new Error(`Command output exceeds the ${this.limits.maxSnapshotBytes}-byte snapshot limit. Narrow the query before retrying.`)}};function zr(e,t,r,n,s){Pe(n);let i=It(e.snapshotId,n);if(i.invocationHash!==e.invocationHash||i.outputHash!==e.outputHash||i.snapshotId!==e.snapshotId)throw new Error("Output snapshot identity does not match this cursor.");if(e.pageSize!==t||i.pageSize!==t)throw new Error(`Output page size changed after this cursor was issued; use ${i.pageSize}.`);let c=i.pages[e.pageIndex];if(!c)throw new Error("Output cursor points past the current result.");if(i.totalCharacters>r)throw new Error(`Output snapshot exceeds the ${r}-character safety limit.`);if(Date.now()-i.createdAtMs>Oe)throw R(e.snapshotId,n),new Error("Output snapshot expired before all pages were read.");let o=w(n,e.snapshotId,"output"),a=ht(o,"r");try{let u=at(a);if(!u.isFile()||u.size!==i.byteLength)throw new Error("Output snapshot size or type changed.");let d=Buffer.allocUnsafe(c.byteLength),h=0;for(;h<d.length;){let g=Pr(a,d,h,d.length-h,c.byteOffset+h);if(g===0)break;h+=g,s?.(g)}let l=at(a);if(l.dev!==u.dev||l.ino!==u.ino||l.size!==u.size||h!==c.byteLength)throw new Error("Output snapshot changed while it was being read.");if(Y("sha256").update(d).digest("hex")!==c.hash)throw new Error("Output snapshot page no longer matches its metadata.");let p=d.toString("utf8");if(p.length!==c.characterLength)throw new Error("Output snapshot page character count changed.");return{content:p,offset:c.characterOffset,pageIndex:e.pageIndex,pageCount:i.pages.length,totalCharacters:i.totalCharacters,outputHash:i.outputHash}}catch(u){throw R(e.snapshotId,n),u}finally{ve(a)}}function It(e,t){if(!b.test(e))throw new Error("Output snapshot identifier is invalid.");let r;try{r=JSON.parse(y(w(t,e,"json"),"output snapshot metadata"))}catch(n){throw new Error("Output snapshot is unavailable.",{cause:n})}if(!Vr(r))throw new Error("Output snapshot metadata is invalid.");return r}function Vr(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===mt&&typeof t.snapshotId=="string"&&b.test(t.snapshotId)&&q(t.invocationHash)&&Tt(t.invocationPrefix)&&typeof t.command=="string"&&t.command.length>0&&t.command.length<=256&&typeof t.cwd=="string"&&t.cwd.length>0&&t.cwd.length<=8192&&un(t.argv)&&Pt(t.command,t.cwd,t.invocationPrefix,t.argv)===t.invocationHash&&q(t.outputHash)&&Number.isSafeInteger(t.pageSize)&&(t.pageSize??0)>=A&&(t.pageSize??0)<=x&&Array.isArray(t.pages)&&t.pages.length>1&&t.pages.length<=Ie&&t.pages.every(Fr)&&Jr(t.pages)&&Number.isSafeInteger(t.totalCharacters)&&(t.totalCharacters??-1)>=0&&t.pages.reduce((r,n)=>r+n.characterLength,0)===t.totalCharacters&&Number.isSafeInteger(t.byteLength)&&(t.byteLength??-1)>=0&&t.pages.reduce((r,n)=>r+n.byteLength,0)===t.byteLength&&Number.isSafeInteger(t.createdAtMs)&&(t.createdAtMs??-1)>=0}function Fr(e){if(!e||typeof e!="object")return!1;let t=e;return Number.isSafeInteger(t.characterOffset)&&(t.characterOffset??-1)>=0&&Number.isSafeInteger(t.characterLength)&&(t.characterLength??0)>0&&Number.isSafeInteger(t.byteOffset)&&(t.byteOffset??-1)>=0&&Number.isSafeInteger(t.byteLength)&&(t.byteLength??0)>0&&q(t.hash)}function Jr(e){let t=0,r=0;for(let n of e){if(n.characterOffset!==t||n.byteOffset!==r)return!1;t+=n.characterLength,r+=n.byteLength}return!0}function Pe(e){Or(e,{recursive:!0,mode:448});let t=Rr(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Output snapshot root is not a private directory: ${e}`);if(typeof process.getuid=="function"&&t.uid!==process.getuid())throw new Error(`Output snapshot root is not owned by the current user: ${e}`);process.platform!=="win32"&&Cr(e,448)}function Kr(e){let t={...Ur,...e};for(let[r,n]of Object.entries(t))if(!Number.isSafeInteger(n)||n<=0)throw new Error(`Output snapshot ${r} must be a positive integer.`);if(t.maxSnapshotBytes>t.maxAggregateBytes)throw new Error("Output snapshot maxSnapshotBytes cannot exceed maxAggregateBytes.");return t}function Yr(e,t,r,n){Q(e,()=>{Zr(e),bt(e,t,r,"active",n)})}function pt(e,t,r,n,s){if(!Number.isSafeInteger(r)||r<0||r>s.maxSnapshotBytes)throw new Error(`Command output exceeds the ${s.maxSnapshotBytes}-byte snapshot limit.`);Q(e,()=>{bt(e,t,r,n,s)})}function bt(e,t,r,n,s){if(!Number.isSafeInteger(r)||r<0||r>s.maxSnapshotBytes)throw new Error(`Command output exceeds the ${s.maxSnapshotBytes}-byte snapshot limit.`);let i=Xr(e),c=i.find(h=>h.snapshotId===t),o=i.reduce((h,l)=>h+l.reservedBytes,0)-(c?.reservedBytes??0)+r,a=i.length+(c?0:1);if(a>s.maxSnapshotCount||o>s.maxAggregateBytes)throw new Error(`Output snapshot capacity is full (${a}/${s.maxSnapshotCount} snapshots, ${o}/${s.maxAggregateBytes} bytes). Narrow the query or finish an existing pagination sequence before retrying.`);let u=Date.now(),d={version:St,snapshotId:t,pid:process.pid,...Re()?{processIdentity:Re()}:{},reservedBytes:r,state:n,createdAtMs:c?.createdAtMs??u,updatedAtMs:u};C(w(e,t,"reserve"),d)}function Qr(e,t){Q(e,()=>{ft(w(e,t,"reserve"),{force:!0})})}function Xr(e){let t=[];for(let r of lt(e,{withFileTypes:!0})){if(!r.isFile()||!r.name.endsWith(".reserve"))continue;let n=r.name.slice(0,-8);if(b.test(n))try{let s=JSON.parse(y(M(e,r.name),"output snapshot reservation"));if(!Ct(s)||s.snapshotId!==n)throw new Error("reservation identity is invalid");t.push(s)}catch(s){throw new Error(`Output snapshot reservation ${r.name} is invalid; retry after its owning process or snapshot expires.`,{cause:s})}}return t}function Ct(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===St&&typeof t.snapshotId=="string"&&b.test(t.snapshotId)&&Number.isSafeInteger(t.pid)&&(t.pid??0)>0&&(t.processIdentity===void 0||H(t.processIdentity)!==null&&t.processIdentity.pid===t.pid)&&Number.isSafeInteger(t.reservedBytes)&&(t.reservedBytes??-1)>=0&&(t.state==="active"||t.state==="complete")&&Number.isSafeInteger(t.createdAtMs)&&Number.isSafeInteger(t.updatedAtMs)}function Zr(e){let t=Date.now();for(let r of lt(e,{withFileTypes:!0})){if(!r.isFile()||!r.name.endsWith(".reserve"))continue;let n=r.name.slice(0,-8);if(!b.test(n))continue;let s=null;try{let a=JSON.parse(y(M(e,r.name),"output snapshot reservation"));s=Ct(a)?a:null}catch{s=null}let i=en(w(e,n,"json")),c=s?.state==="active"&&S(s.pid)&&(s.processIdentity===void 0||(()=>{let a=E(s.pid);return a!==null&&W(s.processIdentity,a)})()),o=s?t-s.updatedAtMs>Oe:!1;c||i&&!o||!i&&s&&!o&&s.state==="complete"||Rt(n,e)}}function en(e){try{return kr(e),!0}catch{return!1}}function Q(e,t){Pe(e);let r=M(e,Mr),n=Date.now()+Dr;for(;;){let s=$(r,{kind:"output-snapshot-quota",processIdentity:Re()});if(s.kind==="acquired")try{return t()}finally{s.lock.release()}if(Date.now()>=n)throw new Error("Output snapshot quota is busy. Retry the command.");Atomics.wait(Hr,0,0,Nr)}}function Re(){return Se===void 0&&(Se=E(process.pid)),Se}function R(e,t){b.test(e)&&Q(t,()=>Rt(e,t))}function Rt(e,t){for(let r of["json","output","tmp","reserve"])ft(w(t,e,r),{force:!0})}function w(e,t,r){if(!b.test(t))throw new Error("Output snapshot identifier is invalid.");return M(e,`${t}.${r}`)}function tn(e){if(!e)throw new Error("Incomplete output did not create a resumable snapshot.");return e}function rn(e){return e>=55296&&e<=56319}function nn(e,t,r){if(r){let n=e.lastIndexOf(`
5
- `,t-1);if(n>=0)return n+1}return rn(e.charCodeAt(t-1))?t-1:t}function sn(e){let t=on({invocationHash:e.invocationHash,pageIndex:e.nextPageIndex,pageSize:e.pageSize,outputHash:e.outputHash,snapshotId:e.snapshotId});return{cursor:t,command:At(e.invocationPrefix,e.filteredArgv,e.pageSize,t)}}function on(e){return Ke({version:3,...e})}function an(e,t){let r=Ot(e);if(!r)throw new Error("Invalid output cursor. Run the command again without --output-cursor.");if(r.invocationHash!==t)throw new Error("This output cursor belongs to a different command, working directory, or argument set. Run again without --output-cursor.");return r}function Ot(e){try{let t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));return cn(t)?t:null}catch{return null}}function os(e,t=yt()){let r=Ot(e);if(r)try{let n=It(r.snapshotId,t);if(n.invocationHash!==r.invocationHash||n.outputHash!==r.outputHash||n.pageSize!==r.pageSize||Date.now()-n.createdAtMs>Oe||!n.pages[r.pageIndex])return;let s=n.pages[r.pageIndex];return{snapshotId:n.snapshotId,pageIndex:r.pageIndex,command:n.command,cwd:n.cwd,continuationCommand:At(n.invocationPrefix,n.argv,n.pageSize,e),remainingCharacters:n.totalCharacters-s.characterOffset,totalCharacters:n.totalCharacters,outputHash:n.outputHash,createdAtMs:n.createdAtMs}}catch{return}}function cn(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===3&&q(t.invocationHash)&&Number.isSafeInteger(t.pageIndex)&&(t.pageIndex??-1)>=1&&Number.isSafeInteger(t.pageSize)&&(t.pageSize??0)>=A&&(t.pageSize??0)<=x&&q(t.outputHash)&&typeof t.snapshotId=="string"&&b.test(t.snapshotId)}function q(e){return typeof e=="string"&&/^[a-f0-9]{64}$/u.test(e)}function Pt(e,t,r,n){return Y("sha256").update(JSON.stringify({command:e,cwd:t,invocationPrefix:r,argv:n})).digest("hex")}function Et(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e[r];if(n==="--output-page-size"||n==="--output-cursor"){r+=1;continue}n.startsWith("--output-page-size=")||n.startsWith("--output-cursor=")||t.push(n)}return t}function kt(e,t,r){return Wt([...e,...t,"--output-page-size",String(r)])}function At(e,t,r,n){return Wt([...e,...t,"--output-page-size",String(r),"--output-cursor",n])}function xt(e){let t=e===void 0?["scip-query"]:[...e];if(!Tt(t))throw new Error("Output pagination invocation prefix must contain one to sixteen non-empty shell arguments.");return t}function Tt(e){return Array.isArray(e)&&e.length>0&&e.length<=16&&e.every(t=>typeof t=="string"&&t.length>0&&t.length<=2048&&!t.includes("\0")&&!t.includes("\r")&&!t.includes(`
6
- `))}function un(e){return Array.isArray(e)&&e.length>0&&e.length<=256&&e.every(t=>typeof t=="string"&&t.length<=8192&&!t.includes("\0")&&!t.includes("\r")&&!t.includes(`
7
- `))}function Wt(e){return e.map(dn).join(" ")}function dn(e){return/^[A-Za-z0-9_@%+=:,./-]+$/u.test(e)?e:`'${e.replaceAll("'",`'"'"'`)}'`}function pn(e){let t=e.page.continuation,r=Math.max(e.page.offset,e.page.offset+e.page.returnedCharacters-1),n=`[scip-query output page: characters ${e.page.offset}-${r} of ${e.page.totalCharacters}]
8
- `,s=t?`
9
- [Incomplete: ${e.page.remainingCharacters} characters remain. Continue exactly:
10
- ${t.command}]
11
- `:`
12
- [scip-query transport complete; evaluate command coverage separately]
13
- `;return`${n}${e.content}${s}`}import{existsSync as Mt,lstatSync as X,readdirSync as Dt,realpathSync as _t,rmSync as D,statSync as Nt}from"fs";import{join as m,resolve as N,sep as Lt}from"path";var hn=3600*1e3,ln=2*1024*1024*1024,fn=300*1e3;function gn(e){let t=e.leases.filter(o=>o.managed&&!o.live&&!o.busy),r=Ht(e.leases,e.locks),n={};for(let o of e.generations)r.has(o.generationId)||(n[o.generationId]=o.unreferencedAt??e.nowMs);let s=e.generations.filter(o=>!r.has(o.generationId)).sort((o,a)=>n[o.generationId]-n[a.generationId]||o.generationId.localeCompare(a.generationId)),i=new Set;for(let o of s)e.nowMs-n[o.generationId]>=e.policy.generationTtlMs&&i.add(o.generationId);let c=e.generations.filter(o=>!i.has(o.generationId)).reduce((o,a)=>o+a.size,0);for(let o of s){if(c<=e.policy.budgetBytes)break;i.has(o.generationId)||(i.add(o.generationId),c-=o.size)}for(let o of i)delete n[o];return{deleteWorktrees:t,deleteGenerations:e.generations.filter(o=>i.has(o.generationId)),deleteLocks:e.locks.filter(o=>!o.live),deleteTemporaries:e.temporaries.filter(o=>!o.live),protectedGenerationIds:[...r].sort(),unreferencedSince:n}}function Ht(e,t){let r=new Set(e.filter(n=>n.managed&&(n.live||n.busy)).flatMap(n=>[n.lease.baseGenerationId,n.lease.activeGenerationId]).filter(n=>n!==void 0));for(let n of t)n.live&&r.add(n.generationId);return r}function ws(e,t,r={}){if(!je())return{kind:"disabled"};let n=se(e);if(!n)return{kind:"unavailable"};let s=m(B(),"repositories",n.repositoryId);if(!Mt(s))return{kind:"unavailable"};let i=(r.now??Date.now)(),c=m(s,"gc-state.json"),o=Gt(c);if(!r.force&&o&&i-Date.parse(o.lastSweepAt)<fn)return{kind:"throttled",sweptAt:o.lastSweepAt};let a=$e(s,{now:()=>i});if(!a)return{kind:"busy"};try{let u=Ut(e,s,n.repositoryId,o?.unreferencedSince??{}),d=gn({nowMs:i,...u,policy:{generationTtlMs:r.policy?.generationTtlMs??hn,budgetBytes:r.policy?.budgetBytes??ln}}),h=0,l=0;for(let f of d.deleteWorktrees){if(!$t(f.lease))continue;let O=Be(m(f.lease.localCacheDir,"cache-lifecycle.lock"));if(O)try{if(ke(f.lease,!0))continue;try{nt({projectRoot:f.lease.projectRoot,cacheDir:f.lease.localCacheDir,cliVersion:t})}catch{continue}if(ke(f.lease,!0))continue;D(f.lease.localCacheDir,{recursive:!0,force:!0}),D(f.leasePath,{force:!0}),l+=1}finally{O.release()}}for(let f of d.deleteLocks)D(f.path,{force:!0});for(let f of d.deleteTemporaries)D(f.path,{recursive:!0,force:!0});for(let f of d.deleteGenerations)D(f.path,{recursive:!0,force:!0}),h+=f.size;We(m(s,"evidence.db"));let p={kind:"swept",sweptAt:new Date(i).toISOString(),deletedWorktrees:l,deletedGenerations:d.deleteGenerations.length,deletedBytes:h,protectedGenerations:d.protectedGenerationIds.length},g={version:1,lastSweepAt:p.sweptAt,unreferencedSince:d.unreferencedSince,lastResult:p};return C(c,g,{spacing:2,trailingNewline:!0}),p}catch(u){return{kind:"failed",error:u instanceof Error?u.message:String(u)}}finally{a.release()}}function Is(e,t,r){let n=ze(e,r.dbPath,t);if(n)return{state:"bypassed",reason:n,localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let s=se(e);if(!s)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let i=m(B(),"repositories",s.repositoryId),c=Bt(m(i,"worktrees",`${s.worktreeId}.json`)),o=Gt(m(i,"gc-state.json")),a=Ut(e,i,s.repositoryId,o?.unreferencedSince??{}),u=Ht(a.leases,a.locks),d=a.generations.filter(g=>!u.has(g.generationId)),h=a.generations.reduce((g,f)=>g+f.size,0),l=Ve(e,t),p=0;return l&&(p=mn(l)),{state:"managed",repositoryId:s.repositoryId,worktreeId:s.worktreeId,localCacheDir:r.cacheDir,...c?{baseGenerationId:c.baseGenerationId,activeGenerationId:c.activeGenerationId,lastAction:c.lastAction,reason:c.lastReason,lastSeenAt:c.lastSeenAt}:{},generations:a.generations.length,generationBytes:h,protectedGenerations:a.generations.filter(g=>u.has(g.generationId)).length,unreferencedGenerations:d.length,unreferencedBytes:d.reduce((g,f)=>g+f.size,0),temporaryGenerations:a.temporaries.length,sharedEvidence:{path:l,exists:p>0,bytes:p},cleanup:o?.lastResult}}function mn(e){return[e,`${e}-wal`,`${e}-shm`].reduce((t,r)=>{try{return t+Nt(r).size}catch{return t}},0)}function Ut(e,t,r,n){let s=new Set(He(e).map(u=>N(u.path))),i=[];for(let u of Ee(m(t,"worktrees"))){if(!u.endsWith(".json"))continue;let d=m(t,"worktrees",u),h=Bt(d);if(!h)continue;let l=N(h.projectRoot);i.push({leasePath:d,lease:h,managed:h.repositoryId===r&&$t(h),live:s.has(l)||Mt(l),busy:ke(h)})}let c=[];for(let u of Ee(m(t,"locks"))){let d=/^([a-f0-9]{64})\.lock$/.exec(u);if(!d)continue;let h=m(t,"locks",u),l=Ae(h),p=l!==void 0&&S(l),g=d[1];c.push({generationId:g,path:h,live:p})}let o=[],a=[];for(let u of Ee(m(t,"generations"))){let d=/^\.tmp-(\d+)-/.exec(u);if(d){let p=m(t,"generations",u),g=Number(d[1]);try{a.push({path:p,size:qt(p),live:Number.isSafeInteger(g)&&S(g)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(u))continue;let h=m(t,"generations",u),l;try{l=X(h)}catch{continue}!l.isDirectory()||l.isSymbolicLink()||o.push({generationId:u,path:h,size:qt(h),...n[u]===void 0?{}:{unreferencedAt:n[u]}})}return{leases:i,generations:o,locks:c,temporaries:a}}function $t(e){if(e.ownershipChecksum!==Fe(e)||ce(e.localCacheDir)!==ce(Ge(e.projectRoot)))return!1;let t=N(B()),r=N(m(t,"projects")),n=N(e.localCacheDir);if(!n.startsWith(`${r}${Lt}`))return!1;try{let s=X(t),i=X(r),c=X(n);if(!s.isDirectory()||s.isSymbolicLink()||!i.isDirectory()||i.isSymbolicLink()||!c.isDirectory()||c.isSymbolicLink())return!1;let o=_t(r);return _t(n).startsWith(`${o}${Lt}`)}catch{return!1}}function ke(e,t=!1){for(let n of t?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let s=Ae(m(e.localCacheDir,n));if(s!==void 0&&S(s))return!0}let r=Ae(k(e.localCacheDir).lockPath);return r!==void 0&&S(r)}function Bt(e){try{let t=JSON.parse(y(e,"worktree cache lease"));return t.version!==1||typeof t.repositoryId!="string"||typeof t.worktreeId!="string"||typeof t.projectRoot!="string"||t.treeOid!==void 0&&typeof t.treeOid!="string"||typeof t.localCacheDir!="string"||t.baseGenerationId!==void 0&&typeof t.baseGenerationId!="string"||t.activeGenerationId!==void 0&&typeof t.activeGenerationId!="string"||typeof t.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(t.ownershipChecksum)||typeof t.lastAction!="string"||t.lastReason!==void 0&&typeof t.lastReason!="string"||typeof t.lastSeenAt!="string"?null:t}catch{return null}}function Ae(e){try{let t=JSON.parse(y(e,"watch lock record"));return typeof t.pid=="number"&&Number.isSafeInteger(t.pid)&&t.pid>0?t.pid:void 0}catch{return}}function Gt(e){try{let t=JSON.parse(y(e,"repository cache GC state"));return t.version!==1||typeof t.lastSweepAt!="string"||!Number.isFinite(Date.parse(t.lastSweepAt))||!t.unreferencedSince||typeof t.unreferencedSince!="object"||!t.lastResult?null:t}catch{return null}}function Ee(e){try{return Dt(e)}catch{return[]}}function qt(e){let t=0,r=[e];for(;r.length>0;){let n=r.pop();for(let s of Dt(n,{withFileTypes:!0})){let i=m(n,s.name);s.isDirectory()?r.push(i):s.isFile()&&(t+=Nt(i).size)}}return t}export{On as a,Hn as b,yr as c,Un as d,$n as e,Sr as f,nt as g,Bn as h,Gn as i,ss as j,is as k,os as l,ws as m,Is as n};
14
- //# sourceMappingURL=chunk-LU47HG23.js.map
@@ -1,2 +0,0 @@
1
- import{a}from"./chunk-NGEXCJJW.js";import{f as o}from"./chunk-C3KV2II6.js";function c(t){return/[*?]/.test(t)?t.replace(/\*\*/g,"%").replace(/\*/g,"%").replace(/\?/g,"_"):`%${t}%`}function b(t,r){let n=c(r);return a(t,{like:n,includeIgnored:!1}).filter(e=>f({pattern:r,relativePath:e})).map(e=>({relativePath:e}))}function f(t,r){let n=typeof t=="string"?{pattern:t,relativePath:r}:t;if(typeof n.pattern!="string"||typeof n.relativePath!="string")throw new TypeError("pathMatchesGlob requires pattern and relativePath.");let e=o(n.pattern),s=o(n.relativePath);if(!/[*?]/.test(e))return s.includes(e);let l=e.includes("/")?e:`**/${e}`;return i(l.split("/"),s.split("/"))}function i(t,r){if(t.length===0)return r.length===0;let[n,...e]=t;return n==="**"?i(e,r)||r.length>0&&i(t,r.slice(1)):r.length===0||!h(n??"",r[0]??"")?!1:i(e,r.slice(1))}function h(t,r){let n="^";for(let e of t)e==="*"?n+="[^/]*":e==="?"?n+="[^/]":n+=u(e);return n+="$",new RegExp(n).test(r)}function u(t){return/[\\^$.*+?()[\]{}|]/.test(t)?`\\${t}`:t}export{b as a,f as b};
2
- //# sourceMappingURL=chunk-LVY7NPF7.js.map
@@ -1,4 +0,0 @@
1
- import{a as D,b as v,c as $,d as B}from"./chunk-MV7OWDUX.js";import{a as K}from"./chunk-ZTETIQ35.js";import{b as I,c as A}from"./chunk-UJCOIXDY.js";import{c as M,h as R}from"./chunk-26QA6FAI.js";import{a as g}from"./chunk-BGBBVSH4.js";import{b as k,d as F,e as b}from"./chunk-EKZTZXHZ.js";import{l as w}from"./chunk-UJPRPGCO.js";import{J as C}from"./chunk-WCCFZ7V7.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},d=e?.semantic!==!1,a=new A(t),m=a.scopedDefinitions(n),y=Q(a,n),p={high:0,medium:1,low:2};return K({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>g(c)-g(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:u=>{let c=U(u),f=W(t,a,u,c,{semantic:d}),h=u.filter(P=>{let x=S(t,P,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&j(P,x.realConsumers.length,y)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,h,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=S(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!j(f.definition,f.realConsumers.length,y))return null;let h=V(t,f);return!l&&h.confidence==="low"?null:h},orderResults:(u,c)=>p[u.confidence]-p[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(t,e,n,i){return n.filter(s=>s.isTypeLike&&g(s)>=i.minLoc).filter(s=>g(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!s.relativePath.endsWith(".d.ts")).filter(s=>M(s.relativePath)!=="test").filter(s=>!R(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function L(t,e,n,i){return v(D(t,e).forDefinitions(n,{semantic:i.semantic,sourceFallback:i.sourceFallback}))}function W(t,e,n,i,s){let r=L(t,e,n,{semantic:!1,sourceFallback:!1}),l=n.filter(a=>{let m=S(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&T(a.relativePath))}),o=s.semantic&&l.length>0?I(r,L(t,e,l,{semantic:!0,sourceFallback:!1})):r,d=l.filter(a=>S(t,a,o,i).realConsumers.length<=1);return I(o,L(t,e,d,{semantic:!1,sourceFallback:!0}))}function U(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=b(n.symbol);s&&i.set(s,n)}return e}function S(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:l,barrelConsumers:o,importOnlyConsumers:d}=$(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:o+d,transitivelyReachable:a}}function V(t,e){let n=E(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),l=z(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:g(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:l.actionTier,stalenessKind:l.stalenessKind,recommendation:l.recommendation}}function z(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),l=r.map(a=>a.singleton);if(r.length===0)return new Set;let o=v(D(t,e).forDefinitions(l,{semantic:s.semantic,sourceFallback:!0})),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,o)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=b(n.symbol);i&&e.set(N(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(E(t,n.relativePath,n.startLine)!=="class")return null;let i=b(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(N(n.relativePath,s))??null:null}function G(t,e,n){let i=b(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!B(t,r,i))}function N(t,e){return`${t}\0${e}`}function J(t,e,n){let i=C(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=k(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function j(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=w(t,e.relativePath),r=b(e.symbol);if(!r)return!1;let l=i.get(e.relativePath);if(!l)return!1;let o=[...s.get(r)??[]],d=new Set;for(;o.length>0;){let a=o.pop();if(d.has(a))continue;d.add(a);let m=l.get(a);if(!m)continue;let y=n.get(m.symbolId);if(y){for(let p of y)if(p!==e.relativePath&&!t.isIgnored(p))return!0}for(let p of s.get(a)??[])o.push(p)}return!1}function E(t,e,n){let i=C(t,e);if(!i)return"other";let s=i.split(`
2
- `),r=Math.max(0,n-2),l=Math.min(s.length-1,n+2);for(let o=r;o<=l;o++){let a=(s[o]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(a))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(a))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(a))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(a))return"enum"}return"other"}function ee(t,e){let n=C(t,e.relativePath);if(!n)return!1;let i=b(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),l=n.split(`
3
- `);for(let o=0;o<l.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&r.test(l[o]??""))return!0;return!1}function ne(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{de as a};
4
- //# sourceMappingURL=chunk-MKCDWWGV.js.map
@@ -1,2 +0,0 @@
1
- import{i as o}from"./chunk-46XGSFNI.js";function P(){return performance.now()}import{execFileSync as m}from"child_process";import{platform as p}from"os";var a=new Set(["aix","android","darwin","freebsd","haiku","linux","openbsd","sunos","win32","cygwin","netbsd"]);function l(r){if(!r||typeof r!="object"||Array.isArray(r))return null;let t=r;return t.version!==1||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.platform!="string"||!a.has(t.platform)||typeof t.startToken!="string"||t.startToken.trim()===""?null:{version:1,pid:t.pid,platform:t.platform,startToken:t.startToken}}function f(r,t){return r.version===t.version&&r.pid===t.pid&&r.platform===t.platform&&r.startToken===t.startToken}var u=1e3,s=16*1024;function x(r,t=y){if(!Number.isSafeInteger(r)||r<=0)return null;try{let n=c(r,t);return n?{version:1,pid:r,platform:t.platform,startToken:n}:null}catch{return null}}function c(r,t){if(t.platform==="linux"||t.platform==="android")return d(t.readFile(`/proc/${r}/stat`));if(t.platform==="win32"){let n=`([DateTimeOffset](Get-Process -Id ${r} -ErrorAction Stop).StartTime).ToUnixTimeMilliseconds()`;return i(t.run("powershell.exe",["-NoProfile","-NonInteractive","-Command",n]))}return t.platform==="darwin"||t.platform==="freebsd"||t.platform==="openbsd"||t.platform==="netbsd"?i(t.run("ps",["-p",String(r),"-o","lstart="])):null}function d(r){let t=r.lastIndexOf(")");if(t<0)return null;let e=r.slice(t+1).trim().split(/\s+/)[19];return e&&/^\d+$/.test(e)?e:null}function i(r){let t=r.trim();return t===""?null:t}var y={platform:p(),readFile(r){return o(r,{maxBytes:s,inputKind:"process identity pseudo-file"})},run(r,t){return m(r,[...t],{encoding:"utf8",timeout:u,maxBuffer:s,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"]})}};export{P as a,l as b,f as c,x as d};
2
- //# sourceMappingURL=chunk-MNE7YG56.js.map
@@ -1,26 +0,0 @@
1
- import{b as d}from"./chunk-Z4N3MZYA.js";import{o as f}from"./chunk-7O5IKBTZ.js";import{d as r,t as m}from"./chunk-EKZTZXHZ.js";function g(t,o={}){let{limit:n=30,scope:e}=o,s=e?"AND def_d.relative_path LIKE ?":"",c=e?[`%${e}%`]:[],l=t.all(`SELECT
2
- gs.symbol,
3
- COUNT(*) AS ref_count,
4
- COUNT(DISTINCT ref_d.id) AS file_count,
5
- def_d.relative_path AS defined_in
6
- FROM mentions m
7
- JOIN chunks c ON m.chunk_id = c.id
8
- JOIN documents ref_d ON c.document_id = ref_d.id
9
- JOIN global_symbols gs ON m.symbol_id = gs.id
10
- JOIN (
11
- SELECT m2.symbol_id, c2.document_id
12
- FROM mentions m2
13
- JOIN chunks c2 ON m2.chunk_id = c2.id
14
- WHERE m2.role = 1
15
- GROUP BY m2.symbol_id
16
- ) sym_def ON sym_def.symbol_id = gs.id
17
- JOIN documents def_d ON sym_def.document_id = def_d.id
18
- WHERE m.role != 1
19
- AND def_d.id != ref_d.id
20
- ${t.pathExclusionsFor("def_d")}
21
- ${t.symbolNoiseFor("gs")}
22
- ${s}
23
- GROUP BY gs.id
24
- ORDER BY ref_count DESC
25
- LIMIT ?`,...c,n).filter(i=>!t.isIgnored(i.defined_in)).map(i=>({symbol:i.symbol,shortName:r(i.symbol),refCount:i.ref_count,fileCount:i.file_count,definedIn:i.defined_in}));return l.length>0?l:u(t,e,n)}function u(t,o,n){return m(t,{scope:o}).filter(e=>!t.isIgnored(e.relativePath)).map(e=>a(t,e)).filter(e=>e.refCount>0).sort((e,s)=>s.refCount-e.refCount||s.fileCount-e.fileCount).slice(0,n)}function a(t,o){let e=d(t,o,{limit:500,semanticEvidence:f}).filter(s=>s.file!==o.relativePath);return{symbol:o.symbol,shortName:r(o.symbol),refCount:e.length,fileCount:new Set(e.map(s=>s.file)).size,definedIn:o.relativePath}}export{g as a};
26
- //# sourceMappingURL=chunk-MRXBEXSY.js.map
@@ -1,2 +0,0 @@
1
- import{l as I}from"./chunk-HX7M4BDI.js";import{a as y,e as g}from"./chunk-EKZTZXHZ.js";import{x as v}from"./chunk-GH74ASD6.js";import{A as x,k as D,l as _,t as F,v as p,y as E}from"./chunk-WCCFZ7V7.js";import{c as b}from"./chunk-7S5E7KWT.js";import{spawnSync as O}from"child_process";import{createHash as U}from"crypto";import{existsSync as k}from"fs";import{dirname as L,join as T}from"path";import{fileURLToPath as j}from"url";var N=b("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]}),M=E({kind:"consumer-file-usage",invalidation:x("consumer-file-usage"),serialize:Q,deserialize:W});function Le(e,n){return{forDefinitions(r,i){return V(e,n,r,i)}}}function Me(e){let n=new Map;for(let[r,i]of e)n.set(r,new Set(i.files.map(t=>t.file)));return n}function Re(e,n,r){return w(e,n,r).partition}function V(e,n,r,i){let t=h(r.length),s=F()?_(e):null,a=s?B(r,i,s):void 0,o=a?{workIdentity:a,workOutcome:"computed"}:{};return p("consumer-evidence.product",()=>{let l=p("consumer-evidence.provenance",()=>z(e,n,r,i),()=>({...o,definitions:r.length,semantic:i.semantic,sourceFallback:i.sourceFallback!==!1})),u=new Map;t={...t,...l.counters};let c=Y(r,l.sources);return p("consumer-evidence.classify",()=>{let f=q(e,r,l.sources,c);for(let d of r){let m=f.get(d.symbolId)??H();t.realFiles+=m.partition.realConsumers.length,t.reexportOnlyFiles+=m.partition.barrelConsumers,t.importOnlyFiles+=m.partition.importOnlyConsumers,u.set(d.symbolId,{definition:d,files:m.files,...m.partition})}},()=>({...o,...c,realFiles:t.realFiles,reexportOnlyFiles:t.reexportOnlyFiles,importOnlyFiles:t.importOnlyFiles})),u},()=>({...o,...t}))}function B(e,n,r){let i=U("sha256").update("consumer-evidence-v1\0").update(r).update("\0").update(n.semantic?"semantic\0":"indexed\0").update(n.sourceFallback===!1?"no-source-fallback":"source-fallback");for(let t of e.map(s=>s.symbol).sort())i.update("\0").update(t);return i.digest("hex").slice(0,24)}function h(e){return{definitions:e,indexedFiles:0,semanticFiles:0,fallbackFiles:0,totalFiles:0,realFiles:0,reexportOnlyFiles:0,importOnlyFiles:0}}function z(e,n,r,i){let t=h(r.length),s=new Map;return S(s,t,"indexed",n.crossFileCallerMap(r,{semantic:!1})),i.semantic&&S(s,t,"semantic",I(e,r)),i.sourceFallback!==!1&&S(s,t,"source-fallback",n.sourceFallbackCallerFiles(r)),t.totalFiles=[...s.values()].reduce((a,o)=>a+o.size,0),{sources:s,counters:t}}function Y(e,n){return{definitions:e.length,consumerFiles:[...n.values()].reduce((r,i)=>r+i.size,0),nativeAttempted:!1,nativeUsed:!1,nativeReason:"not-attempted"}}function S(e,n,r,i){let t=0;for(let[s,a]of i){let o=e.get(s);o||(o=new Map,e.set(s,o));for(let l of a){t++;let u=o.get(l)??new Set;u.add(r),o.set(l,u)}}r==="indexed"?n.indexedFiles+=t:r==="semantic"?n.semanticFiles+=t:n.fallbackFiles+=t}function q(e,n,r,i){let t=re(e,n,r,i);return t||$(e,n,r)}function $(e,n,r){let i=new Map;for(let t of n){let s=r.get(t.symbolId)??new Map;i.set(t.symbolId,w(e,t,[...s.keys()],s))}return i}function w(e,n,r,i=new Map){let t=[],s=0,a=0,o=g(n.symbol),l=[];for(let u of r){let c;X(e,u,n.relativePath,o)?(s++,c="reexport-only"):J(e,u,o)?(a++,c="import-only"):(t.push(u),c="real"),l.push({file:u,sources:[...i.get(u)??[]],classification:c})}return{partition:{realConsumers:t,barrelConsumers:s,importOnlyConsumers:a},files:l}}function H(){return{partition:{realConsumers:[],barrelConsumers:0,importOnlyConsumers:0},files:[]}}function J(e,n,r){if(!r)return!1;let i=v(n);if(!i)return!1;let t=N.get(e,n,()=>A(e,n,i));return t.importedLeaves.has(r)&&!t.usedLeaves.has(r)}function A(e,n,r){let i=y(e).forFile(n,{text:!0,ast:!0}),t=i.text;if(!t)return G();let s=D(e,n,t),a=M.read(e,n,s);if(a)return a;let o=K(i.ast,r);return M.write(e,n,s,o),o}function K(e,n){let r=new Set,i=new Set;if(!e)return{importedLeaves:r,usedLeaves:i};let t=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),s=(a,o)=>{let l=o||t.has(a.type);(a.type==="identifier"||a.type==="type_identifier"||a.type==="property_identifier"||a.type==="field_identifier")&&(l?r.add(a.text):i.add(a.text));for(let u of a.children)s(u,l)};return s(e.rootNode,!1),{importedLeaves:r,usedLeaves:i}}function G(){return{importedLeaves:new Set,usedLeaves:new Set}}function Q(e){return JSON.stringify({importedLeaves:[...e.importedLeaves],usedLeaves:[...e.usedLeaves]})}function W(e){try{let n=JSON.parse(e);return!Array.isArray(n.importedLeaves)||!Array.isArray(n.usedLeaves)?null:{importedLeaves:new Set(n.importedLeaves.filter(r=>typeof r=="string")),usedLeaves:new Set(n.usedLeaves.filter(r=>typeof r=="string"))}}catch{return null}}function X(e,n,r,i){if(!i)return!1;let t=y(e).forFile(n,{lines:!0,reexports:!0}),s=t.lines??[];if(s.length===0)return!1;let a=t.reexports??[];return P(s,a,i)}function P(e,n,r){if(e.length===0||n.length===0)return!1;let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new RegExp(`\\b${i}\\b`),s=0;for(let a=0;a<e.length;a++){if(!t.test(e[a]??""))continue;if(s++,!n.find(l=>l.startLine<=a&&a<=l.endLine))return!1}return s>0}var Z="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY",ee="SCIP_QUERY_NATIVE_KERNELS_BIN",ne="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY_MIN_FILES",R=1e3,ie=5e3,te=64*1024*1024,C;function re(e,n,r,i){let t=process.env[Z]?.toLowerCase();if(t!=="1"&&t!=="true")return i.nativeReason=t==="0"||t==="false"?"disabled":"opt-in-required",null;if(i.consumerFiles<fe())return i.nativeReason="below-threshold",null;let s=me();if(!s)return i.nativeReason="binary-missing",null;i.nativeAttempted=!0;let a=se(e,n,r),o=O(s,["consumer-classify"],{input:JSON.stringify(a),encoding:"utf8",timeout:ie,maxBuffer:te});if(o.status!==0||o.error)return i.nativeReason=o.error?`spawn-error:${o.error.message}`:`exit-${o.status??"null"}`,null;try{let l=JSON.parse(o.stdout),u=ae(l,n);return u?(i.nativeUsed=!0,i.nativeReason="used",u):(i.nativeReason="invalid-response",null)}catch{return i.nativeReason="invalid-json",null}}function se(e,n,r){let i=new Map,t=[];for(let o of n){let l=g(o.symbol),c=[...(r.get(o.symbolId)??new Map).entries()].map(([f,d])=>{let m=i.get(f)??new Set;return l&&m.add(l),i.set(f,m),{file:f,sources:[...d]}});t.push({symbol_id:o.symbolId,leaf:l,consumer_files:c})}let s={},a={};for(let[o,l]of i){let u=v(o);if(u){let f=N.get(e,o,()=>A(e,o,u));s[o]={imported_leaves:[...f.importedLeaves],used_leaves:[...f.usedLeaves]}}let c=oe(e,o,l);c.length>0&&(a[o]=c)}return{definitions:t,file_usages:s,reexport_only_leaves:a}}function oe(e,n,r){if(r.size===0)return[];let i=y(e).forFile(n,{lines:!0,reexports:!0}),t=i.lines??[],s=i.reexports??[];return t.length===0||s.length===0?[]:[...r].filter(a=>P(t,s,a))}function ae(e,n){if(!Array.isArray(e.entries)||e.entries.length!==n.length)return null;let r=new Set(n.map(t=>t.symbolId)),i=new Map;for(let t of e.entries){let s=le(t);if(!s||!r.has(s.symbol_id))return null;i.set(s.symbol_id,{partition:{realConsumers:s.real_consumers,barrelConsumers:s.barrel_consumers,importOnlyConsumers:s.import_only_consumers},files:s.files})}for(let t of r)if(!i.has(t))return null;return i}function le(e){if(!e||typeof e!="object")return null;let n=e;if(typeof n.symbol_id!="number"||!Array.isArray(n.real_consumers)||typeof n.barrel_consumers!="number"||typeof n.import_only_consumers!="number"||!Array.isArray(n.files)||!n.real_consumers.every(i=>typeof i=="string"))return null;let r=[];for(let i of n.files){if(!i||typeof i!="object")return null;let t=i;if(typeof t.file!="string"||!Array.isArray(t.sources)||!t.sources.every(ue)||!ce(t.classification))return null;r.push({file:t.file,sources:t.sources,classification:t.classification})}return{symbol_id:n.symbol_id,real_consumers:n.real_consumers,barrel_consumers:n.barrel_consumers,import_only_consumers:n.import_only_consumers,files:r}}function ue(e){return e==="indexed"||e==="semantic"||e==="source-fallback"}function ce(e){return e==="real"||e==="reexport-only"||e==="import-only"}function fe(){let e=process.env[ne];if(!e)return R;let n=Number(e);return Number.isFinite(n)&&n>=0?n:R}function me(){if(C!==void 0)return C;let e=process.env[ee],n=process.platform==="win32"?"scip-query-kernels.exe":"scip-query-kernels";return C=[...e?[e]:[],...de().map(i=>T(i,"target","release",n))].find(i=>k(i))??null,C}function de(){let e=new Set,n=L(j(import.meta.url));for(let r=0;r<5;r++)e.add(n),n=L(n);return[...e]}export{Le as a,Me as b,Re as c,J as d};
2
- //# sourceMappingURL=chunk-MV7OWDUX.js.map
@@ -1,11 +0,0 @@
1
- import{c as u}from"./chunk-7S5E7KWT.js";import{basename as d}from"path";var f=u("indexed-document-paths",{clearGroups:["whole-project"]});function g(t,e={}){let r=x(e);return[...f.get(t,r,()=>{let s=e.scope?"AND relative_path LIKE ?":"",i=e.like?"AND relative_path LIKE ?":"",c=[...e.scope?[`%${e.scope}%`]:[],...e.like?[e.like]:[]],l=t.all(`SELECT relative_path
2
- FROM documents
3
- WHERE 1 = 1
4
- ${t.pathExclusionsFor("documents")}
5
- ${s}
6
- ${i}
7
- ORDER BY relative_path`,...c).map(a=>a.relative_path),n=e.extensions?l.filter(a=>e.extensions.some(m=>a.toLowerCase().endsWith(m.toLowerCase()))):l;return e.includeIgnored===!1?n.filter(a=>!t.isIgnored(a)):n})]}function x(t){let e=t.extensions?[...new Set(t.extensions.map(r=>r.toLowerCase()))].sort():null;return JSON.stringify({scope:t.scope??null,like:t.like??null,extensions:e,includeIgnored:t.includeIgnored!==!1})}function v(t,e,r){let o=p(e);if(!o)return[];let s=t.all(`SELECT relative_path
8
- FROM documents
9
- WHERE relative_path = ?
10
- ${t.pathExclusionsFor("documents")}`,o).filter(n=>!t.isIgnored(n.relative_path)).map(n=>({relativePath:n.relative_path,score:h(n.relative_path,o)}));if(s.length>0)return s;let i=g(t,{includeIgnored:!1}).map(n=>({relativePath:n,score:h(n,o)})).filter(n=>n.score>0).sort((n,a)=>a.score-n.score||n.relativePath.localeCompare(a.relativePath)),c=i.filter(n=>n.score>=1100);if(c.length>0)return r.allowMultiple?c:[c[0]];let l=i.filter(n=>n.score>=800);return l.length>0?r.allowMultiple?l:[l[0]]:r.allowMultiple?i:i.slice(0,1)}function h(t,e){let r=p(t),o=d(r),s=d(e),i=0;return r===e&&(i+=1200),r.endsWith(`/${e}`)&&(i+=1100),o===s&&(i+=900),r.startsWith(`${e}/`)&&(i+=850),r.includes(e)&&(i+=250),i}function p(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{g as a,v as b};
11
- //# sourceMappingURL=chunk-NGEXCJJW.js.map
@@ -1,29 +0,0 @@
1
- import{b as l}from"./chunk-S7OYBOCK.js";import{c as a}from"./chunk-UJCOIXDY.js";import{d as i,g as n}from"./chunk-EKZTZXHZ.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
2
- FROM mentions m
3
- JOIN chunks c ON m.chunk_id = c.id
4
- JOIN documents d1 ON c.document_id = d1.id
5
- JOIN global_symbols gs ON m.symbol_id = gs.id
6
- WHERE d1.relative_path NOT IN (${t})
7
- AND (
8
- EXISTS (
9
- SELECT 1
10
- FROM defn_enclosing_ranges der
11
- JOIN documents d2 ON der.document_id = d2.id
12
- WHERE der.symbol_id = gs.id
13
- AND d2.relative_path IN (${t})
14
- )
15
- OR EXISTS (
16
- SELECT 1
17
- FROM mentions def_m
18
- JOIN chunks def_c ON def_m.chunk_id = def_c.id
19
- JOIN documents d2 ON def_c.document_id = d2.id
20
- WHERE def_m.symbol_id = gs.id
21
- AND def_m.role = 1
22
- AND d2.relative_path IN (${t})
23
- )
24
- )
25
- AND m.role != 1
26
- AND ${e.localSymbolPredicate}
27
- ${e.pathExclusionsFor("d1")}
28
- ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
29
- //# sourceMappingURL=chunk-NIW6JDC5.js.map
@@ -1,16 +0,0 @@
1
- import{b as V,g as E}from"./chunk-FJH2NW7J.js";import{l as b}from"./chunk-WUPW3UN3.js";import{a as k,b as h,g as m}from"./chunk-46XGSFNI.js";import xe from"better-sqlite3";import{existsSync as Fn}from"fs";import{dirname as On,join as Pn,resolve as ve}from"path";import B from"better-sqlite3";import{execFileSync as X}from"child_process";import{existsSync as J,readdirSync as Y}from"fs";import{extname as R,join as q}from"path";import{readdirSync as He}from"fs";import{execFileSync as Ke}from"child_process";import{extname as Be,join as Xe}from"path";var K=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],C=[".vue"],I=[".tsx",".jsx"],T=[".vue"],Ye=[...I,...T],qe=new Set(I),ze=new Set(T),G=new Set(K.map(e=>e.toLowerCase())),Qe=[...G].sort().join(","),F=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var Ze=V("source-files",{clearGroups:[]});function cn(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:n=>z({projectRoot:n.projectRoot,dbPath:n.dbPath,extensions:e.extensions,onStatus:n.onStatus})}}function z(e){let n=new Set((e.extensions??C).map(i=>i.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!J(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=E(e.projectRoot),t=Q(e.projectRoot,n).filter(i=>!r.isIgnored(i)),o=new B(e.dbPath);try{let i=ee(o,t),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
2
- VALUES (?, ?, NULL, ?)`),u=o.transaction(l=>{let d=0;for(let f of l){if(i.has(f))continue;let p=b(e.projectRoot,f,{inputKind:"auxiliary source file"}),W=s.run(ne(f),f,p);d+=Number(W.changes)}return d})(t),c={scanned:t.length,inserted:u,existing:t.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function Q(e,n){let r=Z(e,n);if(r)return r;let t=[],o=i=>{let s=i?q(e,i):e,a;try{a=Y(s,{withFileTypes:!0})}catch{return}for(let u of a){if(F.has(u.name))continue;let c=i?`${i}/${u.name}`:u.name;if(u.isDirectory()){o(c);continue}n.has(R(u.name).toLowerCase())&&t.push(c)}};return o(""),t.sort()}function Z(e,n){try{return X("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}).split(`
3
- `).filter(t=>t&&n.has(R(t).toLowerCase())).sort()}catch{return null}}function ee(e,n){let r=new Set,t=500;for(let o=0;o<n.length;o+=t){let i=n.slice(o,o+t),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)r.add(a.relative_path)}return r}function ne(e){return R(e).toLowerCase()===".vue"?"vue":R(e).replace(/^\./,"").toLowerCase()||"source"}import{writeFileSync as gn}from"fs";function fn(e,n){let r=performance.now(),t=e.run(n);return{stageId:e.id,facts:e.facts,durationMs:performance.now()-r,result:t}}function te(){return{"missing-source-file":0,"missing-service-script":0,"no-definition":0,"same-file-definition":0,"unindexed-definition":0}}function S(){return{skippedReferences:0,skippedReferenceReasons:te(),skippedReferenceSamples:[]}}function L(e,n){e.skippedReferences+=n.skippedReferences;for(let r of Object.keys(e.skippedReferenceReasons)){e.skippedReferenceReasons[r]+=n.skippedReferenceReasons[r];for(let t of n.skippedReferenceSamples.filter(o=>o.reason===r))e.skippedReferenceSamples.filter(i=>i.reason===r&&i.sourceFile===t.sourceFile).length<2&&e.skippedReferenceSamples.push(t)}}import{createRequire as re}from"module";import{existsSync as oe}from"fs";import{dirname as O,extname as ie,join as P,relative as se,resolve as bn}from"path";import{pathToFileURL as ae}from"url";function A(e,n){let{vueCore:r,ts:t,volarTs:o}=ue(e),{parsed:i,vueOptions:s}=ce(r,t,n),a=O(n),u=r.createVueLanguagePlugin(t,i.options,s,p=>p),c=le(r,t,u),l=de(a,i),{languageServiceHost:d}=o.createLanguageServiceHost(t,t.sys,c,p=>p,l),f=t.createLanguageService(d);return{ts:t,language:c,languageService:f,fileNames:i.fileNames,configDir:a}}function ue(e){let n=re(ae(P(e,"package.json")).href);return{vueCore:y(n,"@vue/language-core",e),ts:y(n,"typescript",e),volarTs:y(n,"@volar/typescript",e)}}function ce(e,n,r){let t=n.readConfigFile(r,n.sys.readFile);if(t.error||!t.config)throw new Error(`Failed to read ${r}`);let i=e.createParsedCommandLine(n,n.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,n.sys.writeFile)),{parsed:n.parseJsonConfigFileContent(t.config,n.sys,O(r),void 0,r,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:n.ScriptKind.Deferred}))),vueOptions:i}}function le(e,n,r){let t={},o=e.createLanguage([r],new Map,i=>{if(!oe(i))return;let s=m(i,{maxBytes:h,inputKind:"Vue language-service source file"});t.current?.scripts.set(i,n.ScriptSnapshot.fromString(s),r.getLanguageId(i)??me(i))});return t.current=o,o}function de(e,n){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>n.options,getScriptFileNames:()=>n.fileNames,getProjectReferences:()=>n.projectReferences,getProjectVersion:()=>"0"}}function y(e,n,r){try{return e(n)}catch(t){throw(typeof t=="object"&&t!==null&&"code"in t?t.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${n} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:t}):t}}function w(e,n,r){let t=ge(e);return o=>{if(!o.name)return null;let i=g(n,o.fileName),s=r.get(o.fileName);if(!s)return null;let a=r.positionAt(s,o.textSpan.start),u=t.get(i);if(!u)return null;let c=u.starts.find(d=>d.line===a.line&&d.displayName===o.name);if(c)return c.symbolId;let l=u.containingByLine.get(a.line);return l&&l.displayName===o.name?l.symbolId:fe(u.starts,a.line,2,o.name)}}function ge(e){let n=e.prepare(`
4
- SELECT
5
- d.relative_path AS relativePath,
6
- der.start_line AS startLine,
7
- der.end_line AS endLine,
8
- der.symbol_id AS symbolId,
9
- gs.display_name AS displayName
10
- FROM defn_enclosing_ranges der
11
- JOIN documents d ON d.id = der.document_id
12
- JOIN global_symbols gs ON gs.id = der.symbol_id
13
- ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
14
- `).all(),r=new Map;for(let t of n){let o=r.get(t.relativePath);o||(o={containingByLine:new Map,starts:[]},r.set(t.relativePath,o)),o.starts.push({line:t.startLine,symbolId:t.symbolId,displayName:t.displayName});for(let i=t.startLine;i<=t.endLine;i++)o.containingByLine.set(i,{symbolId:t.symbolId,displayName:t.displayName})}for(let t of r.values())t.starts.sort((o,i)=>o.line-i.line);return r}function fe(e,n,r,t){let o=0,i=e.length-1;for(;o<=i;){let a=Math.floor((o+i)/2);e[a].line<n?o=a+1:i=a-1}let s=null;for(let a of[i,o]){let u=e[a];if(!u||u.displayName!==t)continue;let c=Math.abs(u.line-n);c>r||(!s||c<s.distance)&&(s={distance:c,symbolId:u.symbolId})}return s?.symbolId??null}function N(e,n){let r=Se(n),t=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=he(t,r,n,i);return o.set(i,s),s}}}function _(e,n,r,t,o){if(e.fileName.endsWith(".vue")){let i=t.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=t.language.maps.get(s,i);if(x(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(o)?r.get(e.fileName):null}return n(e)}function*D(e){let n=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),t;for(;t=n.exec(e);){let o=t[0];r.has(o)||(yield{text:o,start:t.index,end:t.index+o.length})}}function j(e,n){for(let[r]of e.toGeneratedLocation(n,t=>!!t.navigation))return r;return null}function x(e,n){let r=e;for(let[t]of r.toSourceLocation(n,o=>!!o.navigation))return t;return null}function pe(e,n){let r=0,t=e.lineStarts.length-1;for(;r<=t;){let i=Math.floor((r+t)/2);e.lineStarts[i]<=n?r=i+1:t=i-1}let o=Math.max(0,t);return{line:o,character:n-e.lineStarts[o]}}function M(e,n){return g(e,n).startsWith("node_modules/")}function g(e,n){return se(e,n).replaceAll("\\","/")}function me(e){switch(ie(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function $(){let e=new Map;return{get(n){if(e.has(n))return e.get(n)??null;try{let r=m(n,{maxBytes:h,inputKind:"Vue source file"}),t={text:r,lineStarts:Re(r)};return e.set(n,t),t}catch{return e.set(n,null),null}},positionAt:pe}}function Re(e){let n=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&n.push(r+1);return n}function Se(e){try{let n=JSON.parse(m(P(e,"package.json"),{maxBytes:k,inputKind:"project package manifest"}));return{name:n.name??"workspace",version:n.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function he(e,n,r,t){let o=g(r,t),i=be(n.name,n.version,o);return e.get(i)?.id??null}function be(e,n,r){let t=r.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${n} ${t}/default.`}function Nn(e){let n=ve(e.projectRoot,e.tsconfig),r=new xe(e.dbPath,{readonly:!0});try{let t=ke({db:r,projectRoot:e.projectRoot,configPath:n,vueSymbolLookup:N(r,e.projectRoot)});return Ve({vueFiles:e.vueFiles??[],tasks:e.tasks,...t})}finally{r.close()}}function ke(e){let n=$();return{projectRoot:e.projectRoot,context:A(e.projectRoot,e.configPath),symbolLookup:w(e.db,e.projectRoot,n),vueSymbolLookup:e.vueSymbolLookup,sourceReader:n}}function Ve(e){let n=[],r=S(),t=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of t){let i=Ee(e,o);n.push(...i.occurrences),L(r,i)}return{occurrences:n,...r}}function Ee(e,n){let r=e.sourceReader.get(n.fileName);if(!r)return U(e.projectRoot,n,"missing-source-file");let t=e.context.language.scripts.get(n.fileName),o=t?.generated?.languagePlugin.typescript?.getServiceScript(t.generated.root)?.code;if(!t||!o)return U(e.projectRoot,n,"missing-service-script");let i=e.context.language.maps.get(o,t),s=g(e.projectRoot,n.fileName),a=[...D(r.text)],u={tokens:a.filter(c=>c.start>=n.startOffset&&c.start<n.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:Le(a),processedStarts:new Set};return Ce({...e,fileName:n.fileName,sourceInfo:r,sourceFile:s,map:i,tokenContext:u})}function Ce(e){let n=[],r=S();for(let t of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(t.start)||Ie(e.sourceInfo.text,t.start))continue;let o=j(e.map,t.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(l=>!M(e.projectRoot,l.fileName));if(!s){v(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,"no-definition");continue}let a=g(e.projectRoot,s.fileName),u=Te(e.sourceFile,t.text,a);if(u){v(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,u);continue}let c=_(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(c===null){v(r,e.sourceReader,e.sourceInfo,e.sourceFile,t,"unindexed-definition");continue}H(n,e.sourceReader,e.sourceInfo,e.sourceFile,t,a,c),e.tokenContext.processedStarts.add(t.start),Fe(n,e,t,o,a,c)}return{occurrences:n,...r}}function Ie(e,n){let r=e.lastIndexOf(`
15
- `,n-1)+1,t=e.slice(r,n);return/\bfrom\s+['"][^'"]*$/.test(t)||/\bimport\s*\(\s*['"][^'"]*$/.test(t)}function Te(e,n,r){return r===e?"same-file-definition":r.endsWith(".vue")&&n!==r.split("/").at(-1)?.replace(/\.vue$/,"")?"unindexed-definition":null}function U(e,n,r){let t=S();return n.countFileSkip&&(t.skippedReferences=1,t.skippedReferenceReasons[r]=1,t.skippedReferenceSamples.push({sourceFile:g(e,n.fileName),sourceLine:0,sourceStartChar:0,sourceEndChar:0,token:"",reason:r})),{occurrences:[],...t}}function v(e,n,r,t,o,i){if(e.skippedReferences++,e.skippedReferenceReasons[i]++,e.skippedReferenceSamples.filter(a=>a.reason===i&&a.sourceFile===t).length>=2)return;let s=n.positionAt(r,o.start);e.skippedReferenceSamples.push({sourceFile:t,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,token:o.text,reason:i})}function Fe(e,n,r,t,o,i){if(!((n.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let s of Oe(n.context.languageService,n.fileName,t+1,n.map,r,n.tokenContext.tokenByStart)){if(n.tokenContext.processedStarts.has(s))continue;let a=n.tokenContext.tokenByStart.get(s);a&&(H(e,n.sourceReader,n.sourceInfo,n.sourceFile,a,o,i),n.tokenContext.processedStarts.add(s))}}function H(e,n,r,t,o,i,s){let a=n.positionAt(r,o.start);e.push({sourceFile:t,sourceLine:a.line,sourceStartChar:a.character,sourceEndChar:a.character+o.text.length,sourceToken:o.text,definitionFile:i,symbolId:s})}function Le(e){let n=new Map;for(let r of e)n.set(r.text,(n.get(r.text)??0)+1);return n}function Oe(e,n,r,t,o,i){let s=e.getDocumentHighlights?.(n,r,[n])??[],a=[];for(let u of s)if(u.fileName===n)for(let c of u.highlightSpans){let l=Pe(t,c.textSpan.start,i,o.text);l!==null&&a.push(l)}return a}function Pe(e,n,r,t){let o=r.get(n);if(o?.text===t)return o.start;let i=x(e,n);if(i===null)return null;let s=r.get(i);return s?.text===t?s.start:null}export{cn as a,fn as b,Nn as c};
16
- //# sourceMappingURL=chunk-PBUQFCNB.js.map
@@ -1,2 +0,0 @@
1
- import{c as p}from"./chunk-UJCOIXDY.js";import{a as u}from"./chunk-Z4N3MZYA.js";import{n as h,o as y}from"./chunk-7O5IKBTZ.js";import{a as S,c as b}from"./chunk-T7YQSHPQ.js";import{d as m,z as d}from"./chunk-EKZTZXHZ.js";function P(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=S(e,o);return r?c==="backward"?M(e,r,s,{semantic:l.semantic!==!1}):k(e,r,{semantic:l.semantic!==!1}):null}function M(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let g of t){let w=u(e,g,{semantic:c.semantic,semanticEvidence:y});for(let a of w){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function k(e,o,l){let c=new Set,s=[],r=new p(e);for(let t of h(e,o,{semantic:l.semantic,semanticEvidence:y})){if(s.length>=30)break;let n=t.enclosingSymbol??d(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{P as a};
2
- //# sourceMappingURL=chunk-POAVPHH7.js.map
@@ -1,2 +0,0 @@
1
- import{readdirSync as p}from"fs";import{join as h}from"path";function m(n,c){let t=o(n),r=o(c);if(t.endsWith("/**")){let e=t.slice(0,-3);return r===e||r.startsWith(`${e}/`)}if(t.endsWith("/*")){let e=t.slice(0,-2);if(!r.startsWith(`${e}/`))return!1;let i=r.slice(e.length+1);return i.length>0&&!i.includes("/")}return t==="**"?!0:t==="*"?r.length>0&&!r.includes("/"):t===r}function d(n){return o(n).replace(/\/\*\*?$/,"")}function W(n,c){let t=o(c),r=d(t),e=t.endsWith("/**"),i=[],a=(f,u)=>{let g;try{g=p(f,{withFileTypes:!0})}catch{return}for(let s of g){if(s.name.startsWith("."))continue;let l=u?`${u}/${s.name}`:s.name;m(t,l)&&i.push(l),e&&s.isDirectory()&&a(h(f,s.name),l)}};return a(h(n,r),r),i.sort()}function o(n){return n.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"")}export{m as a,W as b};
2
- //# sourceMappingURL=chunk-QZ4JVECJ.js.map
@@ -1,2 +0,0 @@
1
- import{c as h}from"./chunk-UJCOIXDY.js";import{b as I}from"./chunk-B75HZHUP.js";import{a as d,c as g}from"./chunk-Z4N3MZYA.js";import{o as y}from"./chunk-7O5IKBTZ.js";import{d as p}from"./chunk-EKZTZXHZ.js";function k(i,n={}){let{limit:f=20,scope:b,minFanIn:c=2,minFanOut:l=2,scanLimit:t}=n,a=new h(i),s=I(a.productionCallableDefinitions({scope:b,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof t=="number"&&t>0}),t),m=n.semantic!==!1,e=g(i,s,{limit:500,semantic:m,semanticEvidence:y});return s.map(o=>w(i,o,m,e.get(o.symbolId)??[])).filter(o=>o.fanIn>=c&&o.fanOut>=l).sort((o,u)=>u.score-o.score||u.fanIn-o.fanIn).slice(0,f)}function w(i,n,f,b){let c=[...new Set(b.map(e=>e.file))].sort(),l=new Map;for(let e of d(i,n,{limit:500,semantic:f,semanticEvidence:y})){if(e.file===n.relativePath)continue;let r=`${e.symbol}|${e.file}`;l.has(r)||l.set(r,{symbol:e.symbol,shortName:p(e.symbol),file:e.file})}let t=[...l.values()].sort((e,r)=>e.file.localeCompare(r.file)||e.symbol.localeCompare(r.symbol)),a=c.length,s=t.length,m=a*s;return{symbol:n.symbol,shortName:p(n.symbol),fanIn:a,fanOut:s,callerFiles:c,externalCallees:t,score:m,definedIn:n.relativePath,actionTier:"signal",riskKind:"coordination-hotspot",evidenceReasons:[`${a} incoming file(s) reference this symbol`,`${s} distinct cross-file callee symbol(s) are reached from it`,`centrality score is ${m} (fan-in * fan-out)`],recommendation:"Review ownership, API stability, and caller groups before changing this central symbol; do not refactor solely from graph centrality."}}export{k as a};
2
- //# sourceMappingURL=chunk-RDO52JGY.js.map
@@ -1,2 +0,0 @@
1
- import{a as Oe}from"./chunk-FKSELJQF.js";import{a as Ke}from"./chunk-KMKTIO2G.js";import{a as ke,b as x,e as $e}from"./chunk-PXY7F6Y4.js";import{a as De,c as Fe,d as Ae,e as w}from"./chunk-YLCJLTPL.js";import{a as _e}from"./chunk-HX4GQPZP.js";import{a as Me}from"./chunk-MKCDWWGV.js";import{a as Le}from"./chunk-6YTSKJJ3.js";import{a as Pe}from"./chunk-6O5TICIZ.js";import{a as je}from"./chunk-EN3O7VJA.js";import{a as Ie}from"./chunk-EW2NTSFA.js";import{a as Ge}from"./chunk-7SQQWSY3.js";import{a as Ee}from"./chunk-FYLK2DEJ.js";import{b as we}from"./chunk-B2PX5I6M.js";import{a as Re,b as ve}from"./chunk-JVYA47YU.js";import{a as ye,b as be,c as Ce,i as W,j as Se,k as N}from"./chunk-ZHXX42OH.js";import{b as Te}from"./chunk-GOUBFH5O.js";import{a as q,c as me,d as he,e as ge}from"./chunk-ZK26BAQL.js";import{a as pe}from"./chunk-RUJURYSV.js";import{a as Ne,e as Be}from"./chunk-Y2MVPNKY.js";import{d as de,e as fe,f as ue}from"./chunk-RXOXSKY3.js";import{a as B,c as M,d as L,e as xe}from"./chunk-YTQVETEO.js";import{c as le}from"./chunk-UJCOIXDY.js";import{g as j,h as P}from"./chunk-26QA6FAI.js";import{e as ce}from"./chunk-7O5IKBTZ.js";import{d as ie}from"./chunk-7WPLAODU.js";import{d as z,e as A,f as ae,g as U}from"./chunk-EKZTZXHZ.js";import{a as se}from"./chunk-UJPRPGCO.js";import{a as ne}from"./chunk-GH74ASD6.js";import{E as oe,v as re}from"./chunk-WCCFZ7V7.js";import{m as G}from"./chunk-2KAZEZ6M.js";import{createHash as rt}from"crypto";import{existsSync as V}from"fs";function Y(e){let[i,t]=T(e,":"),r=i||"unknown",n=(s={})=>{let a=s.actionTier??ut(r);return{sourceAnalyzer:r,actionTier:a,rootCauseKey:s.rootCauseKey??(t||e),label:s.label??`${r} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??pt(a,r),file:s.file}};if(!t)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(r)){let[s,a]=T(t,":");return n({file:s,relatedFiles:s?[s]:[],rootCauseKey:a?`${s}:${a}`:t,label:`${r} finding`,why:a?[`Baseline subject: ${a}.`]:[]})}if(r==="cycle"){let s=t.split(">").filter(Boolean);return n({relatedFiles:s,rootCauseKey:t,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(r==="similar"){let s=t.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(r==="architecture"){let[s,a]=T(t,":");if(s==="forbidden-edge"){let[c,l]=T(a,":"),o=_(c),f=_(l);return n({actionTier:"direct",rootCauseKey:t,label:"architecture boundary violation",why:[`Declared boundary rule rejects ${o} -> ${f}.`],remediation:`Move the dependency behind an allowed boundary, or deliberately update the ${o} dependency rule and baseline.`})}if(s==="cycle"){let c=a.split("|").filter(Boolean).map(_);return n({actionTier:"direct",rootCauseKey:t,label:"forbidden architecture cycle",why:[`requireAcyclic rejects the connected boundary group: ${c.join(", ")}.`],remediation:"Break the boundary cycle, or deliberately revise the acyclicity rule and baseline."})}if(s==="missing-policy-row"){let c=_(a);return n({actionTier:"direct",rootCauseKey:t,label:"incomplete architecture policy",why:[`requireCompletePolicy rejects the missing outgoing dependency row for ${c}.`],remediation:`Declare the allowed outgoing dependencies for ${c}, including an empty row when it must depend on nothing.`})}}if(r==="drift"){let[s,a]=T(t,":"),[c,l]=T(a,":");return n({actionTier:s==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,l].filter(Boolean))],rootCauseKey:t,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...l?[`Related dependency: ${l}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function ut(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":case"architecture":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function pt(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function T(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}function _(e){try{return decodeURIComponent(e)}catch{return e}}import{existsSync as mt}from"fs";import{isAbsolute as ht,join as gt}from"path";var yt=".scipquery-baseline.json";function J(e){if(e.startsWith("similar:")){let i=e.slice(8).split("|");return i.length!==2?e:`similar:${i.map(z).sort().join("|")}`}if(e.startsWith("duplicate-bodies:")){let i=e.slice(17),t=i.indexOf(":");if(t<0)return e;let r=i.slice(0,t),n=i.slice(t+1).split("|");return n.length<2?e:`duplicate-bodies:${r}:${n.map(z).sort().join("|")}`}return e}function I(e,i){return i&&ht(i)?i:gt(e.config.projectRoot,i??yt)}function K(e,i,t={}){let r=I(e,t.path);if(!mt(r))throw new Error(`No baseline found at ${r}. Create one with: scip-query health --write-baseline`);let s=(JSON.parse(G(r,"health baseline")).findings??[]).map(J),a=new Set(t.accept?s.filter(t.accept):s),c=new Set(i);return{baselinePath:r,baselineCount:a.size,current:[...i],newFindings:i.filter(l=>!a.has(l)),fixedFindings:[...a].filter(l=>!c.has(l))}}var bt=25e3,Ct=2500,St=2500;function kt(e){let i=Le(e);return i.symbols>=bt||i.documents>=Ct?St:void 0}function He(e,i={}){let{scope:t}=i,r=kt(e),n=[],s=Te(e,{scope:t,...w.dead,scanLimit:r});for(let a of s.symbols)j(e,a.relativePath)||P(e,a.symbol,a.relativePath)||a.kind==="dead-code"&&n.push(`dead:${a.relativePath}:${a.shortName}`);for(let a of je(e,{scope:t,...w.isolated,scanLimit:r}))j(e,a.relativePath)||P(e,a.symbol,a.relativePath)||n.push(`isolated:${a.relativePath}:${a.shortName}`);for(let a of Ee(e,{scope:t}))a.kind==="real"&&n.push(`cycle:${$t(a.path)}`);for(let a of Be(e,{scope:t,...w.similar,scanLimit:r}))n.push(`similar:${[a.symbolA,a.symbolB].sort().join("|")}`);for(let a of Re(e,{scope:t,...w.duplicateBodies,scanLimit:r}))n.push(`duplicate-bodies:${a.hash}:${a.functions.map(c=>c.symbol).sort().join("|")}`);for(let a of Ge(e,{scope:t,...w.extract,scanLimit:r}))n.push(`extract:${a.relativePath}:${a.shortName}`);for(let a of _e(e,{scope:t,...w.wrappers,scanLimit:r}))n.push(`wrapper:${a.file}:${a.shortName}`);for(let a of Pe(e,{scope:t,...w.passthroughs,scanLimit:r}))n.push(`passthrough:${a.file}:${a.shortName}`);for(let a of Me(e,{scope:t,...w.stale,scanLimit:r}))n.push(`stale:${a.file}:${a.shortName}`);for(let a of Ie(e,{scope:t,...w.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)a.kind!=="architecture-violation"&&n.push(`drift:${a.kind}:${a.file}:${a.dep}`);return n.push(...L(M(e,{scope:t}))),[...new Set(n.map(J))].sort()}function $t(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function Gi(e,i={}){let t=He(e,{scope:i.scope}),r=I(e,i.path);return ie(r,{version:1,findings:t},{spacing:2,trailingNewline:!0}),{path:r,findingCount:t.length}}function Ve(e,i={}){return K(e,He(e,{scope:i.scope}),{path:i.path})}function ze(e,i={}){let t=L(M(e,{scope:i.scope}));return K(e,t,{path:i.path,accept:r=>r.startsWith(B)})}import{existsSync as Rt,readdirSync as vt}from"fs";import{createHash as wt}from"crypto";import{join as Q}from"path";function Z(e){let i=0,t=0,r=0,n=0,s=0,a=[];for(let o of e)switch(o.state){case"legacy":i+=1;break;case"current":t+=1;break;case"unsupported-older":r+=1,a.push(X(o));break;case"unsupported-future":n+=1,a.push(X(o));break;case"malformed":s+=1,a.push(X(o));break}let c=i+t,l=r+n+s;return{complete:l===0,total:e.length,accepted:c,legacy:i,current:t,unsupportedOlder:r,unsupportedFuture:n,malformed:s,omitted:l,issues:a}}function X(e){if(e.state==="legacy"||e.state==="current")throw new Error(`accepted record ${e.path} cannot become a compatibility issue`);return{path:e.path,state:e.state,reason:e.reason??e.state}}var We=Q(".scipquery","suppressions"),Ue="scip-query-suppression",qe=1,O=2;function Dt(e){return Q(e,We)}function Ft(e){if(e.id&&e.id.trim()!=="")return`${e.id.trim()}.json`;let i=`${e.check??""}\0${e.file??""}`;return`CHECK-${wt("sha256").update(i).digest("hex").slice(0,12).toUpperCase()}.json`}function At(e){return Ft(e).slice(0,-5)}function xt(e,i){if(typeof e!="object"||e===null||Array.isArray(e))return{state:"malformed",error:"not a suppression object"};let t=e;if(t.schemaVersion===void 0&&(t.kind!==void 0||t.suppressionIdentity!==void 0||t.writer!==void 0))return{state:"malformed",error:"suppression envelope metadata requires schemaVersion"};if(t.schemaVersion!==void 0){if(!Number.isSafeInteger(t.schemaVersion))return{state:"malformed",error:"schemaVersion must be a positive safe integer"};if(t.schemaVersion!==qe&&t.schemaVersion!==O)return{state:t.schemaVersion>O?"unsupported-future":"unsupported-older",error:`unsupported schemaVersion ${String(t.schemaVersion)}`};if(t.kind!==void 0&&t.kind!==Ue)return{state:"malformed",error:`kind must be ${Ue}`}}if(t.schemaVersion===qe&&t.decision!==void 0)return{state:"malformed",error:"schemaVersion 1 cannot carry automated adjudication metadata"};if(t.schemaVersion===O&&!fe(t.decision))return{state:"malformed",error:"schemaVersion 2 requires a valid automated adjudication decision"};if(typeof t.reason!="string"||t.reason.trim()==="")return{state:"malformed",error:"missing reason"};if(!t.id&&!t.check)return{state:"malformed",error:"needs an id or a check"};let r=Et(t);if(t.schemaVersion===void 0)return{state:"legacy",suppression:r,record:t,schemaVersion:0};let n=At(r);return t.suppressionIdentity!==n||i!==void 0&&t.suppressionIdentity!==i?{state:"malformed",error:"suppressionIdentity does not match the suppression target or filename"}:!t.writer||t.writer.tool!=="scip-query"||typeof t.writer.version!="string"||t.writer.version.trim()===""?{state:"malformed",error:"missing valid writer metadata"}:typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))?{state:"malformed",error:"missing valid createdAt timestamp"}:t.updatedAt!==void 0&&(typeof t.updatedAt!="string"||!Number.isFinite(Date.parse(t.updatedAt)))?{state:"malformed",error:"invalid updatedAt timestamp"}:{state:t.schemaVersion===O?"current":"legacy",suppression:r,record:t,schemaVersion:t.schemaVersion}}function Ye(e){let i=Dt(e);if(!Rt(i))return{suppressions:[],compatibility:Z([]),warnings:[]};let t=[],r=[];for(let s of vt(i).sort()){if(!s.endsWith(".json"))continue;let a=Q(i,s),c=`${We}/${s}`,l;try{l=JSON.parse(G(a,"suppression record"))}catch{r.push({path:c,state:"malformed",reason:"malformed JSON"});continue}let o=xt(l,s.slice(0,-5));if("error"in o){r.push({path:c,state:o.state,reason:o.error});continue}r.push({path:c,state:o.state}),t.push(o.suppression)}let n=Z(r);return{suppressions:t,compatibility:n,warnings:n.issues.map(s=>`${s.path}: ${s.reason} \u2014 ignored`)}}function Et(e){return{...typeof e.id=="string"?{id:e.id}:{},...typeof e.check=="string"?{check:e.check}:{},...typeof e.file=="string"?{file:e.file}:{},reason:e.reason,...typeof e.expiresAt=="string"?{expiresAt:e.expiresAt}:{},...typeof e.createdAt=="string"?{createdAt:e.createdAt}:{},...e.decision?{decision:e.decision}:{}}}var Je;function Xe(e){Je?.onCheckStart?.(e)}function Ze(e){Je?.onCheckComplete?.(e)}var Rn=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","architecture","doc-reference","unused-params","new-dead","baseline"];function vn(e,i={}){let t=i.base??"HEAD",{minTogether:r=6,minConfidence:n=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:a=Number.POSITIVE_INFINITY,minSimilarity:c=.8,includeBaseline:l=!1,scanLimit:o}=i,f=i.semantic!==!1,h=i.historyMode??"bounded",p=new Set(i.skip??[]),g=Ye(e.config.projectRoot),u=Ce(e,{base:t}),m=be(e,{base:t,plan:u}),y=m.changedFiles,d=new Set(y),S=new Set(u.changedFileLines),k=new Set([...d,...S]),$=N(u,y),E=W({projectRoot:e.config.projectRoot,base:t,preloadPaths:$},i.baseContentRuntime);for(let R of $){let F=E(R);if(F.state==="unavailable")throw new Error(`Base content unavailable for ${R}: ${F.reason}`)}let te=si(e.config.projectRoot,t,u,E),b={base:t,changedFiles:y,changedSymbols:m.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],policyEscalations:[],outcome:"pass",suppressionSummary:at(),findings:[],attributionNotes:m.attributionNotes,evidenceTiers:m.evidenceTiers,rootCauseGroups:[],recordCompatibility:{suppressions:g.compatibility},note:m.summary.note};if(y.length===0)return b;let v=(R,F)=>{if(p.has(R)){b.skipped.push({check:R,reason:"skipped via --skip"});return}let lt=b.findings.length,dt=b.skipped.length,ft=b.checksRun.length;Xe(R);try{re(`diff-gate.check.${R}`,F,()=>({check:R,changedFiles:y.length,changedSymbols:m.changedSymbols.length,findingsAdded:b.findings.length-lt,skippedAdded:b.skipped.length-dt,checksRunAdded:b.checksRun.length-ft}))}finally{Ze(R)}};return v("echo",()=>Bt(e,m.changedSymbols,d,te,s,c,o,f,b)),v("incomplete-migration",()=>Ht(e,t,u,a,o,f,E,b)),v("co-change-partner",()=>Vt(e,k,r,n,h,b)),v("twin-partner",()=>zt(e,m.changedSymbols,d,o,b)),v("coverage-contract",()=>Ut(e,k,b)),v("architecture",()=>ci(e,b)),v("doc-reference",()=>Xt(e,d,S,u.changedRanges,u.renamedFiles,b)),v("unused-params",()=>ti(e,y,b)),v("new-dead",()=>{let R=m.evidenceTiers.filter(F=>F.state==="failed");if(R.length>0){b.skipped.push({check:"new-dead",reason:`required consumer evidence unavailable: ${R.map(F=>F.tier).join(", ")}`});return}ii(e,m.changedSymbols,te,b)}),l&&v("baseline",()=>ai(e,b)),Gt(b,[...e.config.suppressions??[],...g.suppressions],e.config.projectRoot,g.compatibility.complete),b.rootCauseGroups=It(b.findings),b}function wn(e){return Tt(e)!==void 0}function Tt(e){if(e.checksRun.length===0&&e.note===ye)return"git diff unavailable - zero checks ran; the gate fails closed";if(!Array.isArray(e.evidenceTiers))return"required consumer evidence status unavailable";let i=e.evidenceTiers.filter(t=>t.state==="failed");if(i.length!==0)return`required consumer evidence unavailable: ${i.map(t=>`${t.tier} (${t.reason})`).join("; ")}`}function Dn(e){return e.filter(i=>!i.advisory)}function It(e){let i=new Map;for(let t of e){let r=t.groupKey??`${t.check}:${t.id}`,n=i.get(r);n||(n={groupKey:r,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(r,n)),n.count+=1,n.findingIds.push(t.id),n.severity=ot(n.severity,t.severity),n.actionTier=st(n.actionTier,t.actionTier),t.file&&n.files.add(t.file);for(let s of t.relatedFiles??[])n.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,r)=>r.count-t.count||H(r.severity)-H(t.severity)||t.groupKey.localeCompare(r.groupKey))}function ot(e,i){return H(i)>H(e)?i:e}function H(e){return e==="error"?2:e==="warning"?1:0}function st(e,i){return e?i&&Qe(i)>Qe(e)?i:e:i}function Qe(e){return e==="direct"?2:e==="signal"?1:0}function Gt(e,i,t,r){let n=e.suppressionSummary??at();if(e.suppressionSummary=n,e.policyEscalations??=[],i.length===0||e.findings.length===0){e.outcome=e.findings.length>0?"findings":"pass";return}let s=[...e.findings],a=new Map,c=new Map,l=Date.now(),o=u=>{try{return rt("sha256").update(oe(t,u)).digest("hex")}catch{return}};for(let u of s){let m=i.filter(d=>jt(d,u));if(m.length===0)continue;let y=new Set;for(let d of m){let S=ue(d,u,{now:l,contentHash:o});if(S.kind==="accepted"&&r){a.set(u.id,d);break}let k=S.kind==="accepted"?["suppression-record-coverage-incomplete"]:S.reasons;for(let $ of k)y.add($);S.kind==="expired"&&(n.expiredCount+=1),S.kind==="invalidated"&&(n.invalidatedCount+=1),k.includes("legacy-unadjudicated")&&(n.legacyUnadjudicatedCount+=1)}a.has(u.id)||c.set(u.id,y)}let f=Pt(s),h=Nt(s,a),p=new Set;for(let[u,m]of h){let y=f.get(u)??m;de(m,y)&&p.add(u)}let g=[];for(let u of s){let m=a.get(u.id);if(m&&!p.has(u.check)){e.suppressed.push({finding:u,suppression:m}),n.automaticSuppressionCount+=1;continue}g.push(u);let y=c.get(u.id)??new Set;m&&p.has(u.check)&&y.add("automatic-suppression-rate-anomaly"),y.size>0&&e.policyEscalations.push({findingId:u.id,check:u.check,...m?.id?{suppressionId:m.id}:{},reasons:[...y].sort()})}e.findings=g,n.policyEscalationCount=e.policyEscalations.length,e.outcome=e.findings.length>0?"findings":e.suppressed.length>0?"pass-with-suppressions":"pass"}function jt(e,i){return!e.reason||e.reason.trim()===""||e.id&&e.id!==i.id&&!i.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function at(){return{automaticSuppressionCount:0,policyEscalationCount:0,expiredCount:0,invalidatedCount:0,legacyUnadjudicatedCount:0}}function Pt(e){let i=new Map;for(let t of e)i.set(t.check,(i.get(t.check)??0)+1);return i}function Nt(e,i){let t=new Map;for(let r of e)i.has(r.id)&&t.set(r.check,(t.get(r.check)??0)+1);return t}function D(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function Bt(e,i,t,r,n,s,a,c,l){l.checksRun.push("echo");for(let o of i.slice(0,n)){if(!U(o.symbol)||r(o))continue;let f=ve(e,o.symbol,{maxLoc:15,scanLimit:a}).filter(d=>!t.has(d.file)).slice(0,5).map(d=>({otherFile:d.file,otherShort:d.shortName,otherSymbol:d.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${d.loc} LOC)`]}));if(f.length>0){let d=C("echo",o.symbol,o.file),S=C("echo",o.symbol,o.file,...f.map($=>`${$.otherSymbol}|${$.otherFile}`).sort()),k=f[0];D(l,{id:d,legacySuppressionIds:S===d?void 0:[S],groupKey:d,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:o.file,symbol:o.symbol,relatedFiles:[...new Set(f.map($=>$.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${o.symbol}:${k.otherSymbol}`,message:tt(o,f),why:it(o,f),remediation:nt("direct",o.shortName,k.otherShort)});continue}let h=Ne(e,o.symbol,{minSimilarity:s,limit:5,scanLimit:a,semantic:c,sourceCandidateMode:"target-pruned"}),p=[];for(let d of h){let S=d.fileA===o.file?d.fileB:d.fileA,k=d.fileA===o.file?d.shortNameB:d.shortNameA,$=d.fileA===o.file?d.symbolB:d.symbolA;t.has(S)||p.push({otherFile:S,otherShort:k,otherSymbol:$,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(p.length===0)continue;let g=p[0],u=C("echo",o.symbol,o.file,...p.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),m=C("echo",o.symbol,o.file),y=Mt(o,p);D(l,{id:m,legacySuppressionIds:u===m?void 0:[u],groupKey:m,actionTier:y,check:"echo",severity:"warning",evidence:"heuristic",confidence:g.similarity,file:o.file,symbol:o.symbol,relatedFiles:[...new Set(p.map(d=>d.otherFile))].sort(),message:tt(o,p),why:it(o,p),remediation:nt(y,o.shortName,g.otherShort)})}i.length>n&&l.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${i.length} changed symbols`})}function Mt(e,i){return i.some(r=>Lt(e.symbol,r))?"direct":"signal"}function Lt(e,i){if(i.similarityBasis==="exact-body")return!0;if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=A(e),r=A(i.otherSymbol);return!t||!r?!1:t===r?!0:Ot(i.sharedEvidence)?!1:_t(t,r)}function _t(e,i){let t=et(e),r=et(i);if(t.length===0||r.length===0)return!1;let n=new Set(r),s=t.filter(a=>n.has(a)).length;return s>=2&&s/Math.min(t.length,r.length)>=.5}function et(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var Kt=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function Ot(e){return e.length>=3&&e.every(i=>Kt.has(i.toLowerCase()))}function tt(e,i){let t=i[0],r=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${r}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${r}% similar to ${t.otherShort} (${t.otherFile})`}function it(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let r of i.slice(0,3))t.push(`${r.otherShort} is outside this diff and scored ${Math.round(r.similarity*100)}% similar by ${r.similarityBasis} evidence.`),t.push(`Shared evidence: ${r.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function nt(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function Ht(e,i,t,r,n,s,a,c){let l=Ke(e,{base:i,maxHelpers:r,diffPlan:t,scanLimit:n,semantic:s,baseContentResultAt:a});if(!l.available){c.skipped.push({check:"incomplete-migration",reason:l.note??"no git history"});return}c.checksRun.push("incomplete-migration"),l.note&&c.skipped.push({check:"incomplete-migration",reason:l.note});for(let o of l.findings){let f=o.leftovers.map(d=>`${d.shortName} (${d.file}, ${Math.round(d.containment*100)}% helper / ${Math.round(d.siteCoverage*100)}% site, ${d.migrationScope})`).join(", "),h=o.leftovers.map(d=>`${d.shortName}: ${d.migrationScope} (${d.migrationScopeReasons[0]})`).join("; "),p=[...o.migratedFiles,...o.leftovers.map(d=>d.file)],g=o.leftovers.length===0?void 0:Math.max(...o.leftovers.map(d=>Math.min(d.containment,d.siteCoverage))),u=o.leftovers.some(d=>d.migrationScope==="possible-subtype"),m=C("incomplete-migration",o.helperSymbol,o.helperFile,p.join("|")),y=C("incomplete-migration",o.helperSymbol,o.helperFile);D(c,{id:y,legacySuppressionIds:m===y?void 0:[m],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:g,file:o.helperFile,symbol:o.helperSymbol,relatedFiles:p,message:`new helper ${o.helperShortName} (${o.helperFile}) is wired into ${o.migratedFiles.length} file(s), but ${o.leftovers.length} similar un-migrated site(s) remain: ${f}`,why:[`${o.helperShortName} is new in this diff and already referenced by ${o.migratedFiles.join(", ")}.`,`Helper shape: ${o.helperShape}; ${o.specificHelperCalleeCount}/${o.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${f}.`,`Migration scope hints: ${h}.`],remediation:u?`Migrate same-scope sites to ${o.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${o.helperShortName}, or confirm they are intentionally different.`})}}function Vt(e,i,t,r,n,s){let a=pe(e,{historyMode:n}).directionalCoChangePairsForFiles(i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!a){s.skipped.push({check:"co-change-partner",reason:"no git history"});return}s.checksRun.push("co-change-partner");let c=new Set,l;for(let o of a){let f=i.has(o.fileA),h=i.has(o.fileB);if(f===h)continue;let p=f?o.fileA:o.fileB,g=f?o.fileB:o.fileA,u=f?o.changesA:o.changesB,m=u>0?o.together/u:0;if(m<r||q(g)||q(p)||!V(`${e.config.projectRoot}/${g}`))continue;let y=`${p}|${g}`;if(c.has(y))continue;c.add(y);let d=C("co-change-partner",p,g,String(o.together)),S=C("co-change-partner",p,g),k=me(p,g),$=he({fileA:p,fileB:g,together:o.together,confidence:m,commitScope:o.commitScope,recency:o.recency,subjectContext:o.subjectContext},k,(l??=ge(e))(p,g)),E=[p,g].sort().join("|");s.findings.push({id:S,legacySuppressionIds:d===S?void 0:[d],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${E}`,confidence:m,file:p,relatedFiles:[g],sourceAnalyzer:"co-change",rootCauseKey:E,partnerClass:k.partnerClass,partnerClassReasons:k.reasons,commitScope:o.commitScope,recency:o.recency,focusedTogether:o.focusedTogether,broadTogether:o.broadTogether,broadCommitRatio:o.broadCommitRatio,lastTogetherAt:o.lastTogetherAt,recentTogether:o.recentTogether,subjectContext:o.subjectContext,...$?{declaredCouplingSuggestion:$}:{},message:`${p} changed, but ${g} did not \u2014 they change together ${o.together}x (${Math.round(m*100)}% of the time)`,why:[`${p} is in this diff and ${g} is not.`,`Git history shows ${o.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${qt(o)}.`,`Subject context: ${Wt(o.subjectContext)}.`,...Yt(o),`Partner class: ${k.partnerClass} (${k.reasons.join("; ")}).`],remediation:$?`Update ${g} alongside this change, declare the coupling "${$.name}", or confirm the coupling no longer holds.`:`Update ${g} alongside this change, or confirm the coupling no longer holds.`})}}function zt(e,i,t,r,n){n.checksRun.push("twin-partner");let s=we(e,{scanLimit:r}).filter(l=>l.relationship==="divergent"||l.relationship==="identical");if(s.length===0)return;let a=new Map;for(let l of s)for(let o of l.members)a.set(o.symbol,l);let c=new Set;for(let l of i){if(!U(l.symbol))continue;let o=a.get(l.symbol);if(!o)continue;let f=o.members.filter(u=>u.symbol!==l.symbol&&!t.has(u.file));if(f.length===0)continue;let h=[l.symbol,...f.map(u=>u.symbol)].sort().join("|");if(c.has(h))continue;c.add(h);let p=f[0],g=C("twin-partner",l.symbol,l.file,p.symbol);D(n,{id:g,groupKey:`twin-partner:${h}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:o.relationship==="identical"?1:Math.max(0,1-o.maxDivergence),file:l.file,symbol:l.symbol,relatedFiles:f.map(u=>u.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:h,message:`${l.shortName} (${l.file}) changed but its same-name twin ${p.shortName} (${p.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${l.symbol} is in this diff.`,`${p.symbol} shares its (near-)name and is classified '${o.relationship}' with it, but ${p.file} is not in this diff.`,o.relationship==="divergent"?`The two bodies already diverge (~${Math.round(o.maxDivergence*100)}% token difference) \u2014 this diff may widen or narrow that drift.`:"The two bodies were byte-identical before this diff.","Advisory: twin-partner never fails the gate by itself \u2014 see the twin-partner entry in the diff-gate checks table."],remediation:`Update ${p.file} alongside this change, consolidate ${l.shortName}/${p.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function Ut(e,i,t){t.checksRun.push("coverage-contract");let r=e.config.coverageContracts??[];for(let n of r){if(!Fe(n,i))continue;let s=De(e,n);if(s.status==="ok")continue;let a=C("coverage-contract",n.name,n.file);D(t,{id:a,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:s.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:Ae(s),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,s.status==="unavailable"?`The declared side could not be evaluated: ${s.unavailableReason}.`:`Missing: ${s.missing.join(", ")||"none"}. Extra: ${s.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:s.status==="unavailable"?"Investigate why the declared key set could not be parsed (see the reason above) \u2014 do not treat this as a pass.":`Update ${n.file} so its ${n.keys.type==="object-literal-keys"||n.keys.type==="string-array"?n.keys.identifier:n.keys.marker} matches ${n.mustEqual.type}, or fix the ground-truth source if the declared set is right.`})}}function qt(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${Jt(e.lastTogetherAt)}`}function Wt(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",r=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${r}; external issue/PR labels ${e.externalIssueLabelStatus}`}function Yt(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function Jt(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var ee=3;function Xt(e,i,t,r,n,s){s.checksRun.push("doc-reference");let a=x.referenceTargets(e,i,r);if(a.size===0)return;let c=new Set(n.map(o=>o.from)),l=[];for(let o of $e(e,a))t.has(o.doc)||ke(e,o.doc)||l.push(Zt(e,o,c));for(let o of Qt(l))D(s,o)}function Zt(e,i,t){let r=i.citedClaims.length>0?i.citedClaims:x.citationContexts(e,i.doc,i.cited),n=x.classifyCitation(r),s=x.hasLineAnchoredCitation(i.citations),a=i.cited.some(h=>t.has(h)||!V(`${e.config.projectRoot}/${h}`)),c=!(s||a),l=i.cited[0]??"",o=C("doc-reference",i.doc,i.cited.join("|")),f=C("doc-reference",i.doc,l);return{id:f,legacySuppressionIds:o===f?void 0:[o],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${l}`,rootCauseKey:l,confidence:1,file:i.doc,relatedFiles:i.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:r,...c?{advisory:!0}:{},message:`${i.doc} cites ${i.cited.join(", ")} as ${x.citationKindLabel(n.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${i.cited.join(", ")} changed in this diff.`,`${i.doc} cites the changed file(s) but was not updated in the same diff.`,...n.reasons.map(h=>`Citation kind evidence: ${h}`),c?"Advisory: bare file-mention citation (no line anchor, cited file still present under the same path) \u2014 21.2 calibration found this citation shape low-precision; verify at your leisure.":s?"Blocking: citation includes a line anchor that may now point at the wrong lines.":"Blocking: the cited file was deleted or renamed in this diff \u2014 the citation almost certainly needs an update."],remediation:x.citationRemediation(n.citationKind,i.doc)}}function Qt(e){let i=new Map;for(let r of e){let n=r.rootCauseKey??"",s=i.get(n);s?s.push(r):i.set(n,[r])}let t=[];for(let[r,n]of i)n.length<=ee?t.push(...n):t.push(ei(r,n));return t}function ei(e,i){let t=[...i].sort((f,h)=>(f.file??"").localeCompare(h.file??"")),r=t.slice(0,ee).map(f=>({doc:f.file??"",citedClaims:f.citedClaims??[]})),n=t.length-r.length,s=t.every(f=>f.advisory===!0),a=t.reduce((f,h)=>ot(f,h.severity),"info"),c=t.reduce((f,h)=>st(f,h.actionTier),void 0),l=t.map(f=>f.file??"").filter(f=>f.length>0),o=[...new Set(t.flatMap(f=>[f.id,...f.legacySuppressionIds??[]]))];return{id:C("doc-reference","hub-cluster",e),memberFindingIds:o,check:"doc-reference",severity:a,evidence:"change-graph",actionTier:c,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:r[0]?.doc,relatedFiles:[e],citationCount:t.length,citationExemplars:r,suppressedCount:n,...s?{advisory:!0}:{},message:`${e} is cited by ${t.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${r.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${t.length} doc(s) cite it but were not updated in the same diff: ${l.join(", ")}.`,...r.map(f=>`Example \u2014 ${f.doc}: ${f.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${ee}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,s?"Advisory: every citation in this cluster is a bare file-mention (no line anchor, cited file still present).":"Blocking: at least one citation in this cluster is line-anchored or cites a deleted/renamed file."],remediation:`Review the ${r.length} example doc(s) above; ${t.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function ti(e,i,t){t.checksRun.push("unused-params");for(let r of Oe(e,{files:i,limit:50})){let n=C("unused-params",r.symbol,r.file,r.unusedTrailing.join("|")),s=C("unused-params",r.symbol,r.file);D(t,{id:s,legacySuppressionIds:n===s?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:r.file,startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,message:`${r.shortName} (${r.file}) has trailing unused parameter(s): ${r.unusedTrailing.join(", ")}`,why:[`${r.shortName} is in a changed file.`,`The trailing parameter(s) ${r.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function ii(e,i,t,r){r.checksRun.push("new-dead");let n=new le(e),s=ne(e.config.projectRoot),a=s.length>1;for(let c of i){if(t(c)||c.fanIn>0||n.fileKind(c.file)==="test"||j(e,c.file)||P(e,c.symbol,c.file)||oi(c.symbol))continue;let l=C("new-dead",c.symbol,c.file),o=a&&ni(s,c.file)&&ri(e,c.symbol);D(r,{id:l,check:"new-dead",severity:"warning",evidence:o?"heuristic":"graph-fact",confidence:o?.4:.9,file:c.file,symbol:c.symbol,message:o?`${c.shortName} (${c.file}) unconfirmed (cross-package ambiguous-name resolution gap): zero indexed consumers found, but this name is ambiguous project-wide and lives in a workspace package \u2014 verify manually before treating as dead`:`${c.shortName} (${c.file}) was changed but has zero indexed consumers`,why:o?[`${c.shortName} is a changed production symbol in a workspace package.`,"The index, semantic, and source-fallback layers all report zero consumers for this symbol.","Its leaf name is ambiguous project-wide (a same-named definition exists elsewhere), and cross-package consumers reached only through a re-exporting barrel are a known unresolvable shape for this tool \u2014 see docs/plans/2026-07-02-followups.md item 2."]:[`${c.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:o?"Verify with a direct code search before deleting; this tool cannot confidently resolve this symbol.":"Wire it up, or remove it before it becomes permanent dead code."})}}function ni(e,i){return e.some(t=>i===t.relativeDir||i.startsWith(`${t.relativeDir}/`))}function ri(e,i){let t=A(i);return t?(ce(e).get(t)?.length??0)>1:!1}function oi(e){if(ae(e)!=="type")return!1;let i=A(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function Fn(e,i,t,r){let n=typeof e=="string"?{projectRoot:e,base:i,diffPlan:t,baseContentAt:r}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||n.diffPlan===void 0)throw new TypeError("symbolPreexistenceChecker requires projectRoot, base, and diffPlan.");let{projectRoot:s,base:a,diffPlan:c,baseContentAt:l}=n,o=new Map(c.renamedFiles.map(h=>[h.to,h.from])),f=l??Se({projectRoot:s,base:a,preloadPaths:N(c)});return h=>{let p=o.get(h.file)??h.file,g=A(h.symbol);if(!g)return!1;let u=f(p);return u!==null&&ct(u,g)}}function si(e,i,t,r){let n=new Map(t.renamedFiles.map(a=>[a.to,a.from])),s=r??W({projectRoot:e,base:i,preloadPaths:N(t)});return a=>{let c=n.get(a.file)??a.file,l=A(a.symbol);if(!l)return!1;let o=s(c);if(o.state==="unavailable")throw new Error(`Base content unavailable for ${c}: ${o.reason}`);return o.state==="present"&&ct(o.content,l)}}function ct(e,i){return new RegExp(`\\b${se(i)}\\b`).test(e)}function ai(e,i){if(!V(I(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=Ve(e);for(let r of t.newFindings.filter(n=>!n.startsWith(B))){let n=Y(r),s=C("baseline",r);D(i,{id:s,groupKey:`baseline:${n.sourceAnalyzer}:${n.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:n.actionTier,confidence:1,file:n.file,relatedFiles:n.relatedFiles.length>0?n.relatedFiles:void 0,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${r}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${n.sourceAnalyzer}.`,`Inherited action tier: ${n.actionTier}.`,`Root cause key: ${n.rootCauseKey}.`,...n.why],remediation:n.remediation})}}function ci(e,i){if(!xe(e.config.architecture)){i.skipped.push({check:"architecture",reason:"no closed architecture dependency rows, requireCompletePolicy rule, or requireAcyclic rule configured"});return}if(!V(I(e))){i.skipped.push({check:"architecture",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("architecture");let t=ze(e);for(let r of t.newFindings){let n=Y(r),s=C("architecture",r);D(i,{id:s,groupKey:`architecture:${n.rootCauseKey}`,check:"architecture",severity:"error",evidence:"baseline",actionTier:"direct",confidence:1,sourceAnalyzer:"architecture",rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${r}`,why:["The project declares an enforceable architecture rule.","The current boundary graph contains a violation not present in the committed baseline.",...n.why],remediation:n.remediation})}}function C(e,...i){return`SQ${rt("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{He as a,Gi as b,Ve as c,ze as d,Rn as e,vn as f,wn as g,Tt as h,Dn as i,Fn as j};
2
- //# sourceMappingURL=chunk-RJT3TUUZ.js.map
@@ -1,4 +0,0 @@
1
- import{n as f,o as b}from"./chunk-7O5IKBTZ.js";import{a as d}from"./chunk-T7YQSHPQ.js";import{d as s,h as u,p as m,q as g}from"./chunk-EKZTZXHZ.js";import{J as c}from"./chunk-WCCFZ7V7.js";function x(e,r,i={}){let n=d(e,r);if(!n)return{definitions:[],referencedBy:[]};let t=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),a=g(t?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:p(a,t?.display_name??null,n.symbol),source:y(e,n.relativePath,n.startLine,n.endLine)}],S=f(e,n,{semantic:i.semantic,semanticEvidence:b}).map(l=>({relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?s(l.enclosingSymbol):"(top-level)"}));return{definitions:o,referencedBy:S}}function y(e,r,i,n){let t=c(e,r);if(!t)return null;let o=t.split(`
2
- `).slice(i,n+1).join(`
3
- `).trimEnd();return o.length>0?o:null}function p(e,r,i){let n=m(e);if(n&&!h(n))return n;let t=(r??"").trim();return t?u(i)&&!t.endsWith("()")?`${t}()`:t:s(i)}function h(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{x as a};
4
- //# sourceMappingURL=chunk-RVLDN63O.js.map