scip-query 0.23.0 → 0.26.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 (650) hide show
  1. package/CHANGELOG.md +491 -2
  2. package/README.md +111 -122
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-PRVFAGTQ.js +2 -0
  5. package/dist/call-graph-DVPAQV2F.js +2 -0
  6. package/dist/call-graph-evidence-CUtj8V2I.d.ts +19 -0
  7. package/dist/chunk-2FSBGL5P.js +2 -0
  8. package/dist/chunk-2HLAFUCY.js +2 -0
  9. package/dist/chunk-2IWUT6CJ.js +3 -0
  10. package/dist/chunk-2KNN7GTQ.js +2 -0
  11. package/dist/chunk-2LHXRE2B.js +8 -0
  12. package/dist/{chunk-EG2CPZMJ.js → chunk-2YXE77TJ.js} +2 -2
  13. package/dist/chunk-36SGVCGX.js +2 -0
  14. package/dist/chunk-3ABBFPTP.js +2 -0
  15. package/dist/chunk-3IVFU4FD.js +3 -0
  16. package/dist/chunk-3JIQS44J.js +7 -0
  17. package/dist/chunk-3ZRB6DNK.js +7 -0
  18. package/dist/{chunk-6YTSKJJ3.js → chunk-42EOW5VI.js} +1 -1
  19. package/dist/{chunk-6I6L7Z62.js → chunk-4BHGBMNO.js} +2 -2
  20. package/dist/chunk-4BP3UBDG.js +2 -0
  21. package/dist/chunk-4D6RO7G4.js +2 -0
  22. package/dist/chunk-4FEWQ6RH.js +2 -0
  23. package/dist/chunk-4IGEOBG7.js +2 -0
  24. package/dist/chunk-4QZXBUKC.js +2 -0
  25. package/dist/chunk-4WBDEVX2.js +4 -0
  26. package/dist/chunk-4WCUBZU3.js +8 -0
  27. package/dist/chunk-4WTUBQ36.js +40 -0
  28. package/dist/chunk-4XQ4O6IM.js +3 -0
  29. package/dist/chunk-55UQAMZO.js +4 -0
  30. package/dist/chunk-5D2LVK7O.js +125 -0
  31. package/dist/chunk-5IYJ56TT.js +2 -0
  32. package/dist/chunk-5PLMJC7Q.js +2 -0
  33. package/dist/chunk-5TNQJUR2.js +5 -0
  34. package/dist/chunk-62BDNPMI.js +2 -0
  35. package/dist/chunk-64DZ5TXR.js +7 -0
  36. package/dist/chunk-65245JCM.js +2 -0
  37. package/dist/chunk-6FFVZZL4.js +2 -0
  38. package/dist/chunk-6KO5JHAR.js +2 -0
  39. package/dist/chunk-6LRXOOSX.js +2 -0
  40. package/dist/chunk-6LSEIIF7.js +2 -0
  41. package/dist/chunk-6YMNWD3H.js +6 -0
  42. package/dist/chunk-72AD6ZRR.js +5 -0
  43. package/dist/chunk-73AAKPUC.js +4 -0
  44. package/dist/chunk-76CZ77DF.js +2 -0
  45. package/dist/chunk-7VPEEAAG.js +2 -0
  46. package/dist/chunk-7WTPQ4NX.js +14 -0
  47. package/dist/chunk-7Y5T6XDP.js +2 -0
  48. package/dist/chunk-A2IIGFMJ.js +5 -0
  49. package/dist/chunk-AB5KCTEV.js +2 -0
  50. package/dist/chunk-AC566WBP.js +6 -0
  51. package/dist/chunk-AGWFSTXC.js +3 -0
  52. package/dist/chunk-AOSIYPTA.js +2 -0
  53. package/dist/chunk-AUVEWPIF.js +2 -0
  54. package/dist/chunk-B56T42J3.js +25 -0
  55. package/dist/chunk-BIQEF5NE.js +2 -0
  56. package/dist/chunk-BL6XJKTA.js +3 -0
  57. package/dist/chunk-BMKOQJRI.js +2 -0
  58. package/dist/chunk-BOZ4EXBB.js +3 -0
  59. package/dist/chunk-BUTWYEPH.js +2 -0
  60. package/dist/chunk-BZB4QPIP.js +2 -0
  61. package/dist/{chunk-ILTDAWEF.js → chunk-CE357GEE.js} +4 -4
  62. package/dist/chunk-CFN45HFP.js +2 -0
  63. package/dist/chunk-CFYMZFXT.js +368 -0
  64. package/dist/chunk-CN5EH7O3.js +2 -0
  65. package/dist/chunk-D254DNNQ.js +4 -0
  66. package/dist/chunk-D3FDISIC.js +2 -0
  67. package/dist/chunk-D3NX5XIE.js +3 -0
  68. package/dist/chunk-DA7RPPDF.js +3 -0
  69. package/dist/chunk-DDMC3FON.js +3 -0
  70. package/dist/chunk-DIO3FUSG.js +2 -0
  71. package/dist/chunk-DJ2NNSUK.js +3 -0
  72. package/dist/chunk-DKYQIM3C.js +18 -0
  73. package/dist/{chunk-JTQVMR42.js → chunk-DOOEL2IV.js} +2 -2
  74. package/dist/chunk-DVFP6PZI.js +2 -0
  75. package/dist/chunk-E3FDPXZK.js +2 -0
  76. package/dist/chunk-E7YNJLCB.js +2 -0
  77. package/dist/chunk-EFGW5JPH.js +2 -0
  78. package/dist/chunk-EJVTR244.js +13 -0
  79. package/dist/chunk-EOV7RTRZ.js +2 -0
  80. package/dist/chunk-ETOIKRHO.js +2 -0
  81. package/dist/chunk-EYK3ZAO2.js +3 -0
  82. package/dist/chunk-F2V2LPET.js +52 -0
  83. package/dist/chunk-F4LUHJTF.js +2 -0
  84. package/dist/chunk-F4PUT6IT.js +2 -0
  85. package/dist/chunk-F56GCXXS.js +5 -0
  86. package/dist/chunk-FC2EVQRM.js +2 -0
  87. package/dist/chunk-FL7NBMHP.js +3 -0
  88. package/dist/chunk-FMRN2TRL.js +3 -0
  89. package/dist/chunk-FVULPZDF.js +20 -0
  90. package/dist/chunk-GCKCF5FL.js +43 -0
  91. package/dist/chunk-GH2PYF46.js +2 -0
  92. package/dist/chunk-GHJAGXIP.js +2 -0
  93. package/dist/{chunk-WIWY3CRX.js → chunk-GMVSHUKZ.js} +2 -2
  94. package/dist/chunk-GS6KDO4R.js +2 -0
  95. package/dist/chunk-GUUBXNN7.js +2 -0
  96. package/dist/chunk-GVWX5T43.js +80 -0
  97. package/dist/chunk-GZKFETP5.js +2 -0
  98. package/dist/chunk-H4EQHO6J.js +9 -0
  99. package/dist/chunk-H73WY2RM.js +2 -0
  100. package/dist/chunk-H75GSPRV.js +60 -0
  101. package/dist/chunk-HDR3AHSV.js +61 -0
  102. package/dist/chunk-HQBSL74Y.js +2 -0
  103. package/dist/chunk-HRRFKWPZ.js +2 -0
  104. package/dist/chunk-HXENDJC6.js +2 -0
  105. package/dist/chunk-IIBAZNSW.js +21 -0
  106. package/dist/chunk-INLMWEUU.js +12 -0
  107. package/dist/chunk-IWQPAF4F.js +2 -0
  108. package/dist/chunk-IZJ6YUKP.js +35 -0
  109. package/dist/chunk-J2TMAIN5.js +60 -0
  110. package/dist/chunk-J5FJMODQ.js +142 -0
  111. package/dist/chunk-J7HZPIO3.js +2 -0
  112. package/dist/chunk-JEVRKFRL.js +2 -0
  113. package/dist/chunk-JFXSGAEB.js +30 -0
  114. package/dist/chunk-JVRTHGFS.js +3 -0
  115. package/dist/chunk-JYWEX7RR.js +360 -0
  116. package/dist/chunk-K3YL22N6.js +2 -0
  117. package/dist/chunk-K4CN7GXK.js +12 -0
  118. package/dist/chunk-K5TBVXU4.js +30 -0
  119. package/dist/chunk-KDDIE2DP.js +9 -0
  120. package/dist/chunk-KHWRRPV4.js +2 -0
  121. package/dist/chunk-KI6NBKDY.js +14 -0
  122. package/dist/chunk-KU3QRSTH.js +2 -0
  123. package/dist/chunk-KZBJWZJB.js +2 -0
  124. package/dist/chunk-L7GFM3NP.js +3 -0
  125. package/dist/chunk-LMO6PK3V.js +35 -0
  126. package/dist/chunk-LN4YXJJU.js +2 -0
  127. package/dist/chunk-LOVIZBJ4.js +43 -0
  128. package/dist/chunk-LPCRK4A2.js +11 -0
  129. package/dist/chunk-MMHZKBFA.js +2 -0
  130. package/dist/{chunk-M2O5NY6W.js → chunk-MOQQBQRD.js} +2 -2
  131. package/dist/chunk-N2WN6I3L.js +2 -0
  132. package/dist/chunk-N3ORQT7L.js +2 -0
  133. package/dist/chunk-NAZ3RAIW.js +2 -0
  134. package/dist/chunk-NDUNO5JQ.js +2 -0
  135. package/dist/chunk-NEIWRNAZ.js +4 -0
  136. package/dist/chunk-NJJMVD65.js +2 -0
  137. package/dist/chunk-NLOQOBXI.js +20 -0
  138. package/dist/chunk-NOLZOVCU.js +2 -0
  139. package/dist/chunk-NOWINRRN.js +2 -0
  140. package/dist/chunk-NZAXKGRL.js +16 -0
  141. package/dist/chunk-O2C4UILI.js +2 -0
  142. package/dist/chunk-O3RHA6ZT.js +3 -0
  143. package/dist/chunk-O4UZSPPI.js +3 -0
  144. package/dist/chunk-OGFV2BUX.js +2 -0
  145. package/dist/chunk-OZCJXZK6.js +499 -0
  146. package/dist/chunk-P6ODM7BY.js +2 -0
  147. package/dist/{chunk-XBGWL66K.js → chunk-PAVGPRHJ.js} +2 -2
  148. package/dist/chunk-PH52RA7D.js +2 -0
  149. package/dist/chunk-PKN354TH.js +3 -0
  150. package/dist/chunk-PWOASWEG.js +11 -0
  151. package/dist/chunk-QIWXRW72.js +2 -0
  152. package/dist/chunk-QJRMOK5N.js +2 -0
  153. package/dist/{chunk-YXPUP5G2.js → chunk-QOIXNWQR.js} +2 -2
  154. package/dist/chunk-QXEUDXBT.js +3 -0
  155. package/dist/chunk-QYUVVBMR.js +6 -0
  156. package/dist/chunk-QZ7KQZRN.js +2 -0
  157. package/dist/chunk-R6LQBUDH.js +2 -0
  158. package/dist/chunk-RBS42E55.js +20 -0
  159. package/dist/chunk-RSJKPCFX.js +26 -0
  160. package/dist/chunk-S6CZA3MV.js +2 -0
  161. package/dist/chunk-STMVAHJP.js +2 -0
  162. package/dist/chunk-SYVPTTVW.js +2 -0
  163. package/dist/chunk-T3I6NHBH.js +2 -0
  164. package/dist/chunk-T6DK3ZP7.js +2 -0
  165. package/dist/chunk-TKD34PHN.js +4 -0
  166. package/dist/chunk-TNNQFH7W.js +2 -0
  167. package/dist/chunk-TNV7SSUF.js +2 -0
  168. package/dist/chunk-TO7ZR3EH.js +8 -0
  169. package/dist/chunk-TOU3CHK4.js +2 -0
  170. package/dist/chunk-TRBI4UKT.js +2 -0
  171. package/dist/chunk-TZCVNCAN.js +4 -0
  172. package/dist/chunk-U4LZA5LL.js +3 -0
  173. package/dist/chunk-U5RIG3JP.js +3 -0
  174. package/dist/chunk-UP5KXN2I.js +2 -0
  175. package/dist/chunk-UQFR3NDH.js +5 -0
  176. package/dist/chunk-UXYXF7GV.js +2 -0
  177. package/dist/chunk-VB3GOKOS.js +2 -0
  178. package/dist/chunk-VF5JZICY.js +2 -0
  179. package/dist/chunk-VTY3VK6E.js +2 -0
  180. package/dist/chunk-VX2O4RIS.js +2 -0
  181. package/dist/chunk-WKPV2TDZ.js +2 -0
  182. package/dist/chunk-WOFQ5DTB.js +2 -0
  183. package/dist/chunk-WS4C6TCK.js +2 -0
  184. package/dist/chunk-WXU3DGPU.js +2 -0
  185. package/dist/chunk-X6RMKHJQ.js +81 -0
  186. package/dist/{chunk-4ILJCCXV.js → chunk-XHMN6ZX7.js} +2 -2
  187. package/dist/chunk-XHTVFLWW.js +2 -0
  188. package/dist/chunk-XKIDJCIK.js +2 -0
  189. package/dist/chunk-XTYTYZPT.js +2 -0
  190. package/dist/chunk-Y2JHHTTA.js +2 -0
  191. package/dist/chunk-YGVRMGYN.js +4 -0
  192. package/dist/chunk-YNQCGEQE.js +2 -0
  193. package/dist/chunk-YOQVEXVE.js +14 -0
  194. package/dist/chunk-YRT2WLYY.js +2 -0
  195. package/dist/chunk-YTAP5Y2G.js +2 -0
  196. package/dist/chunk-YTYWI7VB.js +2 -0
  197. package/dist/chunk-YULZRALL.js +2 -0
  198. package/dist/chunk-Z33WQG4Q.js +2 -0
  199. package/dist/chunk-ZGTYGDMF.js +16 -0
  200. package/dist/chunk-ZHMRSZFD.js +43 -0
  201. package/dist/chunk-ZHSP366W.js +10 -0
  202. package/dist/chunk-ZIBYCYKK.js +7 -0
  203. package/dist/{chunk-GAS2LJMP.js → chunk-ZLADLUE6.js} +3 -3
  204. package/dist/chunk-ZO4YXUT6.js +4 -0
  205. package/dist/{chunk-HYO3NP5Q.js → chunk-ZR4HBC2H.js} +2 -2
  206. package/dist/cli-main.js +6 -6
  207. package/dist/cli.js +1 -1
  208. package/dist/{code-B17qEMbt.d.ts → code-BNyrCF3_.d.ts} +3 -2
  209. package/dist/code-IL5WH3NZ.js +2 -0
  210. package/dist/code-result-json-ANTBEDFP.js +4 -0
  211. package/dist/command-descriptors-HEEMDHTU.js +222 -0
  212. package/dist/deps-EOWFC6FD.js +2 -0
  213. package/dist/direct-navigation-Y5B6OSIQ.js +3 -0
  214. package/dist/{exploration-topology-BG4v30HZ.d.ts → exploration-topology-CSgEyAz-.d.ts} +3 -1
  215. package/dist/files-K4AI3JUM.js +2 -0
  216. package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
  217. package/dist/{health-CPp2Jf1Z.d.ts → health-BtfmNrfa.d.ts} +58 -74
  218. package/dist/hierarchy-6W5NDIFI.js +2 -0
  219. package/dist/imports-WH365QY4.js +2 -0
  220. package/dist/index.d.ts +13 -1
  221. package/dist/index.js +1 -1
  222. package/dist/members-K3PHMF5S.js +2 -0
  223. package/dist/methods-E7KVMBX4.js +2 -0
  224. package/dist/output-continuation-command-BJSY67SN.js +3 -0
  225. package/dist/output-pagination-UZJ5ACIX.js +24 -0
  226. package/dist/postinstall.js +1 -1
  227. package/dist/project-reindex-EP24WT4X.js +3 -0
  228. package/dist/queries/affected.js +1 -1
  229. package/dist/queries/architecture.d.ts +15 -4
  230. package/dist/queries/architecture.js +1 -1
  231. package/dist/queries/bottlenecks.js +1 -1
  232. package/dist/queries/by-kind.js +1 -1
  233. package/dist/queries/call-graph.d.ts +3 -1
  234. package/dist/queries/call-graph.js +1 -1
  235. package/dist/queries/change-surface.d.ts +1 -0
  236. package/dist/queries/change-surface.js +1 -1
  237. package/dist/queries/cleanup-plan.d.ts +3 -3
  238. package/dist/queries/cleanup-plan.js +1 -1
  239. package/dist/queries/co-change.d.ts +20 -2
  240. package/dist/queries/co-change.js +1 -1
  241. package/dist/queries/code.d.ts +1 -1
  242. package/dist/queries/code.js +1 -1
  243. package/dist/queries/complexity.d.ts +6 -3
  244. package/dist/queries/complexity.js +1 -1
  245. package/dist/queries/context.d.ts +1 -7
  246. package/dist/queries/context.js +1 -1
  247. package/dist/queries/coupling.js +1 -1
  248. package/dist/queries/cycles.js +1 -1
  249. package/dist/queries/dead.d.ts +2 -0
  250. package/dist/queries/dead.js +1 -1
  251. package/dist/queries/decorative-checkers.js +1 -1
  252. package/dist/queries/dependence-slice.d.ts +46 -22
  253. package/dist/queries/dependence-slice.js +1 -1
  254. package/dist/queries/dependency-depth.d.ts +1 -7
  255. package/dist/queries/dependency-depth.js +1 -1
  256. package/dist/queries/deps.js +1 -1
  257. package/dist/queries/diff-impact.d.ts +3 -1
  258. package/dist/queries/diff-impact.js +1 -1
  259. package/dist/queries/doc-drift.js +1 -1
  260. package/dist/queries/drift.d.ts +1 -1
  261. package/dist/queries/drift.js +1 -1
  262. package/dist/queries/duplicate-bodies.d.ts +29 -2
  263. package/dist/queries/duplicate-bodies.js +1 -1
  264. package/dist/queries/entry-map.d.ts +2 -4
  265. package/dist/queries/entry-map.js +1 -1
  266. package/dist/queries/evidence.d.ts +121 -61
  267. package/dist/queries/evidence.js +1 -1
  268. package/dist/queries/fan.js +1 -1
  269. package/dist/queries/files.js +1 -1
  270. package/dist/queries/health.d.ts +1 -1
  271. package/dist/queries/health.js +1 -1
  272. package/dist/queries/hierarchy.d.ts +2 -2
  273. package/dist/queries/hierarchy.js +1 -1
  274. package/dist/queries/hotspots.d.ts +1 -1
  275. package/dist/queries/hotspots.js +1 -1
  276. package/dist/queries/imports.d.ts +1 -0
  277. package/dist/queries/imports.js +1 -1
  278. package/dist/queries/incomplete-migration.d.ts +3 -3
  279. package/dist/queries/incomplete-migration.js +1 -1
  280. package/dist/queries/index.d.ts +17 -65
  281. package/dist/queries/index.js +1 -1
  282. package/dist/queries/locality-candidates.d.ts +4 -4
  283. package/dist/queries/locality-candidates.js +1 -1
  284. package/dist/queries/members.d.ts +2 -2
  285. package/dist/queries/members.js +1 -1
  286. package/dist/queries/methods.js +1 -1
  287. package/dist/queries/not-implemented.d.ts +2 -6
  288. package/dist/queries/not-implemented.js +1 -1
  289. package/dist/queries/outline.js +1 -1
  290. package/dist/queries/passthrough-candidates.d.ts +9 -1
  291. package/dist/queries/passthrough-candidates.js +1 -1
  292. package/dist/queries/react-component-duplicates.d.ts +19 -3
  293. package/dist/queries/react-component-duplicates.js +1 -1
  294. package/dist/queries/react-hook-candidates.d.ts +22 -3
  295. package/dist/queries/react-hook-candidates.js +1 -1
  296. package/dist/queries/react-large-component-pressure.d.ts +17 -3
  297. package/dist/queries/react-large-component-pressure.js +1 -1
  298. package/dist/queries/recent-duplicates.js +1 -1
  299. package/dist/queries/redundant-reexports.d.ts +4 -14
  300. package/dist/queries/redundant-reexports.js +1 -1
  301. package/dist/queries/refs.d.ts +4 -1
  302. package/dist/queries/refs.js +1 -1
  303. package/dist/queries/review.d.ts +188 -0
  304. package/dist/queries/review.js +2 -0
  305. package/dist/queries/similar-files.d.ts +7 -10
  306. package/dist/queries/similar-files.js +1 -1
  307. package/dist/queries/similar-signatures.js +1 -1
  308. package/dist/queries/similar.d.ts +19 -1
  309. package/dist/queries/similar.js +1 -1
  310. package/dist/queries/slice-cohesion.d.ts +205 -0
  311. package/dist/queries/slice-cohesion.js +2 -0
  312. package/dist/queries/source-inspection.d.ts +6 -202
  313. package/dist/queries/source-inspection.js +1 -1
  314. package/dist/queries/source-search.d.ts +2 -3
  315. package/dist/queries/source-search.js +1 -1
  316. package/dist/queries/stats.d.ts +1 -0
  317. package/dist/queries/stats.js +1 -1
  318. package/dist/queries/surface.js +1 -1
  319. package/dist/queries/symbols.js +1 -1
  320. package/dist/queries/system.d.ts +4 -2
  321. package/dist/queries/system.js +1 -1
  322. package/dist/queries/test-quality.d.ts +1 -1
  323. package/dist/queries/test-quality.js +1 -1
  324. package/dist/queries/twin-drift.d.ts +23 -7
  325. package/dist/queries/twin-drift.js +1 -1
  326. package/dist/queries/unused-imports.js +1 -1
  327. package/dist/queries/unused-params.d.ts +3 -15
  328. package/dist/queries/unused-params.js +1 -1
  329. package/dist/queries/vue-component-duplicates.js +1 -1
  330. package/dist/queries/vue-composable-candidates.js +1 -1
  331. package/dist/queries/vue-large-view-pressure.js +1 -1
  332. package/dist/query-service-fastpath.js +5 -5
  333. package/dist/query-service-server.js +4 -4
  334. package/dist/refs-CCBJG7WK.js +2 -0
  335. package/dist/refs-pagination-DRNLVU4S.js +2 -0
  336. package/dist/reindex-worker.js +79 -29
  337. package/dist/reindex.js +45 -45
  338. package/dist/repository-cache-worker.js +2 -0
  339. package/dist/runtime.d.ts +8 -8
  340. package/dist/runtime.js +3 -4
  341. package/dist/rust-semantic-session-server.js +1 -1
  342. package/dist/rust-semantic-session-worker.js +1 -1
  343. package/dist/rust-semantic-worker.js +1 -1
  344. package/dist/service-queries-2WAJI7R6.js +6 -0
  345. package/dist/source-inspection-91U9zdO3.d.ts +341 -0
  346. package/dist/{source-search-types-Dwz8KeuW.d.ts → source-search-types-DWGYNg8M.d.ts} +15 -2
  347. package/dist/stats-G7DIV6VU.js +2 -0
  348. package/dist/surface-IO55UALI.js +2 -0
  349. package/dist/system-ZBMSHJXU.js +2 -0
  350. package/dist/{queries/trace.d.ts → trace-BMjw3prn.d.ts} +1 -18
  351. package/dist/typescript-indexer.js +2 -0
  352. package/dist/typescript-mailbox-worker.js +1 -1
  353. package/dist/watch-server.js +3 -3
  354. package/docs/AGENT_GUIDE.md +19 -128
  355. package/docs/CLI_JSON_OUTPUT.md +21 -17
  356. package/docs/COMMAND_REFERENCE.md +34 -49
  357. package/docs/CURRENT_COMMANDS.md +123 -0
  358. package/docs/DETECTOR_EVIDENCE_CONTRACTS.md +0 -40
  359. package/docs/DETECTOR_GUIDE.md +55 -12
  360. package/docs/PRODUCT_VISION.md +135 -0
  361. package/docs/PROPERTY_TESTING.md +73 -0
  362. package/docs/REVIEW.md +76 -0
  363. package/docs/SKILLS.md +51 -0
  364. package/docs/WINDOWS_SIDECAR_RELEASE.md +12 -3
  365. package/docs/accuracy-audit-checklist.md +70 -13
  366. package/docs/analyzer-inventory.md +2 -2
  367. package/docs/locality-analyzer-design.md +9 -9
  368. package/package.json +18 -80
  369. package/scripts/evidence-product-contract.mjs +7 -3
  370. package/scripts/record-review-coverage.mjs +118 -0
  371. package/scripts/scip-windows-provenance.mjs +29 -19
  372. package/skills/scip-architecture-review/SKILL.md +57 -0
  373. package/skills/scip-architecture-review/agents/openai.yaml +4 -0
  374. package/skills/scip-architecture-review/references/design-checks.md +17 -0
  375. package/skills/scip-explore/SKILL.md +15 -59
  376. package/skills/scip-explore/agents/openai.yaml +3 -3
  377. package/skills/scip-explore/references/external-evidence.md +2 -2
  378. package/skills/scip-explore/references/information-model.md +26 -29
  379. package/skills/scip-explore/scripts/capture-evidence.mjs +68 -34
  380. package/skills/scip-integrity-audit/SKILL.md +53 -181
  381. package/skills/scip-integrity-audit/agents/openai.yaml +3 -3
  382. package/skills/scip-integrity-audit/references/integrity-probes.md +27 -0
  383. package/skills/scip-plan/SKILL.md +39 -65
  384. package/skills/scip-plan/agents/openai.yaml +2 -2
  385. package/skills/scip-query/SKILL.md +28 -81
  386. package/skills/scip-query/agents/openai.yaml +2 -2
  387. package/skills/scip-query/references/command-guide.md +169 -0
  388. package/skills/scip-setup/SKILL.md +4 -2
  389. package/skills/scip-setup/agents/openai.yaml +3 -3
  390. package/dist/by-kind-XI2CSWEY.js +0 -2
  391. package/dist/call-graph-UONR6JR5.js +0 -2
  392. package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
  393. package/dist/chunk-26CT72HM.js +0 -2
  394. package/dist/chunk-2E7CX53V.js +0 -2
  395. package/dist/chunk-2GRUZAQF.js +0 -43
  396. package/dist/chunk-2LDBDR6J.js +0 -29
  397. package/dist/chunk-2OOY75BW.js +0 -2
  398. package/dist/chunk-2R3V3PSD.js +0 -4
  399. package/dist/chunk-2WC2OEDO.js +0 -4
  400. package/dist/chunk-35NLDRZC.js +0 -2
  401. package/dist/chunk-3AF4TUFK.js +0 -3
  402. package/dist/chunk-3D3QG236.js +0 -2
  403. package/dist/chunk-3FHOF22C.js +0 -21
  404. package/dist/chunk-3JKSW6LJ.js +0 -2
  405. package/dist/chunk-3L2ZBPEX.js +0 -133
  406. package/dist/chunk-3PJABJSU.js +0 -2
  407. package/dist/chunk-3SVF22I5.js +0 -2
  408. package/dist/chunk-3WR4E3A3.js +0 -3
  409. package/dist/chunk-4FTZ4P5G.js +0 -2
  410. package/dist/chunk-4UX2F3JX.js +0 -2
  411. package/dist/chunk-4WNW27SX.js +0 -2
  412. package/dist/chunk-5ENOG4VP.js +0 -61
  413. package/dist/chunk-64BFSI5I.js +0 -2
  414. package/dist/chunk-66DVSJQG.js +0 -455
  415. package/dist/chunk-6HFCYNYE.js +0 -9
  416. package/dist/chunk-6PQNKL3G.js +0 -3
  417. package/dist/chunk-6V5CNXL6.js +0 -2
  418. package/dist/chunk-6VVV4WRR.js +0 -4
  419. package/dist/chunk-7BWFZPPZ.js +0 -2
  420. package/dist/chunk-7CYG22FH.js +0 -2
  421. package/dist/chunk-7F45LJKI.js +0 -2
  422. package/dist/chunk-7IWV2EG3.js +0 -3
  423. package/dist/chunk-7KCZELVM.js +0 -2
  424. package/dist/chunk-AFHTBORT.js +0 -2
  425. package/dist/chunk-AVRYW5OZ.js +0 -2
  426. package/dist/chunk-B3X6KU75.js +0 -2
  427. package/dist/chunk-B5D7QPBE.js +0 -4
  428. package/dist/chunk-BBCIS4DX.js +0 -16
  429. package/dist/chunk-BDUVI7TO.js +0 -3
  430. package/dist/chunk-BE7ZZTMC.js +0 -2
  431. package/dist/chunk-BHVUJOCQ.js +0 -3
  432. package/dist/chunk-BJT7LSPK.js +0 -3
  433. package/dist/chunk-BKVWUP7Y.js +0 -2
  434. package/dist/chunk-BQGB4HBD.js +0 -2
  435. package/dist/chunk-BRV7PIFF.js +0 -2
  436. package/dist/chunk-CEEZJXEF.js +0 -2
  437. package/dist/chunk-CIYLO6SI.js +0 -7
  438. package/dist/chunk-CJZXN4NU.js +0 -2
  439. package/dist/chunk-CNO7TOKL.js +0 -2
  440. package/dist/chunk-COF23M5F.js +0 -2
  441. package/dist/chunk-CWFP7GM5.js +0 -2
  442. package/dist/chunk-D2DHWI3D.js +0 -2
  443. package/dist/chunk-D4N5SQ2M.js +0 -4
  444. package/dist/chunk-DBRSYFXR.js +0 -2
  445. package/dist/chunk-DHUIOLDT.js +0 -2
  446. package/dist/chunk-DIRJWYBM.js +0 -6
  447. package/dist/chunk-DIUFNHRJ.js +0 -35
  448. package/dist/chunk-DRENNWRG.js +0 -2
  449. package/dist/chunk-DTZCKZEU.js +0 -4
  450. package/dist/chunk-DULC3QFP.js +0 -5
  451. package/dist/chunk-DYGHBZ2N.js +0 -16
  452. package/dist/chunk-E5R6AQ73.js +0 -40
  453. package/dist/chunk-E73UNJTF.js +0 -38
  454. package/dist/chunk-EKV5HX33.js +0 -2
  455. package/dist/chunk-EQHFIL6T.js +0 -3
  456. package/dist/chunk-ESIQ66Z7.js +0 -2
  457. package/dist/chunk-EVFUMY4R.js +0 -3
  458. package/dist/chunk-F7DY272B.js +0 -2
  459. package/dist/chunk-FBN2FGXG.js +0 -2
  460. package/dist/chunk-FDLOBR6P.js +0 -4
  461. package/dist/chunk-FESCRNVV.js +0 -5
  462. package/dist/chunk-FFRKR4EQ.js +0 -2
  463. package/dist/chunk-FGA2U4OR.js +0 -8
  464. package/dist/chunk-FIQRSHVM.js +0 -2
  465. package/dist/chunk-FPYLNQPT.js +0 -2
  466. package/dist/chunk-FRUSVINH.js +0 -2
  467. package/dist/chunk-GSP44ENC.js +0 -2
  468. package/dist/chunk-GUFSG5TX.js +0 -2
  469. package/dist/chunk-GYIZ4NXB.js +0 -2
  470. package/dist/chunk-GZIUDL6G.js +0 -2
  471. package/dist/chunk-H5EXS3HM.js +0 -2
  472. package/dist/chunk-HCXEQRFF.js +0 -18
  473. package/dist/chunk-HEHOQQKH.js +0 -2
  474. package/dist/chunk-HKGFPJ4T.js +0 -4
  475. package/dist/chunk-HLZTEXRA.js +0 -2
  476. package/dist/chunk-HOENASQM.js +0 -3
  477. package/dist/chunk-HVF5VBG6.js +0 -2
  478. package/dist/chunk-I55I7XXP.js +0 -2
  479. package/dist/chunk-IDFEUFKS.js +0 -2
  480. package/dist/chunk-IHGQTTVW.js +0 -2
  481. package/dist/chunk-IICPE7B2.js +0 -20
  482. package/dist/chunk-IL676XCC.js +0 -18
  483. package/dist/chunk-IW5XQG5G.js +0 -2
  484. package/dist/chunk-IZDPJ2QI.js +0 -2
  485. package/dist/chunk-J66VOFW6.js +0 -5
  486. package/dist/chunk-JFMEXGFE.js +0 -2
  487. package/dist/chunk-JGKUET5J.js +0 -3
  488. package/dist/chunk-JS4PGXMV.js +0 -3
  489. package/dist/chunk-JWTGMPIT.js +0 -80
  490. package/dist/chunk-JYR66JN5.js +0 -5
  491. package/dist/chunk-KFOYCQAJ.js +0 -9
  492. package/dist/chunk-KLFEXGQA.js +0 -2
  493. package/dist/chunk-KMVGRIO2.js +0 -2
  494. package/dist/chunk-KYSDI3GE.js +0 -5
  495. package/dist/chunk-L6PJPETJ.js +0 -29
  496. package/dist/chunk-LDVT66YM.js +0 -2
  497. package/dist/chunk-LEECKFCJ.js +0 -2
  498. package/dist/chunk-LMZ5PRUV.js +0 -2
  499. package/dist/chunk-LQRQN2XA.js +0 -2
  500. package/dist/chunk-LXABEJX3.js +0 -2
  501. package/dist/chunk-MNV5FSBW.js +0 -3
  502. package/dist/chunk-MPQ4OTBM.js +0 -2
  503. package/dist/chunk-MTDBHTSF.js +0 -2
  504. package/dist/chunk-MV3CDXPI.js +0 -38
  505. package/dist/chunk-MWN53KRN.js +0 -60
  506. package/dist/chunk-MXNGIEPU.js +0 -3
  507. package/dist/chunk-N2ZSIIGR.js +0 -117
  508. package/dist/chunk-N5B2NILC.js +0 -5
  509. package/dist/chunk-NJITK2GP.js +0 -2
  510. package/dist/chunk-NOGJXYFO.js +0 -2
  511. package/dist/chunk-NOYBFVJA.js +0 -554
  512. package/dist/chunk-NWQXSFFU.js +0 -3
  513. package/dist/chunk-ODDUPDP7.js +0 -13
  514. package/dist/chunk-OLIWTZI3.js +0 -3
  515. package/dist/chunk-OLNV6I6U.js +0 -2
  516. package/dist/chunk-OR2E3AGZ.js +0 -2
  517. package/dist/chunk-OSR2GEHQ.js +0 -2
  518. package/dist/chunk-OSSESPDX.js +0 -3
  519. package/dist/chunk-OWOOWNJ5.js +0 -7
  520. package/dist/chunk-P42EIXTA.js +0 -2
  521. package/dist/chunk-PJFGPYTU.js +0 -2
  522. package/dist/chunk-PP7KNN7L.js +0 -2
  523. package/dist/chunk-PU7T5QYQ.js +0 -2
  524. package/dist/chunk-PWWAJSKV.js +0 -74
  525. package/dist/chunk-PZL5T7SU.js +0 -73
  526. package/dist/chunk-QBE3YX64.js +0 -23
  527. package/dist/chunk-QGVTFRY2.js +0 -7
  528. package/dist/chunk-QOJONDS7.js +0 -2
  529. package/dist/chunk-QU5XRYB5.js +0 -4
  530. package/dist/chunk-QUU5OBVK.js +0 -11
  531. package/dist/chunk-RBLQNW26.js +0 -20
  532. package/dist/chunk-RTQ7NEKG.js +0 -81
  533. package/dist/chunk-SQXRS7BG.js +0 -4
  534. package/dist/chunk-SSK6LDPC.js +0 -2
  535. package/dist/chunk-SZHGTCPP.js +0 -7
  536. package/dist/chunk-T4N4P2K5.js +0 -16
  537. package/dist/chunk-TA3QKLLU.js +0 -2
  538. package/dist/chunk-TEBQMNVI.js +0 -43
  539. package/dist/chunk-TPFHAQ2G.js +0 -2
  540. package/dist/chunk-TQPCBMWT.js +0 -5
  541. package/dist/chunk-TQZV7KV4.js +0 -2
  542. package/dist/chunk-TRNAEQ6P.js +0 -3
  543. package/dist/chunk-TY7CRN3Z.js +0 -2
  544. package/dist/chunk-UHFYCMZO.js +0 -35
  545. package/dist/chunk-UICY4GTQ.js +0 -7
  546. package/dist/chunk-UVGEWT4Y.js +0 -26
  547. package/dist/chunk-UXW33INU.js +0 -29
  548. package/dist/chunk-VMPRET3I.js +0 -5
  549. package/dist/chunk-VNLGKHS6.js +0 -6
  550. package/dist/chunk-VQILFTEH.js +0 -2
  551. package/dist/chunk-VUPHCS7Y.js +0 -57
  552. package/dist/chunk-VVZSBTSU.js +0 -23
  553. package/dist/chunk-VZRNID6A.js +0 -2
  554. package/dist/chunk-W5OXRYGE.js +0 -7
  555. package/dist/chunk-W6STWDQI.js +0 -57
  556. package/dist/chunk-W7CXK74K.js +0 -2
  557. package/dist/chunk-WB3WYIRE.js +0 -4
  558. package/dist/chunk-WDNVY4E7.js +0 -20
  559. package/dist/chunk-WK46TNUM.js +0 -3
  560. package/dist/chunk-WNTFFKAX.js +0 -12
  561. package/dist/chunk-WOIKCX6A.js +0 -2
  562. package/dist/chunk-WUN6KBHV.js +0 -2
  563. package/dist/chunk-WYCTJDVR.js +0 -2
  564. package/dist/chunk-WYPL7GF7.js +0 -2
  565. package/dist/chunk-XDAUYDFT.js +0 -2
  566. package/dist/chunk-XDQMU3BT.js +0 -2
  567. package/dist/chunk-XFA4SSO3.js +0 -3
  568. package/dist/chunk-XGZEP6GR.js +0 -8
  569. package/dist/chunk-XPDPNWTQ.js +0 -368
  570. package/dist/chunk-XRYABF57.js +0 -8
  571. package/dist/chunk-YBGKCQIS.js +0 -2
  572. package/dist/chunk-YEN6CYC7.js +0 -16
  573. package/dist/chunk-YF5IB2LF.js +0 -2
  574. package/dist/chunk-YI2AWIHC.js +0 -3
  575. package/dist/chunk-YPWBKGFU.js +0 -2
  576. package/dist/chunk-YPWHBBIS.js +0 -2
  577. package/dist/chunk-YSH6U3L4.js +0 -3
  578. package/dist/chunk-YU5DZUZI.js +0 -10
  579. package/dist/chunk-YWO5DDRC.js +0 -16
  580. package/dist/chunk-Z4CDXYNQ.js +0 -2
  581. package/dist/chunk-ZF5KHH7C.js +0 -2
  582. package/dist/chunk-ZOHS7AQV.js +0 -21
  583. package/dist/chunk-ZTI4SBFV.js +0 -3
  584. package/dist/code-MI6F2TTU.js +0 -2
  585. package/dist/code-result-json-FXALY4HE.js +0 -2
  586. package/dist/command-descriptors-P34VABY5.js +0 -343
  587. package/dist/dataflow-4KEMJPC6.js +0 -2
  588. package/dist/dependence-slice-R7FPWD5M.js +0 -2
  589. package/dist/deps-7EMQUYUT.js +0 -2
  590. package/dist/direct-navigation-6YO234F2.js +0 -3
  591. package/dist/entry-map-KOOLR26E.js +0 -2
  592. package/dist/files-OPIPJIGZ.js +0 -2
  593. package/dist/graph-evidence-Bjyky2V4.d.ts +0 -126
  594. package/dist/hierarchy-QPD2CAER.js +0 -2
  595. package/dist/imports-M6HUXRXC.js +0 -2
  596. package/dist/members-I5MEFOCT.js +0 -2
  597. package/dist/methods-5JYGGHXA.js +0 -2
  598. package/dist/next-anchor-candidates-BwMczMvX.d.ts +0 -90
  599. package/dist/output-continuation-command-UPQAAKBP.js +0 -3
  600. package/dist/output-pagination-3OFL2MJV.js +0 -19
  601. package/dist/project-reindex-UKKQ5PLS.js +0 -3
  602. package/dist/queries/anchors.d.ts +0 -123
  603. package/dist/queries/anchors.js +0 -2
  604. package/dist/queries/complexity-hotspots.d.ts +0 -40
  605. package/dist/queries/complexity-hotspots.js +0 -2
  606. package/dist/queries/convergence.d.ts +0 -33
  607. package/dist/queries/convergence.js +0 -2
  608. package/dist/queries/dataflow.d.ts +0 -77
  609. package/dist/queries/dataflow.js +0 -2
  610. package/dist/queries/deep-chains.d.ts +0 -5
  611. package/dist/queries/deep-chains.js +0 -2
  612. package/dist/queries/extract-candidates.d.ts +0 -52
  613. package/dist/queries/extract-candidates.js +0 -2
  614. package/dist/queries/isolated.d.ts +0 -24
  615. package/dist/queries/isolated.js +0 -2
  616. package/dist/queries/plan-context.d.ts +0 -33
  617. package/dist/queries/plan-context.js +0 -2
  618. package/dist/queries/reference-neighborhood.d.ts +0 -4
  619. package/dist/queries/reference-neighborhood.js +0 -2
  620. package/dist/queries/reference-reachability.d.ts +0 -48
  621. package/dist/queries/reference-reachability.js +0 -2
  622. package/dist/queries/self-audit.d.ts +0 -63
  623. package/dist/queries/self-audit.js +0 -2
  624. package/dist/queries/similar-chains.d.ts +0 -48
  625. package/dist/queries/similar-chains.js +0 -2
  626. package/dist/queries/slice.d.ts +0 -4
  627. package/dist/queries/slice.js +0 -2
  628. package/dist/queries/stale-abstractions.d.ts +0 -72
  629. package/dist/queries/stale-abstractions.js +0 -2
  630. package/dist/queries/system-map.d.ts +0 -449
  631. package/dist/queries/system-map.js +0 -2
  632. package/dist/queries/trace.js +0 -2
  633. package/dist/queries/twin-ab.d.ts +0 -66
  634. package/dist/queries/twin-ab.js +0 -2
  635. package/dist/queries/value-flow.d.ts +0 -43
  636. package/dist/queries/value-flow.js +0 -2
  637. package/dist/queries/wrapper-candidates.d.ts +0 -34
  638. package/dist/queries/wrapper-candidates.js +0 -2
  639. package/dist/refs-PSU4JZZW.js +0 -2
  640. package/dist/refs-pagination-JG6CJMRC.js +0 -2
  641. package/dist/slice-HYRATV64.js +0 -2
  642. package/dist/source-snippet-_wrcgmZc.d.ts +0 -15
  643. package/dist/stats-OOJ74B32.js +0 -2
  644. package/dist/surface-VTGDYWF5.js +0 -2
  645. package/dist/symbol-resolution-WD5EU5JE.js +0 -2
  646. package/dist/system-LRQNFOR2.js +0 -2
  647. package/dist/trace-F4B6OLL4.js +0 -2
  648. package/dist/value-flow-VRPZY72V.js +0 -2
  649. package/skills/concrete-plan/SKILL.md +0 -8
  650. package/skills/concrete-plan/agents/openai.yaml +0 -4
