scip-query 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -8
- package/dist/{chunk-2EC4JTHC.js → chunk-2DVVHNC3.js} +2 -2
- package/dist/{chunk-HVGNOUYP.js → chunk-2Y2WIJI4.js} +2 -2
- package/dist/{chunk-GMEBYEMU.js → chunk-3YQO3S5D.js} +2 -2
- package/dist/chunk-44G4P3GJ.js +2 -0
- package/dist/{chunk-ZIIQ55VK.js → chunk-6HP3BKIP.js} +2 -2
- package/dist/chunk-B32FX5KB.js +2 -0
- package/dist/{chunk-MKE7SEEX.js → chunk-FYT2PE7C.js} +2 -2
- package/dist/{chunk-66ORT3LS.js → chunk-HDA2V5DC.js} +2 -2
- package/dist/{chunk-4A4JFNWG.js → chunk-I66MQD5U.js} +2 -2
- package/dist/chunk-IBM6FXOQ.js +3 -0
- package/dist/{chunk-4B7YLRXX.js → chunk-ITUU3VE3.js} +2 -2
- package/dist/{chunk-QYQXPPDI.js → chunk-K3V6XUTL.js} +2 -2
- package/dist/{chunk-XSZ5NC4O.js → chunk-L6TOEQ2M.js} +2 -2
- package/dist/{chunk-JAMU6FLN.js → chunk-LBAMALDV.js} +2 -2
- package/dist/chunk-LR7E2ATW.js +8 -0
- package/dist/chunk-NM3BZXHA.js +2 -0
- package/dist/{chunk-NOVKLH2F.js → chunk-NO2TPMCQ.js} +1 -1
- package/dist/{chunk-SSINY7HL.js → chunk-OMNT7E2T.js} +2 -2
- package/dist/chunk-R3G6ERW7.js +7 -0
- package/dist/{chunk-7UZWNW4E.js → chunk-SEZZ24IG.js} +2 -2
- package/dist/{chunk-DJTJ3DLZ.js → chunk-SLX5XBCD.js} +2 -2
- package/dist/{chunk-K4Z3FCUJ.js → chunk-SQ6VENQY.js} +3 -3
- package/dist/chunk-T4AK46CM.js +16 -0
- package/dist/{chunk-FIPE5AQT.js → chunk-TA4DDU7J.js} +2 -2
- package/dist/{chunk-UQE3DSXY.js → chunk-TCCUWKH4.js} +2 -2
- package/dist/{chunk-HVXIXDLV.js → chunk-U254PV4S.js} +2 -2
- package/dist/chunk-UIWAZ2NT.js +2 -0
- package/dist/{chunk-K6YIGVL7.js → chunk-VHENVDS2.js} +2 -2
- package/dist/{chunk-SB6I6O3P.js → chunk-VQGQHIAT.js} +2 -2
- package/dist/{chunk-FTBT4RP2.js → chunk-VTF5EH22.js} +2 -2
- package/dist/{chunk-SLOIQKY7.js → chunk-Y3RUPPIU.js} +2 -2
- package/dist/{chunk-OIMM7KMI.js → chunk-YO6DU7QZ.js} +2 -2
- package/dist/{chunk-EM2PPDN7.js → chunk-YSSTUCNS.js} +2 -2
- package/dist/cli.js +167 -149
- package/dist/index.js +1 -1
- package/dist/postinstall.js +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/diff-gate.d.ts +4 -1
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +3 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +71 -0
- package/dist/queries/incomplete-migration.js +2 -0
- package/dist/queries/index.d.ts +1 -0
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar.d.ts +15 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/runtime.js +1 -1
- package/package.json +5 -1
- package/skills/scip-query/SKILL.md +79 -0
- package/dist/chunk-6P5W4U6G.js +0 -16
- package/dist/chunk-GTZAU7OL.js +0 -2
- package/dist/chunk-N5D5ZCBW.js +0 -7
- package/dist/chunk-OQSV6OS2.js +0 -2
- package/dist/chunk-RKTDEIHF.js +0 -2
- package/dist/chunk-XBFLIGWU.js +0 -3
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ flowchart LR
|
|
|
84
84
|
|
|
85
85
|
## Cleaning Up AI-Generated Code
|
|
86
86
|
|
|
87
|
-
This is the workflow the tool is built around. Each detector targets a specific way AI-assisted development rots a codebase:
|
|
87
|
+
This is the workflow the tool is built around. Each detector targets a specific way AI-assisted development rots a codebase — the full catalog, with the prevention wiring for each, is in [docs/AI_FAILURE_MODES.md](docs/AI_FAILURE_MODES.md):
|
|
88
88
|
|
|
89
89
|
**1. Find the echoes.** Agents re-implement helpers they didn't know existed. `recent-duplicates` makes similarity *directional* using git file ages — which side is the established original, which is the recent echo:
|
|
90
90
|
|
|
@@ -95,7 +95,16 @@ This is the workflow the tool is built around. Each detector targets a specific
|
|
|
95
95
|
(both new — one agent session duplicated itself; consolidate before they diverge)
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
**2.
|
|
98
|
+
**2. Finish the half-done extraction.** Agents extract a helper, rewire one or two call sites, and abandon the rest — the extracted logic survives inline at every site they missed. `incomplete-migration` finds helpers that are new in the diff, confirms they were wired in somewhere, and lists the established sites that still contain the helper's logic but never call it (containment scoring, because a missed site holds the helper's logic *plus* its own):
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
src/utils/priceLabel.ts priceLabel()
|
|
102
|
+
wired into: src/cards/price-summary-a.ts
|
|
103
|
+
un-migrated: 100% buildReportB() (src/cards/price-summary-b.ts)
|
|
104
|
+
un-migrated: 100% buildReportC() (src/cards/price-summary-c.ts)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**3. Catch your standards docs lying.** If you keep in-repo standards for agents to read before implementing, a stale standard is worse than none. `doc-drift` reads every doc's file citations *and* its co-change history, then flags docs whose code moved on without them — including **broken references** to files that no longer exist:
|
|
99
108
|
|
|
100
109
|
```
|
|
101
110
|
staleness 94 product/domain-model.md
|
|
@@ -103,7 +112,7 @@ staleness 94 product/domain-model.md
|
|
|
103
112
|
22 change(s) since doc update src/workflows/serviceTasks.ts (referenced by doc)
|
|
104
113
|
```
|
|
105
114
|
|
|
106
|
-
**
|
|
115
|
+
**4. Delete with proof.** `cleanup-plan` runs dead-code analysis to a *fixpoint* — deleting batch 0 makes batch 1 dead, and the plan shows the cascade. `--verify` applies each batch in a throwaway git worktree and runs your own compiler (differentially, so pre-existing errors don't drown the signal):
|
|
107
116
|
|
|
108
117
|
```
|
|
109
118
|
── Batch 0: deletable now (graph-fact, 67 LOC) ──
|
|
@@ -113,18 +122,18 @@ Batch 0: COMPILER-VERIFIED
|
|
|
113
122
|
|
|
114
123
|
When verification *fails*, the errors name the exact references the static evidence missed — that failure has caught real detector mistakes and stopped build-breaking deletions.
|
|
115
124
|
|
|
116
|
-
**
|
|
125
|
+
**5. Trim speculative generality.** `unused-params` finds trailing parameters no body ever uses (the classic "options for later"), scoped to removals that are type-safe by construction.
|
|
117
126
|
|
|
118
|
-
**
|
|
127
|
+
**6. Surface hidden coupling.** `co-change` finds file pairs that repeatedly change in the same commits with *no* dependency edge — schema ↔ generated inventory ↔ doc triangles, backend schemas ↔ frontend stores, `.env.example` ↔ its parser. The reference graph cannot see these; the change graph can.
|
|
119
128
|
|
|
120
|
-
**
|
|
129
|
+
**7. Gate every diff.** `diff-gate` runs the whole suite scoped to what a change *introduces* — echoes of established code, incomplete migrations, missing co-change partners, docs that cite the changed files, fresh unused params, new dead symbols, baseline regressions — in seconds, exit-code friendly, with a remediation per finding an agent can act on without human triage:
|
|
121
130
|
|
|
122
131
|
```
|
|
123
132
|
[co-change-partner] schema.prisma changed, but scripts/scope-inventory.mjs did not — they change together 12x (86% of the time)
|
|
124
133
|
-> Update scripts/scope-inventory.mjs alongside this change, or confirm the coupling no longer holds.
|
|
125
134
|
```
|
|
126
135
|
|
|
127
|
-
**
|
|
136
|
+
**8. Ratchet it in CI.** `health --write-baseline` snapshots finding identities into a committable file; `health --baseline` exits 1 on any *new* finding. "Don't get worse" is an objective gate that no score arithmetic can game.
|
|
128
137
|
|
|
129
138
|
Before any edit, `plan-context <target>` bundles the structural picture — definitions, references, call graph, blast radius — plus a HISTORY section: churn, fix-commit density, and the files that usually change together with the target ("editing this usually means editing these").
|
|
130
139
|
|
|
@@ -171,7 +180,9 @@ Heuristic detectors carry guardrails learned from real codebases: published `pac
|
|
|
171
180
|
|
|
172
181
|
## Agent Skills
|
|
173
182
|
|
|
174
|
-
`scip-query install-skills` symlinks ready-made skills into Claude Code, Codex, and shared agent roots —
|
|
183
|
+
`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`), maintainability review (`scip-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`).
|
|
184
|
+
|
|
185
|
+
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.
|
|
175
186
|
|
|
176
187
|
## Quick Start
|
|
177
188
|
|
|
@@ -258,6 +269,8 @@ Query results are filtered through the project's `.gitignore`. If none exists, c
|
|
|
258
269
|
|
|
259
270
|
## Documentation
|
|
260
271
|
|
|
272
|
+
- [AI Failure Modes](docs/AI_FAILURE_MODES.md): every specific way AI coding rots a codebase, the detector built for it, and how to wire prevention in.
|
|
273
|
+
- [Detector Guide](docs/DETECTOR_GUIDE.md): what each detector measures, the differences between the confusable ones, and which check to run after which kind of change.
|
|
261
274
|
- [Agent Guide](docs/AGENT_GUIDE.md): goal-oriented workflows for tracing, planning, cleanup, quality checks, and change verification.
|
|
262
275
|
- [Command Reference](docs/COMMAND_REFERENCE.md): generated command syntax, descriptions, and options.
|
|
263
276
|
- [Programmatic API](docs/API.md): using the query functions from TypeScript.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-NO2TPMCQ.js";import{a as S}from"./chunk-TQTVM27C.js";import{b as h}from"./chunk-64UY7VTR.js";import{b as d}from"./chunk-APLCSDXL.js";import{a as y}from"./chunk-NN3O7TPH.js";import f from"path";function l(e){let n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n.length<=1?"(root)":n.length>=3&&["src","lib","app","server","client"].includes(n[0])?`${n[0]}/${n[1]}`:n[0]}function p(e,t){if(e===t)return"ok";let n=g(e),i=g(t);return n&&i?v(n,i)?"ok":"violation":w(e,t)}function D(e,t){let n=g(l(e)),i=g(l(t));return!!n&&!!i}function g(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function v(e,t){return t==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","semantic","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(t)??!1}function w(e,t){if(t==="shared")return"ok";let n={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return n[e]?n[e].has(t)?"ok":"violation":null}function G(e,t){let{scope:n,minDeviation:i=5}=t??{},r=t?.semantic!==!1,c=new m(e).fileDependencyGraph(n),a=O(e,n);return _([...R(e,c,a,{semantic:r}),...k(c),...I(c,i)])}function R(e,t,n,i){let r=[];for(let[s,c]of t){if(u(s))continue;let a=n.get(s)??new Set;for(let o of c)if(!u(o)&&!a.has(o)){if(i.semantic&&L(e,s,o)||A(e,s,o)||T(e,s,o)||F(o)||j(e,s,o)||V(o))continue;r.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o})}}return r}function k(e){let t=[],n=$(e);for(let[i,r]of e){if(u(i))continue;let s=l(i);for(let c of r){if(u(c))continue;let a=l(c);if(s===a)continue;(p(s,a)??n.get(`${s}->${a}`))==="violation"&&t.push({file:i,kind:"layer-violation",description:`Imports from ${a}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${s}/ should not depend on ${a}/`})}}return t}function I(e,t){let n=[];for(let[i,r]of M(e)){let s=r.filter(a=>!u(a));if(s.length<t)continue;let c=x(e,s);for(let a of s)for(let o of e.get(a)??[])u(o)||(c.get(o)??0)===1&&f.dirname(o)!==i&&f.dirname(o)!==f.dirname(i)&&(D(a,o)||n.push({file:a,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${o}`,dep:o}))}return n}function _(e){return{results:e,unusedImports:e.filter(t=>t.kind==="unused-import").length,layerViolations:e.filter(t=>t.kind==="layer-violation").length,patternDeviations:e.filter(t=>t.kind==="pattern-deviation").length}}function M(e){let t=new Map;for(let n of e.keys()){let i=f.dirname(n),r=t.get(i);r||(r=[],t.set(i,r)),r.push(n)}return t}function x(e,t){let n=new Map;for(let i of t)for(let r of e.get(i)??[])u(r)||n.set(r,(n.get(r)??0)+1);return n}function O(e,t){let n=new Map;return E(e,n,t),P(e,n),n}function E(e,t,n){for(let i of N(e,n))b(e,t,i.from_file,i.to_file)}function N(e,t){let n=t?`AND d1.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -15,4 +15,4 @@ import{a as m}from"./chunk-NOVKLH2F.js";import{a as S}from"./chunk-TQTVM27C.js";
|
|
|
15
15
|
AND m.role != 1
|
|
16
16
|
${e.pathExclusionsFor("d1","d2")}
|
|
17
17
|
${n}`)}function P(e,t){new m(e).scanSourceReferences({paths:y(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},i=>{i.target.relativePath!==i.sourceFile&&(e.isIgnored(i.target.relativePath)||b(e,t,i.sourceFile,i.target.relativePath))})}function b(e,t,n,i){if(e.isIgnored(n)||e.isIgnored(i))return;let r=t.get(n);r||(r=new Set,t.set(n,r)),r.add(i)}function $(e){let t=new Map;for(let[i,r]of e){if(u(i))continue;let s=l(i);for(let c of r){if(u(c))continue;let a=l(c);if(s===a||p(s,a))continue;let o=`${s}->${a}`;t.set(o,(t.get(o)??0)+1)}}let n=new Map;for(let[i,r]of t)n.set(i,r<=2?"violation":"ok");return n}function F(e){return e.includes("types")||e.endsWith(".d.ts")}function L(e,t,n){let i=h(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.some(r=>r.isUsed)}function A(e,t,n){let i=d(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.some(r=>r.used)}function T(e,t,n){let i=d(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.every(r=>r.isTypeOnly===!0)}function V(e){return e.endsWith(".vue")}function j(e,t,n){let i=d(e,t).filter(r=>r.sourcePath===n);return i.length===0?!1:i.every(r=>r.kind==="side-effect"||r.kind==="namespace"&&r.usedMembers.length===0&&!r.used)}function u(e){let t=S(e);return!!(t==="entry"||t==="barrel"||t==="test"||t==="worker"||J(f.basename(e)))}function J(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{G as a};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-2DVVHNC3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as b}from"./chunk-V76FCF5F.js";import{a as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as b}from"./chunk-V76FCF5F.js";import{a as g}from"./chunk-NO2TPMCQ.js";import{a as d}from"./chunk-6ZFKI5EP.js";import{c as p}from"./chunk-SOGLYIJ4.js";import{c as u,f as c}from"./chunk-WQFOZIID.js";function T(t,r={}){let{scope:l,limit:s=30,scanLimit:f}=r,o=r.files===void 0?null:new Set(r.files),L=new g(t);return b({candidates:()=>L.productionCallableDefinitions({scope:l,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}).filter(e=>h(e.relativePath)&&(o===null||o.has(e.relativePath))),scanLimit:f,evaluate:e=>{let n=c(t,e.relativePath)?.callables.find(a=>a.startLine===e.startLine&&a.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(a=>!a.simple)||n.paramsEndLine>=n.endLine)return null;let y=d(t,e.relativePath),m=[];for(let a=n.params.length-1;a>=0;a--){let i=n.params[a];if(i.name===""||i.name.startsWith("_")||P(y.get(i.name),n.paramsEndLine,n.endLine))break;m.unshift(i.name)}return m.length===0?null:{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,paramCount:n.paramCount,unusedTrailing:m}},orderResults:(e,n)=>n.unusedTrailing.length-e.unusedTrailing.length||e.file.localeCompare(n.file)||e.startLine-n.startLine,limit:s})}function h(t){let r=u(t);return r==="typescript"||r==="tsx"||r==="javascript"}function P(t,r,l){return t?t.some(s=>s>r&&s<=l):!1}export{T as a};
|
|
2
|
+
//# sourceMappingURL=chunk-2Y2WIJI4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-NO2TPMCQ.js";import{a as l}from"./chunk-7I6KNKE3.js";import{d as o,f as a}from"./chunk-SOGLYIJ4.js";import{basename as d}from"path";function M(t,c){let n=l(t,c);if(!n)return[];let r=o(n.symbol),s=new m(t).definitionsForFile(n.relativePath).filter(e=>a(e.symbol)),i=s.filter(e=>e.parentTypeName===r||e.symbol.includes(r));return(i.length>0?i:p(d(n.relativePath))===r?s.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:o(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
|
|
2
|
+
//# sourceMappingURL=chunk-3YQO3S5D.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as k,d as v}from"./chunk-R3G6ERW7.js";import{existsSync as C,readFileSync as z}from"fs";import{join as A}from"path";var b=/\.(?:md|mdx|rst|txt)$/i;function T(e){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(e)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(e)}var U=3,_=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function H(e,s={}){let{doc:c,limit:u=20,minCoupling:d=U}=s,n=k(e);if(!n)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let r=v(e)??new Set,a=new Map,h=new Map,m=new Set;for(let o of n.commits){let l=[...new Set(o.files)],S=l.filter(i=>b.test(i)),y=l.filter(i=>!b.test(i));for(let i of l){m.add(i);let f=a.get(i)??[];f.push(o.timestamp),a.set(i,f)}for(let i of S){let f=h.get(i);f||(f=new Map,h.set(i,f));for(let t of y)f.set(t,(f.get(t)??0)+1)}}let p=[...r].filter(o=>b.test(o)),M=j(r),x=[];for(let o of p){if(c!==void 0&&!o.includes(c)||c===void 0&&!F(e,o)||c!==void 0&&!C(A(e.config.projectRoot,o)))continue;let l=Math.max(0,...a.get(o)??[]),S=new Map,{resolved:y,broken:i}=w(e,o,r,M,m);for(let t of y){if(t===o||b.test(t))continue;let g=(a.get(t)??[]).filter(D=>D>l).length;g!==0&&S.set(t,{file:t,evidence:"reference",coChanges:0,changesSinceDocUpdate:g})}for(let[t,g]of h.get(o)??[]){if(g<d||!r.has(t))continue;let D=(a.get(t)??[]).filter(E=>E>l).length;if(D===0)continue;let R=S.get(t);R?(R.evidence="both",R.coChanges=g):S.set(t,{file:t,evidence:"co-change",coChanges:g,changesSinceDocUpdate:D})}if(S.size===0&&i.length===0)continue;let f=[...S.values()].sort((t,g)=>g.changesSinceDocUpdate-t.changesSinceDocUpdate);x.push({doc:o,docLastChangedAt:l,staleness:f.reduce((t,g)=>t+g.changesSinceDocUpdate,0)+i.length*10,subjects:f.slice(0,8),brokenReferences:i})}return x.sort((o,l)=>l.staleness-o.staleness),{available:!0,commitsAnalyzed:n.commits.length,docsScanned:p.length,findings:x.slice(0,u)}}function P(e,s){let c=v(e)??new Set,u=j(c),d=[];for(let n of c){if(!F(e,n))continue;let{resolved:r}=w(e,n,c,u,new Set),a=[...r].filter(h=>s.has(h));a.length>0&&d.push({doc:n,cited:a.sort()})}return d}function F(e,s){return b.test(s)&&!T(s)&&C(A(e.config.projectRoot,s))}function j(e){let s=new Map;for(let c of e){let u=c.split("/");for(let d of[2,3]){if(u.length<d)continue;let n=u.slice(-d).join("/"),r=s.get(n)??[];r.push(c),s.set(n,r)}}return s}function w(e,s,c,u,d){let n=new Set,r=new Set,a;try{a=z(A(e.config.projectRoot,s),"utf-8")}catch{return{resolved:n,broken:[]}}for(let h of a.matchAll(_)){let m=h[0].replace(/^\.?\//,"");if(c.has(m)){n.add(m);continue}let p=u.get(m);if(p&&p.length===1){n.add(p[0]);continue}p&&p.length>1||d.has(m)&&r.add(m)}return{resolved:n,broken:[...r]}}export{T as a,H as b,P as c};
|
|
2
|
+
//# sourceMappingURL=chunk-44G4P3GJ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a}from"./chunk-NO2TPMCQ.js";import{a as i}from"./chunk-7I6KNKE3.js";import{c as s,e as o,k as m}from"./chunk-SOGLYIJ4.js";function L(t,l){let r=i(t,l);return r?new a(t).definitionsForFile(r.relativePath).filter(e=>e.symbol!==r.symbol).filter(e=>m(r.symbol,e.symbol)).sort((e,n)=>e.startLine-n.startLine||e.endLine-n.endLine).map(e=>({symbol:e.symbol,shortName:s(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:o(e.symbol)??"unknown"})):[]}export{L as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6HP3BKIP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var i={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0,semantic:!1},isolated:{minLoc:3,semantic:!1},similar:{minSimilarity:.6,limit:50,minCallees:4,semantic:!1},extract:{minLoc:15,minCallees:5,limit:50,semantic:!1},wrappers:{maxLoc:15,limit:50,semantic:!1},passthroughs:{maxLoc:15,limit:50,semantic:!1},stale:{minLoc:3,limit:50,semantic:!1},drift:{semantic:!1}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-B32FX5KB.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as m}from"./chunk-UIWAZ2NT.js";import{a as d}from"./chunk-RIXOMSOR.js";function v(t,s={}){let{minSimilarity:o=.5,limit:f=20,scope:n,filePattern:p}=s,l=s.minDeps??(p?1:3),{profiles:e,distinctiveDeps:c}=h(t,{scope:n,minDeps:l}),i=[];if(p){let r=e.find(u=>u.file.includes(p));if(!r)return[];for(let u of e){if(u.file===r.file)continue;let a=g(r,u,o,c);a&&i.push(a)}}else for(let r=0;r<e.length;r++){for(let u=r+1;u<e.length;u++){let a=g(e[r],e[u],o,c);a&&i.push(a)}if(i.length>f*5)break}return i.sort((r,u)=>u.similarity-r.similarity),i.slice(0,f)}function h(t,s){let{scope:o,minDeps:f}=s,n=d(t,o),{universalDeps:p,distinctiveDeps:l}=D(n),e=[];for(let[c,i]of n)i.size>=f&&e.push({file:c,deps:new Set([...i].filter(r=>!p.has(r)))});return{profiles:e,distinctiveDeps:l}}function D(t){let s=new Set,o=new Set,f=t.size;if(f===0)return{universalDeps:s,distinctiveDeps:o};let n=new Map;for(let l of t.values())for(let e of l)n.set(e,(n.get(e)??0)+1);let p=Math.max(3,Math.ceil(f*.03));for(let[l,e]of n)e>=5&&e/f>.3?s.add(l):e<=p&&o.add(l);return{universalDeps:s,distinctiveDeps:o}}function g(t,s,o,f){let n=new Set;for(let i of t.deps)s.deps.has(i)&&n.add(i);if(n.size<3||t.deps.size<4||s.deps.size<4)return null;let p=0;for(let i of n)f.has(i)&&p++;if(p<2)return null;let l=m(t.deps,s.deps);if(l<o)return null;let e=[];for(let i of t.deps)s.deps.has(i)||e.push(i);let c=[];for(let i of s.deps)t.deps.has(i)||c.push(i);return{fileA:t.file,fileB:s.file,similarity:l,sharedDeps:[...n],uniqueToA:e,uniqueToB:c}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FYT2PE7C.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as D}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as D}from"./chunk-NO2TPMCQ.js";import{n as A}from"./chunk-6ZFKI5EP.js";import{a as d,c as h,e as y}from"./chunk-64UY7VTR.js";import{c as S}from"./chunk-SOGLYIJ4.js";function F(e,n={}){let{samples:o=50,scope:r,maxDisagreements:l=5}=n,s=new D(e),i=C(s.productionCallableDefinitions({scope:r,minLoc:2,requireFunctionLikeSymbol:!0}),o);if(i.length===0||!R(e,i))return{available:!1,sampleSize:i.length,oracleCoverage:0,scores:[],topDisagreements:[]};let c={references:v(),callees:v()},a=[],g=0,T=y(e,i);for(let t of i){let u=f(t,h(e,t).map(m=>m.file)),b=f(t,(T.get(t.symbolId)??[]).map(m=>m.file));if(u.size===0&&b.size===0)continue;g+=1;let Q=f(t,A(e,t).map(m=>m.file)),I=f(t,(s.calleeMap([t],{semantic:!1}).get(t.symbolId)??[]).map(m=>m.file));x(c.references,t,"references",Q,u,a),x(c.callees,t,"callees",I,b,a)}return a.sort((t,u)=>u.cheapOnly.length+u.oracleOnly.length-(t.cheapOnly.length+t.oracleOnly.length)),{available:!0,sampleSize:i.length,oracleCoverage:i.length>0?p(g/i.length):0,scores:["references","callees"].map(t=>O(t,c[t])),topDisagreements:a.slice(0,l)}}function v(){return{comparedSymbols:0,agreed:0,cheapTotal:0,oracleTotal:0}}function C(e,n){let o=[...e].sort((s,i)=>s.symbolId-i.symbolId);if(o.length<=n)return o;let r=o.length/n,l=[];for(let s=0;s<n;s++)l.push(o[Math.floor(s*r)]);return l}function R(e,n){let o=n[0];if(!o)return!1;try{return d(e,o.relativePath).availability().available}catch{return!1}}function f(e,n){let o=new Set;for(let r of n)r!==e.relativePath&&o.add(r);return o}function x(e,n,o,r,l,s){if(r.size===0&&l.size===0)return;e.comparedSymbols+=1,e.cheapTotal+=r.size,e.oracleTotal+=l.size;let i=[],c=[];for(let a of r)l.has(a)?e.agreed+=1:i.push(a);for(let a of l)r.has(a)||c.push(a);(i.length>0||c.length>0)&&s.push({symbol:S(n.symbol),question:o,cheapOnly:i,oracleOnly:c})}var z={references:!0,callees:!1};function O(e,n){let o=n.oracleTotal>0?n.agreed/n.oracleTotal:1,r=n.cheapTotal-n.agreed;return{question:e,comparedSymbols:n.comparedSymbols,precision:z[e]&&n.cheapTotal>0?p(n.agreed/n.cheapTotal):null,recall:p(o),unverified:r}}function p(e){return Math.round(e*1e3)/1e3}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HDA2V5DC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p,f as h}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p,f as h}from"./chunk-R3G6ERW7.js";import{a as c}from"./chunk-TQTVM27C.js";import{a as d}from"./chunk-RIXOMSOR.js";import{existsSync as A}from"fs";import{join as S}from"path";function T(e){return m.test(e)}var m=/(?:^|\/)(?:package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Cargo\.lock|CHANGELOG(?:\.[a-z]+)?|.*\.map)$|(?:^|\/)(?:dist|build|out|node_modules)\//i;function j(e,i,t={}){let{minTogether:o=4,minConfidence:r=.6,limit:a=30}=t,u=p(e),s=i!==void 0,f=h(e,{minTogether:s?Math.min(o,2):o,minConfidence:s?0:r});if(!u||!f)return{available:!1,commitsAnalyzed:0,findings:[]};let C=d(e),y=t.includeLinked===!0||s,l=[];for(let n of f){if(m.test(n.fileA)||m.test(n.fileB)||!b(e,n.fileA)||!b(e,n.fileB)||s&&!n.fileA.includes(i)&&!n.fileB.includes(i)||!s&&(c(n.fileA)==="test"||c(n.fileB)==="test"||k(n.fileA,n.fileB)))continue;let g=x(C,n.fileA,n.fileB);if(!(!y&&g)&&(l.push({...n,structurallyLinked:g}),l.length>=a))break}return{available:!0,commitsAnalyzed:u.commits.length,findings:l}}function b(e,i){return A(S(e.config.projectRoot,i))}function k(e,i){let t=e.lastIndexOf("/"),o=i.lastIndexOf("/");if(e.slice(0,t)!==i.slice(0,o))return!1;let r=e.slice(t+1).split(".")[0],a=i.slice(o+1).split(".")[0];return r!==""&&r===a}function x(e,i,t){return e.get(i)?.has(t)===!0||e.get(t)?.has(i)===!0}export{T as a,j as b};
|
|
2
|
+
//# sourceMappingURL=chunk-I66MQD5U.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as _}from"./chunk-2Y2WIJI4.js";import{a as l}from"./chunk-B32FX5KB.js";import{a as B}from"./chunk-OMNT7E2T.js";import{a as G}from"./chunk-AQYBOORI.js";import{a as L}from"./chunk-SLX5XBCD.js";import{a as E}from"./chunk-K3V6XUTL.js";import{a as v}from"./chunk-Y3RUPPIU.js";import{a as A}from"./chunk-U254PV4S.js";import{a as P}from"./chunk-LR7E2ATW.js";import{a as F,b as x}from"./chunk-SQ6VENQY.js";import{b as C}from"./chunk-T4AK46CM.js";import{c as w}from"./chunk-44G4P3GJ.js";import{a as N}from"./chunk-2DVVHNC3.js";import{b as k}from"./chunk-YO6DU7QZ.js";import{a as g}from"./chunk-I66MQD5U.js";import{f as D}from"./chunk-R3G6ERW7.js";import{a as R}from"./chunk-EKP7XJ6L.js";import{a as $}from"./chunk-NO2TPMCQ.js";import{e as d,f as p}from"./chunk-TQTVM27C.js";import{existsSync as I}from"fs";import{existsSync as T,readFileSync as M,writeFileSync as O}from"fs";import{isAbsolute as U,join as q}from"path";var z=75e3,J=5e3,K=2500;function W(e){let t=G(e);return t.symbols>=z||t.documents>=J?K:void 0}var Y=".scipquery-baseline.json";function u(e,t){return t&&U(t)?t:q(e.config.projectRoot,t??Y)}function j(e,t={}){let{scope:n}=t,o=W(e),s=[],c=k(e,{scope:n,...l.dead,scanLimit:o});for(let i of c.symbols)d(e,i.relativePath)||p(e,i.symbol,i.relativePath)||i.kind==="dead-code"&&s.push(`dead:${i.relativePath}:${i.shortName}`);for(let i of E(e,{scope:n,...l.isolated,scanLimit:o}))d(e,i.relativePath)||p(e,i.symbol,i.relativePath)||s.push(`isolated:${i.relativePath}:${i.shortName}`);for(let i of R(e,{scope:n}))i.kind==="real"&&s.push(`cycle:${Q(i.path)}`);for(let i of x(e,{scope:n,...l.similar,scanLimit:o}))s.push(`similar:${[i.symbolA,i.symbolB].sort().join("|")}`);for(let i of A(e,{scope:n,...l.extract,scanLimit:o}))s.push(`extract:${i.relativePath}:${i.shortName}`);for(let i of L(e,{scope:n,...l.wrappers,scanLimit:o}))s.push(`wrapper:${i.file}:${i.shortName}`);for(let i of v(e,{scope:n,...l.passthroughs,scanLimit:o}))s.push(`passthrough:${i.file}:${i.shortName}`);for(let i of B(e,{scope:n,...l.stale,scanLimit:o}))s.push(`stale:${i.file}:${i.shortName}`);for(let i of N(e,{scope:n,...l.drift}).results)i.kind!=="pattern-deviation"&&s.push(`drift:${i.kind}:${i.file}:${i.dep}`);return[...new Set(s)].sort()}function Q(e){if(e.length===0)return"";let t=0;for(let n=1;n<e.length;n++)e[n]<e[t]&&(t=n);return[...e.slice(t),...e.slice(0,t)].join(">")}function be(e,t={}){let n=j(e,{scope:t.scope}),o=u(e,t.path);return O(o,JSON.stringify({version:1,findings:n},null,2)+`
|
|
2
|
+
`),{path:o,findingCount:n.length}}function H(e,t={}){let n=u(e,t.path);if(!T(n))throw new Error(`No baseline found at ${n}. Create one with: scip-query health --write-baseline`);let o=JSON.parse(M(n,"utf-8")),s=new Set(o.findings??[]),c=j(e,{scope:t.scope}),i=new Set(c);return{baselinePath:n,baselineCount:s.size,current:c,newFindings:c.filter(r=>!s.has(r)),fixedFindings:[...s].filter(r=>!i.has(r))}}function xe(e,t={}){let n=t.base??"HEAD",{minTogether:o=6,minConfidence:s=.6,maxEchoChecks:c=10,minSimilarity:i=.8}=t,r=C(e,{base:n}),a=r.changedFiles,h=new Set(a),f={base:n,changedFiles:a,changedSymbols:r.changedSymbols.length,checksRun:[],skipped:[],findings:[],note:r.summary.note};return a.length===0||(V(e,r.changedSymbols,h,c,i,f),X(e,n,f),Z(e,h,o,s,f),ee(e,h,f),ie(e,a,f),ne(e,r.changedSymbols,f),te(e,f)),f}function V(e,t,n,o,s,c){c.checksRun.push("echo");for(let i of t.slice(0,o)){let r=F(e,i.symbol,{minSimilarity:s,limit:3});for(let a of r){let h=a.fileA===i.file?a.fileB:a.fileA,f=a.fileA===i.file?a.shortNameB:a.shortNameA;n.has(h)||c.findings.push({check:"echo",message:`${i.shortName} (${i.file}) is ${Math.round(a.similarity*100)}% similar to established ${f} (${h})`,remediation:`Extend or reuse ${f} instead of keeping the re-implementation.`})}}t.length>o&&c.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${t.length} changed symbols`})}function X(e,t,n){let o=P(e,{base:t});if(!o.available){n.skipped.push({check:"incomplete-migration",reason:"no git history"});return}n.checksRun.push("incomplete-migration"),o.note&&n.skipped.push({check:"incomplete-migration",reason:o.note});for(let s of o.findings){let c=s.leftovers.map(i=>`${i.shortName} (${i.file}, ${Math.round(i.containment*100)}%)`).join(", ");n.findings.push({check:"incomplete-migration",message:`new helper ${s.helperShortName} (${s.helperFile}) is wired into ${s.migratedFiles.length} file(s), but ${s.leftovers.length} similar un-migrated site(s) remain: ${c}`,remediation:`Migrate the remaining sites to ${s.helperShortName}, or confirm they are intentionally different.`})}}function Z(e,t,n,o,s){let c=D(e,{minTogether:n,minConfidence:0});if(!c){s.skipped.push({check:"co-change-partner",reason:"no git history"});return}s.checksRun.push("co-change-partner");let i=new Set;for(let r of c){let a=t.has(r.fileA),h=t.has(r.fileB);if(a===h)continue;let f=a?r.fileA:r.fileB,m=a?r.fileB:r.fileA,y=a?r.changesA:r.changesB,b=y>0?r.together/y:0;if(b<o||g(m)||g(f)||!I(`${e.config.projectRoot}/${m}`))continue;let S=`${f}|${m}`;i.has(S)||(i.add(S),s.findings.push({check:"co-change-partner",message:`${f} changed, but ${m} did not \u2014 they change together ${r.together}x (${Math.round(b*100)}% of the time)`,remediation:`Update ${m} alongside this change, or confirm the coupling no longer holds.`}))}}function ee(e,t,n){n.checksRun.push("doc-reference");for(let o of w(e,t))t.has(o.doc)||n.findings.push({check:"doc-reference",message:`${o.doc} cites ${o.cited.join(", ")} \u2014 changed in this diff, doc untouched`,remediation:`Re-read ${o.doc} and update its claims, or update its citations.`})}function ie(e,t,n){n.checksRun.push("unused-params");for(let o of _(e,{files:t,limit:50}))n.findings.push({check:"unused-params",message:`${o.shortName} (${o.file}) has trailing unused parameter(s): ${o.unusedTrailing.join(", ")}`,remediation:"Drop the unused trailing parameters and their call-site arguments."})}function ne(e,t,n){n.checksRun.push("new-dead");let o=new $(e);for(let s of t)s.fanIn>0||o.fileKind(s.file)!=="test"&&(d(e,s.file)||p(e,s.symbol,s.file)||n.findings.push({check:"new-dead",message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,remediation:"Wire it up, or remove it before it becomes permanent dead code."}))}function te(e,t){if(!I(u(e))){t.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("baseline");let n=H(e);for(let o of n.newFindings)t.findings.push({check:"baseline",message:`new finding vs committed baseline: ${o}`,remediation:"Fix the finding, or knowingly accept it via health --write-baseline."})}export{j as a,be as b,H as c,xe as d};
|
|
3
|
+
//# sourceMappingURL=chunk-IBM6FXOQ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f}from"./chunk-WC43FMAB.js";import{a as d}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-WC43FMAB.js";import{a as d}from"./chunk-NO2TPMCQ.js";import{d as c}from"./chunk-64UY7VTR.js";import{c as u}from"./chunk-SOGLYIJ4.js";function L(e,n,i={}){let t=f(e,n);if(!t)return null;let r=h(e,t);if(!r||e.isIgnored(r.relative_path))return null;let s=[],m=0,l=g(e,r.relative_path),p=i.semantic===!1?new Map:c(e,l);for(let o of l){let a=S(e,r,o,p.get(o.symbolId)??new Set);m+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:b(a)})}return{file:r.relative_path,symbols:s,totalExternalConsumers:m}}function h(e,n){return e.get(`SELECT id, relative_path FROM documents
|
|
2
2
|
WHERE relative_path = ?
|
|
3
3
|
${e.pathExclusionsFor("documents")}
|
|
4
4
|
LIMIT 1`,n)??null}function g(e,n){return new d(e).definitionsForFile(n).sort((i,t)=>i.startLine-t.startLine||i.endLine-t.endLine)}function S(e,n,i,t){let r=e.all(`SELECT DISTINCT consumer_d.relative_path
|
|
@@ -8,4 +8,4 @@ import{a as f}from"./chunk-WC43FMAB.js";import{a as d}from"./chunk-NOVKLH2F.js";
|
|
|
8
8
|
WHERE m.symbol_id = ?
|
|
9
9
|
AND m.role != 1
|
|
10
10
|
AND c.document_id != ?`,i.symbolId,n.id);return new Set([...r.map(s=>s.relative_path),...[...t].filter(s=>s!==n.relative_path)]).size}function b(e){return e>10?"high":e>0?"medium":"low"}export{L as a};
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-ITUU3VE3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,c as p}from"./chunk-MX6F756F.js";import{a as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,c as p}from"./chunk-MX6F756F.js";import{a as y}from"./chunk-NO2TPMCQ.js";import{c as b}from"./chunk-SOGLYIJ4.js";function P(u,c={}){let{scope:f,minLoc:L=3,scanLimit:l}=c,s=new y(u),r=c.semantic!==!1,t=p(s.productionCallableDefinitions({scope:f,minLoc:L,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),h=s.crossFileCallerMap(t,{semantic:r}),a=new Set(h.keys());for(let e of s.frameworkReferencedSymbolIds(t))a.add(e);let n=s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:r}),m=t.filter(e=>!a.has(e.symbolId)).filter(e=>!n.has(e.symbolId)),I=s.sourceFallbackCallerFiles(m);for(let e of I.keys())a.add(e);let d=m.filter(e=>!a.has(e.symbolId)),C=s.symbolsWithNonSelfCallees(d,{additive:!0,semantic:r});for(let e of C)n.add(e);return d.filter(e=>!n.has(e.symbolId)).sort((e,i)=>o(i)-o(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{P as a};
|
|
2
|
+
//# sourceMappingURL=chunk-K3V6XUTL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as b}from"./chunk-MX6F756F.js";import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as b}from"./chunk-MX6F756F.js";import{a as u}from"./chunk-NO2TPMCQ.js";import{a as f}from"./chunk-EAU4RDFG.js";import{a as c}from"./chunk-PCMVXWDC.js";import{c as l}from"./chunk-SOGLYIJ4.js";function R(o,e={}){let{limit:r=20,scope:s,minFanIn:i=2,minFanOut:n=2,scanLimit:m}=e,p=new u(o);return b(p.productionCallableDefinitions({scope:s,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof m=="number"&&m>0}),m).map(t=>y(o,t,e.semantic!==!1)).filter(t=>t.fanIn>=i&&t.fanOut>=n).sort((t,a)=>a.score-t.score||a.fanIn-t.fanIn).slice(0,r)}function y(o,e,r){let s=new Set(f(o,e,{limit:500,semantic:r}).map(n=>n.file)).size,i=new Set(c(o,e,{limit:500,semantic:r}).filter(n=>n.file!==e.relativePath).map(n=>`${n.symbol}|${n.file}`)).size;return{symbol:e.symbol,shortName:l(e.symbol),fanIn:s,fanOut:i,score:s*i,definedIn:e.relativePath}}export{R as a};
|
|
2
|
+
//# sourceMappingURL=chunk-L6TOEQ2M.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-NO2TPMCQ.js";import{a as h}from"./chunk-PCMVXWDC.js";import{o as S}from"./chunk-6ZFKI5EP.js";import{a as d,b}from"./chunk-7I6KNKE3.js";import{c as m,v as y}from"./chunk-SOGLYIJ4.js";function v(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=d(e,o);return r?c==="backward"?w(e,r,s,{semantic:l.semantic!==!1}):M(e,r,{semantic:l.semantic!==!1}):null}function w(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let p of t){let g=h(e,p,{semantic:c.semantic});for(let a of g){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function M(e,o,l){let c=new Set,s=[],r=new u(e);for(let t of S(e,o,{semantic:l.semantic})){if(s.length>=30)break;let n=t.enclosingSymbol??y(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LBAMALDV.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{c as k,d as R}from"./chunk-SQ6VENQY.js";import{d as E}from"./chunk-UIWAZ2NT.js";import{a as w,c as x}from"./chunk-T4AK46CM.js";import{a as N}from"./chunk-NO2TPMCQ.js";import{c as u}from"./chunk-SOGLYIJ4.js";import{execFileSync as $}from"child_process";var A=5;function U(n,l={}){let{base:s="HEAD",minContainment:m=.7,minCallees:c=3,maxHelpers:o=10,limit:a=20}=l,I=l.semantic!==!1,g=x(n,{base:s}),t={available:g.note!==w,base:s,changedFiles:g.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!t.available||g.changedFiles.length===0)return t;let v=new N(n),C=new Set(g.changedFiles),h=O(n,v,C,s);if(h.length===0)return t;let S=h.slice(0,o);h.length>o&&(t.note=`helper scoring capped at ${o} of ${h.length} new symbols`);let d=k(n,{minCallees:Math.min(3,c),semantic:I}),P=v.calleeMap(S,{semantic:I}),D=S.map(e=>({def:e,callees:R((P.get(e.symbolId)??[]).map(i=>i.symbol))})),b=new Map;for(let e of d)for(let i of e.callees)b.set(i,(b.get(i)??0)+1);let L=Math.max(8,Math.ceil(Math.sqrt(d.length)));for(let{def:e,callees:i}of D){let F=u(e.symbol);if(i.size<c){t.skipped.push({helperShortName:F,helperFile:e.relativePath,reason:`fewer than ${c} meaningful callees \u2014 too small to score`});continue}let M=H(n,e.symbolId);if(M.length===0){t.skipped.push({helperShortName:F,helperFile:e.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}t.helpersChecked+=1;let f=[];for(let r of d){if(r.symbol===e.symbol||C.has(r.file)||r.callees.has(e.symbol))continue;let p=E(i,r.callees);if(p<m)continue;let _=[...i].filter(y=>r.callees.has(y));_.some(y=>(b.get(y)??0)<=L)&&f.push({symbol:r.symbol,shortName:u(r.symbol),file:r.file,containment:p,sharedCallees:_.map(u).sort()})}f.length!==0&&(f.sort((r,p)=>p.containment-r.containment||r.file.localeCompare(p.file)),t.findings.push({helperSymbol:e.symbol,helperShortName:F,helperFile:e.relativePath,migratedFiles:M.sort(),leftovers:f.slice(0,A)}))}return t.findings.sort((e,i)=>(i.leftovers[0]?.containment??0)-(e.leftovers[0]?.containment??0)||e.helperFile.localeCompare(i.helperFile)),t.findings=t.findings.slice(0,a),t}function O(n,l,s,m){let c=new Map;return l.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(o=>{if(!s.has(o.relativePath))return!1;let a=c.get(o.relativePath);return a===void 0&&(a=T(n.config.projectRoot,m,o.relativePath),c.set(o.relativePath,a)),a===null||!new RegExp(`\\b${j(o.leaf)}\\b`).test(a)})}function T(n,l,s){try{return $("git",["show",`${l}:./${s}`],{encoding:"utf-8",cwd:n,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function H(n,l){return n.all(`SELECT DISTINCT ref_d.relative_path
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
5
|
+
WHERE m.symbol_id = ?
|
|
6
|
+
AND m.role != 1
|
|
7
|
+
${n.pathExclusionsFor("ref_d")}`,l).map(m=>m.relative_path)}function j(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{U as a};
|
|
8
|
+
//# sourceMappingURL=chunk-LR7E2ATW.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as I}from"./chunk-JTCEWV7Q.js";import{a as u}from"./chunk-B32FX5KB.js";import{a as F}from"./chunk-OMNT7E2T.js";import{a as k}from"./chunk-AQYBOORI.js";import{a as z}from"./chunk-SLX5XBCD.js";import{a as _}from"./chunk-K3V6XUTL.js";import{a as M}from"./chunk-Y3RUPPIU.js";import{a as B}from"./chunk-U254PV4S.js";import{b as $}from"./chunk-SQ6VENQY.js";import{a as T}from"./chunk-2DVVHNC3.js";import{a as x,b as R}from"./chunk-YO6DU7QZ.js";import{b as A}from"./chunk-I66MQD5U.js";import{b as E,c as P}from"./chunk-R3G6ERW7.js";import{a as L}from"./chunk-VHENVDS2.js";import{a as D}from"./chunk-EKP7XJ6L.js";import{e as C,f as H}from"./chunk-TQTVM27C.js";function y(e){let i=K(e),{breakdown:t}=Z(e),r=O(t,"risk"),n=O(t,"hygiene");return{score:Math.min(r,n),riskScore:r,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,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null},axes:Q(e),validation:X(e),suppressions:e.suppressions,actions:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function Q(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:Y(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function Y(e){let i=e.gitEvidence?.fileStats;return i?e.complexity.top.map(t=>{let r=t.file?i[t.file]?.changes??0:0;return{...t,changes:r,weighted:p(t.score*Math.log2(1+r))}}).sort((t,r)=>r.weighted-t.weighted):null}function X(e){let i=e.gitEvidence?.fileStats;if(!i)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[]},r=new Set(Object.values(t).flat()),n=0,o=0,a=0;for(let[f,d]of Object.entries(i))r.has(f)?n+=d.fixChanges:(o+=d.fixChanges,a+=1);let m=r.size>0?p(n/r.size):0,l=a>0?p(o/a):0,g={};for(let[f,d]of Object.entries(t)){let h=new Set(d);if(h.size===0)continue;let b=0;for(let q of h)b+=i[q]?.fixChanges??0;let w=p(b/h.size);g[f]={flaggedFiles:h.size,fixDensity:w,lift:l>0?p(w/l):null}}return{flaggedFiles:r.size,flaggedFixDensity:m,baselineFixDensity:l,ratio:r.size>0&&l>0?p(m/l):null,byCategory:g}}function p(e){return Math.round(e*100)/100}function K(e){let i=[];if(e.dead.count>0&&i.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&&i.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&&i.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&&i.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.extractCount>0&&i.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&i.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&i.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 n=[];e.stale.unused>0&&n.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&n.push(`${e.stale.singleUse} single-consumer (not in types file)`),i.push({category:"Stale abstractions",evidence:"heuristic",description:`${n.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let n=[];e.drift.unusedImports>0&&n.push(`${e.drift.unusedImports} unused imports`),e.drift.layerViolations>0&&n.push(`${e.drift.layerViolations} layer violations`),i.push({category:"Structural drift",evidence:"heuristic",description:n.join(", "),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 n=e.gitEvidence.hiddenCoupling.top[0];i.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a dependency edge`+(n?` (e.g. ${n.fileA} \u2194 ${n.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},r={low:3,medium:2,high:1};return i.sort((n,o)=>{let a=t[n.impact]*r[n.effort];return t[o.impact]*r[o.effort]-a}),i}var J={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk",similar:"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene"};function O(e,i){let t=e.filter(r=>r.kind===i).reduce((r,n)=>r+n.points,0);return Math.max(0,Math.min(100,100-t))}function Z(e){let i=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),r=[],n=(d,h,b)=>{h>0&&r.push({axis:d,points:h,detail:b,kind:J[d]??"hygiene"})},o=e.dead.count/t;n("dead-code",Math.min(20,Math.round(o*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let a=e.isolated.count/t;n("isolated",Math.min(10,Math.round(a*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 m=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(m)),`${e.similarCount} similar function pair(s)`);let l=e.extractCount/t*1e3;n("extract",Math.min(5,Math.round(l/2)),`${e.extractCount} extraction candidate(s)`),n("wrappers",Math.min(3,e.wrappers.count),`${e.wrappers.count} wrapper candidate(s)`),n("passthroughs",Math.min(3,e.passthroughs.count),`${e.passthroughs.count} passthrough candidate(s)`);let g=e.stale.count/Math.max(t*.1,1);n("stale-abstractions",Math.min(8,Math.round(g*10)),`${e.stale.count} stale abstraction(s)`);let f=e.drift.count/i;return n("drift",Math.min(5,Math.round(f*50)),`${e.drift.count} drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence&&n("hidden-coupling",Math.min(5,e.gitEvidence.hiddenCoupling.pairCount),`${e.gitEvidence.hiddenCoupling.pairCount} co-changing pair(s) without a dependency edge`),{breakdown:r}}import{getHeapStatistics as ee}from"v8";var te=64*1024*1024;function S(){let e=globalThis.gc;if(!e)return;let i=ee();i.heap_size_limit-i.used_heap_size<te||e()}var ie=50,re=75e3,ne=5e3,V=2500,oe=["overview","dead","isolated","cycles","similar","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions"],N={overview:(e,i,t,r)=>({phase:"overview",statsResult:r,warnings:t.warnings}),dead:(e,i,t)=>({phase:"dead",dead:se(e,i,t)}),isolated:(e,i,t)=>({phase:"isolated",isolated:ce(e,i,t)}),cycles:(e,i,t)=>({phase:"cycles",realCycleCount:ue(e,i,t)}),similar:(e,i,t)=>({phase:"similar",similarCount:le(e,i,t)}),"extract-candidates":(e,i,t)=>({phase:"extract-candidates",extractCount:de(e,i,t)}),"wrapper-candidates":(e,i,t)=>({phase:"wrapper-candidates",wrappers:he(e,i,t)}),"passthrough-candidates":(e,i,t)=>({phase:"passthrough-candidates",passthroughs:pe(e,i,t)}),"stale-abstractions":(e,i,t)=>({phase:"stale-abstractions",stale:me(e,i,t)}),drift:(e,i,t)=>({phase:"drift",drift:be(e,i,t)}),"complexity-hotspots":(e,i,t)=>({phase:"complexity-hotspots",complexity:Ce(e,i,t)}),"git-evidence":(e,i,t)=>({phase:"git-evidence",gitEvidence:fe(e,t)}),suppressions:(e,i,t)=>({phase:"suppressions",suppressions:ge(e,t)})};function Ue(e,i={}){return G(e,i.full===!0,(t,r)=>{let n=ae(e,i.scope,t,r);return y(n)})}function qe(e,i,t={}){return G(e,t.full===!0,(r,n)=>N[i](e,t.scope,n,r))}function G(e,i,t){let r=k(e),n=He(r,i);try{return t(r,n)}finally{x(e,{semanticProvider:!0}),S()}}function Qe(e){return y(W(e))}function W(e){let i=s(e,"overview");return{statsResult:i.statsResult,warnings:i.warnings,dead:s(e,"dead").dead,isolated:s(e,"isolated").isolated,realCycleCount:s(e,"cycles").realCycleCount,similarCount:s(e,"similar").similarCount,extractCount:s(e,"extract-candidates").extractCount,wrappers:s(e,"wrapper-candidates").wrappers,passthroughs:s(e,"passthrough-candidates").passthroughs,stale:s(e,"stale-abstractions").stale,drift:s(e,"drift").drift,complexity:s(e,"complexity-hotspots").complexity,gitEvidence:j(e,"git-evidence")?.gitEvidence??null,suppressions:j(e,"suppressions")?.suppressions??null}}function j(e,i){return e.find(t=>t.phase===i)}function s(e,i){let t=e.find(r=>r.phase===i);if(!t)throw new Error(`Missing health phase result: ${i}`);return t}function ae(e,i,t,r){return W(oe.map(n=>N[n](e,i,r,t)))}function se(e,i,t){return c(e,t,"dead",()=>{let r=R(e,{scope:i,...u.dead,scanLimit:t.candidateScanLimit});return v(Se(e,r.symbols))})}function ce(e,i,t){return c(e,t,"isolated",()=>{let r=_(e,{scope:i,...u.isolated,scanLimit:t.candidateScanLimit});return v(ve(e,r))})}function ue(e,i,t){return c(e,t,"cycles",()=>D(e,{scope:i}).filter(n=>n.kind==="real").length)}function le(e,i,t){return c(e,t,"similar",()=>$(e,{scope:i,...u.similar,scanLimit:t.candidateScanLimit}).length)}function de(e,i,t){return c(e,t,"extract-candidates",()=>B(e,{scope:i,...u.extract,scanLimit:t.candidateScanLimit}).length)}function he(e,i,t){return U(e,t,"wrapper-candidates",()=>z(e,{scope:i,...u.wrappers,scanLimit:t.candidateScanLimit}))}function pe(e,i,t){return U(e,t,"passthrough-candidates",()=>M(e,{scope:i,...u.passthroughs,scanLimit:t.candidateScanLimit}))}function me(e,i,t){return c(e,t,"stale-abstractions",()=>{let r=F(e,{scope:i,...u.stale,scanLimit:t.candidateScanLimit}),n=r.filter(o=>o.consumers===0).length;return{count:r.length,loc:r.reduce((o,a)=>o+a.loc,0),files:[...new Set(r.map(o=>o.file))],unused:n,singleUse:r.length-n}})}function fe(e,i){return c(e,i,"git-evidence",()=>{let t=E(e);if(!t)return null;let r=A(e,void 0,{limit:50}),n={};for(let[o,a]of t)n[o]={changes:a.changes,fixChanges:a.fixChanges};return{amplification:P(e),hiddenCoupling:{pairCount:r.findings.length,top:r.findings.slice(0,5).map(o=>({fileA:o.fileA,fileB:o.fileB,together:o.together,confidence:o.confidence}))},fileStats:n}})}function ge(e,i){return c(e,i,"suppressions",()=>{let t=I(e);return{total:t.total,byCategory:{...t.byCategory}}})}function be(e,i,t){return c(e,t,"drift",()=>{let r=T(e,{scope:i,...u.drift});return{count:r.unusedImports+r.layerViolations,unusedImports:r.unusedImports,layerViolations:r.layerViolations}})}function Ce(e,i,t){return c(e,t,"complexity-hotspots",()=>{let r=L(e,{scope:i,minLoc:10,limit:10,scanLimit:t.candidateScanLimit,semantic:!1});return{top:r.slice(0,5).map(n=>({symbol:n.shortName,score:n.score,file:n.file})),extremeCount:r.filter(n=>n.score>ie).length}})}function He(e,i){return e.symbols>=re||e.documents>=ne?i?{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:["Large index detected; running unbounded health analyses because --full was supplied."]}:{candidateScanLimit:V,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${V} symbols. Run "scip-query health --full" for unbounded candidate counts.`]}:{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:[]}}function xe(e,i){i.releaseCachesBetweenPhases&&(x(e),S())}function c(e,i,t,r){ye(t);try{return r()}finally{xe(e,i)}}function U(e,i,t,r){return c(e,i,t,()=>v(r()))}function ye(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Se(e,i){return i.filter(t=>!C(e,t.relativePath)&&!H(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function ve(e,i){return i.filter(t=>!C(e,t.relativePath)&&!H(e,t.symbol,t.relativePath))}function v(e){let i=new Set;for(let t of e){let r=t.relativePath??t.file;r&&i.add(r)}return{count:e.length,loc:e.reduce((t,r)=>t+r.loc,0),files:[...i]}}export{oe as a,Ue as b,qe as c,Qe as d};
|
|
2
|
+
//# sourceMappingURL=chunk-NM3BZXHA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{a as R,e as T,f as k}from"./chunk-TQTVM27C.js";import{a as C}from"./chunk-RIXOMSOR.js";import{b as V,c as j,d as G}from"./chunk-EAU4RDFG.js";import{c as B}from"./chunk-PCMVXWDC.js";import{a as K,k as I,l as O}from"./chunk-6ZFKI5EP.js";import{c as M}from"./chunk-PBGTMPJ7.js";import{f as P,g as N,i as A,j as w,r as E,t as q}from"./chunk-SOGLYIJ4.js";import{b as h,c as m,d as v,f as x,k as b}from"./chunk-WQFOZIID.js";import{a as L}from"./chunk-NN3O7TPH.js";function H(i,e,t){let a=e.identifierResolution==="strict"?I:O;for(let n of e.paths)if(!(!m(n)&&!(e.includeVueSfc&&v(n)))&&!i.isIgnored(n)&&!e.skipPath?.(n))try{let l=(r,c,p,d)=>{if(e.candidateNames&&!e.candidateNames.has(r))return;let y=e.resolveTargets?e.resolveTargets({sourceFile:n,name:r,kind:c,defaultTargets:d}):d();for(let S of y)t({sourceFile:n,name:r,target:S,occurrences:p,kind:c})},f=K(i,n);for(let[r,c]of f)l(r,"identifier",c.length,()=>a(i,n,r));for(let r of b(i,n,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let c=r.kind==="cross-language-dispatch"?()=>I(i,n,r.name):()=>a(i,n,r.name);l(r.name,r.kind,r.occurrences,c)}}finally{e.afterPath?.(n)}}var W=class{constructor(e){this.db=e}db;scopedDefinitions(e){return q(this.db,e)}definitionsForFile(e){return E(this.db,e)}productionCallableDefinitions(e={}){let{scope:t,minLoc:a=1,maxLoc:n=Number.POSITIVE_INFINITY,excludeSymbol:o,excludeEntrySurfaces:l=!1,excludeTypesFiles:f=!1,excludeRootedSymbols:r=!1,requireFunctionLikeSymbol:c=!1,requireCallableSymbol:p=!1,excludeRustTraitImplMembers:d=!1,includeSuppressed:y=!1,sortByLocDesc:S=!1}=e,g=[];for(let s of this.scopedDefinitions(t)){let u=s.relativePath;if(this.db.isIgnored(u)||l&&T(this.db,u)||!Y(s,{requireFunctionLikeSymbol:c,requireCallableSymbol:p})||o!==void 0&&s.symbol===o)continue;let F=D(s);F<a||F>n||f&&_(u)||r&&k(this.db,s.symbol,u)||d&&A(s.symbol)||R(u)!=="test"&&(w(s.symbol)||!y&&h(this.db,u,s.startLine)||g.push(s))}return S?g.sort((s,u)=>D(u)-D(s)):g}calleeMap(e,t={}){return B(this.db,e,t)}crossFileCallerMap(e,t={}){return V(this.db,e,t)}sourceFallbackCallerFiles(e){return j(this.db,e)}callerFileMap(e,t={}){return G(this.db,e,t)}frameworkReferencedSymbolIds(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let o=t.get(n.leaf)??[];o.push(n.symbolId),t.set(n.leaf,o)}let a=new Set;for(let n of L(this.db,{includeIgnored:!1}))if(m(n)==="rust")for(let{name:o}of b(this.db,n,{includeRustAttributeNames:!0}))for(let l of t.get(o)??[])a.add(l);return a}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let a=new Map(e.map(o=>[o.symbolId,o.symbol])),n=this.calleeMap(e,t);return new Set([...n.entries()].filter(([o,l])=>{let f=a.get(o);return l.some(r=>r.symbol!==f)}).map(([o])=>o))}fileDependencyGraph(e){return C(this.db,e)}fileKind(e){return R(e)}hasSuppressionComment(e){return h(this.db,e.relativePath,e.startLine)}sourceFiles(){return M(this.db)}scanSourceReferences(e,t){H(this.db,e,t)}callableSignature(e){let t=x(this.db,e.relativePath)?.callables.find(a=>a.startLine===e.startLine&&a.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};function Y(i,e){return e.requireCallableSymbol?P(i.symbol):e.requireFunctionLikeSymbol?N(i.symbol):i.isFunctionLike}function D(i){return i.endLine-i.startLine+1}function _(i){return(i.split("/").pop()??"").includes("types")}export{W as a};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-NO2TPMCQ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h,b as F,c as w}from"./chunk-CVRXOP6M.js";import{a as M}from"./chunk-V76FCF5F.js";import{a as b}from"./chunk-MX6F756F.js";import{a as P}from"./chunk-
|
|
1
|
+
import{a as h,b as F,c as w}from"./chunk-CVRXOP6M.js";import{a as M}from"./chunk-V76FCF5F.js";import{a as b}from"./chunk-MX6F756F.js";import{a as P}from"./chunk-NO2TPMCQ.js";import{a as S,f as D}from"./chunk-TQTVM27C.js";import{a as L,c as v,d as p}from"./chunk-SOGLYIJ4.js";import{a as y,j as I}from"./chunk-WQFOZIID.js";function ie(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:a}=e??{},f=e?.semantic!==!1,o=new P(t),d=o.scopedDefinitions(n),g=V(o,n),x={high:0,medium:1,low:2};return M({candidates:()=>$(t,o,d,{minLoc:i,maxLoc:s}),orderCandidates:(c,u)=>b(u)-b(c)||c.relativePath.localeCompare(u.relativePath),scanLimit:a,prepare:c=>({consumerFileMap:A(o,c,{semantic:f}),singletonBackedClassIds:O(t,o,d,c,{semantic:f}),candidateIndex:B(c)}),evaluate:(c,u)=>{if(u.singletonBackedClassIds.has(c.symbolId))return null;let m=N(t,c,u.consumerFileMap,u.candidateIndex);if(m.transitivelyReachable||m.realConsumers.length>1||m.realConsumers.length===0&&m.barrelConsumers>0||!Z(m.definition,m.realConsumers.length,g))return null;let C=j(t,m);return!l&&C.confidence==="low"?null:C},orderResults:(c,u)=>x[c.confidence]-x[u.confidence]||u.loc-c.loc||c.file.localeCompare(u.file)||c.startLine-u.startLine,limit:r})}function $(t,e,n,i){return n.filter(s=>s.isTypeLike&&b(s)>=i.minLoc).filter(s=>b(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>S(s.relativePath)!=="test").filter(s=>!D(t,s.symbol,s.relativePath)).filter(s=>!H(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function A(t,e,n){return h(t,e,{semantic:n.semantic})}function B(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=p(n.symbol);s&&i.set(s,n)}return e}function N(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(d=>d!==e.relativePath&&!t.isIgnored(d)),{realConsumers:l,barrelConsumers:a,importOnlyConsumers:f}=F(t,e,r),o=_(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:a+f,transitivelyReachable:o}}function j(t,e){let n=k(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:q(t,e.definition),{confidence:s,reason:r}=G(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:v(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:b(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r}}function O(t,e,n,i,s){let r=W(t,U(n),i),l=r.map(o=>o.singleton);if(r.length===0)return new Set;let a=h(e,l,{semantic:s.semantic}),f=new Set;for(let{singleton:o,classId:d}of r)E(t,o,a)&&f.add(d);return f}function U(t){let e=new Map;for(let n of t){let i=p(n.symbol);i&&e.set(R(n.relativePath,i),n)}return e}function W(t,e,n){let i=[];for(let s of n){let r=z(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function z(t,e,n){if(k(t,n.relativePath,n.startLine)!=="class")return null;let i=p(n.symbol);if(!i)return null;let s=K(t,n.relativePath,i);return s?e.get(R(n.relativePath,s))??null:null}function E(t,e,n){let i=p(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!w(t,r,i))}function R(t,e){return`${t}\0${e}`}function K(t,e,n){let i=y(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function V(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function H(t){let e=L(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function Z(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function _(t,e,n,i){let s=I(t,e.relativePath),r=p(e.symbol);if(!r)return!1;let l=s.get(r);if(!l||l.size===0)return!1;let a=i.get(e.relativePath);if(!a)return!1;for(let f of l){let o=a.get(f);if(!o)continue;let d=n.get(o.symbolId);if(d){for(let g of d)if(g!==e.relativePath&&!t.isIgnored(g))return!0}}return!1}function k(t,e,n){let i=y(t,e);if(!i)return"other";let s=i.split(`
|
|
2
2
|
`),r=Math.max(0,n-2),l=Math.min(s.length-1,n+2);for(let a=r;a<=l;a++){let o=(s[a]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(o))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(o))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(o))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(o))return"enum"}return"other"}function q(t,e){let n=y(t,e.relativePath);if(!n)return!1;let i=p(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),l=n.split(`
|
|
3
3
|
`);for(let a=0;a<l.length;a++)if(!(a>=e.startLine&&a<=e.endLine)&&r.test(l[a]??""))return!0;return!1}function G(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{ie as a};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-OMNT7E2T.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{d as b}from"./chunk-VDZL45XI.js";import{execFileSync as y}from"child_process";var A=2e3,F=50,R=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i;function d(e){let n=b(e,{clearGroups:["whole-project"]});return(t,i)=>{let s=M(t.config.projectRoot);if(!s)return null;let r=n.has(t)?n.get(t,()=>({head:"",value:null})):null;return r&&r.head===s?r.value:(n.invalidate(t),n.get(t,()=>({head:s,value:i(t.config.projectRoot,s)})).value)}}var S=d("git-commit-history");function p(e){return S(e,w)}function M(e){try{return g(e,["rev-parse","HEAD"]).trim()||null}catch{return null}}function g(e,n){return y("git",["-C",e,...n],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"]})}function w(e,n){let t;try{t=g(e,["log","--no-merges","--name-only","-n",String(A),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let i=[],s=0;for(let r of t.split("")){if(r.trim()==="")continue;let c=r.indexOf(`
|
|
2
|
+
`),f=c>=0?r.slice(0,c):r,[a,o,l]=f.split("\0");if(!a||!o)continue;let m=c>=0?r.slice(c+1).split(`
|
|
3
|
+
`).map(u=>u.trim()).filter(u=>u!==""):[];if(m.length>F){s+=1;continue}i.push({hash:a,timestamp:Number(o)||0,subject:l??"",files:m})}return{head:n,commits:i,skippedBulkCommits:s}}function k(e){return R.test(e.subject)}function B(e){let n=p(e);if(!n)return null;let t=new Map;for(let i of n.commits){let s=k(i);for(let r of i.files){let c=t.get(r)??{changes:0,fixChanges:0,lastChangedAt:0};c.changes+=1,s&&(c.fixChanges+=1),i.timestamp>c.lastChangedAt&&(c.lastChangedAt=i.timestamp),t.set(r,c)}}return t}function v(e){let n=p(e);if(!n||n.commits.length===0)return null;let t=n.commits.map(i=>i.files.length).filter(i=>i>0).sort((i,s)=>i-s);return t.length===0?null:{medianFilesPerCommit:x(t,.5),p90FilesPerCommit:x(t,.9),commitsAnalyzed:t.length}}function x(e,n){let t=Math.min(e.length-1,Math.floor(e.length*n));return e[t]}var P=d("git-tracked-files");function _(e){return P(e,n=>{try{let t=g(n,["ls-files"]);return new Set(t.split(`
|
|
4
|
+
`).map(i=>i.trim()).filter(i=>i!==""))}catch{return null}})}var T=d("git-file-adds");function E(e){return T(e,n=>j(n))}function j(e){let n;try{n=g(e,["log","--no-merges","--diff-filter=A","--name-only","-n",String(A),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let t=new Map,i=-1;for(let s of n.split("")){if(s.trim()==="")continue;i+=1;let r=s.indexOf(`
|
|
5
|
+
`),c=r>=0?s.slice(0,r):s,[,f]=c.split("\0"),a=Number(f)||0;if(!(r<0))for(let o of s.slice(r+1).split(`
|
|
6
|
+
`)){let l=o.trim();l!==""&&t.set(l,{commitsAgo:i,addedAt:a})}}return t}function I(e,n={}){let{minTogether:t=4,minConfidence:i=.6}=n,s=p(e);if(!s)return null;let r=new Map,c=new Map;for(let a of s.commits){let o=[...new Set(a.files)].sort();for(let l of o)r.set(l,(r.get(l)??0)+1);for(let l=0;l<o.length;l++)for(let m=l+1;m<o.length;m++){let u=`${o[l]}\0${o[m]}`;c.set(u,(c.get(u)??0)+1)}}let f=[];for(let[a,o]of c){if(o<t)continue;let[l,m]=a.split("\0"),u=r.get(l)??o,h=r.get(m)??o,C=Math.max(o/u,o/h);C<i||f.push({fileA:l,fileB:m,together:o,confidence:C,changesA:u,changesB:h})}return f.sort((a,o)=>o.together-a.together||o.confidence-a.confidence||a.fileA.localeCompare(o.fileA)),f}export{p as a,B as b,v as c,_ as d,E as e,I as f};
|
|
7
|
+
//# sourceMappingURL=chunk-R3G6ERW7.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b}from"./chunk-SQ6VENQY.js";import{e as d}from"./chunk-R3G6ERW7.js";function C(m,r={}){let{windowCommits:a=100,minSimilarity:u=.7,limit:c=30,scope:g,scanLimit:f}=r,o=d(m);if(!o)return{available:!1,windowCommits:a,findings:[]};let A=b(m,{scope:g,minSimilarity:u,limit:c*5,crossFileOnly:!0,scanLimit:f,semantic:r.semantic}),n=[];for(let e of A){let i=o.get(e.fileA)?.commitsAgo??null,t=o.get(e.fileB)?.commitsAgo??null,s=i!==null&&i<=a,h=t!==null&&t<=a;if(!(!s&&!h)){if(s&&h){let l=(i??0)<=(t??0);n.push({kind:"twin",echoSymbol:l?e.shortNameA:e.shortNameB,echoFile:l?e.fileA:e.fileB,echoAgeCommits:(l?i:t)??0,establishedSymbol:l?e.shortNameB:e.shortNameA,establishedFile:l?e.fileB:e.fileA,establishedAgeCommits:l?t:i,similarity:e.similarity,sharedCallees:e.sharedCallees})}else n.push({kind:"echo",echoSymbol:s?e.shortNameA:e.shortNameB,echoFile:s?e.fileA:e.fileB,echoAgeCommits:(s?i:t)??0,establishedSymbol:s?e.shortNameB:e.shortNameA,establishedFile:s?e.fileB:e.fileA,establishedAgeCommits:s?t:i,similarity:e.similarity,sharedCallees:e.sharedCallees});if(n.length>=c)break}}return n.sort((e,i)=>(e.kind===i.kind?0:e.kind==="echo"?-1:1)||i.similarity-e.similarity),{available:!0,windowCommits:a,findings:n}}export{C as a};
|
|
2
|
+
//# sourceMappingURL=chunk-SEZZ24IG.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as D,b as L}from"./chunk-CVRXOP6M.js";import{a as M}from"./chunk-V76FCF5F.js";import{a as C,b as F}from"./chunk-MX6F756F.js";import{a as I}from"./chunk-
|
|
1
|
+
import{a as D,b as L}from"./chunk-CVRXOP6M.js";import{a as M}from"./chunk-V76FCF5F.js";import{a as C,b as F}from"./chunk-MX6F756F.js";import{a as I}from"./chunk-NO2TPMCQ.js";import{a as b}from"./chunk-6ZFKI5EP.js";import{c as m,d,j as p,v as g}from"./chunk-SOGLYIJ4.js";import{basename as u,extname as f}from"path";function q(t,n){let{scope:e,maxLoc:r=15,limit:o=30,scanLimit:a}=n??{},i=new I(t),s=k(i.fileDependencyGraph(e));return M({candidates:()=>x(i,e,r),orderCandidates:F,scanLimit:a,prepare:l=>({callerFileMap:D(i,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,c)=>h(t,i,l,c),orderResults:(l,c)=>c.callerFanIn-l.callerFanIn||c.loc-l.loc,limit:o})}function h(t,n,e,r){let o=S(t,n,e,r.callerFileMap);if(o.length!==1)return null;let a=o[0],i=y(t,e.symbolId,a);if(!i)return null;let s=v(n,t,a,e.symbol,i);if(s&&p(s.symbol))return null;let{fanIn:l,source:c}=P(r.callerFileMap,r.reverseFanIn,a,s);return(c==="function"?l<=3:l<=5)?null:{symbol:e.symbol,shortName:m(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:C(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?m(s.symbol):u(a),callerFanIn:l}}function x(t,n,e){return t.productionCallableDefinitions({scope:n,minLoc:2,maxLoc:e,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0})}function S(t,n,e,r){let o=u(e.relativePath,f(e.relativePath)),a=[...r.get(e.symbolId)??[]].filter(i=>i!==e.relativePath).filter(i=>u(i,f(i))!==o).filter(i=>{let s=n.fileKind(i);return s!=="barrel"&&s!=="entry"&&s!=="test"});return L(t,e,a).realConsumers}function y(t,n,e){return t.get(`SELECT c.start_line, c.end_line
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d ON c.document_id = d.id
|
|
5
5
|
WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
|
|
6
6
|
LIMIT 1`,n,e)}function v(t,n,e,r,o){let a=t.definitionsForFile(e),i=_(n,e,r,o.start_line,o.end_line);return g(a,i)}function P(t,n,e,r){if(r?.isFunctionLike){let o=[...t.get(r.symbolId)??[]].filter(a=>a!==r.relativePath);if(o.length>0)return{fanIn:o.length,source:"function"}}return{fanIn:N(n,e),source:"file"}}function _(t,n,e,r,o){let a=d(e);if(!a)return r;let i=b(t,n).get(a);if(!i||i.length===0)return r;for(let s of i)if(s>=r&&s<=o)return s;return r}function k(t){let n=new Map;for(let[e,r]of t){n.has(e)||n.set(e,n.get(e)??0);for(let o of r)n.set(o,(n.get(o)??0)+1)}return n}function N(t,n){let e=t.get(n)??0;if(e>0)return e;let r=u(n,f(n)),o=0;for(let[a,i]of t)a!==n&&u(a,f(a))===r&&i>o&&(o=i);return o}export{q as a};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-SLX5XBCD.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as k,b as y,e as R,f as N}from"./chunk-UIWAZ2NT.js";import{c as M}from"./chunk-MX6F756F.js";import{a as x}from"./chunk-NO2TPMCQ.js";import{a as P}from"./chunk-PCMVXWDC.js";import{a as A}from"./chunk-7I6KNKE3.js";import{c as p,d as q,g as w}from"./chunk-SOGLYIJ4.js";import{a as z}from"./chunk-WQFOZIID.js";function re(e,i,t={}){let{minSimilarity:s=.4,limit:r=20}=t,a=Z(e,i,{semantic:t.semantic!==!1});if(!a)return[];if(!w(a.symbol))return[];let n=O(e,a,s,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return n.length>0?n.slice(0,r):W(e,i,{minSimilarity:s,limit:r})}function O(e,i,t,s){let r=$(e,{minCallees:3,excludeSymbol:i.symbol,scanLimit:s.scanLimit,semantic:s.semantic}),a=R([i,...r].map(o=>o.callees)),n=[];for(let o of r){if(o.callees.size<3)continue;let l=T(i,o,a,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0});l&&n.push(l)}return n.sort((o,l)=>l.similarity-o.similarity),n}function T(e,i,t,s){let{similarity:r,significantShared:a}=N(e.callees,i.callees,t);if(r<s.minSimilarity)return null;let n=k(e.callees,i.callees).size;if(a.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let o=a.length>0?a:[...k(e.callees,i.callees)];return{symbolA:e.symbol,shortNameA:p(e.symbol),fileA:e.file,symbolB:i.symbol,shortNameB:p(i.symbol),fileB:i.file,similarity:r,similarityBasis:"callees",sharedCallees:o.map(p),uniqueToA:[...y(e.callees,i.callees)].map(p),uniqueToB:[...y(i.callees,e.callees)].map(p)}}function ae(e,i={}){let{minSimilarity:t=.5,limit:s=20,scope:r,minCallees:a=4,crossFileOnly:n=!1,scanLimit:o}=i,l=$(e,{minCallees:a,scope:r,scanLimit:o,semantic:i.semantic!==!1}),c=R(l.map(m=>m.callees)),u=new Map;for(let m of l)for(let b of m.callees)u.set(b,(u.get(b)??0)+1);let h=Math.max(8,Math.ceil(Math.sqrt(l.length))),F=new Map;for(let m=0;m<l.length;m+=1)for(let b of l[m].callees){if((u.get(b)??0)>h)continue;let g=F.get(b);g||(g=[],F.set(b,g)),g.push(m)}let C=[],B=new Set;e:for(let m=0;m<l.length;m+=1){let b=l[m],g=new Set;for(let D of b.callees){let S=F.get(D);if(S)for(let f of S)f>m&&g.add(f)}for(let D of g){let S=`${m}|${D}`;if(B.has(S))continue;B.add(S);let f=l[D];if(n&&b.file===f.file)continue;if(b.paramCount>=0&&f.paramCount>=0){let j=Math.abs(b.paramCount-f.paramCount),_=Math.max(2,Math.ceil(Math.max(b.paramCount,f.paramCount)*.5));if(j>_)continue}let L=T(b,f,c,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4});if(L&&(C.push(L),C.length>s*5))break e}}return C.sort((m,b)=>b.similarity-m.similarity),C.slice(0,s)}var V=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Z(e,i,t){let s=A(e,i),r=new x(e);if(!s)return null;let a=P(e,s,{semantic:t.semantic});return{symbol:s.symbol,file:s.relativePath,callees:E(a.map(n=>n.symbol)),paramCount:r.callableSignature(s)?.paramCount??-1}}function $(e,i){let{minCallees:t,scope:s,excludeSymbol:r,scanLimit:a}=i,n=new x(e),o=M(n.productionCallableDefinitions({scope:s,minLoc:5,excludeSymbol:r,sortByLocDesc:typeof a=="number"&&a>0}),a),l=n.calleeMap(o,{semantic:i.semantic!==!1});return o.map(c=>({symbol:c.symbol,file:c.relativePath,callees:E((l.get(c.symbolId)??[]).map(u=>u.symbol)),paramCount:n.callableSignature(c)?.paramCount??-1})).filter(c=>c.callees.size>=t)}function E(e){return new Set([...e].filter(i=>!U(i)))}function U(e){return V.some(i=>e.includes(i))}function W(e,i,t){let s=G(e,i);if(!s||s.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,a=[];for(let n of H(e)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let o=k(s.tokens,n.tokens);if(o.size<2)continue;let l=new Set([...s.tokens,...n.tokens]),c=l.size>0?o.size/l.size:0;c<r||a.push({symbolA:s.symbol,shortNameA:p(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:c,similarityBasis:"source-tokens",sharedCallees:[...o].sort(),uniqueToA:[...y(s.tokens,n.tokens)].sort(),uniqueToB:[...y(n.tokens,s.tokens)].sort()})}return a.sort((n,o)=>o.similarity-n.similarity||n.shortNameB.localeCompare(o.shortNameB)),a.slice(0,t.limit)}function G(e,i){let t=A(e,i);if(!t||!w(t.symbol))return null;let s=K(e,t);return s?{symbol:t.symbol,file:t.relativePath,tokens:s}:null}function K(e,i){let t=q(i.symbol),s=v(e,i.relativePath,i.startLine,i.endLine,t),r=I(s,t);return r.size>0?r:null}function H(e){return new x(e).productionCallableDefinitions().map(t=>({symbol:t.symbol,file:t.relativePath,tokens:I(v(e,t.relativePath,t.startLine,t.endLine,t.leaf),t.leaf)})).filter(t=>t.tokens.size>0)}function v(e,i,t,s,r){let a=z(e,i);if(!a)return"";let n=a.split(`
|
|
2
2
|
`);if(s>=t&&s-t<=12)return n.slice(t,s+1).join(`
|
|
3
3
|
`);let o=[new RegExp(`\\bdef\\s+${d(r)}\\b`),new RegExp(`\\bfun\\s+${d(r)}\\b`),new RegExp(`\\bfn\\s+${d(r)}\\b`),new RegExp(`\\bfunction\\s+${d(r)}\\b`),new RegExp(`\\b${d(r)}\\s*\\(`)],l=n.findIndex(c=>o.some(u=>u.test(c)));if(l>=0){let c=l;for(let u=l+1;u<n.length&&u<=l+8;u++){let h=n[u]??"";if(u>l&&Q(h)||(c=u,h.trim()===""&&u>l+1))break}return n.slice(l,c+1).join(`
|
|
4
4
|
`)}return n.slice(t,Math.min(n.length,t+8)).join(`
|
|
5
|
-
`)}function I(e,i){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),s=J(i),a=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>!t.has(n)).filter(n=>!s.has(n));return new Set(a)}function J(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(i=>i.toLowerCase()).filter(i=>i.length>1))}function Q(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function d(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{re as a,ae as b};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
`)}function I(e,i){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),s=J(i),a=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>!t.has(n)).filter(n=>!s.has(n));return new Set(a)}function J(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(i=>i.toLowerCase()).filter(i=>i.length>1))}function Q(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function d(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{re as a,ae as b,$ as c,E as d};
|
|
6
|
+
//# sourceMappingURL=chunk-SQ6VENQY.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{a as h}from"./chunk-NO2TPMCQ.js";import{d as p}from"./chunk-64UY7VTR.js";import{c as u,f,h as g}from"./chunk-SOGLYIJ4.js";import{execFileSync as d}from"child_process";var b="Unable to compute git diff.";function O(e,n={}){let t=S(e,n);return t.note?D(t.note,t.changedFileLines):t.changedFiles.length===0?F(t.changedFileLines):C(t.changedFiles,[I(e,t.changedFiles,t.changedFiles)])}function S(e,n={}){let{base:t="HEAD"}=n;try{let s=_(e.config.projectRoot,t);return{changedFileLines:s,changedFiles:x(e,s),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],note:b}}}function I(e,n,t){let s=new h(e),r=new Set(t),a=[],l=new Map,i=n.flatMap(o=>s.definitionsForFile(o)).filter(L).sort((o,m)=>o.relativePath.localeCompare(m.relativePath)||o.startLine-m.startLine),c=p(e,i);for(let o of i)N(e,o,t,r,a,l,c.get(o.symbolId)??new Set);return{changedSymbols:a,consumerEntries:[...l.entries()].map(([o,m])=>({file:o,symbols:[...m].sort()}))}}function C(e,n){let t=new Map,s=n.flatMap(a=>a.changedSymbols);for(let a of n)for(let l of a.consumerEntries){let i=t.get(l.file);i||(i=new Set,t.set(l.file,i));for(let c of l.symbols)i.add(c)}let r=M(t);return{changedFiles:[...e],changedSymbols:s,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:s.length,totalAffectedFiles:r.length}}}function D(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function F(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 _(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),s=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,s,r].flatMap(a=>a.split(`
|
|
2
|
+
`)).map(a=>a.trim()).filter(a=>a.length>0))]}function x(e,n){let t=[];for(let s of n){let r=e.get(`SELECT relative_path FROM documents
|
|
3
|
+
WHERE relative_path LIKE ?
|
|
4
|
+
LIMIT 1`,`%${s}`);r&&!e.isIgnored(r.relative_path)&&t.push(r.relative_path)}return t}function N(e,n,t,s,r,a,l){let i=Math.max(E(e,n.symbolId),l.size);if(!A(n,i))return;let c=u(n.symbol);r.push({symbol:n.symbol,shortName:c,file:n.relativePath,fanIn:i});for(let o of R(e,n.symbolId,t))y(e,s,a,o,c);for(let o of l)y(e,s,a,o,c)}function E(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
|
|
5
|
+
FROM mentions m
|
|
6
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
+
WHERE m.symbol_id = ?
|
|
8
|
+
AND m.role != 1`,n)?.fan_in??0}function R(e,n,t){return t.length===0?[]:e.all(`SELECT DISTINCT ref_d.relative_path
|
|
9
|
+
FROM mentions m
|
|
10
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
11
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
12
|
+
WHERE m.symbol_id = ?
|
|
13
|
+
AND m.role != 1
|
|
14
|
+
AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
|
|
15
|
+
${e.pathExclusionsFor("ref_d")}`,n,...t).map(r=>r.relative_path)}function y(e,n,t,s,r){if(e.isIgnored(s)||n.has(s))return;let a=t.get(s);a||(a=new Set,t.set(s,a)),a.add(r)}function M(e){return[...e.entries()].map(([n,t])=>({file:n,consumedSymbols:t.size})).sort((n,t)=>t.consumedSymbols-n.consumedSymbols)}function L(e){return!(g(e.symbol)||e.parentTypeName!==null&&!f(e.symbol))}function A(e,n){return f(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{b as a,O as b,S as c,I as d,C as e};
|
|
16
|
+
//# sourceMappingURL=chunk-T4AK46CM.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _}from"./chunk-
|
|
1
|
+
import{a as _}from"./chunk-NO2TPMCQ.js";import{c as u}from"./chunk-TQTVM27C.js";import{b as l,c as d}from"./chunk-APLCSDXL.js";import{c as a,e as m}from"./chunk-SOGLYIJ4.js";import{a as s}from"./chunk-NN3O7TPH.js";function A(e,o={}){let{scope:n,limit:r}=o,t=new _(e),i=h([...b(e,n),...g(e,t,n)]);return y(i),r?i.slice(0,r):i}function b(e,o){let n=[];for(let r of f(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||u(e,r.barrel_path))continue;let t=R(e,r),i=t?.barrel_consumers??0,c=t?.direct_consumers??0;i!==0||c!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:a(r.symbol),originalFile:r.original_path,barrelConsumers:i,directConsumers:c})}return n}function f(e,o){let n=o?`AND barrel_d.relative_path LIKE '%${o}%'`:"";return e.all(`SELECT DISTINCT
|
|
2
2
|
barrel_d.id AS barrel_doc_id,
|
|
3
3
|
barrel_d.relative_path AS barrel_path,
|
|
4
4
|
gs.id AS symbol_id,
|
|
@@ -58,4 +58,4 @@ import{a as _}from"./chunk-NOVKLH2F.js";import{c as u}from"./chunk-TQTVM27C.js";
|
|
|
58
58
|
${e.pathExclusionsFor("consumer_d")}
|
|
59
59
|
GROUP BY consumer_d.id
|
|
60
60
|
)`,o.barrel_doc_id,o.symbol_id,o.barrel_doc_id,o.original_doc_id)}function g(e,o,n){let r=[];for(let t of E(e,n))p(e,t,t)>0||r.push(...S(e,o,t));return r}function E(e,o){return s(e,{scope:o,includeIgnored:!1}).filter(n=>d(e,n).length>0)}function S(e,o,n){return d(e,n).filter(r=>r.sourcePath&&!e.isIgnored(r.sourcePath)).flatMap(r=>x(e,o,n,r.sourcePath))}function x(e,o,n,r){let t=N(o,r);return t?[{barrelFile:n,symbol:t.symbol,shortName:a(t.symbol),originalFile:r,barrelConsumers:0,directConsumers:p(e,r,n)}]:[]}function p(e,o,n){let r=new Set;for(let t of s(e,{includeIgnored:!1}))if(t!==n)for(let i of l(e,t))i.sourcePath===o&&r.add(t);return r.size}function N(e,o){let n=e.definitionsForFile(o);return n.find(r=>m(r.symbol)==="method")??n[0]??null}function h(e){let o=new Set,n=[];for(let r of e){let t=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;o.has(t)||(o.add(t),n.push(r))}return n}function y(e){e.sort((o,n)=>n.directConsumers-o.directConsumers||o.barrelFile.localeCompare(n.barrelFile)||o.shortName.localeCompare(n.shortName))}export{A as a};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-TA4DDU7J.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as l}from"./chunk-WC43FMAB.js";import{a}from"./chunk-
|
|
1
|
+
import{b as l}from"./chunk-WC43FMAB.js";import{a}from"./chunk-NO2TPMCQ.js";import{c as i,f as n}from"./chunk-SOGLYIJ4.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -26,4 +26,4 @@ import{b as l}from"./chunk-WC43FMAB.js";import{a}from"./chunk-NOVKLH2F.js";impor
|
|
|
26
26
|
AND ${e.localSymbolPredicate}
|
|
27
27
|
${e.pathExclusionsFor("d1")}
|
|
28
28
|
ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-TCCUWKH4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f}from"./chunk-V76FCF5F.js";import{a as m}from"./chunk-MX6F756F.js";import{a as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f}from"./chunk-V76FCF5F.js";import{a as m}from"./chunk-MX6F756F.js";import{a as d}from"./chunk-NO2TPMCQ.js";import{c as u}from"./chunk-SOGLYIJ4.js";function w(n,a={}){let{scope:e,minLoc:r=10,minCallees:o=6,limit:t=20,scanLimit:i}=a,s=new d(n);return f({candidates:()=>s.productionCallableDefinitions({scope:e,minLoc:r,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,prepare:l=>s.calleeMap(l,{semantic:a.semantic!==!1}),evaluate:(l,c)=>g(l,c.get(l.symbolId)??[],o),orderResults:(l,c)=>c.clusters.length-l.clusters.length||c.loc-l.loc,limit:t})}function g(n,a,e){let r=new Set(a.map(s=>s.symbol));if(r.size<e)return null;let o=b(r,a),t=p(r,o);if(t.length<2)return null;let i=h(t,o);return i.length===0?null:{symbol:n.symbol,shortName:u(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:m(n),totalCallees:r.size,clusters:i}}function b(n,a){let e=new Map;for(let o of n)e.set(o,new Set);let r=new Map;for(let o of a){let t=r.get(o.chunkId);t||(t=new Set,r.set(o.chunkId,t)),t.add(o.symbol)}for(let o of r.values()){let t=[...o];for(let i=0;i<t.length;i++)for(let s=i+1;s<t.length;s++)e.get(t[i]).add(t[s]),e.get(t[s]).add(t[i])}return e}function p(n,a){let e=new Set,r=[];for(let o of n){if(e.has(o))continue;let t=new Set,i=[o];for(;i.length>0;){let s=i.pop();if(!e.has(s)){e.add(s),t.add(s);for(let l of a.get(s)??[])e.has(l)||i.push(l)}}r.push(t)}return r}function h(n,a){return n.filter(e=>e.size>=3).map(e=>C(e,n,a)).filter(e=>e.isolation>.5).sort((e,r)=>r.isolation-e.isolation)}function C(n,a,e){let r=new Set;for(let s of a)if(s!==n)for(let l of s)r.add(l);let o=0;for(let s of n)for(let l of e.get(s)??[])r.has(l)&&o++;let t=n.size*r.size,i=t>0?1-o/t:1;return{callees:[...n].map(u),isolation:i}}export{w as a};
|
|
2
|
+
//# sourceMappingURL=chunk-U254PV4S.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function S(n,e){let t=new Set;for(let r of n)e.has(r)&&t.add(r);return t}function M(n,e){let t=new Set;for(let r of n)e.has(r)||t.add(r);return t}function w(n,e){if(n.size===0&&e.size===0)return 0;let t=0;for(let o of n)e.has(o)&&(t+=1);let r=n.size+e.size-t;return r===0?0:t/r}function x(n,e){if(n.size===0)return 0;let t=0;for(let r of n)e.has(r)&&(t+=1);return t/n.size}function z(n){let e=n.length;if(e===0)return new Map;let t=new Map;for(let o of n)for(let s of o)t.set(s,(t.get(s)??0)+1);let r=new Map;for(let[o,s]of t)r.set(o,Math.log(e/s));return r}function p(n){let e=[...n.values()].sort((r,o)=>r-o);if(e.length===0)return 0;let t=Math.floor(e.length/2);return e.length%2===0?(e[t-1]+e[t])/2:e[t]}function b(n,e,t){let r=S(n,e);if(r.size===0)return{similarity:0,significantShared:[],trivialShared:[]};let o=0,s=0,T=0,l=new Set([...n,...e]);for(let i of l){let a=t.get(i)??0,f=n.has(i)?a:0,u=e.has(i)?a:0;o+=f*u,s+=f*f,T+=u*u}let h=Math.sqrt(s)*Math.sqrt(T),g=h>0?o/h:0,m=p(t),c=[],d=[];for(let i of r)(t.get(i)??0)>=m?c.push(i):d.push(i);return c.sort((i,a)=>(t.get(a)??0)-(t.get(i)??0)),{similarity:g,significantShared:c,trivialShared:d}}export{S as a,M as b,w as c,x as d,z as e,b as f};
|
|
2
|
+
//# sourceMappingURL=chunk-UIWAZ2NT.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-V76FCF5F.js";import{a as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-V76FCF5F.js";import{a as p}from"./chunk-NO2TPMCQ.js";import{c as i}from"./chunk-SOGLYIJ4.js";function x(e,r){let{scope:m,minLoc:o=10,limit:c=30,scanLimit:a}=r??{},s=new p(e);return u({candidates:()=>s.productionCallableDefinitions({scope:m,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:s.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:s.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>b(t,n,o),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:c})}function b(e,r,m){let o=e.endLine-e.startLine+1;if(o<m)return null;let c=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],s=a.filter(l=>l.file!==e.relativePath),t=new Set(s.map(l=>`${l.symbol}|${l.file}`)).size,n=new Set(a.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:i(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:c,fanOut:t,calleeCount:n,score:Math.round(o/50*(c/5)*Math.max(t/5,1)*100)/100}}export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-VHENVDS2.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as B}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as B}from"./chunk-TCCUWKH4.js";import{a as T}from"./chunk-GD7XRHSV.js";import{a as I}from"./chunk-NK7TQQG4.js";import{a as p}from"./chunk-LBAMALDV.js";import{a as H}from"./chunk-JTCEWV7Q.js";import{a as v}from"./chunk-BCFED24F.js";import{a as F,b as G}from"./chunk-AGW2MVIO.js";import{b as A}from"./chunk-I66MQD5U.js";import{b as P}from"./chunk-R3G6ERW7.js";import{a as k}from"./chunk-YSSTUCNS.js";import{a as b}from"./chunk-UUDYI3FF.js";import{a as D}from"./chunk-D43L5PQF.js";import{a as w}from"./chunk-ITUU3VE3.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?I(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?D(t,e,{semantic:l}):null,f=s?k(t,e,{semantic:l}):null,h=s?v(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,d=s?b(t,e,{maxDepth:o,scope:n.scope}):[],i=w(t,e,{semantic:l}),g=F(t,e),x=G(t,e),u=T(t,e),C=B(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||d.length>0,file:i!==null||g.length>0||x.length>0,module:u.files.length>0||u.symbols.length>0||C.length>0},S=[];!c.symbol&&!c.file&&!c.module&&S.push("No symbol, file, or module matched target.");let O=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:j(t,O),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:d,changeSurface:i,deps:g,rdeps:x,system:u,surface:C,warnings:S}}function j(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})),suppressionsInFile:H(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-VQGQHIAT.js.map
|