scip-query 0.10.3 → 0.10.4

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 (87) hide show
  1. package/README.md +9 -8
  2. package/dist/{chunk-YVLHL6KQ.js → chunk-237YUOPK.js} +2 -2
  3. package/dist/chunk-56UN3DMK.js +2 -0
  4. package/dist/chunk-5UDFZC4D.js +2 -0
  5. package/dist/{chunk-X474LKJX.js → chunk-6UFMPECA.js} +2 -2
  6. package/dist/chunk-7JOTOWZO.js +4 -0
  7. package/dist/chunk-A7RNHUJH.js +20 -0
  8. package/dist/chunk-AYYIZ4BA.js +4 -0
  9. package/dist/chunk-BNKE4TT5.js +2 -0
  10. package/dist/chunk-MA7OVFHI.js +2 -0
  11. package/dist/chunk-QUJBXLBY.js +2 -0
  12. package/dist/chunk-WBJZNPUT.js +2 -0
  13. package/dist/{chunk-4HOMAEDD.js → chunk-YUTRW57I.js} +2 -2
  14. package/dist/cli.js +209 -197
  15. package/dist/frontend-behavior-evidence-BxKpKWUu.d.ts +4 -0
  16. package/dist/postinstall.js +3 -3
  17. package/dist/queries/diff-gate.d.ts +4 -2
  18. package/dist/queries/diff-gate.js +1 -1
  19. package/dist/queries/diff-impact.js +1 -1
  20. package/dist/queries/doc-drift.js +1 -1
  21. package/dist/queries/health.js +1 -1
  22. package/dist/queries/incomplete-migration.js +1 -1
  23. package/dist/queries/index.d.ts +1 -0
  24. package/dist/queries/index.js +1 -1
  25. package/dist/queries/plan-context.js +1 -1
  26. package/dist/queries/react-component-duplicates.js +1 -1
  27. package/dist/queries/react-hook-candidates.d.ts +3 -2
  28. package/dist/queries/react-hook-candidates.js +1 -1
  29. package/dist/queries/recent-duplicates.js +1 -1
  30. package/dist/queries/vue-component-duplicates.js +1 -1
  31. package/dist/queries/vue-composable-candidates.d.ts +3 -2
  32. package/dist/queries/vue-composable-candidates.js +1 -1
  33. package/dist/runtime.js +1 -1
  34. package/docs/AGENT_GUIDE.md +42 -5
  35. package/docs/AI_FAILURE_MODES.md +28 -21
  36. package/docs/COMMAND_REFERENCE.md +4 -2
  37. package/docs/analyzer-inventory.md +5 -1
  38. package/docs/analyzer-validation-ledger.md +8 -0
  39. package/package.json +3 -2
  40. package/skills/concrete-plan/SKILL.md +3 -5
  41. package/skills/concrete-plan/agents/openai.yaml +4 -0
  42. package/skills/scip-adoption/SKILL.md +120 -0
  43. package/skills/scip-adoption/agents/openai.yaml +4 -0
  44. package/skills/scip-ai-cleanup/SKILL.md +12 -4
  45. package/skills/scip-ai-cleanup/agents/openai.yaml +4 -0
  46. package/skills/scip-api-impact/SKILL.md +147 -0
  47. package/skills/scip-api-impact/agents/openai.yaml +4 -0
  48. package/skills/scip-debloat/SKILL.md +15 -13
  49. package/skills/scip-debloat/agents/openai.yaml +4 -0
  50. package/skills/scip-debug/SKILL.md +119 -0
  51. package/skills/scip-debug/agents/openai.yaml +4 -0
  52. package/skills/scip-diagram/SKILL.md +138 -0
  53. package/skills/scip-diagram/agents/openai.yaml +4 -0
  54. package/skills/scip-directory-architecture/SKILL.md +2 -2
  55. package/skills/scip-directory-architecture/agents/openai.yaml +4 -0
  56. package/skills/scip-doc-reconcile/SKILL.md +1 -3
  57. package/skills/scip-doc-reconcile/agents/openai.yaml +4 -0
  58. package/skills/scip-explore/SKILL.md +8 -2
  59. package/skills/scip-explore/agents/openai.yaml +4 -0
  60. package/skills/scip-health-audit/SKILL.md +158 -0
  61. package/skills/scip-health-audit/agents/openai.yaml +4 -0
  62. package/skills/scip-health-improve/SKILL.md +151 -0
  63. package/skills/scip-health-improve/agents/openai.yaml +4 -0
  64. package/skills/scip-language-playbook/SKILL.md +7 -4
  65. package/skills/scip-language-playbook/agents/openai.yaml +4 -0
  66. package/skills/scip-maintainability/SKILL.md +7 -3
  67. package/skills/scip-maintainability/agents/openai.yaml +4 -0
  68. package/skills/scip-query/SKILL.md +74 -33
  69. package/skills/scip-query/agents/openai.yaml +4 -0
  70. package/skills/scip-query-setup/SKILL.md +65 -18
  71. package/skills/scip-query-setup/agents/openai.yaml +3 -0
  72. package/skills/scip-react-maintainability/SKILL.md +2 -2
  73. package/skills/scip-react-maintainability/agents/openai.yaml +4 -0
  74. package/skills/scip-triage-issue/SKILL.md +112 -0
  75. package/skills/scip-triage-issue/agents/openai.yaml +4 -0
  76. package/skills/scip-verify/SKILL.md +83 -232
  77. package/skills/scip-verify/agents/openai.yaml +4 -0
  78. package/skills/scip-vue-maintainability/SKILL.md +2 -3
  79. package/skills/scip-vue-maintainability/agents/openai.yaml +4 -0
  80. package/dist/chunk-7ADUXFRZ.js +0 -2
  81. package/dist/chunk-GLJAAKDW.js +0 -4
  82. package/dist/chunk-GS33KGAY.js +0 -2
  83. package/dist/chunk-I7TSQZ3J.js +0 -4
  84. package/dist/chunk-NP5HYVLX.js +0 -20
  85. package/dist/chunk-O4L4AB3T.js +0 -2
  86. package/dist/chunk-TO54DY4O.js +0 -2
  87. package/dist/chunk-UMNENNTX.js +0 -2
package/README.md CHANGED
@@ -34,7 +34,7 @@ Agents are effective at editing the code in front of them. They are less reliabl
34
34
  | Plan | Externally consumed surfaces, change scope, blast radius, and historical partners | `surface`, `change-surface`, `co-change` |
35
35
  | Reuse | Whether the helper, component, hook, or composable already exists | `similar`, `recent-duplicates` |
36
36
  | Finish | Whether an extraction or migration reached every relevant site | `incomplete-migration`, `unused-params` |
37
- | Verify | What the diff affected and whether covered structural checks regressed | `diff-impact`, `doc-drift`, `diff-gate`, `health --baseline` |
37
+ | Verify | What the diff affected and whether covered structural checks regressed | `diff-impact --json`, `doc-drift`, `diff-gate --json`, `health --baseline` |
38
38
  | Clean up | Candidate removals and newly exposed dead-code cascades | `cleanup-plan --verify` |
39
39
 
40
40
  React and Vue repositories get additional framework-aware checks for repeated component/template structure, hook/composable behavior, and large-component or large-view pressure. These extend the same reuse and completion workflow; the core graph, history, planning, cleanup, and diff-gate commands are not frontend-specific.
@@ -62,7 +62,7 @@ scip-query similar <closest-symbol>
62
62
  scip-query incomplete-migration
63
63
 
64
64
  # Before declaring the work complete: refresh the index and gate the diff
65
- scip-query reindex && scip-query diff-gate
65
+ scip-query reindex && scip-query diff-gate --json
66
66
  ```
67
67
 
68
68
  For a repository-wide cleanup pass:
@@ -209,21 +209,22 @@ Heuristic detectors carry guardrails learned from real codebases: published `pac
209
209
 
210
210
  ## Agent Skills
211
211
 
212
- `scip-query install-skills` symlinks ready-made skills into Claude Code, Codex, and shared agent roots (`~/.agents/skills/`) they update automatically with the package. The `scip-query` router skill triggers on any codebase work and dispatches to the right specialist: exploring (`scip-explore`), debloating (`scip-debloat`), directory architecture review (`scip-directory-architecture`), maintainability review (`scip-maintainability`), React frontend maintainability review (`scip-react-maintainability`), Vue frontend maintainability review (`scip-vue-maintainability`), post-change verification (`scip-verify`), doc reconciliation (`scip-doc-reconcile`), AI-rot cleanup (`scip-ai-cleanup`), per-language guidance (`scip-language-playbook`), and grounded planning (`concrete-plan`).
212
+ `scip-query install-skills` symlinks bundled skills into Claude Code, Codex, and shared agent roots (`~/.agents/skills/`) so they update automatically with the package. The `scip-query` router skill dispatches codebase work to specialists for setup/adoption, health audit and autonomous health improvement, debugging, issue triage, HTML diagrams, API impact, exploration, planning, cleanup, doc reconciliation, maintainability review, React/Vue review, AI-rot cleanup, language playbooks, and post-change verification.
213
213
 