@@ -1,2 +0,0 @@
1
- import{e as M}from"./chunk-JGKUET5J.js";import{b as $}from"./chunk-BOJ5SVE2.js";import{a as p}from"./chunk-BGBBVSH4.js";import{m as I}from"./chunk-NWQXSFFU.js";import{d as D}from"./chunk-MTDBHTSF.js";import{d as b,j as h,p as x,q as y,u as L}from"./chunk-N2ZSIIGR.js";import{a as g,e as S}from"./chunk-ODDUPDP7.js";import{h as d}from"./chunk-FESCRNVV.js";var B=new Set(D());function X(e,n={}){let{scope:s,minLoc:i=1,limit:r,scanLimit:c,maxShapeFrequency:a=12}=n,o=n.semantic!==!1,t=w(e,F(e,{scope:s,minLoc:i,scanLimit:c}),{semantic:o,maxShapeFrequency:a}),m=P(t);return r?m.slice(0,r):m}function F(e,n){let s=L(e,{scope:n.scope}).filter(i=>v(i)&&!e.isIgnored(i.relativePath)).filter(i=>p(i)>=n.minLoc);return typeof n.scanLimit=="number"&&n.scanLimit>0&&s.sort((i,r)=>p(r)-p(i)||i.relativePath.localeCompare(r.relativePath)),$(s,n.scanLimit)}function v(e){return!e.isFunctionLike||h(e.symbol)?!1:e.kind===null||B.has(e.kind)}function w(e,n,s){let i=[];for(let a of n){let o=G(e,a,s);o&&i.push({signature:o,definition:a,fn:z(a)})}let r=new Map;for(let a of i)r.set(a.signature,(r.get(a.signature)??0)+1);let c=new Map;for(let a of i){let o=C(a.fn.loc),t=(r.get(a.signature)??0)>s.maxShapeFrequency,m=t?M(e,a.definition):null;if(t&&!m)continue;let u=t?`${a.signature}\0body\0${m}`:`${a.signature}\0band\0${o}`,l=c.get(u)??{signature:a.signature,locBand:o,exactBody:t,functions:[]};l.functions.push(a.fn),c.set(u,l)}return[...c.values()]}function z(e){return{symbol:e.symbol,shortName:b(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:p(e)}}function P(e){let n=[];for(let s of e)s.functions.length>=2&&n.push(s);return n.sort((s,i)=>{let r=i.functions.length-s.functions.length;if(r!==0)return r;let c=s.functions.reduce((o,t)=>o+t.loc,0);return i.functions.reduce((o,t)=>o+t.loc,0)-c}),n}function C(e){return e<=5?"<=5":e<=20?"6-20":">20"}function G(e,n,s){if(s.semantic){let c=I(e,n);if(c)return c}let i=k(n.documentation),r=i?A(i):null;return r||E(N(e,n.relativePath,n.startLine,n.endLine,n.leaf),n.leaf)}function k(e){return x(y(e))}function N(e,n,s,i,r){let c=d(e,n);if(!c)return null;let a=c.split(/\r?\n/),o=O(a,s,i,r);for(let t of o){let m=Math.min(a.length-1,Math.max(t,t+4)),u="";for(let l=t;l<=m;l+=1){let f=a[l]?.trim();if(f&&(u=u?`${u} ${f}`:f,q(u)))return u}if(u&&u.includes("("))return u}return null}function q(e){let n=e.replace(/\s+/g," ").trim();return!n.includes("(")||S(n)>0?!1:/[;{]$/.test(n)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(n)||/\)\s*As\s+.+$/i.test(n)}function A(e){if(!e||!e.trim())return null;let n=e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim(),s=n.indexOf("(");return s===-1||(n=n.slice(s),n=n.replace(/\s+/g,"").toLowerCase(),n.length<3)?null:n}function E(e,n){if(!e||!e.trim())return null;let s=e.replace(/\s+/g," ").trim(),i=s.indexOf("(");if(i===-1)return null;let r=s.slice(0,i),a=new RegExp(`\\b${g(n)}\\b`,"i").exec(r);a&&typeof a.index=="number"&&(r=r.slice(0,a.index)),r=r.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let o=R(s.slice(i)).replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!o.startsWith("("))return null;let t=`${r?`${r} `:""}${o}`.replace(/\s+/g,"").toLowerCase();return t.length>=3?t:null}function R(e){let n=0,s=0,i=0,r=0,c=null,a=!1;for(let o=0;o<e.length;o+=1){let t=e[o];if(c){if(a){a=!1;continue}if(t==="\\"){a=!0;continue}t===c&&(c=null);continue}if(t==='"'||t==="'"||t==="`"){c=t;continue}if(t==="(")n+=1;else if(t===")")n=Math.max(0,n-1);else if(t==="[")i+=1;else if(t==="]")i=Math.max(0,i-1);else if(t==="<")r+=1;else if(t===">")r=Math.max(0,r-1);else if(t==="{"){if(n===0&&i===0&&r===0)return e.slice(0,o);s+=1}else if(t==="}")s=Math.max(0,s-1);else if(t==="="&&e[o+1]===">"&&n===0&&s===0&&i===0&&r===0)return e.slice(0,o)}return e}function O(e,n,s,i){let r=g(i),c=new RegExp(`\\b${r}\\b\\s*\\(`,"i"),a=new RegExp(`\\bdef\\s+${r}\\b`,"i"),o=[],t=new Set,m=Math.max(0,Math.min(n,e.length-1)),u=Math.max(m,Math.min(e.length-1,Math.max(s,n+4)));for(let l=m;l<=u;l+=1){let f=e[l]??"";(c.test(f)||a.test(f))&&!t.has(l)&&(t.add(l),o.push(l))}for(let l=0;l<e.length;l+=1){let f=e[l]??"";(c.test(f)||a.test(f))&&!t.has(l)&&(t.add(l),o.push(l))}return o}export{X as a};
2
- //# sourceMappingURL=chunk-FPYLNQPT.js.map
@@ -1,2 +0,0 @@
1
- import{o as r}from"./chunk-KYSDI3GE.js";function _(t){switch(t){case"entry":case"source":case"worker":return 0;case"barrel":return 1;case"test":return 2}}function a(t){let s=r(t);return i(s)?"test":n(s)?"worker":u(s)?"entry":f(s)?"barrel":"source"}function i(t){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(t)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(t)||/(?:^|\/)spec_[^/]+$/i.test(t)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(t)||/(?:^|\/)[^/]+_tests\.rs$/i.test(t)||/(?:^|\/)tests\.rs$/i.test(t)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(t)||/(?:^|\/)__tests__\//i.test(t)||/(?:^|\/)test\//i.test(t)||/(?:^|\/)tests\//i.test(t)||/(?:^|\/)__fixtures__\//i.test(t)||/(?:^|\/)__mocks__\//i.test(t)||/(?:^|\/)test-support\//i.test(t)||/(?:^|\/)test-utils\//i.test(t)||/(?:^|\/)testing\//i.test(t))}function n(t){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(t)}function u(t){let s=t.split("/"),e=s[s.length-1]??t;return e==="cli.ts"||e==="cli.js"||e==="postinstall.ts"||e==="postinstall.js"||e==="main.ts"||e==="main.js"||e==="main.rs"||e==="main.go"||e==="main.py"||e==="build.rs"||e==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(t)||/(?:^|\/)examples\/[^/]+\.rs$/.test(t)||/(?:^|\/)tests\/[^/]+\.rs$/.test(t)||/(?:^|\/)benches\/[^/]+\.rs$/.test(t)?!0:e==="index.ts"||e==="index.js"?/(?:^|\/)(?:apps|services)\/[^/]+\/src\/index\.(?:ts|js)$/.test(t)?!0:s.length<=2:!1}function f(t){return t==="index.ts"||t==="index.js"||t.endsWith("/index.ts")||t.endsWith("/index.js")||t.endsWith("/mod.rs")||t.endsWith("/__init__.py")}export{_ as a,a as b};
2
- //# sourceMappingURL=chunk-FRUSVINH.js.map
@@ -1,2 +0,0 @@
1
- import{a as B}from"./chunk-SV2LEFVM.js";import{a as $}from"./chunk-35NLDRZC.js";import{b as P}from"./chunk-NJITK2GP.js";import{b as j}from"./chunk-TEBQMNVI.js";import{t as q}from"./chunk-N2ZSIIGR.js";import{y as v}from"./chunk-ODDUPDP7.js";import{a as U}from"./chunk-ZOHS7AQV.js";import{readdirSync as L}from"fs";import{join as I}from"path";function z(e){return V(e).replace(/\/\*\*?$/,"")}function D(e,r){let t=V(r),o=z(t),c=t.endsWith("/**"),s=[],n=(a,l)=>{let g;try{g=L(a,{withFileTypes:!0})}catch{return}for(let p of g){if(p.name.startsWith("."))continue;let u=l?`${l}/${p.name}`:p.name;B(t,u)&&s.push(u),c&&p.isDirectory()&&n(I(a,p.name),u)}};return n(I(e,o),o),s.sort()}function V(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"")}var G=/\.(test|spec)\.(ts|tsx|js|jsx|mts|cts)$/,T=new Map;function k(e,r,t,o){if(!r?.testPaths?.length)return[];let c=H(r),s=[];for(let n of _(e,r.testPaths)){let a=K(e,n,o),l=a?t(a):null;if(l)for(let g of v(e,n)){let p=g.sourcePath;if(!p)continue;let u=t(p);u&&u!==l&&(c.get(l)?.has(u)||s.push({testFile:n,ownerBoundary:l,importedFile:p,importedBoundary:u,reason:"outside-owner-policy"}))}}return N(s)}function H(e){let r=e.allowedDependencies??{},t=e.boundaries.map(n=>n.name),o=new Map,c=(n,a)=>{for(let l of r[n]??[])a.has(l)||(a.add(l),c(l,a))};for(let n of t){let a=new Set;c(n,a),o.set(n,a)}let s=new Map;for(let n of t){let a=new Set(o.get(n));for(let l of t)l!==n&&o.get(l)?.has(n)&&a.add(l);s.set(n,a)}return s}function _(e,r){let t=`${e.config.projectRoot}\0${r.join("\0")}`,o=T.get(t);if(o)return o;let c=new Set;for(let n of r)for(let a of D(e.config.projectRoot,n))G.test(a)&&c.add(a);let s=[...c].sort();return T.set(t,s),s}function K(e,r,t){let o=r.replace(/^tests\//,"src/").replace(/\.(test|spec)\.(\w+)$/,".$2");if(o!==r&&t(o))return o;let c=r.split("/").pop().replace(/\.(test|spec)\.(\w+)$/,".$2"),s=v(e,r).map(n=>n.sourcePath).filter(n=>!!n&&t(n)&&n.split("/").pop()===c);return s.length===1?s[0]:null}function N(e){let r=new Map;for(let t of e){let o=`${t.testFile}\0${t.importedBoundary}`;r.has(o)||r.set(o,t)}return[...r.values()].sort((t,o)=>t.testFile.localeCompare(o.testFile)||t.importedBoundary.localeCompare(o.importedBoundary))}function O(e,r){let t=(e?.boundaries??[]).filter(o=>o.paths.some(c=>B(c,r)));return t.length===1?t[0].name:null}var C="architecture:";function W(e,r,t,o={}){let c=J(e,r);if(!t||t.boundaries.length===0)return{configured:!1,boundaries:[],edges:[],forbiddenEdges:[],reciprocalPairs:[],cycles:[],coarseBoundaries:[],staleAllowances:[],boundaryLimits:[],fragileEdges:[],testBoundaryViolations:[],coverage:{totalFiles:c.length,mappedFiles:0,unmappedFiles:[],ambiguousFiles:[]},policyCoverage:{declaredRows:0,totalBoundaries:0,missingRows:[],requiresCompletePolicy:!1,requiresCompleteCoverage:!1,requiresMinimalPolicy:!1}};let s=new Map,n=new Map(t.boundaries.map(i=>[i.name,new Set])),a=[],l=[];for(let i of c){let f=t.boundaries.filter(y=>y.paths.some(S=>B(S,i))).map(y=>y.name).sort();if(f.length===0)a.push(i);else if(f.length>1)l.push({file:i,boundaries:f});else{let y=f[0];s.set(i,y),n.get(y).add(i)}}let g=new Map;for(let[i,f]of e){let y=s.get(i);if(y)for(let S of f){let x=s.get(S);if(!x||y===x)continue;let M=F(y,x),w=g.get(M);w||(w={from:y,to:x,fileEdges:[],importers:new Set,importedFiles:new Set},g.set(M,w)),w.fileEdges.push({fromFile:i,toFile:S}),w.importers.add(i),w.importedFiles.add(S)}}let p=[...g.values()].map(i=>Q(i,t)).sort(ie),u=p,E=new Map(u.map(i=>[F(i.from,i.to),i])),R=new Map(t.boundaries.map(i=>[i.name,new Set]));for(let i of u)R.get(i.from).add(i.to);let m=[];for(let i of u){if(i.from>=i.to)continue;let f=E.get(F(i.to,i.from));f&&m.push({boundaries:[i.from,i.to],forward:i,reverse:f})}let{components:A}=$(R),h=A.filter(i=>i.length>1).map(i=>Z(i,u,t.requireAcyclic===!0)).sort((i,f)=>f.boundaries.length-i.boundaries.length||i.boundaries.join("/").localeCompare(f.boundaries.join("/"))),b=t.allowedDependencies??{},d=t.boundaries.map(i=>i.name).filter(i=>!Object.hasOwn(b,i)).sort();return{configured:!0,boundaries:t.boundaries.map(i=>({name:i.name,paths:[...i.paths],fileCount:n.get(i.name).size,dependencyPolicyDeclared:Object.hasOwn(b,i.name)})).sort((i,f)=>i.name.localeCompare(f.name)),edges:p,forbiddenEdges:u.filter(i=>i.policyStatus==="forbidden"),reciprocalPairs:m,cycles:h,staleAllowances:te(t,u),boundaryLimits:oe(t,u,n),fragileEdges:u.filter(i=>i.fragile),testBoundaryViolations:o.testBoundaryViolations??[],coarseBoundaries:ee(e,n,o.isModuleHierarchyFile,t.requireResolvedBoundaries===!0,i=>t.boundaries.find(f=>f.name===i)?.subUnits??"directory"),coverage:{totalFiles:c.length,mappedFiles:s.size,unmappedFiles:a,ambiguousFiles:l},policyCoverage:{declaredRows:t.boundaries.length-d.length,totalBoundaries:t.boundaries.length,missingRows:d,requiresCompletePolicy:t.requireCompletePolicy===!0,requiresCompleteCoverage:t.requireCompleteCoverage===!0,requiresMinimalPolicy:t.requireMinimalPolicy===!0}}}function Fe(e,r={}){let t=j(e,r.scope,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}),o=U(e,{includeIgnored:!1}).filter(s=>!r.scope||s.includes(r.scope)),c=new Set(o);return W(t,o,e.config.architecture,{isModuleHierarchyFile:s=>X(e,s),testBoundaryViolations:k(e,e.config.architecture,s=>O(e.config.architecture,s),s=>c.has(s))})}function X(e,r){let t=P(r);return t==="test"||t==="entry"?!0:t!=="barrel"?!1:q(e,r).length===0}function Ee(e){let r=e.forbiddenEdges.map(o=>`${C}forbidden-edge:${encodeURIComponent(o.from)}:${encodeURIComponent(o.to)}`);if(e.policyCoverage.requiresCompletePolicy)for(let o of e.policyCoverage.missingRows)r.push(`${C}missing-policy-row:${encodeURIComponent(o)}`);if(e.policyCoverage.requiresCompleteCoverage){for(let o of e.coverage.unmappedFiles)r.push(`${C}unmapped-file:${encodeURIComponent(o)}`);for(let o of e.coverage.ambiguousFiles)r.push(`${C}ambiguous-file:${encodeURIComponent(o.file)}:${o.boundaries.map(c=>encodeURIComponent(c)).sort().join("|")}`)}if(e.policyCoverage.requiresMinimalPolicy)for(let o of e.staleAllowances)r.push(`${C}stale-allowance:${encodeURIComponent(o.from)}:${encodeURIComponent(o.to)}`);for(let o of e.testBoundaryViolations)r.push(`${C}test-boundary:${encodeURIComponent(o.testFile)}:${encodeURIComponent(o.importedBoundary)}`);for(let o of e.boundaryLimits)r.push(`${C}boundary-limit:${o.kind}:${encodeURIComponent(o.boundary)}`);let t=new Map;for(let o of e.coarseBoundaries)o.violatesPolicy&&t.set(o.boundary,(t.get(o.boundary)??0)+1);for(let[o,c]of t){let s=`${C}coarse-boundary:${encodeURIComponent(o)}`;r.push(s);for(let n=2;n<=c;n+=1)r.push(`${s}:component:${n}`)}for(let o of e.cycles)o.violatesPolicy&&r.push(`${C}cycle:${o.boundaries.map(c=>encodeURIComponent(c)).sort().join("|")}`);return[...new Set(r)].sort()}function Se(e){return!!e&&(Object.keys(e.allowedDependencies??{}).length>0||e.requireCompletePolicy===!0||e.requireCompleteCoverage===!0||e.requireAcyclic===!0||e.requireResolvedBoundaries===!0||e.requireMinimalPolicy===!0||e.maxBoundaryFanOut!==void 0||e.maxBoundaryFiles!==void 0||e.boundaries.some(r=>r.maxFiles!==void 0)||(e.testPaths?.length??0)>0)}function J(e,r){let t=new Set(r);for(let[o,c]of e){t.add(o);for(let s of c)t.add(s)}return[...t].sort()}function Q(e,r){let t=[...e.fileEdges].sort((o,c)=>o.fromFile.localeCompare(c.fromFile)||o.toFile.localeCompare(c.toFile));return{from:e.from,to:e.to,policyStatus:Y(r,e.from,e.to),fileEdgeCount:t.length,importerCount:e.importers.size,importedFileCount:e.importedFiles.size,examples:t.slice(0,5),fragile:t.length===1}}function Y(e,r,t){return!e.allowedDependencies||!Object.hasOwn(e.allowedDependencies,r)?"undeclared":e.allowedDependencies[r].includes(t)?"allowed":"forbidden"}function Z(e,r,t){let o=[...e].sort(),c=new Set(o),s=r.filter(a=>c.has(a.from)&&c.has(a.to)),n=Math.min(...s.map(a=>a.fileEdgeCount));return{boundaries:o,internalEdges:s,narrowestEdges:s.filter(a=>a.fileEdgeCount===n),violatesPolicy:t}}function ee(e,r,t=re,o=!1,c=()=>"directory"){let s=[];for(let[n,a]of r){let l=c(n)==="file"?m=>m:ne,g=[...a].filter(m=>!t(m));if(g.length<2)continue;let p=new Set(g),u=new Map,E=new Map;for(let m of g)E.set(l(m),new Set);for(let m of g)for(let A of e.get(m)??[]){if(!p.has(A))continue;let h=l(m),b=l(A);if(h===b)continue;let d=F(h,b),i=u.get(d);i||(i={from:h,to:b,fileEdges:[]},u.set(d,i)),i.fileEdges.push({fromFile:m,toFile:A}),E.get(h).add(b)}let{components:R}=$(E);for(let m of R){if(m.length<2)continue;let A=new Set(m),h=[...u.values()].filter(d=>A.has(d.from)&&A.has(d.to)).map(d=>({from:d.from,to:d.to,fileEdgeCount:d.fileEdges.length,examples:d.fileEdges.slice(0,5)})).sort((d,i)=>d.from.localeCompare(i.from)||d.to.localeCompare(i.to)),b=Math.min(...h.map(d=>d.fileEdgeCount));s.push({boundary:n,violatesPolicy:o,subUnits:[...m].sort(),internalEdges:h,narrowestEdges:h.filter(d=>d.fileEdgeCount===b)})}}return s.sort((n,a)=>a.subUnits.length-n.subUnits.length||n.boundary.localeCompare(a.boundary))}function te(e,r){let t=new Set(r.map(n=>F(n.from,n.to))),o=e.allowedDependencies??{},c=new Set(e.boundaries.map(n=>n.name)),s=[];for(let[n,a]of Object.entries(o))if(c.has(n))for(let l of a)!c.has(l)||t.has(F(n,l))||s.push({from:n,to:l});return s.sort((n,a)=>n.from.localeCompare(a.from)||n.to.localeCompare(a.to))}function oe(e,r,t){let o=[],c=new Map;for(let s of r)c.set(s.from,(c.get(s.from)??0)+1);for(let s of e.boundaries){if(e.maxBoundaryFanOut!==void 0){let a=c.get(s.name)??0;a>e.maxBoundaryFanOut&&o.push({boundary:s.name,kind:"fan-out",observed:a,limit:e.maxBoundaryFanOut})}let n=s.maxFiles??e.maxBoundaryFiles;if(n!==void 0){let a=t.get(s.name)?.size??0;a>n&&o.push({boundary:s.name,kind:"files",observed:a,limit:n})}}return o.sort((s,n)=>s.boundary.localeCompare(n.boundary)||s.kind.localeCompare(n.kind))}function re(e){let r=P(e);return r==="test"||r==="entry"}function ne(e){let r=e.lastIndexOf("/");return r===-1?".":e.slice(0,r)}function F(e,r){return`${e}\0${r}`}function ie(e,r){return e.from.localeCompare(r.from)||e.to.localeCompare(r.to)}export{D as a,C as b,W as c,Fe as d,Ee as e,Se as f,ee as g};
2
- //# sourceMappingURL=chunk-GSP44ENC.js.map
@@ -1,2 +0,0 @@
1
- import{a as r,b as u}from"./chunk-H5EXS3HM.js";import{g as c}from"./chunk-KYSDI3GE.js";var g=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"],R=["entry-surface","generated-code","compatibility-shim","reflection-or-registration","test-fixture","intentional-twin","historical-coupling-ended","detector-counterexample"];var p=2,a=3;var d=new Set(g);function P(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(l){return{kind:"malformed",reason:`invalid JSON: ${C(l)}`}}if(!r(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let n=t.version;if(!Number.isInteger(n))return{kind:"malformed",reason:"version must be an integer"};if(n!==p&&n!==a)return{kind:"unsupported",version:n,direction:n<p?"older":"future"};let o=m(t,n);if(o)return{kind:"malformed",reason:o};let i=t,s={metadata:i,capabilities:f(i)};return n===p?{kind:"legacy",...s,metadata:i}:{kind:"supported",...s,metadata:i}}function L(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function j(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===a?t.sqliteLayoutVersion:void 0})}function f(e){let t=e.fingerprint!==void 0,n=r(e.fingerprint),o=e.indexedLanguages!==void 0,i=e.status==="complete",s=e.version===a?e:null;return{usableForQuery:o,usableForEvidenceCache:t,publishableGeneration:i&&n&&o,stableGenerationIdentity:i&&t&&typeof e.updatedAt=="string",languageShardReuse:!!s?.languageFingerprints,typescriptProjectShardReuse:!!s?.typescriptProjectShards}}function m(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!u(e.updatedAt))return"updatedAt must be a valid timestamp";for(let n of["requestedLanguages","indexedLanguages"])if(e[n]!==void 0&&!y(e[n]))return`${n} must contain unique supported languages`;return e.skipped!==void 0&&!b(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===a&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===a&&e.languageFingerprints!==void 0&&!x(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===a&&e.typescriptProjectShards!==void 0&&!S(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function v(e){return e.version===a&&e.sqliteLayoutVersion===1}function y(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&d.has(t))?!1:new Set(e).size===e.length}function b(e){return Array.isArray(e)&&e.every(t=>r(t)&&typeof t.language=="string"&&d.has(t.language)&&typeof t.reason=="string")}function x(e){return r(e)&&Object.entries(e).every(([t,n])=>d.has(t)&&r(n))}function S(e){return r(e)&&Object.values(e).every(t=>r(t)&&Array.isArray(t.files)&&t.files.every(c))}function C(e){return e instanceof Error?e.message:String(e)}export{g as a,R as b,a as c,P as d,L as e,j as f,f as g,v as h};
2
- //# sourceMappingURL=chunk-GUFSG5TX.js.map
@@ -1,2 +0,0 @@
1
- import{c as z,d as B,e as E}from"./chunk-BE7ZZTMC.js";import{a as O,b as G,c as M,d as J}from"./chunk-3AF4TUFK.js";import{b as Y,c as k}from"./chunk-FGA2U4OR.js";import{a as x}from"./chunk-B3PYOSCX.js";import{b as g}from"./chunk-H5EXS3HM.js";import{a as U,b as w,c as C,d as T}from"./chunk-JFMEXGFE.js";import{I as Q,M as D,j as _,k as m,l as K}from"./chunk-KYSDI3GE.js";import{h as I}from"./chunk-7F45LJKI.js";import{statSync as ve,watch as ge}from"fs";function He(e){let t=!1,r=!1,i,n=[],s=[...new Set(e)],c=new Map,a=u=>{try{return ve(u).mtimeMs}catch{return null}},o=()=>{for(let u of s)c.set(u,a(u))},d=()=>s.some(u=>a(u)!==c.get(u));o();let p=()=>{r=!0;let u=i;i=void 0,u?.()};for(let u of s)try{let v=ge(u,{persistent:!1},p);v.on("error",()=>{}),n.push(v)}catch{}return{wait(u){return t||u<=0?(r=!1,Promise.resolve()):new Promise(v=>{let Se=setTimeout(()=>{i===W&&(i=void 0),v()},u),W=()=>{clearTimeout(Se),i===W&&(i=void 0),v()};i=W,(r||t||d())&&(r=!1,o(),W())})},close(){if(!t){t=!0;for(let u of n)try{u.close()}catch{}n.length=0}p()}}}import{spawn as xe}from"child_process";import{existsSync as Oe,rmSync as ae}from"fs";import{dirname as at,resolve as V}from"path";import{fileURLToPath as ut}from"url";import{createHash as ye,randomUUID as L}from"crypto";import{existsSync as Re,linkSync as We,readdirSync as Ie,rmSync as S}from"fs";import{basename as we,dirname as ke,join as l}from"path";var h=1,Ee=10*6e4,be=10080*6e4,A="requests",y="claims",b="completions",Z="staging";function ze(e,t,r={}){let i=r.now?.()??new Date,n=qe(r.ttlMs),s=Ce(r.idempotencyKey),c=s?`key-${ye("sha256").update(s).digest("hex")}`:`request-${(r.randomId??L)()}`,a={version:h,requestId:c,...s?{idempotencyKey:s}:{},createdAt:i.toISOString(),deadlineAt:new Date(i.getTime()+n).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},o=se(e,c),d=$(e,o,a,r.onStage);if(d.published)return{disposition:"accepted",request:a,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let p=N(o);if(!p)throw new Error(`Watch refresh request identity ${c} exists but is malformed.`);return{disposition:"duplicate",request:p}}function Be(e,t={}){let r=t.now?.()??new Date,i=`claim-${(t.randomId??L)()}`,n=Math.max(1,Math.floor(t.limit??64)),s=re(e).sort(Te),c=[];for(let a of s){if(c.length>=n)break;if(X(e,a.requestId))continue;if(Date.parse(a.deadlineAt)<=r.getTime()){te(e,{version:h,requestId:a.requestId,outcome:"expired",completedAt:r.toISOString()});continue}let o={version:h,requestId:a.requestId,claimId:i,claimedAt:r.toISOString()};if($(e,oe(e,a.requestId),o).published){if(X(e,a.requestId)){ie(e,a.requestId,i);continue}c.push(a)}}return{claimId:i,requests:c}}function Xe(e,t,r=()=>new Date,i){let n=r().toISOString();for(let s of t.requests)te(e,{version:h,requestId:s.requestId,claimId:t.claimId,outcome:"completed",completedAt:n});i?.("after-completion"),Ae(e,t),i?.("after-claim-release")}function Ae(e,t){for(let r of t.requests)ie(e,r.requestId,t.claimId)}function Ze(e){let t=0;for(let r of f(l(e,y)))S(r,{force:!0}),t++;return t>0&&m(l(e,y)),ne(e),t}function et(e){let t=re(e),r=new Map,i=Pe(l(e,A),N);for(let o of f(l(e,b))){let d=P(o);if(!d){i++;continue}r.set(d.requestId,d)}let n=new Set;for(let o of f(l(e,y))){let d=ee(o);if(!d){i++;continue}n.add(d.requestId)}let s=t.filter(o=>!r.has(o.requestId)&&!n.has(o.requestId)),c=[...r.values()].filter(o=>o.outcome==="completed").length,a=[...r.values()].filter(o=>o.outcome==="expired").length;return{pending:s.length,claimed:t.filter(o=>!r.has(o.requestId)&&n.has(o.requestId)).length,completed:c,expired:a,invalid:i,...s.length>0?{oldestPendingAt:s.map(o=>o.createdAt).reduce((o,d)=>_e(o,d))}:{}}}function tt(e,t={}){let r=(t.now?.()??new Date).getTime(),i=Math.max(0,t.retentionMs??be),n=0;for(let s of f(l(e,b))){let c=P(s);!c||r-Date.parse(c.completedAt)<i||(S(s,{force:!0}),S(se(e,c.requestId),{force:!0}),n++)}return n>0&&(m(l(e,b)),m(l(e,A))),ne(e),n}function N(e){return F(e,t=>{let r=t;return r.version===h&&R(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&g(r.createdAt)&&g(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function ee(e){return F(e,t=>{let r=t;return r.version===h&&R(r.requestId)&&R(r.claimId)&&g(r.claimedAt)})}function P(e){return F(e,t=>{let r=t;return r.version===h&&R(r.requestId)&&(r.claimId===void 0||R(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&g(r.completedAt)})}function te(e,t){let r=ce(e,t.requestId);if($(e,r,t).published)return;let i=P(r);if(!i||i.requestId!==t.requestId||i.outcome!==t.outcome)throw new Error(`Watch refresh completion ${t.requestId} conflicts with an existing record.`)}function $(e,t,r,i){let n=l(e,Z),s=ke(t),c=_(n),a=_(s),o=l(n,`${we(t)}.${process.pid}.${L()}.tmp`);try{let d=k(o,r,{spacing:2,trailingNewline:!0});i?.("after-staged");try{We(o,t)}catch(u){if(u.code==="EEXIST")return{published:!1};throw u}let p=K(c,a,d.directorySync,m(s));return i?.("after-published"),{published:!0,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}finally{S(o,{force:!0})}}function re(e){let t=[];for(let r of f(l(e,A))){let i=N(r);i&&t.push(i)}return t}function ie(e,t,r){let i=oe(e,t),n=ee(i);!n||n.claimId!==r||(S(i,{force:!0}),m(l(e,y)))}function ne(e){for(let t of f(l(e,Z),".tmp"))S(t,{force:!0})}function Pe(e,t){return f(e).filter(r=>!t(r)).length}function f(e,t=".json"){return Re(e)?Ie(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(t)).map(r=>l(e,r.name)).sort():[]}function F(e,t){try{let r=JSON.parse(I(e,"watch refresh request record"));return t(r)?r:null}catch{return null}}function se(e,t){return l(e,A,`${t}.json`)}function oe(e,t){return l(e,y,`${t}.json`)}function ce(e,t){return l(e,b,`${t}.json`)}function X(e,t){return P(ce(e,t))!==null}function qe(e){if(e===void 0)return Ee;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function Ce(e){let t=e?.trim();return t?t.slice(0,512):void 0}function R(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function Te(e,t){return Date.parse(e.createdAt)-Date.parse(t.createdAt)||e.requestId.localeCompare(t.requestId)}function _e(e,t){return Date.parse(t)<Date.parse(e)?t:e}var Me=6e3,De=1e3,de=10;function yt(e,t,r){let i=D(V(e));if(r&&D(r.projectRoot)===i)return{projectRoot:i,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:t};let n=Q(i);if(n.kind==="error")throw new Error(`Could not establish Git worktree identity for ${i}: ${n.message}`);return n.kind==="non-git"?{projectRoot:i,worktreeKind:"non-git",cliVersion:t}:{projectRoot:i,worktreeKind:"git",worktreeId:n.identity.worktreeId,cliVersion:t}}function Rt(e){let t=e.runtime??$e,r=z(e.cacheDir),i=B(r.statePath),n=i?le(i,t)?{kind:"live",state:i}:{kind:"stale",state:i,reason:"dead-process"}:{kind:"stopped"},s=Le("stop",n);if(s.kind==="signal-stop")return ue(s.state,e,t),H(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};if(s.kind==="clean-stale")return H(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};let c=he(r.lockPath);return s.kind==="already-stopped"&&c?(le(c,t)&&ue(c,e,t),H(r,c.pid,t),{disposition:"stopped",pid:c.pid}):{disposition:"already-stopped"}}function Wt(e,t,r={}){let{durability:i="durable",...n}=r;i==="durable"?k(e,t,n):Y(e,t,n)}function It(e){try{let t=JSON.parse(I(e,"watch activity record"));return t.version!==1||!E(t.at)||t.refreshRequestedAt!==void 0&&!E(t.refreshRequestedAt)||t.refreshDetail!==void 0&&typeof t.refreshDetail!="string"?null:{atMs:Date.parse(t.at),...t.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(t.refreshRequestedAt)},...t.refreshDetail===void 0?{}:{refreshDetail:t.refreshDetail}}}catch{return null}}function wt(e,t,r={}){let i=r.pid??process.pid,n=r.isProcessAlive??x,s=()=>{},c=r.readProcessIdentity??C,a=r.now??(()=>new Date),o={...O,wallNow:()=>a().getTime(),isProcessAlive:n,readProcessIdentity:c},d=G(e,{kind:"watch",pid:i,processIdentity:c(i),detail:{projectRoot:V(t)},parseLegacy:q,runtime:o});if(d.kind==="contended"){let p=fe(d.observation);return{acquired:!1,lockPath:e,message:Ne(e,t,p),release:s}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function he(e){return fe(M(e,{parseLegacy:q}))}var q=e=>{let t=me(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function fe(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 me(e.parsed)}function me(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!E(t.startedAt))return null;let r=t.processIdentity===void 0?null:U(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 Le(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 j(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 j(t)}default:return j(e)}}function kt(e){return e.idleTimeoutMs===0||e.watcher.state!=="idle"?!1:e.nowMs-e.lastActivityAtMs>=e.idleTimeoutMs}function ue(e,t,r){let{pid:i}=e;if(!r.isProcessAlive(i))return;pe(e,r),r.signalProcess(i);let n=t.stopTimeoutMs??Me,s=r.monotonicNow??T,c=s()+n;for(;s()<=c;){if(!r.isProcessAlive(i))return;r.sleep(de)}if(!r.forceSignalProcess)throw new Error(`scip-query watch service pid ${i} did not stop within ${n}ms and forced termination is unavailable.`);pe(e,r),r.forceSignalProcess(i);let a=t.forceStopTimeoutMs??De,o=s()+a;for(;s()<=o;){if(!r.isProcessAlive(i))return;let d=r.readProcessIdentity(i);if(e.processIdentity&&d&&!w(e.processIdentity,d))return;r.sleep(de)}throw new Error(`scip-query watch service pid ${i} remained alive ${a}ms after forced termination.`)}function H(e,t,r){if(ae(e.statePath,{force:!0}),ae(e.activityPath,{force:!0}),he(e.lockPath)?.pid===t){let n={...O,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},s=M(e.lockPath,{parseLegacy:q,runtime:n});J(e.lockPath,s,{parseLegacy:q,runtime:n})}}function le(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||w(e.processIdentity,r)}function Ne(e,t,r){return`error: scip-query watch is already running for ${V(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}var $e={now:Date.now,monotonicNow:T,isProcessAlive:x,readProcessIdentity:C,spawnServer(e,t,r,i){if(!Oe(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);xe(process.execPath,[e,t,r,JSON.stringify(i)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function pe(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 j(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}export{He as a,ze as b,Be as c,Xe as d,Ae as e,Ze as f,et as g,tt as h,yt as i,Rt as j,Wt as k,It as l,wt as m,kt as n};
2
- //# sourceMappingURL=chunk-GYIZ4NXB.js.map
@@ -1,2 +0,0 @@
1
- import{a as T,b as $}from"./chunk-XDAUYDFT.js";import{b as k}from"./chunk-YWO5DDRC.js";import{d as f}from"./chunk-BOJ5SVE2.js";import{d as j}from"./chunk-N2ZSIIGR.js";var y=["execution","runtime","dataflow","state","temporal","contract","identity","ownership","dependencies"];import{createHash as Y}from"crypto";var Ce=["causal","structure","complete"],Q={causal:["execution","runtime","dataflow","state","temporal"],structure:["contract","identity","ownership","dependencies"],complete:y},Z=2,ee=48,H=64,ne=5e4;function Fe(e,n,t={}){let a=f([...n.symbols??[],...n.locations??[]]),o=f(n.searches??[]);if(a.length===0&&o.length===0)throw new Error("evidence requires at least one positional symbol, --symbol, --at, or --search selector.");let r=t.view??"causal",i=te(t.families,r),s=t.direction??"both",g=f(t.subtypes??[]),l=t.connecting??!1,c=t.inventoryOnly??!1,p=f(t.foldIds??[]),u=t.maxDepth??Z,m=t.maxEdges??ee;if(!Number.isSafeInteger(u)||u<0)throw new RangeError(`Evidence depth must be a non-negative safe integer; received ${u}.`);if(!Number.isSafeInteger(m)||m<=0)throw new RangeError(`Evidence max edges must be a positive safe integer; received ${m}.`);if(!["incoming","outgoing","both"].includes(s))throw new Error(`Unsupported graph evidence direction: ${s}.`);if(c&&p.length>0)throw new Error("Evidence fold materialization cannot be combined with --inventory-only.");let h=k(e,{symbols:a,searches:o,maxDepth:u,maxTopologyCharacters:ne,relations:oe(i)}),w=new Map(h.nodes.map(d=>[d.id,d])),v=h.edges.filter(d=>d.disposition==="emitted"||d.disposition==="folded").flatMap(d=>re(d,w)),E=v.filter(d=>i.includes(d.family)).filter(d=>g.length===0||g.includes(d.subtype)),b=new Set(h.anchors.flatMap(d=>d.nodeIds));if(l&&b.size<2)throw new Error("Connecting evidence requires at least two resolved root nodes.");let S=new Set(E.map(d=>d.id)),P=F(v,b,"incoming").filter(d=>S.has(d.id)),_=F(v,b,"outgoing").filter(d=>S.has(d.id)),O=F(v,b,"both").filter(d=>S.has(d.id)),U=de(i,g,P,_,O),A=s==="incoming"?P:s==="outgoing"?_:O,N=l?Ee(A,[...b],s):A,K=ye(N,b,s),G=[...N].sort((d,X)=>ve(d,X,K)),D=le(G,m),z=ge(D,p),x=c?[]:p.length>0?G.filter(d=>z.has(d.id)):G,I=p.length>0?x:x.slice(0,m),B=p.length>0||c?[]:D,R=Math.max(0,x.length-I.length),J=h.frontiers.filter(d=>d.disposition==="unsupported").length,C=h.coverage.status==="incomplete"?"incomplete":R>0?"bounded":"accounted";return{kind:"graph",view:t.families&&t.families.length>0?"custom":r,families:i,selection:{direction:s,subtypes:g,connecting:l,inventoryOnly:c,foldIds:p},targets:h.anchors.map(d=>({kind:d.kind,query:d.query,status:d.status,nodeIds:[...d.nodeIds],omittedCandidates:d.omittedCandidates})),inventory:U,edges:I,folds:B,coverage:{status:C,topologyStatus:h.coverage.status,scope:h.coverage.scope,maxDepth:u,maxEdges:m,matchedEdges:G.length,eligibleEdges:x.length,returnedEdges:I.length,omittedEdges:R,frontierGroups:h.frontiers.length,unsupportedFrontiers:J,blindSpots:f([...h.coverage.blindSpots,...T(i)]),explanation:c?`${G.length} relationship(s) match the explicit projection; only exact inventory counts were requested.`:p.length>0?`Every relationship in ${p.length} explicitly selected recoverable fold(s) was emitted.`:C==="accounted"?"Every selected relationship in the bounded topology was emitted.":C==="bounded"?`${R} selected relationship(s) were withheld by the explicit edge budget.`:h.coverage.explanation}}}function te(e,n){let t=e&&e.length>0?e:Q[n],a=t.filter(o=>!y.includes(o));if(a.length>0)throw new Error(`Unsupported graph evidence family: ${a.join(", ")}.`);return f(t)}function oe(e){return["call","contract-symbol","import","reference","runtime-boundary"]}function re(e,n){let t=n.get(e.fromNodeId),a=n.get(e.toNodeId);return!t||!a?[]:(e.semantics??[]).flatMap((o,r)=>{let i=se(o);if(!i)return[];let s=$(i,o.subtype);if(!s)throw new Error(`No graph relation provider contract is registered for ${i}/${o.subtype}.`);let g=ce(e);return s.relation.evidenceStrengths.includes(g)?[{id:`${e.id}:${r}:${i}`,family:i,semanticFamily:o.family,subtype:o.subtype,from:V(t),to:V(a),sourceKind:e.kind,providerId:s.provider.id,supportCeiling:s.relation.supportCeiling,establishes:s.relation.establishes,nonClaims:[...s.relation.nonClaims],recoverWith:[...s.relation.recoverWith],evidenceStrength:g,evidenceMethods:f(e.evidence.map(l=>l.method)),evidenceConstituents:ie(e.evidence),context:o.context?{...o.context}:null,attributes:o.attributes?{...o.attributes}:null}]:[]})}function ie(e){let n=new Map;for(let t of e)n.set(`${t.method}\0${t.strength}`,t);return[...n.values()].map(({method:t,strength:a})=>({method:t,strength:a}))}function se(e){switch(e.family){case"control":return e.context?.crossesRuntimeBoundary===!0||e.subtype==="runtime-handoff"?"runtime":"execution";case"data":return"dataflow";case"state":return"state";case"temporal":return"temporal";case"contract":return"contract";case"identity":return e.subtype.startsWith("contains")||e.subtype.startsWith("owns-")?"ownership":e.subtype.startsWith("import")?"dependencies":"identity"}}function V(e){let n=ae(e);return{id:e.id,kind:e.kind,label:n?j(n):e.label,symbol:n,location:e.location?{...e.location}:null}}function ae(e){return e.kind!=="symbol"||!e.id.startsWith("symbol:")?null:decodeURIComponent(e.id.slice(7))}function ce(e){let n=f(e.evidence.map(t=>t.strength));return n.length===1?n[0]:n.includes("exact")&&n.every(t=>t==="exact"||t==="derived")?"mixed":n.includes("candidate")?"candidate":n.includes("unknown")||n.length===0?"unknown":"mixed"}function F(e,n,t){let a=M(e,t),o=new Map,r=new Map,i=[...n].sort();for(let s of i)r.set(s,0);for(let s=0;s<i.length;s+=1){let g=i[s],l=r.get(g);for(let c of a.get(g)??[])o.set(c.edge.id,c.edge),!r.has(c.next)&&(r.set(c.next,l+1),i.push(c.next))}return[...o.values()]}function M(e,n){let t=new Map,a=(o,r,i)=>{let s=t.get(o)??[];s.push({edge:i,next:r}),t.set(o,s)};for(let o of e)n!=="incoming"&&a(o.from.id,o.to.id,o),n!=="outgoing"&&a(o.to.id,o.from.id,o);for(let o of t.values())o.sort((r,i)=>r.edge.id.localeCompare(i.edge.id)||r.next.localeCompare(i.next));return t}function de(e,n,t,a,o){let r=new Set;for(let c of[...t,...a,...o])r.add(`${c.family}\0${c.subtype}`);if(n.length>0)for(let c of e)for(let p of n)r.add(`${c}\0${p}`);let i=c=>{let p=new Map;for(let u of c){let m=`${u.family}\0${u.subtype}`;p.set(m,(p.get(m)??0)+1)}return p},s=i(t),g=i(a),l=i(o);return[...r].map(c=>{let[p,u]=c.split("\0");return{family:p,subtype:u,incoming:s.get(c)??0,outgoing:g.get(c)??0,both:l.get(c)??0}}).sort((c,p)=>y.indexOf(c.family)-y.indexOf(p.family)||c.subtype.localeCompare(p.subtype))}function le(e,n){let t=e.slice(n),a=new Map;for(let i of t){let s=pe(i),g=`${i.family}\0${s}`,l=a.get(g)??[];l.push(i),a.set(g,l)}let o=new Map(e.map((i,s)=>[i.id,s+1])),r=[];for(let[i,s]of[...a].sort(([g],[l])=>g.localeCompare(l))){let[g,l]=i.split("\0"),c=[...s].sort((p,u)=>p.id.localeCompare(u.id));for(let p=0;p<c.length;p+=H){let u=c.slice(p,p+H),m=u.map(E=>E.id),h=f(u.map(E=>E.subtype)).sort(),w=h.length===1?h[0]:"mixed",v=[...new Set(u.flatMap(E=>[E.from.id,E.to.id]))].sort();r.push({id:me(g,h.join("\0"),m),mode:ue(u),family:g,subtype:w,subtypes:h,region:l,edgeCount:m.length,edgeIds:m,nodeIds:v,minimumMaxEdges:Math.max(...m.map(E=>o.get(E)??e.length))})}}return r.sort((i,s)=>y.indexOf(i.family)-y.indexOf(s.family)||(i.region??"").localeCompare(s.region??"")||i.id.localeCompare(s.id))}function pe(e){let n=e.from.location?.file??`kind:${e.from.kind}`,t=e.to.location?.file??`kind:${e.to.kind}`;return n===t?n:`${n} -> ${t}`}function ge(e,n){if(n.length===0)return new Set;let t=new Map(e.map(o=>[o.id,o])),a=n.filter(o=>!t.has(o));if(a.length>0){let o=e.map(r=>r.id).sort();throw new Error(`Unknown evidence fold ${a.join(", ")} for this projection. Available folds: ${o.join(", ")||"(none)"}.`)}return new Set(n.flatMap(o=>t.get(o).edgeIds))}function ue(e){let n=new Map,t=new Map,a=new Set;for(let r of e){a.add(r.from.id),a.add(r.to.id);let i=n.get(r.from.id)??new Set;i.add(r.to.id),n.set(r.from.id,i);let s=t.get(r.to.id)??new Set;s.add(r.from.id),t.set(r.to.id,s)}return he(a,n)?"scc":[...a].every(r=>(t.get(r)?.size??0)<=1&&(n.get(r)?.size??0)<=1)?"linear":"topology"}function he(e,n){let t=new Set,a=new Set,o=r=>{if(t.has(r))return!0;if(a.has(r))return!1;t.add(r);for(let i of n.get(r)??[])if(o(i))return!0;return t.delete(r),a.add(r),!1};return[...e].some(o)}function me(e,n,t){return`fold:${Y("sha256").update([e,n,...t].join("\0")).digest("hex").slice(0,16)}`}function Ee(e,n,t){let a=new Map,o=[...new Set(n)].sort();for(let r=0;r<o.length;r+=1)for(let i=r+1;i<o.length;i+=1)for(let s of fe(e,o[r],o[i],t))a.set(s.id,s);return[...a.values()]}function fe(e,n,t,a){let o=M(e,a),r=new Map([[n,0]]),i=new Map,s=[n];for(let l=0;l<s.length;l+=1){let c=s[l],p=r.get(c);if(c!==t)for(let u of o.get(c)??[])r.has(u.next)||(r.set(u.next,p+1),i.set(u.next,{node:c,edge:u.edge}),s.push(u.next))}if(!r.has(t))return[];let g=[];for(let l=t;l!==n;){let c=i.get(l);if(!c)return[];g.push(c.edge),l=c.node}return g.reverse()}function ye(e,n,t){let a=M(e,t),o=new Map,r=[...n];for(let i of n)o.set(i,0);for(let i=0;i<r.length;i+=1){let s=r[i],g=o.get(s);for(let{next:l}of a.get(s)??[])o.has(l)||(o.set(l,g+1),r.push(l))}return o}function ve(e,n,t){return L(e,t)-L(n,t)||q(e)-q(n)||W(e.evidenceStrength)-W(n.evidenceStrength)||y.indexOf(e.family)-y.indexOf(n.family)||e.from.label.localeCompare(n.from.label)||e.to.label.localeCompare(n.to.label)||e.subtype.localeCompare(n.subtype)||e.id.localeCompare(n.id)}function L(e,n){return Math.min(n.get(e.from.id)??Number.MAX_SAFE_INTEGER,n.get(e.to.id)??Number.MAX_SAFE_INTEGER)}function q(e){let n=[e.from,e.to].filter(t=>t.kind==="structural-region").length;return n===2?2:n}function W(e){switch(e){case"exact":return 0;case"mixed":return 1;case"derived":return 2;case"candidate":return 3;case"unknown":return 4}}export{y as a,Ce as b,Fe as c};
2
- //# sourceMappingURL=chunk-GZIUDL6G.js.map
@@ -1,2 +0,0 @@
1
- function e(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function i(n){return typeof n=="string"&&Number.isFinite(Date.parse(n))}function o(n){return e(n)&&Object.values(n).every(t=>typeof t=="string"||t===null)}function s(n){return typeof n=="string"&&n.length>0}function u(n){return typeof n=="number"&&Number.isSafeInteger(n)&&n>=0}function g(n){return typeof n=="number"&&Number.isSafeInteger(n)&&n>0}var r=/^[a-f0-9]{64}$/u;function f(n){return typeof n=="string"&&r.test(n)}function p(n){return typeof n=="string"&&n.length>0&&n.length<=256&&!/[\0\r\n]/u.test(n)}function c(n){return typeof n=="number"&&Number.isFinite(n)&&n>=0}export{e as a,i as b,o as c,s as d,u as e,g as f,f as g,p as h,c as i};
2
- //# sourceMappingURL=chunk-H5EXS3HM.js.map
@@ -1,18 +0,0 @@
1
- import{a as U}from"./chunk-QOKYJ33H.js";import{a as $,c as W}from"./chunk-CJZXN4NU.js";import{d as z,i as G}from"./chunk-NWQXSFFU.js";import{d as j,g as S,i as O}from"./chunk-N2ZSIIGR.js";import{D as k}from"./chunk-ZOHS7AQV.js";import{Aa as A,Y as R,f as _}from"./chunk-N5B2NILC.js";import{execFileSync as g}from"child_process";import{existsSync as se}from"fs";import{basename as q}from"path";var ae="Unable to compute git diff.",re={semanticConsumers:G,sourceFallbackConsumers:$,semanticReadiness:z},I={resolveCommit:R,readBatch({projectRoot:e,resolvedBase:i,relativePaths:t}){let n=t.map(a=>`${i}:./${a}
2
- `).join("");return g("git",["cat-file","--batch"],{cwd:e,input:n,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]})}};function Ye(e,i={}){let t=i.plan??oe(e,i);return t.note?de(t.note,t.changedFileLines):t.changedFiles.length===0?ue(t.changedFileLines):le(t.changedFiles,[ce(e,t.changedFiles,t.changedFiles,t.changedRanges)])}function oe(e,i={}){let{base:t="HEAD"}=i;try{let n=R(e.config.projectRoot,t),a=fe(e.config.projectRoot,n),s=a.changedFileLines,r=Re(e,s),o=Se(e,a.changedRanges);return{changedFileLines:s,changedFiles:r,changedRanges:o,renamedFiles:he(e.config.projectRoot,n,r,a),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:ae}}}function ce(e,i,t,n=[],a={}){let s=a.evidenceRuntime??re,r=new W(e),o=new Set(t),l=U(n),u=[],d=new Map,c=i.flatMap(f=>r.definitionsForFile(f)).filter(Ae),m=c.filter(f=>ve(f,l)),p=Le(e,c,m,l),y=xe([...m,...p.definitions]).sort((f,b)=>f.relativePath.localeCompare(b.relativePath)||f.startLine-b.startLine),B=y.map(f=>f.symbolId),w=Te(e,B),ne=Ne(e,B,t),h=y.filter(f=>(w.get(f.symbolId)??0)===0),M=h.length>0?s.semanticReadiness?.(e)??{ready:!0}:{ready:!0},P=M.ready?Z("semantic-consumers",h.length,()=>s.semanticConsumers(e,h)):{values:new Map,status:{tier:"semantic-consumers",state:"failed",attemptedSymbols:h.length,reason:M.reason}},E=P.values,T=h.filter(f=>(E.get(f.symbolId)?.size??0)===0),N=Z("source-fallback-consumers",T.length,()=>s.sourceFallbackConsumers(e,T)),ie=N.values;for(let f of y)Me(e,f,o,u,d,E.get(f.symbolId)??new Set,ie.get(f.symbolId)??new Set,w.get(f.symbolId)??0,ne.get(f.symbolId)??new Set);return{changedSymbols:u,consumerEntries:[...d.entries()].map(([f,b])=>({file:f,symbols:[...b].sort()})),attributionNotes:p.notes,evidenceTiers:[P.status,N.status]}}function le(e,i){let t=new Map,n=i.flatMap(o=>o.changedSymbols),a=i.flatMap(o=>o.attributionNotes??[]),s=Pe(i);for(let o of i)for(let l of o.consumerEntries){let u=t.get(l.file);u||(u=new Set,t.set(l.file,u));for(let d of l.symbols)u.add(d)}let r=_e(t);return{changedFiles:[...e],changedSymbols:n,affectedConsumers:r,attributionNotes:a,evidenceTiers:s,summary:{totalChangedFiles:e.length,totalChangedSymbols:n.length,totalAffectedFiles:r.length}}}function de(e,i=[]){return{changedFiles:i,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:te(),summary:{totalChangedFiles:i.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function ue(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:te(),summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function fe(e,i){let t=g("git",["diff","--name-status","--find-renames",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),n=g("git",["diff","--name-status","--find-renames","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),a=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),s=g("git",["diff","--unified=0",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),r=g("git",["diff","--unified=0","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),o=be([t,n]);return{changedFileLines:[...new Set([...o.changedFiles,...K(a)])],changedRanges:X([...J(s),...J(r)]),renamedFiles:o.renamedFiles,deletedFiles:o.deletedFiles}}function me(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePath:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||typeof n.relativePath!="string")throw new TypeError("fileContentAtBase requires projectRoot, base, and relativePath.");let a={projectRoot:n.projectRoot,base:n.base,relativePath:n.relativePath},{relativePath:s}=a,r=V(a);if(r.state==="unavailable")throw new Error(`Base content unavailable for ${s}: ${r.reason}`);return r.state==="present"?r.content:null}function V(e,i=I){return Y(e.relativePath),F({projectRoot:e.projectRoot,base:e.base,relativePaths:[e.relativePath]},i).get(e.relativePath)??{state:"unavailable",reason:`Base-content lookup omitted ${e.relativePath}.`}}function F(e,i=I){for(let r of e.relativePaths)Y(r);let t=[...new Set(e.relativePaths)];if(t.length===0)return new Map;let n;try{n=i.resolveCommit(e.projectRoot,e.base)}catch(r){return C(t,v(r))}let a;try{a=i.readBatch({projectRoot:e.projectRoot,resolvedBase:n,relativePaths:t})}catch(r){return C(t,v(r))}let s;try{s=pe(a,t)}catch(r){return C(t,`Malformed git cat-file batch output: ${v(r)}`)}return new Map(t.map(r=>{let o=s.get(r)??null;return[r,o===null?{state:"absent"}:{state:"present",content:o}]}))}function ge(e,i=I){let t=F({projectRoot:e.projectRoot,base:e.base,relativePaths:e.preloadPaths??[]},i);return n=>(t.has(n)||t.set(n,V({projectRoot:e.projectRoot,base:e.base,relativePath:n},i)),t.get(n)??{state:"unavailable",reason:`Base-content reader omitted ${n}.`})}function Ke(e,i,t=[]){let n=typeof e=="string"?{projectRoot:e,base:i,preloadPaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string")throw new TypeError("createBaseContentReader requires projectRoot and base.");let a={projectRoot:n.projectRoot,base:n.base,preloadPaths:n.preloadPaths},s=ge(a);return r=>{let o=s(r);if(o.state==="unavailable")throw new Error(`Base content unavailable for ${r}: ${o.reason}`);return o.state==="present"?o.content:null}}function Qe(e,i=e.changedFiles){let t=new Map(e.renamedFiles.map(n=>[n.to,n.from]));return[...new Set(i.map(n=>t.get(n)??n))]}function Xe(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||!Array.isArray(n.relativePaths))throw new TypeError("fileContentsAtBase requires projectRoot, base, and relativePaths.");let a=F(n),s=new Map;for(let[r,o]of a){if(o.state==="unavailable")throw new Error(`Base content unavailable for ${r}: ${o.reason}`);s.set(r,o.state==="present"?o.content:null)}return s}function Y(e){_(e)}function C(e,i){return new Map(e.map(t=>[t,{state:"unavailable",reason:i}]))}function v(e){let t=(e instanceof Error?e.message:String(e)).replaceAll(/\s+/g," ").trim().slice(0,500);return t===""?"Git base-content lookup failed without a reason.":t}function pe(e,i){let t=new Map,n=0;for(let a of i){let s=e.indexOf(10,n);if(s<0)throw new Error("git cat-file batch output ended before object header");let r=e.subarray(n,s).toString("utf-8");if(n=s+1,r.endsWith(" missing")){t.set(a,null);continue}let o=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(r);if(!o)throw new Error(`unexpected git cat-file batch header: ${r}`);let[,l,u]=o,d=Number(u);if(!Number.isFinite(d)||d<0)throw new Error(`unexpected git cat-file batch size: ${r}`);if(n+d>e.length)throw new Error("git cat-file batch output ended before blob payload");let c=e.subarray(n,n+d);t.set(a,l==="blob"?c.toString("utf-8"):null),n+=d,e[n]===10&&(n+=1)}return t}function he(e,i,t,n){if(t.length===0)return[];let a=new Map,s=new Set;for(let o of n.renamedFiles)t.includes(o.to)&&(a.set(o.to,o),s.add(o.from));let r=n.deletedFiles;if(r.length===0)return[...a.values()].sort((o,l)=>o.to.localeCompare(l.to));for(let o of t){if(a.has(o)||!se(`${e}/${o}`))continue;let l=r.filter(c=>!s.has(c)).filter(c=>q(c)===q(o));if(l.length===0)continue;let u=A(e,o),d=l.map(c=>({from:c,to:o,similarity:ye(me({projectRoot:e,base:i,relativePath:c})??"",u)})).sort((c,m)=>m.similarity-c.similarity)[0];d&&d.similarity>=.45&&(a.set(o,d),s.add(d.from))}return[...a.values()].sort((o,l)=>o.to.localeCompare(l.to))}function be(e){let i=new Set,t=new Map,n=new Set;for(let a of e.flatMap(s=>K(s))){let[s,r,o]=a.split(" ");if(!(!s||!r)){if(s.startsWith("R")&&o){i.add(o),t.set(o,{from:r,to:o,similarity:Number(s.slice(1))/100});continue}i.add(r),s.startsWith("D")&&n.add(r)}}return{changedFiles:[...i],renamedFiles:[...t.values()],deletedFiles:[...n]}}function ye(e,i){let t=new Set(H(e)),n=new Set(H(i));if(t.size===0&&n.size===0)return 1;if(t.size===0||n.size===0)return 0;let a=0;for(let s of t)n.has(s)&&(a+=1);return 2*a/(t.size+n.size)}function H(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function K(e){return e.split(`
3
- `).map(i=>i.trim()).filter(i=>i.length>0)}function Re(e,i){let t=Q(e),n=[];for(let a of i){let s=t(a);s&&!e.isIgnored(s)&&n.push(s)}return n}function Se(e,i){let t=Q(e),n=[];for(let a of i){let s=t(a.file);s&&!e.isIgnored(s)&&n.push({...a,file:s})}return X(n)}function Q(e){let i=e.all(`SELECT relative_path FROM documents
4
- ORDER BY id`).map(n=>n.relative_path),t=new Map(i.map(n=>[n,n]));return n=>{let a=n.replace(/\\/g,"/"),s=t.get(a);return s||(i.find(r=>r.endsWith(a))??null)}}function J(e){let i=[],t=null;for(let n of e.split(`
5
- `)){if(n.startsWith("+++ ")){t=Ce(n.slice(4).trim());continue}if(!t||!n.startsWith("@@ "))continue;let a=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(n);if(!a)continue;let s=Math.max(0,Number(a[1])-1),r=a[2]===void 0?1:Number(a[2]);i.push({file:t,startLine:s,endLine:Math.max(s,s+Math.max(r,1)-1)})}return i}function Ce(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function X(e){let i=new Set,t=[];for(let n of e){let a=`${n.file}:${n.startLine}:${n.endLine}`;i.has(a)||(i.add(a),t.push(n))}return t}function ve(e,i){let t=i.get(e.relativePath);return!t||t.length===0?!0:t.some(n=>x(e.startLine,e.endLine,n.startLine,n.endLine))}function De(e,i,t){let n=new Map,a=[],s=ee(e),r=Be(t);for(let o of i){let l=s.get(o.file)??[];if(l.some(c=>x(c.startLine,c.endLine,o.startLine,o.endLine)))continue;let u=r.get(o.file)??[],d=we(u,o);if(d){let c=l.find(m=>m.startLine>=d.startLine&&m.startLine<=d.endLine);if(c){n.set(c.symbolId,c),a.push(D(o,"ast-widened"));continue}}if(u.length===0){let c=[...l].filter(m=>m.startLine<=o.startLine).sort((m,p)=>p.startLine-m.startLine||m.endLine-p.endLine)[0];if(c){n.set(c.symbolId,c),a.push(D(o,"nearest-preceding"));continue}}a.push(D(o,"unattributed"))}return{definitions:[...n.values()],notes:a}}function Le(e,i,t,n){let a=ee(t),s=[],r=[],o=[...new Set(i.map(l=>l.relativePath))];for(let l of o){let u=n.get(l)??[];if(u.length===0)continue;let d=a.get(l)??[];for(let c of u)d.some(m=>x(m.startLine,m.endLine,c.startLine,c.endLine))||s.push(c);s.some(c=>c.file===l)&&r.push(...Ie(e,l))}return De(i,s,r)}function Ie(e,i){let t=k(e,i);return t?t.rootNode.namedChildren.filter(Fe).map(n=>({file:i,startLine:n.startPosition.row,endLine:n.endPosition.row})).filter(n=>n.endLine>=n.startLine):[]}function Fe(e){return e.endPosition.row<e.startPosition.row?!1:!new Set(["import_statement","comment"]).has(e.type)}function xe(e){let i=new Map;for(let t of e)i.set(t.symbolId,t);return[...i.values()]}function ee(e){let i=new Map;for(let t of e){let n=i.get(t.relativePath)??[];n.push(t),i.set(t.relativePath,n)}return i}function Be(e){let i=new Map;for(let t of e){let n=i.get(t.file)??[];n.push(t),i.set(t.file,n)}return i}function we(e,i){return e.filter(t=>t.startLine<=i.startLine&&t.endLine>=i.endLine).sort((t,n)=>t.endLine-t.startLine-(n.endLine-n.startLine))[0]}function D(e,i){return{file:e.file,startLine:e.startLine,endLine:e.endLine,method:i}}function x(e,i,t,n){return e<=n&&t<=i}function Me(e,i,t,n,a,s,r,o,l){let u=Math.max(o,s.size,r.size);if(!ke(i,u))return;let d=j(i.symbol);n.push({symbol:i.symbol,shortName:d,file:i.relativePath,startLine:i.startLine,endLine:i.endLine,fanIn:u});for(let c of l)L(e,t,a,c,d);for(let c of s)L(e,t,a,c,d);for(let c of r)L(e,t,a,c,d)}function Z(e,i,t){try{return{values:t(),status:{tier:e,state:"complete",attemptedSymbols:i}}}catch(n){return{values:new Map,status:{tier:e,state:"failed",attemptedSymbols:i,reason:Ee(n)}}}}function Pe(e){return["semantic-consumers","source-fallback-consumers"].map(i=>{let t=e.map(s=>s.evidenceTiers?.find(r=>r.tier===i)??{tier:i,state:"failed",attemptedSymbols:0,reason:"isolated diff-impact batch omitted its evidence-tier status"}),n=t.reduce((s,r)=>s+r.attemptedSymbols,0),a=[...new Set(t.filter(s=>s.state==="failed").map(s=>s.reason))];return a.length===0?{tier:i,state:"complete",attemptedSymbols:n}:{tier:i,state:"failed",attemptedSymbols:n,reason:a.join("; ").slice(0,500)}})}function te(){return[{tier:"semantic-consumers",state:"complete",attemptedSymbols:0},{tier:"source-fallback-consumers",state:"complete",attemptedSymbols:0}]}function Ee(e){let t=(e instanceof Error?e.message:String(e)).replaceAll(/\s+/g," ").trim().slice(0,500);return t===""?"evidence provider failed without a reason":t}function Te(e,i){if(i.length===0)return new Map;let t=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
6
- FROM mentions m
7
- JOIN chunks c ON m.chunk_id = c.id
8
- WHERE m.symbol_id IN (${i.map(()=>"?").join(",")})
9
- AND m.role != 1
10
- GROUP BY m.symbol_id`,...i);return new Map(t.map(n=>[n.symbol_id,n.fan_in]))}function Ne(e,i,t){if(i.length===0||t.length===0)return new Map;let n=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
11
- FROM mentions m
12
- JOIN chunks c ON m.chunk_id = c.id
13
- JOIN documents ref_d ON c.document_id = ref_d.id
14
- WHERE m.symbol_id IN (${i.map(()=>"?").join(",")})
15
- AND m.role != 1
16
- AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
17
- ${e.pathExclusionsFor("ref_d")}`,...i,...t),a=new Map;for(let s of n){let r=a.get(s.symbol_id);r||(r=new Set,a.set(s.symbol_id,r)),r.add(s.relative_path)}return a}function L(e,i,t,n,a){if(e.isIgnored(n)||i.has(n))return;let s=t.get(n);s||(s=new Set,t.set(n,s)),s.add(a)}function _e(e){return[...e.entries()].map(([i,t])=>({file:i,consumedSymbols:t.size})).sort((i,t)=>t.consumedSymbols-i.consumedSymbols)}function Ae(e){return!(O(e.symbol)||e.parentTypeName!==null&&!S(e.symbol))}function ke(e,i){return S(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&i>0}export{ae as a,Ye as b,oe as c,ce as d,le as e,me as f,V as g,F as h,ge as i,Ke as j,Qe as k,Xe as l,De as m};
18
- //# sourceMappingURL=chunk-HCXEQRFF.js.map
@@ -1,2 +0,0 @@
1
- import{c as L}from"./chunk-BRV7PIFF.js";import{m as h,y as p}from"./chunk-N2ZSIIGR.js";import{h as f,j as g}from"./chunk-FESCRNVV.js";function z(o,b){let s=L(o,b);if(!s)return[];let i=p(o,[s],{sort:!0});if(i.length===0)return[];let y=Math.max(0,g(f(o,s)).length-1),r=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:Math.min(e.endLine,y),signature:e.signature,children:[]})),l=new Map;for(let e of r)l.set(e.symbol,e);let m=[];for(let e=0;e<i.length;e++){let a=i[e],n=r[e];if(a.enclosingSymbol&&l.has(a.enclosingSymbol)){l.get(a.enclosingSymbol).children.push(n);continue}let c=null,u=1/0;for(let t of r)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!h(t.symbol,n.symbol))continue;let d=t.endLine-t.startLine;d<u&&(u=d,c=t)}c?c.children.push(n):m.push(n)}return m}export{z as a};
2
- //# sourceMappingURL=chunk-HEHOQQKH.js.map
@@ -1,4 +0,0 @@
1
- import{a as v,b as L,c as $,d as B}from"./chunk-HLZTEXRA.js";import{a as K}from"./chunk-WUN6KBHV.js";import{b as D,c as A}from"./chunk-CJZXN4NU.js";import{a as g}from"./chunk-BGBBVSH4.js";import{h as R}from"./chunk-XRYABF57.js";import{b as M}from"./chunk-NJITK2GP.js";import{b as k,d as F,e as b}from"./chunk-N2ZSIIGR.js";import{u as w}from"./chunk-ODDUPDP7.js";import{h as C}from"./chunk-FESCRNVV.js";function me(t,e){let{scope:n,minLoc:s=3,maxLoc:i=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},m=e?.semantic!==!1,a=new A(t),d=a.scopedDefinitions(n),y=Q(a,n),p={high:0,medium:1,low:2};return K({candidates:()=>O(t,a,d,{minLoc:s,maxLoc:i}),orderCandidates:(c,u)=>g(u)-g(c)||c.relativePath.localeCompare(u.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:c=>{let u=U(c),f=W(t,a,c,u,{semantic:m}),h=c.filter(x=>{if(a.hasSuppressionComment(x))return!1;let I=S(t,x,f,u);return I.realConsumers.length<=1&&!I.transitivelyReachable&&j(x,I.realConsumers.length,y)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,d,h,{semantic:m}),candidateIndex:u}},evaluate:(c,u)=>{if(a.hasSuppressionComment(c)||u.singletonBackedClassIds.has(c.symbolId))return null;let f=S(t,c,u.consumerFileMap,u.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:(c,u)=>p[c.confidence]-p[u.confidence]||u.loc-c.loc||c.file.localeCompare(u.file)||c.startLine-u.startLine,limit:r})}function O(t,e,n,s){return n.filter(i=>i.isTypeLike&&g(i)>=s.minLoc).filter(i=>g(i)<=s.maxLoc).filter(i=>!t.isIgnored(i.relativePath)).filter(i=>!i.relativePath.endsWith(".d.ts")).filter(i=>M(i.relativePath)!=="test").filter(i=>!R(t,i.symbol,i.relativePath)).filter(i=>!X(i.symbol))}function T(t,e,n,s){return L(v(t,e).forDefinitions(n,{semantic:s.semantic,sourceFallback:s.sourceFallback}))}function W(t,e,n,s,i){let r=T(t,e,n,{semantic:!1,sourceFallback:!1}),l=n.filter(a=>{let d=S(t,a,r,s);return d.realConsumers.length<=1&&!(d.realConsumers.length>0&&P(a.relativePath))}),o=i.semantic&&l.length>0?D(r,T(t,e,l,{semantic:!0,sourceFallback:!1})):r,m=l.filter(a=>S(t,a,o,s).realConsumers.length<=1);return D(o,T(t,e,m,{semantic:!1,sourceFallback:!0}))}function U(t){let e=new Map;for(let n of t){let s=e.get(n.relativePath);s||(s=new Map,e.set(n.relativePath,s));let i=b(n.symbol);i&&s.set(i,n)}return e}function S(t,e,n,s){let r=[...n.get(e.symbolId)??new Set].filter(d=>d!==e.relativePath&&!t.isIgnored(d)),{realConsumers:l,barrelConsumers:o,importOnlyConsumers:m}=$(t,e,r),a=Y(t,e,n,s);return{definition:e,realConsumers:l,barrelConsumers:o+m,transitivelyReachable:a}}function V(t,e){let n=E(t,e.definition.relativePath,e.definition.startLine),s=P(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:i,reason:r}=ne(e.realConsumers.length,n,s),l=z(e.realConsumers.length,n,s);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:s,confidence:i,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,s,i){let r=_(t,Z(n),s),l=r.map(a=>a.singleton);if(r.length===0)return new Set;let o=L(v(t,e).forDefinitions(l,{semantic:i.semantic,sourceFallback:!0})),m=new Set;for(let{singleton:a,classId:d}of r)G(t,a,o)&&m.add(d);return m}function Z(t){let e=new Map;for(let n of t){let s=b(n.symbol);s&&e.set(N(n.relativePath,s),n)}return e}function _(t,e,n){let s=[];for(let i of n){let r=q(t,e,i);r&&s.push({singleton:r,classId:i.symbolId})}return s}function q(t,e,n){if(E(t,n.relativePath,n.startLine)!=="class")return null;let s=b(n.symbol);if(!s)return null;let i=J(t,n.relativePath,s);return i?e.get(N(n.relativePath,i))??null:null}function G(t,e,n){let s=b(e.symbol),i=n.get(e.symbolId);return!s||!i?!1:[...i].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!B(t,r,s))}function N(t,e){return`${t}\0${e}`}function J(t,e,n){let s=C(t,e);if(!s)return null;let i=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${i}\\s*\\(`);return s.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 s=n[n.length-1],i=n[n.length-2];return s?.suffix==="type"&&i?.suffix==="type"}function P(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!(P(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,s){let i=w(t,e.relativePath),r=b(e.symbol);if(!r)return!1;let l=s.get(e.relativePath);if(!l)return!1;let o=[...i.get(r)??[]],m=new Set;for(;o.length>0;){let a=o.pop();if(m.has(a))continue;m.add(a);let d=l.get(a);if(!d)continue;let y=n.get(d.symbolId);if(y){for(let p of y)if(p!==e.relativePath&&!t.isIgnored(p))return!0}for(let p of i.get(a)??[])o.push(p)}return!1}function E(t,e,n){let s=C(t,e);if(!s)return"other";let i=s.split(`
2
- `),r=Math.max(0,n-2),l=Math.min(i.length-1,n+2);for(let o=r;o<=l;o++){let a=(i[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 s=b(e.symbol);if(!s)return!1;let i=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${i}\\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{me as a};
4
- //# sourceMappingURL=chunk-HKGFPJ4T.js.map
@@ -1,2 +0,0 @@
1
- import{i as I}from"./chunk-NWQXSFFU.js";import{a as p,e as g}from"./chunk-N2ZSIIGR.js";import{z as v}from"./chunk-ZOHS7AQV.js";import{c as E,e as x}from"./chunk-FESCRNVV.js";import{c as b,i as D,j as F,v as _,y}from"./chunk-JWTGMPIT.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:W,deserialize:X});function Me(e,n){return{forDefinitions(t,r){return V(e,n,t,r)}}}function Re(e){let n=new Map;for(let[t,r]of e)n.set(t,new Set(r.files.map(i=>i.file)));return n}function Ne(e,n,t){return w(e,n,t).partition}function V(e,n,t,r){let i=h(t.length),s=_()?F(e):null,a=s?B(t,r,s):void 0,o=a?{workIdentity:a,workOutcome:"computed"}:{};return y("consumer-evidence.product",()=>{let l=y("consumer-evidence.provenance",()=>Y(e,n,t,r),()=>({...o,definitions:t.length,semantic:r.semantic,sourceFallback:r.sourceFallback!==!1})),u=new Map;i={...i,...l.counters};let c=z(t,l.sources);return y("consumer-evidence.classify",()=>{let f=q(e,t,l.sources,c);for(let d of t){let m=f.get(d.symbolId)??H();i.realFiles+=m.partition.realConsumers.length,i.reexportOnlyFiles+=m.partition.barrelConsumers,i.importOnlyFiles+=m.partition.importOnlyConsumers,u.set(d.symbolId,{definition:d,files:m.files,...m.partition})}},()=>({...o,...c,realFiles:i.realFiles,reexportOnlyFiles:i.reexportOnlyFiles,importOnlyFiles:i.importOnlyFiles})),u},()=>({...o,...i}))}function B(e,n,t){let r=U("sha256").update("consumer-evidence-v1\0").update(t).update("\0").update(n.semantic?"semantic\0":"indexed\0").update(n.sourceFallback===!1?"no-source-fallback":"source-fallback");for(let i of e.map(s=>s.symbol).sort())r.update("\0").update(i);return r.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 Y(e,n,t,r){let i=h(t.length),s=new Map;return S(s,i,"indexed",n.crossFileCallerMap(t,{semantic:!1})),r.semantic&&S(s,i,"semantic",I(e,t)),r.sourceFallback!==!1&&S(s,i,"source-fallback",n.sourceFallbackCallerFiles(t)),i.totalFiles=[...s.values()].reduce((a,o)=>a+o.size,0),{sources:s,counters:i}}function z(e,n){return{definitions:e.length,consumerFiles:[...n.values()].reduce((t,r)=>t+r.size,0),nativeAttempted:!1,nativeUsed:!1,nativeReason:"not-attempted"}}function S(e,n,t,r){let i=0;for(let[s,a]of r){let o=e.get(s);o||(o=new Map,e.set(s,o));for(let l of a){i++;let u=o.get(l)??new Set;u.add(t),o.set(l,u)}}t==="indexed"?n.indexedFiles+=i:t==="semantic"?n.semanticFiles+=i:n.fallbackFiles+=i}function q(e,n,t,r){let i=se(e,n,t,r);return i||$(e,n,t)}function $(e,n,t){let r=new Map;for(let i of n){let s=t.get(i.symbolId)??new Map;r.set(i.symbolId,w(e,i,[...s.keys()],s))}return r}function w(e,n,t,r=new Map){let i=[],s=0,a=0,o=g(n.symbol),l=[];for(let u of t){let c;Z(e,u,n.relativePath,o)?(s++,c="reexport-only"):J(e,u,o)?(a++,c="import-only"):(i.push(u),c="real"),l.push({file:u,sources:[...r.get(u)??[]],classification:c})}return{partition:{realConsumers:i,barrelConsumers:s,importOnlyConsumers:a},files:l}}function H(){return{partition:{realConsumers:[],barrelConsumers:0,importOnlyConsumers:0},files:[]}}function J(e,n,t){if(!t)return!1;let r=v(n);if(!r)return!1;let i=N.get(e,n,()=>A(e,n,r));return i.importedLeaves.has(t)&&!i.usedLeaves.has(t)}function A(e,n,t){let r=p(e).forFile(n,{text:!0}).text;if(!r)return Q();let i=D(e,n,r),s=M.read(e,n,i);if(s)return s;let a=G(p(e).forFile(n,{ast:!0}).ast,t);return M.write(e,n,i,a),a}var K=new Set(["identifier","type_identifier","property_identifier","field_identifier"]);function G(e,n){let t=new Set,r=new Set;if(!e)return{importedLeaves:t,usedLeaves:r};let i=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),s=e.walk(),a=0,o=!1;for(;!o;){let l=s.nodeType,u=i.has(l);if(u&&(a+=1),K.has(l)&&(a>0?t:r).add(s.nodeText),!s.gotoFirstChild())for(u&&(a-=1);!s.gotoNextSibling();){if(!s.gotoParent()){o=!0;break}i.has(s.nodeType)&&(a-=1)}}return{importedLeaves:t,usedLeaves:r}}function Q(){return{importedLeaves:new Set,usedLeaves:new Set}}function W(e){return JSON.stringify({importedLeaves:[...e.importedLeaves],usedLeaves:[...e.usedLeaves]})}function X(e){try{let n=JSON.parse(e);return!Array.isArray(n.importedLeaves)||!Array.isArray(n.usedLeaves)?null:{importedLeaves:new Set(n.importedLeaves.filter(t=>typeof t=="string")),usedLeaves:new Set(n.usedLeaves.filter(t=>typeof t=="string"))}}catch{return null}}function Z(e,n,t,r){if(!r)return!1;let i=p(e).forFile(n,{lines:!0,reexports:!0}),s=i.lines??[];if(s.length===0)return!1;let a=i.reexports??[];return P(s,a,r)}function P(e,n,t){if(e.length===0||n.length===0)return!1;let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`\\b${r}\\b`),s=0;for(let a=0;a<e.length;a++){if(!i.test(e[a]??""))continue;if(s++,!n.find(l=>l.startLine<=a&&a<=l.endLine))return!1}return s>0}var ee="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY",ne="SCIP_QUERY_NATIVE_KERNELS_BIN",ie="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY_MIN_FILES",R=1e3,re=5e3,te=64*1024*1024,C;function se(e,n,t,r){let i=process.env[ee]?.toLowerCase();if(i!=="1"&&i!=="true")return r.nativeReason=i==="0"||i==="false"?"disabled":"opt-in-required",null;if(r.consumerFiles<me())return r.nativeReason="below-threshold",null;let s=de();if(!s)return r.nativeReason="binary-missing",null;r.nativeAttempted=!0;let a=oe(e,n,t),o=O(s,["consumer-classify"],{input:JSON.stringify(a),encoding:"utf8",timeout:re,maxBuffer:te});if(o.status!==0||o.error)return r.nativeReason=o.error?`spawn-error:${o.error.message}`:`exit-${o.status??"null"}`,null;try{let l=JSON.parse(o.stdout),u=le(l,n);return u?(r.nativeUsed=!0,r.nativeReason="used",u):(r.nativeReason="invalid-response",null)}catch{return r.nativeReason="invalid-json",null}}function oe(e,n,t){let r=new Map,i=[];for(let o of n){let l=g(o.symbol),c=[...(t.get(o.symbolId)??new Map).entries()].map(([f,d])=>{let m=r.get(f)??new Set;return l&&m.add(l),r.set(f,m),{file:f,sources:[...d]}});i.push({symbol_id:o.symbolId,leaf:l,consumer_files:c})}let s={},a={};for(let[o,l]of r){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=ae(e,o,l);c.length>0&&(a[o]=c)}return{definitions:i,file_usages:s,reexport_only_leaves:a}}function ae(e,n,t){if(t.size===0)return[];let r=p(e).forFile(n,{lines:!0,reexports:!0}),i=r.lines??[],s=r.reexports??[];return i.length===0||s.length===0?[]:[...t].filter(a=>P(i,s,a))}function le(e,n){if(!Array.isArray(e.entries)||e.entries.length!==n.length)return null;let t=new Set(n.map(i=>i.symbolId)),r=new Map;for(let i of e.entries){let s=ue(i);if(!s||!t.has(s.symbol_id))return null;r.set(s.symbol_id,{partition:{realConsumers:s.real_consumers,barrelConsumers:s.barrel_consumers,importOnlyConsumers:s.import_only_consumers},files:s.files})}for(let i of t)if(!r.has(i))return null;return r}function ue(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(r=>typeof r=="string"))return null;let t=[];for(let r of n.files){if(!r||typeof r!="object")return null;let i=r;if(typeof i.file!="string"||!Array.isArray(i.sources)||!i.sources.every(ce)||!fe(i.classification))return null;t.push({file:i.file,sources:i.sources,classification:i.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:t}}function ce(e){return e==="indexed"||e==="semantic"||e==="source-fallback"}function fe(e){return e==="real"||e==="reexport-only"||e==="import-only"}function me(){let e=process.env[ie];if(!e)return R;let n=Number(e);return Number.isFinite(n)&&n>=0?n:R}function de(){if(C!==void 0)return C;let e=process.env[ne],n=process.platform==="win32"?"scip-query-kernels.exe":"scip-query-kernels";return C=[...e?[e]:[],...pe().map(r=>T(r,"target","release",n))].find(r=>k(r))??null,C}function pe(){let e=new Set,n=L(j(import.meta.url));for(let t=0;t<5;t++)e.add(n),n=L(n);return[...e]}export{Me as a,Re as b,Ne as c,J as d};
2
- //# sourceMappingURL=chunk-HLZTEXRA.js.map
@@ -1,3 +0,0 @@
1
- import{$ as M,O as f,P as S,S as R}from"./chunk-3L2ZBPEX.js";import{b as B}from"./chunk-YXPUP5G2.js";import{b as N,c as _,d as w,f as k,g as A,h as z}from"./chunk-DRENNWRG.js";import{c as O}from"./chunk-IW5XQG5G.js";var T=O("symbol-resolution",{clearGroups:[]});function he(e,n){return G(e,n).match}function G(e,n){return T.get(e,n,()=>{let t=W(e,n.trim()).filter(i=>!e.isIgnored(i.relative_path));if(t.length>0)return L(e,t);let o=P(e,n);if(o&&!e.isIgnored(o.relative_path))return L(e,[o]);let r=H(e,n);if(r.length>0)return L(e,r);let s=U(e,n);return s.length>0?L(e,s):J(e,n)})}function H(e,n){let t=n.trim().replace(/\(\)$/u,""),o=t.lastIndexOf(":");if(o<=0||o===t.length-1||t.startsWith("local:"))return[];let r=t.slice(o+1);if(!/^[\p{L}_$][\p{L}\p{N}_$]*$/u.test(r))return[];let s=[`/${r}().`,`/${r}.`,`/${r}#`,`#${r}().`,`#${r}.`,`/${r}/`],i=`gs.display_name = ? OR ${s.map(()=>"instr(gs.symbol, ?) > 0").join(" OR ")}`,a=[r,...s],l=f(e,{where:i,params:a,orderBy:"d.relative_path, der.start_line",limit:200}),u=l.length>0?[]:S(e,{where:i,params:a,orderBy:"d.relative_path, start_line",limit:200}),p=R(l,u).filter(m=>!e.isIgnored(m.relative_path)).filter(m=>_(m.symbol).replace(/\(\)$/u,"")===t);return[...new Map(p.map(m=>[`${m.symbol}\0${m.relative_path}`,m])).values()]}function U(e,n){let t=Q(n),o=E(t);if(!o)return[];let r=`%${o.path}%`,s=o.leaf;return X(e,r,s,t)}function X(e,n,t,o){let r=R([],[...Y(e,n,t),...Z(e,n,t)]).filter(s=>!e.isIgnored(s.relative_path)).filter(s=>C(s,o)>1);return r.sort((s,i)=>C(i,o)-C(s,o)||s.end_line-s.start_line-(i.end_line-i.start_line)||s.start_line-i.start_line||s.symbol.localeCompare(i.symbol)),r}function Y(e,n,t){return f(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function Z(e,n,t){return S(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function J(e,n){let t=Q(n),o=ae(n),r=oe(e,o),s=se(r,n,t).filter(a=>!e.isIgnored(a.relative_path));if(s.length>0)return L(e,s);let i=[];for(let a of r){if(e.isIgnored(a.relative_path))continue;let l=re(a,n,t,o);l<=0||i.push({row:a,score:l})}return i.sort((a,l)=>l.score-a.score||a.row.end_line-a.row.start_line-(l.row.end_line-l.row.start_line)||a.row.relative_path.localeCompare(l.row.relative_path)||a.row.symbol.localeCompare(l.row.symbol)),L(e,i.map(a=>a.row))}function L(e,n){let t=n.map(r=>M(e,r)),o=t[0]??null;return{match:o,candidates:o?V(t,o):[],total:t.length}}function V(e,n){let t=new Set([`${n.symbolId}:${n.relativePath}:${n.startLine}`]),o=[];for(let r of e){let s=`${r.symbolId}:${r.relativePath}:${r.startLine}`;if(!t.has(s)&&(t.add(s),o.push({symbol:r.symbol,shortName:_(r.symbol),relativePath:r.relativePath,startLine:r.startLine}),o.length>=5))break}return o}function P(e,n){let t=n.match(/^(.+):(\d+)(?:-(\d+))?$/);if(!t)return;let[,o,r,s]=t,i=B(e,o,{allowMultiple:!1,requirePathMatch:!0})[0]?.relativePath;if(!i)return;let a=Math.max(0,parseInt(r,10)-1),l=s?Math.max(a,parseInt(s,10)-1):a;return ee(e,i,a,l)??te(e,i,a,l)}function ee(e,n,t,o){return f(e,{where:"d.relative_path = ? AND der.start_line <= ? AND der.end_line >= ?",params:[n,t,o],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function te(e,n,t,o){return S(e,{where:"d.relative_path = ? AND c.start_line <= ? AND c.end_line >= ?",params:[n,t,o],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function be(e,n){let t=W(e,n).find(o=>!e.isIgnored(o.relative_path));return t?M(e,t):null}function W(e,n){let t=f(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line"}),o=t.length>0?[]:S(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line"});return R(t,o)}function Se(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=ne(e,n.symbolId)[0];return t?M(e,t):null}function ne(e,n){let t=f(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),o=S(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return R(t,o)}function oe(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),o=n.flatMap(a=>{let l=`%${a}%`;return[l,l,l]}),r=t.join(`
2
- AND `),s=f(e,{where:r,params:o,limit:200}),i=S(e,{where:r,params:o,limit:200});return R(s,i)}function re(e,n,t,o){let r=n.trim(),s=t,i=s.replace(/\(\)$/,""),a=n.toLowerCase(),l=t.toLowerCase(),u=l.replace(/\(\)$/,""),p=e.symbol,m=_(e.symbol),y=w(e.symbol),g=e.display_name??"",$=e.symbol.toLowerCase(),d=m.toLowerCase(),h=y.toLowerCase(),x=g.toLowerCase(),b=e.relative_path.toLowerCase(),j=/[/:.]/.test(t),I=E(t),v=I?.leaf.toLowerCase(),c=0;return(p===r||p===s)&&(c+=1150),(m===r||m===s)&&(c+=1100),g===i&&(c+=1180),y===i&&(c+=1160),(`${y}()`===r||`${y}()`===s)&&(c+=955),($===a||$===l)&&(c+=1e3),(d===a||d===l)&&(c+=950),(b===a||b===l)&&(c+=925),(b.endsWith(`/${l}`)||b.endsWith(`/${a}`))&&(c+=875),x===u&&(c+=850),h===u&&(c+=825),(`${h}()`===a||`${h}()`===l)&&(c+=820),(d.endsWith(`:${l}`)||d.endsWith(`:${u}`)||d.endsWith(`:${u}()`))&&(c+=800),$.includes(l)&&(c+=120),d.includes(l)&&(c+=140),b.includes(l)&&(c+=140),x.includes(l)&&(c+=110),o.every(q=>{let D=q.toLowerCase();return $.includes(D)||d.includes(D)||b.includes(D)||x.includes(D)})&&(c+=100+o.length*15),I&&b.includes(I.path.toLowerCase())&&(c+=360,v&&(h===v||`${h}()`===v||`${h}()`==`${v}()`)&&(c+=700),k(e.symbol)&&(c+=180)),A(e.symbol)&&h===u&&(c+=60),!j&&z(e.symbol)&&(c-=160),c-=Math.min(50,Math.max(0,e.end_line-e.start_line)),c}function E(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let o=n.slice(t+1).replace(/\(\)$/,"");return!o||o.includes(".")?null:{path:n.slice(0,t),leaf:o}}function Q(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function ae(e){let n=Q(e),t=n.split(/[^A-Za-z0-9_]+/).map(o=>o.trim()).filter(o=>o.length>0);return t.length>0?[...new Set(t)]:[n]}function se(e,n,t){let o=n.trim(),r=e.filter(a=>{let l=_(a.symbol),u=w(a.symbol),p=(a.display_name??"").trim();return a.symbol===o||l===o||l===t||u===o||u===t||`${u}()`===o||p===o||p===t||`${p}()`===o||C(a,t)>1||a.relative_path===o});if(r.length===0)return[];let s=t.replace(/\(\)$/u,""),i=r.filter(a=>w(a.symbol)===s);if(i.length>0){i.sort((l,u)=>F(l,u,t));let a=i.filter(l=>A(l.symbol));return a.length>0?a:i}return r.sort((a,l)=>F(a,l,t)),r}function F(e,n,t){return C(n,t)-C(e,t)||e.end_line-e.start_line-(n.end_line-n.start_line)||e.relative_path.localeCompare(n.relative_path)||e.symbol.localeCompare(n.symbol)}function C(e,n){let t=E(n);if(!t)return 0;let o=e.relative_path.toLowerCase(),r=w(e.symbol).toLowerCase(),s=t.path.toLowerCase(),i=t.leaf.toLowerCase();return o.includes(s)?r!==i?1:k(e.symbol)?N(e.symbol)===null?5:4:N(e.symbol)===null?3:2:0}function ge(e,n,t=5){let o=K(n);if(!o)return[];let r=f(e,{where:"1 = 1",orderBy:"d.relative_path, der.start_line",limit:5e3}),s=new Map;for(let i of r){if(e.isIgnored(i.relative_path))continue;let a=_(i.symbol),l=w(i.symbol),u=i.display_name??l,p=[a,l,u].filter(g=>g.trim().length>0),m=Math.min(...p.map(g=>ie(K(g),o))),y=s.get(a);(!y||m<y.distance)&&s.set(a,{shortName:a,distance:m})}return[...s.values()].sort((i,a)=>i.distance-a.distance||i.shortName.localeCompare(a.shortName)).slice(0,t).map(i=>i.shortName)}function K(e){return Q(e).toLowerCase().replace(/[^a-z0-9_]+/g,"")}function ie(e,n){if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;let t=Array.from({length:n.length+1},(o,r)=>r);for(let o=0;o<e.length;o++){let r=[o+1];for(let s=0;s<n.length;s++){let i=e[o]===n[s]?0:1;r[s+1]=Math.min(r[s]+1,t[s+1]+1,t[s]+i)}t=r}return t[n.length]}export{he as a,G as b,be as c,Se as d,ge as e};
3
- //# sourceMappingURL=chunk-HOENASQM.js.map
@@ -1,2 +0,0 @@
1
- import{d as f}from"./chunk-B3X6KU75.js";import{P as d}from"./chunk-ZOHS7AQV.js";function S(n,e={}){let{minComponentLines:o=300,minFileLines:i=800,minJsxTokens:u=80,minBehaviorTokens:s=40,limit:a=20,scope:m,scanLimit:c,filePattern:p}=e;return d(n).reactProfiles({scope:m,scanLimit:c}).filter(t=>t.kind==="component").filter(t=>!p||t.file.includes(p)||t.name.includes(p)).map(t=>C(t,{minComponentLines:o,minFileLines:i,minJsxTokens:u,minBehaviorTokens:s})).filter(t=>t!==null).sort((t,r)=>r.componentLines-t.componentLines||r.fileLines-t.fileLines||t.file.localeCompare(r.file)).slice(0,a)}function C(n,e){let o=Math.max(80,Math.floor(e.minComponentLines/2)),i=f(n,x({minComponentLines:e.minComponentLines,minFileLines:e.minFileLines,minJsxTokens:e.minJsxTokens,minBehaviorTokens:e.minBehaviorTokens,substantialComponentLines:o}),"component"),{reasons:u}=i;if(u.length===0)return null;let s=i.dominantPressure,a=i.pressureKinds,m=b(n),c=R(s,a,m);return{file:n.file,component:n.name,componentLines:n.loc,fileLines:n.fileLines,jsxTokens:n.jsxTokens.size,behaviorTokens:n.behaviorTokens.size,dominantPressure:s,pressureKinds:a,contextKind:m,recommendationKind:c,recommendation:v(c,m),reasons:u,loc:n.loc}}function x(n){return[{axis:"component",value:e=>e.loc,qualifies:(e,o)=>o>=n.minComponentLines,reason:(e,o)=>`${o} component line(s)`},{axis:"file",value:e=>e.fileLines,qualifies:(e,o)=>o>=n.minFileLines&&e.loc>=n.substantialComponentLines,reason:(e,o)=>`${o} file line(s)`},{axis:"jsx-structure",value:e=>e.jsxTokens.size,weightedValue:(e,o)=>o*3,qualifies:(e,o)=>o>=n.minJsxTokens,reason:(e,o)=>`${o} JSX structure token(s)`},{axis:"hook-behavior",value:e=>e.behaviorTokens.size,weightedValue:(e,o)=>o*4,qualifies:(e,o)=>o>=n.minBehaviorTokens,reason:(e,o)=>`${o} behavior token(s)`}]}function b(n){let e=n.file.split(/[\\/]+/).filter(Boolean),o=e.slice(0,-1).map(r=>r.toLowerCase()),i=(e.at(-1)??n.name).replace(/\.[^.]+$/,""),s=o.findIndex(r=>k.has(r))>=0,a=o.some(r=>h.has(r));if(L(i)||L(n.name))return"component";let c=T.has(i.toLowerCase()),p=/(?:Page|Route|Screen)$/.test(n.name),l=s&&/View$/.test(n.name),t=!a&&i.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()===n.name.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()&&/(?:Page|Route|Screen|View)$/.test(i);return c||p||l||t?"route-page":"component"}function L(n){let e=n.split(/[^A-Za-z0-9]+/).filter(Boolean).map(o=>o.toLowerCase());return e.at(-1)&&g.has(e.at(-1))?!0:[...g].some(o=>n.endsWith(P(o)))}function R(n,e,o){return n==="hook-behavior"?"behavior-extraction":o==="route-page"?"route-page-decomposition":e.includes("hook-behavior")?"behavior-extraction":e.includes("jsx-structure")?"jsx-decomposition":e.includes("file")?"file-decomposition":n==="jsx-structure"?"jsx-decomposition":n==="file"&&!e.includes("component")?"file-decomposition":"component-decomposition"}function v(n,e){switch(n){case"behavior-extraction":return"Extract independent state, effects, requests, or handlers into hooks, controllers, or feature modules.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"jsx-decomposition":return e==="route-page"?"Split page JSX into named layout sections before extracting behavior.":"Split repeated JSX sections into named presentational components.";case"file-decomposition":return"Review file-level decomposition; split colocated panels or helpers before changing behavior.";case"component-decomposition":return"Review component boundaries around props, state ownership, and independently changing UI sections."}}var h=new Set(["component","components","panel","panels","partial","partials"]),g=new Set(["banner","button","card","dialog","drawer","filter","form","grid","header","item","list","menu","modal","nav","panel","picker","rail","row","section","selector","shell","sidebar","table","toolbar"]),k=new Set(["landing","page","pages","route","routes","screen","screens","view","views"]),T=new Set(["page","route","screen"]);function P(n){return n.charAt(0).toUpperCase()+n.slice(1)}export{S as a};
2
- //# sourceMappingURL=chunk-HVF5VBG6.js.map
@@ -1,2 +0,0 @@
1
- import{a as x}from"./chunk-CNO7TOKL.js";import{b as g}from"./chunk-BOJ5SVE2.js";import{c as k}from"./chunk-CJZXN4NU.js";import{a as n}from"./chunk-BGBBVSH4.js";import{i as v}from"./chunk-NWQXSFFU.js";import{b as L}from"./chunk-NJITK2GP.js";import{d as S}from"./chunk-N2ZSIIGR.js";import{y as a}from"./chunk-JWTGMPIT.js";function E(c,f={}){let{scope:P,minLoc:F=3,scanLimit:d}=f,l=new k(c),b=f.semantic!==!1,y=0,m=a("isolated.candidates",()=>{let s=g(l.productionCallableDefinitions({scope:P,minLoc:F,excludeEntrySurfaces:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:typeof d=="number"&&d>0}),d).filter(R=>!x(c,R));return y=s.length,s},()=>({definitions:y})),p=0,i=a("isolated.strict-callees",()=>{let e=l.symbolsWithNonSelfCallees(m,{additive:!1,semantic:!1});return p=e.size,e},()=>({definitions:m.length,symbols:p})),r=m.filter(e=>!i.has(e.symbolId)),C=0,N=a("isolated.scip-callers",()=>{let e=l.crossFileCallerMap(r,{semantic:!1});return C=e.size,e},()=>({definitions:r.length,symbols:C})),o=new Set(N.keys());for(let e of l.frameworkReferencedSymbolIds(r))o.add(e);let t=r.filter(e=>!o.has(e.symbolId));if(b&&t.length>0){for(let e of v(c,t).keys())o.add(e);for(let e of l.symbolsWithNonSelfCallees(t,{additive:!1,semantic:!0}))i.add(e);t=t.filter(e=>!o.has(e.symbolId)).filter(e=>!i.has(e.symbolId))}let h=0,W=a("isolated.source-fallback-callers",()=>{let e=l.sourceFallbackCallerFiles(t,{skipPath:s=>L(s)==="test"});return h=e.size,e},()=>({definitions:t.length,symbols:h}));for(let e of W.keys())o.add(e);let u=t.filter(e=>!o.has(e.symbolId)),I=0,M=a("isolated.additive-callees",()=>{let e=l.symbolsWithNonSelfCallees(u,{additive:!0,semantic:b});return I=e.size,e},()=>({definitions:u.length,symbols:I}));for(let e of M)i.add(e);return u.filter(e=>!i.has(e.symbolId)).sort((e,s)=>n(s)-n(e)||e.relativePath.localeCompare(s.relativePath)||e.startLine-s.startLine).map(e=>({symbol:e.symbol,shortName:S(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:n(e)}))}export{E as a};
2
- //# sourceMappingURL=chunk-I55I7XXP.js.map
@@ -1,2 +0,0 @@
1
- import{b as c}from"./chunk-TEBQMNVI.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
2
- //# sourceMappingURL=chunk-IDFEUFKS.js.map
@@ -1,2 +0,0 @@
1
- import{a as m}from"./chunk-3FHOF22C.js";var v=/:\d+(?:-\d+)?$/u;function D(d,t,c={}){let p=c.direction??"backward",n=c.maxDepth??3;if(!Number.isSafeInteger(n)||n<0)throw new RangeError(`Dependence-slice depth must be a non-negative safe integer; received ${n}.`);let r=v.test(t),o=m(d,r?{locations:[t]}:{symbols:[t]},{families:["execution","runtime","dataflow","ownership"],maxDepth:n+1,maxEdges:c.maxEdges??200}),f=new Set(o.targets.flatMap(e=>e.nodeIds)),a=new Set(f),l=new Map;u(o.edges,a,l,0);for(let e=1;e<=n;e+=1){let s=[];for(let i of o.edges)if(p==="backward"?a.has(i.to.id):a.has(i.from.id)){let g=p==="backward"?i.from.id:i.to.id;if(a.has(g))continue;s.push(g),l.set(i.id,e)}if(s.length===0)break;for(let i of s)a.add(i);u(o.edges,a,l,e)}let h=o.edges.filter(e=>a.has(e.from.id)&&a.has(e.to.id)).filter(e=>l.has(e.id)||e.family==="ownership").map(e=>({...e,traversalDepth:l.get(e.id)??0,supporting:e.family!=="dataflow"&&!y(e)})).sort((e,s)=>e.traversalDepth-s.traversalDepth||e.family.localeCompare(s.family)||e.from.label.localeCompare(s.from.label)||e.to.label.localeCompare(s.to.label));return{kind:"dependence-slice",direction:p,criterion:t,targets:o.targets,nodeIds:[...a].sort(),edges:h,coverage:{status:o.coverage.status,criterionKind:r?"source-location-summary":"symbol-summary",basis:"partial-system-dependence-graph",analysisBasis:"typescript-cfg-reaching-definitions-plus-system-edges",providers:["typescript-local-dependence","bounded-static-value-flow"],graph:o.coverage,unsupportedRelations:["general heap alias and cross-instance field points-to flow","exceptional control and value flow","closure invocation order","downstream local definition-use after a call result","unresolved dynamic dispatch"]}}}function u(d,t,c,p){let n=!0;for(;n;){n=!1;for(let r of d)r.family!=="ownership"||!t.has(r.from.id)||t.has(r.to.id)||(t.add(r.to.id),c.set(r.id,p),n=!0)}}function y(d){return d.semanticFamily==="control"&&d.sourceKind==="control-dependence"}export{D as a};
2
- //# sourceMappingURL=chunk-IHGQTTVW.js.map
@@ -1,20 +0,0 @@
1
- import{a as l,b as d,d as u}from"./chunk-IZDPJ2QI.js";import{r as c}from"./chunk-KYSDI3GE.js";import h from"better-sqlite3";var m=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],o=class{constructor(t,e){this.connection=t;this.releaseGenerationReader=e}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let e of m)this.connection.pragma(e);t(this.connection)}catch(e){try{this.close()}catch(n){throw new AggregateError([e,n],"SQLite initialization and rollback both failed.",{cause:n})}throw e}}close(){if(!this.active)return;this.active=!1;let t,e;try{this.connection.close()}catch(n){t=n}try{this.releaseGenerationReader()}catch(n){e=n}if(t!==void 0&&e!==void 0)throw new AggregateError([t,e],"SQLite connection close and generation-reader release both failed.");if(t!==void 0)throw t;if(e!==void 0)throw e}},b=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".scipquery-cache","__pycache__",".venv","venv"],p=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;constructor(t,e){this.config=t,this.pathFilter=e??null;let n=S(t),i=new o(n.db,n.release);try{i.initialize(y),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=i,this.db=g(n.db)}catch(r){try{i.close()}catch(s){throw new AggregateError([r,s],"SQLite construction and rollback both failed.",{cause:s})}throw r}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
2
- EXISTS (
3
- SELECT 1
4
- FROM defn_enclosing_ranges local_der
5
- JOIN documents local_d ON local_der.document_id = local_d.id
6
- WHERE local_der.symbol_id = gs.id
7
- ${this.pathExclusionsFor("local_d").trimStart()}
8
- )
9
- OR EXISTS (
10
- SELECT 1
11
- FROM mentions local_m
12
- JOIN chunks local_c ON local_m.chunk_id = local_c.id
13
- JOIN documents local_d ON local_c.document_id = local_d.id
14
- WHERE local_m.symbol_id = gs.id
15
- AND local_m.role = 1
16
- ${this.pathExclusionsFor("local_d").trimStart()}
17
- )
18
- )`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(e=>b.flatMap(n=>[`AND ${e}.relative_path NOT LIKE '${n}/%'`,`AND ${e}.relative_path NOT LIKE '%/${n}/%'`])).join(`
19
- `)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...e){return this.statement(t).all(...e)}get(t,...e){return this.statement(t).get(...e)}close(){this.statementCache.clear(),this.connectionOwnership.close()}statement(t){let e=this.statementCache.get(t);return e||(e=this.connection.prepare(t),this.statementCache.set(t,e)),e}};function g(a){return Object.freeze({prepare(t){let e=a.prepare(t);if(!e.readonly||!e.reader)throw new Error("ScipDatabase.db only permits read-only statements that return rows.");return f(e)}})}function f(a){let t={get:(...e)=>a.get(...e),all:(...e)=>a.all(...e),iterate:(...e)=>a.iterate(...e),pluck(e){return e===void 0?a.pluck():a.pluck(e),t},expand(e){return e===void 0?a.expand():a.expand(e),t},raw(e){return e===void 0?a.raw():a.raw(e),t},bind(...e){return a.bind(...e),t},columns:()=>a.columns(),safeIntegers(e){return e===void 0?a.safeIntegers():a.safeIntegers(e),t}};return Object.freeze(t)}function y(a){if(!a.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'documents'").get())return;let e=a.prepare("SELECT relative_path FROM documents").iterate();for(let n of e)c(n.relative_path)}function S(a){for(let t=0;t<4;t+=1){let e=l(a),n=e.generation,i;try{i=new h(n.databasePath,{readonly:!0,fileMustExist:!0})}catch(r){throw e.release(),r}if(n.source==="immutable")return{db:i,generation:n,release:e.release};try{let r=d(a);if(n.databaseFileIdentity===u(n.databasePath)&&r.source==="legacy"&&r.identity===n.identity&&r.databaseFileIdentity===n.databaseFileIdentity&&r.metadataRaw===n.metadataRaw)return{db:i,generation:n,release:e.release}}catch(r){throw i.close(),e.release(),r}i.close(),e.release()}throw new Error("SQLite index publication changed repeatedly while opening a coherent generation.")}export{p as a};
20
- //# sourceMappingURL=chunk-IICPE7B2.js.map
@@ -1,18 +0,0 @@
1
- import{d as S}from"./chunk-GSP44ENC.js";import{c as m}from"./chunk-CJZXN4NU.js";import{g as y}from"./chunk-NWQXSFFU.js";import{b as h}from"./chunk-NJITK2GP.js";import{y as p}from"./chunk-ODDUPDP7.js";import{a as g}from"./chunk-ZOHS7AQV.js";import f from"path";function W(e,t){let{scope:i,minDeviation:r=5,limit:n=50}=t??{},a=t?.semantic!==!1,u=t?.includePatternDeviations===!0,o=new m(e).fileDependencyGraph(i),l=S(e,{scope:i}),c=x([...D(e,o,{scope:i,semantic:a}),...R(l.forbiddenEdges),...u?E(o,r):[]]);return t?.includeArchitecture===!0&&(c.architecture=l),n<=0||c.results.length<=n?c:{...c,results:c.results.slice(0,n),totalResults:c.results.length}}function D(e,t,i){let r=_(e,i.scope),n=[],a=new Set;for(let[s,o]of t){if(d(s))continue;let l=r.get(s)??new Set;for(let c of o)d(c)||l.has(c)||v(e,s,c,i)||(n.push({file:s,dep:c}),a.add(s))}a.size>0&&w(e,r,{paths:[...a]});let u=[];for(let{file:s,dep:o}of n)(r.get(s)??new Set).has(o)||u.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${s} to ${o}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return u}function v(e,t,i,r){return C(e,t,i)||M(e,t,i)||O(i)||P(e,t,i)||N(i)?!0:r.semantic&&A(e,t,i)}function R(e){return e.flatMap(t=>{let i=t.examples[0];return i?[{file:i.fromFile,kind:"architecture-violation",description:`${t.from} depends on forbidden boundary ${t.to} through ${t.fileEdgeCount} file edge(s)`,dep:i.toFile,detail:`${t.from} may not depend on ${t.to}`,actionTier:"direct",policyBasis:"explicit",architecture:{fromBoundary:t.from,toBoundary:t.to,fileEdgeCount:t.fileEdgeCount,importerCount:t.importerCount,importedFileCount:t.importedFileCount,examples:t.examples},evidenceReasons:[`configured dependency row for ${t.from} does not allow ${t.to}`,`${t.fileEdgeCount} file edge(s) connect ${t.importerCount} importer(s) to ${t.importedFileCount} imported file(s)`,...t.examples.map(r=>`${r.fromFile} imports ${r.toFile}`)],recommendation:"Move the dependency behind an allowed boundary, reverse the dependency through an owned interface, or deliberately update the project architecture rule."}]:[]})}function E(e,t){let i=[];for(let[r,n]of k(e)){let a=n.filter(s=>!d(s));if(a.length<t)continue;let u=I(e,a);for(let s of a)for(let o of e.get(s)??[])d(o)||(u.get(o)??0)===1&&f.dirname(o)!==r&&f.dirname(o)!==f.dirname(r)&&i.push({file:s,kind:"pattern-deviation",description:`Only file in ${r}/ that depends on ${o}`,dep:o,actionTier:"signal",evidenceReasons:[`${a.length} sibling file(s) in ${r}/ were compared`,`${s} is the only non-skipped sibling depending on ${o}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."})}return i}function x(e){let t=e.filter(i=>i.kind==="architecture-violation").length;return{results:e,unusedImports:e.filter(i=>i.kind==="unused-import").length,architectureViolations:t,layerViolations:t,patternDeviations:e.filter(i=>i.kind==="pattern-deviation").length}}function k(e){let t=new Map;for(let i of e.keys()){let r=f.dirname(i),n=t.get(r);n||(n=[],t.set(r,n)),n.push(i)}return t}function I(e,t){let i=new Map;for(let r of t)for(let n of e.get(r)??[])d(n)||i.set(n,(i.get(n)??0)+1);return i}function _(e,t){let i=new Map;return $(e,i,t),i}function $(e,t,i){for(let r of F(e,i))b(e,t,r.from_file,r.to_file)}function F(e,t){let i=t?"AND d1.relative_path LIKE ?":"",r=t?[`%${t}%`]:[];return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
2
- 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
- JOIN (
7
- SELECT m2.symbol_id, c2.document_id
8
- FROM mentions m2
9
- JOIN chunks c2 ON m2.chunk_id = c2.id
10
- WHERE m2.role = 1
11
- GROUP BY m2.symbol_id
12
- ) sym_def ON sym_def.symbol_id = gs.id
13
- JOIN documents d2 ON sym_def.document_id = d2.id
14
- WHERE d1.id != d2.id
15
- AND m.role != 1
16
- ${e.pathExclusionsFor("d1","d2")}
17
- ${i}`,...r)}function w(e,t,i={}){new m(e).scanSourceReferences({paths:i.paths??g(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},n=>{n.target.relativePath!==n.sourceFile&&(e.isIgnored(n.target.relativePath)||b(e,t,n.sourceFile,n.target.relativePath))})}function b(e,t,i,r){if(e.isIgnored(i)||e.isIgnored(r))return;let n=t.get(i);n||(n=new Set,t.set(i,n)),n.add(r)}function O(e){return e.includes("types")||e.endsWith(".d.ts")}function A(e,t,i){return y(e,t).filter(n=>n.sourcePath===i).some(n=>n.isUsed)}function C(e,t,i){return p(e,t).filter(n=>n.sourcePath===i).some(n=>n.used)}function M(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.every(n=>n.isTypeOnly===!0)}function N(e){return e.endsWith(".vue")}function P(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length===0?!1:r.every(n=>n.kind==="side-effect"||n.kind==="namespace"&&n.usedMembers.length===0&&!n.used)}function d(e){let t=h(e);return!!(t==="entry"||t==="barrel"||t==="test"||t==="worker"||T(f.basename(e)))}function T(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{W as a};
18
- //# sourceMappingURL=chunk-IL676XCC.js.map
@@ -1,2 +0,0 @@
1
- var f=[];function d(e){e.groups.length>0&&f.push(e)}function m(e,a){let t=new Set(a.groups);for(let c of f)c.groups.some(n=>t.has(n))&&(a.file!==void 0&&c.clearFile?c.clearFile(e,a.file):c.clearAll(e))}var h=256;function g(e){let a=e.maxEntries;if(a!==void 0){if(!Number.isSafeInteger(a)||a<1)throw new Error(`Per-database cache maxEntries must be a positive safe integer; received ${a}.`);return a}return e.clearGroups.includes("source-file")?h:void 0}function C(e,a,t){e.delete(a),e.set(a,t)}function v(e,a){if(a!==void 0)for(;e.size>a;){let t=e.keys().next().value;if(t===void 0)return;e.delete(t)}}function D(){let e=new WeakMap;return{cache:e,ensure(a){let t=e.get(a);return t||(t=new Map,e.set(a,t)),t}}}function x(e,a){let{cache:t,ensure:c}=D(),n=g(a),s={get(r,i,p){let o=c(r);if(o.has(i)){let u=o.get(i);return C(o,i,u),u}let l=p();return o.set(i,l),v(o,n),l},has(r,i){return t.get(r)?.has(i)??!1},invalidate(r,i){t.get(r)?.delete(i)},invalidateAll(r){t.delete(r)},size(r){return t.get(r)?.size??0}};return d({name:e,groups:a.clearGroups,clearAll:r=>s.invalidateAll(r),clearFile:(r,i)=>s.invalidate(r,i)}),s}function E(e,a){let t=new WeakMap,c={get(n,s){let r=t.get(n);if(r)return r.value;let i=s();return t.set(n,{value:i}),i},invalidate(n){t.delete(n)},has(n){return t.has(n)}};return d({name:e,groups:a.clearGroups,clearAll:n=>c.invalidate(n)}),c}var V={clearGroups:["whole-project","source-file"],maxEntries:h};function A(e){return S(e,V)}function S(e,a){let{cache:t,ensure:c}=D(),n=g(a),s={get(r,i,p,o){let l=c(r),u=l.get(i);if(u&&u.source===p)return C(l,i,u),u.value;let b=o();return l.set(i,{source:p,value:b}),v(l,n),b},invalidate(r,i){t.get(r)?.delete(i)},invalidateAll(r){t.delete(r)}};return d({name:e,groups:a.clearGroups,clearAll:r=>s.invalidateAll(r),clearFile:(r,i)=>s.invalidate(r,i)}),s}export{d as a,m as b,x as c,E as d,A as e,S as f};
2
- //# sourceMappingURL=chunk-IW5XQG5G.js.map
@@ -1,2 +0,0 @@
1
- import{c as _t,d as j}from"./chunk-WYPL7GF7.js";import{b as k}from"./chunk-RTQ7NEKG.js";import{d as Se,f as Ct}from"./chunk-GUFSG5TX.js";import{b as Ft}from"./chunk-3AF4TUFK.js";import{a as xe,b as V,c as G}from"./chunk-FGA2U4OR.js";import{a as be}from"./chunk-B3PYOSCX.js";import{e as X}from"./chunk-HGFDYOVB.js";import{a as Pt,b as Tt,c as ye,d as Lt}from"./chunk-JFMEXGFE.js";import{A as Ne,C as jt,D as Nt,F as qt,a as Gt,c as Dt,d as At,e as he,ga as qe,j as Ie,k as O,l as Z,n as Me,r as Fe,s as kt,u as Ot,v as Mt,w as _e,x as je}from"./chunk-KYSDI3GE.js";import{a as v,b as J,c as S,f as I,g as R,h as b,k as Et,l as H}from"./chunk-7F45LJKI.js";import{createHash as en,randomUUID as tn}from"crypto";import{existsSync as Y,mkdirSync as rn,readdirSync as nn,rmSync as Bt,statSync as Wt}from"fs";import{basename as on,dirname as we,join as w}from"path";var N=1,ze=1,te=".scipquery-generations",ve="manifest.json",zt="readers",an="gc.lock",sn=128,ee=new Map,Ut={pid:process.pid,now:()=>new Date,randomToken:()=>tn(),isProcessAlive:be,readProcessIdentity:ye};function h(e){return w(we(e),te)}function Ue(e){return w(h(e),an)}function Po(e,t=Ut){let r=j(Ue(e.dbPath),{waitMs:5e3,directoryDurability:"recoverable"});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");let n;try{let i=ln(e);if(i.source!=="immutable")return{generation:i,release(){}};let o=t.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(o))throw new Error("SQLite generation reader token is unsafe.");let a=w(h(e.dbPath),zt);rn(a,{recursive:!0}),n=w(a,`${t.pid}-${o}.json`);let s=t.readProcessIdentity(t.pid);V(n,{version:1,token:o,generationIdentity:i.identity,pid:t.pid,...s?{processIdentity:s}:{},acquiredAt:t.now().toISOString()},{spacing:2,trailingNewline:!0});let c=!1;return{generation:i,release(){c||!n||(c=!0,Bt(n,{force:!0}))}}}finally{r.release()}}function Ht(e,t,r=Ut,n={}){let i=w(h(e),zt);if(!Y(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,a=0,s=0,c=0;for(let d of nn(i,{withFileTypes:!0})){if(!d.isFile()||!d.name.endsWith(".json"))continue;let l=w(i,d.name),f;try{f=cn(JSON.parse(b(l,"SQLite generation reader lease")))}catch{f=null}if(!f){c+=1;for(let m of t)o.add(m);continue}if(!dn(f,r)){n.removeStale!==!1&&(Bt(l,{force:!0}),s+=1);continue}a+=1,o.add(f.generationIdentity)}return{protectedGenerations:o,activeLeases:a,staleLeasesRemoved:s,malformedLeases:c}}function cn(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,r=t.processIdentity===void 0?null:Pt(t.processIdentity);return t.version!==1||typeof t.token!="string"||t.token.trim()===""||typeof t.generationIdentity!="string"||!/^[a-f0-9]{64}$/.test(t.generationIdentity)||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.acquiredAt!="string"||!Number.isFinite(Date.parse(t.acquiredAt))||t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,token:t.token,generationIdentity:t.generationIdentity,pid:t.pid,...r?{processIdentity:r}:{},acquiredAt:t.acquiredAt}}function dn(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||Tt(e.processIdentity,r)}function q(e){try{let t=JSON.parse(b(w(h(e),"state.json"),"SQLite generation state"));return mn(t)?t:null}catch{return null}}function re(e,t){return ne(h(e),t)}function ne(e,t){try{let r=JSON.parse(b(w(e,t,ve),"SQLite generation manifest"));return pn(r,t)?r:null}catch{return null}}function ln(e){let t=q(e.dbPath);if(t){let r=un(e,t.currentGeneration);if(r)return r;if(t.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${t.currentGeneration} is missing or invalid.`)}if(Y(w(we(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return fn(e,t?.currentGeneration)}function To(e){let t=q(e);if(t)return t.currentGeneration;try{let r=w(we(e),"meta.json"),n=Y(r)?b(r,"reindex metadata"):void 0;return Vt(e,n)}catch{return null}}function M(e){return Ct(Se(e))??e}function un(e,t){try{let r=w(h(e.dbPath),t),n=re(e.dbPath,t);if(!n)return null;let i=$e(r,n.database),o=n.index?$e(r,n.index):void 0,a=n.metadata?$e(r,n.metadata):void 0;return!Be(i,n.database)||n.index&&(!o||!Be(o,n.index))||n.metadata&&(!a||!Be(a,n.metadata))?null:{identity:t,databasePath:i,...o?{indexPath:o}:{},...a?{metadataPath:a,metadataRaw:b(a,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function fn(e,t){let r=$(e.dbPath),n=w(we(e.dbPath),"meta.json"),i=Y(n)?b(n,"reindex metadata"):void 0,o=Y(e.indexPath)?e.indexPath:void 0;return{identity:t??Vt(e.dbPath,i),databasePath:e.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:n,metadataRaw:i},source:"legacy",databaseFileIdentity:r}}function Vt(e,t){let r=en("sha256").update("sqlite-generation-legacy-v1\0");return t!==void 0&&r.update(M(t)),r.update(`\0${$(e)}`),r.digest("hex")}function $(e){let t=Wt(e);return`${t.dev}:${t.ino}:${t.size}:${t.mtimeMs}`}function $e(e,t){if(on(t.file)!==t.file||t.file==="."||t.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return w(e,t.file)}function Be(e,t){if(!Y(e))return!1;let r=$t(e);if(!r||r.size!==t.size)return!1;let n=`${e}\0${t.sha256}\0${r.identity}`;if(ee.has(n))return!0;let i=H(e,{inputKind:"immutable SQLite generation artifact",maxBytes:t.size}),o=$t(e);if(!o||o.identity!==r.identity||i!==t.sha256)return!1;for(ee.set(n,!0);ee.size>sn;){let a=ee.keys().next().value;if(a===void 0)break;ee.delete(a)}return!0}function $t(e){let t=Wt(e,{bigint:!0});return t.isFile()?{identity:`${t.dev}:${t.ino}:${t.size}:${t.mtimeNs}:${t.ctimeNs}`,size:Number(t.size)}:null}function pn(e,t){return e.version===ze&&e.identity===t&&We(e.database)&&(e.index===void 0||We(e.index))&&(e.metadata===void 0||We(e.metadata))}function We(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.file=="string"&&!!t.file&&Number.isSafeInteger(t.size)&&(t.size??-1)>=0&&typeof t.sha256=="string"&&/^[a-f0-9]{64}$/.test(t.sha256)}function mn(e){return e.version===N&&typeof e.currentGeneration=="string"&&!!e.currentGeneration&&typeof e.publishedAt=="string"&&Number.isFinite(Date.parse(e.publishedAt))&&(e.artifactSet===void 0||e.artifactSet==="immutable-v1")&&gn(e.stableMirrors)&&yn(e.previousGeneration)&&hn(e.publication)}function gn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.databaseFileIdentity=="string"&&!!t.databaseFileIdentity&&(t.indexFileIdentity===void 0||typeof t.indexFileIdentity=="string"&&!!t.indexFileIdentity)}function yn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.generationIdentity=="string"&&!!t.generationIdentity&&typeof t.databasePath=="string"&&!!t.databasePath&&(t.metadataPath===void 0||typeof t.metadataPath=="string"&&!!t.metadataPath)}function hn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e,r=[t.converterDurationMs,t.affectedDocumentCount,t.changedDocumentCount,t.producerDurationMs,t.materializationDurationMs,t.patchDurationMs].filter(n=>n!==void 0);return(t.mode==="incremental"||t.mode==="full")&&t.validation==="passed"&&t.converterDurationMs!==void 0&&r.every(n=>typeof n=="number"&&Number.isFinite(n)&&n>=0)&&(t.scipCompanion===void 0||t.scipCompanion==="current"||t.scipCompanion==="deferred")&&(t.typescriptOverlayGeneration===void 0||typeof t.typescriptOverlayGeneration=="string"&&!!t.typescriptOverlayGeneration)&&(t.scipCompanion!=="deferred"||!!t.typescriptOverlayGeneration)&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")}import{execFileSync as Sn}from"child_process";import{existsSync as In,readdirSync as Yt}from"fs";import{extname as Qt,join as Kt}from"path";var Jt=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),bn=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function ko(e){let t=[],r=xn(e),n=En(e);for(let i of bn){if(wn(e,i.files)){t.push(i.language);continue}if(vn(r,i.globs)){t.push(i.language);continue}Tn(n,i.extensions)&&t.push(i.language)}if(t.includes("typescript")&&He(t,"javascript"),t.includes("cpp")&&t.includes("c")){let i=n.has(".c"),o=[".cc",".cpp",".cxx"].some(a=>n.has(a));i&&!o?He(t,"cpp"):i||He(t,"c")}return t}function xn(e){try{return Yt(e)}catch{return[]}}function wn(e,t){return t?.length?t.some(r=>In(Kt(e,r))):!1}function vn(e,t){return t?.length?e.some(r=>t.some(n=>Rn(r,n))):!1}function Rn(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[r,n]=t.split("*");return e.startsWith(r??"")&&e.endsWith(n??"")}function En(e){let t=Pn(e);if(t)return t;let r=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!i)continue;let o;try{o=Yt(i,{withFileTypes:!0})}catch{continue}for(let a of o){if(a.name.startsWith(".")&&!a.name.endsWith("proj")&&!a.name.endsWith("sln")&&a.isDirectory())continue;let s=Kt(i,a.name);if(a.isDirectory()){Jt.has(a.name)||n.push(s);continue}let c=Qt(a.name).toLowerCase();c&&r.add(c)}}return r}function Pn(e){try{let t=jt(e,26214400,()=>Sn("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:52428800,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"})),r=new Set;for(let n of Nt(t)){if(n.split("/").some(o=>Jt.has(o)))continue;let i=Qt(n).toLowerCase();i&&r.add(i)}return r}catch{return null}}function Tn(e,t){return t?.length?t.some(r=>e.has(r)):!1}function He(e,t){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}import{closeSync as Zt,openSync as kn,renameSync as On,rmSync as Mn,writeSync as Fn}from"fs";import{create as er,fromBinary as _n,toBinary as jn}from"@bufbuild/protobuf";import{DocumentSchema as Ye,IndexSchema as Nn,SymbolRole as Ke}from"@c4312/scip";var E=class extends Error{},Gn=0,Dn=1,Xt=2,An=5;function Ve(e,t,r){let n=0,i=0;for(;t<r;){let o=e[t];if(t+=1,i<53)n+=(o&127)*2**i;else if((o&127)!==0)throw new E("varint exceeds the safe integer range");if((o&128)===0)return{value:n,pos:t};if(i+=7,i>63)throw new E("varint is longer than 64 bits")}throw new E("varint runs past the end of the buffer")}function*P(e,t=0,r=e.length){let n=t;for(;n<r;){let i=n,o=Ve(e,n,r);n=o.pos;let a=Math.floor(o.value/8),s=o.value%8;if(a===0)throw new E("field number 0 is invalid");let c=n,d=0;if(s===Gn){let l=Ve(e,n,r);d=l.value,n=l.pos}else if(s===Xt){let l=Ve(e,n,r);if(c=l.pos,n=l.pos+l.value,n>r)throw new E("length-delimited field runs past the end of the buffer")}else if(s===Dn)n+=8;else if(s===An)n+=4;else throw new E(`unsupported wire type ${s}`);if(n>r)throw new E("field value runs past the end of the buffer");yield{fieldNumber:a,wireType:s,fieldStart:i,valueStart:c,valueEnd:n,fieldEnd:n,varint:d}}}function ie(e){if(!Number.isSafeInteger(e)||e<0)throw new E(`cannot encode varint ${e}`);let t=[],r=e;do{let n=r%128;r=Math.floor(r/128),r>0&&(n|=128),t.push(n)}while(r>0);return Uint8Array.from(t)}function Re(e){return ie(e*8+Xt)}var Cn=1,Ln=3;function oe(e){let t=new TextDecoder,r;for(let n of P(e))if(!(n.fieldNumber!==Cn||n.wireType!==2))for(let i of P(e,n.valueStart,n.valueEnd)){if(i.fieldNumber!==Ln||i.wireType!==2)continue;let o=t.decode(e.subarray(i.valueStart,i.valueEnd));o&&(r=o)}return r}var Qe=2,qn=3,$n=1,Bn=2,Wn=3,zn=1,Un=2,Hn=3;function Bo(e){let t;try{t=I(e,{inputKind:"SCIP sanitization input",maxBytes:S})}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}try{return Vn(t,e)}catch(r){if(r instanceof E)return{removedDefinitionOccurrences:0,touchedDocuments:0};throw r}}function Vn(e,t){let r=new TextDecoder,n=new Set;for(let a of P(e))if(a.wireType===2)if(a.fieldNumber===Qe)for(let s of P(e,a.valueStart,a.valueEnd))s.wireType===2&&(s.fieldNumber===$n?Fe(r.decode(e.subarray(s.valueStart,s.valueEnd))):s.fieldNumber===Wn&&tr(e,s,r,n));else a.fieldNumber===qn&&tr(e,a,r,n);let i=0,o=[];for(let a of P(e)){if(a.wireType!==2||a.fieldNumber!==Qe)continue;let s=Yn(e,a,r,n);s>0&&(i+=s,o.push(a))}return i===0?{removedDefinitionOccurrences:0,touchedDocuments:0}:(Qn(e,t,o,n),{removedDefinitionOccurrences:i,touchedDocuments:o.length})}function tr(e,t,r,n){for(let i of P(e,t.valueStart,t.valueEnd)){if(i.wireType!==2||i.fieldNumber!==zn)continue;let o=r.decode(e.subarray(i.valueStart,i.valueEnd));o&&n.add(o)}}function Yn(e,t,r,n){let i=0;for(let o of P(e,t.valueStart,t.valueEnd)){if(o.wireType!==2||o.fieldNumber!==Bn)continue;let a="",s=0;for(let c of P(e,o.valueStart,o.valueEnd))c.fieldNumber===Un&&c.wireType===2?a=r.decode(e.subarray(c.valueStart,c.valueEnd)):c.fieldNumber===Hn&&c.wireType===0&&(s=c.varint);(s&Ke.Definition)!==0&&!n.has(a)&&(i+=1)}return i}function Qn(e,t,r,n){let i=`${t}.sanitize-tmp`,o=kn(i,"w",384);try{let a=0;for(let s of r){ae(o,e.subarray(a,s.fieldStart));let c=_n(Ye,e.subarray(s.valueStart,s.valueEnd));c.occurrences=c.occurrences.filter(l=>(l.symbolRoles&Ke.Definition)===0||n.has(l.symbol));let d=jn(Ye,c);ae(o,Re(Qe)),ae(o,ie(d.byteLength)),ae(o,d),a=s.fieldEnd}ae(o,e.subarray(a))}catch(a){throw Zt(o),Mn(i,{force:!0}),a}Zt(o),On(i,t)}function ae(e,t){let r=0;for(;r<t.byteLength;)r+=Fn(e,t,r,t.byteLength-r)}function rr(e){let t=new Set;for(let o of e.documents){Fe(o.relativePath);for(let a of o.symbols)a.symbol&&t.add(a.symbol)}for(let o of e.externalSymbols)o.symbol&&t.add(o.symbol);let r=0,n=0,i=[];for(let o of e.documents){let a=o.occurrences.filter(s=>(s.symbolRoles&Ke.Definition)===0||t.has(s.symbol)?!0:(r+=1,!1));if(a.length===o.occurrences.length){i.push(o);continue}n+=1,i.push(er(Ye,{language:o.language,relativePath:o.relativePath,occurrences:a,symbols:o.symbols,text:o.text,positionEncoding:o.positionEncoding}))}return{index:r===0?e:er(Nn,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:r,touchedDocuments:n}}import{closeSync as ce,openSync as Je,readSync as Kn,renameSync as Jn,rmSync as or,statSync as Xn,writeFileSync as ar,writeSync as sr}from"fs";import{create as Xe,fromBinary as Zn,toBinary as ei}from"@bufbuild/protobuf";import{deserializeSCIP as cr,serializeSCIP as dr,DocumentSchema as ti,IndexSchema as ri,MetadataSchema as nr,SymbolInformationSchema as ni}from"@c4312/scip";function lr(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=ii(e),r=oi(e.flatMap(i=>i.documents??[])),n=fr(e.flatMap(i=>i.externalSymbols??[]));return Xe(ri,{metadata:t,documents:r,externalSymbols:n})}function Jo(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>cr(I(i,{inputKind:"SCIP merge input",maxBytes:S}))),n=lr(r);return ar(t,dr(n)),{documentCount:n.documents.length,externalSymbolCount:n.externalSymbols.length,inputCount:e.length}}function Xo(e,t){if(e.length===0)throw new Error("Cannot concatenate zero SCIP files");let r=0;for(let o of e)if(r+=Xn(o).size,r>S)throw new Error(`Concatenated SCIP output exceeds the ${S}-byte artifact limit. Reduce the indexed project scope or use compatible cached generations.`);let n=Buffer.allocUnsafe(1024*1024),i=Je(t,"w",384);try{for(let o of e){let a=Je(o,"r");try{let s=0;for(;(s=Kn(a,n,0,n.byteLength,null))>0;){let c=0;for(;c<s;)c+=sr(i,n,c,s-c)}}finally{ce(a)}}}catch(o){throw ce(i),or(t,{force:!0}),o}ce(i)}function Zo(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=X("reindex.publish.scip-output.deserialize",()=>e.map(o=>cr(I(o,{inputKind:"SCIP merge input",maxBytes:S})))),n=X("reindex.publish.scip-output.merge",()=>lr(r)),i=X("reindex.publish.scip-output.sanitize",()=>rr(n));return X("reindex.publish.scip-output.serialize",()=>ar(t,dr(i.index))),{documentCount:i.index.documents.length,externalSymbolCount:i.index.externalSymbols.length,inputCount:e.length,removedDefinitionOccurrences:i.removedDefinitionOccurrences,touchedDocuments:i.touchedDocuments}}var ir=1;function ur(e,t,r){let n=I(e,{inputKind:"SCIP normalization input",maxBytes:S}),i=oe(n),o=[];for(let c of P(n))c.fieldNumber===ir&&c.wireType===2&&o.push(c);if(o.length===0)throw new Error("Cannot rebase a SCIP index without metadata");if((i??"")!==t)throw new Error(`Cannot rebase SCIP project root: expected ${t}, got ${i??""}`);let a=`${e}.rebase-tmp`,s=Je(a,"w",384);try{let c=0;for(let d of o){se(s,n.subarray(c,d.fieldStart));let l=Zn(nr,n.subarray(d.valueStart,d.valueEnd));l.projectRoot=r;let f=ei(nr,l);se(s,Re(ir)),se(s,ie(f.byteLength)),se(s,f),c=d.fieldEnd}se(s,n.subarray(c))}catch(c){throw ce(s),or(a,{force:!0}),c}ce(s),Jn(a,e)}function se(e,t){let r=0;for(;r<t.byteLength;)r+=sr(e,t,r,t.byteLength-r)}function ii(e){let t=e[0]?.metadata;if(!t)return;let r=t.projectRoot;for(let n of e.slice(1)){let i=n.metadata?.projectRoot;if(r&&i&&i!==r)throw new Error(`Cannot merge SCIP indexes with different project roots: ${r} vs ${i}`)}return t}function oi(e){let t=new Map;for(let r of e){let n=t.get(r.relativePath);if(!n){t.set(r.relativePath,r);continue}t.set(r.relativePath,Xe(ti,{language:n.language||r.language,relativePath:n.relativePath||r.relativePath,occurrences:ai([...n.occurrences,...r.occurrences]),symbols:fr([...n.symbols,...r.symbols]),text:ci(n.text,r.text),positionEncoding:n.positionEncoding||r.positionEncoding}))}return[...t.values()]}function ai(e){let t=new Set,r=[];for(let n of e){let i=JSON.stringify(n);t.has(i)||(t.add(i),r.push(n))}return r}function fr(e){let t=new Map;for(let r of e){let n=t.get(r.symbol);if(!n){t.set(r.symbol,r);continue}t.set(r.symbol,Xe(ni,{symbol:n.symbol,documentation:di([...n.documentation,...r.documentation]),relationships:si([...n.relationships,...r.relationships]),kind:n.kind||r.kind,displayName:n.displayName||r.displayName,enclosingSymbol:n.enclosingSymbol||r.enclosingSymbol,signatureDocumentation:n.signatureDocumentation??r.signatureDocumentation}))}return[...t.values()]}function si(e){let t=new Set,r=[];for(let n of e){let i=[n.symbol,n.isReference?"1":"0",n.isImplementation?"1":"0",n.isTypeDefinition?"1":"0",n.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),r.push(n))}return r}function ci(e,t){return e?t?e.length>=t.length?e:t:e:t}function di(e){return[...new Set(e)]}import li from"better-sqlite3";var ui=25,fi=new Set(["typescript","javascript"]);function ia(e,t,r){let n=null;try{n=new li(e,{readonly:!0,fileMustExist:!0});let i=new Set(n.prepare("SELECT relative_path FROM documents").pluck().all().map(Me)),o=pi(t,r),a=new Set([...o.values()].flatMap(l=>[...l])),s=[...a].filter(l=>!i.has(l)).sort();if(s.length===0)return{state:"complete",expectedDocumentCount:a.size,actualDocumentCount:i.size};let c=new Set(s),d=r.filter(l=>[...o.get(l)??[]].some(f=>c.has(f)));return{state:"incomplete",expectedDocumentCount:a.size,actualDocumentCount:i.size,missingDocumentCount:s.length,missingPaths:s.slice(0,ui),affectedLanguages:d}}catch(i){return{state:"unavailable",reason:i instanceof Error?i.message:String(i)}}finally{n?.close()}}function pi(e,t){let r=new Map,n=t.filter(i=>fi.has(i));for(let i of n)r.set(i,new Set);for(let i of e.files){let o=Me(i.path);for(let a of n)Gt(o,[a])==="source"&&r.get(a).add(o)}return r}import{existsSync as mr,readdirSync as gr,rmSync as yr}from"fs";import{join as Q}from"path";import{create as Sr,fromBinary as Ir,toBinary as ma}from"@bufbuild/protobuf";import{deserializeSCIP as Ze,DocumentSchema as br,IndexSchema as xr,serializeSCIP as wr}from"@c4312/scip";import{existsSync as mi,mkdirSync as gi,renameSync as yi,writeFileSync as hi}from"fs";import{join as Si}from"path";function pr(e){gi(e.blobDir,{recursive:!0});let t=Si(e.blobDir,`${e.blobHash}.scipdoc`);if(mi(t)){let n=I(t,{maxBytes:J,inputKind:e.inputKind});if(n.byteLength!==e.bytes.byteLength||k(n)!==e.blobHash)throw new Error(`existing ${e.inputKind} is corrupt: ${e.relativePath}`);return}let r=`${t}.${process.pid}.${Date.now()}.tmp`;hi(r,e.bytes),yi(r,t)}var et=1,de="typescript-scip-fragments";function Sa(e){let t=new Set,r=[];for(let o of e){let a=Ee(o.relativePath);if(t.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(t.add(a),o.bytes===null)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${a}`);let s=Ir(br,o.bytes);if(s.relativePath!==a)throw new Error(`TypeScript fragment path mismatch: expected ${a}, got ${s.relativePath}`);r.push(s)}let n=wr(Sr(xr,{documents:r,externalSymbols:[]})),i=Ze(n);if(i.documents.length!==r.length||i.externalSymbols.length!==0)throw new Error("affected TypeScript SCIP index failed structural verification");return n}function Ii(e){let t=Q(e,de);return{rootDir:t,blobDir:Q(t,"blobs"),generationDir:Q(t,"generations")}}function vr(e){let t=bi(e);return xi(t.baseIndex,t.completeDocuments,"assembled")}function bi(e){let t=Ze(e.baseIndexBytes);Ei(t.metadata,Pi(e)),Ri(t.externalSymbols);let r=new Map;for(let s of e.fragments){let c=Ee(s.relativePath);if(r.has(c))throw new Error(`duplicate TypeScript fragment replacement: ${c}`);r.set(c,s)}if(r.size===0)throw new Error("TypeScript index assembly requires at least one replacement");let n=new Set,i=[],o=[],a=[];for(let s of t.documents){let c=Ee(s.relativePath);if(n.has(c))throw new Error(`duplicate TypeScript SCIP document path: ${c}`);n.add(c);let d=r.get(c);if(!d){i.push(s);continue}if(r.delete(c),d.bytes===null){a.push(c);continue}let l=hr(c,d.bytes);i.push(l),o.push(l)}for(let s of[...r.keys()].sort()){let c=r.get(s);if(c.bytes===null)continue;if(n.has(s))throw new Error(`duplicate TypeScript SCIP document path: ${s}`);n.add(s);let d=hr(s,c.bytes);i.push(d),o.push(d)}return{baseIndex:t,completeDocuments:i,affectedDocuments:o,deletedAffectedPaths:a}}function hr(e,t){let r=Ir(br,t);if(r.relativePath!==e)throw new Error(`TypeScript fragment path mismatch: expected ${e}, got ${r.relativePath}`);return r}function xi(e,t,r){let n=wr(Sr(xr,{metadata:e.metadata,documents:t,externalSymbols:[]})),i=Ze(n);if(i.documents.length!==t.length||i.externalSymbols.length!==0)throw new Error(`${r} TypeScript SCIP index failed structural verification`);return n}function Ia(e,t){let r=Ii(e);if(!mr(r.generationDir))return;let n=new Set(t.map(a=>vi(a))),i=gr(r.generationDir).filter(a=>a.endsWith(".json")),o=new Set;for(let a of i.filter(s=>n.has(s))){let s=wi(R(Q(r.generationDir,a),{maxBytes:v,inputKind:"TypeScript fragment manifest"}));for(let c of s.documents)o.add(`${c.blobHash}.scipdoc`)}for(let a of i)n.has(a)||yr(Q(r.generationDir,a),{force:!0});if(mr(r.blobDir))for(let a of gr(r.blobDir))o.has(a)||yr(Q(r.blobDir,a),{force:!0})}function wi(e){let t=JSON.parse(e);if(t.version!==et||typeof t.producerIdentity!="string"||typeof t.projectIdentity!="string"||typeof t.generationIdentity!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.documents))throw new Error("invalid TypeScript fragment generation manifest");let r=new Set;for(let n of t.documents){if(!n||typeof n.relativePath!="string"||typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash)||typeof n.byteLength!="number"||!Number.isInteger(n.byteLength)||n.byteLength<0||typeof n.documentIdentity!="string"||!n.documentIdentity)throw new Error("invalid TypeScript fragment record");if(Ee(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript fragment record");r.add(n.relativePath)}return t}function vi(e){if(!e)throw new Error("TypeScript fragment generation identity must be non-empty");return`${k(e)}.json`}function Ri(e){if(e.length>0)throw new Error("scip-typescript emitted external symbols; incremental document assembly is unsupported")}function Ei(e,t){if(!e||typeof e!="object")throw new Error("TypeScript SCIP shard has no producer metadata");let r=e,n=r.toolInfo??r.tool_info;if(!n||typeof n!="object")throw new Error("TypeScript SCIP shard has no producer tool identity");let i=n;if(i.name!=="scip-typescript"||i.version!==t)throw new Error("TypeScript SCIP shard producer identity changed")}function Pi(e){let t=e.packageVersion??e.runtime?.packageVersion;if(!t)throw new Error("scip-typescript package version is unavailable");return t}function Ee(e){if(!e||e.startsWith("/")||e.startsWith("\\")||e.includes("\\"))throw new Error(`invalid TypeScript SCIP document path: ${e}`);let t=e.split("/");if(t.includes("")||t.includes(".")||t.includes(".."))throw new Error(`invalid TypeScript SCIP document path: ${e}`);return e}import{existsSync as Pe,readdirSync as tt,rmSync as Rr}from"fs";import{join as D}from"path";var Te=1,le="typescript-scip-overlays",Er="typescript-project-v3:";function Ga(e){let t=Tr(e.cacheDir,e.previousGenerationIdentity);if(!t&&!e.baseShardCurrent)throw new Error("deferred TypeScript SCIP base has no matching overlay generation");if(t?.producerIdentity!==void 0&&t.producerIdentity!==e.producerIdentity)throw new Error("TypeScript overlay producer identity changed");let r=e.allowLegacyProjectIdentityMigration===!0&&t!==null&&!t.projectIdentity.startsWith(Er)&&e.projectIdentity.startsWith(Er);if(t&&t.projectIdentity!==e.projectIdentity&&!e.allowProjectIdentityChange&&!r)throw new Error("TypeScript overlay project identity changed");let n=new Map((t?.overlays??[]).map(a=>[a.relativePath,a])),i=new Set;for(let a of e.fragments){let s=it(a.relativePath);if(i.has(s))throw new Error(`duplicate TypeScript overlay: ${s}`);i.add(s),n.set(s,Ti(e.cacheDir,a))}if(i.size===0)throw new Error("TypeScript overlay generation requires affected documents");let o={version:Te,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:t?.baseGenerationIdentity??e.previousGenerationIdentity,generationIdentity:e.nextGenerationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),overlays:[...n.values()].sort((a,s)=>a.relativePath.localeCompare(s.relativePath))};return Gi(e.cacheDir,o),o}function Da(e){let t=Tr(e.cacheDir,e.generationIdentity);if(!t)throw new Error("TypeScript overlay generation is unavailable");let r=t.overlays.map(n=>{if(n.blobHash===null)return{relativePath:n.relativePath,bytes:null,occurrences:0,symbols:0,referenceFragments:[]};let i=I(D(ue(e.cacheDir),"blobs",`${n.blobHash}.scipdoc`),{maxBytes:J,inputKind:"TypeScript overlay blob"});if(i.byteLength!==n.byteLength||k(i)!==n.blobHash)throw new Error(`TypeScript overlay blob is corrupt: ${n.relativePath}`);return{relativePath:n.relativePath,bytes:i,occurrences:0,symbols:0,referenceFragments:[]}});return vr({packageVersion:e.packageVersion,baseIndexBytes:e.baseIndexBytes,fragments:r})}function Aa(e,t){let r=ue(e),n=D(r,"generations");if(!Pe(n))return;let i=new Set(t.map(nt)),o=new Set;for(let s of tt(n).filter(c=>i.has(c))){let c=rt(R(D(n,s),{maxBytes:v,inputKind:"TypeScript overlay manifest"}));for(let d of c.overlays)d.blobHash&&o.add(`${d.blobHash}.scipdoc`)}for(let s of tt(n))i.has(s)||Rr(D(n,s),{force:!0});let a=D(r,"blobs");if(Pe(a))for(let s of tt(a))o.has(s)||Rr(D(a,s),{force:!0})}function Tr(e,t){let r=D(ue(e),"generations",nt(t));if(!Pe(r))return null;let n=rt(R(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(n.generationIdentity!==t)throw new Error("TypeScript overlay generation identity does not match its path");return n}function Ti(e,t){let r=it(t.relativePath);if(t.bytes===null)return{relativePath:r,blobHash:null,byteLength:0};let n=Buffer.from(t.bytes),i=k(n);return pr({blobDir:D(ue(e),"blobs"),blobHash:i,bytes:n,relativePath:r,inputKind:"TypeScript overlay blob"}),{relativePath:r,blobHash:i,byteLength:n.byteLength}}function Gi(e,t){let r=D(ue(e),"generations",nt(t.generationIdentity));if(Pe(r)){let n=rt(R(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(Pr(n)!==Pr(t))throw new Error(`TypeScript overlay generation is immutable: ${t.generationIdentity}`);return}V(r,t,{spacing:2,trailingNewline:!0})}function rt(e){let t=JSON.parse(e);if(t.version!==Te||typeof t.producerIdentity!="string"||!t.producerIdentity||typeof t.projectIdentity!="string"||!t.projectIdentity||typeof t.baseGenerationIdentity!="string"||!t.baseGenerationIdentity||typeof t.generationIdentity!="string"||!t.generationIdentity||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.overlays))throw new Error("invalid TypeScript overlay manifest");let r=new Set;for(let n of t.overlays){if(!n||typeof n.relativePath!="string"||n.blobHash!==null&&(typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash))||!Number.isInteger(n.byteLength)||n.byteLength<0||n.blobHash===null&&n.byteLength!==0)throw new Error("invalid TypeScript overlay record");if(it(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript overlay record");r.add(n.relativePath)}return t}function ue(e){return D(e,le)}function nt(e){if(!e)throw new Error("TypeScript overlay generation identity must be non-empty");return`${k(e)}.json`}function Pr(e){return k(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:e.baseGenerationIdentity,generationIdentity:e.generationIdentity,overlays:e.overlays}))}function it(e){if(!e||e.startsWith("/")||e.includes("\\")||e.split("/").some(t=>!t||t==="."))throw new Error(`invalid TypeScript overlay path: ${e}`);if(e.split("/").includes(".."))throw new Error(`invalid TypeScript overlay path: ${e}`);return e}import{createHash as lt}from"crypto";import{closeSync as Di,existsSync as g,mkdirSync as Ai,openSync as Ci,readSync as Li,readdirSync as ut,renameSync as ct,rmSync as fe,statSync as B}from"fs";import{basename as ft,dirname as A,join as p,relative as Gr}from"path";var ki=Object.freeze({maxGenerations:2,maxLogicalBytes:2*1024*1024*1024});function Ar(e){let t=h(e.outputDb),r=ji(e);e.onStage?.("after-recovery-retained");let n=e.preserveOutputScip?e.outputScip:e.tempOutputScip,i=Ni(e,r),o=mt({generationRoot:t,databasePath:e.tempOutputDb,indexPath:g(n)?n:void 0,verifiedIndexArtifact:i,metadataPath:g(e.tempMetaPath)?e.tempMetaPath:void 0}),a=(e.now??(()=>new Date))().toISOString(),s={version:N,currentGeneration:o.identity,artifactSet:"immutable-v1",...r?{previousGeneration:r}:{},...e.publication?{publication:e.publication}:{},publishedAt:a},c=G(p(t,"state.json"),s,{spacing:2,trailingNewline:!0});e.onStage?.("after-pointer-handoff"),e.preserveOutputScip||st(e.tempOutputScip,e.outputScip),e.onStage?.("after-scip-handoff"),st(e.tempOutputDb,e.outputDb),e.onStage?.("after-database-handoff"),st(e.tempMetaPath,e.metaPath),e.onStage?.("after-metadata-handoff");let d=o.identity,l={...s,stableMirrors:pt(e.outputDb,e.outputScip)};G(p(t,"state.json"),l,{spacing:2,trailingNewline:!0});let f=Cr(e.outputDb,{now:e.now}),m=Z(o.directorySync,c.directorySync);return{currentGeneration:d,...r?{previousGeneration:r}:{},retention:f,achievedDurability:m==="synced"?"directory-durable":"file-flushed",directorySync:m}}function Oi(e,t,r,n=()=>new Date){if(!g(e))return null;let i=q(e),o=p(h(e),"state.json");if(i?.artifactSet==="immutable-v1"&&re(e,i.currentGeneration))return i;let a=h(e),s=!i&&g(o)?$i(r,e,t):void 0;if(s&&!ne(a,s))return null;let c=mt({generationRoot:a,databasePath:e,indexPath:g(t)?t:void 0,metadataPath:g(r)?r:void 0,forcedIdentity:i?.currentGeneration??s}),d={version:N,currentGeneration:c.identity,artifactSet:"immutable-v1",stableMirrors:pt(e,t),...i?.previousGeneration?{previousGeneration:i.previousGeneration}:{},...i?.publication?{publication:i.publication}:{},publishedAt:i?.publishedAt??n().toISOString()};return G(p(a,"state.json"),d,{spacing:2,trailingNewline:!0}),d}function Ba(e,t,r=()=>new Date){if(!g(e)||!g(t))throw new Error("metadata-only generation refresh requires stable database and metadata files");let n=q(e),i=h(e),o=mt({generationRoot:i,databasePath:e,indexPath:g(p(A(e),"index.scip"))?p(A(e),"index.scip"):void 0,metadataPath:t}),a=n&&n.currentGeneration!==o.identity?kr(e,n.currentGeneration):void 0,s={version:N,currentGeneration:o.identity,artifactSet:"immutable-v1",stableMirrors:pt(e,p(A(e),"index.scip")),...a?{previousGeneration:a}:{},...n?.publication?{publication:n.publication}:{},publishedAt:r().toISOString()};return G(p(h(e),"state.json"),s,{spacing:2,trailingNewline:!0}),Cr(e,{now:r}),s}function Cr(e,t={}){let r=Mi(t.limits),i=(t.now??(()=>new Date))().toISOString(),o=j(Ue(e),{waitMs:0});if(!o)return{state:"deferred",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:"another process owns local generation retention"};try{let a=q(e),s=Fi(e),c=Ht(e,s.map(x=>x.identity),{isProcessAlive:t.isProcessAlive??be,readProcessIdentity:t.readProcessIdentity??ye}),d=new Set(c.protectedGenerations);a?.currentGeneration&&d.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&d.add(a.previousGeneration.generationIdentity);let l=s.length,f=s.reduce((x,Oe)=>x+Oe.logicalBytes,0),m=0,T=0;for(let x of s){if(l<=r.maxGenerations&&f<=r.maxLogicalBytes)break;d.has(x.identity)||(t.onBeforeRemove?.(x.identity),fe(x.path,{recursive:!0,force:!0}),l-=1,f-=x.logicalBytes,m+=1,T+=x.logicalBytes)}let y=l>r.maxGenerations||f>r.maxLogicalBytes,L={state:y?"protected":m>0?"collected":"within-bounds",generationCount:l,logicalBytes:f,protectedGenerations:d.size,activeReaderLeases:c.activeLeases,staleReaderLeasesRemoved:c.staleLeasesRemoved,malformedReaderLeases:c.malformedLeases,removedGenerations:m,removedLogicalBytes:T,limits:r,at:i,...y?{reason:c.malformedLeases>0?"malformed reader ownership evidence fails closed":"retention bounds cannot be met without deleting a protected generation"}:{}};return Dr(e,L),L}catch(a){let s={state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:a instanceof Error?a.message:String(a)};try{Dr(e,s)}catch{}return s}finally{o.release()}}function Mi(e={}){let t={...ki,...e};if(!Number.isSafeInteger(t.maxGenerations)||t.maxGenerations<2)throw new Error("Local SQLite generation retention must keep at least current and previous generations.");if(!Number.isSafeInteger(t.maxLogicalBytes)||t.maxLogicalBytes<=0)throw new Error("Local SQLite generation byte retention must be a positive safe integer.");return t}function Fi(e){let t=h(e);return g(t)?ut(t,{withFileTypes:!0}).filter(r=>r.isDirectory()&&/^[a-f0-9]{64}$/.test(r.name)).map(r=>{let n=p(t,r.name),i=ne(t,r.name),o=i?i.database.size+(i.index?.size??0)+(i.metadata?.size??0):Lr(n);return{identity:r.name,path:n,logicalBytes:o,modifiedAtMs:B(n).mtimeMs}}).sort((r,n)=>r.modifiedAtMs-n.modifiedAtMs||r.identity.localeCompare(n.identity)):[]}function Lr(e){let t=0;for(let r of ut(e,{withFileTypes:!0})){let n=p(e,r.name);r.isDirectory()?t+=Lr(n):r.isFile()&&(t+=B(n).size)}return t}function Dr(e,t){V(p(h(e),"gc.json"),t,{spacing:2,trailingNewline:!0})}function De(e,t=p(A(e),"meta.json")){let r=p(h(e),"state.json");if(!g(r))return{state:"legacy",statePath:r};let n=q(e);if(!n)return{state:"invalid",statePath:r,reason:"generation state is malformed"};try{let i=re(e,n.currentGeneration),o=i!==null,a=i?_i(e,t,i,n):!1,s=n.previousGeneration?g(p(A(e),n.previousGeneration.databasePath)):!0;return!a||!o||!s?{state:"drifted",statePath:r,currentMatches:a,recoveryExists:s,generation:n,reason:o?a?"retained recovery database is missing":"stable database or metadata no longer matches the published generation":"published immutable generation is missing"}:{state:"current",statePath:r,currentMatches:a,recoveryExists:s,generation:n}}catch(i){return{state:"drifted",statePath:r,currentMatches:!1,recoveryExists:!1,generation:n,reason:i instanceof Error?i.message:String(i)}}}function _i(e,t,r,n){if(n.stableMirrors&&(n.stableMirrors.databaseFileIdentity!==$(e)||n.stableMirrors.indexFileIdentity!==void 0&&n.stableMirrors.indexFileIdentity!==$(p(A(e),"index.scip")))||!dt(e,r.database))return!1;let i=p(A(e),"index.scip");if(r.index&&!dt(i,r.index))return!1;if(!r.metadata)return!g(t);if(!g(t))return!1;let o=p(h(e),r.identity,r.metadata.file);return g(o)&&M(b(t,"reindex metadata"))===M(b(o,"immutable reindex metadata"))}function dt(e,t){return g(e)&&B(e).isFile()&&B(e).size===t.size}function ji(e){let t=Oi(e.outputDb,e.outputScip,e.metaPath);return t?kr(e.outputDb,t.currentGeneration):void 0}function Ni(e,t){if(!e.preserveOutputScip)return;if(!t)throw new Error("deferred SCIP publication requires an accepted immutable generation");let r=De(e.outputDb,e.metaPath);if(r.state!=="current"||r.generation.currentGeneration!==t.generationIdentity){let i=r.state==="current"?"generation identity changed":"reason"in r?r.reason:`generation state is ${r.state}`;throw new Error(`deferred SCIP publication requires a verified accepted companion: ${i}`)}let n=re(e.outputDb,t.generationIdentity);if(!n?.index||!dt(e.outputScip,n.index))throw new Error("deferred SCIP publication requires the verified accepted index artifact");return n.index}function pt(e,t){return{databaseFileIdentity:$(e),...g(t)?{indexFileIdentity:$(t)}:{}}}function kr(e,t){let r=p(h(e),t),n=p(r,ft(e)),i=p(r,"meta.json");return{generationIdentity:t,databasePath:Gr(A(e),n),...g(i)?{metadataPath:Gr(A(e),i)}:{}}}function qi(e){if(g(e))for(let t of ut(e,{withFileTypes:!0}))t.isDirectory()&&t.name.endsWith(".tmp")&&fe(p(e,t.name),{recursive:!0,force:!0})}function $i(e,t,r=p(A(t),"index.scip")){let n=lt("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(Ge(t)),g(r)&&n.update(`\0${Ge(r)}`),g(e)&&n.update(`\0${M(b(e,"reindex metadata"))}`),n.digest("hex")}function mt(e){let t=ot(e.databasePath),r=e.indexPath?e.verifiedIndexArtifact?Wi(e.indexPath,e.verifiedIndexArtifact):ot(e.indexPath):void 0,n=e.metadataPath?ot(e.metadataPath):void 0,i=e.forcedIdentity??Bi(t,r,e.metadataPath),o=p(e.generationRoot,i),a=p(o,ve);if(g(a)){let d=ne(e.generationRoot,i);if(d&&Or(o,d.database,t)&&Ui(o,d.index,r)&&Hi(o,d.metadata,e.metadataPath))return{identity:i,directorySync:O(e.generationRoot)};throw new Error(`SQLite generation ${i} already exists with different or corrupt artifacts.`)}let s=[Ie(e.generationRoot)];qi(e.generationRoot);let c=`${o}.${process.pid}.${Date.now()}.tmp`;fe(c,{recursive:!0,force:!0}),Ai(c,{recursive:!0});try{s.push(at(e.databasePath,p(c,t.file))),r&&e.indexPath&&s.push(at(e.indexPath,p(c,r.file))),n&&e.metadataPath&&s.push(at(e.metadataPath,p(c,n.file)));let d=G(p(c,ve),{version:ze,identity:i,database:t,...r?{index:r}:{},...n?{metadata:n}:{}},{spacing:2,trailingNewline:!0});d.directorySync!=="not-requested"&&s.push(d.directorySync),s.push(O(c)),ct(c,o),s.push(O(e.generationRoot))}finally{fe(c,{recursive:!0,force:!0})}return{identity:i,directorySync:Z(...s)}}function Bi(e,t,r){let n=lt("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(e.sha256),t&&n.update(`\0${t.sha256}`),r&&n.update(`\0${M(b(r,"reindex metadata"))}`),n.digest("hex")}function ot(e){return{file:ft(e),size:B(e).size,sha256:Ge(e)}}function Wi(e,t){if(t.file!==ft(e)||B(e).size!==t.size)throw new Error(`verified SQLite generation artifact changed before publication: ${e}`);return t}function Ge(e){let t=lt("sha256"),r=Ci(e,"r"),n=Buffer.allocUnsafe(1024*1024);try{for(;;){let i=zi(r,n);if(i===0)break;t.update(n.subarray(0,i))}}finally{Di(r)}return t.digest("hex")}function zi(e,t){let r=0;for(;r<t.length;){let n=Li(e,t,r,t.length-r,null);if(r+=n,n===0)break}return r}function at(e,t){return xe(e,t,{mode:292})}function Or(e,t,r){let n=p(e,t.file);return t.file===r.file&&t.size===r.size&&t.sha256===r.sha256&&g(n)&&B(n).size===t.size&&Ge(n)===t.sha256}function Ui(e,t,r){return!t||!r?t===r:Or(e,t,r)}function Hi(e,t,r){if(!t||!r)return t===void 0&&r===void 0;let n=p(e,t.file);return g(n)&&M(b(n,"stored reindex metadata"))===M(b(r,"candidate reindex metadata"))}function st(e,t){fe(`${t}.tmp-replace`,{force:!0}),ct(e,`${t}.tmp-replace`),ct(`${t}.tmp-replace`,t)}import{createHash as Wr,randomUUID as Zi}from"crypto";import{existsSync as _,lstatSync as ht,mkdirSync as K,mkdtempSync as zr,readdirSync as Ur,realpathSync as Hr,renameSync as z,rmSync as F,statSync as ke}from"fs";import{dirname as St,join as u,resolve as W}from"path";import{setTimeout as eo}from"timers/promises";import{pathToFileURL as jr}from"url";import to from"better-sqlite3";import{lstatSync as Vi,readdirSync as Yi}from"fs";import{join as Qi,relative as Ki,resolve as gt,sep as Ji}from"path";var pe=1,yt="language-indexes",Mr=["index.db","index.scip","meta.json"],Fr=[yt,de,le];function Ae(e){let t=[];for(let r of Mr)Xi(e,r),t.push(r);for(let r of Fr)_r(e,r,t);return{version:pe,files:t.sort()}}function Ce(e){if(!e||e.includes("\0")||e.startsWith("/")||e.includes("\\"))throw new Error(`invalid index artifact path: ${e||"<empty>"}`);let t=e.split("/");if(t.some(n=>!n||n==="."||n===".."))throw new Error(`invalid index artifact path: ${e}`);let r=t[0];if(!Mr.includes(e)&&!Fr.includes(r))throw new Error(`index artifact path is not shareable: ${e}`);return e}function C(e,t){let r=Ce(t),n=gt(e),i=gt(n,...r.split("/"));if(i!==n&&!i.startsWith(`${n}${Ji}`))throw new Error(`index artifact escapes cache: ${t}`);return i}function _r(e,t,r){let n=Qi(e,t),i;try{i=Yi(n,{withFileTypes:!0,encoding:"utf8"})}catch{return}for(let o of i){let a=`${t}/${o.name}`;if(o.isSymbolicLink())throw new Error(`index artifact cannot be a symlink: ${a}`);o.isDirectory()?_r(e,a,r):o.isFile()&&r.push(Ce(a))}}function Xi(e,t){let r=C(e,t),n;try{n=Vi(r)}catch{throw new Error(`required index artifact is missing: ${t}`)}if(!n.isFile()||n.isSymbolicLink())throw new Error(`required index artifact is not a regular file: ${t}`);if(Ki(gt(e),r).startsWith(".."))throw new Error(`index artifact escapes cache: ${t}`)}var It=1,Nr="SCIP_QUERY_SHARED_CACHE",ro=2,Le=JSON.stringify({cliVersion:kt,artifactCatalogVersion:pe,postIndexAugmentationSchemaVersion:ro,sqliteGenerationStoreVersion:N,typescriptFragmentStoreVersion:et,typescriptOverlayStoreVersion:Te}),bt="manifest.json",Vr="shared-cache.json";var xt=[yt,de,le];function no(e,t){if(!e.clean||!e.treeOid)return;let r=Zr(JSON.stringify({version:It,repositoryId:e.repositoryId,treeOid:e.treeOid,fingerprint:At(t),producerIdentity:Le}));return{repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:t,producerIdentity:Le,generationId:r,repositoryCacheDir:_e(e.repositoryId)}}function xs(e,t,r){if(!go(r))return!1;let n=no(e,r);if(!n)return!1;try{let i=lo(t);if(!i||i.repositoryId!==e.repositoryId||i.worktreeId!==e.worktreeId)return!1;let o=JSON.parse(R(u(n.repositoryCacheDir,"worktrees",`${i.worktreeId}.json`),{inputKind:"worktree cache lease",maxBytes:v}));return o.version!==1||o.repositoryId!==i.repositoryId||o.worktreeId!==i.worktreeId||W(o.projectRoot)!==W(e.projectRoot)||o.treeOid!==e.treeOid||W(o.localCacheDir)!==W(t)||o.ownershipChecksum!==wt(o)||o.baseGenerationId!==n.generationId||o.activeGenerationId!==n.generationId?!1:U(n,!1)!==null}catch{return!1}}function ws(e,t,r){if(process.env[Nr]==="0")return`${Nr}=0`;if(!je(r))return"explicit cache or database override";if(Ne(St(t))!==Ne(Mt(e))||t!==u(St(t),"index.db"))return"index database is outside the managed worktree cache"}function vs(e,t,r){if(!je(t))return;let n=r??qt(e);return n?u(_e(n.repositoryId),"evidence.db"):void 0}function U(e,t=!0){let r=vt(e),n;try{n=Yr(R(u(r,bt),{inputKind:"shared-generation manifest",maxBytes:v}))}catch{return null}if(n.generationId!==e.generationId||n.repositoryId!==e.repositoryId||n.treeOid!==e.treeOid||n.producerIdentity!==e.producerIdentity||!he(n.fingerprint,e.fingerprint)||!so(r))return null;if(!t)return n;try{for(let i of n.artifacts){let o=C(r,i.path),a=ke(o);if(!a.isFile()||a.size!==i.size||H(o,{inputKind:"shared-generation artifact",maxBytes:S})!==i.sha256)return null}}catch{return null}return n}function Rs(e,t,r,n){if(!e.treeOid)return null;let i=qe(t,r),o=u(Ot(),"repositories",e.repositoryId),a;try{let d=ht(o);if(!d.isDirectory()||d.isSymbolicLink())return null;a=Hr(o)}catch{return null}let s=u(a,"generations"),c=[];try{for(let d of Ur(s)){if(!/^[a-f0-9]{64}$/.test(d))continue;let l=u(s,d),f;try{f=ht(l)}catch{continue}if(!(!f.isDirectory()||f.isSymbolicLink()))try{let m=Yr(R(u(l,bt),{inputKind:"shared-generation baseline manifest",maxBytes:v}));m.generationId===d&&m.repositoryId===e.repositoryId&&m.producerIdentity===Le&&co(m.fingerprint,i)&&c.push(m)}catch{continue}}}catch{return null}c.sort((d,l)=>{let f=d.treeOid===e.treeOid?0:1,m=l.treeOid===e.treeOid?0:1;if(f!==m)return f-m;if(n){let y=Br(d.fingerprint,n)-Br(l.fingerprint,n);if(y!==0)return y}return Date.parse(l.createdAt)-Date.parse(d.createdAt)||d.generationId.localeCompare(l.generationId)});for(let d of c){let l={repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:d.treeOid,fingerprint:d.fingerprint,producerIdentity:d.producerIdentity,generationId:d.generationId,repositoryCacheDir:a},f=U(l);if(f)return{snapshot:l,manifest:f}}return null}function Es(e){let t=j(u(e.snapshot.repositoryCacheDir,"locks",`${e.snapshot.generationId}.publish.lock`));if(!t)throw new Error(`shared generation publication is already in progress for ${e.snapshot.generationId}`);try{return io(e)}finally{t.release()}}function io(e){let t=U(e.snapshot);if(t)return qr(e.snapshot,t);if(!Xr(e.sourceCacheDir,e.sourceProjectRoot,e.snapshot.fingerprint))throw new Error("source index is incomplete, incompatible, or corrupt");let r=$r(e.sourceCacheDir);if(!r)throw new Error("source index artifacts are incomplete");let n=Ae(e.sourceCacheDir),i=u(e.snapshot.repositoryCacheDir,"generations"),o=[Ie(i)],a=zr(u(i,`.tmp-${process.pid}-`));try{let s=[];for(let y of n.files){let L=C(e.sourceCacheDir,y),x=C(a,y);o.push(ge(L,x,292)),e.onPublicationStage?.("after-artifact-flushed",y);let Oe=ke(x).size;s.push({path:y,size:Oe,sha256:H(x,{inputKind:"staged shared-generation artifact",maxBytes:S})})}let c=oe(I(u(a,"index.scip"),{inputKind:"staged shared SCIP index",maxBytes:S}));if(!c)throw new Error("shared SCIP generation has no project root metadata");let d=Rt(e.sourceProjectRoot);if(c!==d)throw new Error("shared SCIP generation root does not match its source worktree");if($r(e.sourceCacheDir)!==r||e.sourceStillValid&&!e.sourceStillValid())throw new Error("source index changed while staging a shared generation");let l={version:It,artifactCatalogVersion:pe,generationId:e.snapshot.generationId,repositoryId:e.snapshot.repositoryId,treeOid:e.snapshot.treeOid,fingerprint:e.snapshot.fingerprint,producerIdentity:e.snapshot.producerIdentity,sourceProjectRoot:e.sourceProjectRoot,scipProjectRoot:c,createdAt:(e.now??(()=>new Date))().toISOString(),artifacts:s.sort((y,L)=>y.path.localeCompare(L.path))},f=G(u(a,bt),l,{spacing:2,trailingNewline:!0});f.directorySync!=="not-requested"&&o.push(f.directorySync),e.onPublicationStage?.("after-manifest-flushed"),o.push(O(a)),e.onPublicationStage?.("after-staging-directory-synced");let m=vt(e.snapshot);try{if(_(m)&&!U(e.snapshot)){let y=`${m}.corrupt-${process.pid}-${Date.now()}`;z(m,y),F(y,{recursive:!0,force:!0})}z(a,m)}catch(y){let L=U(e.snapshot);if(L)return qr(e.snapshot,L);throw y}e.onPublicationStage?.("after-generation-renamed"),o.push(O(i)),e.onPublicationStage?.("after-generations-directory-synced");let T=Z(...o);return{kind:"published",manifest:l,achievedDurability:T==="synced"?"directory-durable":"file-flushed",directorySync:T}}finally{F(a,{recursive:!0,force:!0})}}function qr(e,t){let r=O(u(e.repositoryCacheDir,"generations"));return{kind:"existing",manifest:t,achievedDurability:r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function Ps(e){let t=vt(e.snapshot);K(e.targetCacheDir,{recursive:!0});let r=j(u(e.targetCacheDir,"cache-lifecycle.lock"),{waitMs:e.lockWaitMs??3e4});if(!r)throw new Error("timed out waiting for another cache hydration");let n,i,o=!1;try{n=zr(u(e.targetCacheDir,".shared-hydrate-")),mo(e.manifest,e.snapshot);for(let c of e.manifest.artifacts){let d=C(t,c.path),l=C(n,c.path);if(ge(d,l),ke(l).size!==c.size||H(l,{inputKind:"hydrated shared-generation artifact",maxBytes:S})!==c.sha256)throw new Error(`shared artifact is corrupt: ${c.path}`)}let a=Rt(e.targetProjectRoot);if(a!==e.manifest.scipProjectRoot)for(let c of e.manifest.artifacts)c.path.endsWith(".scip")&&ur(C(n,c.path),e.manifest.scipProjectRoot,a);if(!Xr(n,e.targetProjectRoot,e.snapshot.fingerprint,!1))throw new Error("staged shared generation failed completeness or integrity validation");i=uo(e.targetCacheDir,n),o=!0,fo(n,e.targetCacheDir,i),Ar({tempOutputScip:u(n,"index.scip"),tempOutputDb:u(n,"index.db"),tempMetaPath:u(n,"meta.json"),outputScip:u(e.targetCacheDir,"index.scip"),outputDb:u(e.targetCacheDir,"index.db"),metaPath:u(e.targetCacheDir,"meta.json"),now:e.now});let s=De(u(e.targetCacheDir,"index.db"),u(e.targetCacheDir,"meta.json"));if(s.state==="invalid"||s.state==="drifted")throw new Error(`hydrated SQLite generation failed validation: ${s.reason}`);e.persistLease!==!1&&oo(e.snapshot,e.targetCacheDir,e.action??"attached",e.now)}catch(a){throw o&&i&&po(e.targetCacheDir,i),a}finally{n&&F(n,{recursive:!0,force:!0}),r.release()}}async function Ts(e,t={}){let r=t.timeoutMs??3e4,n=t.pollMs??100,i=t.now??Lt,o=i()+r,a=u(e.repositoryCacheDir,"locks"),s=u(a,`${e.generationId}.lock`),c=d=>{if(!d||typeof d!="object"||Array.isArray(d))return null;let l=d.pid;return typeof l=="number"&&Number.isSafeInteger(l)&&l>0?{pid:l}:null};for(;i()<=o;){if(U(e))return{kind:"generation-ready"};let d=Ft(s,{kind:"shared-generation-build",detail:{generationId:e.generationId},parseLegacy:c});if(d.kind==="acquired")return{kind:"owner",release:()=>d.lock.release()};let l=o-i();if(l<=0)break;await eo(Math.min(n,l))}return U(e)?{kind:"generation-ready"}:{kind:"timeout"}}function oo(e,t,r,n=void 0){let i={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,activeGenerationId:e.generationId,lastAction:r,lastSeenAt:(n??(()=>new Date))().toISOString()},o={...i,ownershipChecksum:wt(i)};return Kr(e.repositoryCacheDir,o,!0),o}function Gs(e,t,r=void 0){let n={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,lastAction:"overlay",lastReason:`private cache forked from shared baseline ${e.generationId}`,lastSeenAt:(r??(()=>new Date))().toISOString()},i={...n,ownershipChecksum:wt(n)};return Kr(e.repositoryCacheDir,i,!0),i}function wt(e){return Zr(JSON.stringify({version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:W(e.projectRoot),localCacheDir:W(e.localCacheDir)}))}function Yr(e){let t=JSON.parse(e);if(t.version!==It||t.artifactCatalogVersion!==pe||typeof t.generationId!="string"||!/^[a-f0-9]{64}$/.test(t.generationId)||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.treeOid!="string"||!t.treeOid||typeof t.producerIdentity!="string"||t.producerIdentity!==Le||typeof t.sourceProjectRoot!="string"||typeof t.scipProjectRoot!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!t.fingerprint||!Array.isArray(t.artifacts))throw new Error("invalid shared generation manifest");let r=new Set;for(let n of t.artifacts){if(!n||typeof n.path!="string"||typeof n.size!="number"||n.size<0||typeof n.sha256!="string"||!/^[a-f0-9]{64}$/.test(n.sha256))throw new Error("invalid shared generation artifact");if(Ce(n.path),r.has(n.path))throw new Error(`duplicate shared generation artifact: ${n.path}`);r.add(n.path)}for(let n of["index.db","index.scip","meta.json"])if(!r.has(n))throw new Error(`shared generation is missing ${n}`);return t}function ge(e,t,r=384){return xe(e,t,{mode:r})}function ao(e,t,r){K(e,{recursive:!0}),G(u(e,Vr),{version:1,repositoryId:t,worktreeId:r},{spacing:2,trailingNewline:!0})}function $r(e){try{let t=Ae(e),r=Wr("sha256");for(let n of t.files){let i=C(e,n),o=ke(i).size;r.update(n).update("\0").update(String(o)).update("\0"),Et(i,{inputKind:"source-generation artifact",maxBytes:S},a=>r.update(a)),r.update("\0")}return r.digest("hex")}catch{return null}}function Qr(e){try{let t=Se(R(u(e,"meta.json"),{inputKind:"reindex metadata",maxBytes:v}));return(t.kind==="legacy"||t.kind==="supported")&&t.capabilities.publishableGeneration?t.metadata:void 0}catch{return}}function so(e){return Qr(e)?.scipCompanion!=="deferred"}function co(e,t){let r=qe(e.languages,e);return JSON.stringify(r)===JSON.stringify(t)}function Br(e,t){let r=new Map(e.files.map(o=>[o.path,`${o.size}\0${o.hash}`])),n=new Map(t.files.map(o=>[o.path,`${o.size}\0${o.hash}`])),i=0;for(let[o,a]of r)n.get(o)!==a&&(i+=1);for(let o of n.keys())r.has(o)||(i+=1);return i}function vt(e){return u(e.repositoryCacheDir,"generations",e.generationId)}function lo(e){let t=JSON.parse(R(u(e,Vr),{inputKind:"worktree cache pointer",maxBytes:v}));return t.version!==1||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.worktreeId!="string"||!/^[a-f0-9]{24}$/.test(t.worktreeId)?null:{version:t.version,repositoryId:t.repositoryId,worktreeId:t.worktreeId}}function Kr(e,t,r){let n=_t(e,{waitMs:5e3});if(!n)throw new Error("repository cache cleanup is busy");try{if(r){let o=t.activeGenerationId??t.baseGenerationId;if(!o||!_(u(e,"generations",o)))throw new Error("shared generation disappeared before its lease was attached")}let i=u(e,"worktrees");K(i,{recursive:!0}),G(u(i,`${t.worktreeId}.json`),t,{spacing:2,trailingNewline:!0}),ao(t.localCacheDir,t.repositoryId,t.worktreeId)}finally{n.release()}}function uo(e,t){let r=u(t,".rollback"),n=new Map,i=new Map;K(r,{recursive:!0});for(let s of["index.scip","index.db","meta.json"]){let c=u(e,s),d=_(c);n.set(s,d),d&&ge(c,u(r,"stable",s))}for(let s of xt){let c=u(e,s),d=_(c);if(d){let l=ht(c);if(!l.isDirectory()||l.isSymbolicLink())throw new Error(`managed artifact path is not a directory: ${s}`)}i.set(s,d)}let o=u(e,te),a=_(o);return a&&Jr(o,u(r,"sqlite-generations")),{root:r,stableFiles:n,managedDirectories:i,generationStoreExisted:a}}function fo(e,t,r){for(let n of xt){let i=u(t,n);if(r.managedDirectories.get(n)){let a=u(r.root,"managed",n);K(St(a),{recursive:!0}),z(i,a)}let o=u(e,n);_(o)&&z(o,i)}}function po(e,t){for(let i of xt){let o=u(e,i),a=u(t.root,"managed",i);t.managedDirectories.get(i)?_(a)&&(F(o,{recursive:!0,force:!0}),z(a,o)):F(o,{recursive:!0,force:!0})}for(let[i,o]of t.stableFiles){let a=u(e,i);if(!o){F(a,{force:!0});continue}let s=`${a}.shared-restore-${Zi()}`;ge(u(t.root,"stable",i),s),F(a,{force:!0}),z(s,a)}let r=u(e,te);F(r,{recursive:!0,force:!0});let n=u(t.root,"sqlite-generations");t.generationStoreExisted&&_(n)&&z(n,r)}function Jr(e,t){K(t,{recursive:!0});for(let r of Ur(e,{withFileTypes:!0})){let n=u(e,r.name),i=u(t,r.name);if(r.isSymbolicLink())throw new Error(`managed cache backup cannot contain a symlink: ${n}`);r.isDirectory()?Jr(n,i):r.isFile()&&ge(n,i)}}function mo(e,t){if(e.generationId!==t.generationId||e.repositoryId!==t.repositoryId||e.treeOid!==t.treeOid||e.producerIdentity!==t.producerIdentity||!he(e.fingerprint,t.fingerprint))throw new Error("shared generation manifest does not match the requested snapshot")}function Xr(e,t,r,n=!0,i=!0){try{let o=Qr(e);if(!o||o.scipCompanion==="deferred"||!he(Dt(o.fingerprint),r)||JSON.stringify([...o.indexedLanguages??[]].sort())!==JSON.stringify([...r.languages].sort()))return me("source validation rejected metadata"),!1;let a=Ae(e),s=De(u(e,"index.db"),u(e,"meta.json"));if(n?s.state!=="current":s.state==="invalid"||s.state==="drifted")return me(`source validation rejected SQLite generation state ${s.state}`),!1;let c=new to(u(e,"index.db"),{readonly:!0,fileMustExist:!0});try{if(i){if(c.pragma("quick_check(1)",{simple:!0})!=="ok")return!1}else c.pragma("schema_version",{simple:!0})}finally{c.close()}let d=Rt(t),f=(i?a.files.filter(m=>m.endsWith(".scip")):["index.scip"]).every(m=>{let T=oe(I(C(e,m),{inputKind:"shared SCIP validation artifact",maxBytes:S}));return T!==d&&me(`source validation rejected SCIP root for ${m}: ${String(T)}`),T===d});return f||me("source validation rejected SCIP project roots"),f}catch(o){return me(`source validation failed: ${o instanceof Error?o.message:String(o)}`),!1}}function me(e){process.env.SCIP_QUERY_DEBUG&&console.error(`shared-cache: ${e}`)}function Rt(e){try{return jr(Hr(e)).href}catch{return jr(W(e)).href}}function go(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===3&&Array.isArray(t.languages)&&typeof t.pnpmWorkspaces=="boolean"&&(t.typescriptProjectMode==="single"||t.typescriptProjectMode==="workspace")&&Array.isArray(t.typescriptProjects)&&Array.isArray(t.files)&&t.files.every(r=>r!==null&&typeof r=="object"&&typeof r.path=="string"&&typeof r.size=="number"&&typeof r.hash=="string"&&(r.semanticHash===void 0||typeof r.semanticHash=="string"))}function Zr(e){return Wr("sha256").update(e).digest("hex")}export{Po as a,ln as b,To as c,$ as d,ko as e,P as f,ie as g,Re as h,Bo as i,Jo as j,Xo as k,Zo as l,ia as m,Sa as n,Ia as o,Ga as p,Da as q,Aa as r,Ar as s,Oi as t,Ba as u,De as v,no as w,xs as x,ws as y,vs as z,U as A,Rs as B,Es as C,Ps as D,Ts as E,oo as F,Gs as G,wt as H};
2
- //# sourceMappingURL=chunk-IZDPJ2QI.js.map
@@ -1,5 +0,0 @@
1
- import{g as x}from"./chunk-B5D7QPBE.js";import{l as m,y as b}from"./chunk-3L2ZBPEX.js";var y=new Set(["call","call_expression","command","command_call","function_call_expression","invocation_expression","macro_invocation","method_call","method_invocation","new_expression","object_creation_expression"]);function h(n,e,t,r){if(!Number.isSafeInteger(t)||t<0)return null;if(!Number.isSafeInteger(r)||r<0)throw new RangeError(`contextLines must be a non-negative safe integer; received ${r}`);let i=m(n,e);if(i.length===0||t>=i.length)return null;let o=Math.max(0,t-r),c=Math.min(i.length-1,t+r);return{relativePath:e,startLine:o,endLine:c,focusLine:t,source:i.slice(o,c+1).join(`
2
- `)}}function F(n,e,t,r,i){let o=h(n,e,t,r);if(!o)return null;let c=b(n,e)?.rootNode??null;if(!c)return{...o,kind:"bounded-context"};let s=_(c,t,i);if(s.length!==1)return{...o,kind:s.length===0?"non-call-reference":"bounded-context"};let l=s[0],a=m(n,e),u=Math.max(0,l.startPosition.row),S=l.endPosition.column===0?l.endPosition.row-1:l.endPosition.row,p=Math.min(a.length-1,Math.max(u,S));return{relativePath:e,startLine:u,endLine:p,focusLine:t,source:a.slice(u,p+1).join(`
3
- `),kind:"complete-call-expression"}}function L(n,e,t,r,i=6){if(!Number.isSafeInteger(r)||r<=0)throw new RangeError(`maxLines must be a positive safe integer; received ${r}`);let o=m(n,e);if(o.length===0||t<0||t>=o.length)return null;let c=x(n,e,t);if(!c){let d=h(n,e,t,i);return d?{...d,unitType:null,unitStartLine:d.startLine,unitEndLine:d.endLine,omittedLines:0}:null}let s=c.startLine,l=c.endLine,a=l-s+1,u=Math.min(a,r),S=t-s-Math.floor(u/2),p=Math.max(0,Math.min(a-u,S)),f=s+p,g=f+u-1;return{relativePath:e,startLine:f,endLine:g,focusLine:t,source:o.slice(f,g+1).join(`
4
- `),unitType:c.type,unitStartLine:s,unitEndLine:l,omittedLines:a-u}}function _(n,e,t){let r=[];return N(n,e,t,r),r.filter(i=>!r.some(o=>o!==i&&o.startIndex>=i.startIndex&&o.endIndex<=i.endIndex))}function N(n,e,t,r){if(M(n,e)){y.has(n.type)&&w(n)===t&&r.push(n);for(let i of n.namedChildren)N(i,e,t,r)}}function w(n){let e=n.childForFieldName("function")??n.childForFieldName("constructor")??n.childForFieldName("method")??n.childForFieldName("name")??n.namedChild(0);return e?e.text.match(/[\p{L}_$][\p{L}\p{N}_$!?-]*/gu)?.at(-1)??null:null}function M(n,e){return n.startPosition.row<=e&&n.endPosition.row>=e}export{F as a,L as b};
5
- //# sourceMappingURL=chunk-J66VOFW6.js.map
@@ -1,2 +0,0 @@
1
- import{j as i}from"./chunk-7F45LJKI.js";var c=new Set(["aix","android","darwin","freebsd","haiku","linux","openbsd","sunos","win32","cygwin","netbsd"]);function d(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let t=n;return t.version!==1||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.platform!="string"||!c.has(t.platform)||typeof t.startToken!="string"||t.startToken.trim()===""?null:{version:1,pid:t.pid,platform:t.platform,startToken:t.startToken}}function p(n,t){return n.version===t.version&&n.pid===t.pid&&n.platform===t.platform&&n.startToken===t.startToken}import{execFileSync as y}from"child_process";import{platform as P}from"os";var I=1e3,a=16*1024,s;function N(n,t=u){if(!Number.isSafeInteger(n)||n<=0)return null;let e=n===process.pid&&t===u;if(e&&s)return{...s};try{let r=b(n,t);if(!r)return null;let o={version:1,pid:n,platform:t.platform,startToken:r};return e&&(s=o),{...o}}catch{return null}}function b(n,t){if(t.platform==="linux"||t.platform==="android")return T(t.readFile(`/proc/${n}/stat`));if(t.platform==="win32"){let e=`([DateTimeOffset](Get-Process -Id ${n} -ErrorAction Stop).StartTime).ToUnixTimeMilliseconds()`;return m(t.run("powershell.exe",["-NoProfile","-NonInteractive","-Command",e]))}return t.platform==="darwin"||t.platform==="freebsd"||t.platform==="openbsd"||t.platform==="netbsd"?m(t.run("ps",["-p",String(n),"-o","lstart="])):null}function T(n){let t=n.lastIndexOf(")");if(t<0)return null;let r=n.slice(t+1).trim().split(/\s+/)[19];return r&&/^\d+$/.test(r)?r:null}function m(n){let t=n.trim();return t===""?null:t}var u={platform:P(),readFile(n){return i(n,{maxBytes:a,inputKind:"process identity pseudo-file"})},run(n,t){return y(n,[...t],{encoding:"utf8",timeout:I,maxBuffer:a,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"]})}};function h(){return performance.now()}function _(n,t,e,r,o,l){if(n>0)return e;let f=Math.max(0,Math.min(l,t-1));return Math.min(o,r*2**f)}export{d as a,p as b,N as c,h as d,_ as e};
2
- //# sourceMappingURL=chunk-JFMEXGFE.js.map
@@ -1,3 +0,0 @@
1
- import{c as p}from"./chunk-6HFCYNYE.js";import{b as D}from"./chunk-BOJ5SVE2.js";import{a as m}from"./chunk-BGBBVSH4.js";import{d as g,u as B}from"./chunk-N2ZSIIGR.js";import{b as f}from"./chunk-ODDUPDP7.js";import{k as y,n as d}from"./chunk-FESCRNVV.js";import{createHash as A}from"crypto";var h=3;function H(e,t={}){let{scope:o,maxLoc:n=15,minLoc:i=h,limit:r,scanLimit:s}=t,l=p(e),u=L(e,{scope:o,maxLoc:n,scanLimit:s}).map(a=>x(e,a,l,i)).filter(a=>a!==null),c=v(u);return r?c.slice(0,r):c}function M(e,t,o={}){let{scope:n,maxLoc:i=15,minLoc:r=h,scanLimit:s}=o,l=p(e),u=L(e,{scope:n,maxLoc:i,scanLimit:s}).map(a=>x(e,a,l,r)).filter(a=>a!==null),c=u.find(a=>a.symbol===t);return c?u.filter(a=>a.symbol!==c.symbol&&a.normalizedBody===c.normalizedBody&&a.file!==c.file).sort(z).map(({normalizedBody:a,...C})=>C):[]}function I(e){let t=S(e);return f(t).replace(/\s+/g,"")}function v(e){let t=new Map;for(let n of e){if(n.normalizedBody.length<8)continue;let i=F(n.normalizedBody),r=t.get(i)??[];r.push(n),t.set(i,r)}let o=[];for(let[n,i]of t){let r=new Set(i.map(l=>l.file));if(i.length<2||r.size<2)continue;let s=[...i].sort(z).map(({normalizedBody:l,...u})=>u);o.push({hash:n,canonical:s[0],functions:s})}return o.sort((n,i)=>{let r=i.functions.length-n.functions.length;if(r!==0)return r;let s=b(i)-b(n);return s!==0?s:n.canonical.file.localeCompare(i.canonical.file)}),o}function L(e,t){let o=B(e,{scope:t.scope}).filter(n=>n.isFunctionLike&&!e.isIgnored(n.relativePath)).filter(n=>!d(e,n.relativePath,n.startLine,"similar")).filter(n=>m(n)<=t.maxLoc);return o.sort((n,i)=>m(i)-m(n)||n.relativePath.localeCompare(i.relativePath)),D(o,t.scanLimit)}function x(e,t,o,n){let i=E(e,t);if(!i||W(i)<n)return null;let r=P(e,t);return r?{symbol:t.symbol,shortName:g(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:m(t),ageCommits:o?.get(t.relativePath)?.commitsAgo??null,normalizedBody:r}:null}function P(e,t){let o=E(e,t);return o&&I(o)||null}function E(e,t){let o=y(e,t.relativePath);return o.length===0?null:o.slice(t.startLine,t.endLine+1).join(`
2
- `)}function S(e){let t=e.indexOf("{"),o=e.lastIndexOf("}");if(t>=0&&o>t)return e.slice(t+1,o);let n=e.indexOf("=>");return n>=0?e.slice(n+2).replace(/;+\s*$/,""):e}function W(e){return S(e).split(/\r?\n/).map(o=>o.trim()).filter(o=>o.length>0).length}function F(e){return A("sha256").update(e).digest("hex").slice(0,16)}function z(e,t){let o=e.ageCommits??-1;return(t.ageCommits??-1)-o||e.file.localeCompare(t.file)||e.startLine-t.startLine}function b(e){return e.functions.reduce((t,o)=>t+o.loc,0)}export{H as a,M as b,I as c,v as d,P as e,E as f,S as g};
3
- //# sourceMappingURL=chunk-JGKUET5J.js.map