scip-query 0.19.6 → 0.19.8

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 (304) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +28 -15
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/chunk-2465DLHK.js +3 -0
  5. package/dist/{chunk-2CVXCGL4.js → chunk-24GTWJ3N.js} +2 -2
  6. package/dist/{chunk-XVJ3V7LM.js → chunk-2SNGN6U4.js} +2 -2
  7. package/dist/{chunk-FKGN4A4E.js → chunk-2U3OLUNJ.js} +2 -2
  8. package/dist/{chunk-UUJBLG6J.js → chunk-33KUO7CG.js} +2 -2
  9. package/dist/{chunk-N3SE646F.js → chunk-33XTHFKR.js} +2 -2
  10. package/dist/{chunk-WXAAURU7.js → chunk-3EDFLQ6A.js} +2 -2
  11. package/dist/chunk-3ZSJ3PWF.js +16 -0
  12. package/dist/{chunk-G4UQL4CP.js → chunk-43KC6EQZ.js} +2 -2
  13. package/dist/{chunk-NQLSSVOB.js → chunk-464PLI5O.js} +2 -2
  14. package/dist/chunk-46XGSFNI.js +2 -0
  15. package/dist/{chunk-NN4ZIRPK.js → chunk-47BU5Z4T.js} +2 -2
  16. package/dist/chunk-4BV4QAZJ.js +5 -0
  17. package/dist/chunk-4YTUWQ6M.js +18 -0
  18. package/dist/{chunk-LMFVTUW2.js → chunk-5ML2BNRH.js} +2 -2
  19. package/dist/{chunk-OP3MTFJR.js → chunk-5YLUDDAF.js} +2 -2
  20. package/dist/chunk-67QRR5YC.js +6 -0
  21. package/dist/{chunk-273W2U4Y.js → chunk-6GXYN7YA.js} +2 -2
  22. package/dist/{chunk-JELJLXEE.js → chunk-6M7RONVB.js} +2 -2
  23. package/dist/{chunk-MLGTCX56.js → chunk-7FT5Y65S.js} +2 -2
  24. package/dist/{chunk-F42A3AKG.js → chunk-7KYNAMMH.js} +2 -2
  25. package/dist/{chunk-VP542C25.js → chunk-7LSVMFX7.js} +2 -2
  26. package/dist/{chunk-YWB2EBNB.js → chunk-7QHY3H7P.js} +2 -2
  27. package/dist/{chunk-UQK5CRUK.js → chunk-7RAG65VK.js} +2 -2
  28. package/dist/{chunk-CYJM7CYF.js → chunk-7SWJEWJF.js} +2 -2
  29. package/dist/{chunk-47X75ZKH.js → chunk-7VCOXZH3.js} +2 -2
  30. package/dist/chunk-A2TNXAXO.js +8 -0
  31. package/dist/{chunk-TYQ76QHQ.js → chunk-A3QXWFBK.js} +2 -2
  32. package/dist/{chunk-S2GP3CU3.js → chunk-AA4UWRNL.js} +2 -2
  33. package/dist/{chunk-OBKDTVZ3.js → chunk-ACAM6O5R.js} +2 -2
  34. package/dist/chunk-AQOFWNQJ.js +1 -0
  35. package/dist/chunk-AZFUMCQB.js +2 -0
  36. package/dist/{chunk-IYAOX36F.js → chunk-BDOIKGDI.js} +2 -2
  37. package/dist/{chunk-7E3TH5ZN.js → chunk-BNXICU42.js} +2 -2
  38. package/dist/chunk-C5Q44Q5D.js +3 -0
  39. package/dist/{chunk-OQ2A4G2G.js → chunk-CTF2GDEX.js} +2 -2
  40. package/dist/chunk-DHEQMPLW.js +2 -0
  41. package/dist/{chunk-EVOC5I5I.js → chunk-DQBCO2UY.js} +2 -2
  42. package/dist/{chunk-YLVE3SXZ.js → chunk-DQGSM7RZ.js} +2 -2
  43. package/dist/chunk-E2LAW7SL.js +30 -0
  44. package/dist/chunk-E3HYEQO7.js +2 -0
  45. package/dist/chunk-E4NFOAD4.js +6 -0
  46. package/dist/chunk-E5HNT4X2.js +3 -0
  47. package/dist/{chunk-6XHTISLI.js → chunk-ELLMY7XJ.js} +2 -2
  48. package/dist/chunk-FD3HFKXR.js +5 -0
  49. package/dist/{chunk-RJHCPSZ7.js → chunk-FIJCV235.js} +2 -2
  50. package/dist/{chunk-KLVJABXA.js → chunk-FJ5UDTQF.js} +2 -2
  51. package/dist/{chunk-SHKZ7OVJ.js → chunk-GHKEJTCE.js} +2 -2
  52. package/dist/{chunk-JERWGHQT.js → chunk-GLZTVKAB.js} +3 -3
  53. package/dist/{chunk-A43URCQ3.js → chunk-GNC4JVAN.js} +2 -2
  54. package/dist/chunk-HIB452NU.js +949 -0
  55. package/dist/{chunk-U5CNPPTZ.js → chunk-HZYDQPNY.js} +2 -2
  56. package/dist/chunk-IF6FP6B2.js +66 -0
  57. package/dist/{chunk-CSTYYXKC.js → chunk-JAY7YWS3.js} +2 -2
  58. package/dist/{chunk-6XFC7PQ5.js → chunk-JHF3E4YM.js} +2 -2
  59. package/dist/chunk-JORHF5AL.js +108 -0
  60. package/dist/{chunk-QBYYWGAT.js → chunk-K2WO7XY7.js} +2 -2
  61. package/dist/chunk-KFZNKUNT.js +2 -0
  62. package/dist/{chunk-J7VT2CRB.js → chunk-KJ2IIBZN.js} +2 -2
  63. package/dist/{chunk-336DC5NJ.js → chunk-KKME5ZAI.js} +2 -2
  64. package/dist/chunk-KSGTULOS.js +9 -0
  65. package/dist/{chunk-E2ZXPB7J.js → chunk-KXDJAG4N.js} +3 -3
  66. package/dist/{chunk-Z2LHPIOM.js → chunk-L4S2A7BV.js} +2 -2
  67. package/dist/chunk-LP3ARJKF.js +8 -0
  68. package/dist/chunk-LSOR3LQG.js +3 -0
  69. package/dist/{chunk-FHCTEANE.js → chunk-MLFZP76A.js} +2 -2
  70. package/dist/{chunk-RBFFD4V2.js → chunk-MNSTUIDD.js} +2 -2
  71. package/dist/{chunk-3OIKRYU5.js → chunk-MSBDMFER.js} +2 -2
  72. package/dist/{chunk-7LABSJSR.js → chunk-MZZBAITE.js} +5 -5
  73. package/dist/{chunk-QQWOFXNW.js → chunk-NE3TZUCI.js} +2 -2
  74. package/dist/{chunk-JZNLMHWY.js → chunk-NTUMF2X3.js} +2 -2
  75. package/dist/{chunk-DD5BOU5I.js → chunk-O23I56NA.js} +2 -2
  76. package/dist/{chunk-YHXBD52M.js → chunk-O3O4XXO6.js} +2 -2
  77. package/dist/{chunk-FQTPPXNA.js → chunk-OUBAF226.js} +2 -2
  78. package/dist/chunk-P3UO3EH3.js +2 -0
  79. package/dist/{chunk-5OC3HWP5.js → chunk-QGGLL3UH.js} +2 -2
  80. package/dist/chunk-QIQ63BHW.js +16 -0
  81. package/dist/{chunk-RWRLUZ6U.js → chunk-QJIVBYEK.js} +2 -2
  82. package/dist/chunk-QOXBSI6G.js +20 -0
  83. package/dist/{chunk-7Q6VYYCH.js → chunk-QXK6UUSM.js} +2 -2
  84. package/dist/{chunk-ZTTISZ7J.js → chunk-RA3AYNWP.js} +2 -2
  85. package/dist/chunk-RJMDJR3A.js +2 -0
  86. package/dist/{chunk-TFUU5MQQ.js → chunk-RLH5VUMG.js} +2 -2
  87. package/dist/{chunk-OHWZKLVA.js → chunk-S4S2WOIX.js} +2 -2
  88. package/dist/{chunk-YTUD45PU.js → chunk-SERUIGV5.js} +2 -2
  89. package/dist/{chunk-2OXVAGGT.js → chunk-SMQWE25B.js} +2 -2
  90. package/dist/{chunk-K42M2KWT.js → chunk-TAVELHYR.js} +2 -2
  91. package/dist/{chunk-MGBJHRFB.js → chunk-TWMJ3Y3G.js} +2 -2
  92. package/dist/chunk-VAXNI5NE.js +146 -0
  93. package/dist/chunk-VVY2G5ET.js +2 -0
  94. package/dist/{chunk-XF3KLXN3.js → chunk-W3DBTGL4.js} +2 -2
  95. package/dist/{chunk-26X7KCJR.js → chunk-WANA4KAQ.js} +2 -2
  96. package/dist/chunk-WJL2L6MV.js +60 -0
  97. package/dist/chunk-WUW7YUAH.js +11 -0
  98. package/dist/{chunk-PC44K7RF.js → chunk-WWKWUPSU.js} +2 -2
  99. package/dist/{chunk-2EZSOTSY.js → chunk-WY45BHKQ.js} +2 -2
  100. package/dist/chunk-X4FR5BZF.js +9 -0
  101. package/dist/chunk-X6RKPDY7.js +2 -0
  102. package/dist/{chunk-GK3GRUJX.js → chunk-YLFORA5G.js} +2 -2
  103. package/dist/{chunk-NBRUH7OE.js → chunk-YTVWB7YJ.js} +2 -2
  104. package/dist/{chunk-YGQN3XGZ.js → chunk-ZCEJ63SP.js} +2 -2
  105. package/dist/{chunk-2GSQR6YA.js → chunk-ZJ5CBXK3.js} +2 -2
  106. package/dist/chunk-ZL2OGDCD.js +2 -0
  107. package/dist/cli.js +8 -3
  108. package/dist/command-descriptors-ZW5J4ZEM.js +631 -0
  109. package/dist/{config-types-BWQ5xPGI.d.ts → config-types-B6MEoRNy.d.ts} +4 -0
  110. package/dist/{db-B0r1o7Vt.d.ts → db-DYLKr9Wn.d.ts} +1 -1
  111. package/dist/direct-navigation-42YHQPOI.js +3 -0
  112. package/dist/{health-CFnlCiTz.d.ts → health-DgxIDXJC.d.ts} +1 -1
  113. package/dist/index.d.ts +2 -2
  114. package/dist/index.js +1 -1
  115. package/dist/postinstall.js +1 -1
  116. package/dist/queries/affected.d.ts +2 -2
  117. package/dist/queries/affected.js +1 -1
  118. package/dist/queries/architecture.d.ts +2 -2
  119. package/dist/queries/architecture.js +1 -1
  120. package/dist/queries/bottlenecks.d.ts +2 -2
  121. package/dist/queries/bottlenecks.js +1 -1
  122. package/dist/queries/by-kind.d.ts +2 -2
  123. package/dist/queries/by-kind.js +1 -1
  124. package/dist/queries/call-graph.d.ts +2 -2
  125. package/dist/queries/call-graph.js +1 -1
  126. package/dist/queries/change-surface.d.ts +2 -2
  127. package/dist/queries/change-surface.js +1 -1
  128. package/dist/queries/cleanup-plan.d.ts +2 -2
  129. package/dist/queries/cleanup-plan.js +1 -1
  130. package/dist/queries/co-change.d.ts +2 -2
  131. package/dist/queries/co-change.js +1 -1
  132. package/dist/queries/code.d.ts +2 -2
  133. package/dist/queries/code.js +1 -1
  134. package/dist/queries/complexity-hotspots.d.ts +2 -2
  135. package/dist/queries/complexity-hotspots.js +1 -1
  136. package/dist/queries/complexity.d.ts +2 -2
  137. package/dist/queries/complexity.js +1 -1
  138. package/dist/queries/convergence.d.ts +2 -2
  139. package/dist/queries/convergence.js +1 -1
  140. package/dist/queries/coupling.d.ts +2 -2
  141. package/dist/queries/coupling.js +1 -1
  142. package/dist/queries/cycles.d.ts +2 -2
  143. package/dist/queries/cycles.js +1 -1
  144. package/dist/queries/dataflow.d.ts +2 -2
  145. package/dist/queries/dataflow.js +1 -1
  146. package/dist/queries/dead.d.ts +2 -2
  147. package/dist/queries/dead.js +1 -1
  148. package/dist/queries/decorative-checkers.d.ts +2 -2
  149. package/dist/queries/decorative-checkers.js +1 -1
  150. package/dist/queries/deep-chains.d.ts +2 -2
  151. package/dist/queries/deep-chains.js +1 -1
  152. package/dist/queries/deps.d.ts +2 -2
  153. package/dist/queries/deps.js +1 -1
  154. package/dist/queries/diff-gate.d.ts +2 -2
  155. package/dist/queries/diff-gate.js +1 -1
  156. package/dist/queries/diff-impact.d.ts +2 -2
  157. package/dist/queries/diff-impact.js +1 -1
  158. package/dist/queries/doc-drift.d.ts +2 -2
  159. package/dist/queries/doc-drift.js +1 -1
  160. package/dist/queries/drift.d.ts +2 -2
  161. package/dist/queries/drift.js +1 -1
  162. package/dist/queries/duplicate-bodies.d.ts +2 -2
  163. package/dist/queries/duplicate-bodies.js +1 -1
  164. package/dist/queries/extract-candidates.d.ts +2 -2
  165. package/dist/queries/extract-candidates.js +1 -1
  166. package/dist/queries/fan.d.ts +2 -2
  167. package/dist/queries/fan.js +1 -1
  168. package/dist/queries/files.d.ts +2 -2
  169. package/dist/queries/health.d.ts +3 -3
  170. package/dist/queries/health.js +1 -1
  171. package/dist/queries/hierarchy.d.ts +2 -2
  172. package/dist/queries/hierarchy.js +1 -1
  173. package/dist/queries/hotspots.d.ts +2 -2
  174. package/dist/queries/hotspots.js +1 -1
  175. package/dist/queries/imports.d.ts +2 -2
  176. package/dist/queries/imports.js +1 -1
  177. package/dist/queries/incomplete-migration.d.ts +2 -2
  178. package/dist/queries/incomplete-migration.js +1 -1
  179. package/dist/queries/index.d.ts +3 -3
  180. package/dist/queries/index.js +1 -1
  181. package/dist/queries/isolated.d.ts +2 -2
  182. package/dist/queries/isolated.js +1 -1
  183. package/dist/queries/locality-candidates.d.ts +2 -2
  184. package/dist/queries/locality-candidates.js +1 -1
  185. package/dist/queries/members.d.ts +2 -2
  186. package/dist/queries/members.js +1 -1
  187. package/dist/queries/methods.d.ts +2 -2
  188. package/dist/queries/methods.js +1 -1
  189. package/dist/queries/not-implemented.d.ts +2 -2
  190. package/dist/queries/not-implemented.js +1 -1
  191. package/dist/queries/outline.d.ts +2 -2
  192. package/dist/queries/outline.js +1 -1
  193. package/dist/queries/passthrough-candidates.d.ts +2 -2
  194. package/dist/queries/passthrough-candidates.js +1 -1
  195. package/dist/queries/plan-context.d.ts +2 -2
  196. package/dist/queries/plan-context.js +1 -1
  197. package/dist/queries/react-component-duplicates.d.ts +2 -2
  198. package/dist/queries/react-component-duplicates.js +1 -1
  199. package/dist/queries/react-hook-candidates.d.ts +2 -2
  200. package/dist/queries/react-hook-candidates.js +1 -1
  201. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  202. package/dist/queries/react-large-component-pressure.js +1 -1
  203. package/dist/queries/recent-duplicates.d.ts +2 -2
  204. package/dist/queries/recent-duplicates.js +1 -1
  205. package/dist/queries/redundant-reexports.d.ts +2 -2
  206. package/dist/queries/redundant-reexports.js +1 -1
  207. package/dist/queries/refs.d.ts +2 -2
  208. package/dist/queries/refs.js +1 -1
  209. package/dist/queries/self-audit.d.ts +2 -2
  210. package/dist/queries/self-audit.js +1 -1
  211. package/dist/queries/similar-chains.d.ts +2 -2
  212. package/dist/queries/similar-chains.js +1 -1
  213. package/dist/queries/similar-files.d.ts +2 -2
  214. package/dist/queries/similar-files.js +1 -1
  215. package/dist/queries/similar-signatures.d.ts +2 -2
  216. package/dist/queries/similar-signatures.js +1 -1
  217. package/dist/queries/similar.d.ts +2 -2
  218. package/dist/queries/similar.js +1 -1
  219. package/dist/queries/slice.d.ts +2 -2
  220. package/dist/queries/slice.js +1 -1
  221. package/dist/queries/stale-abstractions.d.ts +2 -2
  222. package/dist/queries/stale-abstractions.js +1 -1
  223. package/dist/queries/stats.d.ts +2 -2
  224. package/dist/queries/surface.d.ts +2 -2
  225. package/dist/queries/surface.js +1 -1
  226. package/dist/queries/symbols.d.ts +2 -2
  227. package/dist/queries/symbols.js +1 -1
  228. package/dist/queries/system.d.ts +2 -2
  229. package/dist/queries/system.js +1 -1
  230. package/dist/queries/test-quality.d.ts +2 -2
  231. package/dist/queries/test-quality.js +1 -1
  232. package/dist/queries/trace.d.ts +2 -2
  233. package/dist/queries/trace.js +1 -1
  234. package/dist/queries/twin-ab.d.ts +2 -2
  235. package/dist/queries/twin-ab.js +1 -1
  236. package/dist/queries/twin-drift.d.ts +2 -2
  237. package/dist/queries/twin-drift.js +1 -1
  238. package/dist/queries/unused-imports.d.ts +2 -2
  239. package/dist/queries/unused-imports.js +1 -1
  240. package/dist/queries/unused-params.d.ts +2 -2
  241. package/dist/queries/unused-params.js +1 -1
  242. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  243. package/dist/queries/vue-component-duplicates.js +1 -1
  244. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  245. package/dist/queries/vue-composable-candidates.js +1 -1
  246. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  247. package/dist/queries/vue-large-view-pressure.js +1 -1
  248. package/dist/queries/wrapper-candidates.d.ts +2 -2
  249. package/dist/queries/wrapper-candidates.js +1 -1
  250. package/dist/reindex-worker.js +26 -25
  251. package/dist/reindex.d.ts +7 -3
  252. package/dist/reindex.js +34 -33
  253. package/dist/runtime.d.ts +3 -10
  254. package/dist/runtime.js +3 -3
  255. package/dist/rust-semantic-session-server.js +1 -1
  256. package/dist/rust-semantic-session-worker.js +1 -1
  257. package/dist/rust-semantic-worker.js +1 -1
  258. package/dist/{scip-cli-DCvnlZCu.d.ts → scip-cli-Cc6c00-a.d.ts} +2 -2
  259. package/dist/watch-server.js +5 -5
  260. package/docs/AGENT_GUIDE.md +19 -3
  261. package/docs/CLI_JSON_OUTPUT.md +86 -1
  262. package/docs/COMMAND_REFERENCE.md +5 -3
  263. package/docs/SECURITY_MODEL.md +129 -0
  264. package/docs/TELEMETRY_RETENTION.md +5 -0
  265. package/docs/schemas/cli-output-page.schema.json +104 -0
  266. package/package.json +8 -7
  267. package/skills/_shared/SKILL.md +4 -2
  268. package/skills/scip-audit/SKILL.md +3 -2
  269. package/skills/scip-explore/SKILL.md +1 -1
  270. package/skills/scip-improve/SKILL.md +1 -1
  271. package/skills/scip-plan/SKILL.md +1 -1
  272. package/skills/scip-verify/SKILL.md +7 -2
  273. package/dist/chunk-24QNP7MN.js +0 -2
  274. package/dist/chunk-2ZOCHAL2.js +0 -8
  275. package/dist/chunk-35SQLYCQ.js +0 -2
  276. package/dist/chunk-4CGVLUDP.js +0 -18
  277. package/dist/chunk-4RI4BJGT.js +0 -8
  278. package/dist/chunk-52HQTTPB.js +0 -2
  279. package/dist/chunk-A63U2W3P.js +0 -3
  280. package/dist/chunk-ADFSIJP2.js +0 -16
  281. package/dist/chunk-AOLE4DYM.js +0 -6
  282. package/dist/chunk-B5MHCHP3.js +0 -107
  283. package/dist/chunk-DGAGY7RJ.js +0 -60
  284. package/dist/chunk-DGMCFMPG.js +0 -11
  285. package/dist/chunk-GA64UPMI.js +0 -6
  286. package/dist/chunk-HEBAY673.js +0 -2
  287. package/dist/chunk-HELS7KFF.js +0 -2
  288. package/dist/chunk-IPDCSB6N.js +0 -6
  289. package/dist/chunk-JJJCO4QC.js +0 -945
  290. package/dist/chunk-KP4KBDVF.js +0 -3
  291. package/dist/chunk-LRTP3DKL.js +0 -3
  292. package/dist/chunk-P6HBYNBE.js +0 -5
  293. package/dist/chunk-QHKUY4FW.js +0 -2
  294. package/dist/chunk-QHRL4LKM.js +0 -2
  295. package/dist/chunk-UXP636P5.js +0 -144
  296. package/dist/chunk-VEVBIAOJ.js +0 -16
  297. package/dist/chunk-VKRQDBW5.js +0 -9
  298. package/dist/chunk-VOQFGC2W.js +0 -67
  299. package/dist/chunk-WMXRRBII.js +0 -8
  300. package/dist/chunk-X3NLZHPA.js +0 -20
  301. package/dist/chunk-Z5QQPJ3U.js +0 -30
  302. package/dist/chunk-ZLJLE6LK.js +0 -2
  303. package/dist/command-descriptors-SJDZ7QGR.js +0 -617
  304. package/dist/direct-navigation-HTKOZEOM.js +0 -3
