scip-query 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +1 -0
  2. package/dist/{chunk-ECVXWZ4Q.js → chunk-27HMTUJE.js} +2 -2
  3. package/dist/{chunk-2LQWMYG4.js → chunk-27XEGMCT.js} +2 -2
  4. package/dist/{chunk-NKT5EMEX.js → chunk-2TPCIPYA.js} +2 -2
  5. package/dist/{chunk-ZOIPAYRP.js → chunk-2XRXEIRK.js} +2 -2
  6. package/dist/{chunk-Q3B3FNCU.js → chunk-3AMWF6V5.js} +2 -2
  7. package/dist/{chunk-BVNO67DB.js → chunk-3H5OSDF7.js} +2 -2
  8. package/dist/{chunk-D64L53WX.js → chunk-43GKP6LI.js} +2 -2
  9. package/dist/{chunk-F5BJSNU5.js → chunk-44P4SJFN.js} +2 -2
  10. package/dist/{chunk-T7VQG55Q.js → chunk-5JRMZMLM.js} +2 -2
  11. package/dist/{chunk-72MFTCU5.js → chunk-5VY3RIEI.js} +2 -2
  12. package/dist/{chunk-D7J6GZAG.js → chunk-6JUAGXR4.js} +2 -2
  13. package/dist/{chunk-NQ75OVUU.js → chunk-6KDOYKCB.js} +2 -2
  14. package/dist/chunk-6KMTPNZL.js +3 -0
  15. package/dist/{chunk-TTMKELT7.js → chunk-72FR7KEZ.js} +2 -2
  16. package/dist/{chunk-FXG3PHVW.js → chunk-7COVQPQQ.js} +6 -6
  17. package/dist/{chunk-MBKJ7GHT.js → chunk-7TVFPOD7.js} +2 -2
  18. package/dist/{chunk-M72ZFN6E.js → chunk-A6KSEIRN.js} +2 -2
  19. package/dist/{chunk-52Q4JFDW.js → chunk-AAMURYOK.js} +2 -2
  20. package/dist/{chunk-XEMQUN3Z.js → chunk-BP7S6V3M.js} +2 -2
  21. package/dist/{chunk-ETU2I5JM.js → chunk-BRBF3E5X.js} +2 -2
  22. package/dist/{chunk-V7CVBPWX.js → chunk-BUNDZ6K2.js} +2 -2
  23. package/dist/{chunk-NAH5EAZS.js → chunk-BZXE3HO4.js} +2 -2
  24. package/dist/{chunk-AZLKLZ5S.js → chunk-CXQQOXSI.js} +2 -2
  25. package/dist/{chunk-RIQED5OU.js → chunk-EDSD3VJK.js} +2 -2
  26. package/dist/chunk-EVZSAR3S.js +2 -0
  27. package/dist/{chunk-L2CX5GHZ.js → chunk-GMOEX7EV.js} +2 -2
  28. package/dist/{chunk-O3WDE26W.js → chunk-GUDKRIGW.js} +2 -2
  29. package/dist/{chunk-MKM7NBZK.js → chunk-GULVO6NF.js} +2 -2
  30. package/dist/{chunk-V3Z3IOWO.js → chunk-GY3HAWUA.js} +2 -2
  31. package/dist/{chunk-G2UBOONK.js → chunk-HV27H2V2.js} +2 -2
  32. package/dist/chunk-HZZQKNVE.js +2 -0
  33. package/dist/{chunk-T6NGEV5I.js → chunk-I4R3SNMR.js} +2 -2
  34. package/dist/{chunk-UAHZ57BR.js → chunk-IMQFJ53K.js} +2 -2
  35. package/dist/{chunk-NJJ7AS4F.js → chunk-IUSSGHJO.js} +2 -2
  36. package/dist/{chunk-OVMUVXKQ.js → chunk-JJUX2OAP.js} +2 -2
  37. package/dist/chunk-JZBGTSAB.js +13 -0
  38. package/dist/{chunk-YPKBZ77R.js → chunk-K5N5RNGM.js} +2 -2
  39. package/dist/{chunk-OSWF3HSF.js → chunk-K7SPOJHZ.js} +2 -2
  40. package/dist/{chunk-BCNT6ODA.js → chunk-KSJ544IV.js} +2 -2
  41. package/dist/{chunk-HSU3M25J.js → chunk-KYB7FPXT.js} +2 -2
  42. package/dist/{chunk-ORBRX2QJ.js → chunk-LY7NMOBW.js} +2 -2
  43. package/dist/{chunk-CW3KZ7UF.js → chunk-M7EEHYSU.js} +2 -2
  44. package/dist/{chunk-U7I373V4.js → chunk-N23FT4EZ.js} +2 -2
  45. package/dist/{chunk-ZRIOGL7F.js → chunk-N2OTJWC2.js} +2 -2
  46. package/dist/{chunk-PH7ZFK6L.js → chunk-NCVFKOLB.js} +2 -2
  47. package/dist/{chunk-2QGE5AEP.js → chunk-NOKUZU56.js} +2 -2
  48. package/dist/{chunk-BP2NAIAZ.js → chunk-OXTM2RX3.js} +2 -2
  49. package/dist/{chunk-RA5MTIOO.js → chunk-PEHDARNC.js} +2 -2
  50. package/dist/chunk-PESEPWZO.js +2 -0
  51. package/dist/{chunk-LFM3O5KX.js → chunk-PMY4UFGV.js} +2 -2
  52. package/dist/{chunk-H7NSJ7L2.js → chunk-Q7PWDXL5.js} +2 -2
  53. package/dist/{chunk-FBCOFKEC.js → chunk-QVGFVRKD.js} +2 -2
  54. package/dist/{chunk-Q7S2DADC.js → chunk-QYOPMTZ6.js} +2 -2
  55. package/dist/{chunk-VYF5HA76.js → chunk-QZOAOLLZ.js} +2 -2
  56. package/dist/{chunk-NLMRJ7SI.js → chunk-R7U2I55B.js} +2 -2
  57. package/dist/{chunk-64PRNLKP.js → chunk-RLB6SG25.js} +2 -2
  58. package/dist/{chunk-MJKJMWIM.js → chunk-SFDVBARK.js} +2 -2
  59. package/dist/{chunk-B4VYXRCQ.js → chunk-TYCZ7S4I.js} +2 -2
  60. package/dist/{chunk-4D54JIU3.js → chunk-U3VMUDXJ.js} +2 -2
  61. package/dist/chunk-UHPWZCYQ.js +3 -0
  62. package/dist/{chunk-OPE5YXFE.js → chunk-V5W7H7V4.js} +2 -2
  63. package/dist/{chunk-YDDGCJJG.js → chunk-WMO2VZZK.js} +2 -2
  64. package/dist/chunk-WPZPB42I.js +2 -0
  65. package/dist/{chunk-EXKLAEB4.js → chunk-X3DTIEMU.js} +2 -2
  66. package/dist/chunk-X5C43YVI.js +2 -0
  67. package/dist/{chunk-IRJDYTNZ.js → chunk-XC2PJOVM.js} +2 -2
  68. package/dist/{chunk-Z3IPJKJP.js → chunk-XDESMVOL.js} +2 -2
  69. package/dist/{chunk-KSUZS77X.js → chunk-XZBLZHXL.js} +2 -2
  70. package/dist/{chunk-7ITCOJGD.js → chunk-YQKECTPV.js} +2 -2
  71. package/dist/chunk-YTVKPJXW.js +2 -0
  72. package/dist/{chunk-75X52JTA.js → chunk-ZEO4CXQR.js} +2 -2
  73. package/dist/cli.js +256 -244
  74. package/dist/index.js +1 -1
  75. package/dist/queries/affected.js +1 -1
  76. package/dist/queries/bottlenecks.js +1 -1
  77. package/dist/queries/by-kind.js +1 -1
  78. package/dist/queries/call-graph.js +1 -1
  79. package/dist/queries/change-surface.js +1 -1
  80. package/dist/queries/cleanup-plan.js +1 -1
  81. package/dist/queries/co-change.js +1 -1
  82. package/dist/queries/code.js +1 -1
  83. package/dist/queries/complexity-hotspots.js +1 -1
  84. package/dist/queries/complexity.js +1 -1
  85. package/dist/queries/convergence.js +1 -1
  86. package/dist/queries/coupling.js +1 -1
  87. package/dist/queries/cycles.js +1 -1
  88. package/dist/queries/dataflow.js +1 -1
  89. package/dist/queries/dead.js +1 -1
  90. package/dist/queries/decorative-checkers.d.ts +34 -0
  91. package/dist/queries/decorative-checkers.js +2 -0
  92. package/dist/queries/deep-chains.js +1 -1
  93. package/dist/queries/deps.js +1 -1
  94. package/dist/queries/diff-gate.js +1 -1
  95. package/dist/queries/diff-impact.js +1 -1
  96. package/dist/queries/doc-drift.js +1 -1
  97. package/dist/queries/drift.js +1 -1
  98. package/dist/queries/duplicate-bodies.js +1 -1
  99. package/dist/queries/extract-candidates.js +1 -1
  100. package/dist/queries/fan.js +1 -1
  101. package/dist/queries/health.js +1 -1
  102. package/dist/queries/hierarchy.js +1 -1
  103. package/dist/queries/hotspots.js +1 -1
  104. package/dist/queries/imports.js +1 -1
  105. package/dist/queries/incomplete-migration.js +1 -1
  106. package/dist/queries/index.d.ts +3 -0
  107. package/dist/queries/index.js +1 -1
  108. package/dist/queries/isolated.js +1 -1
  109. package/dist/queries/locality-candidates.js +1 -1
  110. package/dist/queries/members.js +1 -1
  111. package/dist/queries/methods.js +1 -1
  112. package/dist/queries/not-implemented.d.ts +33 -0
  113. package/dist/queries/not-implemented.js +2 -0
  114. package/dist/queries/outline.js +1 -1
  115. package/dist/queries/passthrough-candidates.js +1 -1
  116. package/dist/queries/plan-context.js +1 -1
  117. package/dist/queries/recent-duplicates.js +1 -1
  118. package/dist/queries/redundant-reexports.js +1 -1
  119. package/dist/queries/refs.js +1 -1
  120. package/dist/queries/self-audit.js +1 -1
  121. package/dist/queries/similar-chains.js +1 -1
  122. package/dist/queries/similar-files.js +1 -1
  123. package/dist/queries/similar-signatures.js +1 -1
  124. package/dist/queries/similar.js +1 -1
  125. package/dist/queries/slice.js +1 -1
  126. package/dist/queries/stale-abstractions.js +1 -1
  127. package/dist/queries/surface.js +1 -1
  128. package/dist/queries/symbols.js +1 -1
  129. package/dist/queries/system.js +1 -1
  130. package/dist/queries/test-quality.d.ts +56 -0
  131. package/dist/queries/test-quality.js +2 -0
  132. package/dist/queries/trace.js +1 -1
  133. package/dist/queries/twin-ab.js +1 -1
  134. package/dist/queries/twin-drift.d.ts +23 -1
  135. package/dist/queries/twin-drift.js +1 -1
  136. package/dist/queries/unused-imports.js +1 -1
  137. package/dist/queries/unused-params.js +1 -1
  138. package/dist/queries/wrapper-candidates.js +1 -1
  139. package/dist/runtime.js +1 -1
  140. package/docs/COMMAND_REFERENCE.md +4 -1
  141. package/docs/analyzer-inventory.md +16 -0
  142. package/package.json +14 -2
  143. package/skills/_shared/SKILL.md +4 -1
  144. package/skills/scip-calibrate/SKILL.md +124 -0
  145. package/skills/scip-calibrate/agents/openai.yaml +4 -0
  146. package/skills/scip-integrity-audit/SKILL.md +32 -0
  147. package/skills/scip-tla-model-system/SKILL.md +7 -9
  148. package/dist/chunk-EDB7Y442.js +0 -2
  149. package/dist/chunk-EZ5WDZ2Q.js +0 -3
  150. package/dist/chunk-H2NMIZFD.js +0 -2
  151. package/dist/chunk-HXXMPYEF.js +0 -2
  152. package/dist/chunk-PXHPCWX5.js +0 -2
  153. package/dist/chunk-T2FQ4GHD.js +0 -9