214
- Then, once per project, `scip-query setup-agent` seeds the `AGENTS.md` guidance block (plus a `CLAUDE.md` import shim, since Claude Code doesn't read AGENTS.md natively), and `--git-hook` adds a pre-commit diff gate that fires no matter which agent or human wrote the change.
214
+ Project setup writes reviewable project-local lifecycle hooks for Codex and Claude Code (`.codex/hooks.json` and `.claude/settings.json`). These hooks add scip-query context at session start, route prompts toward the right skill, and run an advisory Stop-hook wrapper around the diff gate only for that repository. The Stop hook warns by default instead of blocking the agent; set `SCIP_QUERY_STOP_HOOK_MODE=feedback` to ask the agent to continue without a hook error, or `SCIP_QUERY_STOP_HOOK_MODE=block` to enforce the gate. Set `SCIP_QUERY_SKIP_HOOK_INSTALL=1` to skip hook installation during setup, or run `scip-query setup-hooks --json` later to repair the current repo's hooks.
215
+
216
+ For a project, run `scip-query setup`. It installs/refreshes skills, configures project-local hooks, checks indexer readiness, attempts configured indexer remediation, refreshes the index, smoke-tests representative command families, writes `docs/scip-query/health-dossier.md` and `.json`, reports the health score and items needing attention, and seeds AGENTS.md/CLAUDE.md guidance. After setup, `scip-health-audit` confirms raw signals and `scip-health-improve` keeps fixing the worst confirmed items until the score is as high as reasonably possible. Use `scip-query setup --git-hook` when you also want a local pre-commit diff gate. CI setup is intentionally separate.
215
217
 
216
218
  ## Quick Start
217
219
 
218
220
  ```bash
219
- scip-query check-deps # verify indexers are runnable
220
- scip-query install-skills # optional: agent skills
221
- scip-query reindex
221
+ scip-query setup --json # bootstrap local skills, index, capabilities, guidance, and health dossier
222
222
 
223
223
  scip-query stats
224
224
  scip-query system src/auth
225
225
  scip-query plan-context login
226
- scip-query health
226
+ scip-query diff-impact --json
227
+ scip-query health --json --full
227
228
  scip-query cleanup-plan --verify
228
229
  scip-query health --write-baseline # start the ratchet
229
230
  ```
@@ -1,8 +1,8 @@
1
- import{d as E,g as D}from"./chunk-UQJGTVHV.js";import{d as _}from"./chunk-3UVJJ6Z7.js";import{a as N,c as P,f as T}from"./chunk-NP5HYVLX.js";import{a as R}from"./chunk-3ZYF3ELZ.js";import{c as S,d as y}from"./chunk-JM72FNGA.js";var A=5;function ne(e,t={}){let{base:i="HEAD",minContainment:r=.7,minCallees:n=3,minSiteCoverage:o=.4,maxHelpers:a=Number.POSITIVE_INFINITY,limit:g=20}=t,c=t.semantic!==!1,p=t.diffPlan??P(e,{base:i}),s={available:p.note!==N,base:i,changedFiles:p.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!s.available||p.changedFiles.length===0)return s;let v=new R(e),M=new Set(p.changedFiles),q=new Map(p.renamedFiles.map(l=>[l.to,l.from])),f=K(e,v,M,i,q);if(f.length===0)return s;let k=f.slice(0,a);f.length>a&&(s.note=`helper scoring capped at ${a} of ${f.length} new symbols`);let H=E(e,{minCallees:Math.min(3,n),semantic:c}),x=z(H),O=v.calleeMap(k,{semantic:c}),$=k.map(l=>({def:l,callees:D((O.get(l.symbolId)??[]).map(m=>m.symbol))}));for(let{def:l,callees:m}of $){let h=S(l.symbol);if(m.size<n){s.skipped.push({helperShortName:h,helperFile:l.relativePath,reason:`fewer than ${n} meaningful callees \u2014 too small to score`});continue}let w=J(m,x);if(w===0){s.skipped.push({helperShortName:h,helperFile:l.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=U(e,l.symbolId);if(b.length===0){s.skipped.push({helperShortName:h,helperFile:l.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}s.helpersChecked+=1;let C=j({candidateIndex:x,changed:M,helperCallees:m,helperFile:l.relativePath,helperSymbol:l.symbol,minContainment:r,minSiteCoverage:o,migratedFiles:b});C.length!==0&&(C.sort((u,d)=>L(d.migrationScope)-L(u.migrationScope)||d.containment-u.containment||d.siteCoverage-u.siteCoverage||u.file.localeCompare(d.file)),s.findings.push({helperSymbol:l.symbol,helperShortName:h,helperFile:l.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:m.size,specificHelperCalleeCount:w,migratedFiles:b.sort(),leftovers:C.slice(0,A)}))}return s.findings.sort((l,m)=>(m.leftovers[0]?.containment??0)-(l.leftovers[0]?.containment??0)||l.helperFile.localeCompare(m.helperFile)),s.findings=s.findings.slice(0,g),s}function z(e){let t=new Map,i=new Map;for(let r of e)for(let n of r.callees){t.set(n,(t.get(n)??0)+1);let o=i.get(n);o||(o=[],i.set(n,o)),o.push(r)}return{candidatesByCallee:i,docFreq:t,ubiquityThreshold:Math.max(8,Math.ceil(Math.sqrt(e.length)))}}function j(e){let t=[],i=B(e.helperSymbol,e.helperFile,e.migratedFiles),r=new Set;for(let n of e.helperCallees)for(let o of e.candidateIndex.candidatesByCallee.get(n)??[])r.add(o);for(let n of r){if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let o=_(e.helperCallees,n.callees);if(o<e.minContainment)continue;let a=[...e.helperCallees].filter(p=>n.callees.has(p)),g=n.callees.size===0?0:a.length/n.callees.size;if(g<e.minSiteCoverage||!a.some(p=>(e.candidateIndex.docFreq.get(p)??0)<=e.candidateIndex.ubiquityThreshold))continue;let c=V(i,n.symbol,n.file);t.push({symbol:n.symbol,shortName:S(n.symbol),file:n.file,...c,containment:o,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-a.length),sharedCallees:a.map(S).sort()})}return t}function L(e){return e==="same-scope"?2:e==="unknown"?1:0}function B(e,t,i){let r=new Set([...I(t),...F(y(e))]);for(let n of i)for(let o of I(n))r.add(o);return r}function V(e,t,i){let r=new Set([...I(i),...F(y(t))]);if(e.size===0||r.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let n=[...r].filter(o=>e.has(o)).sort();return n.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${n.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var G=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function I(e){return F(e.replace(/\.[^.]+$/,""))}function F(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!G.has(t))}function J(e,t){let i=0;for(let r of e)(t.docFreq.get(r)??0)<=t.ubiquityThreshold&&(i+=1);return i}function K(e,t,i,r,n){let o=new Map;return t.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(a=>{if(!i.has(a.relativePath))return!1;let g=n.get(a.relativePath)??a.relativePath,c=o.get(g);return c===void 0&&(c=T(e.config.projectRoot,r,g),o.set(g,c)),c===null||!new RegExp(`\\b${W(a.leaf)}\\b`).test(c)})}function U(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
1
+ import{d as E,g as D}from"./chunk-UQJGTVHV.js";import{d as _}from"./chunk-3UVJJ6Z7.js";import{b as N,d as P,g as T}from"./chunk-A7RNHUJH.js";import{a as R}from"./chunk-3ZYF3ELZ.js";import{c as S,d as y}from"./chunk-JM72FNGA.js";var A=5;function ne(e,t={}){let{base:i="HEAD",minContainment:r=.7,minCallees:n=3,minSiteCoverage:o=.4,maxHelpers:a=Number.POSITIVE_INFINITY,limit:g=20}=t,c=t.semantic!==!1,p=t.diffPlan??P(e,{base:i}),s={available:p.note!==N,base:i,changedFiles:p.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!s.available||p.changedFiles.length===0)return s;let v=new R(e),M=new Set(p.changedFiles),q=new Map(p.renamedFiles.map(l=>[l.to,l.from])),f=K(e,v,M,i,q);if(f.length===0)return s;let k=f.slice(0,a);f.length>a&&(s.note=`helper scoring capped at ${a} of ${f.length} new symbols`);let H=E(e,{minCallees:Math.min(3,n),semantic:c}),x=z(H),O=v.calleeMap(k,{semantic:c}),$=k.map(l=>({def:l,callees:D((O.get(l.symbolId)??[]).map(m=>m.symbol))}));for(let{def:l,callees:m}of $){let h=S(l.symbol);if(m.size<n){s.skipped.push({helperShortName:h,helperFile:l.relativePath,reason:`fewer than ${n} meaningful callees \u2014 too small to score`});continue}let w=J(m,x);if(w===0){s.skipped.push({helperShortName:h,helperFile:l.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=U(e,l.symbolId);if(b.length===0){s.skipped.push({helperShortName:h,helperFile:l.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}s.helpersChecked+=1;let C=j({candidateIndex:x,changed:M,helperCallees:m,helperFile:l.relativePath,helperSymbol:l.symbol,minContainment:r,minSiteCoverage:o,migratedFiles:b});C.length!==0&&(C.sort((u,d)=>L(d.migrationScope)-L(u.migrationScope)||d.containment-u.containment||d.siteCoverage-u.siteCoverage||u.file.localeCompare(d.file)),s.findings.push({helperSymbol:l.symbol,helperShortName:h,helperFile:l.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:m.size,specificHelperCalleeCount:w,migratedFiles:b.sort(),leftovers:C.slice(0,A)}))}return s.findings.sort((l,m)=>(m.leftovers[0]?.containment??0)-(l.leftovers[0]?.containment??0)||l.helperFile.localeCompare(m.helperFile)),s.findings=s.findings.slice(0,g),s}function z(e){let t=new Map,i=new Map;for(let r of e)for(let n of r.callees){t.set(n,(t.get(n)??0)+1);let o=i.get(n);o||(o=[],i.set(n,o)),o.push(r)}return{candidatesByCallee:i,docFreq:t,ubiquityThreshold:Math.max(8,Math.ceil(Math.sqrt(e.length)))}}function j(e){let t=[],i=B(e.helperSymbol,e.helperFile,e.migratedFiles),r=new Set;for(let n of e.helperCallees)for(let o of e.candidateIndex.candidatesByCallee.get(n)??[])r.add(o);for(let n of r){if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let o=_(e.helperCallees,n.callees);if(o<e.minContainment)continue;let a=[...e.helperCallees].filter(p=>n.callees.has(p)),g=n.callees.size===0?0:a.length/n.callees.size;if(g<e.minSiteCoverage||!a.some(p=>(e.candidateIndex.docFreq.get(p)??0)<=e.candidateIndex.ubiquityThreshold))continue;let c=V(i,n.symbol,n.file);t.push({symbol:n.symbol,shortName:S(n.symbol),file:n.file,...c,containment:o,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-a.length),sharedCallees:a.map(S).sort()})}return t}function L(e){return e==="same-scope"?2:e==="unknown"?1:0}function B(e,t,i){let r=new Set([...I(t),...F(y(e))]);for(let n of i)for(let o of I(n))r.add(o);return r}function V(e,t,i){let r=new Set([...I(i),...F(y(t))]);if(e.size===0||r.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let n=[...r].filter(o=>e.has(o)).sort();return n.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${n.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var G=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function I(e){return F(e.replace(/\.[^.]+$/,""))}function F(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!G.has(t))}function J(e,t){let i=0;for(let r of e)(t.docFreq.get(r)??0)<=t.ubiquityThreshold&&(i+=1);return i}function K(e,t,i,r,n){let o=new Map;return t.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(a=>{if(!i.has(a.relativePath))return!1;let g=n.get(a.relativePath)??a.relativePath,c=o.get(g);return c===void 0&&(c=T(e.config.projectRoot,r,g),o.set(g,c)),c===null||!new RegExp(`\\b${W(a.leaf)}\\b`).test(c)})}function U(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents ref_d ON c.document_id = ref_d.id
5
5
  WHERE m.symbol_id = ?
6
6
  AND m.role != 1
7
7
  ${e.pathExclusionsFor("ref_d")}`,t).map(r=>r.relative_path)}function W(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{ne as a};
8
- //# sourceMappingURL=chunk-YVLHL6KQ.js.map
8
+ //# sourceMappingURL=chunk-237YUOPK.js.map
@@ -0,0 +1,2 @@
1
+ import{a as p,b as H,c as l,d as m}from"./chunk-QUJBXLBY.js";import{a as b}from"./chunk-PVZMPG5I.js";import{a as R,b as g}from"./chunk-3UVJJ6Z7.js";import{e as v}from"./chunk-EWC3UK4V.js";function V(e,s={}){let{minSimilarity:d=.45,minSharedBehaviors:i=6,limit:o=20,scope:n,scanLimit:a,filePattern:c}=s,h=v(e,{scope:n,minBehaviorTokens:Math.max(3,i),scanLimit:a}).map(r=>({file:r.file,component:r.name,tokens:r.behaviorTokens,profile:r}));return b({profiles:h,limit:o,filePattern:c,compare:(r,t)=>y(r,t,d,i),sort:(r,t)=>t.similarity-r.similarity||r.fileA.localeCompare(t.fileA)||r.componentA.localeCompare(t.componentA)||r.fileB.localeCompare(t.fileB)||r.componentB.localeCompare(t.componentB)})}function y(e,s,d,i){let o=R(e.tokens,s.tokens);if(o.size<i||!A(o))return null;let n=H(e.tokens,s.tokens);if(n<d)return null;let a=l(o,"hook:"),c=l(o,"react-hook:"),h=l(o,"effect:"),r=l(o,"state:"),t=l(o,"request:"),u=l(o,"handler:"),k=l(o,"handler-verb:"),f=B({sharedHooks:a,sharedReactHooks:c,sharedEffects:h,sharedState:r,sharedRequests:t,sharedHandlers:u,sharedHandlerVerbs:k});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:n,sharedTokens:m(o),sharedHooks:a,sharedReactHooks:c,sharedEffects:h,sharedState:r,sharedRequests:t,sharedHandlers:u,sharedHandlerVerbs:k,evidenceClass:f.evidenceClass,actionTier:f.actionTier,evidenceClassReasons:f.reasons,recommendation:f.recommendation,uniqueToA:m(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:m(g(s.tokens,e.tokens)).slice(0,25),reason:E({sharedHooks:a,sharedReactHooks:c,sharedEffects:h,sharedState:r,sharedRequests:t,sharedHandlers:u,sharedHandlerVerbs:k}),locA:e.profile.loc,locB:s.profile.loc}}function B(e){return p({genericWords:P,stripPrefixes:S,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:C})}function C(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function A(e){let s=0,d=0,i=0,o=0,n=0,a=0,c=0;for(let t of e)t.startsWith("hook:")?s+=1:t.startsWith("react-hook:")?d+=1:t.startsWith("effect:")?i+=1:t.startsWith("request:")?o+=1:t.startsWith("handler:")||t.startsWith("handler-verb:")?n+=1:t.startsWith("state:")?a+=1:t.startsWith("state-hook:")&&(c+=1);let h=a+c,r=s+d+i+o+n+h;return o>=1&&r>=4||s>=1&&(o>=1||a>=1||n>=2)&&r>=5||a>=1&&n>=2&&(i>=1||d>=2)&&r>=5}function E(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}var P=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]),S=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{V as a};
2
+ //# sourceMappingURL=chunk-56UN3DMK.js.map
@@ -0,0 +1,2 @@
1
+ import{a as C,b as k,c as a,d as m}from"./chunk-QUJBXLBY.js";import{a as V}from"./chunk-PVZMPG5I.js";import{a as B,b}from"./chunk-3UVJJ6Z7.js";import{c as y}from"./chunk-ERHOS6AW.js";function L(e,s={}){let{minSimilarity:h=.45,minSharedBehaviors:o=6,limit:r=20,scope:t,scanLimit:l,filePattern:c}=s,d=y(e,{scope:t,minBehaviorTokens:Math.max(3,o),scanLimit:l}).map(n=>({file:n.file,tokens:n.behaviorTokens,profile:n}));return V({profiles:d,limit:r,filePattern:c,compare:(n,i)=>R(n,i,h,o),sort:(n,i)=>i.similarity-n.similarity||n.fileA.localeCompare(i.fileA)||n.fileB.localeCompare(i.fileB)})}function R(e,s,h,o){let r=B(e.tokens,s.tokens);if(r.size<o||!P(r))return null;let t=k(e.tokens,s.tokens);if(t<h)return null;let l=a(r,"composable:"),c=a(r,"store:"),d=a(r,"reactivity:"),n=a(r,"lifecycle:"),i=a(r,"request:"),f=a(r,"function:"),g=a(r,"function-verb:"),v=a(r,"template-binding:"),p=a(r,"template-event:"),u=T({sharedComposables:l,sharedStores:c,sharedReactivity:d,sharedLifecycle:n,sharedRequests:i,sharedFunctions:f,sharedFunctionVerbs:g,sharedBindings:v,sharedTemplateEvents:p});return{fileA:e.file,fileB:s.file,similarity:t,sharedTokens:m(r),sharedComposables:l,sharedStores:c,sharedReactivity:d,sharedLifecycle:n,sharedRequests:i,sharedFunctions:f,sharedFunctionVerbs:g,sharedBindings:v,sharedTemplateEvents:p,evidenceClass:u.evidenceClass,actionTier:u.actionTier,evidenceClassReasons:u.reasons,recommendation:u.recommendation,uniqueToA:m(b(e.tokens,s.tokens)).slice(0,25),uniqueToB:m(b(s.tokens,e.tokens)).slice(0,25),reason:S({sharedComposables:l,sharedStores:c,sharedRequests:i,sharedLifecycle:n,sharedFunctions:f,sharedFunctionVerbs:g,sharedBindings:v}),locA:e.profile.totalLines,locB:s.profile.totalLines}}function T(e){return C({genericWords:q,primitiveGroups:[{values:e.sharedReactivity,reasonPrefix:"shared reactivity primitive",bucket:"generic"},{values:e.sharedLifecycle,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedComposables,label:"shared composable",fallbackBucket:"shared-abstraction"},{names:e.sharedStores,label:"shared store",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedFunctions,label:"shared function",fallbackBucket:"generic"},{names:e.sharedFunctionVerbs,label:"shared action verb",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"},{names:e.sharedTemplateEvents,label:"shared template event",fallbackBucket:"generic"}],recommendation:F})}function F(e){switch(e){case"domain-behavior":return"Review for a shared composable, store, or feature module around the named domain behavior.";case"mixed":return"Separate generic Vue mechanics from domain-specific behavior before extracting a composable.";case"shared-abstraction":return"Review the existing composable/store usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct composable-extraction evidence."}}function P(e){let s=0,h=0,o=0,r=0,t=0,l=0,c=0;for(let i of e)i.startsWith("composable:")?s+=1:i.startsWith("store:")?h+=1:i.startsWith("request:")?o+=1:i.startsWith("lifecycle:")?r+=1:i.startsWith("function:")?t+=1:i.startsWith("reactivity:")?l+=1:(i.startsWith("function-verb:")||i.startsWith("template-binding:")||i.startsWith("template-event:"))&&(c+=1);let d=s+h,n=d+o+r+t+c;return o>=1&&n>=4||r>=1&&t>=2&&n>=4||d>=2&&(o>=1||t>=2)&&n>=5||t>=2&&l>=1&&n>=4}function S(e){let s=[];return e.sharedComposables.length&&s.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&s.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&s.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&s.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&s.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&s.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&s.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),s.join("; ")||"shared Vue behavior profile"}var q=new Set(["add","apply","cancel","change","clear","close","composable","create","data","delete","draft","edit","error","fetch","filter","form","item","items","load","loading","name","open","reactive","ref","refresh","remove","request","reset","resource","row","rows","save","saving","search","select","selected","store","submit","toggle","update","use","value","watch"]);export{L as a};
2
+ //# sourceMappingURL=chunk-5UDFZC4D.js.map
@@ -1,2 +1,2 @@
1
- import{a as I}from"./chunk-ICXVNWMI.js";import{a as H}from"./chunk-X7ZY6FFF.js";import{a as p}from"./chunk-FIB4JPEX.js";import{a as T}from"./chunk-YQH353VA.js";import{a as G}from"./chunk-3KLLFNT4.js";import{a as k}from"./chunk-EOZIZWW4.js";import{a as v,b as F}from"./chunk-4ZUJJRWT.js";import{b as A}from"./chunk-EYLXU575.js";import{b as P}from"./chunk-KRGBLZT2.js";import{a as j}from"./chunk-ESG4HBEF.js";import{a as S}from"./chunk-CFL2CNIF.js";import{a as D}from"./chunk-Z4VHYJ5U.js";import{a as w}from"./chunk-TM6GVHA6.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?H(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?D(t,e,{semantic:l}):null,f=s?j(t,e,{semantic:l}):null,h=s?k(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,C=s?S(t,e,{maxDepth:o,scope:n.scope}):[],i=w(t,e,{semantic:l}),d=v(t,e),g=F(t,e),u=I(t,e),x=T(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||C.length>0,file:i!==null||d.length>0||g.length>0,module:u.files.length>0||u.symbols.length>0||x.length>0},b=[];!c.symbol&&!c.file&&!c.module&&b.push("No symbol, file, or module matched target.");let B=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:O(t,B),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:C,changeSurface:i,deps:d,rdeps:g,system:u,surface:x,warnings:b}}function O(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=P(t);if(!o)return n;let r=A(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence,subjectContext:l.subjectContext})),suppressionsInFile:G(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
2
- //# sourceMappingURL=chunk-X474LKJX.js.map
1
+ import{a as I}from"./chunk-ICXVNWMI.js";import{a as H}from"./chunk-X7ZY6FFF.js";import{a as p}from"./chunk-FIB4JPEX.js";import{a as T}from"./chunk-YQH353VA.js";import{a as G}from"./chunk-3KLLFNT4.js";import{a as k}from"./chunk-EOZIZWW4.js";import{a as v,b as F}from"./chunk-4ZUJJRWT.js";import{b as D}from"./chunk-EYLXU575.js";import{b as S}from"./chunk-KRGBLZT2.js";import{a as j}from"./chunk-ESG4HBEF.js";import{a as w}from"./chunk-CFL2CNIF.js";import{a as P}from"./chunk-Z4VHYJ5U.js";import{a as A}from"./chunk-TM6GVHA6.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?H(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?P(t,e,{semantic:l}):null,f=s?j(t,e,{semantic:l}):null,h=s?k(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,C=s?w(t,e,{maxDepth:o,scope:n.scope}):[],i=A(t,e,{semantic:l}),d=v(t,e),g=F(t,e),u=I(t,e),x=T(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||C.length>0,file:i!==null||d.length>0||g.length>0,module:u.files.length>0||u.symbols.length>0||x.length>0},b=[];!c.symbol&&!c.file&&!c.module&&b.push("No symbol, file, or module matched target.");let B=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:O(t,B),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:C,changeSurface:i,deps:d,rdeps:g,system:u,surface:x,warnings:b}}function O(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=S(t);if(!o)return n;let r=D(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence,subjectContext:l.subjectContext})),suppressionsInFile:G(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
2
+ //# sourceMappingURL=chunk-6UFMPECA.js.map
@@ -0,0 +1,4 @@
1
+ import{a as te}from"./chunk-NNDYO2DX.js";import{a as ie}from"./chunk-237YUOPK.js";import{a as y}from"./chunk-B32FX5KB.js";import{a as ee}from"./chunk-SPE4YCOT.js";import{a as Q}from"./chunk-ZFMPHDAT.js";import{a as X}from"./chunk-C2QSK7E7.js";import{a as J,b as Z}from"./chunk-UQJGTVHV.js";import{a as W}from"./chunk-G3WGZU5Q.js";import{a as Y}from"./chunk-DE7MA6OD.js";import{a as q}from"./chunk-7KCSELEV.js";import{a as M,c as I,d as P,g as H}from"./chunk-A7RNHUJH.js";import{a as _,b as F,e as z}from"./chunk-AYYIZ4BA.js";import{a as V}from"./chunk-AW4N6MGC.js";import{b as U}from"./chunk-C3MZZ2ZN.js";import{a as A,c as L,d as N,e as B}from"./chunk-EYLXU575.js";import{g as K}from"./chunk-KRGBLZT2.js";import{a as O}from"./chunk-CJJP64OC.js";import{a as E}from"./chunk-3ZYF3ELZ.js";import{f as k,g as T}from"./chunk-ZQLO2SCU.js";import{d as w,e as j}from"./chunk-JM72FNGA.js";import{createHash as Ke}from"crypto";import{existsSync as le}from"fs";function ne(e){let[i,t]=R(e,":"),r=i||"unknown",o=(s={})=>{let n=s.actionTier??fe(r);return{sourceAnalyzer:r,actionTier:n,rootCauseKey:s.rootCauseKey??(t||e),label:s.label??`${r} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??de(n,r),file:s.file}};if(!t)return o({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(r)){let[s,n]=R(t,":");return o({file:s,relatedFiles:s?[s]:[],rootCauseKey:n?`${s}:${n}`:t,label:`${r} finding`,why:n?[`Baseline subject: ${n}.`]:[]})}if(r==="cycle"){let s=t.split(">").filter(Boolean);return o({relatedFiles:s,rootCauseKey:t,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(r==="similar"){let s=t.split("|").filter(Boolean);return o({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(r==="drift"){let[s,n]=R(t,":"),[c,a]=R(n,":");return o({actionTier:s==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,a].filter(Boolean))],rootCauseKey:t,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...a?[`Related dependency: ${a}.`]:[]]})}return o({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function fe(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 de(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function R(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as ue,readFileSync as re}from"fs";var $={classifyCitation:he,citationContexts:ge,citationKindLabel:pe,citationRemediation:ye,referenceTargets:be};function he(e){let i=e.join(`
2
+ `).toLowerCase(),t=[],r=F(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(r.length>0)return t.push(`configuration/example terms near citation: ${r.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:t};let o=F(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return t.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:t};let s=F(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(t.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:t}):(t.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:t})}function ge(e,i,t){let r;try{r=re(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=t.flatMap(me),s=[];for(let n=0;n<r.length;n+=1){let c=r[n]??"";o.some(a=>c.includes(a))&&s.push(_(r,n))}return s}function me(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((t,r,o)=>t.length>0&&o.indexOf(t)===r)}function pe(e){switch(e){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function ye(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function be(e,i,t){let r=M(t),o=new Set;for(let s of i)Ce(e,s,r.get(s)??[])&&o.add(s);return o}function Ce(e,i,t){if(t.length===0)return!1;if(!Se.test(i))return!0;let r=`${e.config.projectRoot}/${i}`;if(!ue(r))return!0;let o=re(r,"utf-8").split(/\r?\n/),s=$e(o);for(let n of t)for(let c=n.startLine;c<=n.endLine;c+=1)if((o[c]??"").trim()!==""&&!s.has(c))return!0;return!1}var Se=/\.(?:[cm]?[jt]sx?)$/i;function $e(e){let i=new Set,t=!1;for(let r=0;r<e.length;r+=1){let o=e[r].trim();!t&&De(o)&&(t=!0),t&&(i.add(r),o.endsWith(";")&&(t=!1))}return i}function De(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}import{existsSync as we,readFileSync as ke,writeFileSync as Te}from"fs";import{isAbsolute as Fe,join as Re}from"path";var ve=75e3,xe=5e3,Ae=2500;function Ge(e){let i=X(e);return i.symbols>=ve||i.documents>=xe?Ae:void 0}var je=".scipquery-baseline.json";function v(e,i){return i&&Fe(i)?i:Re(e.config.projectRoot,i??je)}function oe(e,i={}){let{scope:t}=i,r=Ge(e),o=[],s=U(e,{scope:t,...y.dead,scanLimit:r});for(let n of s.symbols)k(e,n.relativePath)||T(e,n.symbol,n.relativePath)||n.kind==="dead-code"&&o.push(`dead:${n.relativePath}:${n.shortName}`);for(let n of W(e,{scope:t,...y.isolated,scanLimit:r}))k(e,n.relativePath)||T(e,n.symbol,n.relativePath)||o.push(`isolated:${n.relativePath}:${n.shortName}`);for(let n of O(e,{scope:t}))n.kind==="real"&&o.push(`cycle:${Ee(n.path)}`);for(let n of Z(e,{scope:t,...y.similar,scanLimit:r}))o.push(`similar:${[n.symbolA,n.symbolB].sort().join("|")}`);for(let n of q(e,{scope:t,...y.extract,scanLimit:r}))o.push(`extract:${n.relativePath}:${n.shortName}`);for(let n of ee(e,{scope:t,...y.wrappers,scanLimit:r}))o.push(`wrapper:${n.file}:${n.shortName}`);for(let n of Y(e,{scope:t,...y.passthroughs,scanLimit:r}))o.push(`passthrough:${n.file}:${n.shortName}`);for(let n of Q(e,{scope:t,...y.stale,scanLimit:r}))o.push(`stale:${n.file}:${n.shortName}`);for(let n of V(e,{scope:t,...y.drift}).results)n.kind!=="pattern-deviation"&&o.push(`drift:${n.kind}:${n.file}:${n.dep}`);return[...new Set(o)].sort()}function Ee(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function xi(e,i={}){let t=oe(e,{scope:i.scope}),r=v(e,i.path);return Te(r,JSON.stringify({version:1,findings:t},null,2)+`
3
+ `),{path:r,findingCount:t.length}}function se(e,i={}){let t=v(e,i.path);if(!we(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let r=JSON.parse(ke(t,"utf-8")),o=new Set(r.findings??[]),s=oe(e,{scope:i.scope}),n=new Set(s);return{baselinePath:t,baselineCount:o.size,current:s,newFindings:s.filter(c=>!o.has(c)),fixedFindings:[...o].filter(c=>!n.has(c))}}var Vi=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function qi(e,i={}){let t=i.base??"HEAD",{minTogether:r=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:n=Number.POSITIVE_INFINITY,minSimilarity:c=.8}=i,a=new Set(i.skip??[]),f=P(e,{base:t}),g=I(e,{base:t,plan:f}),u=g.changedFiles,d=new Set(u),l=new Set(f.changedFileLines),m=oi(e.config.projectRoot,t,f),h={base:t,changedFiles:u,changedSymbols:g.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:g.summary.note};if(u.length===0)return h;let p=(b,S)=>{if(a.has(b)){h.skipped.push({check:b,reason:"skipped via --skip"});return}S()};return p("echo",()=>Pe(e,g.changedSymbols,d,m,s,c,h)),p("incomplete-migration",()=>Ye(e,t,f,n,h)),p("co-change-partner",()=>Je(e,d,r,o,h)),p("doc-reference",()=>ii(e,d,l,f.changedRanges,h)),p("unused-params",()=>ti(e,u,h)),p("new-dead",()=>ni(e,g.changedSymbols,m,h)),p("baseline",()=>ci(e,h)),Me(h,e.config.suppressions??[]),h.rootCauseGroups=Le(h.findings),h}function Le(e){let i=new Map;for(let t of e){let r=t.groupKey??`${t.check}:${t.id}`,o=i.get(r);o||(o={groupKey:r,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(r,o)),o.count+=1,o.findingIds.push(t.id),o.severity=Ne(o.severity,t.severity),o.actionTier=Be(o.actionTier,t.actionTier),t.file&&o.files.add(t.file);for(let s of t.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,r)=>r.count-t.count||x(r.severity)-x(t.severity)||t.groupKey.localeCompare(r.groupKey))}function Ne(e,i){return x(i)>x(e)?i:e}function x(e){return e==="error"?2:e==="warning"?1:0}function Be(e,i){return e?i&&ae(i)>ae(e)?i:e:i}function ae(e){return e==="direct"?2:e==="signal"?1:0}function Me(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let r of e.findings){let o=i.find(s=>Ie(s,r));o?e.suppressed.push({finding:r,suppression:o}):t.push(r)}e.findings=t}function Ie(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function D(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function Pe(e,i,t,r,o,s,n){n.checksRun.push("echo");for(let c of i.slice(0,o)){if(r(c))continue;let a=J(e,c.symbol,{minSimilarity:s,limit:5}),f=[];for(let l of a){let m=l.fileA===c.file?l.fileB:l.fileA,h=l.fileA===c.file?l.shortNameB:l.shortNameA,p=l.fileA===c.file?l.symbolB:l.symbolA;t.has(m)||f.push({otherFile:m,otherShort:h,otherSymbol:p,similarity:l.similarity,similarityBasis:l.similarityBasis??"callees",sharedEvidence:l.sharedCallees})}if(f.length===0)continue;let g=f[0],u=C("echo",c.symbol,c.file,...f.map(l=>`${l.otherSymbol}|${l.otherFile}`).sort()),d=He(c,f);D(n,{id:u,groupKey:u,actionTier:d,check:"echo",severity:"warning",evidence:"heuristic",confidence:g.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(f.map(l=>l.otherFile))].sort(),message:Ve(c,f),why:qe(c,f),remediation:We(d,c.shortName,g.otherShort)})}i.length>o&&n.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function He(e,i){return i.some(r=>_e(e.symbol,r))?"direct":"signal"}function _e(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=w(e),r=w(i.otherSymbol);return!t||!r?!1:t===r?!0:Ue(i.sharedEvidence)?!1:ze(t,r)}function ze(e,i){let t=ce(e),r=ce(i);if(t.length===0||r.length===0)return!1;let o=new Set(r),s=t.filter(n=>o.has(n)).length;return s>=2&&s/Math.min(t.length,r.length)>=.5}function ce(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var Oe=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function Ue(e){return e.length>=3&&e.every(i=>Oe.has(i.toLowerCase()))}function Ve(e,i){let t=i[0],r=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${r}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${r}% similar to ${t.otherShort} (${t.otherFile})`}function qe(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let r of i.slice(0,3))t.push(`${r.otherShort} is outside this diff and scored ${Math.round(r.similarity*100)}% similar by ${r.similarityBasis} evidence.`),t.push(`Shared evidence: ${r.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function We(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function Ye(e,i,t,r,o){let s=ie(e,{base:i,maxHelpers:r,diffPlan:t});if(!s.available){o.skipped.push({check:"incomplete-migration",reason:"no git history"});return}o.checksRun.push("incomplete-migration"),s.note&&o.skipped.push({check:"incomplete-migration",reason:s.note});for(let n of s.findings){let c=n.leftovers.map(l=>`${l.shortName} (${l.file}, ${Math.round(l.containment*100)}% helper / ${Math.round(l.siteCoverage*100)}% site, ${l.migrationScope})`).join(", "),a=n.leftovers.map(l=>`${l.shortName}: ${l.migrationScope} (${l.migrationScopeReasons[0]})`).join("; "),f=[...n.migratedFiles,...n.leftovers.map(l=>l.file)],g=n.leftovers.length===0?void 0:Math.max(...n.leftovers.map(l=>Math.min(l.containment,l.siteCoverage))),u=n.leftovers.some(l=>l.migrationScope==="possible-subtype"),d=C("incomplete-migration",n.helperSymbol,n.helperFile,f.join("|"));D(o,{id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:g,file:n.helperFile,symbol:n.helperSymbol,relatedFiles:f,message:`new helper ${n.helperShortName} (${n.helperFile}) is wired into ${n.migratedFiles.length} file(s), but ${n.leftovers.length} similar un-migrated site(s) remain: ${c}`,why:[`${n.helperShortName} is new in this diff and already referenced by ${n.migratedFiles.join(", ")}.`,`Helper shape: ${n.helperShape}; ${n.specificHelperCalleeCount}/${n.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${c}.`,`Migration scope hints: ${a}.`],remediation:u?`Migrate same-scope sites to ${n.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${n.helperShortName}, or confirm they are intentionally different.`})}}function Je(e,i,t,r,o){let s=K(e,i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let n=new Set,c;for(let a of s){let f=i.has(a.fileA),g=i.has(a.fileB);if(f===g)continue;let u=f?a.fileA:a.fileB,d=f?a.fileB:a.fileA,l=f?a.changesA:a.changesB,m=l>0?a.together/l:0;if(m<r||A(d)||A(u)||!le(`${e.config.projectRoot}/${d}`))continue;let h=`${u}|${d}`;if(n.has(h))continue;n.add(h);let p=C("co-change-partner",u,d,String(a.together)),b=L(u,d),S=N({fileA:u,fileB:d,together:a.together,confidence:m,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,(c??=B(e))(u,d)),G=[u,d].sort().join("|");o.findings.push({id:p,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${G}`,confidence:m,file:u,relatedFiles:[d],sourceAnalyzer:"co-change",rootCauseKey:G,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...S?{declaredCouplingSuggestion:S}:{},message:`${u} changed, but ${d} did not \u2014 they change together ${a.together}x (${Math.round(m*100)}% of the time)`,why:[`${u} is in this diff and ${d} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${Ze(a)}.`,`Subject context: ${Qe(a.subjectContext)}.`,...Xe(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:S?`Update ${d} alongside this change, declare the coupling "${S.name}", or confirm the coupling no longer holds.`:`Update ${d} alongside this change, or confirm the coupling no longer holds.`})}}function Ze(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${ei(e.lastTogetherAt)}`}function Qe(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",r=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${r}; external issue/PR labels ${e.externalIssueLabelStatus}`}function Xe(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function ei(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function ii(e,i,t,r,o){o.checksRun.push("doc-reference");let s=$.referenceTargets(e,i,r);if(s.size!==0)for(let n of z(e,s)){if(t.has(n.doc))continue;let c=n.citedClaims.length>0?n.citedClaims:$.citationContexts(e,n.doc,n.cited),a=$.classifyCitation(c),f=C("doc-reference",n.doc,n.cited.join("|"));D(o,{id:f,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:n.doc,relatedFiles:n.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:c,message:`${n.doc} cites ${n.cited.join(", ")} as ${$.citationKindLabel(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${n.cited.join(", ")} changed in this diff.`,`${n.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(g=>`Citation kind evidence: ${g}`)],remediation:$.citationRemediation(a.citationKind,n.doc)})}}function ti(e,i,t){t.checksRun.push("unused-params");for(let r of te(e,{files:i,limit:50})){let o=C("unused-params",r.symbol,r.file,r.unusedTrailing.join("|"));D(t,{id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:r.file,startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,message:`${r.shortName} (${r.file}) has trailing unused parameter(s): ${r.unusedTrailing.join(", ")}`,why:[`${r.shortName} is in a changed file.`,`The trailing parameter(s) ${r.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function ni(e,i,t,r){r.checksRun.push("new-dead");let o=new E(e);for(let s of i){if(t(s)||s.fanIn>0||o.fileKind(s.file)==="test"||k(e,s.file)||T(e,s.symbol,s.file)||ri(s.symbol))continue;let n=C("new-dead",s.symbol,s.file);D(r,{id:n,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.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:"Wire it up, or remove it before it becomes permanent dead code."})}}function ri(e){if(j(e)!=="type")return!1;let i=w(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function oi(e,i,t){let r=new Map(t.renamedFiles.map(s=>[s.to,s.from])),o=new Map;return s=>{let n=r.get(s.file)??s.file,c=w(s.symbol);if(!c)return!1;let a=o.get(n);return a===void 0&&(a=H(e,i,n),o.set(n,a)),a!==null&&si(a,c)}}function si(e,i){return new RegExp(`\\b${ai(i)}\\b`).test(e)}function ai(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ci(e,i){if(!le(v(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=se(e);for(let r of t.newFindings){let o=ne(r),s=C("baseline",r);D(i,{id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${r}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation})}}function C(e,...i){return`SQ${Ke("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{oe as a,xi as b,se as c,Vi as d,qi as e,oi as f};
4
+ //# sourceMappingURL=chunk-7JOTOWZO.js.map
@@ -0,0 +1,20 @@
1
+ import{a as S}from"./chunk-3ZYF3ELZ.js";import{e as b}from"./chunk-FUPDW5AC.js";import{c as h,f as p,h as y}from"./chunk-JM72FNGA.js";import{execFileSync as d}from"child_process";import{existsSync as N,readFileSync as v}from"fs";import{basename as R}from"path";function C(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=[],n.set(t.file,i)),i.push(t)}return n}var P="Unable to compute git diff.";function fe(e,n={}){let t=n.plan??E(e,n);return t.note?O(t.note,t.changedFileLines):t.changedFiles.length===0?$(t.changedFileLines):A(t.changedFiles,[T(e,t.changedFiles,t.changedFiles,t.changedRanges)])}function E(e,n={}){let{base:t="HEAD"}=n;try{let i=k(e.config.projectRoot,t),r=G(e,i),s=Y(e,z(e.config.projectRoot,t));return{changedFileLines:i,changedFiles:r,changedRanges:s,renamedFiles:W(e.config.projectRoot,t,r),note:i.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:P}}}function T(e,n,t,i=[]){let r=new S(e),s=new Set(t),a=C(i),l=[],m=new Map,f=n.flatMap(o=>r.definitionsForFile(o)).filter(ee).filter(o=>V(o,a)).sort((o,u)=>o.relativePath.localeCompare(u.relativePath)||o.startLine-u.startLine),c=f.map(o=>o.symbolId),g=K(e,c),x=Q(e,c,t),M=b(e,f.filter(o=>g.get(o.symbolId)===0));for(let o of f)j(e,o,s,l,m,M.get(o.symbolId)??new Set,g.get(o.symbolId)??0,x.get(o.symbolId)??new Set);return{changedSymbols:l,consumerEntries:[...m.entries()].map(([o,u])=>({file:o,symbols:[...u].sort()}))}}function A(e,n){let t=new Map,i=n.flatMap(s=>s.changedSymbols);for(let s of n)for(let a of s.consumerEntries){let l=t.get(a.file);l||(l=new Set,t.set(a.file,l));for(let m of a.symbols)l.add(m)}let r=X(t);return{changedFiles:[...e],changedSymbols:i,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:i.length,totalAffectedFiles:r.length}}}function O(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function $(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function k(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4}),r=d("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([t,i,r].flatMap(s=>s.split(`
2
+ `)).map(s=>s.trim()).filter(s=>s.length>0))]}function z(e,n){let t=d("git",["diff","--unified=0",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--unified=0","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return w([...D(t),...D(i)])}function B(e,n,t){try{return d("git",["show",`${n}:./${t}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function W(e,n,t){if(t.length===0)return[];let i=new Map,r=new Set;for(let a of H(e,n))t.includes(a.to)&&(i.set(a.to,a),r.add(a.from));let s=U(e,n);if(s.length===0)return[...i.values()].sort((a,l)=>a.to.localeCompare(l.to));for(let a of t){if(i.has(a)||!N(`${e}/${a}`))continue;let l=s.filter(c=>!r.has(c)).filter(c=>R(c)===R(a));if(l.length===0)continue;let m=v(`${e}/${a}`,"utf-8"),f=l.map(c=>({from:c,to:a,similarity:J(B(e,n,c)??"",m)})).sort((c,g)=>g.similarity-c.similarity)[0];f&&f.similarity>=.45&&(i.set(a,f),r.add(f.from))}return[...i.values()].sort((a,l)=>a.to.localeCompare(l.to))}function U(e,n){let t=d("git",["diff","--name-only","--diff-filter=D",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-only","--diff-filter=D","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([...F(t),...F(i)])]}function H(e,n){let t=d("git",["diff","--name-status","--find-renames",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-status","--find-renames","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return[...t.split(`
3
+ `),...i.split(`
4
+ `)].map(r=>r.trim()).filter(r=>r.startsWith("R")).map(r=>r.split(" ")).filter(r=>r.length>=3).map(([r,s,a])=>({from:s,to:a,similarity:Number(r.slice(1))/100}))}function J(e,n){let t=new Set(I(e)),i=new Set(I(n));if(t.size===0&&i.size===0)return 1;if(t.size===0||i.size===0)return 0;let r=0;for(let s of t)i.has(s)&&(r+=1);return 2*r/(t.size+i.size)}function I(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function F(e){return e.split(`
5
+ `).map(n=>n.trim()).filter(n=>n.length>0)}function G(e,n){let t=_(e),i=[];for(let r of n){let s=t(r);s&&!e.isIgnored(s)&&i.push(s)}return i}function Y(e,n){let t=_(e),i=[];for(let r of n){let s=t(r.file);s&&!e.isIgnored(s)&&i.push({...r,file:s})}return w(i)}function _(e){let n=e.all(`SELECT relative_path FROM documents
6
+ ORDER BY id`).map(i=>i.relative_path),t=new Map(n.map(i=>[i,i]));return i=>{let r=i.replace(/\\/g,"/"),s=t.get(r);return s||(n.find(a=>a.endsWith(r))??null)}}function D(e){let n=[],t=null;for(let i of e.split(`
7
+ `)){if(i.startsWith("+++ ")){t=q(i.slice(4).trim());continue}if(!t||!i.startsWith("@@ "))continue;let r=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(i);if(!r)continue;let s=Math.max(0,Number(r[1])-1),a=r[2]===void 0?1:Number(r[2]);n.push({file:t,startLine:s,endLine:Math.max(s,s+Math.max(a,1)-1)})}return n}function q(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function w(e){let n=new Set,t=[];for(let i of e){let r=`${i.file}:${i.startLine}:${i.endLine}`;n.has(r)||(n.add(r),t.push(i))}return t}function V(e,n){let t=n.get(e.relativePath);return!t||t.length===0?!0:t.some(i=>Z(e.startLine,e.endLine,i.startLine,i.endLine))}function Z(e,n,t,i){return e<=i&&t<=n}function j(e,n,t,i,r,s,a,l){let m=Math.max(a,s.size);if(!ne(n,m))return;let f=h(n.symbol);i.push({symbol:n.symbol,shortName:f,file:n.relativePath,startLine:n.startLine,endLine:n.endLine,fanIn:m});for(let c of l)L(e,t,r,c,f);for(let c of s)L(e,t,r,c,f)}function K(e,n){if(n.length===0)return new Map;let t=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
8
+ FROM mentions m
9
+ JOIN chunks c ON m.chunk_id = c.id
10
+ WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
11
+ AND m.role != 1
12
+ GROUP BY m.symbol_id`,...n);return new Map(t.map(i=>[i.symbol_id,i.fan_in]))}function Q(e,n,t){if(n.length===0||t.length===0)return new Map;let i=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
13
+ FROM mentions m
14
+ JOIN chunks c ON m.chunk_id = c.id
15
+ JOIN documents ref_d ON c.document_id = ref_d.id
16
+ WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
17
+ AND m.role != 1
18
+ AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
19
+ ${e.pathExclusionsFor("ref_d")}`,...n,...t),r=new Map;for(let s of i){let a=r.get(s.symbol_id);a||(a=new Set,r.set(s.symbol_id,a)),a.add(s.relative_path)}return r}function L(e,n,t,i,r){if(e.isIgnored(i)||n.has(i))return;let s=t.get(i);s||(s=new Set,t.set(i,s)),s.add(r)}function X(e){return[...e.entries()].map(([n,t])=>({file:n,consumedSymbols:t.size})).sort((n,t)=>t.consumedSymbols-n.consumedSymbols)}function ee(e){return!(y(e.symbol)||e.parentTypeName!==null&&!p(e.symbol))}function ne(e,n){return p(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{C as a,P as b,fe as c,E as d,T as e,A as f,B as g};
20
+ //# sourceMappingURL=chunk-A7RNHUJH.js.map
@@ -0,0 +1,4 @@
1
+ import{a as O,d as I}from"./chunk-KRGBLZT2.js";import{b as v,c as N,d as E}from"./chunk-A4L36SZS.js";import{existsSync as X,readFileSync as M}from"fs";import{join as D}from"path";function L(t,n){let e=$(t,n)??W(t,n)??G(t,n)??Z(t,n);return J(t,e,n)}function $(t,n){let e=-1,i=null;for(let o=0;o<=n;o+=1){let r=x(t[o]??"");r&&(i===null?(i=r,e=o):r===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let o=n+1;o<t.length;o+=1)if(x(t[o]??"")===i)return{start:e,end:o+1};return{start:e,end:t.length}}function x(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function W(t,n){if(!T(t[n]??""))return null;let e=n;for(;e>0&&T(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&T(t[i]??"");)i+=1;return{start:e,end:i}}function T(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function G(t,n){let e=n;for(;e>=0;){let r=t[e]??"";if(y(r)!==null)break;if(k(r)!==null)return null;e-=1}if(e<0)return null;let i=y(t[e]??"");if(i===null)return null;let o=e+1;for(;o<t.length;){let r=t[o]??"",s=y(r);if(s!==null){if(s<=i)break;o+=1;continue}if(k(r)!==null)break;o+=1}return{start:e,end:o}}function y(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function Z(t,n){let e=t[n]??"";if(F(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&j(t[i-1]??"");)i-=1;let o=n+1;for(;o<t.length&&j(t[o]??"");)o+=1;return{start:i,end:o}}function j(t){return k(t)===null}function k(t){return t.trim().length===0?"blank":F(t)?"heading":x(t)?"fence":T(t)?"table":y(t)!==null?"list":null}function F(t){return/^#{1,6}\s+/.test(t.trim())}function J(t,n,e){let{start:i,end:o}=n;if(o-i>40){let s=Math.floor(20);i=Math.max(i,e-s),o=Math.min(o,i+40),i=Math.max(n.start,o-40)}let r=t.slice(i,o).join(`
2
+ `).trim();return r.length<=2e3?r:`${r.slice(0,2e3).trimEnd()}...`}function w(t,n){return n.filter(e=>t.includes(e))}var p=/\.(?:md|mdx|rst|txt)$/i;function q(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var K=3,H=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function ft(t,n={}){let{doc:e,limit:i=20,minCoupling:o=K}=n,r=Y(t);if(!r)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let s=[];for(let c of r.docFiles){if(e!==void 0&&!c.includes(e)||e===void 0&&!z(t,c)||e!==void 0&&!X(D(t.config.projectRoot,c)))continue;let d=Math.max(0,...r.changeTimes.get(c)??[]),g=Q(t,c),l=new Map,{resolved:a,broken:u,citations:m}=P(t,c,r.tracked,r.trackedBySuffix,r.everSeenInHistory),S=new Map(m.map(f=>[f.file,f.contexts]));for(let f of a){if(f===c||p.test(f))continue;let h=(r.changeTimes.get(f)??[]).filter(b=>b>d).length;h!==0&&l.set(f,{file:f,evidence:"reference",coChanges:0,changesSinceDocUpdate:h,...A("reference",g),citationContexts:S.get(f)})}for(let[f,h]of r.coupling.get(c)??[]){if(h<o||!r.tracked.has(f))continue;let b=(r.changeTimes.get(f)??[]).filter(U=>U>d).length;if(b===0)continue;let C=l.get(f);C?(C.evidence="both",C.coChanges=h,Object.assign(C,A("both",g))):l.set(f,{file:f,evidence:"co-change",coChanges:h,changesSinceDocUpdate:b,...A("co-change",g)})}if(l.size===0&&u.length===0)continue;let _=[...l.values()].sort((f,h)=>h.changesSinceDocUpdate-f.changesSinceDocUpdate);s.push({doc:c,docLastChangedAt:d,staleness:_.reduce((f,h)=>f+h.changesSinceDocUpdate,0)+u.length*10,subjects:_.slice(0,8),brokenReferences:u})}return s.sort((c,d)=>d.staleness-c.staleness),{available:!0,commitsAnalyzed:r.historyCommitCount,docsScanned:r.docFiles.length,findings:s.slice(0,i)}}function Q(t,n){let e;try{e=M(D(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
3
+ ${e}`.toLowerCase(),o=w(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(o.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${o.join(", ")}`]};let r=w(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return r.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${r.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function A(t,n){return{actionTier:V(t,n.docIntent),docIntent:n.docIntent,docIntentReasons:n.reasons}}function V(t,n){return n==="historical-note"?"support":t==="co-change"?"signal":"direct"}function Y(t){let n=O(t);if(!n)return null;let e=I(t)??new Set,i=new Map,o=new Map,r=new Set;for(let s of n.commits){let c=[...new Set(s.files)],d=c.filter(l=>p.test(l)),g=c.filter(l=>!p.test(l));for(let l of c){r.add(l);let a=i.get(l)??[];a.push(s.timestamp),i.set(l,a)}for(let l of d){let a=o.get(l);a||(a=new Map,o.set(l,a));for(let u of g)a.set(u,(a.get(u)??0)+1)}}return{changeTimes:i,coupling:o,docFiles:[...e].filter(s=>p.test(s)),everSeenInHistory:r,historyCommitCount:n.commits.length,tracked:e,trackedBySuffix:B(e)}}function gt(t,n){let e=I(t)??new Set,i=B(e),o=[];for(let r of e){if(!z(t,r))continue;let{resolved:s,citations:c}=P(t,r,e,i,new Set),d=[...s].filter(g=>n.has(g));if(d.length>0){let g=d.sort(),l=new Set(g),a=c.filter(u=>l.has(u.file));o.push({doc:r,cited:g,citations:a,citedClaims:R(a.flatMap(u=>u.contexts)).slice(0,3)})}}return o}function z(t,n){return p.test(n)&&!q(n)&&X(D(t.config.projectRoot,n))}function B(t){let n=new Map;for(let e of t){let i=e.split("/");for(let o of[2,3]){if(i.length<o)continue;let r=i.slice(-o).join("/"),s=n.get(r)??[];s.push(e),n.set(r,s)}}return n}function P(t,n,e,i,o){let r=new Set,s=new Set,c=et(t,n);if(!c)return{resolved:r,broken:[],citations:[]};let d=tt(t,n,c),g=new Map,l=(a,u)=>{let m=d.get(u);if(!m||m.length===0)return;let S=g.get(a)??[];S.push(...m),g.set(a,R(S).slice(0,3))};for(let a of c){if(e.has(a)){r.add(a),l(a,a);continue}let u=i.get(a);if(u&&u.length===1){r.add(u[0]),l(u[0],a);continue}u&&u.length>1||o.has(a)&&s.add(a)}return{resolved:r,broken:[...s],citations:[...g].map(([a,u])=>({file:a,contexts:u}))}}function tt(t,n,e){let i;try{i=M(D(t.config.projectRoot,n),"utf-8").split(/\r?\n/)}catch{return new Map}let o=new Set(e),r=new Map;for(let s=0;s<i.length;s+=1){let c=i[s]??"";for(let d of c.matchAll(H)){let g=d[0].replace(/^\.?\//,"");if(!o.has(g))continue;let l=L(i,s);if(l.length===0)continue;let a=r.get(g)??[];a.push(l),r.set(g,R(a).slice(0,3))}}return r}function R(t){let n=[];for(let e of new Set(t))n.some(i=>nt(i,e))||n.push(e);return n}function nt(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),i=n.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),o=Math.min(e.length,i.length);if(o===0)return!1;if(o<3)return t.includes(n)||n.includes(t);let r=new Set(i),s=e.filter(c=>r.has(c)).length;return s>=3&&s/o>=.6}function et(t,n){let e;try{e=M(D(t.config.projectRoot,n),"utf-8")}catch{return null}let i=v(t,n,e),o=N(t,"doc-path-tokens",n,i);if(o!==null)try{return JSON.parse(o)}catch{}let r=[...new Set([...e.matchAll(H)].map(s=>s[0].replace(/^\.?\//,"")))];return E(t,"doc-path-tokens",n,i,JSON.stringify(r)),r}export{L as a,w as b,q as c,ft as d,gt as e};
4
+ //# sourceMappingURL=chunk-AYYIZ4BA.js.map
@@ -0,0 +1,2 @@
1
+ import{c as o,d as a}from"./chunk-QUJBXLBY.js";import{a as p}from"./chunk-PVZMPG5I.js";import{a as c,b as m,c as f}from"./chunk-3UVJJ6Z7.js";import{c as u}from"./chunk-ERHOS6AW.js";function D(n,i={}){let{minSimilarity:t=.62,minTokens:e=8,limit:l=20,scope:d,scanLimit:h,filePattern:k}=i,P=g(n,{scope:d,minTokens:e,scanLimit:h});return p({profiles:P,limit:l,filePattern:k,compare:(r,s)=>v(r,s,t),sort:(r,s)=>s.similarity-r.similarity||r.fileA.localeCompare(s.fileA)||r.fileB.localeCompare(s.fileB)})}function g(n,i){return u(n,{scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(t=>({file:t.file,tokens:t.templateTokens,loc:C(t)}))}function C(n){return n.totalLines}function v(n,i,t){let e=c(n.tokens,i.tokens);if(e.size<6||!T(e))return null;let l=f(n.tokens,i.tokens);return l<t?null:{fileA:n.file,fileB:i.file,similarity:l,sharedTokens:a(e),sharedComponents:o(e,"component:"),sharedProps:o(e,"prop:"),sharedEvents:o(e,"event:"),sharedDirectives:o(e,"directive:"),sharedSlots:o(e,"slot:"),sharedIdentifiers:o(e,"id:"),uniqueToA:a(m(n.tokens,i.tokens)).slice(0,25),uniqueToB:a(m(i.tokens,n.tokens)).slice(0,25),locA:n.loc,locB:i.loc}}function T(n){let i=0,t=0;for(let e of n)e.startsWith("component:")&&(i+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("directive:")||e.startsWith("slot:"))&&(t+=1);return i>=1||t>=3}export{D as a};
2
+ //# sourceMappingURL=chunk-BNKE4TT5.js.map
@@ -0,0 +1,2 @@
1
+ import{a as D}from"./chunk-5UDFZC4D.js";import{a as g}from"./chunk-BNKE4TT5.js";import{a as y}from"./chunk-WBJZNPUT.js";import{a as f}from"./chunk-56UN3DMK.js";import{b as h}from"./chunk-UQJGTVHV.js";import{e as p}from"./chunk-KRGBLZT2.js";var v=.7,S=.62,C=.45;function j(i,t={}){let{windowCommits:e=100,limit:n=30,scope:o,scanLimit:a}=t,s=p(i);if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let d=F(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:a,scope:o,semantic:t.semantic}).map(r=>x(r,s,e)).filter(r=>r!==null);d.sort((r,c)=>(r.kind===c.kind?0:r.kind==="echo"?-1:1)||c.similarity-r.similarity||r.echoFile.localeCompare(c.echoFile)||r.echoSymbol.localeCompare(c.echoSymbol)||r.domain.localeCompare(c.domain));let b=d.slice(0,n).map(I);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:w(b)}}function F(i,t){let e=N(t.limit);return[...A(i,{scope:t.scope,minSimilarity:t.minSimilarity??v,limit:e,scanLimit:t.scanLimit,semantic:t.semantic}),...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit})]}function A(i,t){return h(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function B(i,t){return u(i,t,{query:y,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:K(...e.evidenceBuckets(n)),sharedCallees:[]}))}function k(i,t){return u(i,t,{query:f,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}function L(i,t){return u(i,t,{query:g,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function E(i,t){return u(i,t,{query:D,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function x(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,o=t.get(i.fileB)?.commitsAgo??null,a=n!==null&&n<=e,s=o!==null&&o<=e;if(!a&&!s)return null;if(a&&s){let l=(n??0)<=(o??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:o)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?o:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:a?i.symbolA:i.symbolB,echoFile:a?i.fileA:i.fileB,echoAgeCommits:(a?n:o)??0,establishedSymbol:a?i.symbolB:i.symbolA,establishedFile:a?i.fileB:i.fileA,establishedAgeCommits:a?o:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function I(i){let t=R(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function R(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function w(i){let t=new Map;for(let[e,n]of i.entries()){let o=n.rootCauseKey??R(n),a=n.groupKey??`recent-duplicate:${o}`,s=t.get(a);s||(s={groupKey:a,rootCauseKey:o,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:T(n)},t.set(a,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let l of n.sharedEvidence)s.sharedEvidence.add(l)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function T(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function N(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function K(...i){let t=[],e=new Set;for(let[n,o]of i)for(let a of o){let s=`${n}:${a}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{j as a};
2
+ //# sourceMappingURL=chunk-MA7OVFHI.js.map
@@ -0,0 +1,2 @@
1
+ import{a as l,c as g}from"./chunk-3UVJJ6Z7.js";function v(e){let n=[],r=[],i=[];for(let o of e.primitiveGroups)o.values.length!==0&&h(o.bucket,r,i).push(`${o.reasonPrefix}: ${o.values.join(", ")}`);for(let o of e.nameGroups)u(o.names,o.label,e.genericWords,e.stripPrefixes??[],n,h(o.fallbackBucket,r,i));let c=n.length>0,d=r.length>0,s=i.length>0,t=c?d||s?"mixed":"domain-behavior":s?"shared-abstraction":"generic-workflow-scaffolding";return{actionTier:t==="domain-behavior"||t==="mixed"?"signal":"support",evidenceClass:t,reasons:[...n,...i,...r].slice(0,6),recommendation:e.recommendation(t)}}function x(e,n){if(e.size===0||n.size===0)return 0;let i=l(e,n).size/Math.min(e.size,n.size);return Math.max(g(e,n),i)}function y(e,n){return[...e].filter(r=>r.startsWith(n)).map(r=>r.slice(n.length)).sort()}function b(e){return[...e].sort()}function u(e,n,r,i,c,d){let s=[],t=[];for(let a of e)m(a,i).filter(f=>!r.has(f)).length>0?s.push(a):t.push(a);s.length&&c.push(`${n} has domain term(s): ${s.slice(0,6).join(", ")}`),t.length&&d.push(`${n} is generic workflow: ${t.slice(0,6).join(", ")}`)}function m(e,n){let r=e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2");for(let i of n)r=r.replace(i,"");return r.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function h(e,n,r){return e==="generic"?n:r}export{v as a,x as b,y as c,b as d};
2
+ //# sourceMappingURL=chunk-QUJBXLBY.js.map
@@ -0,0 +1,2 @@
1
+ import{c as s,d as l}from"./chunk-QUJBXLBY.js";import{a as u}from"./chunk-PVZMPG5I.js";import{a as p,b as m,c as f}from"./chunk-3UVJJ6Z7.js";import{e as c}from"./chunk-EWC3UK4V.js";function A(i,t={}){let{minSimilarity:r=.62,minTokens:e=8,limit:a=20,scope:d,scanLimit:g,filePattern:h}=t,k=c(i,{scope:d,minJsxTokens:e,scanLimit:g}).filter(n=>n.kind==="component").map(n=>({file:n.file,component:n.name,tokens:n.jsxTokens,profile:n}));return u({profiles:k,limit:a,filePattern:h,compare:(n,o)=>P(n,o,r),sort:(n,o)=>o.similarity-n.similarity||n.fileA.localeCompare(o.fileA)||n.componentA.localeCompare(o.componentA)||n.fileB.localeCompare(o.fileB)||n.componentB.localeCompare(o.componentB)})}function P(i,t,r){let e=p(i.tokens,t.tokens);if(e.size<6||!B(e))return null;let a=f(i.tokens,t.tokens);return a<r?null:{fileA:i.file,componentA:i.component,fileB:t.file,componentB:t.component,similarity:a,sharedTokens:l(e),sharedComponents:s(e,"component:"),sharedNativeTags:s(e,"native:"),sharedProps:s(e,"prop:"),sharedEvents:s(e,"event:"),sharedBindings:s(e,"binding:"),uniqueToA:l(m(i.tokens,t.tokens)).slice(0,25),uniqueToB:l(m(t.tokens,i.tokens)).slice(0,25),locA:i.profile.loc,locB:t.profile.loc}}function B(i){let t=0,r=0;for(let e of i)e.startsWith("component:")&&(t+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("native:")||e.startsWith("jsx:"))&&(r+=1);return t>=1||r>=4}export{A as a};
2
+ //# sourceMappingURL=chunk-WBJZNPUT.js.map
@@ -1,2 +1,2 @@
1
- import{a as oe}from"./chunk-O3OKSF6O.js";import{a as ne}from"./chunk-3KLLFNT4.js";import{a as te}from"./chunk-QSXQT3NE.js";import{a as ie}from"./chunk-O4L4AB3T.js";import{a as re}from"./chunk-GS33KGAY.js";import{a as Z}from"./chunk-UMNENNTX.js";import{a as ee}from"./chunk-TO54DY4O.js";import{a as p}from"./chunk-B32FX5KB.js";import{a as K}from"./chunk-SPE4YCOT.js";import{a as Q}from"./chunk-ZFMPHDAT.js";import{a as J}from"./chunk-C2QSK7E7.js";import{b as X}from"./chunk-UQJGTVHV.js";import{a as G}from"./chunk-G3WGZU5Q.js";import{a as Y}from"./chunk-DE7MA6OD.js";import{a as j}from"./chunk-7KCSELEV.js";import{a as q}from"./chunk-AW4N6MGC.js";import{a as T,b as I}from"./chunk-C3MZZ2ZN.js";import{b as O}from"./chunk-EYLXU575.js";import{b as z,c as N}from"./chunk-KRGBLZT2.js";import{a as U}from"./chunk-DAI74TJU.js";import{a as W}from"./chunk-CJJP64OC.js";import{f as A,g as k}from"./chunk-ZQLO2SCU.js";function m(e){return e.scoreCount??e.count}function M(e){let r=Me(e),{breakdown:t,pressure:i}=Be(e),o=se(t,"risk"),n=se(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,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:m(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:m(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:m(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},axes:Ae(e),validation:Te(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function Ae(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:ke(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+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 ke(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:l(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function Te(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.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,a=0;for(let[b,g]of Object.entries(r))i.has(b)?o+=g.fixChanges:(n+=g.fixChanges,a+=1);let d=i.size>0?l(o/i.size):0,h=a>0?l(n/a):0,S={};for(let[b,g]of Object.entries(t)){let f=new Set(g);if(f.size===0)continue;let H=0;for(let L of f)H+=r[L]?.fixChanges??0;let x=l(H/f.size);S[b]={flaggedFiles:f.size,fixDensity:x,lift:h>0?l(x/h):null}}return{flaggedFiles:i.size,flaggedFixDensity:d,baselineFixDensity:h,ratio:i.size>0&&h>0?l(d/h):null,byCategory:S}}function l(e){return Math.round(e*100)/100}function ce(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function P(e,r="existing shared infrastructure discount"){let t=m(e);return Math.abs(t-e.count)<.01?"":` (${ce(t)} score-weighted after ${r})`}function v(e,r){let t=m(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${ce(t)} score-weighted)`}function Me(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 \u2014 safe to delete`,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.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${P(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${P(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${P(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.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`+P({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 a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var ae={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"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","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 se(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 Be(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(u,y,C)=>{y>0&&i.push({axis:u,points:y,detail:C,kind:ae[u]??"hygiene"})},a=(u,y,C,we,Pe,Re,De)=>{let w=Math.max(we,1);if(C<=w)return;let D=C/w,E=Math.min(Pe,Math.ceil(Math.log2(D)*Re));if(E<=0)return;let Ee=ae[u]??"hygiene";o.push({axis:u,category:y,kind:Ee,count:C,threshold:l(w),ratio:l(D),extraPenalty:E}),n(u,E,`${C} ${De} exceed pressure threshold ${l(w)} (${l(D)}x)`)},d=e.dead.count/t;n("dead-code",Math.min(20,Math.round(d*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let h=e.isolated.count/t;n("isolated",Math.min(10,Math.round(h*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 S=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(S)),`${e.similarCount} similar function pair(s)`);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 g=m(e.reactHookCandidates),f=g/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(f)),v(e.reactHookCandidates,"duplicated React behavior pair(s)"));let H=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(H/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let x=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(x)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let L=m(e.vueComposableCandidates),xe=L/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(xe)),v(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Le=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(Le/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let _=m(e.wrappers);n("wrappers",Math.min(3,_),v(e.wrappers,"wrapper candidate(s)"));let F=m(e.passthroughs);n("passthroughs",Math.min(3,F),v(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 ye=e.drift.direct/r;if(n("drift",Math.min(5,Math.round(ye*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 u=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling",Math.min(5,Math.ceil(u/10)),v({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:u},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let u=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",u,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",g,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",L,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",_,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",F,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("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 Ve}from"v8";var $e=64*1024*1024;function B(){let e=globalThis.gc;if(!e)return;let r=Ve();r.heap_size_limit-r.used_heap_size<$e||e()}var _e=50,Fe=75e3,Ie=5e3,ue=2500,le=50,ze=10,Ne=["overview","dead","isolated","cycles","similar","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"],me={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:Ue(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:We(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:qe(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:je(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:Ye(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Xe(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:Qe(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Je(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Ke(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:Ze(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Ge(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:et(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:tt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:rt(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:nt(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:at(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:it(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:ot(e,t)})};function qt(e,r={}){return he(e,r.full!==!1,(t,i)=>{let o=Oe(e,r.scope,t,i);return M(o)})}function jt(e,r,t={}){return he(e,t.full!==!1,(i,o)=>me[r](e,t.scope,o,i))}function he(e,r,t){let i=J(e),o=st(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),B()}}function Gt(e){return M(ge(e))}function ge(e){let r=c(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,dead:c(e,"dead").dead,isolated:c(e,"isolated").isolated,realCycleCount:c(e,"cycles").realCycleCount,similarCount:c(e,"similar").similarCount,reactComponentDuplicates:c(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:c(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:c(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:c(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:c(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:c(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:c(e,"extract-candidates").extractCount,wrappers:c(e,"wrapper-candidates").wrappers,passthroughs:c(e,"passthrough-candidates").passthroughs,stale:c(e,"stale-abstractions").stale,drift:c(e,"drift").drift,complexity:c(e,"complexity-hotspots").complexity,gitEvidence:de(e,"git-evidence")?.gitEvidence??null,suppressions:de(e,"suppressions")?.suppressions??null}}function de(e,r){return e.find(t=>t.phase===r)}function c(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function Oe(e,r,t,i){return ge(Ne.map(o=>me[o](e,r,i,t)))}function Ue(e,r,t){return s(e,t,"dead",()=>{let i=I(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit});return R(lt(e,i.symbols))})}function We(e,r,t){return s(e,t,"isolated",()=>{let i=G(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit});return R(dt(e,i))})}function qe(e,r,t){return s(e,t,"cycles",()=>W(e,{scope:r}).filter(o=>o.kind==="real").length)}function je(e,r,t){return s(e,t,"similar",()=>X(e,{scope:r,...p.similar,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function Ge(e,r,t){return s(e,t,"extract-candidates",()=>j(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function Ye(e,r,t){return s(e,t,"react-component-duplicates",()=>{let i=Z(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Xe(e,r,t){return s(e,t,"react-hook-candidates",()=>{let i=ee(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Ce(i,mt)})}function Qe(e,r,t){return s(e,t,"react-large-component-pressure",()=>{let i=te(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return pt(i)})}function Je(e,r,t){return s(e,t,"vue-component-duplicates",()=>{let i=re(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Ke(e,r,t){return s(e,t,"vue-composable-candidates",()=>{let i=ie(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Ce(i,ht)})}function Ze(e,r,t){return s(e,t,"vue-large-view-pressure",()=>{let i=oe(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return R(i)})}function et(e,r,t){return s(e,t,"wrapper-candidates",()=>{let i=K(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,gt)})}function tt(e,r,t){return s(e,t,"passthrough-candidates",()=>{let i=Y(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,ft)})}function rt(e,r,t){return s(e,t,"stale-abstractions",()=>{let i=Q(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function it(e,r){return s(e,r,"git-evidence",()=>{let t=z(e);if(!t)return null;let i=O(e,void 0,{limit:r.candidateResultLimit}),o={};for(let[n,a]of t)o[n]={changes:a.changes,fixChanges:a.fixChanges};return{amplification:N(e),hiddenCoupling:{pairCount:i.findings.length,scoreCount:$(i.findings.reduce((n,a)=>n+pe(a),0)),top:i.findings.slice(0,5).map(n=>({fileA:n.fileA,fileB:n.fileB,together:n.together,confidence:n.confidence,focusedTogether:n.focusedTogether,broadTogether:n.broadTogether,broadCommitRatio:n.broadCommitRatio,lastTogetherAt:n.lastTogetherAt,recentTogether:n.recentTogether,commitScope:n.commitScope,recency:n.recency,scoreWeight:pe(n),subjectContext:n.subjectContext}))},fileStats:o}})}function ot(e,r){return s(e,r,"suppressions",()=>{let t=ne(e);return{total:t.total,byCategory:{...t.byCategory}}})}function nt(e,r,t){return s(e,t,"drift",()=>{let i=q(e,{scope:r,...p.drift}),o=i.results.filter(d=>d.kind!=="pattern-deviation"),n=o.filter(d=>d.actionTier==="direct").length,a=o.length-n;return{count:o.length,unusedImports:i.unusedImports,layerViolations:i.layerViolations,direct:n,signal:a}})}function at(e,r,t){return s(e,t,"complexity-hotspots",()=>{let i=U(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>_e).length}})}function st(e,r){let t=e.symbols>=Fe||e.documents>=Ie,i=r?Number.POSITIVE_INFINITY:le,o=r?Number.POSITIVE_INFINITY:ze;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:ue,candidateResultLimit:i,complexityResultLimit:o,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${ue} symbols and reported their top ${le} findings. Enable full mode for unbounded candidate counts.`]}}function ct(e,r){r.releaseCachesBetweenPhases&&(T(e),B())}function s(e,r,t,i){ut(t);try{return i()}finally{ct(e,r)}}function ut(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function lt(e,r){return r.filter(t=>!A(e,t.relativePath)&&!k(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function dt(e,r){return r.filter(t=>!A(e,t.relativePath)&&!k(e,t.symbol,t.relativePath))}function R(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function fe(e,r){return{...R(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function pt(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 V(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 Ce(e,r){return{...V(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function mt(e){let r=e.sharedHooks.length>0,t=be({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:ve(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function ht(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=be({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:ve(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function be(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!He.has(Se(r))).length+Math.min(e.functions.length,3)}function ve(e,r,t){let i=[...e,...r,...t].map(Se);return i.length>0&&i.every(o=>He.has(o))}function Se(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function gt(e){return e.actionTier==="signal"?.25:1}function ft(e){return e.actionTier==="signal"?.25:1}function pe(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 He=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{Ne as a,qt as b,jt as c,Gt as d};
2
- //# sourceMappingURL=chunk-4HOMAEDD.js.map
1
+ import{a as oe}from"./chunk-O3OKSF6O.js";import{a as ne}from"./chunk-3KLLFNT4.js";import{a as te}from"./chunk-QSXQT3NE.js";import{a as ie}from"./chunk-5UDFZC4D.js";import{a as re}from"./chunk-BNKE4TT5.js";import{a as Z}from"./chunk-WBJZNPUT.js";import{a as ee}from"./chunk-56UN3DMK.js";import{a as p}from"./chunk-B32FX5KB.js";import{a as J}from"./chunk-SPE4YCOT.js";import{a as X}from"./chunk-ZFMPHDAT.js";import{a as Q}from"./chunk-C2QSK7E7.js";import{b as Y}from"./chunk-UQJGTVHV.js";import{a as j}from"./chunk-G3WGZU5Q.js";import{a as G}from"./chunk-DE7MA6OD.js";import{a as q}from"./chunk-7KCSELEV.js";import{a as W}from"./chunk-AW4N6MGC.js";import{a as T,b as U}from"./chunk-C3MZZ2ZN.js";import{b as N}from"./chunk-EYLXU575.js";import{b as I,c as z}from"./chunk-KRGBLZT2.js";import{a as K}from"./chunk-DAI74TJU.js";import{a as O}from"./chunk-CJJP64OC.js";import{f as A,g as k}from"./chunk-ZQLO2SCU.js";function m(e){return e.scoreCount??e.count}function M(e){let r=Me(e),{breakdown:t,pressure:i}=Be(e),o=se(t,"risk"),n=se(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,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:m(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:m(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:m(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},axes:Ae(e),validation:Te(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function Ae(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:ke(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+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 ke(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:l(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function Te(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.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,a=0;for(let[b,g]of Object.entries(r))i.has(b)?o+=g.fixChanges:(n+=g.fixChanges,a+=1);let d=i.size>0?l(o/i.size):0,h=a>0?l(n/a):0,S={};for(let[b,g]of Object.entries(t)){let f=new Set(g);if(f.size===0)continue;let H=0;for(let L of f)H+=r[L]?.fixChanges??0;let x=l(H/f.size);S[b]={flaggedFiles:f.size,fixDensity:x,lift:h>0?l(x/h):null}}return{flaggedFiles:i.size,flaggedFixDensity:d,baselineFixDensity:h,ratio:i.size>0&&h>0?l(d/h):null,byCategory:S}}function l(e){return Math.round(e*100)/100}function ce(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function P(e,r="existing shared infrastructure discount"){let t=m(e);return Math.abs(t-e.count)<.01?"":` (${ce(t)} score-weighted after ${r})`}function v(e,r){let t=m(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${ce(t)} score-weighted)`}function Me(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 \u2014 safe to delete`,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.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${P(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${P(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${P(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.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`+P({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 a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var ae={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"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","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 se(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 Be(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(u,y,C)=>{y>0&&i.push({axis:u,points:y,detail:C,kind:ae[u]??"hygiene"})},a=(u,y,C,we,Pe,Re,De)=>{let w=Math.max(we,1);if(C<=w)return;let D=C/w,E=Math.min(Pe,Math.ceil(Math.log2(D)*Re));if(E<=0)return;let Ee=ae[u]??"hygiene";o.push({axis:u,category:y,kind:Ee,count:C,threshold:l(w),ratio:l(D),extraPenalty:E}),n(u,E,`${C} ${De} exceed pressure threshold ${l(w)} (${l(D)}x)`)},d=e.dead.count/t;n("dead-code",Math.min(20,Math.round(d*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let h=e.isolated.count/t;n("isolated",Math.min(10,Math.round(h*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 S=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(S)),`${e.similarCount} similar function pair(s)`);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 g=m(e.reactHookCandidates),f=g/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(f)),v(e.reactHookCandidates,"duplicated React behavior pair(s)"));let H=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(H/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let x=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(x)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let L=m(e.vueComposableCandidates),xe=L/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(xe)),v(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Le=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(Le/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let _=m(e.wrappers);n("wrappers",Math.min(3,_),v(e.wrappers,"wrapper candidate(s)"));let F=m(e.passthroughs);n("passthroughs",Math.min(3,F),v(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 ye=e.drift.direct/r;if(n("drift",Math.min(5,Math.round(ye*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 u=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling",Math.min(5,Math.ceil(u/10)),v({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:u},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let u=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",u,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",g,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",L,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",_,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",F,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("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 Ve}from"v8";var $e=64*1024*1024;function B(){let e=globalThis.gc;if(!e)return;let r=Ve();r.heap_size_limit-r.used_heap_size<$e||e()}var _e=50,Fe=75e3,Ie=5e3,ue=2500,le=50,ze=10,Ne=["overview","dead","isolated","cycles","similar","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"],me={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:Ue(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:We(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:qe(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:je(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:Ye(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Xe(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:Qe(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Je(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Ke(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:Ze(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Ge(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:et(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:tt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:rt(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:nt(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:at(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:it(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:ot(e,t)})};function qt(e,r={}){return he(e,r.full!==!1,(t,i)=>{let o=Oe(e,r.scope,t,i);return M(o)})}function jt(e,r,t={}){return he(e,t.full!==!1,(i,o)=>me[r](e,t.scope,o,i))}function he(e,r,t){let i=Q(e),o=st(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),B()}}function Gt(e){return M(ge(e))}function ge(e){let r=c(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,dead:c(e,"dead").dead,isolated:c(e,"isolated").isolated,realCycleCount:c(e,"cycles").realCycleCount,similarCount:c(e,"similar").similarCount,reactComponentDuplicates:c(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:c(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:c(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:c(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:c(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:c(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:c(e,"extract-candidates").extractCount,wrappers:c(e,"wrapper-candidates").wrappers,passthroughs:c(e,"passthrough-candidates").passthroughs,stale:c(e,"stale-abstractions").stale,drift:c(e,"drift").drift,complexity:c(e,"complexity-hotspots").complexity,gitEvidence:de(e,"git-evidence")?.gitEvidence??null,suppressions:de(e,"suppressions")?.suppressions??null}}function de(e,r){return e.find(t=>t.phase===r)}function c(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function Oe(e,r,t,i){return ge(Ne.map(o=>me[o](e,r,i,t)))}function Ue(e,r,t){return s(e,t,"dead",()=>{let i=U(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit});return R(lt(e,i.symbols))})}function We(e,r,t){return s(e,t,"isolated",()=>{let i=j(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit});return R(dt(e,i))})}function qe(e,r,t){return s(e,t,"cycles",()=>O(e,{scope:r}).filter(o=>o.kind==="real").length)}function je(e,r,t){return s(e,t,"similar",()=>Y(e,{scope:r,...p.similar,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function Ge(e,r,t){return s(e,t,"extract-candidates",()=>q(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function Ye(e,r,t){return s(e,t,"react-component-duplicates",()=>{let i=Z(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Xe(e,r,t){return s(e,t,"react-hook-candidates",()=>{let i=ee(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Ce(i,mt)})}function Qe(e,r,t){return s(e,t,"react-large-component-pressure",()=>{let i=te(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return pt(i)})}function Je(e,r,t){return s(e,t,"vue-component-duplicates",()=>{let i=re(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Ke(e,r,t){return s(e,t,"vue-composable-candidates",()=>{let i=ie(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Ce(i,ht)})}function Ze(e,r,t){return s(e,t,"vue-large-view-pressure",()=>{let i=oe(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return R(i)})}function et(e,r,t){return s(e,t,"wrapper-candidates",()=>{let i=J(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,gt)})}function tt(e,r,t){return s(e,t,"passthrough-candidates",()=>{let i=G(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,ft)})}function rt(e,r,t){return s(e,t,"stale-abstractions",()=>{let i=X(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function it(e,r){return s(e,r,"git-evidence",()=>{let t=I(e);if(!t)return null;let i=N(e,void 0,{limit:r.candidateResultLimit}),o={};for(let[n,a]of t)o[n]={changes:a.changes,fixChanges:a.fixChanges};return{amplification:z(e),hiddenCoupling:{pairCount:i.findings.length,scoreCount:$(i.findings.reduce((n,a)=>n+pe(a),0)),top:i.findings.slice(0,5).map(n=>({fileA:n.fileA,fileB:n.fileB,together:n.together,confidence:n.confidence,focusedTogether:n.focusedTogether,broadTogether:n.broadTogether,broadCommitRatio:n.broadCommitRatio,lastTogetherAt:n.lastTogetherAt,recentTogether:n.recentTogether,commitScope:n.commitScope,recency:n.recency,scoreWeight:pe(n),subjectContext:n.subjectContext}))},fileStats:o}})}function ot(e,r){return s(e,r,"suppressions",()=>{let t=ne(e);return{total:t.total,byCategory:{...t.byCategory}}})}function nt(e,r,t){return s(e,t,"drift",()=>{let i=W(e,{scope:r,...p.drift}),o=i.results.filter(d=>d.kind!=="pattern-deviation"),n=o.filter(d=>d.actionTier==="direct").length,a=o.length-n;return{count:o.length,unusedImports:i.unusedImports,layerViolations:i.layerViolations,direct:n,signal:a}})}function at(e,r,t){return s(e,t,"complexity-hotspots",()=>{let i=K(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>_e).length}})}function st(e,r){let t=e.symbols>=Fe||e.documents>=Ie,i=r?Number.POSITIVE_INFINITY:le,o=r?Number.POSITIVE_INFINITY:ze;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:ue,candidateResultLimit:i,complexityResultLimit:o,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${ue} symbols and reported their top ${le} findings. Enable full mode for unbounded candidate counts.`]}}function ct(e,r){r.releaseCachesBetweenPhases&&(T(e),B())}function s(e,r,t,i){ut(t);try{return i()}finally{ct(e,r)}}function ut(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function lt(e,r){return r.filter(t=>!A(e,t.relativePath)&&!k(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function dt(e,r){return r.filter(t=>!A(e,t.relativePath)&&!k(e,t.symbol,t.relativePath))}function R(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function fe(e,r){return{...R(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function pt(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 V(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 Ce(e,r){return{...V(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function mt(e){let r=e.sharedHooks.length>0,t=be({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:ve(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function ht(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=be({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:ve(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function be(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!He.has(Se(r))).length+Math.min(e.functions.length,3)}function ve(e,r,t){let i=[...e,...r,...t].map(Se);return i.length>0&&i.every(o=>He.has(o))}function Se(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function gt(e){return e.actionTier==="signal"?.25:1}function ft(e){return e.actionTier==="signal"?.25:1}function pe(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 He=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{Ne as a,qt as b,jt as c,Gt as d};
2
+ //# sourceMappingURL=chunk-YUTRW57I.js.map