@@ -1,2 +1,2 @@
1
- import{a as se}from"./chunk-TYQ76QHQ.js";import{a as ce}from"./chunk-VP542C25.js";import{a as oe}from"./chunk-EVOC5I5I.js";import{a as ae}from"./chunk-G4UQL4CP.js";import{a as re}from"./chunk-YHXBD52M.js";import{a as ie}from"./chunk-DD5BOU5I.js";import{a as ne}from"./chunk-OP3MTFJR.js";import{b as G,e as m}from"./chunk-24QNP7MN.js";import{a as te}from"./chunk-PC44K7RF.js";import{a as Z}from"./chunk-MLGTCX56.js";import{a as ee}from"./chunk-6YTSKJJ3.js";import{a as J}from"./chunk-WXAAURU7.js";import{a as X}from"./chunk-KLVJABXA.js";import{a as K}from"./chunk-U5CNPPTZ.js";import{a as Y}from"./chunk-GK3GRUJX.js";import{a as W}from"./chunk-TFUU5MQQ.js";import{b as j}from"./chunk-IYAOX36F.js";import{a as U}from"./chunk-JELJLXEE.js";import{a as A,b as q}from"./chunk-LRTP3DKL.js";import{b as N}from"./chunk-QHKUY4FW.js";import{a as z}from"./chunk-OHWZKLVA.js";import{a as ue}from"./chunk-F42A3AKG.js";import{f as Q}from"./chunk-26X7KCJR.js";import{f as E,g as M}from"./chunk-WMXRRBII.js";import{w as _}from"./chunk-B5MHCHP3.js";import{createHash as At,randomUUID as Bt}from"crypto";function de(e,r){let t=new Map;for(let n of e){let o=t.get(n.check)??[];o.push(n),t.set(n.check,o)}let i=[];for(let[n,o]of t){let c=o.filter(d=>d.outcome==="resolved").length,s=o.filter(d=>d.outcome==="suppressed").length,l=o.filter(d=>d.outcome==="still-open").length,h=o.length,C=o.filter(d=>d.outcome==="still-open").sort((d,b)=>d.firstSeen-b.firstSeen)[0];i.push({check:n,seen:h,resolved:c,suppressed:s,stillOpen:l,resolutionRate:h>0?c/h:0,suppressionRate:h>0?s/h:0,oldestOpenAgeDays:C?Math.floor((r-C.firstSeen)/$e):null})}return i.sort((n,o)=>n.check.localeCompare(o.check))}var $e=864e5;function le(e){return _(e).map(Ie)}function Ie(e){return{check:e.check,findingId:e.findingId,firstSeen:e.firstSeen,lastSeen:e.lastSeen,timesShown:e.timesShown,outcome:e.outcome}}function f(e){return e.scoreCount??e.count}function B(e){let r=Ne(e),{breakdown:t,pressure:i}=Ue(e),n=me(t,"risk"),o=me(t,"hygiene");return{score:Math.min(n,o),riskScore:n,hygieneScore:o,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,duplicateBodyGroups:e.duplicateBodies.count,duplicateBodyLoc:e.duplicateBodies.loc,twinDriftGroups:e.twinDrift.count,twinDriftLoc:e.twinDrift.loc,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:f(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:f(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:f(e.wrappers),passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null,hiddenCouplingScoreCount:e.gitEvidence?.hiddenCoupling.scoreCount??null,coverageContractViolations:e.coverageContracts.count},axes:Ve(e),validation:ze(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0,detectorPrecision:[]}}function Ve(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:_e(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.duplicateBodies.count+e.twinDrift.count+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function _e(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:g(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function ze(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],twinDrift:e.twinDrift.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),n=0,o=0,c=0;for(let[C,d]of Object.entries(r))i.has(C)?n+=d.fixChanges:(o+=d.fixChanges,c+=1);let s=i.size>0?g(n/i.size):0,l=c>0?g(o/c):0,h={};for(let[C,d]of Object.entries(t)){let b=new Set(d);if(b.size===0)continue;let S=0;for(let D of b)S+=r[D]?.fixChanges??0;let y=g(S/b.size);h[C]={flaggedFiles:b.size,fixDensity:y,lift:l>0?g(y/l):null}}return{flaggedFiles:i.size,flaggedFixDensity:s,baselineFixDensity:l,ratio:i.size>0&&l>0?g(s/l):null,byCategory:h,validationBasis:{method:"subject-regex",commitsScanned:e.gitEvidence?.commitsScanned??0}}}function g(e){return Math.round(e*100)/100}function he(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function L(e,r="existing shared infrastructure discount"){let t=f(e);return Math.abs(t-e.count)<.01?"":` (${he(t)} score-weighted after ${r})`}function w(e,r){let t=f(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${he(t)} score-weighted)`}function Ne(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} indexed symbols with no visible repository references \u2014 review runtime/framework roots and the capability disclosure, then verify any deletion with cleanup-plan --verify`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} indexed dependency cycle(s) \u2014 inspect ownership and runtime order before choosing whether or how to break them`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs share disclosed call or source-token evidence beyond imports \u2014 review domain identity before considering consolidation`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.duplicateBodies.count>0&&r.push({category:"Duplicate function bodies",evidence:"heuristic",description:`${e.duplicateBodies.count} exact small-body group(s) across files \u2014 consolidate only when the domain concept matches`,effort:"low",impact:"medium",count:e.duplicateBodies.count,locRecoverable:e.duplicateBodies.loc}),e.twinDrift.count>0&&r.push({category:"Drifted twin implementations",evidence:"heuristic",description:`${e.twinDrift.count} same-name (or near-name) function group(s) across files with diverged or identical bodies \u2014 determine whether they represent the same concept before acting`,effort:"medium",impact:"medium",count:e.twinDrift.count,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${L(e.reactHookCandidates)} \u2014 review whether a common hook would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${L(e.vueComposableCandidates)} \u2014 review whether a common composable would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 review same-file or feature-local extraction seams`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols${L(e.wrappers,"boundary-evidence discount")} \u2014 inspect whether each is indirection or an intentional API, framework, or ownership boundary`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that literally forward to one callee \u2014 inspect whether each is unnecessary indirection or an intentional boundary`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let n=[];e.stale.unused>0&&n.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&n.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${n.join(", ")} \u2014 review public, runtime-registration, and ownership evidence before removing, moving, or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let n=[];e.drift.unusedImports>0&&n.push(`${e.drift.unusedImports} unused imports`),e.drift.architectureViolations>0&&n.push(`${e.drift.architectureViolations} declared architecture violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${n.join(", ")} \u2014 repair direct dependency-rule breaks; inspect boundary signals with \`drift --architecture\``,effort:e.drift.architectureViolations>0?"medium":"low",impact:e.drift.architectureViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.coverageContracts.count>0&&r.push({category:"Coverage contract drift",evidence:"graph-fact",description:`${e.coverageContracts.count} configured coverage contract(s) drifted from their ground-truth source (enumeration rot) \u2014 run \`scip-query diff-gate\` or \`scip-query health --json\` for the missing/extra keys`,effort:"low",impact:"medium",count:e.coverageContracts.count,locRecoverable:0}),e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let n=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+L({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(n?` (e.g. ${n.fileA} \u2194 ${n.fileB})`:"")+" \u2014 inspect whether a shared concept, generated artifact, or coordinated contract explains the history",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((n,o)=>{let c=t[n.impact]*i[n.effort];return t[o.impact]*i[o.effort]-c}),r}var pe={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","duplicate-bodies":"hygiene","twin-drift":"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","duplicate-bodies-pressure":"hygiene","twin-drift-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function me(e,r){let t=e.filter(i=>i.kind===r).reduce((i,n)=>i+n.points,0);return Math.max(0,Math.min(100,100-t))}function Ue(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],n=[],o=(p,H,v)=>{H>0&&i.push({axis:p,points:H,detail:v,kind:pe[p]??"hygiene"})},c=(p,H,v,Ae,Be,Te,Fe)=>{let x=Math.max(Ae,1);if(v<=x)return;let P=v/x,k=Math.min(Be,Math.ceil(Math.log2(P)*Te));if(k<=0)return;let Oe=pe[p]??"hygiene";n.push({axis:p,category:H,kind:Oe,count:v,threshold:g(x),ratio:g(P),extraPenalty:k}),o(p,k,`${v} ${Fe} exceed pressure threshold ${g(x)} (${g(P)}x)`)},s=e.dead.count/t;o("dead-code",Math.min(20,Math.round(s*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let l=e.isolated.count/t;o("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),o("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let h=e.similarCount/t*1e3;o("similar",Math.min(10,Math.round(h)),`${e.similarCount} similar function pair(s)`);let C=e.duplicateBodies.count/t*1e3;o("duplicate-bodies",Math.min(10,Math.round(C*2)),`${e.duplicateBodies.count} exact duplicate small-body group(s) (${e.duplicateBodies.loc} duplicate LOC)`);let d=e.twinDrift.count/t*1e3;o("twin-drift",Math.min(10,Math.round(d*2)),`${e.twinDrift.count} drifted twin implementation group(s) (same or near-same name, diverged or identical bodies)`);let b=e.reactComponentDuplicates.count/r*1e3;o("react-component-duplicates",Math.min(10,Math.round(b)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let S=f(e.reactHookCandidates),y=S/r*1e3;o("react-hook-candidates",Math.min(10,Math.round(y)),w(e.reactHookCandidates,"duplicated React behavior pair(s)"));let D=e.reactLargeComponentPressure.count/r*1e3;o("react-large-component-pressure",Math.min(5,Math.round(D/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Pe=e.vueComponentDuplicates.count/r*1e3;o("vue-component-duplicates",Math.min(10,Math.round(Pe)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let $=f(e.vueComposableCandidates),ke=$/r*1e3;o("vue-composable-candidates",Math.min(10,Math.round(ke)),w(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Ee=e.vueLargeViewPressure.count/r*1e3;o("vue-large-view-pressure",Math.min(5,Math.round(Ee/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let I=f(e.wrappers);o("wrappers",Math.min(3,I),w(e.wrappers,"wrapper candidate(s)"));let V=f(e.passthroughs);o("passthroughs",Math.min(3,V),w(e.passthroughs,"passthrough candidate(s)")),o("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let Me=e.drift.direct/r;if(o("drift",Math.min(5,Math.round(Me*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),o("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let p=e.gitEvidence.hiddenCoupling.scoreCount;o("hidden-coupling",Math.min(5,Math.ceil(p/10)),w({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:p},"co-changing pair(s) without a structural link"))}if(c("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),c("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let p=e.gitEvidence.hiddenCoupling.scoreCount;c("hidden-coupling-pressure","Hidden coupling",p,50,10,4,"score-weighted co-changing pair(s)")}return c("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),c("duplicate-bodies-pressure","Duplicate function bodies",e.duplicateBodies.count,Math.max(20,t*.005),8,4,"exact duplicate small-body group(s)"),c("twin-drift-pressure","Drifted twin implementations",e.twinDrift.count,Math.max(20,t*.005),8,4,"drifted twin implementation group(s)"),c("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),c("react-hook-candidates-pressure","Duplicated React hook behavior",S,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),c("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),c("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),c("vue-composable-candidates-pressure","Duplicated Vue behavior",$,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),c("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),c("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),c("wrappers-pressure","Wrapper functions",I,50,4,2,"wrapper candidate(s)"),c("passthroughs-pressure","Passthrough functions",V,50,4,2,"passthrough candidate(s)"),c("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),c("drift-pressure","Structural drift signals",e.drift.signal,Math.max(10,r*.1),4,2,"signal drift finding(s)"),{breakdown:i,pressure:n}}import{getHeapStatistics as je}from"v8";var Ge=64*1024*1024;function T(){let e=globalThis.gc;if(!e)return;let r=je();r.heap_size_limit-r.used_heap_size<Ge||e()}var We=50,qe=25e3,Ke=2500,ge=2500,fe=50,Ye=10,Xe=["overview","dead","isolated","cycles","similar","duplicate-bodies","twin-drift","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions","coverage-contracts"],ve={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:Ze(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:et(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:tt(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:rt(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:nt(e,r,t)}),"twin-drift":(e,r,t)=>({phase:"twin-drift",twinDrift:ot(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:ct(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:st(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:at(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:ut(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:dt(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:lt(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:it(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:pt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:mt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:ht(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:bt(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:vt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:gt(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:ft(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:Ct(e,t)})};function hr(e,r={}){return Se(e,r.full!==!1,(t,i)=>{let n=Qe(e,r.scope,t,i),o=B(n);return o.detectorPrecision=de(le(e),Date.now()),o})}function gr(e,r,t={}){return Je(e,[r],t)[0]}function Je(e,r,t={}){return Se(e,t.full!==!1,(i,n)=>{let o={...n,releaseCachesBetweenPhases:!1};return r.map(c=>ve[c](e,t.scope,o,i))})}function Se(e,r,t){let i=ee(e),n=St(i,r);try{return t(i,n)}finally{A(e,{semanticProvider:!0}),T()}}function fr(e){return B(we(e))}function we(e){let r=u(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,dead:u(e,"dead").dead,isolated:u(e,"isolated").isolated,realCycleCount:u(e,"cycles").realCycleCount,similarCount:u(e,"similar").similarCount,duplicateBodies:u(e,"duplicate-bodies").duplicateBodies,twinDrift:u(e,"twin-drift").twinDrift,reactComponentDuplicates:u(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:u(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:u(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:u(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:u(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:u(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:u(e,"extract-candidates").extractCount,wrappers:u(e,"wrapper-candidates").wrappers,passthroughs:u(e,"passthrough-candidates").passthroughs,stale:u(e,"stale-abstractions").stale,drift:u(e,"drift").drift,complexity:u(e,"complexity-hotspots").complexity,gitEvidence:Ce(e,"git-evidence")?.gitEvidence??null,suppressions:Ce(e,"suppressions")?.suppressions??null,coverageContracts:u(e,"coverage-contracts").coverageContracts}}function Ce(e,r){return e.find(t=>t.phase===r)}function u(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function Qe(e,r,t,i){return we(Xe.map(n=>ve[n](e,r,i,t)))}function Ze(e,r,t){return a(e,t,"dead",()=>{let i=q(e,{scope:r,...m.dead,scanLimit:t.candidateScanLimit,semantic:t.semantic});return R(Ht(e,i.symbols))})}function et(e,r,t){return a(e,t,"isolated",()=>{let i=X(e,{scope:r,...m.isolated,scanLimit:t.candidateScanLimit,semantic:t.semantic});return R(xt(e,i))})}function tt(e,r,t){return a(e,t,"cycles",()=>W(e,{scope:r}).filter(n=>n.kind==="real").length)}function rt(e,r,t){let i=a(e,t,"similar",()=>Q(e,{scope:r,...m.similar,scanLimit:t.candidateScanLimit,semantic:t.semantic}));return Math.min(i,t.candidateResultLimit)}function it(e,r,t){return a(e,t,"extract-candidates",()=>Y(e,{scope:r,...m.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}).length)}function nt(e,r,t){return a(e,t,"duplicate-bodies",()=>{let i=U(e,{scope:r,...m.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),n=new Set,o=0;for(let c of i)for(let s of c.functions.slice(1))n.add(s.file),o+=s.loc;return{count:i.length,loc:o,files:[...n]}})}function ot(e,r,t){return a(e,t,"twin-drift",()=>{let i=j(e,{scope:r,...m.twinDrift,scanLimit:t.candidateScanLimit}).filter(c=>c.relationship==="divergent"||c.relationship==="identical"),n=new Set,o=0;for(let c of i)for(let s of c.members)n.add(s.file),o+=s.loc;return{count:i.length,loc:o,files:[...n].sort()}})}function ct(e,r,t){return a(e,t,"react-component-duplicates",()=>{let i=re(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return F(i)})}function st(e,r,t){return a(e,t,"react-hook-candidates",()=>{let i=ie(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return He(i,Rt)})}function at(e,r,t){return a(e,t,"react-large-component-pressure",()=>{let i=ne(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Lt(i)})}function ut(e,r,t){return a(e,t,"vue-component-duplicates",()=>{let i=oe(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return F(i)})}function dt(e,r,t){return a(e,t,"vue-composable-candidates",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return He(i,Dt)})}function lt(e,r,t){return a(e,t,"vue-large-view-pressure",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return R(i)})}function pt(e,r,t){return a(e,t,"wrapper-candidates",()=>{let i=te(e,{scope:r,...m.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return ye(i,Pt)})}function mt(e,r,t){return a(e,t,"passthrough-candidates",()=>{let i=J(e,{scope:r,...m.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return ye(i,kt)})}function ht(e,r,t){return a(e,t,"stale-abstractions",()=>{let i=Z(e,{scope:r,...m.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}),n=i.filter(o=>o.consumers===0).length;return{count:i.length,loc:i.reduce((o,c)=>o+c.loc,0),files:[...new Set(i.map(o=>o.file))],unused:n,singleUse:i.length-n}})}function gt(e,r){return a(e,r,"git-evidence",()=>{let t=z(e,{historyMode:r.gitHistoryMode}),i=t.fileChurn();if(!i)return null;let n=t.commitHistory(),o=N(e,void 0,{limit:r.candidateResultLimit,historyMode:r.gitHistoryMode}),c={};for(let[s,l]of i)c[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:o.findings.length,scoreCount:O(o.findings.reduce((s,l)=>s+be(l),0)),top:o.findings.slice(0,5).map(s=>({fileA:s.fileA,fileB:s.fileB,together:s.together,confidence:s.confidence,focusedTogether:s.focusedTogether,broadTogether:s.broadTogether,broadCommitRatio:s.broadCommitRatio,lastTogetherAt:s.lastTogetherAt,recentTogether:s.recentTogether,commitScope:s.commitScope,recency:s.recency,scoreWeight:be(s),subjectContext:s.subjectContext}))},fileStats:c,commitsScanned:n?.commits.length??0}})}function ft(e,r){return a(e,r,"suppressions",()=>{let t=ae(e);return{total:t.total,byCategory:{...t.byCategory}}})}function Ct(e,r){return a(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],n=G(e,t).filter(o=>o.status!=="ok");return{count:n.length,loc:0,files:[...new Set(n.map(o=>o.file))].sort()}})}function bt(e,r,t){return a(e,t,"drift",()=>{let i=K(e,{scope:r,...m.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY,semantic:t.semantic}),n=i.results.filter(s=>s.kind!=="pattern-deviation"),o=n.filter(s=>s.actionTier==="direct").length,c=n.length-o;return{count:n.length,unusedImports:i.unusedImports,architectureViolations:i.architectureViolations,layerViolations:i.layerViolations,direct:o,signal:c}})}function vt(e,r,t){return a(e,t,"complexity-hotspots",()=>{let i=ue(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return{top:i.slice(0,5).map(n=>({symbol:n.shortName,score:n.score,file:n.file})),extremeCount:i.filter(n=>n.score>We).length}})}function St(e,r){let t=e.symbols>=qe||e.documents>=Ke,i=r?Number.POSITIVE_INFINITY:fe,n=r?Number.POSITIVE_INFINITY:Ye;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:n,semantic:!0,gitHistoryMode:r?"full":"bounded",releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because full mode is enabled."]:[]}:{candidateScanLimit:ge,candidateResultLimit:i,complexityResultLimit:n,semantic:!1,gitHistoryMode:"bounded",releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${ge} symbols and reported their top ${fe} findings. Enable full mode for unbounded candidate counts.`]}}function wt(e,r){r.releaseCachesBetweenPhases&&(A(e),T())}function a(e,r,t,i){yt(t);try{return i()}finally{wt(e,r)}}function yt(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Ht(e,r){return r.filter(t=>!E(e,t.relativePath)&&!M(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function xt(e,r){return r.filter(t=>!E(e,t.relativePath)&&!M(e,t.symbol,t.relativePath))}function R(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function ye(e,r){return{...R(e),scoreCount:O(e.reduce((i,n)=>i+r(n),0))}}function Lt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function F(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function He(e,r){return{...F(e),scoreCount:O(e.reduce((i,n)=>i+r(n),0))}}function Rt(e){let r=e.sharedHooks.length>0,t=xe({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:Le(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Dt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=xe({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:Le(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function xe(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!De.has(Re(r))).length+Math.min(e.functions.length,3)}function Le(e,r,t){let i=[...e,...r,...t].map(Re);return i.length>0&&i.every(n=>De.has(n))}function Re(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Pt(e){return e.actionTier==="signal"?.25:1}function kt(e){return e.actionTier==="signal"?.25:1}function be(e){return e.commitScope==="broad-sweep"?e.recency==="recent"?.25:0:e.commitScope==="mixed"?e.recency==="recent"?.5:.25:e.recency==="recent"?1:.5}function O(e){return Math.round(e*100)/100}var De=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{Xe as a,hr as b,gr as c,Je as d,fr as e};
2
- //# sourceMappingURL=chunk-7Q6VYYCH.js.map
1
+ import{a as se}from"./chunk-A3QXWFBK.js";import{a as ce}from"./chunk-7LSVMFX7.js";import{a as oe}from"./chunk-DQBCO2UY.js";import{a as ae}from"./chunk-43KC6EQZ.js";import{a as re}from"./chunk-O3O4XXO6.js";import{a as ie}from"./chunk-O23I56NA.js";import{a as ne}from"./chunk-5YLUDDAF.js";import{b as G,e as m}from"./chunk-E3HYEQO7.js";import{a as te}from"./chunk-WWKWUPSU.js";import{a as Z}from"./chunk-7FT5Y65S.js";import{a as ee}from"./chunk-6YTSKJJ3.js";import{a as J}from"./chunk-3EDFLQ6A.js";import{a as X}from"./chunk-FJ5UDTQF.js";import{a as K}from"./chunk-HZYDQPNY.js";import{a as Y}from"./chunk-YLFORA5G.js";import{a as W}from"./chunk-RLH5VUMG.js";import{b as j}from"./chunk-BDOIKGDI.js";import{a as U}from"./chunk-6M7RONVB.js";import{a as A,b as q}from"./chunk-E5HNT4X2.js";import{b as N}from"./chunk-P3UO3EH3.js";import{a as z}from"./chunk-S4S2WOIX.js";import{a as ue}from"./chunk-7KYNAMMH.js";import{f as Q}from"./chunk-WANA4KAQ.js";import{f as E,g as M}from"./chunk-LP3ARJKF.js";import{v as _}from"./chunk-JORHF5AL.js";import{createHash as At,randomUUID as Bt}from"crypto";function de(e,r){let t=new Map;for(let n of e){let o=t.get(n.check)??[];o.push(n),t.set(n.check,o)}let i=[];for(let[n,o]of t){let c=o.filter(d=>d.outcome==="resolved").length,s=o.filter(d=>d.outcome==="suppressed").length,l=o.filter(d=>d.outcome==="still-open").length,h=o.length,C=o.filter(d=>d.outcome==="still-open").sort((d,b)=>d.firstSeen-b.firstSeen)[0];i.push({check:n,seen:h,resolved:c,suppressed:s,stillOpen:l,resolutionRate:h>0?c/h:0,suppressionRate:h>0?s/h:0,oldestOpenAgeDays:C?Math.floor((r-C.firstSeen)/$e):null})}return i.sort((n,o)=>n.check.localeCompare(o.check))}var $e=864e5;function le(e){return _(e).map(Ie)}function Ie(e){return{check:e.check,findingId:e.findingId,firstSeen:e.firstSeen,lastSeen:e.lastSeen,timesShown:e.timesShown,outcome:e.outcome}}function f(e){return e.scoreCount??e.count}function B(e){let r=Ne(e),{breakdown:t,pressure:i}=Ue(e),n=me(t,"risk"),o=me(t,"hygiene");return{score:Math.min(n,o),riskScore:n,hygieneScore:o,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,duplicateBodyGroups:e.duplicateBodies.count,duplicateBodyLoc:e.duplicateBodies.loc,twinDriftGroups:e.twinDrift.count,twinDriftLoc:e.twinDrift.loc,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:f(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:f(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:f(e.wrappers),passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null,hiddenCouplingScoreCount:e.gitEvidence?.hiddenCoupling.scoreCount??null,coverageContractViolations:e.coverageContracts.count},axes:Ve(e),validation:ze(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0,detectorPrecision:[]}}function Ve(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:_e(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.duplicateBodies.count+e.twinDrift.count+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function _e(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:g(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function ze(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],twinDrift:e.twinDrift.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),n=0,o=0,c=0;for(let[C,d]of Object.entries(r))i.has(C)?n+=d.fixChanges:(o+=d.fixChanges,c+=1);let s=i.size>0?g(n/i.size):0,l=c>0?g(o/c):0,h={};for(let[C,d]of Object.entries(t)){let b=new Set(d);if(b.size===0)continue;let S=0;for(let D of b)S+=r[D]?.fixChanges??0;let y=g(S/b.size);h[C]={flaggedFiles:b.size,fixDensity:y,lift:l>0?g(y/l):null}}return{flaggedFiles:i.size,flaggedFixDensity:s,baselineFixDensity:l,ratio:i.size>0&&l>0?g(s/l):null,byCategory:h,validationBasis:{method:"subject-regex",commitsScanned:e.gitEvidence?.commitsScanned??0}}}function g(e){return Math.round(e*100)/100}function he(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function L(e,r="existing shared infrastructure discount"){let t=f(e);return Math.abs(t-e.count)<.01?"":` (${he(t)} score-weighted after ${r})`}function w(e,r){let t=f(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${he(t)} score-weighted)`}function Ne(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} indexed symbols with no visible repository references \u2014 review runtime/framework roots and the capability disclosure, then verify any deletion with cleanup-plan --verify`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} indexed dependency cycle(s) \u2014 inspect ownership and runtime order before choosing whether or how to break them`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs share disclosed call or source-token evidence beyond imports \u2014 review domain identity before considering consolidation`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.duplicateBodies.count>0&&r.push({category:"Duplicate function bodies",evidence:"heuristic",description:`${e.duplicateBodies.count} exact small-body group(s) across files \u2014 consolidate only when the domain concept matches`,effort:"low",impact:"medium",count:e.duplicateBodies.count,locRecoverable:e.duplicateBodies.loc}),e.twinDrift.count>0&&r.push({category:"Drifted twin implementations",evidence:"heuristic",description:`${e.twinDrift.count} same-name (or near-name) function group(s) across files with diverged or identical bodies \u2014 determine whether they represent the same concept before acting`,effort:"medium",impact:"medium",count:e.twinDrift.count,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${L(e.reactHookCandidates)} \u2014 review whether a common hook would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${L(e.vueComposableCandidates)} \u2014 review whether a common composable would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 review same-file or feature-local extraction seams`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols${L(e.wrappers,"boundary-evidence discount")} \u2014 inspect whether each is indirection or an intentional API, framework, or ownership boundary`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that literally forward to one callee \u2014 inspect whether each is unnecessary indirection or an intentional boundary`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let n=[];e.stale.unused>0&&n.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&n.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${n.join(", ")} \u2014 review public, runtime-registration, and ownership evidence before removing, moving, or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let n=[];e.drift.unusedImports>0&&n.push(`${e.drift.unusedImports} unused imports`),e.drift.architectureViolations>0&&n.push(`${e.drift.architectureViolations} declared architecture violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${n.join(", ")} \u2014 repair direct dependency-rule breaks; inspect boundary signals with \`drift --architecture\``,effort:e.drift.architectureViolations>0?"medium":"low",impact:e.drift.architectureViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.coverageContracts.count>0&&r.push({category:"Coverage contract drift",evidence:"graph-fact",description:`${e.coverageContracts.count} configured coverage contract(s) drifted from their ground-truth source (enumeration rot) \u2014 run \`scip-query diff-gate\` or \`scip-query health --json\` for the missing/extra keys`,effort:"low",impact:"medium",count:e.coverageContracts.count,locRecoverable:0}),e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let n=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+L({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(n?` (e.g. ${n.fileA} \u2194 ${n.fileB})`:"")+" \u2014 inspect whether a shared concept, generated artifact, or coordinated contract explains the history",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((n,o)=>{let c=t[n.impact]*i[n.effort];return t[o.impact]*i[o.effort]-c}),r}var pe={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","duplicate-bodies":"hygiene","twin-drift":"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","duplicate-bodies-pressure":"hygiene","twin-drift-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function me(e,r){let t=e.filter(i=>i.kind===r).reduce((i,n)=>i+n.points,0);return Math.max(0,Math.min(100,100-t))}function Ue(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],n=[],o=(p,H,v)=>{H>0&&i.push({axis:p,points:H,detail:v,kind:pe[p]??"hygiene"})},c=(p,H,v,Ae,Be,Te,Fe)=>{let x=Math.max(Ae,1);if(v<=x)return;let P=v/x,k=Math.min(Be,Math.ceil(Math.log2(P)*Te));if(k<=0)return;let Oe=pe[p]??"hygiene";n.push({axis:p,category:H,kind:Oe,count:v,threshold:g(x),ratio:g(P),extraPenalty:k}),o(p,k,`${v} ${Fe} exceed pressure threshold ${g(x)} (${g(P)}x)`)},s=e.dead.count/t;o("dead-code",Math.min(20,Math.round(s*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let l=e.isolated.count/t;o("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),o("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let h=e.similarCount/t*1e3;o("similar",Math.min(10,Math.round(h)),`${e.similarCount} similar function pair(s)`);let C=e.duplicateBodies.count/t*1e3;o("duplicate-bodies",Math.min(10,Math.round(C*2)),`${e.duplicateBodies.count} exact duplicate small-body group(s) (${e.duplicateBodies.loc} duplicate LOC)`);let d=e.twinDrift.count/t*1e3;o("twin-drift",Math.min(10,Math.round(d*2)),`${e.twinDrift.count} drifted twin implementation group(s) (same or near-same name, diverged or identical bodies)`);let b=e.reactComponentDuplicates.count/r*1e3;o("react-component-duplicates",Math.min(10,Math.round(b)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let S=f(e.reactHookCandidates),y=S/r*1e3;o("react-hook-candidates",Math.min(10,Math.round(y)),w(e.reactHookCandidates,"duplicated React behavior pair(s)"));let D=e.reactLargeComponentPressure.count/r*1e3;o("react-large-component-pressure",Math.min(5,Math.round(D/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Pe=e.vueComponentDuplicates.count/r*1e3;o("vue-component-duplicates",Math.min(10,Math.round(Pe)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let $=f(e.vueComposableCandidates),ke=$/r*1e3;o("vue-composable-candidates",Math.min(10,Math.round(ke)),w(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Ee=e.vueLargeViewPressure.count/r*1e3;o("vue-large-view-pressure",Math.min(5,Math.round(Ee/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let I=f(e.wrappers);o("wrappers",Math.min(3,I),w(e.wrappers,"wrapper candidate(s)"));let V=f(e.passthroughs);o("passthroughs",Math.min(3,V),w(e.passthroughs,"passthrough candidate(s)")),o("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let Me=e.drift.direct/r;if(o("drift",Math.min(5,Math.round(Me*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),o("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let p=e.gitEvidence.hiddenCoupling.scoreCount;o("hidden-coupling",Math.min(5,Math.ceil(p/10)),w({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:p},"co-changing pair(s) without a structural link"))}if(c("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),c("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let p=e.gitEvidence.hiddenCoupling.scoreCount;c("hidden-coupling-pressure","Hidden coupling",p,50,10,4,"score-weighted co-changing pair(s)")}return c("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),c("duplicate-bodies-pressure","Duplicate function bodies",e.duplicateBodies.count,Math.max(20,t*.005),8,4,"exact duplicate small-body group(s)"),c("twin-drift-pressure","Drifted twin implementations",e.twinDrift.count,Math.max(20,t*.005),8,4,"drifted twin implementation group(s)"),c("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),c("react-hook-candidates-pressure","Duplicated React hook behavior",S,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),c("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),c("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),c("vue-composable-candidates-pressure","Duplicated Vue behavior",$,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),c("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),c("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),c("wrappers-pressure","Wrapper functions",I,50,4,2,"wrapper candidate(s)"),c("passthroughs-pressure","Passthrough functions",V,50,4,2,"passthrough candidate(s)"),c("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),c("drift-pressure","Structural drift signals",e.drift.signal,Math.max(10,r*.1),4,2,"signal drift finding(s)"),{breakdown:i,pressure:n}}import{getHeapStatistics as je}from"v8";var Ge=64*1024*1024;function T(){let e=globalThis.gc;if(!e)return;let r=je();r.heap_size_limit-r.used_heap_size<Ge||e()}var We=50,qe=25e3,Ke=2500,ge=2500,fe=50,Ye=10,Xe=["overview","dead","isolated","cycles","similar","duplicate-bodies","twin-drift","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions","coverage-contracts"],ve={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:Ze(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:et(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:tt(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:rt(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:nt(e,r,t)}),"twin-drift":(e,r,t)=>({phase:"twin-drift",twinDrift:ot(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:ct(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:st(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:at(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:ut(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:dt(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:lt(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:it(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:pt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:mt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:ht(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:bt(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:vt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:gt(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:ft(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:Ct(e,t)})};function hr(e,r={}){return Se(e,r.full!==!1,(t,i)=>{let n=Qe(e,r.scope,t,i),o=B(n);return o.detectorPrecision=de(le(e),Date.now()),o})}function gr(e,r,t={}){return Je(e,[r],t)[0]}function Je(e,r,t={}){return Se(e,t.full!==!1,(i,n)=>{let o={...n,releaseCachesBetweenPhases:!1};return r.map(c=>ve[c](e,t.scope,o,i))})}function Se(e,r,t){let i=ee(e),n=St(i,r);try{return t(i,n)}finally{A(e,{semanticProvider:!0}),T()}}function fr(e){return B(we(e))}function we(e){let r=u(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,dead:u(e,"dead").dead,isolated:u(e,"isolated").isolated,realCycleCount:u(e,"cycles").realCycleCount,similarCount:u(e,"similar").similarCount,duplicateBodies:u(e,"duplicate-bodies").duplicateBodies,twinDrift:u(e,"twin-drift").twinDrift,reactComponentDuplicates:u(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:u(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:u(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:u(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:u(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:u(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:u(e,"extract-candidates").extractCount,wrappers:u(e,"wrapper-candidates").wrappers,passthroughs:u(e,"passthrough-candidates").passthroughs,stale:u(e,"stale-abstractions").stale,drift:u(e,"drift").drift,complexity:u(e,"complexity-hotspots").complexity,gitEvidence:Ce(e,"git-evidence")?.gitEvidence??null,suppressions:Ce(e,"suppressions")?.suppressions??null,coverageContracts:u(e,"coverage-contracts").coverageContracts}}function Ce(e,r){return e.find(t=>t.phase===r)}function u(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function Qe(e,r,t,i){return we(Xe.map(n=>ve[n](e,r,i,t)))}function Ze(e,r,t){return a(e,t,"dead",()=>{let i=q(e,{scope:r,...m.dead,scanLimit:t.candidateScanLimit,semantic:t.semantic});return R(Ht(e,i.symbols))})}function et(e,r,t){return a(e,t,"isolated",()=>{let i=X(e,{scope:r,...m.isolated,scanLimit:t.candidateScanLimit,semantic:t.semantic});return R(xt(e,i))})}function tt(e,r,t){return a(e,t,"cycles",()=>W(e,{scope:r}).filter(n=>n.kind==="real").length)}function rt(e,r,t){let i=a(e,t,"similar",()=>Q(e,{scope:r,...m.similar,scanLimit:t.candidateScanLimit,semantic:t.semantic}));return Math.min(i,t.candidateResultLimit)}function it(e,r,t){return a(e,t,"extract-candidates",()=>Y(e,{scope:r,...m.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}).length)}function nt(e,r,t){return a(e,t,"duplicate-bodies",()=>{let i=U(e,{scope:r,...m.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),n=new Set,o=0;for(let c of i)for(let s of c.functions.slice(1))n.add(s.file),o+=s.loc;return{count:i.length,loc:o,files:[...n]}})}function ot(e,r,t){return a(e,t,"twin-drift",()=>{let i=j(e,{scope:r,...m.twinDrift,scanLimit:t.candidateScanLimit}).filter(c=>c.relationship==="divergent"||c.relationship==="identical"),n=new Set,o=0;for(let c of i)for(let s of c.members)n.add(s.file),o+=s.loc;return{count:i.length,loc:o,files:[...n].sort()}})}function ct(e,r,t){return a(e,t,"react-component-duplicates",()=>{let i=re(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return F(i)})}function st(e,r,t){return a(e,t,"react-hook-candidates",()=>{let i=ie(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return He(i,Rt)})}function at(e,r,t){return a(e,t,"react-large-component-pressure",()=>{let i=ne(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Lt(i)})}function ut(e,r,t){return a(e,t,"vue-component-duplicates",()=>{let i=oe(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return F(i)})}function dt(e,r,t){return a(e,t,"vue-composable-candidates",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return He(i,Dt)})}function lt(e,r,t){return a(e,t,"vue-large-view-pressure",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return R(i)})}function pt(e,r,t){return a(e,t,"wrapper-candidates",()=>{let i=te(e,{scope:r,...m.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return ye(i,Pt)})}function mt(e,r,t){return a(e,t,"passthrough-candidates",()=>{let i=J(e,{scope:r,...m.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return ye(i,kt)})}function ht(e,r,t){return a(e,t,"stale-abstractions",()=>{let i=Z(e,{scope:r,...m.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}),n=i.filter(o=>o.consumers===0).length;return{count:i.length,loc:i.reduce((o,c)=>o+c.loc,0),files:[...new Set(i.map(o=>o.file))],unused:n,singleUse:i.length-n}})}function gt(e,r){return a(e,r,"git-evidence",()=>{let t=z(e,{historyMode:r.gitHistoryMode}),i=t.fileChurn();if(!i)return null;let n=t.commitHistory(),o=N(e,void 0,{limit:r.candidateResultLimit,historyMode:r.gitHistoryMode}),c={};for(let[s,l]of i)c[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:o.findings.length,scoreCount:O(o.findings.reduce((s,l)=>s+be(l),0)),top:o.findings.slice(0,5).map(s=>({fileA:s.fileA,fileB:s.fileB,together:s.together,confidence:s.confidence,focusedTogether:s.focusedTogether,broadTogether:s.broadTogether,broadCommitRatio:s.broadCommitRatio,lastTogetherAt:s.lastTogetherAt,recentTogether:s.recentTogether,commitScope:s.commitScope,recency:s.recency,scoreWeight:be(s),subjectContext:s.subjectContext}))},fileStats:c,commitsScanned:n?.commits.length??0}})}function ft(e,r){return a(e,r,"suppressions",()=>{let t=ae(e);return{total:t.total,byCategory:{...t.byCategory}}})}function Ct(e,r){return a(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],n=G(e,t).filter(o=>o.status!=="ok");return{count:n.length,loc:0,files:[...new Set(n.map(o=>o.file))].sort()}})}function bt(e,r,t){return a(e,t,"drift",()=>{let i=K(e,{scope:r,...m.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY,semantic:t.semantic}),n=i.results.filter(s=>s.kind!=="pattern-deviation"),o=n.filter(s=>s.actionTier==="direct").length,c=n.length-o;return{count:n.length,unusedImports:i.unusedImports,architectureViolations:i.architectureViolations,layerViolations:i.layerViolations,direct:o,signal:c}})}function vt(e,r,t){return a(e,t,"complexity-hotspots",()=>{let i=ue(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return{top:i.slice(0,5).map(n=>({symbol:n.shortName,score:n.score,file:n.file})),extremeCount:i.filter(n=>n.score>We).length}})}function St(e,r){let t=e.symbols>=qe||e.documents>=Ke,i=r?Number.POSITIVE_INFINITY:fe,n=r?Number.POSITIVE_INFINITY:Ye;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:n,semantic:!0,gitHistoryMode:r?"full":"bounded",releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because full mode is enabled."]:[]}:{candidateScanLimit:ge,candidateResultLimit:i,complexityResultLimit:n,semantic:!1,gitHistoryMode:"bounded",releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${ge} symbols and reported their top ${fe} findings. Enable full mode for unbounded candidate counts.`]}}function wt(e,r){r.releaseCachesBetweenPhases&&(A(e),T())}function a(e,r,t,i){yt(t);try{return i()}finally{wt(e,r)}}function yt(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Ht(e,r){return r.filter(t=>!E(e,t.relativePath)&&!M(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function xt(e,r){return r.filter(t=>!E(e,t.relativePath)&&!M(e,t.symbol,t.relativePath))}function R(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function ye(e,r){return{...R(e),scoreCount:O(e.reduce((i,n)=>i+r(n),0))}}function Lt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function F(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function He(e,r){return{...F(e),scoreCount:O(e.reduce((i,n)=>i+r(n),0))}}function Rt(e){let r=e.sharedHooks.length>0,t=xe({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:Le(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Dt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=xe({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:Le(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function xe(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!De.has(Re(r))).length+Math.min(e.functions.length,3)}function Le(e,r,t){let i=[...e,...r,...t].map(Re);return i.length>0&&i.every(n=>De.has(n))}function Re(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Pt(e){return e.actionTier==="signal"?.25:1}function kt(e){return e.actionTier==="signal"?.25:1}function be(e){return e.commitScope==="broad-sweep"?e.recency==="recent"?.25:0:e.commitScope==="mixed"?e.recency==="recent"?.5:.25:e.recency==="recent"?1:.5}function O(e){return Math.round(e*100)/100}var De=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{Xe as a,hr as b,gr as c,Je as d,fr as e};
2
+ //# sourceMappingURL=chunk-QXK6UUSM.js.map
@@ -1,4 +1,4 @@
1
- import{a as _,g as O,j as C,o as $,p as T}from"./chunk-7LABSJSR.js";import{E as N}from"./chunk-DGMCFMPG.js";import{E as R,G as E,H as k,I as M,l as y,q as S,r as x,x as D}from"./chunk-B5MHCHP3.js";import{a as h}from"./chunk-64MNV6AB.js";var V={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],i=n[1],r=e.slice(t.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=ee(r);return{scheme:t,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let n=u(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let i=n.descriptors[t];if(i?.suffix==="type")return i.name}return null}function ee(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let s=e.indexOf("]",t+1);if(s===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,s),suffix:"type-param"}),t=s+1;continue}if(e[t]==="("&&(n.length===0||t===0||w(e[t-1]))){let s=e.indexOf(")",t+1);if(s!==-1&&e[s+1]!=="."){n.push({name:e.slice(t+1,s),suffix:"parameter"}),t=s+1;continue}}let i;if(e[t]==="`"){let s=e.indexOf("`",t+1);if(s===-1){i=e.slice(t+1),n.push({name:i,suffix:"term"});break}i=e.slice(t+1,s),t=s+1}else{let s=t;for(;t<e.length&&!w(e[t]);)t++;i=e.slice(s,t)}if(t>=e.length){i&&n.push({name:i,suffix:"term"});break}let r=e[t];if(r==="("){let s=e.indexOf(")",t+1);s!==-1&&e[s+1]==="."?(n.push({name:i,suffix:"method"}),t=s+2):s!==-1?(n.push({name:i,suffix:"method"}),t=s+1):(n.push({name:i,suffix:"term"}),t++)}else{let s=V[r];s&&n.push({name:i,suffix:s}),t+=1}}return n}function w(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function A(e){let n=u(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let i=[];for(let r of t.descriptors){let s=ne(r);s&&i.push(s)}return i.join(":")}function ne(e){let n=e.suffix==="namespace"?te(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function te(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function v(e){let n=u(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let n=u(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Ae(e){return e.endsWith("().")||p(e)==="method"}function P(e){let n=p(e);return n==="method"?!0:n!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function ve(e){return p(e)==="namespace"}var ie=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function Pe(e){return ie.test(e)}var re=new Set(["test","tests","_tests"]);function Qe(e){let n=u(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let i=n.descriptors[t];if(i?.suffix==="namespace"&&i.name&&re.has(i.name))return!0}return!1}function je(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Be(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Je(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
1
+ import{a as _,g as O,j as C,o as $,p as T}from"./chunk-MZZBAITE.js";import{A as N}from"./chunk-WUW7YUAH.js";import{D as R,F as E,O as k,P as M,k as y,p as S,q as x,w as D}from"./chunk-JORHF5AL.js";import{a as h}from"./chunk-64MNV6AB.js";var V={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],i=n[1],r=e.slice(t.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=ee(r);return{scheme:t,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let n=u(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let i=n.descriptors[t];if(i?.suffix==="type")return i.name}return null}function ee(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let s=e.indexOf("]",t+1);if(s===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,s),suffix:"type-param"}),t=s+1;continue}if(e[t]==="("&&(n.length===0||t===0||w(e[t-1]))){let s=e.indexOf(")",t+1);if(s!==-1&&e[s+1]!=="."){n.push({name:e.slice(t+1,s),suffix:"parameter"}),t=s+1;continue}}let i;if(e[t]==="`"){let s=e.indexOf("`",t+1);if(s===-1){i=e.slice(t+1),n.push({name:i,suffix:"term"});break}i=e.slice(t+1,s),t=s+1}else{let s=t;for(;t<e.length&&!w(e[t]);)t++;i=e.slice(s,t)}if(t>=e.length){i&&n.push({name:i,suffix:"term"});break}let r=e[t];if(r==="("){let s=e.indexOf(")",t+1);s!==-1&&e[s+1]==="."?(n.push({name:i,suffix:"method"}),t=s+2):s!==-1?(n.push({name:i,suffix:"method"}),t=s+1):(n.push({name:i,suffix:"term"}),t++)}else{let s=V[r];s&&n.push({name:i,suffix:s}),t+=1}}return n}function w(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function A(e){let n=u(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let i=[];for(let r of t.descriptors){let s=ne(r);s&&i.push(s)}return i.join(":")}function ne(e){let n=e.suffix==="namespace"?te(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function te(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function v(e){let n=u(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let n=u(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Ae(e){return e.endsWith("().")||p(e)==="method"}function P(e){let n=p(e);return n==="method"?!0:n!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function ve(e){return p(e)==="namespace"}var ie=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function Pe(e){return ie.test(e)}var re=new Set(["test","tests","_tests"]);function Qe(e){let n=u(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let i=n.descriptors[t];if(i?.suffix==="namespace"&&i.name&&re.has(i.name))return!0}return!1}function je(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Be(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Je(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
2
2
  FROM global_symbols gs
3
3
  JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -109,4 +109,4 @@ import{a as _,g as O,j as C,o as $,p as T}from"./chunk-7LABSJSR.js";import{E as
109
109
  ${e.symbolNoiseFor("gs")}
110
110
  GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
111
111
  ORDER BY d.relative_path, start_line, end_line`,...s)}function Se(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function Z(e,n){return n==="callable"?Se(e):xe(e)}function xe(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function U(e){let n=new Map;for(let t of e){let i=n.get(t.relative_path);i?i.push(t):n.set(t.relative_path,[t])}return n}function pn(e,n,t={}){if(n.length===0)return[];let i=n.flatMap(r=>F(e,r)).filter(r=>!e.isIgnored(r.relativePath));return t.onlyDocumented&&(i=i.filter(r=>r.documentation!==null&&r.documentation!=="")),t.sort&&(i=i.sort((r,s)=>r.relativePath.localeCompare(s.relativePath)||r.startLine-s.startLine||r.endLine-s.endLine)),i.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:A(r.symbol),signature:z(J(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function he(e){let n=new Map,t=e.map((i,r)=>({definition:i,index:r,span:i.endLine-i.startLine})).sort((i,r)=>i.span-r.span||i.index-r.index);for(let{definition:i}of t)for(let r=i.startLine;r<=i.endLine;r+=1)n.has(r)||n.set(r,i);return n}function gn(e,n){let t=H.get(e);return t||(t=he(e),H.set(e,t)),t.get(n)??null}function bn(e,n){let t=F(e,n.relative_path).find(i=>i.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,startChar:t.startChar,endLine:t.endLine,endChar:t.endChar,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,startChar:n.start_char??0,endLine:n.end_line,endChar:n.end_char??0,relativePath:n.relative_path}}function q(e,n,t){let i=g(e).forFile(n,{text:!0}).text,r=C(e,n);return r?Re(t,r,i):i?De(t,i):t}function De(e,n){let t=n.split(/\r?\n/),i=_e(e,t),r=Ie(e,i),s=Le(r,t);return Fe(e,s)}function _e(e,n){let t=e.some(r=>b(r.symbol))?$e(n):null,i=new Map;for(let r of e)i.set(r.symbolId,Ce(n,t,r));return i}function Ie(e,n){return e.filter(t=>b(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,i)=>t.startLine-i.startLine||t.definition.startLine-i.definition.startLine||t.definition.symbol.localeCompare(i.definition.symbol))}function Le(e,n){let t=new Map;for(let i=0;i<e.length;i+=1){let r=e[i],s=e[i+1],o=s?Math.max(r.startLine,s.startLine-1):n.length-1;t.set(r.definition.symbolId,{startLine:r.startLine,endLine:Te(n,r.definition,r.startLine,o)})}return t}function Fe(e,n){return e.map(t=>{let i=n.get(t.symbolId);return i?{...t,startLine:i.startLine,endLine:i.endLine}:t})}function Re(e,n,t=null){let i=new Map;for(let r of n){let s=i.get(r.name);s?s.push(r):i.set(r.name,[r])}return e.map(r=>{if(!Oe(r)||!r.leaf)return G(r,t);let s=i.get(r.leaf);if(!s||s.length===0)return G(r,t);let o=t?Ee(r,s,t):null;if(o)return{...r,startLine:o.startLine,endLine:o.endLine};let a=s[0],c=Math.abs(a.startLine-r.startLine);for(let l=1;l<s.length;l+=1){let d=s[l],f=Math.abs(d.startLine-r.startLine);f<c&&(a=d,c=f)}return{...r,startLine:a.startLine,endLine:a.endLine}})}function Ee(e,n,t){let i=ke(e.symbol);if(!i)return null;let r=t.split(/\r?\n/),s=new RegExp(`\\b${_(i)}\\b`);for(let o of n){let a=Me(r,o.startLine);if(a&&s.test(a))return o}return null}function ke(e){return e.match(/\/impl#\[([^\]]+)\]/)?.[1]??null}function Me(e,n){for(let t=n;t>=0;t-=1){let i=e[t]?.trim()??"";if(i){if(/^impl\b/.test(i))return Ne(e,t,n);if(/^(?:struct|enum|trait|mod)\b/.test(i))return null}}return null}function Ne(e,n,t){let i=[];for(let r=n;r<=t;r+=1){let s=e[r]??"";if(i.push(s),s.includes("{"))break}return i.join(" ")}function Oe(e){return b(e.symbol)?!0:p(e.symbol)==="term"&&m(e.symbol)===null}function G(e,n){if(!n||!e.leaf||p(e.symbol)!=="term"||m(e.symbol)!==null)return e;let t=_(e.leaf),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),s=n.split(/\r?\n/).findIndex(o=>i.test(o));return s>=0?{...e,startLine:s,endLine:s}:e}function Ce(e,n,t){if(!b(t.symbol))return t.startLine;let i=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return i;let r=n.get(t.leaf);if(!r||r.length===0)return i;let s=null;for(let o of r){let a=Math.abs(o-t.startLine);(!s||a<s.distance)&&(s={line:o,distance:a})}return s?.line??i}function $e(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,s=new Map,o=(a,c)=>{let l=s.get(a);if(!l){s.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let d of c.matchAll(n))d[1]&&o(d[1],a);for(let d of c.matchAll(t))d[1]&&o(d[1],a);let l=c.match(i);l?.[1]&&o(l[1],a);for(let d of c.matchAll(r))d[1]&&o(d[1],a)}return s}function Te(e,n,t,i){let r=Math.max(t,Math.min(e.length-1,i)),s=Math.max(t,Math.min(r,n.endLine)),o=0,a=0,c=!1;for(let l=t;l<=r;l+=1){let d=we(e[l]??"");for(let f of d)f==="{"?(o+=1,c=!0):f==="}"?o=Math.max(0,o-1):f==="("?a+=1:f===")"&&(a=Math.max(0,a-1));if(c&&o===0||!c&&a===0&&l>=s)return l}return s}function we(e){let n="",t=null,i=!1;for(let r=0;r<e.length;r+=1){let s=e[r],o=e[r+1];if(!t&&s==="/"&&o==="/"){n+=" ".repeat(e.length-r);break}if(t){if(i){i=!1,n+=" ";continue}if(s==="\\"){i=!0,n+=" ";continue}s===t&&(t=null),n+=" ";continue}if(s==='"'||s==="'"||s==="`"){t=s,n+=" ";continue}n+=s}return n}function b(e){return e.includes("().")}function yn(e){let n=u(e);if("kind"in n)return[];let t=[];for(let i=n.descriptors.length-2;i>=0;i-=1){let r=n.descriptors[i];r?.suffix==="type"&&r.name&&t.push(r.name)}return t}export{g as a,u as b,m as c,A as d,v as e,p as f,Ae as g,P as h,ve as i,Pe as j,Qe as k,je as l,Be as m,Je as n,We as o,z as p,J as q,I as r,F as s,un as t,ge as u,fn as v,mn as w,pn as x,he as y,gn as z,bn as A,yn as B};
112
- //# sourceMappingURL=chunk-ZTTISZ7J.js.map
112
+ //# sourceMappingURL=chunk-RA3AYNWP.js.map
@@ -0,0 +1,2 @@
1
+ import{a as je}from"./chunk-MSBDMFER.js";import{a as Ne}from"./chunk-47BU5Z4T.js";import{a as me,b as D,e as he}from"./chunk-4BV4QAZJ.js";import{a as Se,c as Ce,d as $e,e as F}from"./chunk-E3HYEQO7.js";import{a as Ge}from"./chunk-WWKWUPSU.js";import{a as Ie}from"./chunk-7FT5Y65S.js";import{a as Ee}from"./chunk-6YTSKJJ3.js";import{a as Ae}from"./chunk-3EDFLQ6A.js";import{a as ve}from"./chunk-FJ5UDTQF.js";import{a as Re}from"./chunk-HZYDQPNY.js";import{a as De}from"./chunk-YLFORA5G.js";import{a as ke}from"./chunk-RLH5VUMG.js";import{b as be}from"./chunk-BDOIKGDI.js";import{a as ge,b as ye}from"./chunk-6M7RONVB.js";import{a as fe,b as ue,c as pe,g as V,h as U}from"./chunk-4YTUWQ6M.js";import{b as Fe}from"./chunk-E5HNT4X2.js";import{a as z,c as ce,d as le,e as de}from"./chunk-P3UO3EH3.js";import{a as ae}from"./chunk-S4S2WOIX.js";import{a as xe,e as Te}from"./chunk-WANA4KAQ.js";import{a as j,c as B,d as P,e as we}from"./chunk-7VCOXZH3.js";import{c as se}from"./chunk-2SNGN6U4.js";import{f as E,g as G}from"./chunk-LP3ARJKF.js";import{e as re}from"./chunk-GLZTVKAB.js";import{w as oe}from"./chunk-FD3HFKXR.js";import{d as O,e as v,f as ne,g as H}from"./chunk-RA3AYNWP.js";import{a as ie}from"./chunk-MZZBAITE.js";import{a as ee}from"./chunk-WUW7YUAH.js";import{A as te}from"./chunk-JORHF5AL.js";import{r as I}from"./chunk-VVY2G5ET.js";import{createHash as bt}from"crypto";import{existsSync as _}from"fs";function q(e){let[i,t]=A(e,":"),r=i||"unknown",n=(s={})=>{let a=s.actionTier??Qe(r);return{sourceAnalyzer:r,actionTier:a,rootCauseKey:s.rootCauseKey??(t||e),label:s.label??`${r} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??et(a,r),file:s.file}};if(!t)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(r)){let[s,a]=A(t,":");return n({file:s,relatedFiles:s?[s]:[],rootCauseKey:a?`${s}:${a}`:t,label:`${r} finding`,why:a?[`Baseline subject: ${a}.`]:[]})}if(r==="cycle"){let s=t.split(">").filter(Boolean);return n({relatedFiles:s,rootCauseKey:t,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(r==="similar"){let s=t.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(r==="architecture"){let[s,a]=A(t,":");if(s==="forbidden-edge"){let[c,l]=A(a,":"),o=K(c),f=K(l);return n({actionTier:"direct",rootCauseKey:t,label:"architecture boundary violation",why:[`Declared boundary rule rejects ${o} -> ${f}.`],remediation:`Move the dependency behind an allowed boundary, or deliberately update the ${o} dependency rule and baseline.`})}if(s==="cycle"){let c=a.split("|").filter(Boolean).map(K);return n({actionTier:"direct",rootCauseKey:t,label:"forbidden architecture cycle",why:[`requireAcyclic rejects the connected boundary group: ${c.join(", ")}.`],remediation:"Break the boundary cycle, or deliberately revise the acyclicity rule and baseline."})}if(s==="missing-policy-row"){let c=K(a);return n({actionTier:"direct",rootCauseKey:t,label:"incomplete architecture policy",why:[`requireCompletePolicy rejects the missing outgoing dependency row for ${c}.`],remediation:`Declare the allowed outgoing dependencies for ${c}, including an empty row when it must depend on nothing.`})}}if(r==="drift"){let[s,a]=A(t,":"),[c,l]=A(a,":");return n({actionTier:s==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,l].filter(Boolean))],rootCauseKey:t,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...l?[`Related dependency: ${l}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Qe(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":case"architecture":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function et(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function A(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}function K(e){try{return decodeURIComponent(e)}catch{return e}}import{existsSync as tt}from"fs";import{isAbsolute as it,join as nt}from"path";var rt=".scipquery-baseline.json";function W(e){if(e.startsWith("similar:")){let i=e.slice(8).split("|");return i.length!==2?e:`similar:${i.map(O).sort().join("|")}`}if(e.startsWith("duplicate-bodies:")){let i=e.slice(17),t=i.indexOf(":");if(t<0)return e;let r=i.slice(0,t),n=i.slice(t+1).split("|");return n.length<2?e:`duplicate-bodies:${r}:${n.map(O).sort().join("|")}`}return e}function x(e,i){return i&&it(i)?i:nt(e.config.projectRoot,i??rt)}function M(e,i,t={}){let r=x(e,t.path);if(!tt(r))throw new Error(`No baseline found at ${r}. Create one with: scip-query health --write-baseline`);let s=(JSON.parse(I(r,"health baseline")).findings??[]).map(W),a=new Set(t.accept?s.filter(t.accept):s),c=new Set(i);return{baselinePath:r,baselineCount:a.size,current:[...i],newFindings:i.filter(l=>!a.has(l)),fixedFindings:[...a].filter(l=>!c.has(l))}}var ot=25e3,st=2500,at=2500;function ct(e){let i=Ee(e);return i.symbols>=ot||i.documents>=st?at:void 0}function Be(e,i={}){let{scope:t}=i,r=ct(e),n=[],s=Fe(e,{scope:t,...F.dead,scanLimit:r});for(let a of s.symbols)E(e,a.relativePath)||G(e,a.symbol,a.relativePath)||a.kind==="dead-code"&&n.push(`dead:${a.relativePath}:${a.shortName}`);for(let a of ve(e,{scope:t,...F.isolated,scanLimit:r}))E(e,a.relativePath)||G(e,a.symbol,a.relativePath)||n.push(`isolated:${a.relativePath}:${a.shortName}`);for(let a of ke(e,{scope:t}))a.kind==="real"&&n.push(`cycle:${lt(a.path)}`);for(let a of Te(e,{scope:t,...F.similar,scanLimit:r}))n.push(`similar:${[a.symbolA,a.symbolB].sort().join("|")}`);for(let a of ge(e,{scope:t,...F.duplicateBodies,scanLimit:r}))n.push(`duplicate-bodies:${a.hash}:${a.functions.map(c=>c.symbol).sort().join("|")}`);for(let a of De(e,{scope:t,...F.extract,scanLimit:r}))n.push(`extract:${a.relativePath}:${a.shortName}`);for(let a of Ge(e,{scope:t,...F.wrappers,scanLimit:r}))n.push(`wrapper:${a.file}:${a.shortName}`);for(let a of Ae(e,{scope:t,...F.passthroughs,scanLimit:r}))n.push(`passthrough:${a.file}:${a.shortName}`);for(let a of Ie(e,{scope:t,...F.stale,scanLimit:r}))n.push(`stale:${a.file}:${a.shortName}`);for(let a of Re(e,{scope:t,...F.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)a.kind!=="architecture-violation"&&n.push(`drift:${a.kind}:${a.file}:${a.dep}`);return n.push(...P(B(e,{scope:t}))),[...new Set(n.map(W))].sort()}function lt(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function Si(e,i={}){let t=Be(e,{scope:i.scope}),r=x(e,i.path);return oe(r,{version:1,findings:t},{spacing:2,trailingNewline:!0}),{path:r,findingCount:t.length}}function Pe(e,i={}){return M(e,Be(e,{scope:i.scope}),{path:i.path})}function Ke(e,i={}){let t=P(B(e,{scope:i.scope}));return M(e,t,{path:i.path,accept:r=>r.startsWith(j)})}import{existsSync as dt,readdirSync as ft}from"fs";import{createHash as ut}from"crypto";import{join as Z}from"path";function Y(e){let i=0,t=0,r=0,n=0,s=0,a=[];for(let o of e)switch(o.state){case"legacy":i+=1;break;case"current":t+=1;break;case"unsupported-older":r+=1,a.push(J(o));break;case"unsupported-future":n+=1,a.push(J(o));break;case"malformed":s+=1,a.push(J(o));break}let c=i+t,l=r+n+s;return{complete:l===0,total:e.length,accepted:c,legacy:i,current:t,unsupportedOlder:r,unsupportedFuture:n,malformed:s,omitted:l,issues:a}}function J(e){if(e.state==="legacy"||e.state==="current")throw new Error(`accepted record ${e.path} cannot become a compatibility issue`);return{path:e.path,state:e.state,reason:e.reason??e.state}}var Le=Z(".scipquery","suppressions"),Me="scip-query-suppression",X=1;function pt(e){return Z(e,Le)}function mt(e){if(e.id&&e.id.trim()!=="")return`${e.id.trim()}.json`;let i=`${e.check??""}\0${e.file??""}`;return`CHECK-${ut("sha256").update(i).digest("hex").slice(0,12).toUpperCase()}.json`}function ht(e){return mt(e).slice(0,-5)}function gt(e,i){if(typeof e!="object"||e===null||Array.isArray(e))return{state:"malformed",error:"not a suppression object"};let t=e;if(t.schemaVersion===void 0&&(t.kind!==void 0||t.suppressionIdentity!==void 0||t.writer!==void 0))return{state:"malformed",error:"suppression envelope metadata requires schemaVersion"};if(t.schemaVersion!==void 0){if(!Number.isSafeInteger(t.schemaVersion))return{state:"malformed",error:"schemaVersion must be a positive safe integer"};if(t.schemaVersion!==X)return{state:t.schemaVersion>X?"unsupported-future":"unsupported-older",error:`unsupported schemaVersion ${String(t.schemaVersion)}`};if(t.kind!==void 0&&t.kind!==Me)return{state:"malformed",error:`kind must be ${Me}`}}if(typeof t.reason!="string"||t.reason.trim()==="")return{state:"malformed",error:"missing reason"};if(!t.id&&!t.check)return{state:"malformed",error:"needs an id or a check"};let r=yt(t);if(t.schemaVersion===void 0)return{state:"legacy",suppression:r,record:t,schemaVersion:0};let n=ht(r);return t.suppressionIdentity!==n||i!==void 0&&t.suppressionIdentity!==i?{state:"malformed",error:"suppressionIdentity does not match the suppression target or filename"}:!t.writer||t.writer.tool!=="scip-query"||typeof t.writer.version!="string"||t.writer.version.trim()===""?{state:"malformed",error:"missing valid writer metadata"}:typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))?{state:"malformed",error:"missing valid createdAt timestamp"}:t.updatedAt!==void 0&&(typeof t.updatedAt!="string"||!Number.isFinite(Date.parse(t.updatedAt)))?{state:"malformed",error:"invalid updatedAt timestamp"}:{state:"current",suppression:r,record:t,schemaVersion:X}}function _e(e){let i=pt(e);if(!dt(i))return{suppressions:[],compatibility:Y([]),warnings:[]};let t=[],r=[];for(let s of ft(i).sort()){if(!s.endsWith(".json"))continue;let a=Z(i,s),c=`${Le}/${s}`,l;try{l=JSON.parse(I(a,"suppression record"))}catch{r.push({path:c,state:"malformed",reason:"malformed JSON"});continue}let o=gt(l,s.slice(0,-5));if("error"in o){r.push({path:c,state:o.state,reason:o.error});continue}r.push({path:c,state:o.state}),t.push(o.suppression)}let n=Y(r);return{suppressions:t,compatibility:n,warnings:n.issues.map(s=>`${s.path}: ${s.reason} \u2014 ignored`)}}function yt(e){return{...typeof e.id=="string"?{id:e.id}:{},...typeof e.check=="string"?{check:e.check}:{},...typeof e.file=="string"?{file:e.file}:{},reason:e.reason,...typeof e.expiresAt=="string"?{expiresAt:e.expiresAt}:{},...typeof e.createdAt=="string"?{createdAt:e.createdAt}:{}}}var rn=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","architecture","doc-reference","unused-params","new-dead","baseline"];function on(e,i={}){let t=i.base??"HEAD",{minTogether:r=6,minConfidence:n=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:a=Number.POSITIVE_INFINITY,minSimilarity:c=.8,includeBaseline:l=!1,scanLimit:o}=i,f=i.semantic!==!1,m=i.historyMode??"bounded",u=new Set(i.skip??[]),p=_e(e.config.projectRoot),h=pe(e,{base:t}),y=ue(e,{base:t,plan:h}),S=y.changedFiles,d=new Set(S),w=new Set(h.changedFileLines),$=new Set([...d,...w]),C=V(e.config.projectRoot,t,U(h,S)),T=Vt(e.config.projectRoot,t,h,C),g={base:t,changedFiles:S,changedSymbols:y.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],attributionNotes:y.attributionNotes,rootCauseGroups:[],recordCompatibility:{suppressions:p.compatibility},note:y.summary.note};if(S.length===0)return g;let k=(N,Je)=>{if(u.has(N)){g.skipped.push({check:N,reason:"skipped via --skip"});return}let Ye=g.findings.length,Xe=g.skipped.length,Ze=g.checksRun.length;te(`diff-gate.check.${N}`,Je,()=>({check:N,changedFiles:S.length,changedSymbols:y.changedSymbols.length,findingsAdded:g.findings.length-Ye,skippedAdded:g.skipped.length-Xe,checksRunAdded:g.checksRun.length-Ze}))};return k("echo",()=>wt(e,y.changedSymbols,d,T,s,c,o,f,g)),k("incomplete-migration",()=>At(e,t,h,a,o,f,C,g)),k("co-change-partner",()=>xt(e,$,r,n,m,g)),k("twin-partner",()=>Tt(e,y.changedSymbols,d,o,g)),k("coverage-contract",()=>It(e,$,g)),k("architecture",()=>Wt(e,g)),k("doc-reference",()=>Bt(e,d,w,h.changedRanges,h.renamedFiles,g)),k("unused-params",()=>Lt(e,S,g)),k("new-dead",()=>_t(e,y.changedSymbols,T,g)),l&&k("baseline",()=>qt(e,g)),Ct(g,[...e.config.suppressions??[],...p.suppressions]),g.rootCauseGroups=St(g.findings),g}function sn(e){return e.checksRun.length===0&&e.note===fe}function an(e){return e.filter(i=>!i.advisory)}function St(e){let i=new Map;for(let t of e){let r=t.groupKey??`${t.check}:${t.id}`,n=i.get(r);n||(n={groupKey:r,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(r,n)),n.count+=1,n.findingIds.push(t.id),n.severity=qe(n.severity,t.severity),n.actionTier=We(n.actionTier,t.actionTier),t.file&&n.files.add(t.file);for(let s of t.relatedFiles??[])n.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,r)=>r.count-t.count||L(r.severity)-L(t.severity)||t.groupKey.localeCompare(r.groupKey))}function qe(e,i){return L(i)>L(e)?i:e}function L(e){return e==="error"?2:e==="warning"?1:0}function We(e,i){return e?i&&Oe(i)>Oe(e)?i:e:i}function Oe(e){return e==="direct"?2:e==="signal"?1:0}function Ct(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let r of e.findings){let n=i.find(s=>$t(s,r));n?e.suppressed.push({finding:r,suppression:n}):t.push(r)}e.findings=t}function $t(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id&&!i.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function R(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function wt(e,i,t,r,n,s,a,c,l){l.checksRun.push("echo");for(let o of i.slice(0,n)){if(!H(o.symbol)||r(o))continue;let f=ye(e,o.symbol,{maxLoc:15,scanLimit:a}).filter(d=>!t.has(d.file)).slice(0,5).map(d=>({otherFile:d.file,otherShort:d.shortName,otherSymbol:d.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${d.loc} LOC)`]}));if(f.length>0){let d=b("echo",o.symbol,o.file),w=b("echo",o.symbol,o.file,...f.map(C=>`${C.otherSymbol}|${C.otherFile}`).sort()),$=f[0];R(l,{id:d,legacySuppressionIds:w===d?void 0:[w],groupKey:d,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:o.file,symbol:o.symbol,relatedFiles:[...new Set(f.map(C=>C.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${o.symbol}:${$.otherSymbol}`,message:ze(o,f),why:Ve(o,f),remediation:Ue("direct",o.shortName,$.otherShort)});continue}let m=xe(e,o.symbol,{minSimilarity:s,limit:5,scanLimit:a,semantic:c,sourceCandidateMode:"target-pruned"}),u=[];for(let d of m){let w=d.fileA===o.file?d.fileB:d.fileA,$=d.fileA===o.file?d.shortNameB:d.shortNameA,C=d.fileA===o.file?d.symbolB:d.symbolA;t.has(w)||u.push({otherFile:w,otherShort:$,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(u.length===0)continue;let p=u[0],h=b("echo",o.symbol,o.file,...u.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),y=b("echo",o.symbol,o.file),S=kt(o,u);R(l,{id:y,legacySuppressionIds:h===y?void 0:[h],groupKey:y,actionTier:S,check:"echo",severity:"warning",evidence:"heuristic",confidence:p.similarity,file:o.file,symbol:o.symbol,relatedFiles:[...new Set(u.map(d=>d.otherFile))].sort(),message:ze(o,u),why:Ve(o,u),remediation:Ue(S,o.shortName,p.otherShort)})}i.length>n&&l.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${i.length} changed symbols`})}function kt(e,i){return i.some(r=>Ft(e.symbol,r))?"direct":"signal"}function Ft(e,i){if(i.similarityBasis==="exact-body")return!0;if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=v(e),r=v(i.otherSymbol);return!t||!r?!1:t===r?!0:vt(i.sharedEvidence)?!1:Rt(t,r)}function Rt(e,i){let t=He(e),r=He(i);if(t.length===0||r.length===0)return!1;let n=new Set(r),s=t.filter(a=>n.has(a)).length;return s>=2&&s/Math.min(t.length,r.length)>=.5}function He(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var Dt=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function vt(e){return e.length>=3&&e.every(i=>Dt.has(i.toLowerCase()))}function ze(e,i){let t=i[0],r=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${r}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${r}% similar to ${t.otherShort} (${t.otherFile})`}function Ve(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let r of i.slice(0,3))t.push(`${r.otherShort} is outside this diff and scored ${Math.round(r.similarity*100)}% similar by ${r.similarityBasis} evidence.`),t.push(`Shared evidence: ${r.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function Ue(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function At(e,i,t,r,n,s,a,c){let l=Ne(e,{base:i,maxHelpers:r,diffPlan:t,scanLimit:n,semantic:s,baseContentAt:a});if(!l.available){c.skipped.push({check:"incomplete-migration",reason:"no git history"});return}c.checksRun.push("incomplete-migration"),l.note&&c.skipped.push({check:"incomplete-migration",reason:l.note});for(let o of l.findings){let f=o.leftovers.map(d=>`${d.shortName} (${d.file}, ${Math.round(d.containment*100)}% helper / ${Math.round(d.siteCoverage*100)}% site, ${d.migrationScope})`).join(", "),m=o.leftovers.map(d=>`${d.shortName}: ${d.migrationScope} (${d.migrationScopeReasons[0]})`).join("; "),u=[...o.migratedFiles,...o.leftovers.map(d=>d.file)],p=o.leftovers.length===0?void 0:Math.max(...o.leftovers.map(d=>Math.min(d.containment,d.siteCoverage))),h=o.leftovers.some(d=>d.migrationScope==="possible-subtype"),y=b("incomplete-migration",o.helperSymbol,o.helperFile,u.join("|")),S=b("incomplete-migration",o.helperSymbol,o.helperFile);R(c,{id:S,legacySuppressionIds:y===S?void 0:[y],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:o.helperFile,symbol:o.helperSymbol,relatedFiles:u,message:`new helper ${o.helperShortName} (${o.helperFile}) is wired into ${o.migratedFiles.length} file(s), but ${o.leftovers.length} similar un-migrated site(s) remain: ${f}`,why:[`${o.helperShortName} is new in this diff and already referenced by ${o.migratedFiles.join(", ")}.`,`Helper shape: ${o.helperShape}; ${o.specificHelperCalleeCount}/${o.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${f}.`,`Migration scope hints: ${m}.`],remediation:h?`Migrate same-scope sites to ${o.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${o.helperShortName}, or confirm they are intentionally different.`})}}function xt(e,i,t,r,n,s){let a=ae(e,{historyMode:n}).directionalCoChangePairsForFiles(i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!a){s.skipped.push({check:"co-change-partner",reason:"no git history"});return}s.checksRun.push("co-change-partner");let c=new Set,l;for(let o of a){let f=i.has(o.fileA),m=i.has(o.fileB);if(f===m)continue;let u=f?o.fileA:o.fileB,p=f?o.fileB:o.fileA,h=f?o.changesA:o.changesB,y=h>0?o.together/h:0;if(y<r||z(p)||z(u)||!_(`${e.config.projectRoot}/${p}`))continue;let S=`${u}|${p}`;if(c.has(S))continue;c.add(S);let d=b("co-change-partner",u,p,String(o.together)),w=b("co-change-partner",u,p),$=ce(u,p),C=le({fileA:u,fileB:p,together:o.together,confidence:y,commitScope:o.commitScope,recency:o.recency,subjectContext:o.subjectContext},$,(l??=de(e))(u,p)),T=[u,p].sort().join("|");s.findings.push({id:w,legacySuppressionIds:d===w?void 0:[d],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${T}`,confidence:y,file:u,relatedFiles:[p],sourceAnalyzer:"co-change",rootCauseKey:T,partnerClass:$.partnerClass,partnerClassReasons:$.reasons,commitScope:o.commitScope,recency:o.recency,focusedTogether:o.focusedTogether,broadTogether:o.broadTogether,broadCommitRatio:o.broadCommitRatio,lastTogetherAt:o.lastTogetherAt,recentTogether:o.recentTogether,subjectContext:o.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${u} changed, but ${p} did not \u2014 they change together ${o.together}x (${Math.round(y*100)}% of the time)`,why:[`${u} is in this diff and ${p} is not.`,`Git history shows ${o.together} co-change(s), which is ${Math.round(y*100)}% of changes to the edited side.`,`History context: ${Et(o)}.`,`Subject context: ${Gt(o.subjectContext)}.`,...Nt(o),`Partner class: ${$.partnerClass} (${$.reasons.join("; ")}).`],remediation:C?`Update ${p} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${p} alongside this change, or confirm the coupling no longer holds.`})}}function Tt(e,i,t,r,n){n.checksRun.push("twin-partner");let s=be(e,{scanLimit:r}).filter(l=>l.relationship==="divergent"||l.relationship==="identical");if(s.length===0)return;let a=new Map;for(let l of s)for(let o of l.members)a.set(o.symbol,l);let c=new Set;for(let l of i){if(!H(l.symbol))continue;let o=a.get(l.symbol);if(!o)continue;let f=o.members.filter(h=>h.symbol!==l.symbol&&!t.has(h.file));if(f.length===0)continue;let m=[l.symbol,...f.map(h=>h.symbol)].sort().join("|");if(c.has(m))continue;c.add(m);let u=f[0],p=b("twin-partner",l.symbol,l.file,u.symbol);R(n,{id:p,groupKey:`twin-partner:${m}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:o.relationship==="identical"?1:Math.max(0,1-o.maxDivergence),file:l.file,symbol:l.symbol,relatedFiles:f.map(h=>h.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:m,message:`${l.shortName} (${l.file}) changed but its same-name twin ${u.shortName} (${u.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${l.symbol} is in this diff.`,`${u.symbol} shares its (near-)name and is classified '${o.relationship}' with it, but ${u.file} is not in this diff.`,o.relationship==="divergent"?`The two bodies already diverge (~${Math.round(o.maxDivergence*100)}% token difference) \u2014 this diff may widen or narrow that drift.`:"The two bodies were byte-identical before this diff.","Advisory: twin-partner never fails the gate by itself \u2014 see the twin-partner entry in the diff-gate checks table."],remediation:`Update ${u.file} alongside this change, consolidate ${l.shortName}/${u.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function It(e,i,t){t.checksRun.push("coverage-contract");let r=e.config.coverageContracts??[];for(let n of r){if(!Ce(n,i))continue;let s=Se(e,n);if(s.status==="ok")continue;let a=b("coverage-contract",n.name,n.file);R(t,{id:a,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:s.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:$e(s),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,s.status==="unavailable"?`The declared side could not be evaluated: ${s.unavailableReason}.`:`Missing: ${s.missing.join(", ")||"none"}. Extra: ${s.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:s.status==="unavailable"?"Investigate why the declared key set could not be parsed (see the reason above) \u2014 do not treat this as a pass.":`Update ${n.file} so its ${n.keys.type==="object-literal-keys"||n.keys.type==="string-array"?n.keys.identifier:n.keys.marker} matches ${n.mustEqual.type}, or fix the ground-truth source if the declared set is right.`})}}function Et(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${jt(e.lastTogetherAt)}`}function Gt(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",r=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${r}; external issue/PR labels ${e.externalIssueLabelStatus}`}function Nt(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function jt(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var Q=3;function Bt(e,i,t,r,n,s){s.checksRun.push("doc-reference");let a=D.referenceTargets(e,i,r);if(a.size===0)return;let c=new Set(n.map(o=>o.from)),l=[];for(let o of he(e,a))t.has(o.doc)||me(e,o.doc)||l.push(Pt(e,o,c));for(let o of Kt(l))R(s,o)}function Pt(e,i,t){let r=i.citedClaims.length>0?i.citedClaims:D.citationContexts(e,i.doc,i.cited),n=D.classifyCitation(r),s=D.hasLineAnchoredCitation(i.citations),a=i.cited.some(m=>t.has(m)||!_(`${e.config.projectRoot}/${m}`)),c=!(s||a),l=i.cited[0]??"",o=b("doc-reference",i.doc,i.cited.join("|")),f=b("doc-reference",i.doc,l);return{id:f,legacySuppressionIds:o===f?void 0:[o],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${l}`,rootCauseKey:l,confidence:1,file:i.doc,relatedFiles:i.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:r,...c?{advisory:!0}:{},message:`${i.doc} cites ${i.cited.join(", ")} as ${D.citationKindLabel(n.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${i.cited.join(", ")} changed in this diff.`,`${i.doc} cites the changed file(s) but was not updated in the same diff.`,...n.reasons.map(m=>`Citation kind evidence: ${m}`),c?"Advisory: bare file-mention citation (no line anchor, cited file still present under the same path) \u2014 21.2 calibration found this citation shape low-precision; verify at your leisure.":s?"Blocking: citation includes a line anchor that may now point at the wrong lines.":"Blocking: the cited file was deleted or renamed in this diff \u2014 the citation almost certainly needs an update."],remediation:D.citationRemediation(n.citationKind,i.doc)}}function Kt(e){let i=new Map;for(let r of e){let n=r.rootCauseKey??"",s=i.get(n);s?s.push(r):i.set(n,[r])}let t=[];for(let[r,n]of i)n.length<=Q?t.push(...n):t.push(Mt(r,n));return t}function Mt(e,i){let t=[...i].sort((f,m)=>(f.file??"").localeCompare(m.file??"")),r=t.slice(0,Q).map(f=>({doc:f.file??"",citedClaims:f.citedClaims??[]})),n=t.length-r.length,s=t.every(f=>f.advisory===!0),a=t.reduce((f,m)=>qe(f,m.severity),"info"),c=t.reduce((f,m)=>We(f,m.actionTier),void 0),l=t.map(f=>f.file??"").filter(f=>f.length>0),o=[...new Set(t.flatMap(f=>[f.id,...f.legacySuppressionIds??[]]))];return{id:b("doc-reference","hub-cluster",e),memberFindingIds:o,check:"doc-reference",severity:a,evidence:"change-graph",actionTier:c,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:r[0]?.doc,relatedFiles:[e],citationCount:t.length,citationExemplars:r,suppressedCount:n,...s?{advisory:!0}:{},message:`${e} is cited by ${t.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${r.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${t.length} doc(s) cite it but were not updated in the same diff: ${l.join(", ")}.`,...r.map(f=>`Example \u2014 ${f.doc}: ${f.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${Q}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,s?"Advisory: every citation in this cluster is a bare file-mention (no line anchor, cited file still present).":"Blocking: at least one citation in this cluster is line-anchored or cites a deleted/renamed file."],remediation:`Review the ${r.length} example doc(s) above; ${t.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function Lt(e,i,t){t.checksRun.push("unused-params");for(let r of je(e,{files:i,limit:50})){let n=b("unused-params",r.symbol,r.file,r.unusedTrailing.join("|")),s=b("unused-params",r.symbol,r.file);R(t,{id:s,legacySuppressionIds:n===s?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:r.file,startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,message:`${r.shortName} (${r.file}) has trailing unused parameter(s): ${r.unusedTrailing.join(", ")}`,why:[`${r.shortName} is in a changed file.`,`The trailing parameter(s) ${r.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function _t(e,i,t,r){r.checksRun.push("new-dead");let n=new se(e),s=ee(e.config.projectRoot),a=s.length>1;for(let c of i){if(t(c)||c.fanIn>0||n.fileKind(c.file)==="test"||E(e,c.file)||G(e,c.symbol,c.file)||zt(c.symbol))continue;let l=b("new-dead",c.symbol,c.file),o=a&&Ot(s,c.file)&&Ht(e,c.symbol);R(r,{id:l,check:"new-dead",severity:"warning",evidence:o?"heuristic":"graph-fact",confidence:o?.4:.9,file:c.file,symbol:c.symbol,message:o?`${c.shortName} (${c.file}) unconfirmed (cross-package ambiguous-name resolution gap): zero indexed consumers found, but this name is ambiguous project-wide and lives in a workspace package \u2014 verify manually before treating as dead`:`${c.shortName} (${c.file}) was changed but has zero indexed consumers`,why:o?[`${c.shortName} is a changed production symbol in a workspace package.`,"The index, semantic, and source-fallback layers all report zero consumers for this symbol.","Its leaf name is ambiguous project-wide (a same-named definition exists elsewhere), and cross-package consumers reached only through a re-exporting barrel are a known unresolvable shape for this tool \u2014 see docs/plans/2026-07-02-followups.md item 2."]:[`${c.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:o?"Verify with a direct code search before deleting; this tool cannot confidently resolve this symbol.":"Wire it up, or remove it before it becomes permanent dead code."})}}function Ot(e,i){return e.some(t=>i===t.relativeDir||i.startsWith(`${t.relativeDir}/`))}function Ht(e,i){let t=v(i);return t?(re(e).get(t)?.length??0)>1:!1}function zt(e){if(ne(e)!=="type")return!1;let i=v(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function Vt(e,i,t,r){let n=new Map(t.renamedFiles.map(a=>[a.to,a.from])),s=r??V(e,i,U(t));return a=>{let c=n.get(a.file)??a.file,l=v(a.symbol);if(!l)return!1;let o=s(c);return o!==null&&Ut(o,l)}}function Ut(e,i){return new RegExp(`\\b${ie(i)}\\b`).test(e)}function qt(e,i){if(!_(x(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=Pe(e);for(let r of t.newFindings.filter(n=>!n.startsWith(j))){let n=q(r),s=b("baseline",r);R(i,{id:s,groupKey:`baseline:${n.sourceAnalyzer}:${n.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:n.actionTier,confidence:1,file:n.file,relatedFiles:n.relatedFiles.length>0?n.relatedFiles:void 0,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${r}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${n.sourceAnalyzer}.`,`Inherited action tier: ${n.actionTier}.`,`Root cause key: ${n.rootCauseKey}.`,...n.why],remediation:n.remediation})}}function Wt(e,i){if(!we(e.config.architecture)){i.skipped.push({check:"architecture",reason:"no closed architecture dependency rows, requireCompletePolicy rule, or requireAcyclic rule configured"});return}if(!_(x(e))){i.skipped.push({check:"architecture",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("architecture");let t=Ke(e);for(let r of t.newFindings){let n=q(r),s=b("architecture",r);R(i,{id:s,groupKey:`architecture:${n.rootCauseKey}`,check:"architecture",severity:"error",evidence:"baseline",actionTier:"direct",confidence:1,sourceAnalyzer:"architecture",rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${r}`,why:["The project declares an enforceable architecture rule.","The current boundary graph contains a violation not present in the committed baseline.",...n.why],remediation:n.remediation})}}function b(e,...i){return`SQ${bt("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{Be as a,Si as b,Pe as c,Ke as d,rn as e,on as f,sn as g,an as h,Vt as i};
2
+ //# sourceMappingURL=chunk-RJMDJR3A.js.map
@@ -1,2 +1,2 @@
1
- import{b as m,c as d}from"./chunk-WMXRRBII.js";import{a as $}from"./chunk-YLVE3SXZ.js";function v(r,e={}){return P(r,e).cycles}function P(r,e={}){let{scope:s,maxDepth:i=10}=e,n=$(r,s,{scipEdges:"imports-only"}),c=[],a=new Set,l=new Set,f=[],g=!1;function b(t,o){if(o>i){g=!0;return}if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),y=u.indexOf(u.reduce((C,D)=>C<D?C:D)),p=[...u.slice(y,-1),...u.slice(0,y),u[y]],k=p.join(" -> ");S.has(k)||(S.add(k),c.push({path:p,kind:w(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let x=n.get(t);if(x)for(let h of x)b(h,o+1);f.pop(),l.delete(t)}let S=new Set;for(let t of n.keys())a.has(t)||b(t,0);return c.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),{cycles:c,truncated:g,maxDepth:i}}function w(r){for(let i of r){let n=m(i);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(r.length!==3)return"real";let[e,s]=r;return!e||!s?"real":d(e)||d(s)||B(e,s)||B(s,e)||R(e,s)||R(s,e)||m(e)==="entry"||m(s)==="entry"?"module-hierarchy":"real"}function B(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=e.replace(/\.rs$/,"/");return r.startsWith(s)?!r.slice(s.length).includes("/"):!1}function R(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=r.replace(/\.rs$/,""),i=e.replace(/\.rs$/,"");if(s===i+"_tests"||s===i+"/tests")return!0;let n=r.split("/"),c=e.split("/");if(n.length===c.length&&n.includes("tests")&&c.includes("src")){let a=n[n.length-1],l=c[c.length-1];if(a&&a===l)return!0}return!1}export{v as a,P as b};
2
- //# sourceMappingURL=chunk-TFUU5MQQ.js.map
1
+ import{b as m,c as d}from"./chunk-LP3ARJKF.js";import{a as $}from"./chunk-DQGSM7RZ.js";function v(r,e={}){return P(r,e).cycles}function P(r,e={}){let{scope:s,maxDepth:i=10}=e,n=$(r,s,{scipEdges:"imports-only"}),c=[],a=new Set,l=new Set,f=[],g=!1;function b(t,o){if(o>i){g=!0;return}if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),y=u.indexOf(u.reduce((C,D)=>C<D?C:D)),p=[...u.slice(y,-1),...u.slice(0,y),u[y]],k=p.join(" -> ");S.has(k)||(S.add(k),c.push({path:p,kind:w(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let x=n.get(t);if(x)for(let h of x)b(h,o+1);f.pop(),l.delete(t)}let S=new Set;for(let t of n.keys())a.has(t)||b(t,0);return c.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),{cycles:c,truncated:g,maxDepth:i}}function w(r){for(let i of r){let n=m(i);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(r.length!==3)return"real";let[e,s]=r;return!e||!s?"real":d(e)||d(s)||B(e,s)||B(s,e)||R(e,s)||R(s,e)||m(e)==="entry"||m(s)==="entry"?"module-hierarchy":"real"}function B(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=e.replace(/\.rs$/,"/");return r.startsWith(s)?!r.slice(s.length).includes("/"):!1}function R(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=r.replace(/\.rs$/,""),i=e.replace(/\.rs$/,"");if(s===i+"_tests"||s===i+"/tests")return!0;let n=r.split("/"),c=e.split("/");if(n.length===c.length&&n.includes("tests")&&c.includes("src")){let a=n[n.length-1],l=c[c.length-1];if(a&&a===l)return!0}return!1}export{v as a,P as b};
2
+ //# sourceMappingURL=chunk-RLH5VUMG.js.map
@@ -1,4 +1,4 @@
1
- import{a as _}from"./chunk-P5XHIJHI.js";import{E,G as M,m as P}from"./chunk-B5MHCHP3.js";import{execFileSync as U}from"child_process";var L=2e3,S=50,J=64,Y=8,V=3,W=2160*60*60,X=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,Z=3,Q=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,q=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function tt(t){let e=P(t,{clearGroups:["whole-project"]});return(i,n,r)=>{let o=r??H(i.config.projectRoot);if(!o)return null;let s=e.has(i)?e.get(i,()=>({head:"",value:null})):null;return s&&s.head===o?s.value:(e.invalidate(i),e.get(i,()=>({head:o,value:n(i.config.projectRoot,o)})).value)}}function F(t){let e=P(t,{clearGroups:["whole-project"]});return(i,n,r,o)=>{let s=o??H(i.config.projectRoot);if(!s)return null;let c=e.has(i)?e.get(i,()=>({head:"",values:new Map})):null;(!c||c.head!==s)&&e.invalidate(i);let l=e.get(i,()=>({head:s,values:new Map}));if(l.values.has(n))return l.values.get(n)??null;let d=r(i.config.projectRoot,s);return l.values.set(n,d),d}}var et=F("git-commit-history");function nt(t,e={}){let i=e.historyMode??"bounded",n=e.head;return{capability:r=>it(t,r,n),commitHistory:()=>x(t,i,n),fileChurn:()=>st(t,i,n),changeAmplification:()=>at(t,i,n),trackedFiles:()=>lt(t,n),fileAddRecords:()=>dt(t,i,n),coChangePairs:(r={})=>bt(t,r,i,n),coChangePairsForFiles:(r,o={})=>z(t,r,o,i,n),directionalCoChangePairsForFiles:(r,o={})=>yt(t,r,o,i,n)}}function x(t,e="bounded",i){return et(t,y(e),(n,r)=>rt(n,r,e),i)}function it(t,e,i){let n=i??H(t.config.projectRoot);return n?{slot:e,available:!0,head:n}:{slot:e,available:!1,head:null,reason:"git history is unavailable for this project"}}function H(t){try{return C(t,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(t,e){return U("git",["-C",t,...e],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"})}function rt(t,e,i){let n;try{n=C(t,["log","--no-merges","--name-only",...R(i),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}return{head:e,...w(n,S)}}function ot(t){return X.test(t.subject)}function st(t,e,i){let n=x(t,e,i);if(!n)return null;let r=new Map;for(let o of n.commits){let s=ot(o);for(let c of o.files){let l=r.get(c)??{changes:0,fixChanges:0,lastChangedAt:0};l.changes+=1,s&&(l.fixChanges+=1),o.timestamp>l.lastChangedAt&&(l.lastChangedAt=o.timestamp),r.set(c,l)}}return r}function at(t,e,i){let n=x(t,e,i);if(!n||n.commits.length===0)return null;let r=n.commits.map(o=>o.files.length).filter(o=>o>0).sort((o,s)=>o-s);return r.length===0?null:{medianFilesPerCommit:O(r,.5),p90FilesPerCommit:O(r,.9),commitsAnalyzed:r.length}}function O(t,e){let i=Math.min(t.length-1,Math.floor(t.length*e));return t[i]}var ct=tt("git-tracked-files");function lt(t,e){return ct(t,i=>{try{let n=C(i,["ls-files"]);return new Set(n.split(`
1
+ import{a as _}from"./chunk-P5XHIJHI.js";import{D as E,F as M,l as P}from"./chunk-JORHF5AL.js";import{execFileSync as U}from"child_process";var L=2e3,S=50,J=64,Y=8,V=3,W=2160*60*60,X=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,Z=3,Q=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,q=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function tt(t){let e=P(t,{clearGroups:["whole-project"]});return(i,n,r)=>{let o=r??H(i.config.projectRoot);if(!o)return null;let s=e.has(i)?e.get(i,()=>({head:"",value:null})):null;return s&&s.head===o?s.value:(e.invalidate(i),e.get(i,()=>({head:o,value:n(i.config.projectRoot,o)})).value)}}function F(t){let e=P(t,{clearGroups:["whole-project"]});return(i,n,r,o)=>{let s=o??H(i.config.projectRoot);if(!s)return null;let c=e.has(i)?e.get(i,()=>({head:"",values:new Map})):null;(!c||c.head!==s)&&e.invalidate(i);let l=e.get(i,()=>({head:s,values:new Map}));if(l.values.has(n))return l.values.get(n)??null;let d=r(i.config.projectRoot,s);return l.values.set(n,d),d}}var et=F("git-commit-history");function nt(t,e={}){let i=e.historyMode??"bounded",n=e.head;return{capability:r=>it(t,r,n),commitHistory:()=>x(t,i,n),fileChurn:()=>st(t,i,n),changeAmplification:()=>at(t,i,n),trackedFiles:()=>lt(t,n),fileAddRecords:()=>dt(t,i,n),coChangePairs:(r={})=>bt(t,r,i,n),coChangePairsForFiles:(r,o={})=>z(t,r,o,i,n),directionalCoChangePairsForFiles:(r,o={})=>yt(t,r,o,i,n)}}function x(t,e="bounded",i){return et(t,y(e),(n,r)=>rt(n,r,e),i)}function it(t,e,i){let n=i??H(t.config.projectRoot);return n?{slot:e,available:!0,head:n}:{slot:e,available:!1,head:null,reason:"git history is unavailable for this project"}}function H(t){try{return C(t,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(t,e){return U("git",["-C",t,...e],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"})}function rt(t,e,i){let n;try{n=C(t,["log","--no-merges","--name-only",...R(i),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}return{head:e,...w(n,S)}}function ot(t){return X.test(t.subject)}function st(t,e,i){let n=x(t,e,i);if(!n)return null;let r=new Map;for(let o of n.commits){let s=ot(o);for(let c of o.files){let l=r.get(c)??{changes:0,fixChanges:0,lastChangedAt:0};l.changes+=1,s&&(l.fixChanges+=1),o.timestamp>l.lastChangedAt&&(l.lastChangedAt=o.timestamp),r.set(c,l)}}return r}function at(t,e,i){let n=x(t,e,i);if(!n||n.commits.length===0)return null;let r=n.commits.map(o=>o.files.length).filter(o=>o>0).sort((o,s)=>o-s);return r.length===0?null:{medianFilesPerCommit:O(r,.5),p90FilesPerCommit:O(r,.9),commitsAnalyzed:r.length}}function O(t,e){let i=Math.min(t.length-1,Math.floor(t.length*e));return t[i]}var ct=tt("git-tracked-files");function lt(t,e){return ct(t,i=>{try{let n=C(i,["ls-files"]);return new Set(n.split(`
2
2
  `).map(r=>r.trim()).filter(r=>r!==""))}catch{return null}},e)}var ut=F("git-file-adds"),D="__git__/file-adds",k=E({kind:"git-file-adds",invalidation:M("git-file-adds"),serialize:gt,deserialize:ft});function _t(t){return nt(t).fileAddRecords()}function dt(t,e,i){let n=y(e);return ut(t,n,(r,o)=>mt(t,r,o,e),i)}function mt(t,e,i,n){let r=k.read(t,I(n),i);if(r)return r;let o=ht(e,n);return o&&k.write(t,I(n),i,o),o}function gt(t){return JSON.stringify([...t.entries()])}function ft(t){if(!t)return null;try{let e=JSON.parse(t);if(!Array.isArray(e))return null;let i=new Map;for(let n of e){if(!Array.isArray(n)||n.length!==2||typeof n[0]!="string")return null;let r=n[1];if(!r||typeof r.commitsAgo!="number"||!Number.isFinite(r.commitsAgo)||typeof r.addedAt!="number"||!Number.isFinite(r.addedAt))return null;i.set(n[0],{commitsAgo:r.commitsAgo,addedAt:r.addedAt})}return i}catch{return null}}function ht(t,e){let i;try{i=C(t,["log","--no-merges","--find-renames","--name-status",...R(e),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let n=new Map,r=new Map,o=-1;for(let s of i.split("")){if(s.trim()==="")continue;o+=1;let c=s.indexOf(`
3
3
  `),l=c>=0?s.slice(0,c):s,[,d]=l.split("\0"),f=Number(d)||0;if(!(c<0))for(let u of s.slice(c+1).split(`
4
4
  `)){let a=pt(u);if(!a)continue;if(a.status==="R"&&a.from&&a.to){let p=r.get(a.to)??new Set([a.to]);r.set(a.from,p);continue}if(a.status!=="A"||!a.to)continue;let m={commitsAgo:o,addedAt:f};n.set(a.to,m);for(let p of r.get(a.to)??[])n.set(p,m)}}return n}function pt(t){let e=t.trim().split(" "),i=e[0]??"";if(!i)return null;let n=i[0]??"";if(n==="R"){let o=e[1],s=e[2];return o&&s?{status:n,from:o,to:s}:null}let r=e[1];return r?{status:n,to:r}:null}var j=F("git-co-change-pairs"),Ct=F("git-directional-co-change-pairs");function bt(t,e,i,n){let r=`all\0${y(i)}\0${T(e)}`,o=j(t,r,()=>{let s=x(t,i,n);return s?G(s,e):null},n);return o&&[...o]}function z(t,e,i,n,r){if(e.size===0)return[];let o=`files\0${y(n)}\0${N(e)}\0${T(i)}`,s=j(t,o,()=>{let c=x(t,n,r);return c?G(c,i,e):null},r);return s&&[...s]}function yt(t,e,i,n,r){if(e.size===0)return[];let o=i.maxFilesPerCommit??S;if(e.size>J)return z(t,e,i,n,r);let s=`directional\0${y(n)}\0${N(e)}\0${T({...i,maxFilesPerCommit:o})}`,c=Ct(t,s,(l,d)=>{let f=At(l,d,e,o,n);return f?G(f,i,e):null},r);return c&&[...c]}function T(t){let e=t.minTogether??4,i=t.minConfidence??.6,n=t.maxFilesPerCommit??S;return`${e}\0${i}\0${n}`}function N(t){return[...t].sort().join("\0")}function G(t,e,i){let{minTogether:n=4,minConfidence:r=.6,maxFilesPerCommit:o=S}=e,s=new Map,c=new Map,l=t.newestAnalyzedAt??0;for(let u of t.commits){let a=[...new Set(u.files)].sort();if(a.length>o)continue;t.newestAnalyzedAt===void 0&&u.timestamp>l&&(l=u.timestamp);let m=Ft(a),p=i===void 0||a.some(g=>i.has(g));for(let g of a)s.set(g,(s.get(g)??0)+1);if(p)for(let g=0;g<a.length;g++)for(let b=g+1;b<a.length;b++){if(i&&!i.has(a[g])&&!i.has(a[b]))continue;let A=`${a[g]}\0${a[b]}`,h=c.get(A)??{together:0,focusedTogether:0,broadTogether:0,lastTogetherAt:0,timestamps:[],subjects:[]};h.together+=1,m?h.broadTogether+=1:h.focusedTogether+=1,u.timestamp>h.lastTogetherAt&&(h.lastTogetherAt=u.timestamp),h.timestamps.push(u.timestamp),h.subjects.push(u.subject),c.set(A,h)}}let d=[],f=l-W;for(let[u,a]of c){let m=a.together;if(m<n)continue;let[p,g]=u.split("\0"),b=s.get(p)??m,A=s.get(g)??m,h=Math.max(m/b,m/A);if(h<r)continue;let $=a.broadTogether/m,v=a.timestamps.filter(K=>K>=f).length;d.push({fileA:p,fileB:g,together:m,confidence:h,changesA:b,changesB:A,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:$,lastTogetherAt:a.lastTogetherAt,recentTogether:v,commitScope:Pt(a.broadTogether,m),recency:v>0?"recent":"stale",subjectContext:Ht(a.subjects)})}return d.sort((u,a)=>a.together-u.together||a.confidence-u.confidence||u.fileA.localeCompare(a.fileA)),d}function At(t,e,i,n,r){let o;try{o=xt(t,r)}catch{return null}if(o.length===0)return{head:e,commits:[],skippedBulkCommits:0,newestAnalyzedAt:0};let s;try{s=C(t,["log","--no-merges","--format=%H",...R(r),"--",...[...i].sort()])}catch{return null}let c=new Set(o.map(a=>a.hash)),l=s.split(`
@@ -6,4 +6,4 @@ import{a as _}from"./chunk-P5XHIJHI.js";import{E,G as M,m as P}from"./chunk-B5MH
6
6
  `).map(n=>n.trim()).filter(n=>n!=="").map(n=>{let[r,o]=n.split("\0");return{hash:r??"",timestamp:Number(o)||0}}).filter(n=>n.hash!=="")}function R(t){return t==="full"?[]:["-n",String(B())]}function B(){return _(process.env.SCIP_QUERY_GIT_HISTORY_MAX_COMMITS)??L}function y(t){return t==="full"?"full":`bounded:${B()}`}function I(t){let e=y(t);return e===`bounded:${L}`?D:`${D}:${e}`}function St(t,e,i){for(let r=0;r<e.length;r+=20){let o=e.slice(r,r+20),s;try{s=C(t,["show","--no-walk=unsorted","--name-only","--pretty=format:%x01%H%x00%ct%x00%s",...o.map(l=>l.hash)])}catch{return e[0]?.timestamp??0}let c=w(s,i);if(c.commits.length>0)return c.commits[0].timestamp}return 0}function w(t,e){let i=[],n=0;for(let r of t.split("")){if(r.trim()==="")continue;let o=r.indexOf(`
7
7
  `),s=o>=0?r.slice(0,o):r,[c,l,d]=s.split("\0");if(!c||!l)continue;let f=o>=0?r.slice(o+1).split(`
8
8
  `).map(u=>u.trim()).filter(u=>u!==""):[];if(f.length>e){n+=1;continue}i.push({hash:c,timestamp:Number(l)||0,subject:d??"",files:f})}return{commits:i,skippedBulkCommits:n}}function Ft(t){return t.length>=Y?!0:Rt(t).size>=V}function Rt(t){let e=new Set;for(let i of t){let n=i.indexOf("/");e.add(n>=0?i.slice(0,n):".")}return e}function Pt(t,e){return t===0?"focused":t/e>=.5?"broad-sweep":"mixed"}function Ht(t){let e=new Set,i=[],n=[];for(let r of t){!n.includes(r)&&n.length<Z&&n.push(r);for(let o of Tt(r))e.add(o);for(let o of r.match(Q)??[])i.includes(o)||i.push(o)}return{subjectLabels:[...e].sort(),issueRefs:i,sampleSubjects:n,externalIssueLabelStatus:"unavailable"}}function Tt(t){let e=new Set,i=q.exec(t)?.[1]?.toLowerCase();return i&&e.add(Gt(i)),/\b(?:feat|feature)\b/i.test(t)&&e.add("feature"),/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i.test(t)&&e.add("fix"),/\b(?:docs?|documentation|guide|readme)\b/i.test(t)&&e.add("docs"),/\brefactor(?:ing|ed)?\b/i.test(t)&&e.add("refactor"),/\btests?\b/i.test(t)&&e.add("test"),/\b(?:release|version|v\d+\.\d+)\b/i.test(t)&&e.add("release"),/\bchore\b/i.test(t)&&e.add("chore"),/\bbuild\b/i.test(t)&&e.add("build"),/\bci\b/i.test(t)&&e.add("ci"),/\bperf(?:ormance)?\b/i.test(t)&&e.add("perf"),[...e]}function Gt(t){return t==="feat"?"feature":t}export{nt as a,C as b,_t as c};
9
- //# sourceMappingURL=chunk-OHWZKLVA.js.map
9
+ //# sourceMappingURL=chunk-S4S2WOIX.js.map
@@ -1,4 +1,4 @@
1
- import{c as D}from"./chunk-E2ZXPB7J.js";import{n as R}from"./chunk-JERWGHQT.js";import{a as M,c as N}from"./chunk-2OXVAGGT.js";import{d as b,f as g,s as S,z as I}from"./chunk-ZTTISZ7J.js";import{B as p}from"./chunk-DGMCFMPG.js";function C(o,n,l={}){let{maxDepth:u=5,scope:m}=l,i=M(o,n);if(!i)return[];let c=[],d=new Set([i.symbolId]),a=new Set,r=[i];for(let e=1;e<=u&&r.length!==0;e++){let t=[],f=D(o,r,{limit:500,semanticEvidence:R});for(let y of r)for(let s of w(o,y,m,f.get(y.symbolId)??[])){let h=`${s.file}|${s.shortName}`;if(s.symbolId!==null){if(d.has(s.symbolId))continue;d.add(s.symbolId)}else if(a.has(h))continue;a.add(h),c.push({symbol:s.symbol,shortName:s.shortName,file:s.file,depth:e}),s.symbolId!==null&&s.symbolMatch&&t.push(s.symbolMatch)}r=t}return c.sort((e,t)=>e.depth-t.depth||e.file.localeCompare(t.file)),c}function w(o,n,l,u){let m=u.filter(e=>!o.isIgnored(e.file)).filter(e=>!l||e.file.includes(l)),i=new Set(m.map(e=>e.file)),c=[];for(let e of A(o,n,l)){if(i.has(e))continue;let t=S(o,e),f=t.length>0?I(t,t[0].startLine):null;c.push({symbol:f?.symbol??e,file:e})}let d=[...m,...c],a=[],r=new Set;for(let e of d){let t=N(o,e.symbol);if(!t){let y=`${e.file}|${e.symbol}`;if(r.has(y))continue;r.add(y),a.push({symbolId:null,symbol:e.symbol,shortName:b(e.symbol),file:e.file,symbolMatch:null});continue}if(t.symbolId===n.symbolId||o.isIgnored(t.relativePath)||!_(t))continue;let f=`${t.symbolId}|${t.relativePath}`;r.has(f)||(r.add(f),a.push({symbolId:t.symbolId,symbol:t.symbol,shortName:b(t.symbol),file:t.relativePath,symbolMatch:t}))}return a}function A(o,n,l){let u=l?"AND consumer_d.relative_path LIKE ?":"",m=[n.symbolId,n.documentId];return l&&m.push(`%${l}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
1
+ import{c as D}from"./chunk-KXDJAG4N.js";import{n as R}from"./chunk-GLZTVKAB.js";import{a as M,c as N}from"./chunk-SMQWE25B.js";import{d as b,f as g,s as S,z as I}from"./chunk-RA3AYNWP.js";import{x as p}from"./chunk-WUW7YUAH.js";function C(o,n,l={}){let{maxDepth:u=5,scope:m}=l,i=M(o,n);if(!i)return[];let c=[],d=new Set([i.symbolId]),a=new Set,r=[i];for(let e=1;e<=u&&r.length!==0;e++){let t=[],f=D(o,r,{limit:500,semanticEvidence:R});for(let y of r)for(let s of w(o,y,m,f.get(y.symbolId)??[])){let h=`${s.file}|${s.shortName}`;if(s.symbolId!==null){if(d.has(s.symbolId))continue;d.add(s.symbolId)}else if(a.has(h))continue;a.add(h),c.push({symbol:s.symbol,shortName:s.shortName,file:s.file,depth:e}),s.symbolId!==null&&s.symbolMatch&&t.push(s.symbolMatch)}r=t}return c.sort((e,t)=>e.depth-t.depth||e.file.localeCompare(t.file)),c}function w(o,n,l,u){let m=u.filter(e=>!o.isIgnored(e.file)).filter(e=>!l||e.file.includes(l)),i=new Set(m.map(e=>e.file)),c=[];for(let e of A(o,n,l)){if(i.has(e))continue;let t=S(o,e),f=t.length>0?I(t,t[0].startLine):null;c.push({symbol:f?.symbol??e,file:e})}let d=[...m,...c],a=[],r=new Set;for(let e of d){let t=N(o,e.symbol);if(!t){let y=`${e.file}|${e.symbol}`;if(r.has(y))continue;r.add(y),a.push({symbolId:null,symbol:e.symbol,shortName:b(e.symbol),file:e.file,symbolMatch:null});continue}if(t.symbolId===n.symbolId||o.isIgnored(t.relativePath)||!_(t))continue;let f=`${t.symbolId}|${t.relativePath}`;r.has(f)||(r.add(f),a.push({symbolId:t.symbolId,symbol:t.symbol,shortName:b(t.symbol),file:t.relativePath,symbolMatch:t}))}return a}function A(o,n,l){let u=l?"AND consumer_d.relative_path LIKE ?":"",m=[n.symbolId,n.documentId];return l&&m.push(`%${l}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents consumer_d ON consumer_d.id = c.document_id
@@ -7,4 +7,4 @@ import{c as D}from"./chunk-E2ZXPB7J.js";import{n as R}from"./chunk-JERWGHQT.js";
7
7
  AND c.document_id != ?
8
8
  ${o.pathExclusionsFor("consumer_d")}
9
9
  ${u}`,...m).map(i=>i.relative_path).filter(i=>!o.isIgnored(i)))}function _(o){if(o.symbol.startsWith("scip-clojure ")||p(o.relativePath)==="clojure")return!0;let n=g(o.symbol);return n==="method"||n==="type"||o.symbol.endsWith("().")}export{C as a};
10
- //# sourceMappingURL=chunk-YTUD45PU.js.map
10
+ //# sourceMappingURL=chunk-SERUIGV5.js.map
@@ -1,3 +1,3 @@
1
- import{A as C,c as M,d as L,e as Q,g as I,h as K,i as O,n as y,o as d,r as b}from"./chunk-ZTTISZ7J.js";import{l as E}from"./chunk-B5MHCHP3.js";var W=E("symbol-resolution",{clearGroups:[]});function ue(e,n){return j(e,n).match}function j(e,n){return W.get(e,n,()=>{let t=z(e,n.trim()).filter(r=>!e.isIgnored(r.relative_path));if(t.length>0)return S(e,t);let o=Y(e,n);if(o&&!e.isIgnored(o.relative_path))return S(e,[o]);let i=q(e,n);return i.length>0?S(e,i):U(e,n)})}function q(e,n){let t=N(n),o=x(t);if(!o)return[];let i=`%${o.path}%`,r=o.leaf;return T(e,i,r,t)}function T(e,n,t,o){let i=b([],[...G(e,n,t),...H(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>f(r,o)>1);return i.sort((r,a)=>f(a,o)-f(r,o)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),i}function G(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function H(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function U(e,n){let t=N(n),o=te(n),i=P(e,o),r=ne(i,n,t).filter(s=>!e.isIgnored(s.relative_path));if(r.length>0)return S(e,r);let a=[];for(let s of i){if(e.isIgnored(s.relative_path))continue;let c=ee(s,n,t,o);c<=0||a.push({row:s,score:c})}return a.sort((s,c)=>c.score-s.score||s.row.end_line-s.row.start_line-(c.row.end_line-c.row.start_line)||s.row.relative_path.localeCompare(c.row.relative_path)||s.row.symbol.localeCompare(c.row.symbol)),S(e,a.map(s=>s.row))}function S(e,n){let t=n.map(i=>C(e,i)),o=t[0]??null;return{match:o,candidates:o?X(t,o):[],total:t.length}}function X(e,n){let t=new Set([`${n.symbolId}:${n.relativePath}:${n.startLine}`]),o=[];for(let i of e){let r=`${i.symbolId}:${i.relativePath}:${i.startLine}`;if(!t.has(r)&&(t.add(r),o.push({symbol:i.symbol,shortName:L(i.symbol),relativePath:i.relativePath,startLine:i.startLine}),o.length>=5))break}return o}function Y(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return;let[,o,i,r]=t,a=Math.max(0,parseInt(i,10)-1),s=Math.max(a,parseInt(r,10)-1);return Z(e,o,a,s)??J(e,o,a,s)}function Z(e,n,t,o){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,o],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function J(e,n,t,o){return d(e,{where:"d.relative_path LIKE ? 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 me(e,n){let t=z(e,n).find(o=>!e.isIgnored(o.relative_path));return t?C(e,t):null}function z(e,n){let t=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line"}),o=t.length>0?[]:d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line"});return b(t,o)}function pe(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=V(e,n.symbolId)[0];return t?C(e,t):null}function V(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),o=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return b(t,o)}function P(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),o=n.flatMap(s=>{let c=`%${s}%`;return[c,c,c]}),i=t.join(`
1
+ import{A as C,c as M,d as L,e as Q,g as I,h as K,i as O,n as y,o as d,r as b}from"./chunk-RA3AYNWP.js";import{k as E}from"./chunk-JORHF5AL.js";var W=E("symbol-resolution",{clearGroups:[]});function ue(e,n){return j(e,n).match}function j(e,n){return W.get(e,n,()=>{let t=z(e,n.trim()).filter(r=>!e.isIgnored(r.relative_path));if(t.length>0)return S(e,t);let o=Y(e,n);if(o&&!e.isIgnored(o.relative_path))return S(e,[o]);let i=q(e,n);return i.length>0?S(e,i):U(e,n)})}function q(e,n){let t=N(n),o=x(t);if(!o)return[];let i=`%${o.path}%`,r=o.leaf;return T(e,i,r,t)}function T(e,n,t,o){let i=b([],[...G(e,n,t),...H(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>f(r,o)>1);return i.sort((r,a)=>f(a,o)-f(r,o)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),i}function G(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function H(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function U(e,n){let t=N(n),o=te(n),i=P(e,o),r=ne(i,n,t).filter(s=>!e.isIgnored(s.relative_path));if(r.length>0)return S(e,r);let a=[];for(let s of i){if(e.isIgnored(s.relative_path))continue;let c=ee(s,n,t,o);c<=0||a.push({row:s,score:c})}return a.sort((s,c)=>c.score-s.score||s.row.end_line-s.row.start_line-(c.row.end_line-c.row.start_line)||s.row.relative_path.localeCompare(c.row.relative_path)||s.row.symbol.localeCompare(c.row.symbol)),S(e,a.map(s=>s.row))}function S(e,n){let t=n.map(i=>C(e,i)),o=t[0]??null;return{match:o,candidates:o?X(t,o):[],total:t.length}}function X(e,n){let t=new Set([`${n.symbolId}:${n.relativePath}:${n.startLine}`]),o=[];for(let i of e){let r=`${i.symbolId}:${i.relativePath}:${i.startLine}`;if(!t.has(r)&&(t.add(r),o.push({symbol:i.symbol,shortName:L(i.symbol),relativePath:i.relativePath,startLine:i.startLine}),o.length>=5))break}return o}function Y(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return;let[,o,i,r]=t,a=Math.max(0,parseInt(i,10)-1),s=Math.max(a,parseInt(r,10)-1);return Z(e,o,a,s)??J(e,o,a,s)}function Z(e,n,t,o){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,o],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function J(e,n,t,o){return d(e,{where:"d.relative_path LIKE ? 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 me(e,n){let t=z(e,n).find(o=>!e.isIgnored(o.relative_path));return t?C(e,t):null}function z(e,n){let t=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line"}),o=t.length>0?[]:d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line"});return b(t,o)}function pe(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=V(e,n.symbolId)[0];return t?C(e,t):null}function V(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),o=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return b(t,o)}function P(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),o=n.flatMap(s=>{let c=`%${s}%`;return[c,c,c]}),i=t.join(`
2
2
  AND `),r=y(e,{where:i,params:o,limit:200}),a=d(e,{where:i,params:o,limit:200});return b(r,a)}function ee(e,n,t,o){let i=n.trim(),r=t,a=r.replace(/\(\)$/,""),s=n.toLowerCase(),c=t.toLowerCase(),h=c.replace(/\(\)$/,""),k=e.symbol,v=L(e.symbol),g=Q(e.symbol),A=e.display_name??"",_=e.symbol.toLowerCase(),u=v.toLowerCase(),m=g.toLowerCase(),D=A.toLowerCase(),p=e.relative_path.toLowerCase(),B=/[/:.]/.test(t),$=x(t),w=$?.leaf.toLowerCase(),l=0;return(k===i||k===r)&&(l+=1150),(v===i||v===r)&&(l+=1100),A===a&&(l+=1180),g===a&&(l+=1160),(`${g}()`===i||`${g}()`===r)&&(l+=955),(_===s||_===c)&&(l+=1e3),(u===s||u===c)&&(l+=950),(p===s||p===c)&&(l+=925),(p.endsWith(`/${c}`)||p.endsWith(`/${s}`))&&(l+=875),D===h&&(l+=850),m===h&&(l+=825),(`${m}()`===s||`${m}()`===c)&&(l+=820),(u.endsWith(`:${c}`)||u.endsWith(`:${h}`)||u.endsWith(`:${h}()`))&&(l+=800),_.includes(c)&&(l+=120),u.includes(c)&&(l+=140),p.includes(c)&&(l+=140),D.includes(c)&&(l+=110),o.every(F=>{let R=F.toLowerCase();return _.includes(R)||u.includes(R)||p.includes(R)||D.includes(R)})&&(l+=100+o.length*15),$&&p.includes($.path.toLowerCase())&&(l+=360,w&&(m===w||`${m}()`===w||`${m}()`==`${w}()`)&&(l+=700),I(e.symbol)&&(l+=180)),K(e.symbol)&&m===h&&(l+=60),!B&&O(e.symbol)&&(l-=160),l-=Math.min(50,Math.max(0,e.end_line-e.start_line)),l}function x(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 N(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function te(e){let n=N(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 ne(e,n,t){let o=n.trim(),i=e.filter(r=>{let a=L(r.symbol),s=(r.display_name??"").trim();return r.symbol===o||a===o||a===t||s===o||s===t||`${s}()`===o||f(r,t)>1||r.relative_path===o});return i.length===0?[]:(i.sort((r,a)=>f(a,t)-f(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),i)}function f(e,n){let t=x(n);if(!t)return 0;let o=e.relative_path.toLowerCase(),i=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return o.includes(r)?i!==a?1:I(e.symbol)?M(e.symbol)===null?5:4:M(e.symbol)===null?3:2:0}export{ue as a,j as b,me as c,pe as d};
3
- //# sourceMappingURL=chunk-2OXVAGGT.js.map
3
+ //# sourceMappingURL=chunk-SMQWE25B.js.map
@@ -1,2 +1,2 @@
1
- import{c as f}from"./chunk-XVJ3V7LM.js";import{a as h}from"./chunk-2OXVAGGT.js";import{e as s,g as u}from"./chunk-ZTTISZ7J.js";import{f as d}from"./chunk-7LABSJSR.js";import{B as c}from"./chunk-DGMCFMPG.js";import{basename as p}from"path";function N(r,o){let t=h(r,o);if(!t)return[];let e=s(t.symbol),a=new f(r).definitionsForFile(t.relativePath).filter(n=>u(n.symbol)),l=a.filter(n=>n.parentTypeName===e||n.symbol.includes(e)),m=(l.length>0?l:L(p(t.relativePath))===e?a.filter(n=>n.symbol.includes("<invalid-global-code>")):[]).map(n=>({startLine:n.startLine,endLine:n.endLine,name:s(n.symbol)}));return c(t.relativePath)!=="clojure"?m:b(m,M(r,t))}function L(r){return r.replace(/\.[^.]+$/,"")}function M(r,o){let t=s(o.symbol);return t?(d(r,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function b(r,o){let t=new Map;for(let e of[...r,...o])t.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...t.values()].sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine)}export{N as a};
2
- //# sourceMappingURL=chunk-K42M2KWT.js.map
1
+ import{c as f}from"./chunk-2SNGN6U4.js";import{a as h}from"./chunk-SMQWE25B.js";import{e as s,g as u}from"./chunk-RA3AYNWP.js";import{f as d}from"./chunk-MZZBAITE.js";import{x as c}from"./chunk-WUW7YUAH.js";import{basename as p}from"path";function N(r,o){let t=h(r,o);if(!t)return[];let e=s(t.symbol),a=new f(r).definitionsForFile(t.relativePath).filter(n=>u(n.symbol)),l=a.filter(n=>n.parentTypeName===e||n.symbol.includes(e)),m=(l.length>0?l:L(p(t.relativePath))===e?a.filter(n=>n.symbol.includes("<invalid-global-code>")):[]).map(n=>({startLine:n.startLine,endLine:n.endLine,name:s(n.symbol)}));return c(t.relativePath)!=="clojure"?m:b(m,M(r,t))}function L(r){return r.replace(/\.[^.]+$/,"")}function M(r,o){let t=s(o.symbol);return t?(d(r,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function b(r,o){let t=new Map;for(let e of[...r,...o])t.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...t.values()].sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine)}export{N as a};
2
+ //# sourceMappingURL=chunk-TAVELHYR.js.map
@@ -1,2 +1,2 @@
1
- import{B as u}from"./chunk-B5MHCHP3.js";function x(e,i){let l=new Map;return e.forEach((t,f)=>{let o=new Set;for(let r of i(t)){if(o.has(r))continue;o.add(r);let n=l.get(r);n?n.push(f):l.set(r,[f])}}),{candidatesFor:(t,f)=>{let o=new Set;for(let r of i(t)){let n=l.get(r);if(n)for(let a of n)a!==f&&o.add(a)}return[...o].sort((r,n)=>r-n)}}}function R(e){let i=c(e.profile?.name),l=()=>{let t=[];i=c(e.profile?.name,e);let f=(r,n)=>{let a=e.profiles[r],s=e.profiles[n];i.candidatePairs+=1,i.comparedPairs+=1;let d=e.compare(a,s);d&&t.push(d)};if(e.filePattern){let r=e.profiles.findIndex(n=>n.file.includes(e.filePattern));if(r>=0){let n=e.profiles[r];for(let a of m(e,r)){let s=e.profiles[a];e.focusFiles&&!e.focusFiles.has(n.file)&&!e.focusFiles.has(s.file)||f(r,a)}}}else if(e.focusFiles?.size!==0){let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let n=0;n<e.profiles.length;n+=1){let a=e.profiles[n],s=e.focusFiles?.has(a.file)??!1;for(let d of p(e,n))e.focusFiles&&!s&&!e.focusFiles.has(e.profiles[d].file)||f(n,d);if(t.length>r){i.overrunApplied=!0;break}}}t.sort(e.sort??((r,n)=>n.similarity-r.similarity)),i.matchedResults=t.length;let o=t.slice(0,e.limit);return i.emittedResults=o.length,e.onProfile?.({...i}),o};return e.profile?u(`pairwise-profile:${e.profile.name}`,l,()=>({...b(e.profile?.metadata),...i})):l()}function m(e,i){if(e.candidateIndex)return P(e,i,-1);let l=[];for(let t=0;t<e.profiles.length;t+=1)t!==i&&l.push(t);return l}function p(e,i){if(e.candidateIndex)return P(e,i,i);let l=[];for(let t=i+1;t<e.profiles.length;t+=1)l.push(t);return l}function P(e,i,l){let t=e.profiles[i],f=new Set;for(let o of e.candidateIndex?.candidatesFor(t,i,e.profiles)??[])o<=l||o!==i&&(o<0||o>=e.profiles.length||f.add(o));return[...f].sort((o,r)=>o-r)}function c(e,i){return{pipeline:e,profileCount:i?.profiles.length??0,focusedProfileCount:i?.focusFiles?i.profiles.filter(l=>i.focusFiles.has(l.file)).length:0,candidatePairs:0,comparedPairs:0,matchedResults:0,emittedResults:0,candidateIndexApplied:i?.candidateIndex!==void 0,focusApplied:i?.focusFiles!==void 0,filePatternApplied:i?.filePattern!==void 0,overrunApplied:!1}}function b(e){return typeof e=="function"?e():e??{}}export{x as a,R as b};
2
- //# sourceMappingURL=chunk-MGBJHRFB.js.map
1
+ import{A as u}from"./chunk-JORHF5AL.js";function x(e,i){let l=new Map;return e.forEach((t,f)=>{let o=new Set;for(let r of i(t)){if(o.has(r))continue;o.add(r);let n=l.get(r);n?n.push(f):l.set(r,[f])}}),{candidatesFor:(t,f)=>{let o=new Set;for(let r of i(t)){let n=l.get(r);if(n)for(let a of n)a!==f&&o.add(a)}return[...o].sort((r,n)=>r-n)}}}function R(e){let i=c(e.profile?.name),l=()=>{let t=[];i=c(e.profile?.name,e);let f=(r,n)=>{let a=e.profiles[r],s=e.profiles[n];i.candidatePairs+=1,i.comparedPairs+=1;let d=e.compare(a,s);d&&t.push(d)};if(e.filePattern){let r=e.profiles.findIndex(n=>n.file.includes(e.filePattern));if(r>=0){let n=e.profiles[r];for(let a of m(e,r)){let s=e.profiles[a];e.focusFiles&&!e.focusFiles.has(n.file)&&!e.focusFiles.has(s.file)||f(r,a)}}}else if(e.focusFiles?.size!==0){let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let n=0;n<e.profiles.length;n+=1){let a=e.profiles[n],s=e.focusFiles?.has(a.file)??!1;for(let d of p(e,n))e.focusFiles&&!s&&!e.focusFiles.has(e.profiles[d].file)||f(n,d);if(t.length>r){i.overrunApplied=!0;break}}}t.sort(e.sort??((r,n)=>n.similarity-r.similarity)),i.matchedResults=t.length;let o=t.slice(0,e.limit);return i.emittedResults=o.length,e.onProfile?.({...i}),o};return e.profile?u(`pairwise-profile:${e.profile.name}`,l,()=>({...b(e.profile?.metadata),...i})):l()}function m(e,i){if(e.candidateIndex)return P(e,i,-1);let l=[];for(let t=0;t<e.profiles.length;t+=1)t!==i&&l.push(t);return l}function p(e,i){if(e.candidateIndex)return P(e,i,i);let l=[];for(let t=i+1;t<e.profiles.length;t+=1)l.push(t);return l}function P(e,i,l){let t=e.profiles[i],f=new Set;for(let o of e.candidateIndex?.candidatesFor(t,i,e.profiles)??[])o<=l||o!==i&&(o<0||o>=e.profiles.length||f.add(o));return[...f].sort((o,r)=>o-r)}function c(e,i){return{pipeline:e,profileCount:i?.profiles.length??0,focusedProfileCount:i?.focusFiles?i.profiles.filter(l=>i.focusFiles.has(l.file)).length:0,candidatePairs:0,comparedPairs:0,matchedResults:0,emittedResults:0,candidateIndexApplied:i?.candidateIndex!==void 0,focusApplied:i?.focusFiles!==void 0,filePatternApplied:i?.filePattern!==void 0,overrunApplied:!1}}function b(e){return typeof e=="function"?e():e??{}}export{x as a,R as b};
2
+ //# sourceMappingURL=chunk-TWMJ3Y3G.js.map