@@ -1,2 +1,2 @@
1
- import{a as ae}from"./chunk-7JZRFDCU.js";import{a as ue}from"./chunk-R5336VHZ.js";import{a as ne}from"./chunk-ZMGBWSFZ.js";import{a as ce}from"./chunk-TG7QSYCJ.js";import{a as se}from"./chunk-URSSPS5H.js";import{a as ie}from"./chunk-5AAAEZ2Z.js";import{a as oe}from"./chunk-J5WVNZ6O.js";import{b as G,e as m}from"./chunk-75X52JTA.js";import{a as te}from"./chunk-2LQWMYG4.js";import{b as W}from"./chunk-EDB7Y442.js";import{a as Z}from"./chunk-D7J6GZAG.js";import{a as ee}from"./chunk-C2QSK7E7.js";import{a as Q}from"./chunk-EZ5WDZ2Q.js";import{a as X}from"./chunk-OVMUVXKQ.js";import{a as Y}from"./chunk-EXKLAEB4.js";import{a as K}from"./chunk-ZOIPAYRP.js";import{a as U}from"./chunk-Q3B3FNCU.js";import{a as A,b as q}from"./chunk-FBCOFKEC.js";import{b as N}from"./chunk-NJJ7AS4F.js";import{a as z}from"./chunk-FXG3PHVW.js";import{a as re}from"./chunk-Z3IPJKJP.js";import{f as J}from"./chunk-BCNT6ODA.js";import{a as j}from"./chunk-ORBRX2QJ.js";import{f as k,g as M}from"./chunk-NAH5EAZS.js";import{h as _}from"./chunk-WS3Z6W3M.js";function de(e,r){let t=new Map;for(let o of e){let n=t.get(o.check)??[];n.push(o),t.set(o.check,n)}let i=[];for(let[o,n]of t){let c=n.filter(d=>d.outcome==="resolved").length,s=n.filter(d=>d.outcome==="suppressed").length,l=n.filter(d=>d.outcome==="still-open").length,h=n.length,C=n.filter(d=>d.outcome==="still-open").sort((d,b)=>d.firstSeen-b.firstSeen)[0];i.push({check:o,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)/Ie):null})}return i.sort((o,n)=>o.check.localeCompare(n.check))}var Ie=864e5;function le(e){return _(e).map(r=>({check:r.check,findingId:r.findingId,firstSeen:r.firstSeen,lastSeen:r.lastSeen,timesShown:r.timesShown,outcome:r.outcome}))}function f(e){return e.scoreCount??e.count}function B(e){let r=ze(e),{breakdown:t,pressure:i}=Ne(e),o=me(t,"risk"),n=me(t,"hygiene");return{score:Math.min(o,n),riskScore:o,hygieneScore:n,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:Oe(e),validation:_e(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0,detectorPrecision:[]}}function Oe(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:Ve(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 Ve(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 _e(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()),o=0,n=0,c=0;for(let[C,d]of Object.entries(r))i.has(C)?o+=d.fixChanges:(n+=d.fixChanges,c+=1);let s=i.size>0?g(o/i.size):0,l=c>0?g(n/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 R of b)S+=r[R]?.fixChanges??0;let x=g(S/b.size);h[C]={flaggedFiles:b.size,fixDensity:x,lift:l>0?g(x/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 y(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 ze(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} symbols with zero references anywhere -- deletion candidates; confirm with cleanup-plan --verify before deleting`,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} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,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 the same concept implemented twice; consolidate or verify the drift is intentional`,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 extract or reuse the shared UI concept`,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${y(e.reactHookCandidates)} \u2014 extract or reuse a hook`,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 extract or reuse the shared UI concept`,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${y(e.vueComposableCandidates)} \u2014 extract or reuse a composable`,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${y(e.wrappers,"boundary-evidence discount")} \u2014 inline direct wrappers or review boundary signals`,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 just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let o=[];e.stale.unused>0&&o.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&o.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${o.join(", ")} \u2014 remove unused abstractions; review single-consumer ownership before moving or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let o=[];e.drift.unusedImports>0&&o.push(`${e.drift.unusedImports} unused imports`),e.drift.layerViolations>0&&o.push(`${e.drift.layerViolations} layer violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${o.join(", ")} \u2014 remove direct drift; review signal drift against layer ownership`,effort:e.drift.layerViolations>0?"medium":"low",impact:e.drift.layerViolations>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 o=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`+y({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(o?` (e.g. ${o.fileA} \u2194 ${o.fileB})`:"")+" \u2014 name the shared concept or enforce the sync",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((o,n)=>{let c=t[o.impact]*i[o.effort];return t[n.impact]*i[n.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,o)=>i+o.points,0);return Math.max(0,Math.min(100,100-t))}function Ne(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(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 L=Math.max(Ae,1);if(v<=L)return;let P=v/L,E=Math.min(Be,Math.ceil(Math.log2(P)*Te));if(E<=0)return;let $e=pe[p]??"hygiene";o.push({axis:p,category:H,kind:$e,count:v,threshold:g(L),ratio:g(P),extraPenalty:E}),n(p,E,`${v} ${Fe} exceed pressure threshold ${g(L)} (${g(P)}x)`)},s=e.dead.count/t;n("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;n("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let h=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(h)),`${e.similarCount} similar function pair(s)`);let C=e.duplicateBodies.count/t*1e3;n("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;n("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;n("react-component-duplicates",Math.min(10,Math.round(b)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let S=f(e.reactHookCandidates),x=S/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(x)),w(e.reactHookCandidates,"duplicated React behavior pair(s)"));let R=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(R/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Pe=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(Pe)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let I=f(e.vueComposableCandidates),Ee=I/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(Ee)),w(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let ke=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(ke/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let O=f(e.wrappers);n("wrappers",Math.min(3,O),w(e.wrappers,"wrapper candidate(s)"));let V=f(e.passthroughs);n("passthroughs",Math.min(3,V),w(e.passthroughs,"passthrough candidate(s)")),n("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(n("drift",Math.min(5,Math.round(Me*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let p=e.gitEvidence.hiddenCoupling.scoreCount;n("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",I,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",O,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:o}}import{getHeapStatistics as Ue}from"v8";var We=64*1024*1024;function T(){let e=globalThis.gc;if(!e)return;let r=Ue();r.heap_size_limit-r.used_heap_size<We||e()}var Ge=50,je=25e3,qe=2500,ge=2500,fe=50,Ye=10,Ke=["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:Je(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:Ze(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:et(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:tt(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:it(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:nt(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:ct(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:st(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:at(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:ut(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:dt(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:rt(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:lt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:pt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:mt(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:Ct(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:bt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:ht(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:gt(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:ft(e,t)})};function dr(e,r={}){return Se(e,r.full!==!1,(t,i)=>{let o=Qe(e,r.scope,t,i),n=B(o);return n.detectorPrecision=de(le(e),Date.now()),n})}function lr(e,r,t={}){return Xe(e,[r],t)[0]}function Xe(e,r,t={}){return Se(e,t.full!==!1,(i,o)=>{let n={...o,releaseCachesBetweenPhases:!1};return r.map(c=>ve[c](e,t.scope,n,i))})}function Se(e,r,t){let i=ee(e),o=vt(i,r);try{return t(i,o)}finally{A(e,{semanticProvider:!0}),T()}}function pr(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(Ke.map(o=>ve[o](e,r,i,t)))}function Je(e,r,t){return a(e,t,"dead",()=>{let i=q(e,{scope:r,...m.dead,scanLimit:t.candidateScanLimit});return D(xt(e,i.symbols))})}function Ze(e,r,t){return a(e,t,"isolated",()=>{let i=X(e,{scope:r,...m.isolated,scanLimit:t.candidateScanLimit});return D(Ht(e,i))})}function et(e,r,t){return a(e,t,"cycles",()=>j(e,{scope:r}).filter(o=>o.kind==="real").length)}function tt(e,r,t){let i=a(e,t,"similar",()=>J(e,{scope:r,...m.similar,scanLimit:t.candidateScanLimit}));return Math.min(i,t.candidateResultLimit)}function rt(e,r,t){return a(e,t,"extract-candidates",()=>K(e,{scope:r,...m.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function it(e,r,t){return a(e,t,"duplicate-bodies",()=>{let i=U(e,{scope:r,...m.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=new Set,n=0;for(let c of i)for(let s of c.functions.slice(1))o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o]}})}function ot(e,r,t){return a(e,t,"twin-drift",()=>{let i=W(e,{scope:r,...m.twinDrift,scanLimit:t.candidateScanLimit}).filter(c=>c.relationship==="divergent"||c.relationship==="identical"),o=new Set,n=0;for(let c of i)for(let s of c.members)o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o].sort()}})}function nt(e,r,t){return a(e,t,"react-component-duplicates",()=>{let i=ie(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return F(i)})}function ct(e,r,t){return a(e,t,"react-hook-candidates",()=>{let i=oe(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return He(i,yt)})}function st(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 at(e,r,t){return a(e,t,"vue-component-duplicates",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return F(i)})}function ut(e,r,t){return a(e,t,"vue-composable-candidates",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return He(i,Dt)})}function dt(e,r,t){return a(e,t,"vue-large-view-pressure",()=>{let i=ae(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return D(i)})}function lt(e,r,t){return a(e,t,"wrapper-candidates",()=>{let i=te(e,{scope:r,...m.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return xe(i,Rt)})}function pt(e,r,t){return a(e,t,"passthrough-candidates",()=>{let i=Q(e,{scope:r,...m.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return xe(i,Pt)})}function mt(e,r,t){return a(e,t,"stale-abstractions",()=>{let i=Z(e,{scope:r,...m.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,c)=>n+c.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function ht(e,r){return a(e,r,"git-evidence",()=>{let t=z(e),i=t.fileChurn();if(!i)return null;let o=t.commitHistory(),n=N(e,void 0,{limit:r.candidateResultLimit}),c={};for(let[s,l]of i)c[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:n.findings.length,scoreCount:$(n.findings.reduce((s,l)=>s+be(l),0)),top:n.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:o?.commits.length??0}})}function gt(e,r){return a(e,r,"suppressions",()=>{let t=ue(e);return{total:t.total,byCategory:{...t.byCategory}}})}function ft(e,r){return a(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],o=G(e,t).filter(n=>n.status!=="ok");return{count:o.length,loc:0,files:[...new Set(o.map(n=>n.file))].sort()}})}function Ct(e,r,t){return a(e,t,"drift",()=>{let i=Y(e,{scope:r,...m.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}),o=i.results.filter(s=>s.kind!=="pattern-deviation"),n=o.filter(s=>s.actionTier==="direct").length,c=o.length-n;return{count:o.length,unusedImports:i.unusedImports,layerViolations:i.layerViolations,direct:n,signal:c}})}function bt(e,r,t){return a(e,t,"complexity-hotspots",()=>{let i=re(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:!1});return{top:i.slice(0,5).map(o=>({symbol:o.shortName,score:o.score,file:o.file})),extremeCount:i.filter(o=>o.score>Ge).length}})}function vt(e,r){let t=e.symbols>=je||e.documents>=qe,i=r?Number.POSITIVE_INFINITY:fe,o=r?Number.POSITIVE_INFINITY:Ye;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:o,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:o,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 St(e,r){r.releaseCachesBetweenPhases&&(A(e),T())}function a(e,r,t,i){wt(t);try{return i()}finally{St(e,r)}}function wt(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function xt(e,r){return r.filter(t=>!k(e,t.relativePath)&&!M(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function Ht(e,r){return r.filter(t=>!k(e,t.relativePath)&&!M(e,t.symbol,t.relativePath))}function D(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 xe(e,r){return{...D(e),scoreCount:$(e.reduce((i,o)=>i+r(o),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:$(e.reduce((i,o)=>i+r(o),0))}}function yt(e){let r=e.sharedHooks.length>0,t=Le({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:ye(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Dt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=Le({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:ye(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function Le(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Re.has(De(r))).length+Math.min(e.functions.length,3)}function ye(e,r,t){let i=[...e,...r,...t].map(De);return i.length>0&&i.every(o=>Re.has(o))}function De(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Rt(e){return e.actionTier==="signal"?.25:1}function Pt(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 $(e){return Math.round(e*100)/100}var Re=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{Ke as a,dr as b,lr as c,Xe as d,pr as e};
2
- //# sourceMappingURL=chunk-4D54JIU3.js.map
1
+ import{a as ae}from"./chunk-7JZRFDCU.js";import{a as ue}from"./chunk-R5336VHZ.js";import{a as ne}from"./chunk-ZMGBWSFZ.js";import{a as se}from"./chunk-URSSPS5H.js";import{a as ce}from"./chunk-TG7QSYCJ.js";import{a as ie}from"./chunk-5AAAEZ2Z.js";import{a as oe}from"./chunk-J5WVNZ6O.js";import{b as G,e as m}from"./chunk-ZEO4CXQR.js";import{a as te}from"./chunk-27XEGMCT.js";import{a as Z}from"./chunk-6JUAGXR4.js";import{a as ee}from"./chunk-C2QSK7E7.js";import{a as Q}from"./chunk-6KMTPNZL.js";import{a as X}from"./chunk-JJUX2OAP.js";import{a as Y}from"./chunk-X3DTIEMU.js";import{a as K}from"./chunk-2XRXEIRK.js";import{b as W}from"./chunk-HZZQKNVE.js";import{a as U}from"./chunk-3AMWF6V5.js";import{a as A,b as q}from"./chunk-QVGFVRKD.js";import{b as N}from"./chunk-IUSSGHJO.js";import{a as z}from"./chunk-7COVQPQQ.js";import{a as re}from"./chunk-XDESMVOL.js";import{f as J}from"./chunk-KSJ544IV.js";import{a as j}from"./chunk-LY7NMOBW.js";import{f as k,g as M}from"./chunk-BZXE3HO4.js";import{h as _}from"./chunk-WS3Z6W3M.js";function de(e,r){let t=new Map;for(let o of e){let n=t.get(o.check)??[];n.push(o),t.set(o.check,n)}let i=[];for(let[o,n]of t){let c=n.filter(d=>d.outcome==="resolved").length,s=n.filter(d=>d.outcome==="suppressed").length,l=n.filter(d=>d.outcome==="still-open").length,h=n.length,C=n.filter(d=>d.outcome==="still-open").sort((d,b)=>d.firstSeen-b.firstSeen)[0];i.push({check:o,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)/Ie):null})}return i.sort((o,n)=>o.check.localeCompare(n.check))}var Ie=864e5;function le(e){return _(e).map(r=>({check:r.check,findingId:r.findingId,firstSeen:r.firstSeen,lastSeen:r.lastSeen,timesShown:r.timesShown,outcome:r.outcome}))}function f(e){return e.scoreCount??e.count}function B(e){let r=ze(e),{breakdown:t,pressure:i}=Ne(e),o=me(t,"risk"),n=me(t,"hygiene");return{score:Math.min(o,n),riskScore:o,hygieneScore:n,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:Oe(e),validation:_e(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0,detectorPrecision:[]}}function Oe(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:Ve(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 Ve(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 _e(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()),o=0,n=0,c=0;for(let[C,d]of Object.entries(r))i.has(C)?o+=d.fixChanges:(n+=d.fixChanges,c+=1);let s=i.size>0?g(o/i.size):0,l=c>0?g(n/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 R of b)S+=r[R]?.fixChanges??0;let x=g(S/b.size);h[C]={flaggedFiles:b.size,fixDensity:x,lift:l>0?g(x/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 y(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 ze(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} symbols with zero references anywhere -- deletion candidates; confirm with cleanup-plan --verify before deleting`,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} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,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 the same concept implemented twice; consolidate or verify the drift is intentional`,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 extract or reuse the shared UI concept`,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${y(e.reactHookCandidates)} \u2014 extract or reuse a hook`,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 extract or reuse the shared UI concept`,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${y(e.vueComposableCandidates)} \u2014 extract or reuse a composable`,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${y(e.wrappers,"boundary-evidence discount")} \u2014 inline direct wrappers or review boundary signals`,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 just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let o=[];e.stale.unused>0&&o.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&o.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${o.join(", ")} \u2014 remove unused abstractions; review single-consumer ownership before moving or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let o=[];e.drift.unusedImports>0&&o.push(`${e.drift.unusedImports} unused imports`),e.drift.layerViolations>0&&o.push(`${e.drift.layerViolations} layer violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${o.join(", ")} \u2014 remove direct drift; review signal drift against layer ownership`,effort:e.drift.layerViolations>0?"medium":"low",impact:e.drift.layerViolations>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 o=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`+y({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(o?` (e.g. ${o.fileA} \u2194 ${o.fileB})`:"")+" \u2014 name the shared concept or enforce the sync",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((o,n)=>{let c=t[o.impact]*i[o.effort];return t[n.impact]*i[n.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,o)=>i+o.points,0);return Math.max(0,Math.min(100,100-t))}function Ne(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(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 L=Math.max(Ae,1);if(v<=L)return;let P=v/L,E=Math.min(Be,Math.ceil(Math.log2(P)*Te));if(E<=0)return;let $e=pe[p]??"hygiene";o.push({axis:p,category:H,kind:$e,count:v,threshold:g(L),ratio:g(P),extraPenalty:E}),n(p,E,`${v} ${Fe} exceed pressure threshold ${g(L)} (${g(P)}x)`)},s=e.dead.count/t;n("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;n("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let h=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(h)),`${e.similarCount} similar function pair(s)`);let C=e.duplicateBodies.count/t*1e3;n("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;n("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;n("react-component-duplicates",Math.min(10,Math.round(b)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let S=f(e.reactHookCandidates),x=S/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(x)),w(e.reactHookCandidates,"duplicated React behavior pair(s)"));let R=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(R/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Pe=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(Pe)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let I=f(e.vueComposableCandidates),Ee=I/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(Ee)),w(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let ke=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(ke/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let O=f(e.wrappers);n("wrappers",Math.min(3,O),w(e.wrappers,"wrapper candidate(s)"));let V=f(e.passthroughs);n("passthroughs",Math.min(3,V),w(e.passthroughs,"passthrough candidate(s)")),n("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(n("drift",Math.min(5,Math.round(Me*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let p=e.gitEvidence.hiddenCoupling.scoreCount;n("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",I,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",O,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:o}}import{getHeapStatistics as Ue}from"v8";var We=64*1024*1024;function T(){let e=globalThis.gc;if(!e)return;let r=Ue();r.heap_size_limit-r.used_heap_size<We||e()}var Ge=50,je=25e3,qe=2500,ge=2500,fe=50,Ye=10,Ke=["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:Je(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:Ze(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:et(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:tt(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:it(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:nt(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:ct(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:st(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:at(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:ut(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:dt(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:rt(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:lt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:pt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:mt(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:Ct(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:bt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:ht(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:gt(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:ft(e,t)})};function dr(e,r={}){return Se(e,r.full!==!1,(t,i)=>{let o=Qe(e,r.scope,t,i),n=B(o);return n.detectorPrecision=de(le(e),Date.now()),n})}function lr(e,r,t={}){return Xe(e,[r],t)[0]}function Xe(e,r,t={}){return Se(e,t.full!==!1,(i,o)=>{let n={...o,releaseCachesBetweenPhases:!1};return r.map(c=>ve[c](e,t.scope,n,i))})}function Se(e,r,t){let i=ee(e),o=vt(i,r);try{return t(i,o)}finally{A(e,{semanticProvider:!0}),T()}}function pr(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(Ke.map(o=>ve[o](e,r,i,t)))}function Je(e,r,t){return a(e,t,"dead",()=>{let i=q(e,{scope:r,...m.dead,scanLimit:t.candidateScanLimit});return D(xt(e,i.symbols))})}function Ze(e,r,t){return a(e,t,"isolated",()=>{let i=X(e,{scope:r,...m.isolated,scanLimit:t.candidateScanLimit});return D(Ht(e,i))})}function et(e,r,t){return a(e,t,"cycles",()=>j(e,{scope:r}).filter(o=>o.kind==="real").length)}function tt(e,r,t){let i=a(e,t,"similar",()=>J(e,{scope:r,...m.similar,scanLimit:t.candidateScanLimit}));return Math.min(i,t.candidateResultLimit)}function rt(e,r,t){return a(e,t,"extract-candidates",()=>K(e,{scope:r,...m.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function it(e,r,t){return a(e,t,"duplicate-bodies",()=>{let i=U(e,{scope:r,...m.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=new Set,n=0;for(let c of i)for(let s of c.functions.slice(1))o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o]}})}function ot(e,r,t){return a(e,t,"twin-drift",()=>{let i=W(e,{scope:r,...m.twinDrift,scanLimit:t.candidateScanLimit}).filter(c=>c.relationship==="divergent"||c.relationship==="identical"),o=new Set,n=0;for(let c of i)for(let s of c.members)o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o].sort()}})}function nt(e,r,t){return a(e,t,"react-component-duplicates",()=>{let i=ie(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return F(i)})}function ct(e,r,t){return a(e,t,"react-hook-candidates",()=>{let i=oe(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return He(i,yt)})}function st(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 at(e,r,t){return a(e,t,"vue-component-duplicates",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return F(i)})}function ut(e,r,t){return a(e,t,"vue-composable-candidates",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return He(i,Dt)})}function dt(e,r,t){return a(e,t,"vue-large-view-pressure",()=>{let i=ae(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return D(i)})}function lt(e,r,t){return a(e,t,"wrapper-candidates",()=>{let i=te(e,{scope:r,...m.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return xe(i,Rt)})}function pt(e,r,t){return a(e,t,"passthrough-candidates",()=>{let i=Q(e,{scope:r,...m.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return xe(i,Pt)})}function mt(e,r,t){return a(e,t,"stale-abstractions",()=>{let i=Z(e,{scope:r,...m.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,c)=>n+c.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function ht(e,r){return a(e,r,"git-evidence",()=>{let t=z(e),i=t.fileChurn();if(!i)return null;let o=t.commitHistory(),n=N(e,void 0,{limit:r.candidateResultLimit}),c={};for(let[s,l]of i)c[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:n.findings.length,scoreCount:$(n.findings.reduce((s,l)=>s+be(l),0)),top:n.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:o?.commits.length??0}})}function gt(e,r){return a(e,r,"suppressions",()=>{let t=ue(e);return{total:t.total,byCategory:{...t.byCategory}}})}function ft(e,r){return a(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],o=G(e,t).filter(n=>n.status!=="ok");return{count:o.length,loc:0,files:[...new Set(o.map(n=>n.file))].sort()}})}function Ct(e,r,t){return a(e,t,"drift",()=>{let i=Y(e,{scope:r,...m.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}),o=i.results.filter(s=>s.kind!=="pattern-deviation"),n=o.filter(s=>s.actionTier==="direct").length,c=o.length-n;return{count:o.length,unusedImports:i.unusedImports,layerViolations:i.layerViolations,direct:n,signal:c}})}function bt(e,r,t){return a(e,t,"complexity-hotspots",()=>{let i=re(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:!1});return{top:i.slice(0,5).map(o=>({symbol:o.shortName,score:o.score,file:o.file})),extremeCount:i.filter(o=>o.score>Ge).length}})}function vt(e,r){let t=e.symbols>=je||e.documents>=qe,i=r?Number.POSITIVE_INFINITY:fe,o=r?Number.POSITIVE_INFINITY:Ye;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:o,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:o,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 St(e,r){r.releaseCachesBetweenPhases&&(A(e),T())}function a(e,r,t,i){wt(t);try{return i()}finally{St(e,r)}}function wt(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function xt(e,r){return r.filter(t=>!k(e,t.relativePath)&&!M(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function Ht(e,r){return r.filter(t=>!k(e,t.relativePath)&&!M(e,t.symbol,t.relativePath))}function D(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 xe(e,r){return{...D(e),scoreCount:$(e.reduce((i,o)=>i+r(o),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:$(e.reduce((i,o)=>i+r(o),0))}}function yt(e){let r=e.sharedHooks.length>0,t=Le({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:ye(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Dt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=Le({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:ye(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function Le(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Re.has(De(r))).length+Math.min(e.functions.length,3)}function ye(e,r,t){let i=[...e,...r,...t].map(De);return i.length>0&&i.every(o=>Re.has(o))}function De(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Rt(e){return e.actionTier==="signal"?.25:1}function Pt(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 $(e){return Math.round(e*100)/100}var Re=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{Ke as a,dr as b,lr as c,Xe as d,pr as e};
2
+ //# sourceMappingURL=chunk-U3VMUDXJ.js.map
@@ -0,0 +1,3 @@
1
+ import{b as w}from"./chunk-7COVQPQQ.js";import{b as I}from"./chunk-B75HZHUP.js";import{b as y}from"./chunk-BZXE3HO4.js";import{d as A}from"./chunk-JZBGTSAB.js";import{p as b}from"./chunk-WS3Z6W3M.js";import{g as R}from"./chunk-GNG622H3.js";var P=60;function nt(e,s={}){let{scope:n,limit:t=30,scanLimit:i,rotDays:r=P}=s,c=I(R(e,{extensions:[".ts",".tsx",".js",".jsx",".mjs",".cjs"]}).filter(a=>y(a)==="test").filter(a=>!n||a.includes(n)).filter(a=>!e.isIgnored(a)).sort(),i),o=[],l=[],p=[];for(let a of c){let d=b(e,a);if(!d)continue;let m=A(d),x=K(d);for(let u of $(m,x))x.add(u);let O=C(m);for(let u of O){if(u.skip){l.push(H(e,a,u,r));continue}if(u.kind==="describe")continue;let S=F(d,u.argsStart),h=m.slice(u.argsStart,u.callEnd),M=d.slice(u.argsStart,u.callEnd);_(h,x)||o.push({file:a,startLine:f(d,u.callStart),endLine:f(d,u.callEnd),title:S,severity:/\bawait\b/.test(h)?"low":"high"});let k=q(h,M);k&&p.push({file:a,startLine:f(d,u.callStart),endLine:f(d,u.callEnd),title:S,echoedValue:k})}}return{assertionFree:t?o.slice(0,t):o,skipped:t?l.slice(0,t):l,mockEcho:t?p.slice(0,t):p}}var E=/(?<!\.)\b(?:x(it|test|describe)|(it|test|describe)(?:\.\s*(skip|only|todo|each\s*\([^)]*\)))?)\s*\(/g;function C(e){let s=[];E.lastIndex=0;let n;for(;n=E.exec(e);){let t=n[1],i=t??n[2];if(!i)continue;let r=n[3]?.split(/\s*\(/)[0],c=n.index,o=n.index+n[0].length-1,l=g(e,o);E.lastIndex=o+1,r!=="each"&&s.push({kind:i,skip:t!==void 0||r==="skip"||r==="todo",skipKind:r==="todo"?"todo":"skip",callStart:c,argsStart:o+1,callEnd:l+1})}return s}function g(e,s){let n=0;for(let t=s;t<e.length;t+=1){let i=e[t];if(i==="(")n+=1;else if(i===")"&&(n-=1,n===0))return t}return e.length-1}function f(e,s){let n=0;for(let t=0;t<s&&t<e.length;t+=1)e[t]===`
2
+ `&&(n+=1);return n}function F(e,s){let n=e.slice(s,s+400),t=/^\s*(['"`])((?:\\.|(?!\1)[\s\S])*)\1/.exec(n);return t?t[2]:"(anonymous)"}var D=new Set(["vitest","chai","jest","@jest/globals","assert","node:assert","node:assert/strict","assert/strict","uvu/assert","expect","chai-as-promised"]),L=/import\s+(?:\*\s+as\s+(\w+)|\{([^}]*)\}|(\w+))\s+from\s+['"]([^'"]+)['"]/g;function K(e){let s=new Set(["expect","assert"]);L.lastIndex=0;let n;for(;n=L.exec(e);){let[,t,i,r,c]=n;if(!(!c||!D.has(c))&&(t&&s.add(t),r&&s.add(r),i))for(let o of i.split(",")){let l=o.trim().replace(/^type\s+/,"");if(!l)continue;let p=/^(\w+)\s+as\s+(\w+)$/.exec(l);s.add(p?p[2]:l)}}return s}function _(e,s){if(/\.should\b/.test(e)||/\bthrow\b/.test(e))return!0;for(let n of s){let t=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${t}\\s*(?:<[^<>]*>)?\\s*[.(]`).test(e))return!0}return!1}var v=/\bfunction\s+(\w+)\s*\(/g,j=/\b(?:const|let)\s+(\w+)\s*=\s*(?:async\s*)?\(/g,V=60;function $(e,s){let n=new Set;for(let t of[v,j]){t.lastIndex=0;let i;for(;i=t.exec(e);){let r=i[1],c=i.index+i[0].length-1,o=g(e,c),l=e.indexOf("{",o+1);if(l===-1||l-o>V)continue;let p=Q(e,l),a=e.slice(l+1,p);_(a,s)&&n.add(r)}}return n}function Q(e,s){let n=0;for(let t=s;t<e.length;t+=1){let i=e[t];if(i==="{")n+=1;else if(i==="}"&&(n-=1,n===0))return t}return e.length-1}var U=/\bmock(?:ReturnValue|ResolvedValue)(?:Once)?\s*\(/g,T=/\bexpect\s*\(/g,B=/^\s*\.\s*(?:toBe|toEqual|toStrictEqual)\s*\(/,N=/^(?:-?\d+(?:\.\d+)?|(['"`]).+\1)$/;function q(e,s){let n=G(e,s,U);if(n.length===0)return null;let t=Y(e,s);for(let i of t)if(n.includes(i))return i;return null}function G(e,s,n){let t=[];n.lastIndex=0;let i;for(;i=n.exec(e);){let r=i.index+i[0].length-1,c=g(e,r),o=s.slice(r+1,c).trim();N.test(o)&&t.push(o),n.lastIndex=c+1}return t}function Y(e,s){let n=[];T.lastIndex=0;let t;for(;t=T.exec(e);){let i=t.index+t[0].length-1,r=g(e,i),c=e.slice(r+1),o=B.exec(c);if(T.lastIndex=r+1,!o)continue;let l=r+1+o[0].length-1,p=g(e,l),a=s.slice(l+1,p).trim();N.test(a)&&n.push(a)}return n}function H(e,s,n,t){let i=b(e,s),r=F(i,n.argsStart),c=f(i,n.callStart),o=X(e.config.projectRoot,s,c),l=o===null?"unknown":o>=t?"rot":"workflow";return{file:s,startLine:c,title:r,skipKind:n.skipKind,blockKind:n.kind,ageDays:o,rot:l}}function X(e,s,n){let t=n+1;try{let i=w(e,["blame","-L",`${t},${t}`,"--porcelain","--",s]),r=/^author-time (\d+)$/m.exec(i);if(!r)return null;let c=Number(r[1]);return Number.isFinite(c)?Math.max(0,Math.round((Date.now()/1e3-c)/86400)):null}catch{return null}}export{nt as a};
3
+ //# sourceMappingURL=chunk-UHPWZCYQ.js.map
@@ -1,4 +1,4 @@
1
- import{b as l}from"./chunk-OSWF3HSF.js";import{a}from"./chunk-UAHZ57BR.js";import{d as i,g as n}from"./chunk-HXXMPYEF.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
1
+ import{b as l}from"./chunk-K7SPOJHZ.js";import{a}from"./chunk-IMQFJ53K.js";import{d as i,g as n}from"./chunk-X5C43YVI.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -26,4 +26,4 @@ import{b as l}from"./chunk-OSWF3HSF.js";import{a}from"./chunk-UAHZ57BR.js";impor
26
26
  AND ${e.localSymbolPredicate}
27
27
  ${e.pathExclusionsFor("d1")}
28
28
  ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
29
- //# sourceMappingURL=chunk-OPE5YXFE.js.map
29
+ //# sourceMappingURL=chunk-V5W7H7V4.js.map
@@ -1,3 +1,3 @@
1
- import{f as k}from"./chunk-MBKJ7GHT.js";import{e as C,f as se}from"./chunk-HXXMPYEF.js";import{a as oe}from"./chunk-T2FQ4GHD.js";import{a as ie,b as re,o as W}from"./chunk-ISLWJ4PY.js";import{c as ee,e as te,g as ne,k as v,l as S}from"./chunk-WS3Z6W3M.js";import{a as U}from"./chunk-64MNV6AB.js";import{a as Q,c as Z}from"./chunk-7S5E7KWT.js";import{performance as m}from"perf_hooks";function b(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import ae from"path";function Ae(i,e){return i.getReferences().map(t=>{let n=t.getNode();return O(n,e)})}function Ue(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function ce(i,e,t,n){let r=[];for(let o of Ue(i))for(let a of Ae(o,n))a.file===e.relativePath&&a.line>=e.startLine&&a.line<=e.endLine||r.push(a);for(let o of t)r.push(o);return R(r)}function le(i,e,t,n){let r=[],o=t?.getStart();for(let a of i.getReferences()){let s=a.getNode();P(n,s.getSourceFile().getFilePath())===e&&(o!==void 0&&s.getStart()===o||r.push({location:O(s,n),node:s}))}return r}function O(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:P(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function fe(i,e,t){let n=i.getSourceFile(),r=_(n,i),o=i.getText(),a=new RegExp(`\\b${oe(o)}\\b`,"g"),s=n.getFullText().split(`
1
+ import{f as k}from"./chunk-7TVFPOD7.js";import{e as C,f as se}from"./chunk-X5C43YVI.js";import{a as oe}from"./chunk-JZBGTSAB.js";import{a as ie,b as re,o as W}from"./chunk-ISLWJ4PY.js";import{c as ee,e as te,g as ne,k as v,l as S}from"./chunk-WS3Z6W3M.js";import{a as U}from"./chunk-64MNV6AB.js";import{a as Q,c as Z}from"./chunk-7S5E7KWT.js";import{performance as m}from"perf_hooks";function b(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import ae from"path";function Ae(i,e){return i.getReferences().map(t=>{let n=t.getNode();return O(n,e)})}function Ue(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function ce(i,e,t,n){let r=[];for(let o of Ue(i))for(let a of Ae(o,n))a.file===e.relativePath&&a.line>=e.startLine&&a.line<=e.endLine||r.push(a);for(let o of t)r.push(o);return R(r)}function le(i,e,t,n){let r=[],o=t?.getStart();for(let a of i.getReferences()){let s=a.getNode();P(n,s.getSourceFile().getFilePath())===e&&(o!==void 0&&s.getStart()===o||r.push({location:O(s,n),node:s}))}return r}function O(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:P(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function fe(i,e,t){let n=i.getSourceFile(),r=_(n,i),o=i.getText(),a=new RegExp(`\\b${oe(o)}\\b`,"g"),s=n.getFullText().split(`
2
2
  `),c=[];for(let l=0;l<s.length;l++){if(l===r)continue;let d=s[l]??"";a.lastIndex=0;let p;for(;(p=a.exec(d))!==null;)c.push({file:e,line:l,column:p.index})}return R(c.filter(l=>P(t,ae.join(t,l.file))===e))}function H(i){for(let e=i;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function _(i,e){return i.getLineAndColumnAtPos(e.getStart()).line-1}function R(i){let e=new Set,t=[];for(let n of i){let r=`${n.file}:${n.line}:${n.column}`;e.has(r)||(e.add(r),t.push(n))}return t}function P(i,e){let t=ae.relative(i||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function pe(i,e,t,n){let r=Oe(e,n);return r.size===0?new Map:Be(i,t,r)}function Oe(i,e){let t=new Map;for(let n of k(i,e)){let r=C(n.symbol)??n.leaf;if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return t}function Be(i,e,t){let n=new Map,r=new Map;return e.forEachDescendant(o=>{for(let a of We(i,o)){let s=t.get(a);if(!s)continue;let c=_(e,o);for(let l of s){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),p=r.get(l.symbolId);p!==void 0&&p<=d||(r.set(l.symbolId,d),n.set(l.symbolId,o))}}}),n}function We(i,e){let t=[],n=r=>{r&&!t.includes(r)&&t.push(r)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let r=e.getNameNode();n(r?.getText())}if("getName"in e&&typeof e.getName=="function"){let r=e.getName();n(r)}return i.Node.isIdentifier(e)&&n(e.getText()),t}var He=Z("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function ue(i,e,t,n){let r=ge(i,e),o=de(r.get(n)??[],t);if(o)return o;let a=[];for(let s of r.values())for(let c of s)((c.leaf||C(c.symbol)||"").includes(n)||c.symbol.includes(n))&&a.push(c);return de(a,t)}function me(i,e){let t=new Map;for(let[n,r]of ge(i,e)){let o=r[0];o&&t.set(n,o)}return t}function ge(i,e){return He.get(i,e,()=>{let t=new Map;for(let n of k(i,e)){let r=n.leaf||C(n.symbol);if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push({...n,leaf:r})}for(let n of t.values())n.sort((r,o)=>r.startLine-o.startLine||r.endLine-o.endLine||r.symbolId-o.symbolId);return t})}function de(i,e){let t=null,n=Number.POSITIVE_INFINITY;for(let r of i){let o=Math.abs(r.startLine-e);(o<n||o===n&&t&&r.startLine<t.startLine)&&(t=r,n=o)}return t}import z from"path";var N=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function D(i){let e=i.toLowerCase();return N.some(t=>e.endsWith(t))}function ye(i,e){let t=new Map,n=null,r=null,o=()=>(r??=U(i,{extensions:N}),r),a=()=>(n??=S("typescript.source-file-index",()=>_e(i.config.projectRoot,e,o()),()=>({projects:e.length,indexedDocuments:o().length})),n),s=c=>D(c)?b(t,c,()=>{let l=T(z.resolve(i.config.projectRoot,c));for(let{project:d,sourceFiles:p}of a()){let f=p.get(l)??null;if(f||(f=d.addSourceFileAtPathIfExists(l)??null,f&&p.set(T(f.getFilePath()),f)),f)return{project:d,sourceFile:f}}return null}):null;return{sourceFile:c=>s(c)?.sourceFile??null,sourceFileMatch:s,indexedTypeScriptLikeDocuments:o}}function _e(i,e,t){let n=e.map(({project:r})=>({project:r,sourceFiles:new Map(r.getSourceFiles().map(o=>[T(o.getFilePath()),o]))}));for(let r of t){let o=T(z.resolve(i,r));for(let a of n){if(a.sourceFiles.has(o))break;let s=a.project.addSourceFileAtPathIfExists(o)??null;if(s){a.sourceFiles.set(T(s.getFilePath()),s);break}}}return n}function T(i){return z.resolve(i)}function Se(i,e){for(let t of i)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function he(i){let e=`${i.relativeDir}/src`;return[`${e}/index.ts`,`${e}/index.tsx`,`${e}/index.mts`,`${e}/index.cts`]}import{existsSync as w,readFileSync as ze}from"fs";import h from"path";var $=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function V(i,e){let n=e?h.dirname(h.join(i,e)):i,r=h.resolve(i);for(;n.startsWith(r);){for(let a of $){let s=h.join(n,a);if(w(s))return s}let o=h.dirname(n);if(o===n)break;n=o}for(let o of $){let a=h.join(i,o);if(w(a))return a}return null}function be(i){let e=i.config.projectRoot,t=new Set($e(e,i.config.semantic?.typescript?.tsconfigs)),n=U(i,{includeIgnored:!1,extensions:N});for(let r of n){let o=V(e,r);o&&t.add(h.resolve(o))}if(t.size===0){let r=V(e);r&&t.add(h.resolve(r))}return[...t].filter(r=>!Me(e,r)).sort((r,o)=>r.localeCompare(o))}function $e(i,e=[]){let t=new Set;for(let n of e){let r=h.isAbsolute(n)?n:h.join(i,n);w(r)&&t.add(h.resolve(r))}for(let n of Ve(i))for(let r of $){let o=h.join(n,r);w(o)&&t.add(h.resolve(o))}if(t.size===0){let n=V(i);n&&t.add(h.resolve(n))}return[...t].filter(n=>!Me(i,n)).sort((n,r)=>n.localeCompare(r))}function Ve(i){let e=h.join(i,"package.json");if(!w(e))return[];let t;try{t=JSON.parse(ze(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>re(i,r))}function Me(i,e){let t=h.relative(i,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}import{createRequire as qe}from"module";var Ke=qe(import.meta.url),L;function Ie(){if(L!==void 0)return L;try{L=Ke("ts-morph")}catch{L=null}return L}function xe(i,e){return e.map(t=>({tsconfigPath:t,project:new i.Project({tsConfigFilePath:t,skipFileDependencyResolution:!0})}))}function B(i,e,t){return{language:"typescript",availability:()=>({available:!1,reason:i,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var Ge=32;function Re(i,e){let t=S("typescript.provider.load",()=>Ie());if(!t)return B("ts-morph is not installed");let n=S("typescript.provider.tsconfig-discovery",()=>be(i));if(n.length===0)return B("no tsconfig found");try{let r=S("typescript.provider.project-bundles",()=>xe(t,n),()=>({tsconfigs:n.length}));return S("typescript.provider.construct",()=>new q(i,t,r),()=>({tsconfigs:n.length}))}catch(r){return B(r instanceof Error?r.message:String(r),n[0],n)}}var q=class{constructor(e,t,n){this.db=e;this.tsMorph=t;this.projects=n;this.workspacePackages=ie(e.config.projectRoot),this.sourceFiles=ye(e,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return b(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let n=Ye();return S("typescript.import-usage.file",()=>this.importUsageForSourceFile(e,t,n),()=>({file:e,...n}))})}referencesFor(e){return b(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);return this.referencesForDefinitionNode(e,t)})}referencesForDefinitions(e){let t=new Map,n=v(),r=[];for(let c of e){let l=this.referencesCache.get(c.symbolId);l?t.set(c.symbolId,l):r.push(c)}if(r.length===0)return t;let o=r,a=r.filter(c=>!De(c));if(a.length>=Ge){let c=this.referencesForDefinitionsBySymbolScan(a);for(let l of a){let d=c.get(l.symbolId)??[];this.referencesCache.set(l.symbolId,d),t.set(l.symbolId,d)}if(o=r.filter(l=>De(l)),o.length===0)return t}let s=new Map;for(let c of o){let l=s.get(c.relativePath);l?l.push(c):s.set(c.relativePath,[c])}for(let[c,l]of s){let d=Fe();S("typescript.references-map.file",()=>{let p=this.definitionNodesForFile(c);for(let f of l){n&&(d.cacheMisses+=1);let u=p.get(f.symbolId)??null;n&&(u?d.nodeHits+=1:d.nodeMisses+=1);let g=this.referencesForDefinitionNode(f,u,n?d:void 0);this.referencesCache.set(f.symbolId,g),t.set(f.symbolId,g)}},()=>({relativePath:c,definitions:l.length,...ke(d)}))}return t}referencesForDefinitionsBySymbolScan(e){let t=v(),n=Fe(),r=new Map,o=new Set(e.map(s=>s.symbolId)),a=new Map(e.map(s=>[s.symbolId,s]));for(let s of e)r.set(s.symbolId,[]);return S("typescript.references-map.inverted-scan",()=>{let s=t?m.now():0;for(let p of e){let f=this.packageImportReferencesForDefinition(p);if(f.length>0){let u=r.get(p.symbolId)??[];u.push(...f),r.set(p.symbolId,u)}t&&(n.packageReferenceCount+=f.length)}t&&(n.packageRefsMs+=m.now()-s);let c=new Map,l=new Set(e.map(p=>p.leaf).filter(Boolean)),d=t?m.now():0;for(let p of this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(p))continue;let f=this.sourceFiles.sourceFile(p);f&&(t&&(n.scanFiles+=1),this.addReferencesFromSourceFileScan(f,p,o,a,l,c,r,t?n:void 0))}t&&(n.scanMs+=m.now()-d);for(let[p,f]of r){let u=R(f);r.set(p,u),t&&(n.referenceCount+=u.length)}},()=>({definitions:e.length,...ke(n)})),r}addReferencesFromSourceFileScan(e,t,n,r,o,a,s,c){let l=this.compilerCheckerForSourceFile(e),d=e.compilerNode,p=Ze(e),f=u=>{if(this.tsMorph.ts.isIdentifier(u)){if(c&&(c.identifiers+=1),!o.has(u.text)&&!p.has(u.text)){this.tsMorph.ts.forEachChild(u,f);return}let g=this.compilerReferenceSymbol(l,u,c);if(g){let y;if(a.has(g)?y=a.get(g)??null:(y=this.definitionFromCompilerSymbol(g),a.set(g,y)),c&&(y?c.targetHits+=1:c.targetMisses+=1),y&&n.has(y.symbolId)){c&&(c.requestedHits+=1);let F=r.get(y.symbolId);if(F&&!tt(F,t,ve(d,u))){let I=s.get(y.symbolId)??[],A=d.getLineAndCharacterOfPosition(u.getStart(d));I.push({file:t,line:A.line,column:A.character}),s.set(y.symbolId,I)}}}}this.tsMorph.ts.forEachChild(u,f)};f(d)}compilerReferenceSymbol(e,t,n){n&&(n.symbolLookups+=1);let r=e.getSymbolAtLocation(t);if(r){if((r.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return r;try{return n&&(n.aliasResolutions+=1),e.getAliasedSymbol(r)}catch{return r}}}calleesFor(e){return b(this.calleesCache,e.symbolId,()=>b(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}calleesForDefinitions(e){let t=new Map,n=new Map;for(let r of e){let o=n.get(r.relativePath);o?o.push(r):n.set(r.relativePath,[r])}for(let[r,o]of n){let a=this.fileCalleesCache.get(r),s=new Set(o.map(l=>l.symbolId)),c=a??this.calleeMapForFile(r,s);for(let l of o){let d=c.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,d),t.set(l.symbolId,d)}}return t}referencesForDefinitionNode(e,t,n){let r=n?m.now():0,o=this.packageImportReferencesForDefinition(e);if(n&&(n.packageRefsMs+=m.now()-r,n.packageReferenceCount+=o.length),!t)return o;let a=n?m.now():0,s=ce(t,e,o,this.db.config.projectRoot);return n&&(n.semanticRefsMs+=m.now()-a,n.referenceCount+=s.length),s}signatureFor(e){return b(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let n=t.getType().getCallSignatures()[0];if(!n)return null;let r=n.getParameters().map(a=>{let s=a.getDeclarations()[0],c=s?a.getTypeAtLocation(s).getText(s):a.getValueDeclaration()?.getType().getText()??"unknown";return Ce(c)}),o=n.getReturnType().getText(t);return`(${r.join(",")})=>${Ce(o)}`})}importUsageForSourceFile(e,t,n){let r=[],o=new Map;for(let a of t.getImportDeclarations()){n.declarations+=1;let s=W(this.db,e,a.getModuleSpecifierValue()),c=a.getImportClause()?.isTypeOnly()??!1;for(let l of K(a)){n.entries+=1;let d=c?null:l.identifier?.getSymbol()?.compilerSymbol??null;!c&&l.identifier&&(d?n.bindingSymbols+=1:n.missingBindingSymbols+=1);let p={sourcePath:s,entry:l,typeOnlyDeclaration:c,bindingSymbol:d,references:[]};if(r.push(p),c||!l.localName||!d)continue;let f=o.get(l.localName);f?f.push(p):o.set(l.localName,[p])}}return o.size>0&&t.forEachDescendant(a=>{if(a.getKindName()!=="Identifier")return;let s=o.get(a.getText());if(!s||Xe(a))return;n.scannedIdentifiers+=1;let c=a.getSymbol()?.compilerSymbol;if(n.symbolLookups+=1,!!c){for(let l of s)if(l.bindingSymbol===c){l.references.push({location:O(a,this.db.config.projectRoot),node:a}),n.matchedReferences+=1;break}}}),r.map(a=>a.typeOnlyDeclaration?Je(e,a.sourcePath,a.entry):a.entry.identifier&&!a.bindingSymbol?(n.fallbackEntries+=1,this.valueImportUsageForEntry(e,a.sourcePath,a.entry)):this.valueImportUsageFromLocations(e,a.sourcePath,a.entry,a.references))}valueImportUsageForEntry(e,t,n){let r=n.identifier?n.identifier.findReferences():[],o=[];for(let a of r)for(let s of le(a,e,n.identifier,this.db.config.projectRoot))o.push(s);return this.valueImportUsageFromLocations(e,t,n,o)}valueImportUsageFromLocations(e,t,n,r){let o=r.some(c=>!H(c.node)),a=r.some(c=>H(c.node)),s=n.isTypeOnly;return{importer:e,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:s,isUsed:s||r.length>0,isTypeUsed:s||a,isValueUsed:o,references:r.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,n);for(let[n,r]of e)e.set(n,R(r));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,n){if(this.db.isIgnored(n))return;let r=this.sourceFiles.sourceFileMatch(n);if(r)for(let o of r.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,n,o)}addPackageImportReferencesForDeclaration(e,t,n,r){let o=Se(this.workspacePackages,r.getModuleSpecifierValue());if(!o)return;let a=t.get(o);if(a)for(let s of K(r)){if(s.kind!=="named"||!s.identifier)continue;let c=a.get(s.importedName);if(!c||c.size===0)continue;let l=fe(s.identifier,n,this.db.config.projectRoot);l.length>0&&rt(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let n=new Map;for(let r of he(t))this.collectPackageExports(t,r,n,new Set);n.size>0&&e.set(t.name,n)}return this.packageExportIndex=e,e}collectPackageExports(e,t,n,r){if(r.has(t))return;r.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let a of o.getExportDeclarations()){let s=a.getModuleSpecifierValue(),c=s?W(this.db,t,s):t;if(!c||!c.startsWith(`${e.relativeDir}/src/`))continue;let l=a.getNamedExports();if(l.length===0){if(a.isNamespaceExport())continue;this.collectPackageExports(e,c,n,r);continue}for(let d of l){let p=d.getNameNode().getText(),f=d.getAliasNode()?.getText()??p,u=this.indexedDefinitionByLeaf(c,p);if(!u)continue;let g=n.get(f);g||(g=new Set,n.set(f,g)),g.add(u.symbolId)}}}indexedDefinitionByLeaf(e,t){return b(this.indexedDefinitionLeafCache,e,()=>me(this.db,e)).get(t)??null}nodeForDefinition(e){return b(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return b(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?pe(this.tsMorph,this.db,t,e):new Map})}definitionFromCompilerSymbol(e,t){let n=e.name,r=t?m.now():0,o=e.declarations??[];t&&(t.declarationsMs+=m.now()-r,t.declarationChecks+=o.length);for(let a of o){let s=t?m.now():0,c=a.getSourceFile(),l=P(this.db.config.projectRoot,c.fileName),d=c.getLineAndCharacterOfPosition(a.getStart(c)).line;if(t&&(t.declarationLocationMs+=m.now()-s),!l||this.db.isIgnored(l))continue;let p=t?m.now():0,f=ue(this.db,l,d,n);if(t&&(t.indexedLookupMs+=m.now()-p),f)return{symbolId:f.symbolId,symbol:f.symbol,file:f.relativePath,line:f.startLine}}return null}calleeMapForFile(e,t){let n=v(),r=0,o=0,a=0,s=0,c=0,l=0,d=0,p=0,f=n?nt():void 0;return S("typescript.callee-map.file",()=>{let u=n?m.now():0,g=this.sourceFiles.sourceFile(e);if(n&&(c=Math.round(m.now()-u)),!g)return new Map;let y=n?m.now():0,F=k(this.db,e).sort((M,x)=>M.startLine-x.startLine||x.endLine-M.endLine);if(n&&(l=Math.round(m.now()-y)),r=F.length,F.length===0)return new Map;let I=new Map,A=n?m.now():0,Le=this.compilerCheckerForSourceFile(g),Y=g.compilerNode;n&&(d=Math.round(m.now()-A));let Ee=new Map,X=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){n&&(o+=1);let x=this.semanticCalleeForCallNode(Le,Y,F,M,Ee,t,f);x&&(n&&(a+=1),Qe(I,x.callerId,x.target))}this.tsMorph.ts.forEachChild(M,X)},je=n?m.now():0;X(Y),n&&(p=Math.round(m.now()-je));for(let[M,x]of I)I.set(M,ot(x));return s=I.size,I},()=>({relativePath:e,definitions:r,callNodes:o,resolvedCallees:a,outputRows:s,requestedDefinitions:t?.size??r,sourceFileLookupMs:c,definitionsLoadMs:l,checkerLookupMs:d,traversalMs:p,...f?it(f):{}}))}semanticCalleeForCallNode(e,t,n,r,o,a,s){let c=s?m.now():0,l=et(n,ve(t,r));if(s&&(s.callerLookupMs+=m.now()-c),!l)return null;if(a&&!a.has(l.symbolId))return s&&(s.skippedUnrequestedCallers+=1),null;let d=r.expression,p=this.compilerSymbolForExpression(e,d,s),f=null;if(p)if(s&&(s.targetSymbolHits+=1),o.has(p))s&&(s.compilerSymbolCacheHits+=1),f=o.get(p)??null;else{s&&(s.compilerSymbolCacheMisses+=1);let u=s?m.now():0;f=this.definitionFromCompilerSymbol(p,s),s&&(s.targetLookupMs+=m.now()-u),o.set(p,f)}else s&&(s.targetMisses+=1);return f?{callerId:l.symbolId,target:{symbol:f.symbol,file:f.file,line:f.line}}:null}compilerSymbolForExpression(e,t,n){let r=n?m.now():0,o=e.getSymbolAtLocation(t);if(n&&(n.expressionSymbolMs+=m.now()-r),o)return o;n&&(n.typeFallbacks+=1);let a=n?m.now():0,s=e.getTypeAtLocation(t).getSymbol();return n&&(n.typeSymbolMs+=m.now()-a),s}compilerCheckerForSourceFile(e){let t=e.getProject(),n=this.compilerCheckerCache.get(t);return n||(n=t.getTypeChecker().compilerObject,this.compilerCheckerCache.set(t,n)),n}};function K(i){let e=[],t=i.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let n=i.getNamespaceImport();n&&e.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let r of i.getNamedImports()){let o=r.getNameNode(),s=r.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:s,importedName:o.getText(),localName:s?.getText()??o.getText(),kind:"named",isTypeOnly:r.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Je(i,e,t){return{importer:i,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ye(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function Xe(i){for(let e=i;e;e=e.getParent())if(e.getKindName()==="ImportDeclaration")return!0;return!1}function Qe(i,e,t){let n=i.get(e);n||(n=[],i.set(e,n)),n.push(t)}function Ze(i){let e=new Set;for(let t of i.getImportDeclarations())for(let n of K(t))n.localName&&e.add(n.localName);return e}function et(i,e){let t=null;for(let n of i)e<n.startLine||e>n.endLine||(!t||n.startLine>=t.startLine)&&(t=n);return t}function ve(i,e){return i.getLineAndCharacterOfPosition(e.getStart(i)).line}function tt(i,e,t){return e===i.relativePath&&t>=i.startLine&&t<=i.endLine}function De(i){return i.symbol.includes("#")?se(i.symbol)==="type"&&i.relativePath.endsWith(".d.ts"):!1}function nt(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function it(i){return{...i,callerLookupMs:Math.round(i.callerLookupMs),expressionSymbolMs:Math.round(i.expressionSymbolMs),typeSymbolMs:Math.round(i.typeSymbolMs),targetLookupMs:Math.round(i.targetLookupMs),declarationsMs:Math.round(i.declarationsMs),declarationLocationMs:Math.round(i.declarationLocationMs),indexedLookupMs:Math.round(i.indexedLookupMs)}}function Fe(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0}}function ke(i){return{...i,scanMs:Math.round(i.scanMs),packageRefsMs:Math.round(i.packageRefsMs),semanticRefsMs:Math.round(i.semanticRefsMs)}}function rt(i,e,t){for(let n of e){let r=i.get(n)??[];r.push(...t),i.set(n,r)}}function ot(i){let e=new Set,t=[];for(let n of i){let r=`${n.symbol}|${n.file}|${n.line}`;e.has(r)||(e.add(r),t.push(n))}return t}function Ce(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var G=new WeakMap;Q({name:"semantic-provider",groups:["semantic-provider"],clearAll:i=>G.delete(i)});function J(i,e){let t=`${i.config.projectRoot}:typescript-workspace`,n=G.get(i);n||(n=new Map,G.set(i,n));let r=n.get(t);if(r)return r;let o=Re(i,e);return n.set(t,o),o}function E(i){return{capability:(e,t)=>we(i,e,t),importUsage:e=>st(i,e),references:e=>at(i,e),callerMap:e=>ct(i,e),calleeMap:e=>pt(i,e),signature:e=>dt(i,e)}}function fn(i,e){return E(i).importUsage(e)}function st(i,e){let t=j(i,e);return t?t.importUsage(e):[]}function pn(i,e){return E(i).references(e)}function at(i,e){let t=j(i,e.relativePath);return t?t.referencesFor(e):[]}function dn(i,e){return E(i).callerMap(e)}function ct(i,e){let t=v(),n=new Map,r=ee(i),o=[],a=[],s=[],c=0,l=0,d=0,p=0;if(S("semantic.references.cache-scan",()=>{for(let f of e){if(!r||!D(f.relativePath)){t&&!D(f.relativePath)&&(c+=1),s.push(f);continue}let u=te(i,f.relativePath,f.symbol,r);if(u!==null){let g=ft(u);if(g){t&&(l+=1),p+=Ne(i,n,f,g);continue}t&&(d+=1)}a.push(f)}},()=>({definitions:e.length,skippedNonTs:c,cacheHits:l,parseFailures:d,misses:a.length,unkeyed:s.length,resultRows:n.size,callerFiles:p})),a.length>0||s.length>0){let f=[...s,...a],u=0,g=S("semantic.references.compute-misses",()=>{let y=lt(i,f);return u=y.size,y},()=>({definitions:f.length,misses:a.length,unkeyed:s.length,rows:u}));for(let y of f)p+=Ne(i,n,y,g.get(y.symbolId)??[]);if(r)for(let y of a)o.push({relativePath:y.relativePath,symbol:y.symbol,projectFingerprint:r,payload:JSON.stringify(g.get(y.symbolId)??[])})}return o.length>0&&(we(i,"semantic-references").available?S("semantic.references.cache-write",()=>ne(i,o),()=>({entries:o.length})):S("semantic.references.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",entries:o.length}))),n}function lt(i,e){let t=v(),n=new Map,r=0,o=0,a=0,s=0;return S("semantic.references.provider-loop",()=>{let c=new Map,l=[];for(let d of e){let p=j(i,d.relativePath);if(!p){t&&(o+=1);continue}if(t&&(r+=1),p.referencesForDefinitions){let f=c.get(p);f?f.push(d):c.set(p,[d])}else l.push({provider:p,definition:d})}for(let[d,p]of c){let f=d.referencesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Pe(n,u.symbolId,g,t,y=>{a+=1,s+=y})}}for(let{provider:d,definition:p}of l){let f=d.referencesFor(p);Pe(n,p.symbolId,f,t,u=>{a+=1,s+=u})}return n},()=>({definitions:e.length,providerHits:r,providerMisses:o,definitionsWithReferences:a,referenceCount:s,rows:n.size}))}function Pe(i,e,t,n,r){i.set(e,t),n&&t.length>0&&r(t.length)}function Ne(i,e,t,n){let r=0;for(let o of n){if(o.file===t.relativePath||i.isIgnored(o.file))continue;let a=e.get(t.symbolId);a||(a=new Set,e.set(t.symbolId,a));let s=a.size;a.add(o.file),a.size!==s&&(r+=1)}return r}function ft(i){try{return JSON.parse(i)}catch{return null}}function un(i,e){return E(i).calleeMap(e)}function pt(i,e){let t=v(),n=new Map,r=0,o=0,a=0,s=0;return S("semantic.callees.provider-loop",()=>{let c=new Map,l=[];for(let d of e){let p=j(i,d.relativePath);if(!p){t&&(o+=1);continue}t&&(r+=1);let f=d;if(p.calleesForDefinitions){let u=c.get(p);u?u.push(f):c.set(p,[f])}else l.push({provider:p,definition:f})}for(let[d,p]of c){let f=d.calleesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Te(n,u.symbolId,g,t,y=>{a+=1,s+=y})}}for(let{provider:d,definition:p}of l){let f=d.calleesFor(p);Te(n,p.symbolId,f,t,u=>{a+=1,s+=u})}return n},()=>({definitions:e.length,providerHits:r,providerMisses:o,definitionsWithCallees:a,calleeCount:s,rows:n.size}))}function Te(i,e,t,n,r){t.length>0&&(i.set(e,t),n&&r(t.length))}function mn(i,e){return E(i).signature(e)}function dt(i,e){let t=j(i,e.relativePath);return t?t.signatureFor(e):null}function we(i,e,t){if(t!==void 0&&!D(t))return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript files"};try{return{slot:e,language:"typescript",...J(i,t).availability()}}catch(n){return{slot:e,language:"typescript",available:!1,reason:n instanceof Error?n.message:String(n)}}}function j(i,e){if(!D(e))return null;let t=J(i,e);return t.availability().available?t:null}export{D as a,E as b,fn as c,pn as d,dn as e,un as f,mn as g};
3
- //# sourceMappingURL=chunk-YDDGCJJG.js.map
3
+ //# sourceMappingURL=chunk-WMO2VZZK.js.map
@@ -0,0 +1,2 @@
1
+ import{b as A}from"./chunk-6KMTPNZL.js";import{a as _}from"./chunk-I4R3SNMR.js";import{f as R,g as L}from"./chunk-3AMWF6V5.js";import{b as D}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-IMQFJ53K.js";import{f as x,g as I}from"./chunk-BZXE3HO4.js";import{a as w}from"./chunk-BGBBVSH4.js";import{d as N}from"./chunk-X5C43YVI.js";import{b as T,c as h}from"./chunk-JZBGTSAB.js";import{p as S}from"./chunk-WS3Z6W3M.js";import{a as g}from"./chunk-64MNV6AB.js";var F={caller:3,"entry-surface":2,rooted:1},O=/not\s*yet\s*implement|not\s*implement|unimplement|\bnyi\b|\btodo\b|\bstub\b|not\s*supported|coming\s*soon/i,P=/^throw\s+new\s+[\w.]*Error\s*\(([\s\S]*)\)\s*;?$/,C=/^return(\s+(null|undefined|false|0|''|""|``|\[\]|\{\}))?\s*;?$/,v=/\/\/\s*TODO\b|\/\*\s*TODO\b/i,K=/(?:=>|\))\s*(?::\s*[^{;=]+)?\s*\{\s*\}\s*;?\s*$/;function et(e,n={}){let{scope:o,limit:r=30,scanLimit:l,semantic:a=!0}=n,s=new E(e),t=D(s.productionCallableDefinitions({scope:o,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),l),c=[];for(let i of t){let m=M(e,i);m&&c.push(m)}if(c.length===0)return[];let d=j(e,c,t),f=c.filter(i=>!d.has(i.def.symbol));if(f.length===0)return[];let p=_(e,s).forDefinitions(f.map(i=>i.def),{semantic:a}),u=[];for(let i of f){let b=p.get(i.def.symbolId)?.realConsumers.length??0,y=B(e,i.def,b);y&&u.push({symbol:i.def.symbol,shortName:N(i.def.symbol),file:i.def.relativePath,startLine:i.def.startLine,endLine:i.def.endLine,loc:w(i.def),stubKind:i.stubKind,reachability:y,callerFanIn:b,stubText:i.stubText})}return u.sort((i,m)=>F[m.reachability]-F[i.reachability]||m.callerFanIn-i.callerFanIn||i.file.localeCompare(m.file)||i.startLine-m.startLine),r?u.slice(0,r):u}function B(e,n,o){return o>0?"caller":I(e,n.symbol,n.relativePath)?"rooted":x(e,n.relativePath)?"entry-surface":null}function M(e,n){let o=R(e,n);if(!o)return null;let r=L(o),l=r.trim();if(l==="")return!z(o)||!A(e,n)?null:{def:n,stubKind:"empty-body",stubText:"(empty body)"};let a=h(r),s=T(r),t=$(a,s);if(t.length!==1)return null;let c=t[0];return U(c)?{def:n,stubKind:"throw-stub",stubText:c.trim()}:v.test(r)&&C.test(c.trim())?{def:n,stubKind:"todo-return-default",stubText:l}:null}function $(e,n){let o=[],r=0,l="";for(let a=0;a<n.length;a+=1){let s=n[a];if(s==="("||s==="["||s==="{"?r+=1:(s===")"||s==="]"||s==="}")&&(r=Math.max(0,r-1)),s===";"&&r===0){o.push(l),l="";continue}l+=e[a]??""}return l.trim()&&o.push(l),o.map(a=>a.trim()).filter(a=>a.length>0)}function U(e){let n=P.exec(e.trim());return n?O.test(n[1]??""):!1}function z(e){return K.test(e.trimEnd())}function j(e,n,o){let r=new Set,l=new Set(n.map(t=>t.def.parentTypeName).filter(t=>t!==null));if(l.size===0)return r;let a=k(e,l),s=new Map;for(let t of o){if(!t.parentTypeName)continue;let c=s.get(t.leaf)??new Set;c.add(t.parentTypeName),s.set(t.leaf,c)}for(let t of n){let c=t.def.parentTypeName;if(!c)continue;let d=a.get(c);if(!d||d.size===0)continue;let f=s.get(t.def.leaf)??new Set;[...d].every(u=>f.has(u))&&r.add(t.def.symbol)}return r}var Y=/\bclass\s+([A-Za-z_$][\w$]*)\s+extends\s+([A-Za-z_$][\w$]*)/g;function k(e,n){let o=new Map;for(let r of g(e,{includeIgnored:!1})){let l=S(e,r);if(l)for(let a of l.matchAll(Y)){let s=a[1],t=a[2];if(!s||!t||!n.has(t))continue;let c=o.get(t)??new Set;c.add(s),o.set(t,c)}}return o}export{et as a};
2
+ //# sourceMappingURL=chunk-WPZPB42I.js.map
@@ -1,4 +1,4 @@
1
- import{a as S}from"./chunk-UAHZ57BR.js";import{b as D}from"./chunk-NAH5EAZS.js";import{c as v}from"./chunk-YDDGCJJG.js";import{m as y}from"./chunk-T2FQ4GHD.js";import{a as b}from"./chunk-64MNV6AB.js";import p from"path";var w={analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),domain:new Set([]),instrumentation:new Set([]),"language-parsers":new Set(["core","domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["core","domain","queries","reindex","resolution","semantic","source","storage","symbols","tla"]),semantic:new Set(["core","domain","resolution","storage","symbols"]),source:new Set(["core","domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"]),tla:new Set(["core","domain","queries","source","storage","symbols"])};function f(e){let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t.length<=1?"(root)":t.length>=3&&["src","lib","app","server","client"].includes(t[0])?`${t[0]}/${t[1]}`:t[0]}function h(e,n){if(e===n)return"ok";let t=g(e),i=g(n);return t&&i?!m(t)||!m(i)?null:P(t,i)?"ok":"violation":E(e,n)}function k(e,n){let t=g(f(e)),i=g(f(n));return!!t&&!!i&&m(t)&&m(i)}function R(e,n){let t=g(e),i=g(n);return!!t&&!!i&&(!m(t)||!m(i))}function g(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function P(e,n){return n==="instrumentation"||n==="domain"?!0:e==="domain"?!1:w[e]?.has(n)??!1}function m(e){return Object.hasOwn(w,e)}function E(e,n){if(n==="shared")return"ok";let t={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return t[e]?t[e].has(n)?"ok":"violation":null}function re(e,n){let{scope:t,minDeviation:i=5,limit:r=50}=n??{},a=n?.semantic!==!1,c=n?.includePatternDeviations===!0,s=new S(e).fileDependencyGraph(t),l=F([...I(e,s,{scope:t,semantic:a}),...M(s),...c?N(s,i):[]]);return r<=0||l.results.length<=r?l:{...l,results:l.results.slice(0,r),totalResults:l.results.length}}function I(e,n,t){let i=T(e,t.scope),r=[],a=new Set;for(let[o,s]of n){if(d(o))continue;let l=i.get(o)??new Set;for(let u of s)d(u)||l.has(u)||_(e,o,u,t)||(r.push({file:o,dep:u}),a.add(o))}a.size>0&&U(e,i,{paths:[...a]});let c=[];for(let{file:o,dep:s}of r)(i.get(o)??new Set).has(s)||c.push({file:o,kind:"unused-import",description:`Depends on ${s} but references none of its symbols`,dep:s,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${o} to ${s}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return c}function _(e,n,t,i){return J(e,n,t)||z(e,n,t)||q(t)||W(e,n,t)||K(t)?!0:i.semantic&&C(e,n,t)}function M(e){let n=[],t=V(e);for(let[i,r]of e){if(d(i))continue;let a=f(i);for(let c of r){if(d(c))continue;let o=f(c);if(a===o)continue;let s=h(a,o),l=s===null&&R(a,o),u=s?"explicit":l?"unknown-layer":"inferred";if((l?"violation":s??t.get(`${a}->${o}`))==="violation"){let $=u==="explicit"?"direct":"signal";n.push({file:i,kind:"layer-violation",description:`Imports from ${o}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${a}/ should not depend on ${o}/`,actionTier:$,policyBasis:u,evidenceReasons:[`dependency edge exists from ${i} to ${c}`,O(u,a,o)],recommendation:u==="explicit"?"Move the dependency behind an allowed layer boundary or document a policy change.":u==="unknown-layer"?"Add a layer policy entry before treating this as a boundary violation.":"Review whether this is a real boundary break or an intentional exception before moving code."})}}}return n}function O(e,n,t){return e==="explicit"?`explicit layer policy rejects ${n}/ -> ${t}/`:e==="unknown-layer"?`source layer policy has no entry for ${n}/ -> ${t}/`:`rare cross-layer edge ${n}/ -> ${t}/ is inferred as a violation`}function N(e,n){let t=[];for(let[i,r]of A(e)){let a=r.filter(o=>!d(o));if(a.length<n)continue;let c=L(e,a);for(let o of a)for(let s of e.get(o)??[])d(s)||(c.get(s)??0)===1&&p.dirname(s)!==i&&p.dirname(s)!==p.dirname(i)&&(k(o,s)||t.push({file:o,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${s}`,dep:s,actionTier:"signal",evidenceReasons:[`${a.length} sibling file(s) in ${i}/ were compared`,`${o} is the only non-skipped sibling depending on ${s}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."}))}return t}function F(e){return{results:e,unusedImports:e.filter(n=>n.kind==="unused-import").length,layerViolations:e.filter(n=>n.kind==="layer-violation").length,patternDeviations:e.filter(n=>n.kind==="pattern-deviation").length}}function A(e){let n=new Map;for(let t of e.keys()){let i=p.dirname(t),r=n.get(i);r||(r=[],n.set(i,r)),r.push(t)}return n}function L(e,n){let t=new Map;for(let i of n)for(let r of e.get(i)??[])d(r)||t.set(r,(t.get(r)??0)+1);return t}function T(e,n){let t=new Map;return j(e,t,n),t}function j(e,n,t){for(let i of B(e,t))x(e,n,i.from_file,i.to_file)}function B(e,n){let t=n?"AND d1.relative_path LIKE ?":"",i=n?[`%${n}%`]:[];return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
1
+ import{a as S}from"./chunk-IMQFJ53K.js";import{b as D}from"./chunk-BZXE3HO4.js";import{c as v}from"./chunk-WMO2VZZK.js";import{o as y}from"./chunk-JZBGTSAB.js";import{a as b}from"./chunk-64MNV6AB.js";import p from"path";var w={analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),domain:new Set([]),instrumentation:new Set([]),"language-parsers":new Set(["core","domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["core","domain","queries","reindex","resolution","semantic","source","storage","symbols","tla"]),semantic:new Set(["core","domain","resolution","storage","symbols"]),source:new Set(["core","domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"]),tla:new Set(["core","domain","queries","source","storage","symbols"])};function f(e){let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t.length<=1?"(root)":t.length>=3&&["src","lib","app","server","client"].includes(t[0])?`${t[0]}/${t[1]}`:t[0]}function h(e,n){if(e===n)return"ok";let t=g(e),i=g(n);return t&&i?!m(t)||!m(i)?null:P(t,i)?"ok":"violation":E(e,n)}function k(e,n){let t=g(f(e)),i=g(f(n));return!!t&&!!i&&m(t)&&m(i)}function R(e,n){let t=g(e),i=g(n);return!!t&&!!i&&(!m(t)||!m(i))}function g(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function P(e,n){return n==="instrumentation"||n==="domain"?!0:e==="domain"?!1:w[e]?.has(n)??!1}function m(e){return Object.hasOwn(w,e)}function E(e,n){if(n==="shared")return"ok";let t={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return t[e]?t[e].has(n)?"ok":"violation":null}function re(e,n){let{scope:t,minDeviation:i=5,limit:r=50}=n??{},a=n?.semantic!==!1,c=n?.includePatternDeviations===!0,s=new S(e).fileDependencyGraph(t),l=F([...I(e,s,{scope:t,semantic:a}),...M(s),...c?N(s,i):[]]);return r<=0||l.results.length<=r?l:{...l,results:l.results.slice(0,r),totalResults:l.results.length}}function I(e,n,t){let i=T(e,t.scope),r=[],a=new Set;for(let[o,s]of n){if(d(o))continue;let l=i.get(o)??new Set;for(let u of s)d(u)||l.has(u)||_(e,o,u,t)||(r.push({file:o,dep:u}),a.add(o))}a.size>0&&U(e,i,{paths:[...a]});let c=[];for(let{file:o,dep:s}of r)(i.get(o)??new Set).has(s)||c.push({file:o,kind:"unused-import",description:`Depends on ${s} but references none of its symbols`,dep:s,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${o} to ${s}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return c}function _(e,n,t,i){return J(e,n,t)||z(e,n,t)||q(t)||W(e,n,t)||K(t)?!0:i.semantic&&C(e,n,t)}function M(e){let n=[],t=V(e);for(let[i,r]of e){if(d(i))continue;let a=f(i);for(let c of r){if(d(c))continue;let o=f(c);if(a===o)continue;let s=h(a,o),l=s===null&&R(a,o),u=s?"explicit":l?"unknown-layer":"inferred";if((l?"violation":s??t.get(`${a}->${o}`))==="violation"){let $=u==="explicit"?"direct":"signal";n.push({file:i,kind:"layer-violation",description:`Imports from ${o}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${a}/ should not depend on ${o}/`,actionTier:$,policyBasis:u,evidenceReasons:[`dependency edge exists from ${i} to ${c}`,O(u,a,o)],recommendation:u==="explicit"?"Move the dependency behind an allowed layer boundary or document a policy change.":u==="unknown-layer"?"Add a layer policy entry before treating this as a boundary violation.":"Review whether this is a real boundary break or an intentional exception before moving code."})}}}return n}function O(e,n,t){return e==="explicit"?`explicit layer policy rejects ${n}/ -> ${t}/`:e==="unknown-layer"?`source layer policy has no entry for ${n}/ -> ${t}/`:`rare cross-layer edge ${n}/ -> ${t}/ is inferred as a violation`}function N(e,n){let t=[];for(let[i,r]of A(e)){let a=r.filter(o=>!d(o));if(a.length<n)continue;let c=L(e,a);for(let o of a)for(let s of e.get(o)??[])d(s)||(c.get(s)??0)===1&&p.dirname(s)!==i&&p.dirname(s)!==p.dirname(i)&&(k(o,s)||t.push({file:o,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${s}`,dep:s,actionTier:"signal",evidenceReasons:[`${a.length} sibling file(s) in ${i}/ were compared`,`${o} is the only non-skipped sibling depending on ${s}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."}))}return t}function F(e){return{results:e,unusedImports:e.filter(n=>n.kind==="unused-import").length,layerViolations:e.filter(n=>n.kind==="layer-violation").length,patternDeviations:e.filter(n=>n.kind==="pattern-deviation").length}}function A(e){let n=new Map;for(let t of e.keys()){let i=p.dirname(t),r=n.get(i);r||(r=[],n.set(i,r)),r.push(t)}return n}function L(e,n){let t=new Map;for(let i of n)for(let r of e.get(i)??[])d(r)||t.set(r,(t.get(r)??0)+1);return t}function T(e,n){let t=new Map;return j(e,t,n),t}function j(e,n,t){for(let i of B(e,t))x(e,n,i.from_file,i.to_file)}function B(e,n){let t=n?"AND d1.relative_path LIKE ?":"",i=n?[`%${n}%`]:[];return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -15,4 +15,4 @@ import{a as S}from"./chunk-UAHZ57BR.js";import{b as D}from"./chunk-NAH5EAZS.js";
15
15
  AND m.role != 1
16
16
  ${e.pathExclusionsFor("d1","d2")}
17
17
  ${t}`,...i)}function U(e,n,t={}){new S(e).scanSourceReferences({paths:t.paths??b(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},r=>{r.target.relativePath!==r.sourceFile&&(e.isIgnored(r.target.relativePath)||x(e,n,r.sourceFile,r.target.relativePath))})}function x(e,n,t,i){if(e.isIgnored(t)||e.isIgnored(i))return;let r=n.get(t);r||(r=new Set,n.set(t,r)),r.add(i)}function V(e){let n=new Map;for(let[i,r]of e){if(d(i))continue;let a=f(i);for(let c of r){if(d(c))continue;let o=f(c);if(a===o||h(a,o))continue;let s=`${a}->${o}`;n.set(s,(n.get(s)??0)+1)}}let t=new Map;for(let[i,r]of n)t.set(i,r<=2?"violation":"ok");return t}function q(e){return e.includes("types")||e.endsWith(".d.ts")}function C(e,n,t){let i=v(e,n).filter(r=>r.sourcePath===t);return i.length>0&&i.some(r=>r.isUsed)}function J(e,n,t){let i=y(e,n).filter(r=>r.sourcePath===t);return i.length>0&&i.some(r=>r.used)}function z(e,n,t){let i=y(e,n).filter(r=>r.sourcePath===t);return i.length>0&&i.every(r=>r.isTypeOnly===!0)}function K(e){return e.endsWith(".vue")}function W(e,n,t){let i=y(e,n).filter(r=>r.sourcePath===t);return i.length===0?!1:i.every(r=>r.kind==="side-effect"||r.kind==="namespace"&&r.usedMembers.length===0&&!r.used)}function d(e){let n=D(e);return!!(n==="entry"||n==="barrel"||n==="test"||n==="worker"||H(p.basename(e)))}function H(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{re as a};
18
- //# sourceMappingURL=chunk-EXKLAEB4.js.map
18
+ //# sourceMappingURL=chunk-X3DTIEMU.js.map
@@ -0,0 +1,2 @@
1
+ import{g,n as S,o as x}from"./chunk-JZBGTSAB.js";import{A as m}from"./chunk-ISLWJ4PY.js";import{p as u,q as d}from"./chunk-WS3Z6W3M.js";var y={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function a(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let s=e.split(" ");if(s.length<4)return{scheme:s[0]??"",manager:s[1]??"",packageName:s[2]??"",version:"",descriptors:[],raw:e};let t=s[0],r=s[1],n=e.slice(t.length+1+r.length+1),i;if(n.startsWith("`")){let f=n.indexOf("`",1);f===-1?(i=n.slice(1),n=""):(i=n.slice(1,f),n=n.slice(f+2))}else{let f=n.indexOf(" ");f===-1?(i=n,n=""):(i=n.slice(0,f),n=n.slice(f+1))}let o,c=n.indexOf(" ");c===-1?(o=n,n=""):(o=n.slice(0,c),n=n.slice(c+1));let l=v(n);return{scheme:t,manager:r,packageName:i,version:o,descriptors:l,raw:e}}function M(e){let s=a(e);if("kind"in s)return null;for(let t=s.descriptors.length-2;t>=0;t--){let r=s.descriptors[t];if(r?.suffix==="type")return r.name}return null}function v(e){let s=[],t=0;for(;t<e.length;){if(e[t]==="["){let i=e.indexOf("]",t+1);if(i===-1){s.push({name:e.slice(t+1),suffix:"type-param"});break}s.push({name:e.slice(t+1,i),suffix:"type-param"}),t=i+1;continue}if(e[t]==="("&&(s.length===0||t===0||h(e[t-1]))){let i=e.indexOf(")",t+1);if(i!==-1&&e[i+1]!=="."){s.push({name:e.slice(t+1,i),suffix:"parameter"}),t=i+1;continue}}let r;if(e[t]==="`"){let i=e.indexOf("`",t+1);if(i===-1){r=e.slice(t+1),s.push({name:r,suffix:"term"});break}r=e.slice(t+1,i),t=i+1}else{let i=t;for(;t<e.length&&!h(e[t]);)t++;r=e.slice(i,t)}if(t>=e.length){r&&s.push({name:r,suffix:"term"});break}let n=e[t];if(n==="("){let i=e.indexOf(")",t+1);i!==-1&&e[i+1]==="."?(s.push({name:r,suffix:"method"}),t=i+2):i!==-1?(s.push({name:r,suffix:"method"}),t=i+1):(s.push({name:r,suffix:"term"}),t++)}else{let i=y[n];i&&s.push({name:r,suffix:i}),t+=1}}return s}function h(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function R(e){let s=a(e);if("kind"in s&&s.kind==="local")return`local:${s.id}`;let t=s;if(t.descriptors.length===0)return t.raw;let r=[];for(let n of t.descriptors){let i=k(n);i&&r.push(i)}return r.join(":")}function k(e){let s=e.suffix==="namespace"?F(e.name):e.name;return s?e.suffix==="method"?`${s}()`:s:""}function F(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 $(e){let s=a(e);if("kind"in s&&s.kind==="local")return s.id;let t=s;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let s=a(e);if("kind"in s&&s.kind==="local")return null;let t=s;return t.descriptors[t.descriptors.length-1]?.suffix??null}function T(e){return e.endsWith("().")||p(e)==="method"}function j(e){let s=p(e);return s==="method"?!0:s!=="term"?!1:e.endsWith("().")||!e.startsWith("scip-typescript ")?!0:!/#[A-Za-z0-9_$]+\.$/.test(e)}function I(e){return p(e)==="namespace"}var D=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function L(e){return D.test(e)}var E=new Set(["test","tests","_tests"]);function O(e){let s=a(e);if("kind"in s)return!1;for(let t=0;t<s.descriptors.length-1;t+=1){let r=s.descriptors[t];if(r?.suffix==="namespace"&&r.name&&E.has(r.name))return!0}return!1}function P(e,s){let t=a(e),r=a(s);if("kind"in t||"kind"in r)return!1;let n=t.descriptors,i=r.descriptors;if(i.length!==n.length+1)return!1;for(let o=0;o<n.length;o++){let c=n[o],l=i[o];if(c.name!==l.name||c.suffix!==l.suffix)return!1}return!0}function _(e,s){let t=a(e),r=a(s);if("kind"in t||"kind"in r)return!1;let n=t.descriptors,i=r.descriptors;if(i.length<=n.length)return!1;for(let o=0;o<n.length;o++){let c=n[o],l=i[o];if(c.name!==l.name||c.suffix!==l.suffix)return!1}return!0}function z(e){return{forFile(s,t){return b(e,s,t)},forFiles(s,t){let r=new Map;for(let n of s)r.set(n,b(e,n,t));return r}}}function b(e,s,t){let r={file:s},n=t.facts||t.identifiers;if(t.text&&(r.text=u(e,s)),t.lines&&(r.lines=d(e,s)),t.ast&&(r.ast=m(e,s)),t.imports&&(r.imports=x(e,s)),t.reexports&&(r.reexports=S(e,s)),n){let i=g(e,s),o=i.facts;t.facts&&(r.facts=o),i.unavailable&&(r.sourceFactsUnavailable=i.unavailable),t.identifiers&&o&&(r.identifiers=o.fileIdentifiers,r.identifierLineMap=o.identifierLineMap)}return r}export{z as a,a as b,M as c,R as d,$ as e,p as f,T as g,j as h,I as i,L as j,O as k,P as l,_ as m};
2
+ //# sourceMappingURL=chunk-X5C43YVI.js.map
@@ -1,3 +1,3 @@
1
- import{a as be}from"./chunk-CW3KZ7UF.js";import{a as ye}from"./chunk-ZRIOGL7F.js";import{a as ne,c as oe,d as re,e as w}from"./chunk-75X52JTA.js";import{a as pe}from"./chunk-2LQWMYG4.js";import{b as ie}from"./chunk-EDB7Y442.js";import{a as ge}from"./chunk-D7J6GZAG.js";import{a as me}from"./chunk-C2QSK7E7.js";import{a as de}from"./chunk-EZ5WDZ2Q.js";import{a as fe}from"./chunk-OVMUVXKQ.js";import{a as ce}from"./chunk-EXKLAEB4.js";import{a as le}from"./chunk-ZOIPAYRP.js";import{a as Y,b as J,c as Z,g as j,h as B}from"./chunk-HSU3M25J.js";import{a as Q,b as D,e as X}from"./chunk-H7NSJ7L2.js";import{a as ee,b as te}from"./chunk-Q3B3FNCU.js";import{b as ae}from"./chunk-FBCOFKEC.js";import{a as N,c as W,d as q,e as V}from"./chunk-NJJ7AS4F.js";import{a as U}from"./chunk-FXG3PHVW.js";import{a as he,e as ue}from"./chunk-BCNT6ODA.js";import{a as se}from"./chunk-ORBRX2QJ.js";import{a as O}from"./chunk-UAHZ57BR.js";import{f as R,g as T}from"./chunk-NAH5EAZS.js";import{i as H}from"./chunk-MKM7NBZK.js";import{e as F,f as z,g as I}from"./chunk-HXXMPYEF.js";import{a as _}from"./chunk-T2FQ4GHD.js";import{a as L}from"./chunk-ISLWJ4PY.js";import{l as P}from"./chunk-WS3Z6W3M.js";import{createHash as We}from"crypto";import{existsSync as K}from"fs";function Ce(e){let[t,i]=G(e,":"),o=t||"unknown",n=(a={})=>{let s=a.actionTier??Ie(o);return{sourceAnalyzer:o,actionTier:s,rootCauseKey:a.rootCauseKey??(i||e),label:a.label??`${o} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??Ne(s,o),file:a.file}};if(!i)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(o)){let[a,s]=G(i,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:i,label:`${o} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(o==="cycle"){let a=i.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:i,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(o==="similar"){let a=i.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:i,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(o==="drift"){let[a,s]=G(i,":"),[l,c]=G(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,c].filter(Boolean))],rootCauseKey:i,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...c?[`Related dependency: ${c}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Ie(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function Ne(e,t){return e==="direct"?`Fix the new ${t} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${t} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function G(e,t){let i=e.indexOf(t);return i<0?[e,""]:[e.slice(0,i),e.slice(i+t.length)]}import{existsSync as je,readFileSync as Be,writeFileSync as Me}from"fs";import{isAbsolute as Ke,join as Le}from"path";var Pe=25e3,_e=2500,ze=2500;function He(e){let t=me(e);return t.symbols>=Pe||t.documents>=_e?ze:void 0}var Oe=".scipquery-baseline.json";function x(e,t){return t&&Ke(t)?t:Le(e.config.projectRoot,t??Oe)}function $e(e,t={}){let{scope:i}=t,o=He(e),n=[],a=ae(e,{scope:i,...w.dead,scanLimit:o});for(let s of a.symbols)R(e,s.relativePath)||T(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of fe(e,{scope:i,...w.isolated,scanLimit:o}))R(e,s.relativePath)||T(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of se(e,{scope:i}))s.kind==="real"&&n.push(`cycle:${Ue(s.path)}`);for(let s of ue(e,{scope:i,...w.similar,scanLimit:o}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of ee(e,{scope:i,...w.duplicateBodies,scanLimit:o}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(l=>l.symbol).sort().join("|")}`);for(let s of le(e,{scope:i,...w.extract,scanLimit:o}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of pe(e,{scope:i,...w.wrappers,scanLimit:o}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of de(e,{scope:i,...w.passthroughs,scanLimit:o}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of ge(e,{scope:i,...w.stale,scanLimit:o}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of ce(e,{scope:i,...w.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return[...new Set(n)].sort()}function Ue(e){if(e.length===0)return"";let t=0;for(let i=1;i<e.length;i++)e[i]<e[t]&&(t=i);return[...e.slice(t),...e.slice(0,t)].join(">")}function Kt(e,t={}){let i=$e(e,{scope:t.scope}),o=x(e,t.path);return Me(o,JSON.stringify({version:1,findings:i},null,2)+`
1
+ import{a as be}from"./chunk-M7EEHYSU.js";import{a as ye}from"./chunk-N2OTJWC2.js";import{a as ne,c as oe,d as re,e as w}from"./chunk-ZEO4CXQR.js";import{a as pe}from"./chunk-27XEGMCT.js";import{a as ge}from"./chunk-6JUAGXR4.js";import{a as me}from"./chunk-C2QSK7E7.js";import{a as de}from"./chunk-6KMTPNZL.js";import{a as fe}from"./chunk-JJUX2OAP.js";import{a as ce}from"./chunk-X3DTIEMU.js";import{a as le}from"./chunk-2XRXEIRK.js";import{b as ie}from"./chunk-HZZQKNVE.js";import{a as ee,b as te}from"./chunk-3AMWF6V5.js";import{a as Y,b as J,c as Z,g as j,h as B}from"./chunk-KYB7FPXT.js";import{a as Q,b as D,e as X}from"./chunk-Q7PWDXL5.js";import{b as ae}from"./chunk-QVGFVRKD.js";import{a as N,c as W,d as q,e as V}from"./chunk-IUSSGHJO.js";import{a as U}from"./chunk-7COVQPQQ.js";import{a as he,e as ue}from"./chunk-KSJ544IV.js";import{a as se}from"./chunk-LY7NMOBW.js";import{a as O}from"./chunk-IMQFJ53K.js";import{f as R,g as T}from"./chunk-BZXE3HO4.js";import{i as H}from"./chunk-GULVO6NF.js";import{e as F,f as z,g as I}from"./chunk-X5C43YVI.js";import{a as _}from"./chunk-JZBGTSAB.js";import{a as L}from"./chunk-ISLWJ4PY.js";import{l as P}from"./chunk-WS3Z6W3M.js";import{createHash as We}from"crypto";import{existsSync as K}from"fs";function Ce(e){let[t,i]=G(e,":"),o=t||"unknown",n=(a={})=>{let s=a.actionTier??Ie(o);return{sourceAnalyzer:o,actionTier:s,rootCauseKey:a.rootCauseKey??(i||e),label:a.label??`${o} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??Ne(s,o),file:a.file}};if(!i)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(o)){let[a,s]=G(i,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:i,label:`${o} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(o==="cycle"){let a=i.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:i,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(o==="similar"){let a=i.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:i,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(o==="drift"){let[a,s]=G(i,":"),[l,c]=G(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,c].filter(Boolean))],rootCauseKey:i,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...c?[`Related dependency: ${c}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Ie(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function Ne(e,t){return e==="direct"?`Fix the new ${t} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${t} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function G(e,t){let i=e.indexOf(t);return i<0?[e,""]:[e.slice(0,i),e.slice(i+t.length)]}import{existsSync as je,readFileSync as Be,writeFileSync as Me}from"fs";import{isAbsolute as Ke,join as Le}from"path";var Pe=25e3,_e=2500,ze=2500;function He(e){let t=me(e);return t.symbols>=Pe||t.documents>=_e?ze:void 0}var Oe=".scipquery-baseline.json";function x(e,t){return t&&Ke(t)?t:Le(e.config.projectRoot,t??Oe)}function $e(e,t={}){let{scope:i}=t,o=He(e),n=[],a=ae(e,{scope:i,...w.dead,scanLimit:o});for(let s of a.symbols)R(e,s.relativePath)||T(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of fe(e,{scope:i,...w.isolated,scanLimit:o}))R(e,s.relativePath)||T(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of se(e,{scope:i}))s.kind==="real"&&n.push(`cycle:${Ue(s.path)}`);for(let s of ue(e,{scope:i,...w.similar,scanLimit:o}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of ee(e,{scope:i,...w.duplicateBodies,scanLimit:o}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(l=>l.symbol).sort().join("|")}`);for(let s of le(e,{scope:i,...w.extract,scanLimit:o}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of pe(e,{scope:i,...w.wrappers,scanLimit:o}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of de(e,{scope:i,...w.passthroughs,scanLimit:o}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of ge(e,{scope:i,...w.stale,scanLimit:o}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of ce(e,{scope:i,...w.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return[...new Set(n)].sort()}function Ue(e){if(e.length===0)return"";let t=0;for(let i=1;i<e.length;i++)e[i]<e[t]&&(t=i);return[...e.slice(t),...e.slice(0,t)].join(">")}function Kt(e,t={}){let i=$e(e,{scope:t.scope}),o=x(e,t.path);return Me(o,JSON.stringify({version:1,findings:i},null,2)+`
2
2
  `),{path:o,findingCount:i.length}}function Se(e,t={}){let i=x(e,t.path);if(!je(i))throw new Error(`No baseline found at ${i}. Create one with: scip-query health --write-baseline`);let o=JSON.parse(Be(i,"utf-8")),n=new Set(o.findings??[]),a=$e(e,{scope:t.scope}),s=new Set(a);return{baselinePath:i,baselineCount:n.size,current:a,newFindings:a.filter(l=>!n.has(l)),fixedFindings:[...n].filter(l=>!s.has(l))}}var ci=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","doc-reference","unused-params","new-dead","baseline"];function li(e,t={}){let i=t.base??"HEAD",{minTogether:o=6,minConfidence:n=.6,maxEchoChecks:a=Number.POSITIVE_INFINITY,maxHelpers:s=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:c=!1,scanLimit:r}=t,d=t.semantic!==!1,u=new Set(t.skip??[]),h=Z(e,{base:i}),p=J(e,{base:i,plan:h}),m=p.changedFiles,b=new Set(m),S=new Set(h.changedFileLines),f=new Set([...b,...S]),C=j(e.config.projectRoot,i,B(h,m)),$=Ct(e.config.projectRoot,i,h,C),g={base:i,changedFiles:m,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],attributionNotes:p.attributionNotes,rootCauseGroups:[],note:p.summary.note};if(m.length===0)return g;let v=(A,Ae)=>{if(u.has(A)){g.skipped.push({check:A,reason:"skipped via --skip"});return}let Ge=g.findings.length,xe=g.skipped.length,Ee=g.checksRun.length;P(`diff-gate.check.${A}`,Ae,()=>({check:A,changedFiles:m.length,changedSymbols:p.changedSymbols.length,findingsAdded:g.findings.length-Ge,skippedAdded:g.skipped.length-xe,checksRunAdded:g.checksRun.length-Ee}))};return v("echo",()=>Je(e,p.changedSymbols,b,$,a,l,r,d,g)),v("incomplete-migration",()=>it(e,i,h,s,r,d,C,g)),v("co-change-partner",()=>nt(e,f,o,n,g)),v("twin-partner",()=>ot(e,p.changedSymbols,b,r,g)),v("coverage-contract",()=>rt(e,f,g)),v("doc-reference",()=>ft(e,b,S,h.changedRanges,h.renamedFiles,g)),v("unused-params",()=>gt(e,m,g)),v("new-dead",()=>mt(e,p.changedSymbols,$,g)),c&&v("baseline",()=>St(e,g)),Ve(g,e.config.suppressions??[]),g.rootCauseGroups=qe(g.findings),g}function fi(e){return e.checksRun.length===0&&e.note===Y}function di(e){return e.filter(t=>!t.advisory)}function qe(e){let t=new Map;for(let i of e){let o=i.groupKey??`${i.check}:${i.id}`,n=t.get(o);n||(n={groupKey:o,check:i.check,severity:i.severity,actionTier:i.actionTier,sourceAnalyzer:i.sourceAnalyzer,rootCauseKey:i.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:i.message,remediation:i.remediation},t.set(o,n)),n.count+=1,n.findingIds.push(i.id),n.severity=Re(n.severity,i.severity),n.actionTier=Te(n.actionTier,i.actionTier),i.file&&n.files.add(i.file);for(let a of i.relatedFiles??[])n.relatedFiles.add(a)}return[...t.values()].map(i=>({...i,files:[...i.files].sort(),relatedFiles:[...i.relatedFiles].sort()})).sort((i,o)=>o.count-i.count||E(o.severity)-E(i.severity)||i.groupKey.localeCompare(o.groupKey))}function Re(e,t){return E(t)>E(e)?t:e}function E(e){return e==="error"?2:e==="warning"?1:0}function Te(e,t){return e?t&&we(t)>we(e)?t:e:t}function we(e){return e==="direct"?2:e==="signal"?1:0}function Ve(e,t){if(t.length===0||e.findings.length===0)return;let i=[];for(let o of e.findings){let n=t.find(a=>Ye(a,o));n?e.suppressed.push({finding:o,suppression:n}):i.push(o)}e.findings=i}function Ye(e,t){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==t.id&&!t.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==t.check||e.file&&e.file!==t.file?!1:!!(e.id||e.check)}function k(e,t){e.findings.push({...t,suppressionHint:`scip-query: ignore ${t.check} ${t.id} -- <reason>`})}function Je(e,t,i,o,n,a,s,l,c){c.checksRun.push("echo");for(let r of t.slice(0,n)){if(!I(r.symbol)||o(r))continue;let d=te(e,r.symbol,{maxLoc:15,scanLimit:s}).filter(f=>!i.has(f.file)).slice(0,5).map(f=>({otherFile:f.file,otherShort:f.shortName,otherSymbol:f.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${f.loc} LOC)`]}));if(d.length>0){let f=y("echo",r.symbol,r.file),C=y("echo",r.symbol,r.file,...d.map(g=>`${g.otherSymbol}|${g.otherFile}`).sort()),$=d[0];k(c,{id:f,legacySuppressionIds:C===f?void 0:[C],groupKey:f,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(d.map(g=>g.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${r.symbol}:${$.otherSymbol}`,message:ke(r,d),why:De(r,d),remediation:Fe("direct",r.shortName,$.otherShort)});continue}let u=he(e,r.symbol,{minSimilarity:a,limit:5,scanLimit:s,semantic:l,sourceCandidateMode:"target-pruned"}),h=[];for(let f of u){let C=f.fileA===r.file?f.fileB:f.fileA,$=f.fileA===r.file?f.shortNameB:f.shortNameA,g=f.fileA===r.file?f.symbolB:f.symbolA;i.has(C)||h.push({otherFile:C,otherShort:$,otherSymbol:g,similarity:f.similarity,similarityBasis:f.similarityBasis??"callees",sharedEvidence:f.sharedCallees})}if(h.length===0)continue;let p=h[0],m=y("echo",r.symbol,r.file,...h.map(f=>`${f.otherSymbol}|${f.otherFile}`).sort()),b=y("echo",r.symbol,r.file),S=Ze(r,h);k(c,{id:b,legacySuppressionIds:m===b?void 0:[m],groupKey:b,actionTier:S,check:"echo",severity:"warning",evidence:"heuristic",confidence:p.similarity,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(h.map(f=>f.otherFile))].sort(),message:ke(r,h),why:De(r,h),remediation:Fe(S,r.shortName,p.otherShort)})}t.length>n&&c.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${t.length} changed symbols`})}function Ze(e,t){return t.some(o=>Qe(e.symbol,o))?"direct":"signal"}function Qe(e,t){if(t.similarityBasis==="exact-body")return!0;if(t.similarityBasis!=="source-tokens"||t.similarity<.98||t.sharedEvidence.length>8)return!1;let i=F(e),o=F(t.otherSymbol);return!i||!o?!1:i===o?!0:tt(t.sharedEvidence)?!1:Xe(i,o)}function Xe(e,t){let i=ve(e),o=ve(t);if(i.length===0||o.length===0)return!1;let n=new Set(o),a=i.filter(s=>n.has(s)).length;return a>=2&&a/Math.min(i.length,o.length)>=.5}function ve(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}var et=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function tt(e){return e.length>=3&&e.every(t=>et.has(t.toLowerCase()))}function ke(e,t){let i=t[0],o=Math.round(i.similarity*100);return t.length===1?`${e.shortName} (${e.file}) is ${o}% similar to established ${i.otherShort} (${i.otherFile})`:`${e.shortName} (${e.file}) resembles ${t.length} established symbol(s); strongest is ${o}% similar to ${i.otherShort} (${i.otherFile})`}function De(e,t){let i=[`${e.shortName} was changed in this diff.`];for(let o of t.slice(0,3))i.push(`${o.otherShort} is outside this diff and scored ${Math.round(o.similarity*100)}% similar by ${o.similarityBasis} evidence.`),i.push(`Shared evidence: ${o.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return t.length>3&&i.push(`${t.length-3} additional similar match(es) grouped into this finding.`),i}function Fe(e,t,i){return e==="direct"?`Extract or reuse the shared behavior with ${i}, or keep the duplicate with a suppression reason.`:`Review whether ${t} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function it(e,t,i,o,n,a,s,l){let c=ye(e,{base:t,maxHelpers:o,diffPlan:i,scanLimit:n,semantic:a,baseContentAt:s});if(!c.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),c.note&&l.skipped.push({check:"incomplete-migration",reason:c.note});for(let r of c.findings){let d=r.leftovers.map(f=>`${f.shortName} (${f.file}, ${Math.round(f.containment*100)}% helper / ${Math.round(f.siteCoverage*100)}% site, ${f.migrationScope})`).join(", "),u=r.leftovers.map(f=>`${f.shortName}: ${f.migrationScope} (${f.migrationScopeReasons[0]})`).join("; "),h=[...r.migratedFiles,...r.leftovers.map(f=>f.file)],p=r.leftovers.length===0?void 0:Math.max(...r.leftovers.map(f=>Math.min(f.containment,f.siteCoverage))),m=r.leftovers.some(f=>f.migrationScope==="possible-subtype"),b=y("incomplete-migration",r.helperSymbol,r.helperFile,h.join("|")),S=y("incomplete-migration",r.helperSymbol,r.helperFile);k(l,{id:S,legacySuppressionIds:b===S?void 0:[b],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:r.helperFile,symbol:r.helperSymbol,relatedFiles:h,message:`new helper ${r.helperShortName} (${r.helperFile}) is wired into ${r.migratedFiles.length} file(s), but ${r.leftovers.length} similar un-migrated site(s) remain: ${d}`,why:[`${r.helperShortName} is new in this diff and already referenced by ${r.migratedFiles.join(", ")}.`,`Helper shape: ${r.helperShape}; ${r.specificHelperCalleeCount}/${r.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${d}.`,`Migration scope hints: ${u}.`],remediation:m?`Migrate same-scope sites to ${r.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${r.helperShortName}, or confirm they are intentionally different.`})}}function nt(e,t,i,o,n){let a=U(e).directionalCoChangePairsForFiles(t,{minTogether:i,minConfidence:0,maxFilesPerCommit:20});if(!a){n.skipped.push({check:"co-change-partner",reason:"no git history"});return}n.checksRun.push("co-change-partner");let s=new Set,l;for(let c of a){let r=t.has(c.fileA),d=t.has(c.fileB);if(r===d)continue;let u=r?c.fileA:c.fileB,h=r?c.fileB:c.fileA,p=r?c.changesA:c.changesB,m=p>0?c.together/p:0;if(m<o||N(h)||N(u)||!K(`${e.config.projectRoot}/${h}`))continue;let b=`${u}|${h}`;if(s.has(b))continue;s.add(b);let S=y("co-change-partner",u,h,String(c.together)),f=y("co-change-partner",u,h),C=W(u,h),$=q({fileA:u,fileB:h,together:c.together,confidence:m,commitScope:c.commitScope,recency:c.recency,subjectContext:c.subjectContext},C,(l??=V(e))(u,h)),g=[u,h].sort().join("|");n.findings.push({id:f,legacySuppressionIds:S===f?void 0:[S],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${g}`,confidence:m,file:u,relatedFiles:[h],sourceAnalyzer:"co-change",rootCauseKey:g,partnerClass:C.partnerClass,partnerClassReasons:C.reasons,commitScope:c.commitScope,recency:c.recency,focusedTogether:c.focusedTogether,broadTogether:c.broadTogether,broadCommitRatio:c.broadCommitRatio,lastTogetherAt:c.lastTogetherAt,recentTogether:c.recentTogether,subjectContext:c.subjectContext,...$?{declaredCouplingSuggestion:$}:{},message:`${u} changed, but ${h} did not \u2014 they change together ${c.together}x (${Math.round(m*100)}% of the time)`,why:[`${u} is in this diff and ${h} is not.`,`Git history shows ${c.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${st(c)}.`,`Subject context: ${at(c.subjectContext)}.`,...ct(c),`Partner class: ${C.partnerClass} (${C.reasons.join("; ")}).`],remediation:$?`Update ${h} alongside this change, declare the coupling "${$.name}", or confirm the coupling no longer holds.`:`Update ${h} alongside this change, or confirm the coupling no longer holds.`})}}function ot(e,t,i,o,n){n.checksRun.push("twin-partner");let a=ie(e,{scanLimit:o}).filter(c=>c.relationship==="divergent"||c.relationship==="identical");if(a.length===0)return;let s=new Map;for(let c of a)for(let r of c.members)s.set(r.symbol,c);let l=new Set;for(let c of t){if(!I(c.symbol))continue;let r=s.get(c.symbol);if(!r)continue;let d=r.members.filter(m=>m.symbol!==c.symbol&&!i.has(m.file));if(d.length===0)continue;let u=[c.symbol,...d.map(m=>m.symbol)].sort().join("|");if(l.has(u))continue;l.add(u);let h=d[0],p=y("twin-partner",c.symbol,c.file,h.symbol);k(n,{id:p,groupKey:`twin-partner:${u}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:r.relationship==="identical"?1:Math.max(0,1-r.maxDivergence),file:c.file,symbol:c.symbol,relatedFiles:d.map(m=>m.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:u,message:`${c.shortName} (${c.file}) changed but its same-name twin ${h.shortName} (${h.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${c.symbol} is in this diff.`,`${h.symbol} shares its (near-)name and is classified '${r.relationship}' with it, but ${h.file} is not in this diff.`,r.relationship==="divergent"?`The two bodies already diverge (~${Math.round(r.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 ${h.file} alongside this change, consolidate ${c.shortName}/${h.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function rt(e,t,i){i.checksRun.push("coverage-contract");let o=e.config.coverageContracts??[];for(let n of o){if(!oe(n,t))continue;let a=ne(e,n);if(a.status==="ok")continue;let s=y("coverage-contract",n.name,n.file);k(i,{id:s,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:a.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:re(a),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,a.status==="unavailable"?`The declared side could not be evaluated: ${a.unavailableReason}.`:`Missing: ${a.missing.join(", ")||"none"}. Extra: ${a.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:a.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 st(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${lt(e.lastTogetherAt)}`}function at(e){let t=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",i=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",o=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${t}; refs ${i}; samples ${o}; external issue/PR labels ${e.externalIssueLabelStatus}`}function ct(e){let t=[];return e.commitScope==="broad-sweep"&&t.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&t.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),t}function lt(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var M=3;function ft(e,t,i,o,n,a){a.checksRun.push("doc-reference");let s=D.referenceTargets(e,t,o);if(s.size===0)return;let l=new Set(n.map(r=>r.from)),c=[];for(let r of X(e,s))i.has(r.doc)||Q(e,r.doc)||c.push(dt(e,r,l));for(let r of ht(c))k(a,r)}function dt(e,t,i){let o=t.citedClaims.length>0?t.citedClaims:D.citationContexts(e,t.doc,t.cited),n=D.classifyCitation(o),a=D.hasLineAnchoredCitation(t.citations),s=t.cited.some(u=>i.has(u)||!K(`${e.config.projectRoot}/${u}`)),l=!(a||s),c=t.cited[0]??"",r=y("doc-reference",t.doc,t.cited.join("|")),d=y("doc-reference",t.doc,c);return{id:d,legacySuppressionIds:r===d?void 0:[r],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${c}`,rootCauseKey:c,confidence:1,file:t.doc,relatedFiles:t.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:o,...l?{advisory:!0}:{},message:`${t.doc} cites ${t.cited.join(", ")} as ${D.citationKindLabel(n.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${t.cited.join(", ")} changed in this diff.`,`${t.doc} cites the changed file(s) but was not updated in the same diff.`,...n.reasons.map(u=>`Citation kind evidence: ${u}`),l?"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.":a?"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,t.doc)}}function ht(e){let t=new Map;for(let o of e){let n=o.rootCauseKey??"",a=t.get(n);a?a.push(o):t.set(n,[o])}let i=[];for(let[o,n]of t)n.length<=M?i.push(...n):i.push(ut(o,n));return i}function ut(e,t){let i=[...t].sort((d,u)=>(d.file??"").localeCompare(u.file??"")),o=i.slice(0,M).map(d=>({doc:d.file??"",citedClaims:d.citedClaims??[]})),n=i.length-o.length,a=i.every(d=>d.advisory===!0),s=i.reduce((d,u)=>Re(d,u.severity),"info"),l=i.reduce((d,u)=>Te(d,u.actionTier),void 0),c=i.map(d=>d.file??"").filter(d=>d.length>0),r=[...new Set(i.flatMap(d=>[d.id,...d.legacySuppressionIds??[]]))];return{id:y("doc-reference","hub-cluster",e),memberFindingIds:r,check:"doc-reference",severity:s,evidence:"change-graph",actionTier:l,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:o[0]?.doc,relatedFiles:[e],citationCount:i.length,citationExemplars:o,suppressedCount:n,...a?{advisory:!0}:{},message:`${e} is cited by ${i.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${o.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${i.length} doc(s) cite it but were not updated in the same diff: ${c.join(", ")}.`,...o.map(d=>`Example \u2014 ${d.doc}: ${d.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${M}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,a?"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 ${o.length} example doc(s) above; ${i.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function gt(e,t,i){i.checksRun.push("unused-params");for(let o of be(e,{files:t,limit:50})){let n=y("unused-params",o.symbol,o.file,o.unusedTrailing.join("|")),a=y("unused-params",o.symbol,o.file);k(i,{id:a,legacySuppressionIds:n===a?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:o.file,startLine:o.startLine,endLine:o.endLine,symbol:o.symbol,message:`${o.shortName} (${o.file}) has trailing unused parameter(s): ${o.unusedTrailing.join(", ")}`,why:[`${o.shortName} is in a changed file.`,`The trailing parameter(s) ${o.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function mt(e,t,i,o){o.checksRun.push("new-dead");let n=new O(e),a=L(e.config.projectRoot),s=a.length>1;for(let l of t){if(i(l)||l.fanIn>0||n.fileKind(l.file)==="test"||R(e,l.file)||T(e,l.symbol,l.file)||bt(l.symbol))continue;let c=y("new-dead",l.symbol,l.file),r=s&&pt(a,l.file)&&yt(e,l.symbol);k(o,{id:c,check:"new-dead",severity:"warning",evidence:r?"heuristic":"graph-fact",confidence:r?.4:.9,file:l.file,symbol:l.symbol,message:r?`${l.shortName} (${l.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`:`${l.shortName} (${l.file}) was changed but has zero indexed consumers`,why:r?[`${l.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."]:[`${l.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:r?"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 pt(e,t){return e.some(i=>t===i.relativeDir||t.startsWith(`${i.relativeDir}/`))}function yt(e,t){let i=F(t);return i?(H(e).get(i)?.length??0)>1:!1}function bt(e){if(z(e)!=="type")return!1;let t=F(e);return t.startsWith("_Assert")||t.startsWith("Assert")}function Ct(e,t,i,o){let n=new Map(i.renamedFiles.map(s=>[s.to,s.from])),a=o??j(e,t,B(i));return s=>{let l=n.get(s.file)??s.file,c=F(s.symbol);if(!c)return!1;let r=a(l);return r!==null&&$t(r,c)}}function $t(e,t){return new RegExp(`\\b${_(t)}\\b`).test(e)}function St(e,t){if(!K(x(e))){t.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("baseline");let i=Se(e);for(let o of i.newFindings){let n=Ce(o),a=y("baseline",o);k(t,{id:a,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: ${o}`,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 y(e,...t){return`SQ${We("sha256").update([e,...t].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{$e as a,Kt as b,Se as c,ci as d,li as e,fi as f,di as g,Ct as h};
3
- //# sourceMappingURL=chunk-IRJDYTNZ.js.map
3
+ //# sourceMappingURL=chunk-XC2PJOVM.js.map
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunk-K6UI6EBZ.js";import{b as h}from"./chunk-KSUZS77X.js";import{a as y}from"./chunk-UAHZ57BR.js";import{d as b}from"./chunk-HXXMPYEF.js";import{d as p}from"./chunk-T2FQ4GHD.js";function v(e,n){let{scope:s,minLoc:r=10,limit:o=30,scanLimit:a}=n??{},l=new y(e);return g({candidates:()=>l.productionCallableDefinitions({scope:s,minLoc:r,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,profile:{name:"complexity-hotspots"},prepare:t=>{let i=B(e,t);return{callerMap:l.crossFileCallerMap(t,{semantic:n?.semantic!==!1}),calleeMap:l.calleeMap(t,{semantic:n?.semantic!==!1}),languageByFile:i,clojureCallableIds:I(e,t,i),branchEstimates:x(e,t)}},evaluate:(t,i)=>M(t,i,r),orderResults:(t,i)=>i.score-t.score||i.loc-t.loc,limit:o})}function M(e,n,s){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let r=e.endLine-e.startLine+1;if(r<s)return null;let o=n.callerMap.get(e.symbolId)?.size??0,a=n.calleeMap.get(e.symbolId)??[],l=new Set,t=new Set;for(let m of a){let u=`${m.symbol}|${m.file}`;l.add(u),m.file!==e.relativePath&&t.add(u)}let i=t.size,d=l.size,c=n.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},f=c.branches+1;return{symbol:e.symbol,shortName:b(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r,fanIn:o,fanOut:i,calleeCount:d,branches:c.branches,estimateBasis:c.estimateBasis,score:Math.round(r/50*(o/5)*Math.max(i/5,1)*Math.max(f/5,1)*100)/100}}function x(e,n){return new Map(n.map(s=>[s.symbolId,h(e,s)]))}function B(e,n){let s=[...new Set(n.map(a=>a.relativePath))];if(s.length===0)return new Map;let r=s.map(()=>"?").join(", "),o=e.all(`SELECT relative_path, language
1
+ import{a as g}from"./chunk-K6UI6EBZ.js";import{b as h}from"./chunk-XZBLZHXL.js";import{a as y}from"./chunk-IMQFJ53K.js";import{d as b}from"./chunk-X5C43YVI.js";import{f as p}from"./chunk-JZBGTSAB.js";function v(e,n){let{scope:s,minLoc:r=10,limit:o=30,scanLimit:a}=n??{},l=new y(e);return g({candidates:()=>l.productionCallableDefinitions({scope:s,minLoc:r,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,profile:{name:"complexity-hotspots"},prepare:t=>{let i=B(e,t);return{callerMap:l.crossFileCallerMap(t,{semantic:n?.semantic!==!1}),calleeMap:l.calleeMap(t,{semantic:n?.semantic!==!1}),languageByFile:i,clojureCallableIds:I(e,t,i),branchEstimates:x(e,t)}},evaluate:(t,i)=>M(t,i,r),orderResults:(t,i)=>i.score-t.score||i.loc-t.loc,limit:o})}function M(e,n,s){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let r=e.endLine-e.startLine+1;if(r<s)return null;let o=n.callerMap.get(e.symbolId)?.size??0,a=n.calleeMap.get(e.symbolId)??[],l=new Set,t=new Set;for(let m of a){let u=`${m.symbol}|${m.file}`;l.add(u),m.file!==e.relativePath&&t.add(u)}let i=t.size,d=l.size,c=n.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},f=c.branches+1;return{symbol:e.symbol,shortName:b(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:r,fanIn:o,fanOut:i,calleeCount:d,branches:c.branches,estimateBasis:c.estimateBasis,score:Math.round(r/50*(o/5)*Math.max(i/5,1)*Math.max(f/5,1)*100)/100}}function x(e,n){return new Map(n.map(s=>[s.symbolId,h(e,s)]))}function B(e,n){let s=[...new Set(n.map(a=>a.relativePath))];if(s.length===0)return new Map;let r=s.map(()=>"?").join(", "),o=e.all(`SELECT relative_path, language
2
2
  FROM documents
3
3
  WHERE relative_path IN (${r})`,...s);return new Map(o.map(a=>[a.relative_path,a.language?.toLowerCase()??null]))}function I(e,n,s){let r=new Set,o=new Map;for(let a of n){if(s.get(a.relativePath)!=="clojure")continue;let l=o.get(a.relativePath);l||(l=new Set((p(e,a.relativePath)?.callables??[]).map(t=>`${t.name}:${t.startLine}`)),o.set(a.relativePath,l)),l.has(`${a.leaf}:${a.startLine}`)&&r.add(a.symbolId)}return r}export{v as a};
4
- //# sourceMappingURL=chunk-Z3IPJKJP.js.map
4
+ //# sourceMappingURL=chunk-XDESMVOL.js.map
@@ -1,4 +1,4 @@
1
- import{a as f}from"./chunk-UAHZ57BR.js";import{a as u}from"./chunk-ECVXWZ4Q.js";import{d as b}from"./chunk-HXXMPYEF.js";import{b as m}from"./chunk-T2FQ4GHD.js";import{A as l}from"./chunk-ISLWJ4PY.js";import{readFileSync as d}from"fs";import{join as _}from"path";function M(e,t,n={}){let s=u(e,t);if(!s)return null;let i=new f(e),a=S(e,s),r=s.endLine-s.startLine+1,c=i.calleeMap([s],{additive:!0,semantic:n.semantic}).get(s.symbolId)??[],p=new Set(c.map(y=>y.symbol));return{symbol:s.symbol,shortName:b(s.symbol),relativePath:s.relativePath,startLine:s.startLine,endLine:s.endLine,loc:r,branches:a.branches,estimateBasis:a.estimateBasis,cyclomaticEstimate:a.branches+1,calleeCount:p.size,fanIn:N(e,s.symbolId),fanOut:B(c,s.relativePath)}}function S(e,t){let n=l(e,t.relativePath);if(n){let s=g(n.rootNode,t.startLine,t.endLine);if(s)return{branches:P(s),estimateBasis:"ast"}}return{branches:L(E(e,t.relativePath,t.startLine,t.endLine),x(e,t.relativePath)),estimateBasis:"regex-fallback"}}function x(e,t){return e.get("SELECT language FROM documents WHERE relative_path = ?",t)?.language??"unknown"}function E(e,t,n,s){try{return d(_(e.config.projectRoot,t),"utf-8").split(`
1
+ import{a as f}from"./chunk-IMQFJ53K.js";import{a as u}from"./chunk-27HMTUJE.js";import{d as b}from"./chunk-X5C43YVI.js";import{b as m}from"./chunk-JZBGTSAB.js";import{A as l}from"./chunk-ISLWJ4PY.js";import{readFileSync as d}from"fs";import{join as _}from"path";function M(e,t,n={}){let s=u(e,t);if(!s)return null;let i=new f(e),a=S(e,s),r=s.endLine-s.startLine+1,c=i.calleeMap([s],{additive:!0,semantic:n.semantic}).get(s.symbolId)??[],p=new Set(c.map(y=>y.symbol));return{symbol:s.symbol,shortName:b(s.symbol),relativePath:s.relativePath,startLine:s.startLine,endLine:s.endLine,loc:r,branches:a.branches,estimateBasis:a.estimateBasis,cyclomaticEstimate:a.branches+1,calleeCount:p.size,fanIn:N(e,s.symbolId),fanOut:B(c,s.relativePath)}}function S(e,t){let n=l(e,t.relativePath);if(n){let s=g(n.rootNode,t.startLine,t.endLine);if(s)return{branches:P(s),estimateBasis:"ast"}}return{branches:L(E(e,t.relativePath,t.startLine,t.endLine),x(e,t.relativePath)),estimateBasis:"regex-fallback"}}function x(e,t){return e.get("SELECT language FROM documents WHERE relative_path = ?",t)?.language??"unknown"}function E(e,t,n,s){try{return d(_(e.config.projectRoot,t),"utf-8").split(`
2
2
  `).slice(n,s+1).join(`
3
3
  `)}catch{return""}}function N(e,t){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
4
4
  FROM mentions m
@@ -13,4 +13,4 @@ import{a as f}from"./chunk-UAHZ57BR.js";import{a as u}from"./chunk-ECVXWZ4Q.js";
13
13
  WHERE m.symbol_id = ?
14
14
  AND m.role != 1
15
15
  AND sym_def.document_id != c.document_id`,t)?.c??0}function B(e,t){return new Set(e.filter(n=>n.file!==t).map(n=>n.symbol)).size}function P(e){let t=0;return h(e,n=>{if(C.has(n.type)){t+=1;return}n.type==="binary_expression"&&n.parent?.type!=="binary_expression"&&(n.text.includes("&&")||n.text.includes("||"))&&(t+=O(n.text))}),t}function h(e,t){t(e);for(let n of e.namedChildren)h(n,t)}function g(e,t,n){if(e.startPosition.row>t||e.endPosition.row<n)return null;for(let s of e.namedChildren){let i=g(s,t,n);if(i)return i}return e}var C=new Set(["if_statement","conditional_expression","ternary_expression","for_statement","for_in_statement","for_of_statement","while_statement","do_statement","switch_case","case_statement","catch_clause","except_clause","elif_clause","match_arm"]);function O(e){return(e.match(/&&|\|\|/g)??[]).length}function L(e,t){let n=m(e),s=0,i=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let a of i){let r=n.match(a);r&&(s+=r.length)}if(t==="python"){let a=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let r of a){let o=n.match(r);o&&(s+=o.length)}}else if(t==="rust"){let a=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let r of a){let o=n.match(r);o&&(s+=o.length)}}else if(t==="ruby"){let a=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let r of a){let o=n.match(r);o&&(s+=o.length)}}else if(t==="go"){let a=[/\bselect\b/g,/\bdefer\b/g];for(let r of a){let o=n.match(r);o&&(s+=o.length)}}return s}export{M as a,S as b,P as c};
16
- //# sourceMappingURL=chunk-KSUZS77X.js.map
16
+ //# sourceMappingURL=chunk-XZBLZHXL.js.map
@@ -1,4 +1,4 @@
1
- import{b as m}from"./chunk-OSWF3HSF.js";import{k as o}from"./chunk-MBKJ7GHT.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
1
+ import{b as m}from"./chunk-K7SPOJHZ.js";import{k as o}from"./chunk-7TVFPOD7.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
2
2
  WHERE relative_path IN (${d})
3
3
  ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
4
4
  FROM mentions m
@@ -32,4 +32,4 @@ import{b as m}from"./chunk-OSWF3HSF.js";import{k as o}from"./chunk-MBKJ7GHT.js";
32
32
  WHERE d2.relative_path IN (${d})
33
33
  AND d1.relative_path NOT IN (${d})
34
34
  ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{h as a};
35
- //# sourceMappingURL=chunk-7ITCOJGD.js.map
35
+ //# sourceMappingURL=chunk-YQKECTPV.js.map
@@ -0,0 +1,2 @@
1
+ import{a as f}from"./chunk-IMQFJ53K.js";import{a as h}from"./chunk-27HMTUJE.js";import{e as s,g as u}from"./chunk-X5C43YVI.js";import{f as d}from"./chunk-JZBGTSAB.js";import{x as c}from"./chunk-ISLWJ4PY.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-YTVKPJXW.js.map
@@ -1,2 +1,2 @@
1
- import{a as m,b as d}from"./chunk-QZ4JVECJ.js";import{a as u}from"./chunk-T2FQ4GHD.js";import{A as g,x as f}from"./chunk-ISLWJ4PY.js";import{p as l}from"./chunk-WS3Z6W3M.js";import{readFileSync as E,readdirSync as h}from"fs";import{basename as k,join as c}from"path";function S(t,e,r={}){let a=new Set(t),n=new Set(e),o=[...n].filter(i=>!a.has(i)).sort(),s=r.allowExtra?[]:[...a].filter(i=>!n.has(i)).sort();return{missing:o,extra:s}}function b(t,e){let r=N(t,e.file,e.keys);if(!r.ok)return{name:e.name,file:e.file,status:"unavailable",missing:[],extra:[],unavailableReason:r.reason};let a=L(t.config.projectRoot,e.mustEqual),n=S(r.keys,a,{allowExtra:e.allowExtra??!1}),o=n.missing.length>0||n.extra.length>0?"violated":"ok";return{name:e.name,file:e.file,status:o,missing:n.missing,extra:n.extra}}function O(t,e){return e.map(r=>b(t,r))}function G(t,e){if(e.has(t.file))return!0;let r=t.mustEqual;switch(r.type){case"top-level-dirs":return[...e].some(a=>a===r.path||a.startsWith(`${r.path}/`));case"file-glob":return[...e].some(a=>m(r.pattern,a));case"registered-commands":return e.has("docs/COMMAND_REFERENCE.md");case"builtin-skills":return[...e].some(a=>a.startsWith("skills/"))}}function I(t){if(t.status==="unavailable")return`[coverage-contract] ${t.name}: DISCLOSED \u2014 could not evaluate (${t.unavailableReason})`;let e=[];return t.missing.length>0&&e.push(`missing ${t.missing.join(", ")}`),t.extra.length>0&&e.push(`extra ${t.extra.join(", ")}`),`[coverage-contract] ${t.name}: ${e.join("; ")}`}function N(t,e,r){return r.type==="markdown-list"?T(t,e,r.marker):R(t,e,r)}function R(t,e,r){if(!l(t,e))return{ok:!1,reason:`file not found: ${e}`};let n=f(e);if(!n)return{ok:!1,reason:`unsupported file type for ${r.type} extraction: ${e}`};let o=g(t,e);if(!o)return{ok:!1,reason:`tree-sitter parser unavailable for ${n} (${e}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:n,reason:"parser-unavailable"}};let s=r.type==="object-literal-keys"?D(o,r.identifier):w(o,r.identifier);return s===null?{ok:!1,reason:`no ${r.type==="object-literal-keys"?"object literal":"string array"} named "${r.identifier}" found in ${e}`}:{ok:!0,keys:s}}function y(t){let e=t.childForFieldName("value");return e?e.type==="as_expression"||e.type==="satisfies_expression"?e.namedChild(0):e:null}function D(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let n=y(r);if(n?.type==="object")return $(n)}return null}function $(t){let e=new Set;for(let r of t.namedChildren)if(r.type==="pair"){let a=r.childForFieldName("key");a&&e.add(C(a.text))}else r.type==="shorthand_property_identifier"&&e.add(r.text);return[...e].sort()}function w(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let n=y(r);if(n?.type!=="array")continue;let o=new Set;for(let s of n.namedChildren)s.type==="string"&&o.add(C(s.text));return[...o].sort()}return null}function C(t){return t.length>=2&&(t[0]==="'"&&t.endsWith("'")||t[0]==='"'&&t.endsWith('"'))?t.slice(1,-1):t}function T(t,e,r){let a=l(t,e);if(!a)return{ok:!1,reason:`file not found: ${e}`};let n=v(a,r);return n===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${r} --> ... <!-- END GENERATED ${r} --> block in ${e}`}:{ok:!0,keys:x(n)}}function v(t,e){let r=u(e),n=new RegExp(`<!--\\s*BEGIN GENERATED ${r}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${r}\\s*-->`).exec(t);return n?n[1]:null}function x(t){let e=new Set;for(let r of t.matchAll(/`([a-z][a-z0-9-]*)`/g))e.add(r[1]);for(let r of t.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))e.add(r[1]);return[...e].sort()}function L(t,e){switch(e.type){case"top-level-dirs":return p(c(t,e.path));case"file-glob":return[...new Set(d(t,e.pattern).map(r=>k(r)))].sort();case"registered-commands":return A(t);case"builtin-skills":return p(c(t,"skills"))}}function p(t){let e;try{e=h(t,{withFileTypes:!0})}catch{return[]}return e.filter(r=>r.isDirectory()&&!r.name.startsWith(".")).map(r=>r.name).sort()}function A(t){let e;try{e=E(c(t,"docs/COMMAND_REFERENCE.md"),"utf-8")}catch{return[]}let r=v(e,"COMMAND REFERENCE");return r?x(r):[]}var z={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0,semantic:!1},isolated:{minLoc:3,semantic:!1},similar:{minSimilarity:.6,limit:50,minCallees:4,semantic:!1},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50,semantic:!1},wrappers:{maxLoc:15,limit:50,semantic:!1},passthroughs:{maxLoc:15,limit:50,semantic:!1},stale:{minLoc:3,limit:50,semantic:!1},drift:{semantic:!1},twinDrift:{minSimilarity:.3}};export{b as a,O as b,G as c,I as d,z as e};
2
- //# sourceMappingURL=chunk-75X52JTA.js.map
1
+ import{a as m,b as d}from"./chunk-QZ4JVECJ.js";import{a as u}from"./chunk-JZBGTSAB.js";import{A as g,x as f}from"./chunk-ISLWJ4PY.js";import{p as l}from"./chunk-WS3Z6W3M.js";import{readFileSync as E,readdirSync as h}from"fs";import{basename as k,join as c}from"path";function S(t,e,r={}){let a=new Set(t),n=new Set(e),o=[...n].filter(i=>!a.has(i)).sort(),s=r.allowExtra?[]:[...a].filter(i=>!n.has(i)).sort();return{missing:o,extra:s}}function b(t,e){let r=N(t,e.file,e.keys);if(!r.ok)return{name:e.name,file:e.file,status:"unavailable",missing:[],extra:[],unavailableReason:r.reason};let a=L(t.config.projectRoot,e.mustEqual),n=S(r.keys,a,{allowExtra:e.allowExtra??!1}),o=n.missing.length>0||n.extra.length>0?"violated":"ok";return{name:e.name,file:e.file,status:o,missing:n.missing,extra:n.extra}}function O(t,e){return e.map(r=>b(t,r))}function G(t,e){if(e.has(t.file))return!0;let r=t.mustEqual;switch(r.type){case"top-level-dirs":return[...e].some(a=>a===r.path||a.startsWith(`${r.path}/`));case"file-glob":return[...e].some(a=>m(r.pattern,a));case"registered-commands":return e.has("docs/COMMAND_REFERENCE.md");case"builtin-skills":return[...e].some(a=>a.startsWith("skills/"))}}function I(t){if(t.status==="unavailable")return`[coverage-contract] ${t.name}: DISCLOSED \u2014 could not evaluate (${t.unavailableReason})`;let e=[];return t.missing.length>0&&e.push(`missing ${t.missing.join(", ")}`),t.extra.length>0&&e.push(`extra ${t.extra.join(", ")}`),`[coverage-contract] ${t.name}: ${e.join("; ")}`}function N(t,e,r){return r.type==="markdown-list"?T(t,e,r.marker):R(t,e,r)}function R(t,e,r){if(!l(t,e))return{ok:!1,reason:`file not found: ${e}`};let n=f(e);if(!n)return{ok:!1,reason:`unsupported file type for ${r.type} extraction: ${e}`};let o=g(t,e);if(!o)return{ok:!1,reason:`tree-sitter parser unavailable for ${n} (${e}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:n,reason:"parser-unavailable"}};let s=r.type==="object-literal-keys"?D(o,r.identifier):w(o,r.identifier);return s===null?{ok:!1,reason:`no ${r.type==="object-literal-keys"?"object literal":"string array"} named "${r.identifier}" found in ${e}`}:{ok:!0,keys:s}}function y(t){let e=t.childForFieldName("value");return e?e.type==="as_expression"||e.type==="satisfies_expression"?e.namedChild(0):e:null}function D(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let n=y(r);if(n?.type==="object")return $(n)}return null}function $(t){let e=new Set;for(let r of t.namedChildren)if(r.type==="pair"){let a=r.childForFieldName("key");a&&e.add(C(a.text))}else r.type==="shorthand_property_identifier"&&e.add(r.text);return[...e].sort()}function w(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let n=y(r);if(n?.type!=="array")continue;let o=new Set;for(let s of n.namedChildren)s.type==="string"&&o.add(C(s.text));return[...o].sort()}return null}function C(t){return t.length>=2&&(t[0]==="'"&&t.endsWith("'")||t[0]==='"'&&t.endsWith('"'))?t.slice(1,-1):t}function T(t,e,r){let a=l(t,e);if(!a)return{ok:!1,reason:`file not found: ${e}`};let n=v(a,r);return n===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${r} --> ... <!-- END GENERATED ${r} --> block in ${e}`}:{ok:!0,keys:x(n)}}function v(t,e){let r=u(e),n=new RegExp(`<!--\\s*BEGIN GENERATED ${r}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${r}\\s*-->`).exec(t);return n?n[1]:null}function x(t){let e=new Set;for(let r of t.matchAll(/`([a-z][a-z0-9-]*)`/g))e.add(r[1]);for(let r of t.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))e.add(r[1]);return[...e].sort()}function L(t,e){switch(e.type){case"top-level-dirs":return p(c(t,e.path));case"file-glob":return[...new Set(d(t,e.pattern).map(r=>k(r)))].sort();case"registered-commands":return A(t);case"builtin-skills":return p(c(t,"skills"))}}function p(t){let e;try{e=h(t,{withFileTypes:!0})}catch{return[]}return e.filter(r=>r.isDirectory()&&!r.name.startsWith(".")).map(r=>r.name).sort()}function A(t){let e;try{e=E(c(t,"docs/COMMAND_REFERENCE.md"),"utf-8")}catch{return[]}let r=v(e,"COMMAND REFERENCE");return r?x(r):[]}var z={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0,semantic:!1},isolated:{minLoc:3,semantic:!1},similar:{minSimilarity:.6,limit:50,minCallees:4,semantic:!1},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50,semantic:!1},wrappers:{maxLoc:15,limit:50,semantic:!1},passthroughs:{maxLoc:15,limit:50,semantic:!1},stale:{minLoc:3,limit:50,semantic:!1},drift:{semantic:!1},twinDrift:{minSimilarity:.3}};export{b as a,O as b,G as c,I as d,z as e};
2
+ //# sourceMappingURL=chunk-ZEO4CXQR.js.map