scip-query 0.10.5 → 0.10.7
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 +6 -1
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-CJJP64OC.js → chunk-27FU2KX7.js} +2 -2
- package/dist/chunk-3C4NIBY5.js +2 -0
- package/dist/chunk-3LQFMQPY.js +3 -0
- package/dist/{chunk-QVCCLDZI.js → chunk-5JXH6VGF.js} +2 -2
- package/dist/{chunk-77YBOOYT.js → chunk-5LM7RJMQ.js} +2 -2
- package/dist/{chunk-EWC3UK4V.js → chunk-5MHQI4RR.js} +2 -2
- package/dist/{chunk-X7ZY6FFF.js → chunk-72QDTW5U.js} +2 -2
- package/dist/{chunk-MZ7APUFN.js → chunk-733EF5FD.js} +2 -2
- package/dist/chunk-7AOMEMOA.js +4 -0
- package/dist/chunk-A536TEU4.js +3 -0
- package/dist/chunk-BZ2RRK7Y.js +8 -0
- package/dist/chunk-C6ROZBJA.js +32 -0
- package/dist/chunk-CMXD5VC4.js +2 -0
- package/dist/{chunk-BNKE4TT5.js → chunk-CQEJU32R.js} +2 -2
- package/dist/{chunk-5FOPAXWY.js → chunk-DBTL56LR.js} +2 -2
- package/dist/chunk-DOZ2X6TS.js +2 -0
- package/dist/{chunk-D322LMSA.js → chunk-DS6QEB3G.js} +5 -5
- package/dist/chunk-EOUTP32Q.js +4 -0
- package/dist/{chunk-QSXQT3NE.js → chunk-EPPCGQUI.js} +2 -2
- package/dist/{chunk-CSWZFD46.js → chunk-EW64FEJL.js} +2 -2
- package/dist/{chunk-O3OKSF6O.js → chunk-FG4NT6VY.js} +2 -2
- package/dist/chunk-FKYPOK7P.js +5 -0
- package/dist/chunk-FPYQA7JK.js +21 -0
- package/dist/{chunk-FIB4JPEX.js → chunk-FRIASDLG.js} +2 -2
- package/dist/chunk-FXI3AAKO.js +2 -0
- package/dist/{chunk-QUJBXLBY.js → chunk-FXWV2V7K.js} +2 -2
- package/dist/chunk-G2CGUNQU.js +4 -0
- package/dist/{chunk-LPLGJ4HO.js → chunk-GIOT3O6P.js} +2 -2
- package/dist/{chunk-YUTRW57I.js → chunk-GKRRO3WC.js} +2 -2
- package/dist/{chunk-Z4VHYJ5U.js → chunk-GOWLZ4NA.js} +2 -2
- package/dist/{chunk-4ZUJJRWT.js → chunk-GRZRMELG.js} +2 -2
- package/dist/{chunk-CFL2CNIF.js → chunk-H6RLM7D7.js} +2 -2
- package/dist/chunk-HDBQHJNY.js +2 -0
- package/dist/{chunk-AW4N6MGC.js → chunk-IA7Q6HVP.js} +2 -2
- package/dist/{chunk-E44ZMVNA.js → chunk-IL2EVPYP.js} +2 -2
- package/dist/{chunk-E7KERP7E.js → chunk-J43GIAVM.js} +2 -2
- package/dist/{chunk-56UN3DMK.js → chunk-JOGZKF5W.js} +2 -2
- package/dist/{chunk-CTCAF3YA.js → chunk-KT2ZO3CE.js} +2 -2
- package/dist/{chunk-DAI74TJU.js → chunk-KUIIQPDA.js} +2 -2
- package/dist/{chunk-VAA5FFIW.js → chunk-LM5SHAN4.js} +2 -2
- package/dist/chunk-LONIY5FF.js +2 -0
- package/dist/{chunk-FNRPGGVI.js → chunk-LQSLW7K7.js} +2 -2
- package/dist/{chunk-WBJZNPUT.js → chunk-M3YEHOCD.js} +2 -2
- package/dist/{chunk-GZCQTZLK.js → chunk-MFWAZFYD.js} +2 -2
- package/dist/{chunk-EYLXU575.js → chunk-MHATKJ3J.js} +2 -2
- package/dist/{chunk-ZQLO2SCU.js → chunk-MJXJ56LG.js} +2 -2
- package/dist/{chunk-47UA45TU.js → chunk-NIGHS7UP.js} +2 -2
- package/dist/{chunk-NVFERV4U.js → chunk-OFO7BIRK.js} +2 -2
- package/dist/{chunk-7OHWPJ5N.js → chunk-OMGE3V2Q.js} +2 -2
- package/dist/{chunk-ICXVNWMI.js → chunk-OT6CDRKC.js} +2 -2
- package/dist/{chunk-6UFMPECA.js → chunk-OWXN6ZS5.js} +2 -2
- package/dist/{chunk-QLNGUWR7.js → chunk-OZUJ3VZS.js} +2 -2
- package/dist/chunk-P3K7LX7M.js +4 -0
- package/dist/{chunk-ZSLT7NWQ.js → chunk-PQ6QG3EX.js} +2 -2
- package/dist/chunk-PTKQNPWX.js +23 -0
- package/dist/{chunk-YYD245WG.js → chunk-QMH2D6S5.js} +2 -2
- package/dist/{chunk-5M4TYWVI.js → chunk-QPTVFG4O.js} +2 -2
- package/dist/{chunk-MUULWXSJ.js → chunk-QR337MAA.js} +2 -2
- package/dist/{chunk-SPE4YCOT.js → chunk-QVS4SYAX.js} +2 -2
- package/dist/{chunk-AUVBR62P.js → chunk-RISLKTKQ.js} +2 -2
- package/dist/{chunk-OLD6PBU6.js → chunk-S7DNZ6IW.js} +2 -2
- package/dist/{chunk-EOZIZWW4.js → chunk-SXESPZUX.js} +2 -2
- package/dist/{chunk-TM6GVHA6.js → chunk-TDBTVMHY.js} +2 -2
- package/dist/{chunk-3UW7VM4H.js → chunk-TJXOD4IK.js} +2 -2
- package/dist/chunk-U73YFD3P.js +3 -0
- package/dist/{chunk-YUOAAR24.js → chunk-UBDFQBSE.js} +2 -2
- package/dist/chunk-UJEVABIR.js +2 -0
- package/dist/{chunk-5QJXH6ZL.js → chunk-VA3FJ3AY.js} +2 -2
- package/dist/{chunk-3KLLFNT4.js → chunk-VOYOYC5T.js} +2 -2
- package/dist/chunk-W2CBNBEL.js +71 -0
- package/dist/chunk-W2TIXAGN.js +40 -0
- package/dist/{chunk-CAWSSEVM.js → chunk-WMIQMXSK.js} +2 -2
- package/dist/{chunk-YQH353VA.js → chunk-WVRTGVHJ.js} +2 -2
- package/dist/{chunk-DJMK4DBL.js → chunk-WXMVK53S.js} +2 -2
- package/dist/{chunk-YTR4CO5S.js → chunk-XAYARHNF.js} +3 -3
- package/dist/{chunk-ESG4HBEF.js → chunk-XBIF45WK.js} +2 -2
- package/dist/{chunk-DE7MA6OD.js → chunk-XYI7XRZC.js} +2 -2
- package/dist/{chunk-7KCSELEV.js → chunk-YNLK3G63.js} +2 -2
- package/dist/{chunk-NNDYO2DX.js → chunk-YOCYR7KJ.js} +2 -2
- package/dist/chunk-YZA6PPZL.js +3 -0
- package/dist/{chunk-5UDFZC4D.js → chunk-ZUTV7DDX.js} +2 -2
- package/dist/cli.js +274 -237
- package/dist/{config-types-Bj4sh28g.d.ts → config-types-BDIWAYzr.d.ts} +13 -1
- package/dist/{db-CTarohbZ.d.ts → db-BAVwb4Pb.d.ts} +1 -1
- package/dist/{health-Bx0x1HAG.d.ts → health-B17sVFYf.d.ts} +6 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +8 -5
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +7 -3
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +5 -3
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +3 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +5 -3
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +11 -11
- package/dist/reindex.d.ts +11 -2
- package/dist/reindex.js +22 -22
- package/dist/runtime.d.ts +17 -20
- package/dist/runtime.js +2 -2
- package/dist/scip-cli-CnK9Va4O.d.ts +56 -0
- package/docs/AGENT_GUIDE.md +1 -1
- package/docs/COMMAND_REFERENCE.md +3 -2
- package/docs/analyzer-inventory.md +2 -2
- package/docs/analyzer-validation-ledger.md +2 -2
- package/package.json +1 -1
- package/skills/concrete-plan/SKILL.md +2 -2
- package/skills/scip-adoption/SKILL.md +4 -2
- package/skills/scip-ai-cleanup/SKILL.md +1 -1
- package/skills/scip-api-impact/SKILL.md +6 -2
- package/skills/scip-debloat/SKILL.md +1 -1
- package/skills/scip-debug/SKILL.md +6 -2
- package/skills/scip-diagram/SKILL.md +3 -1
- package/skills/scip-directory-architecture/SKILL.md +7 -3
- package/skills/scip-doc-reconcile/SKILL.md +3 -1
- package/skills/scip-explore/SKILL.md +2 -2
- package/skills/scip-health-audit/SKILL.md +6 -2
- package/skills/scip-health-improve/SKILL.md +6 -2
- package/skills/scip-maintainability/SKILL.md +6 -3
- package/skills/scip-query/SKILL.md +10 -6
- package/skills/scip-query-setup/SKILL.md +10 -5
- package/skills/scip-react-maintainability/SKILL.md +7 -2
- package/skills/scip-triage-issue/SKILL.md +4 -2
- package/skills/scip-verify/SKILL.md +5 -3
- package/skills/scip-vue-maintainability/SKILL.md +7 -2
- package/dist/chunk-237YUOPK.js +0 -8
- package/dist/chunk-3UVJJ6Z7.js +0 -2
- package/dist/chunk-3ZYF3ELZ.js +0 -2
- package/dist/chunk-7JOTOWZO.js +0 -4
- package/dist/chunk-A3VNUGKJ.js +0 -2
- package/dist/chunk-A4L36SZS.js +0 -22
- package/dist/chunk-A7RNHUJH.js +0 -20
- package/dist/chunk-AYYIZ4BA.js +0 -4
- package/dist/chunk-BKDXBJDQ.js +0 -2
- package/dist/chunk-C3MZZ2ZN.js +0 -2
- package/dist/chunk-CRU42NJU.js +0 -2
- package/dist/chunk-ERHOS6AW.js +0 -2
- package/dist/chunk-FOQHUKNZ.js +0 -4
- package/dist/chunk-FUPDW5AC.js +0 -3
- package/dist/chunk-G3WGZU5Q.js +0 -2
- package/dist/chunk-HVTYSC26.js +0 -40
- package/dist/chunk-KPHKX4LP.js +0 -71
- package/dist/chunk-MA7OVFHI.js +0 -2
- package/dist/chunk-OBBDKQAG.js +0 -3
- package/dist/chunk-RHTJBYZ5.js +0 -2
- package/dist/chunk-UQJGTVHV.js +0 -5
- package/dist/chunk-ZFMPHDAT.js +0 -4
- package/dist/scip-cli-Bh1M_JPu.d.ts +0 -20
package/README.md
CHANGED
|
@@ -262,6 +262,9 @@ Vue single-file components are handled through the JavaScript/TypeScript indexer
|
|
|
262
262
|
|
|
263
263
|
By default, indexes live in `~/.cache/scip-query/projects/<hash>/`, keeping project directories clean. Override paths with `.scipquery.json` or `SCIP_QUERY_*` environment variables. Reindexing writes per-language SCIP shards next to the SQLite index, so a mixed-language repo can reuse unchanged language outputs and rerun only the languages whose source/config inputs changed.
|
|
264
264
|
|
|
265
|
+
TypeScript monorepos can opt into project sharding with `indexer.typescript.projectMode: "workspace"`. In that mode, `scip-query` discovers repo-local TypeScript project roots, runs one `scip-typescript` process per project with bounded concurrency, merges the shard protobufs, and still publishes one TypeScript language index. Set `indexer.typescript.projects` to an explicit list of project directories or tsconfig paths when automatic discovery is too broad. Set `indexerConcurrency` when a repo needs a persistent worker cap; CLI `--indexer-concurrency` and `SCIP_QUERY_INDEXER_CONCURRENCY` still override ad hoc runs.
|
|
266
|
+
Use `indexer.typescript.pnpmWorkspaces` only with the default single-project mode; workspace mode passes explicit projects instead.
|
|
267
|
+
|
|
265
268
|
Most read-only commands accept `--json` and use the same envelope:
|
|
266
269
|
|
|
267
270
|
```json
|
|
@@ -281,6 +284,7 @@ It creates `.scipquery.json`:
|
|
|
281
284
|
```json
|
|
282
285
|
{
|
|
283
286
|
"languages": ["typescript"],
|
|
287
|
+
"indexerConcurrency": 6,
|
|
284
288
|
"watch": {
|
|
285
289
|
"enabled": false,
|
|
286
290
|
"debounceMs": 30000,
|
|
@@ -288,7 +292,8 @@ It creates `.scipquery.json`:
|
|
|
288
292
|
},
|
|
289
293
|
"indexer": {
|
|
290
294
|
"typescript": {
|
|
291
|
-
"
|
|
295
|
+
"projectMode": "workspace",
|
|
296
|
+
"projects": ["apps/api", "apps/web"]
|
|
292
297
|
}
|
|
293
298
|
}
|
|
294
299
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as t}from"./chunk-
|
|
1
|
+
import{c as t}from"./chunk-W2CBNBEL.js";import{writeFileSync as o}from"fs";import{workerData as s}from"worker_threads";var e=s;try{let r=t({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles,tasks:e.tasks});o(e.resultPath,JSON.stringify({ok:!0,result:r}))}catch(r){o(e.resultPath,JSON.stringify({ok:!1,error:r instanceof Error?r.message:String(r)}))}finally{let r=new Int32Array(e.sharedBuffer);Atomics.add(r,0,1),Atomics.notify(r,0)}
|
|
2
2
|
//# sourceMappingURL=augment-vue-worker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as d,c as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as d,c as m}from"./chunk-MJXJ56LG.js";import{a as B}from"./chunk-RISLKTKQ.js";function F(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],a=new Set,l=new Set,f=[];function y(t,o){if(o>c)return;if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),g=u.indexOf(u.reduce((x,$)=>x<$?x:$)),p=[...u.slice(g,-1),...u.slice(0,g),u[g]],S=p.join(" -> ");b.has(S)||(b.add(S),i.push({path:p,kind:R(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)y(h,o+1);f.pop(),l.delete(t)}let b=new Set;for(let t of n.keys())a.has(t)||y(t,0);return i.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),i}function R(s){for(let c of s){let n=d(c);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(s.length!==3)return"real";let[e,r]=s;return!e||!r?"real":m(e)||m(r)||C(e,r)||C(r,e)||D(e,r)||D(r,e)||d(e)==="entry"||d(r)==="entry"?"module-hierarchy":"real"}function C(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=e.replace(/\.rs$/,"/");return s.startsWith(r)?!s.slice(r.length).includes("/"):!1}function D(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=s.replace(/\.rs$/,""),c=e.replace(/\.rs$/,"");if(r===c+"_tests"||r===c+"/tests")return!0;let n=s.split("/"),i=e.split("/");if(n.length===i.length&&n.includes("tests")&&i.includes("src")){let a=n[n.length-1],l=i[i.length-1];if(a&&a===l)return!0}return!1}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-27FU2KX7.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as w}from"./chunk-C6ROZBJA.js";import{a as v}from"./chunk-64MNV6AB.js";import{a as O,d as D,f as P}from"./chunk-7S5E7KWT.js";function V(t){return t.replace(/'''[\s\S]*?'''/g,f).replace(/"""[\s\S]*?"""/g,f).replace(/#.*$/gm,f).replace(/\/\/.*$/gm,f).replace(/\/\*[\s\S]*?\*\//g,f).replace(/`(?:\\[\s\S]|[^`])*`/g,f).replace(/'(?:\\.|[^'\\\r\n])*'/g,f).replace(/"(?:\\.|[^"\\\r\n])*"/g,f)}function f(t){return t.replace(/[^\r\n]/g," ")}var Rt=P("stripped-lines",{clearGroups:["whole-project","source-file"]});O({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{_=null,h=""},clearFile:()=>{_=null,h=""}});var _=null,h="";function Y(t){return _===t||(_=t,h=V(t)),h}function Ct(t,n,e){let r=Y(t);return`${r.slice(0,n)}${" ".repeat(e-n)}${r.slice(e)}`}function $t(t,n){return new RegExp(`\\b${X(n)}\\b`,"m").test(t)}function jt(t,n){let e=new Set,r=new RegExp(`\\b${X(n)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let o of t.matchAll(r)){let s=o[1];s&&e.add(s)}return[...e]}function X(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yt(t){let n=0;for(let e of t)e==="("&&(n+=1),e===")"&&(n-=1);return n}import{existsSync as T}from"fs";import{basename as K,dirname as S,extname as p,join as g,relative as m,resolve as u}from"path";var Q=D("indexed-paths",{clearGroups:[]}),Z=D("indexed-path-digest",{clearGroups:[]}),I=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],b=[".py",".pyi"],k=[".java",".scala",".kt",".kts"],A=[".rs"],L=[".rb"],W=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],H=[".cs",".vb"],U=[".dart"],G=[".php"],q=new Set(I),R=new Set(b),J=new Set(k),C=new Set(A),$=new Set(L),M=new Set(W),B=new Set(H),j=new Set(U),F=new Set(G),tt=[{extensions:I,lookup:q},{extensions:b,lookup:R},{extensions:k,lookup:J},{extensions:A,lookup:C},{extensions:L,lookup:$},{extensions:W,lookup:M},{extensions:H,lookup:B},{extensions:U,lookup:j},{extensions:G,lookup:F}];function x(t,n){return n.has(p(t).toLowerCase())}function nt(t){return x(t,R)}function et(t){return x(t,J)}function rt(t){return x(t,C)}function ot(t){return x(t,$)}function st(t){return x(t,M)}function it(t){return x(t,B)}function kt(t){return p(t).toLowerCase()===".vb"}function ct(t){return x(t,j)}function at(t){return x(t,F)}function lt(t){let n=p(t).toLowerCase();for(let e of tt)if(e.lookup.has(n))return e.extensions;return I}function ut(t){return et(t)||it(t)||at(t)}function At(t,n,e){return nt(n)?pt(t,n,e):rt(n)?ft(t,n,e):ot(n)?St(t,n,e):st(n)?xt(t,n,e):ut(n)?dt(t,e.replace(/\\/g,"."),lt(n)):ct(n)?Et(t,n,e):gt(t,n,e)}function gt(t,n,e){if(!e.startsWith(".")&&!e.startsWith("/"))return null;let r=S(g(t.config.projectRoot,n)),o=u(r,e),s=E(t);for(let c of _t(o)){let a=d(m(t.config.projectRoot,c));if(s.has(a)||T(c))return a}return d(m(t.config.projectRoot,o))}function pt(t,n,e){let r=E(t),o;if(e.startsWith(".")){let s=e.match(/^(\.+)(.*)$/);if(!s)return null;let c=s[1].length,a=s[2].replace(/^\./,""),i=S(g(t.config.projectRoot,n));for(let l=1;l<c;l++)i=S(i);o=a?u(i,a.replace(/\./g,"/")):i}else o=u(t.config.projectRoot,e.replace(/\./g,"/"));for(let s of ht(o)){let c=d(m(t.config.projectRoot,s));if(r.has(c)||T(s))return c}return null}function ft(t,n,e){if(!e)return null;let r=e.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let o=S(g(t.config.projectRoot,n)),s;return r.startsWith("crate::")?s=u(t.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?s=u(o,r.slice(6).replace(/::/g,"/")):s=u(S(o),r.slice(7).replace(/::/g,"/")),y(t,mt(s))}function St(t,n,e){let r=S(g(t.config.projectRoot,n)),o=u(r,e);return y(t,It(o))}function xt(t,n,e){let r=S(g(t.config.projectRoot,n)),o=[u(r,e),u(t.config.projectRoot,e),u(t.config.projectRoot,"include",e),u(t.config.projectRoot,"src",e)];return y(t,o)}function dt(t,n,e){let r=E(t),o=n.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),s=o.replace(/\./g,"/"),c=o.split(".").pop()??o;for(let i of e){let l=`${s}${i}`,N=[...r].find(z=>z.endsWith(l));if(N)return N}for(let i of e){let l=[...r].find(N=>K(N)===`${c}${i}`);if(l)return l}let a=[...r].filter(i=>e.includes(p(i).toLowerCase())).filter(i=>i.includes(`/${s}/`)||i.includes(`/${c}/`)).sort((i,l)=>i.localeCompare(l));return a.length===1?a[0]:null}function Et(t,n,e){let r=E(t);if(e.startsWith("package:")){let c=e.slice(8),a=c.indexOf("/");if(a<0)return null;let i=c.slice(a+1),l=d(i.startsWith("lib/")?i:`lib/${i}`);return r.has(l)?l:null}let o=S(g(t.config.projectRoot,n)),s=u(o,e);for(let c of Nt(s)){let a=d(m(t.config.projectRoot,c));if(r.has(a)||T(c))return a}return null}function ht(t){let n=p(t);return R.has(n)?[t]:[`${t}.py`,`${t}.pyi`,g(t,"__init__.py"),g(t,"__init__.pyi")]}function y(t,n){let e=E(t);for(let r of n){let o=d(m(t.config.projectRoot,r));if(e.has(o)||T(r))return o}return null}function mt(t){let n=p(t);return C.has(n)?[t]:[`${t}.rs`,g(t,"mod.rs")]}function It(t){let n=p(t);return $.has(n)?[t]:[`${t}.rb`,g(t,"index.rb")]}function Nt(t){let n=p(t);return j.has(n)?[t]:[`${t}.dart`,t]}function _t(t){let n=p(t),e=new Set;if(n){e.add(t);for(let r of I)e.add(t.slice(0,-n.length)+r)}else for(let r of I)e.add(`${t}${r}`),e.add(g(t,`index${r}`));return[...e]}function E(t){return Q.get(t,()=>new Set(v(t,{includeIgnored:!1}).map(d)))}function Lt(t){return Z.get(t,()=>w([...E(t)].sort().join(`
|
|
2
|
+
`)))}function d(t){return t.replace(/\\/g,"/")}export{I as a,b,k as c,A as d,L as e,W as f,H as g,U as h,G as i,kt as j,lt as k,At as l,pt as m,ft as n,St as o,xt as p,dt as q,Et as r,Lt as s,d as t,V as u,Ct as v,$t as w,jt as x,yt as y};
|
|
3
|
+
//# sourceMappingURL=chunk-3LQFMQPY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-RISLKTKQ.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5JXH6VGF.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d}from"./chunk-PVZMPG5I.js";import{c as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d}from"./chunk-PVZMPG5I.js";import{c as a}from"./chunk-HDBQHJNY.js";import{a as c}from"./chunk-RISLKTKQ.js";function F(t,e={}){let{minSimilarity:o=.5,limit:l=20,scope:n,filePattern:f}=e,r=e.minDeps??(f?1:3),{profiles:s,distinctiveDeps:p}=m(t,{scope:n,minDeps:r});return d({profiles:s,limit:l,filePattern:f,overrunFactor:5,compare:(i,u)=>D(i,u,o,p)})}function m(t,e){let{scope:o,minDeps:l}=e,n=c(t,o),{universalDeps:f,distinctiveDeps:r}=g(n),s=[];for(let[p,i]of n)i.size>=l&&s.push({file:p,deps:new Set([...i].filter(u=>!f.has(u)))});return{profiles:s,distinctiveDeps:r}}function g(t){let e=new Set,o=new Set,l=t.size;if(l===0)return{universalDeps:e,distinctiveDeps:o};let n=new Map;for(let r of t.values())for(let s of r)n.set(s,(n.get(s)??0)+1);let f=Math.max(3,Math.ceil(l*.03));for(let[r,s]of n)s>=5&&s/l>.3?e.add(r):s<=f&&o.add(r);return{universalDeps:e,distinctiveDeps:o}}function D(t,e,o,l){let n=new Set;for(let i of t.deps)e.deps.has(i)&&n.add(i);if(n.size<3||t.deps.size<4||e.deps.size<4)return null;let f=0;for(let i of n)l.has(i)&&f++;if(f<2)return null;let r=a(t.deps,e.deps);if(r<o)return null;let s=[];for(let i of t.deps)e.deps.has(i)||s.push(i);let p=[];for(let i of e.deps)t.deps.has(i)||p.push(i);return{fileA:t.file,fileB:e.file,similarity:r,sharedDeps:[...n],uniqueToA:s,uniqueToB:p}}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5LM7RJMQ.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as f,b as h,e as m,g as x,i as N}from"./chunk-
|
|
1
|
+
import{a as f,b as h,e as m,g as x,i as N}from"./chunk-DS6QEB3G.js";import{c as y}from"./chunk-A536TEU4.js";import{f as g}from"./chunk-7S5E7KWT.js";import{extname as S}from"path";var R={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb"};function p(e){return R[S(e).toLowerCase()]??null}function k(e){return S(e).toLowerCase()===".vue"}import{extname as B}from"path";import{parse as $}from"@vue/compiler-sfc";function v(e){let t=$(e),n=t.descriptor.scriptSetup??t.descriptor.script;if(!n||n.src)return null;let s=x(n.lang??null);return s?{body:n.content,startLine:Math.max(0,n.loc.start.line-1),language:s}:null}var b=g("ast-trees",{clearGroups:["whole-project","source-file"]});function _(e,t){if(k(t))return E(e,t);let n=p(t);if(!n)return null;let s=f(e,t);return s?b.get(e,t,s,()=>m(n,s)):null}function E(e,t){let n=f(e,t);return n?b.get(e,t,n,()=>{let s=v(n);if(!s)return null;let r=`
|
|
2
2
|
`.repeat(s.startLine)+s.body;return m(s.language,r)}):null}var O=[".tsx",".jsx"],C=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),J=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),P=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),D=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),V=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),q=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),I=new Set(["children","className","false","key","null","style","true","undefined"]),Z=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]);function Le(e,t={}){let n=y(e,{extensions:O}).filter(r=>!t.scope||r.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(r=>z(e,r)).filter(r=>(t.minJsxTokens===void 0||r.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||r.behaviorTokens.size>=t.minBehaviorTokens))}function z(e,t){let n=t.replace(/\\/g,"/"),s=H(n);if(!s)return[];let r=_(e,n);if(!r)return[];let o=h(e,n).length;return M(r.rootNode,s).filter(a=>a.kind==="hook"||A(a.bodyNode)).map(a=>{let l=Q(a.bodyNode),u=ne(a.bodyNode,s);return{file:n,name:a.name,kind:a.kind,startLine:a.node.startPosition.row,endLine:a.node.endPosition.row,loc:Math.max(1,a.node.endPosition.row-a.node.startPosition.row+1),fileLines:o,jsxTokens:l.tokens,behaviorTokens:u.tokens,componentNames:c(l.componentNames),nativeTags:c(l.nativeTags),propNames:c(l.propNames),eventNames:c(l.eventNames),hookNames:c(u.hookNames),requestNames:c(u.requestNames),stateNames:c(u.stateNames),effectNames:c(u.effectNames),handlerNames:c(u.handlerNames)}})}function H(e){let t=B(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:p(e)}function M(e,t){let n=[],s=new Set,r=o=>{let i=K(o);if(i&&!U(o)){let a=`${i.name}:${i.node.startIndex}:${i.node.endIndex}`;s.has(a)||(s.add(a),n.push(i));return}for(let a of o.namedChildren)r(a)};return(t==="tsx"||t==="javascript")&&r(e),n}function K(e){if(e.type==="function_declaration"){let o=j(e);return!o||!L(o)?null:{name:o,kind:w(o),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),s=d(t);if(!s||!n||!L(s))return null;let r=W(n);return r?{name:s,kind:w(s),node:e,bodyNode:r}:null}function L(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function w(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function W(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=G(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(r=>r.type==="arguments")?.namedChildren.find(r=>r.type==="arrow_function"||r.type==="function_expression")??null}function U(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function j(e){return d(e.childForFieldName("name")??e.namedChild(0))}function G(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function A(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(A)}function Q(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=s=>{s.type==="jsx_opening_element"||s.type==="jsx_self_closing_element"?X(s,t):s.type==="jsx_expression"?Y(s,t):s.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let r of s.namedChildren)n(r)};return n(e),t}function X(e,t){let n=ee(e),s=!1;if(n){let r=T(n);s=ie(r),s?(t.componentNames.add(r),t.tokens.add(`component:${r}`)):(t.nativeTags.add(r),t.tokens.add(`native:${r}`))}for(let r of e.namedChildren)if(r.type==="jsx_attribute"){let o=te(r);if(!o)continue;let i=T(o);if(i.startsWith("on")&&i.length>2){let a=i.slice(2).replace(/^[A-Z]/,l=>l.toLowerCase());t.eventNames.add(a),t.tokens.add(`event:${a}`)}else Z.has(i)||(t.propNames.add(i),t.tokens.add(`${s?"prop":"native-prop"}:${i}`))}else r.type==="jsx_spread_attribute"&&t.tokens.add("prop:spread")}function Y(e,t){let n=e.text;(n.includes("&&")||n.includes("?"))&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let s of ce(n))I.has(s)||t.tokens.add(`binding:${s}`)}function ee(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function te(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function ne(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},s=r=>{if(r.type==="call_expression"){let o=N(r,t);o&&se(o.calleeLeaf,n)}else if(r.type==="variable_declarator")oe(r,n);else if(r.type==="function_declaration"){let o=j(r);o&&F(o,n)}for(let o of r.namedChildren)s(o)};return s(e),n}function se(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!C.has(e)&&!D.has(e)&&t.tokens.add(`hook:${e}`)),C.has(e)&&t.tokens.add(`react-hook:${e}`),J.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),P.has(e)&&t.tokens.add(`state-hook:${e}`),re(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function re(e){if(V.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function oe(e,t){let n=e.childForFieldName("name")??e.namedChild(0),s=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&s?.text.includes("useState")){let o=n.namedChildren.find(a=>d(a)),i=d(o);i&&(t.stateNames.add(i),t.tokens.add(`state:${i}`))}let r=d(n);r&&F(r,t)}function F(e,t){let n=ae(e);!n||!q.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function ae(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function ie(e){return/^[A-Z]/.test(e)||e.includes(".")}function T(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function d(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function ce(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let s=n[0];t.includes(s)||t.push(s)}return t}function c(e){return[...e].sort()}export{p as a,k as b,v as c,_ as d,Le as e};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-5MHQI4RR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{p as f}from"./chunk-W2TIXAGN.js";import{a as d}from"./chunk-733EF5FD.js";import{c as m,d as g}from"./chunk-TJXOD4IK.js";import{c as s,g as u}from"./chunk-JM72FNGA.js";import{a as c}from"./chunk-DS6QEB3G.js";function E(e,r,i={}){let n=d(e,r);if(!n)return{definitions:[],referencedBy:[]};let t=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),a=g(t?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:y(a,t?.display_name??null,n.symbol),source:S(e,n.relativePath,n.startLine,n.endLine)}],b=f(e,n,{semantic:i.semantic}).map(l=>({relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?s(l.enclosingSymbol):"(top-level)"}));return{definitions:o,referencedBy:b}}function S(e,r,i,n){let t=c(e,r);if(!t)return null;let o=t.split(`
|
|
2
2
|
`).slice(i,n+1).join(`
|
|
3
3
|
`).trimEnd();return o.length>0?o:null}function y(e,r,i){let n=m(e);if(n&&!p(n))return n;let t=(r??"").trim();return t?u(i)&&!t.endsWith("()")?`${t}()`:t:s(i)}function p(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{E as a};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-72QDTW5U.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as y,b as d,e as w,l as f}from"./chunk-
|
|
1
|
+
import{a as y,b as d,e as w,l as f}from"./chunk-TJXOD4IK.js";import{b as D,c as $,d as Q,f as v,g as A,h as N}from"./chunk-JM72FNGA.js";function re(e,n){let t=Z(e,n.trim());if(t)return t;let i=q(e,n);if(i)return i;let o=F(e,n);return o||j(e,n)}function F(e,n){let t=x(n),i=I(t);if(!i)return null;let o=`%${i.path}%`,r=i.leaf,c=O(e,o,r,t)[0];return c?f(e,c):null}function O(e,n,t,i){let o=w([],[...z(e,n,t),...W(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>h(r,i)>1);return o.sort((r,a)=>h(a,i)-h(r,i)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),o}function z(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function W(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function j(e,n){let t=x(n),i=U(n),o=H(e,i),r=V(o,n,t);if(r&&!e.isIgnored(r.relative_path))return f(e,r);let a=null;for(let c of o){if(e.isIgnored(c.relative_path))continue;let l=J(c,n,t,i);l<=0||(!a||l>a.score)&&(a={row:c,score:l})}return a?f(e,a.row):null}function q(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return null;let[,i,o,r]=t,a=Math.max(0,parseInt(o,10)-1),c=Math.max(a,parseInt(r,10)-1),l=T(e,i,a,c)??X(e,i,a,c);return l&&!e.isIgnored(l.relative_path)?f(e,l):null}function T(e,n,t,i){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function X(e,n,t,i){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Z(e,n){let i=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line",limit:1})[0]??d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line",limit:1})[0];return!i||e.isIgnored(i.relative_path)?null:f(e,i)}function ae(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=G(e,n.symbolId)[0];return t?f(e,t):null}function G(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),i=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return w(t,i)}function H(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=n.flatMap(c=>{let l=`%${c}%`;return[l,l,l]}),o=t.join(`
|
|
2
2
|
AND `),r=y(e,{where:o,params:i,limit:200}),a=d(e,{where:o,params:i,limit:200});return w(r,a)}function J(e,n,t,i){let o=n.trim(),r=t,a=r.replace(/\(\)$/,""),c=n.toLowerCase(),l=t.toLowerCase(),S=l.replace(/\(\)$/,""),k=e.symbol,C=$(e.symbol),b=Q(e.symbol),E=e.display_name??"",g=e.symbol.toLowerCase(),u=C.toLowerCase(),m=b.toLowerCase(),R=E.toLowerCase(),p=e.relative_path.toLowerCase(),K=/[/:.]/.test(t),M=I(t),_=M?.leaf.toLowerCase(),s=0;return(k===o||k===r)&&(s+=1150),(C===o||C===r)&&(s+=1100),E===a&&(s+=1180),b===a&&(s+=1160),(`${b}()`===o||`${b}()`===r)&&(s+=955),(g===c||g===l)&&(s+=1e3),(u===c||u===l)&&(s+=950),(p===c||p===l)&&(s+=925),(p.endsWith(`/${l}`)||p.endsWith(`/${c}`))&&(s+=875),R===S&&(s+=850),m===S&&(s+=825),(`${m}()`===c||`${m}()`===l)&&(s+=820),(u.endsWith(`:${l}`)||u.endsWith(`:${S}`)||u.endsWith(`:${S}()`))&&(s+=800),g.includes(l)&&(s+=120),u.includes(l)&&(s+=140),p.includes(l)&&(s+=140),R.includes(l)&&(s+=110),i.every(B=>{let L=B.toLowerCase();return g.includes(L)||u.includes(L)||p.includes(L)||R.includes(L)})&&(s+=100+i.length*15),M&&p.includes(M.path.toLowerCase())&&(s+=360,_&&(m===_||`${m}()`===_||`${m}()`==`${_}()`)&&(s+=700),v(e.symbol)&&(s+=180)),A(e.symbol)&&m===S&&(s+=60),!K&&N(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function I(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let i=n.slice(t+1).replace(/\(\)$/,"");return!i||i.includes(".")?null:{path:n.slice(0,t),leaf:i}}function x(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function U(e){let n=x(e),t=n.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return t.length>0?[...new Set(t)]:[n]}function V(e,n,t){let i=n.trim(),o=e.filter(r=>{let a=$(r.symbol),c=(r.display_name??"").trim();return r.symbol===i||a===i||a===t||c===i||c===t||`${c}()`===i||h(r,t)>1||r.relative_path===i});return o.length===0?null:(o.sort((r,a)=>h(a,t)-h(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),o[0]??null)}function h(e,n){let t=I(n);if(!t)return 0;let i=e.relative_path.toLowerCase(),o=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return i.includes(r)?o!==a?1:v(e.symbol)?D(e.symbol)===null?5:4:D(e.symbol)===null?3:2:0}export{re as a,Z as b,ae as c};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-733EF5FD.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as re}from"./chunk-YOCYR7KJ.js";import{a as oe}from"./chunk-BZ2RRK7Y.js";import{a as S}from"./chunk-B32FX5KB.js";import{a as ne}from"./chunk-QVS4SYAX.js";import{a as te}from"./chunk-EOUTP32Q.js";import{a as ie}from"./chunk-C2QSK7E7.js";import{a as X,b as ee}from"./chunk-FKYPOK7P.js";import{a as Z}from"./chunk-UJEVABIR.js";import{a as Q}from"./chunk-XYI7XRZC.js";import{a as J}from"./chunk-YNLK3G63.js";import{a as _,c as z,d as O,h as E,i as L}from"./chunk-FPYQA7JK.js";import{a as U,b as v,e as V}from"./chunk-P3K7LX7M.js";import{a as Y}from"./chunk-IA7Q6HVP.js";import{b as W}from"./chunk-CMXD5VC4.js";import{a as j,c as M,d as P,e as H}from"./chunk-MHATKJ3J.js";import{g as I}from"./chunk-KRGBLZT2.js";import{a as q}from"./chunk-27FU2KX7.js";import{a as N}from"./chunk-LONIY5FF.js";import{f as T,g as F}from"./chunk-MJXJ56LG.js";import{d as R,e as K}from"./chunk-JM72FNGA.js";import{createHash as Ie}from"crypto";import{existsSync as ue}from"fs";function se(e){let[i,t]=x(e,":"),n=i||"unknown",o=(s={})=>{let r=s.actionTier??ge(n);return{sourceAnalyzer:n,actionTier:r,rootCauseKey:s.rootCauseKey??(t||e),label:s.label??`${n} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??me(r,n),file:s.file}};if(!t)return o({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(n)){let[s,r]=x(t,":");return o({file:s,relatedFiles:s?[s]:[],rootCauseKey:r?`${s}:${r}`:t,label:`${n} finding`,why:r?[`Baseline subject: ${r}.`]:[]})}if(n==="cycle"){let s=t.split(">").filter(Boolean);return o({relatedFiles:s,rootCauseKey:t,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(n==="similar"){let s=t.split("|").filter(Boolean);return o({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(n==="drift"){let[s,r]=x(t,":"),[l,a]=x(r,":");return o({actionTier:s==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,a].filter(Boolean))],rootCauseKey:t,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...a?[`Related dependency: ${a}.`]:[]]})}return o({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function ge(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function me(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function x(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as pe,readFileSync as ae}from"fs";var w={classifyCitation:ye,citationContexts:be,citationKindLabel:Se,citationRemediation:$e,referenceTargets:De};function ye(e){let i=e.join(`
|
|
2
|
+
`).toLowerCase(),t=[],n=v(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(n.length>0)return t.push(`configuration/example terms near citation: ${n.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:t};let o=v(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return t.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:t};let s=v(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(t.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:t}):(t.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:t})}function be(e,i,t){let n;try{n=ae(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=t.flatMap(Ce),s=[];for(let r=0;r<n.length;r+=1){let l=n[r]??"";o.some(a=>l.includes(a))&&s.push(U(n,r))}return s}function Ce(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((t,n,o)=>t.length>0&&o.indexOf(t)===n)}function Se(e){switch(e){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function $e(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function De(e,i,t){let n=_(t),o=new Set;for(let s of i)we(e,s,n.get(s)??[])&&o.add(s);return o}function we(e,i,t){if(t.length===0)return!1;if(!ke.test(i))return!0;let n=`${e.config.projectRoot}/${i}`;if(!pe(n))return!0;let o=ae(n,"utf-8").split(/\r?\n/),s=Re(o);for(let r of t)for(let l=r.startLine;l<=r.endLine;l+=1)if((o[l]??"").trim()!==""&&!s.has(l))return!0;return!1}var ke=/\.(?:[cm]?[jt]sx?)$/i;function Re(e){let i=new Set,t=!1;for(let n=0;n<e.length;n+=1){let o=e[n].trim();!t&&Te(o)&&(t=!0),t&&(i.add(n),o.endsWith(";")&&(t=!1))}return i}function Te(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}import{existsSync as Fe,readFileSync as ve,writeFileSync as xe}from"fs";import{isAbsolute as Ae,join as Ge}from"path";var je=75e3,Ee=5e3,Le=2500;function Be(e){let i=ie(e);return i.symbols>=je||i.documents>=Ee?Le:void 0}var Ke=".scipquery-baseline.json";function A(e,i){return i&&Ae(i)?i:Ge(e.config.projectRoot,i??Ke)}function ce(e,i={}){let{scope:t}=i,n=Be(e),o=[],s=W(e,{scope:t,...S.dead,scanLimit:n});for(let r of s.symbols)T(e,r.relativePath)||F(e,r.symbol,r.relativePath)||r.kind==="dead-code"&&o.push(`dead:${r.relativePath}:${r.shortName}`);for(let r of Z(e,{scope:t,...S.isolated,scanLimit:n}))T(e,r.relativePath)||F(e,r.symbol,r.relativePath)||o.push(`isolated:${r.relativePath}:${r.shortName}`);for(let r of q(e,{scope:t}))r.kind==="real"&&o.push(`cycle:${Ne(r.path)}`);for(let r of ee(e,{scope:t,...S.similar,scanLimit:n}))o.push(`similar:${[r.symbolA,r.symbolB].sort().join("|")}`);for(let r of J(e,{scope:t,...S.extract,scanLimit:n}))o.push(`extract:${r.relativePath}:${r.shortName}`);for(let r of ne(e,{scope:t,...S.wrappers,scanLimit:n}))o.push(`wrapper:${r.file}:${r.shortName}`);for(let r of Q(e,{scope:t,...S.passthroughs,scanLimit:n}))o.push(`passthrough:${r.file}:${r.shortName}`);for(let r of te(e,{scope:t,...S.stale,scanLimit:n}))o.push(`stale:${r.file}:${r.shortName}`);for(let r of Y(e,{scope:t,...S.drift}).results)r.kind!=="pattern-deviation"&&o.push(`drift:${r.kind}:${r.file}:${r.dep}`);return[...new Set(o)].sort()}function Ne(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function Et(e,i={}){let t=ce(e,{scope:i.scope}),n=A(e,i.path);return xe(n,JSON.stringify({version:1,findings:t},null,2)+`
|
|
3
|
+
`),{path:n,findingCount:t.length}}function le(e,i={}){let t=A(e,i.path);if(!Fe(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let n=JSON.parse(ve(t,"utf-8")),o=new Set(n.findings??[]),s=ce(e,{scope:i.scope}),r=new Set(s);return{baselinePath:t,baselineCount:o.size,current:s,newFindings:s.filter(l=>!o.has(l)),fixedFindings:[...o].filter(l=>!r.has(l))}}var Jt=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function Zt(e,i={}){let t=i.base??"HEAD",{minTogether:n=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:r=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:a=!1,scanLimit:c}=i,y=i.semantic!==!1,u=new Set(i.skip??[]),f=O(e,{base:t}),p=z(e,{base:t,plan:f}),g=p.changedFiles,d=new Set(g),h=new Set(f.changedFileLines),b=E(e.config.projectRoot,t,L(f,g)),C=lt(e.config.projectRoot,t,f,b),m={base:t,changedFiles:g,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:p.summary.note};if(g.length===0)return m;let $=(B,he)=>{if(u.has(B)){m.skipped.push({check:B,reason:"skipped via --skip"});return}he()};return $("echo",()=>Oe(e,p.changedSymbols,d,C,s,l,c,y,m)),$("incomplete-migration",()=>Xe(e,t,f,r,c,y,b,m)),$("co-change-partner",()=>et(e,d,n,o,m)),$("doc-reference",()=>rt(e,d,h,f.changedRanges,m)),$("unused-params",()=>st(e,g,m)),$("new-dead",()=>at(e,p.changedSymbols,C,m)),a&&$("baseline",()=>ut(e,m)),_e(m,e.config.suppressions??[]),m.rootCauseGroups=Me(m.findings),m}function Me(e){let i=new Map;for(let t of e){let n=t.groupKey??`${t.check}:${t.id}`,o=i.get(n);o||(o={groupKey:n,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(n,o)),o.count+=1,o.findingIds.push(t.id),o.severity=Pe(o.severity,t.severity),o.actionTier=He(o.actionTier,t.actionTier),t.file&&o.files.add(t.file);for(let s of t.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,n)=>n.count-t.count||G(n.severity)-G(t.severity)||t.groupKey.localeCompare(n.groupKey))}function Pe(e,i){return G(i)>G(e)?i:e}function G(e){return e==="error"?2:e==="warning"?1:0}function He(e,i){return e?i&&fe(i)>fe(e)?i:e:i}function fe(e){return e==="direct"?2:e==="signal"?1:0}function _e(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let n of e.findings){let o=i.find(s=>ze(s,n));o?e.suppressed.push({finding:n,suppression:o}):t.push(n)}e.findings=t}function ze(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function k(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function Oe(e,i,t,n,o,s,r,l,a){a.checksRun.push("echo");for(let c of i.slice(0,o)){if(n(c))continue;let y=X(e,c.symbol,{minSimilarity:s,limit:5,scanLimit:r,semantic:l}),u=[];for(let d of y){let h=d.fileA===c.file?d.fileB:d.fileA,b=d.fileA===c.file?d.shortNameB:d.shortNameA,C=d.fileA===c.file?d.symbolB:d.symbolA;t.has(h)||u.push({otherFile:h,otherShort:b,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(u.length===0)continue;let f=u[0],p=D("echo",c.symbol,c.file,...u.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),g=Ue(c,u);k(a,{id:p,groupKey:p,actionTier:g,check:"echo",severity:"warning",evidence:"heuristic",confidence:f.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(u.map(d=>d.otherFile))].sort(),message:Je(c,u),why:Ze(c,u),remediation:Qe(g,c.shortName,f.otherShort)})}i.length>o&&a.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function Ue(e,i){return i.some(n=>Ve(e.symbol,n))?"direct":"signal"}function Ve(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=R(e),n=R(i.otherSymbol);return!t||!n?!1:t===n?!0:Ye(i.sharedEvidence)?!1:qe(t,n)}function qe(e,i){let t=de(e),n=de(i);if(t.length===0||n.length===0)return!1;let o=new Set(n),s=t.filter(r=>o.has(r)).length;return s>=2&&s/Math.min(t.length,n.length)>=.5}function de(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var We=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function Ye(e){return e.length>=3&&e.every(i=>We.has(i.toLowerCase()))}function Je(e,i){let t=i[0],n=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${n}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${n}% similar to ${t.otherShort} (${t.otherFile})`}function Ze(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let n of i.slice(0,3))t.push(`${n.otherShort} is outside this diff and scored ${Math.round(n.similarity*100)}% similar by ${n.similarityBasis} evidence.`),t.push(`Shared evidence: ${n.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function Qe(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function Xe(e,i,t,n,o,s,r,l){let a=oe(e,{base:i,maxHelpers:n,diffPlan:t,scanLimit:o,semantic:s,baseContentAt:r});if(!a.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),a.note&&l.skipped.push({check:"incomplete-migration",reason:a.note});for(let c of a.findings){let y=c.leftovers.map(h=>`${h.shortName} (${h.file}, ${Math.round(h.containment*100)}% helper / ${Math.round(h.siteCoverage*100)}% site, ${h.migrationScope})`).join(", "),u=c.leftovers.map(h=>`${h.shortName}: ${h.migrationScope} (${h.migrationScopeReasons[0]})`).join("; "),f=[...c.migratedFiles,...c.leftovers.map(h=>h.file)],p=c.leftovers.length===0?void 0:Math.max(...c.leftovers.map(h=>Math.min(h.containment,h.siteCoverage))),g=c.leftovers.some(h=>h.migrationScope==="possible-subtype"),d=D("incomplete-migration",c.helperSymbol,c.helperFile,f.join("|"));k(l,{id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:c.helperFile,symbol:c.helperSymbol,relatedFiles:f,message:`new helper ${c.helperShortName} (${c.helperFile}) is wired into ${c.migratedFiles.length} file(s), but ${c.leftovers.length} similar un-migrated site(s) remain: ${y}`,why:[`${c.helperShortName} is new in this diff and already referenced by ${c.migratedFiles.join(", ")}.`,`Helper shape: ${c.helperShape}; ${c.specificHelperCalleeCount}/${c.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${y}.`,`Migration scope hints: ${u}.`],remediation:g?`Migrate same-scope sites to ${c.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${c.helperShortName}, or confirm they are intentionally different.`})}}function et(e,i,t,n,o){let s=I(e,i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let r=new Set,l;for(let a of s){let c=i.has(a.fileA),y=i.has(a.fileB);if(c===y)continue;let u=c?a.fileA:a.fileB,f=c?a.fileB:a.fileA,p=c?a.changesA:a.changesB,g=p>0?a.together/p:0;if(g<n||j(f)||j(u)||!ue(`${e.config.projectRoot}/${f}`))continue;let d=`${u}|${f}`;if(r.has(d))continue;r.add(d);let h=D("co-change-partner",u,f,String(a.together)),b=M(u,f),C=P({fileA:u,fileB:f,together:a.together,confidence:g,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,(l??=H(e))(u,f)),m=[u,f].sort().join("|");o.findings.push({id:h,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${m}`,confidence:g,file:u,relatedFiles:[f],sourceAnalyzer:"co-change",rootCauseKey:m,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${u} changed, but ${f} did not \u2014 they change together ${a.together}x (${Math.round(g*100)}% of the time)`,why:[`${u} is in this diff and ${f} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(g*100)}% of changes to the edited side.`,`History context: ${tt(a)}.`,`Subject context: ${it(a.subjectContext)}.`,...nt(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:C?`Update ${f} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${f} alongside this change, or confirm the coupling no longer holds.`})}}function tt(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${ot(e.lastTogetherAt)}`}function it(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",n=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${n}; external issue/PR labels ${e.externalIssueLabelStatus}`}function nt(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function ot(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function rt(e,i,t,n,o){o.checksRun.push("doc-reference");let s=w.referenceTargets(e,i,n);if(s.size!==0)for(let r of V(e,s)){if(t.has(r.doc))continue;let l=r.citedClaims.length>0?r.citedClaims:w.citationContexts(e,r.doc,r.cited),a=w.classifyCitation(l),c=D("doc-reference",r.doc,r.cited.join("|"));k(o,{id:c,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:r.doc,relatedFiles:r.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:l,message:`${r.doc} cites ${r.cited.join(", ")} as ${w.citationKindLabel(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${r.cited.join(", ")} changed in this diff.`,`${r.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(y=>`Citation kind evidence: ${y}`)],remediation:w.citationRemediation(a.citationKind,r.doc)})}}function st(e,i,t){t.checksRun.push("unused-params");for(let n of re(e,{files:i,limit:50})){let o=D("unused-params",n.symbol,n.file,n.unusedTrailing.join("|"));k(t,{id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:n.file,startLine:n.startLine,endLine:n.endLine,symbol:n.symbol,message:`${n.shortName} (${n.file}) has trailing unused parameter(s): ${n.unusedTrailing.join(", ")}`,why:[`${n.shortName} is in a changed file.`,`The trailing parameter(s) ${n.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function at(e,i,t,n){n.checksRun.push("new-dead");let o=new N(e);for(let s of i){if(t(s)||s.fanIn>0||o.fileKind(s.file)==="test"||T(e,s.file)||F(e,s.symbol,s.file)||ct(s.symbol))continue;let r=D("new-dead",s.symbol,s.file);k(n,{id:r,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:"Wire it up, or remove it before it becomes permanent dead code."})}}function ct(e){if(K(e)!=="type")return!1;let i=R(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function lt(e,i,t,n){let o=new Map(t.renamedFiles.map(r=>[r.to,r.from])),s=n??E(e,i,L(t));return r=>{let l=o.get(r.file)??r.file,a=R(r.symbol);if(!a)return!1;let c=s(l);return c!==null&&ft(c,a)}}function ft(e,i){return new RegExp(`\\b${dt(i)}\\b`).test(e)}function dt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ut(e,i){if(!ue(A(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=le(e);for(let n of t.newFindings){let o=se(n),s=D("baseline",n);k(i,{id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${n}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation})}}function D(e,...i){return`SQ${Ie("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{ce as a,Et as b,le as c,Jt as d,Zt as e,lt as f};
|
|
4
|
+
//# sourceMappingURL=chunk-7AOMEMOA.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as d}from"./chunk-64MNV6AB.js";import{c as S}from"./chunk-7S5E7KWT.js";import{readdirSync as p}from"fs";import{execFileSync as x}from"child_process";import{extname as l,join as y}from"path";var m=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],F=[".vue"],f=[".tsx",".jsx"],g=[".vue"],_=[...f,...g],h=new Set(f),C=new Set(g),E=new Set(m.map(e=>e.toLowerCase())),O=[...E].sort().join(","),I=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function R(e,n={}){let o=n.includeIndexed??!0,s=n.includeAuxiliary??!0,t=n.extensions?.map(c=>c.toLowerCase()),i=t?new Set(t):E,u=t?[...i].sort().join(","):O,r=`${o?"1":"0"}|${s?"1":"0"}|${u}`;return N.get(e,r,()=>{let c=new Set;if(o)for(let a of d(e,{includeIgnored:!1}))i.has(l(a).toLowerCase())&&c.add(a);if(s)for(let a of w(e.config.projectRoot,i))e.isIgnored(a)||o&&c.has(a)||c.add(a);return[...c].sort()})}function X(e,n={}){let o=!1,s=!1;for(let t of R(e,{extensions:_})){if(n.scope&&!t.includes(n.scope))continue;let i=l(t).toLowerCase();if(o||=h.has(i),s||=C.has(i),o&&s)break}return{react:o,vue:s}}var N=S("source-files",{clearGroups:[]});function w(e,n){return T(e,n)??v(e,n)}function T(e,n){try{let o=x("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,stdio:["ignore","pipe","ignore"]}),s=new Set;for(let t of o.split(`
|
|
2
|
+
`)){let i=t.trim();i&&n.has(l(i).toLowerCase())&&s.add(i)}return s}catch{return null}}function v(e,n){let o=new Set,s=t=>{let i=t?y(e,t):e,u;try{u=p(i,{withFileTypes:!0})}catch{return}for(let r of u)if(!I.has(r.name)){if(r.isDirectory()){s(t?`${t}/${r.name}`:r.name);continue}n.has(l(r.name).toLowerCase())&&o.add(t?`${t}/${r.name}`:r.name)}};return s(""),o}export{F as a,I as b,R as c,X as d};
|
|
3
|
+
//# sourceMappingURL=chunk-A536TEU4.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{d as D,e as A,g as H}from"./chunk-FKYPOK7P.js";import{d as L}from"./chunk-HDBQHJNY.js";import{b as w,d as _,h as T,i as E}from"./chunk-FPYQA7JK.js";import{a as N}from"./chunk-LONIY5FF.js";import{c as b,d as F}from"./chunk-JM72FNGA.js";var V=5;function re(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??_(e,{base:a}),l={available:s.note!==w,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new N(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),z=t.baseContentAt??T(e.config.projectRoot,a,E(s)),h=X(x,k,$,z);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let j=D(e,{minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M=A(j),q=x.calleeMap(R,{semantic:f}),B=R.map(i=>({def:i,callees:H((q.get(i.symbolId)??[]).map(p=>p.symbol))}));for(let{def:i,callees:p}of B){let d=b(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=W(p,M);if(P===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let C=Y(e,i.symbolId);if(C.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=G({candidateIndex:M,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:C});I.length!==0&&(I.sort((u,S)=>O(S.migrationScope)-O(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:P,migratedFiles:C.sort(),leftovers:I.slice(0,V)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function G(e){let t=[],a=J(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=L(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=K(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:b(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(b).sort()})}return t}function O(e){return e==="same-scope"?2:e==="unknown"?1:0}function J(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function K(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var U=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!U.has(t))}function W(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function X(e,t,a,o){return e.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${Z(r.leaf)}\\b`).test(c)})}function Y(e,t){return e.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
|
+
${e.pathExclusionsFor("ref_d")}`,t).map(o=>o.relative_path)}function Z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{re as a};
|
|
8
|
+
//# sourceMappingURL=chunk-BZ2RRK7Y.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import{c as d}from"./chunk-7S5E7KWT.js";import{createHash as h}from"crypto";import{readFileSync as T}from"fs";import{createRequire as m}from"module";import{dirname as E,join as g}from"path";import v from"better-sqlite3";var N=m(import.meta.url),S="evidence.db",p=new WeakMap,y=d("evidence-content-hash",{clearGroups:["whole-project","source-file"]}),_=d("evidence-project-fingerprint",{clearGroups:["whole-project"]});function L(){for(let n of["../package.json","../../package.json"])try{return N(n).version}catch{}return"0.0.0"}var s=L();function f(n){return h("sha256").update(n).digest("hex")}function w(n,t,e){return y.get(n,t,()=>f(e))}function F(n){return _.get(n,"current",()=>{try{let t=JSON.parse(T(g(E(n.config.dbPath),"meta.json"),"utf-8"));if(t.version!==2&&t.version!==3||t.status!=="complete"||t.fingerprint===void 0)return null;let e=Array.isArray(t.indexedLanguages)?[...t.indexedLanguages].sort():[];return f(JSON.stringify({fingerprint:t.fingerprint,indexedLanguages:e}))}catch(t){return u("project fingerprint unavailable",t),null}})}function u(n,t){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${n}: ${t instanceof Error?t.message:String(t)}`)}function c(n){if(p.has(n))return p.get(n)??null;let t=null;try{let e=new v(g(E(n.config.dbPath),S));e.pragma("journal_mode = WAL"),e.pragma("busy_timeout = 5000"),e.pragma("synchronous = NORMAL"),e.exec(`
|
|
2
|
+
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
3
|
+
kind TEXT NOT NULL,
|
|
4
|
+
relative_path TEXT NOT NULL,
|
|
5
|
+
content_hash TEXT NOT NULL,
|
|
6
|
+
version TEXT NOT NULL,
|
|
7
|
+
payload TEXT NOT NULL,
|
|
8
|
+
PRIMARY KEY (kind, relative_path)
|
|
9
|
+
);
|
|
10
|
+
CREATE TABLE IF NOT EXISTS semantic_callees (
|
|
11
|
+
relative_path TEXT NOT NULL,
|
|
12
|
+
symbol TEXT NOT NULL,
|
|
13
|
+
content_hash TEXT NOT NULL,
|
|
14
|
+
deps_digest TEXT NOT NULL,
|
|
15
|
+
version TEXT NOT NULL,
|
|
16
|
+
payload TEXT NOT NULL,
|
|
17
|
+
PRIMARY KEY (relative_path, symbol)
|
|
18
|
+
);
|
|
19
|
+
CREATE TABLE IF NOT EXISTS semantic_references (
|
|
20
|
+
relative_path TEXT NOT NULL,
|
|
21
|
+
symbol TEXT NOT NULL,
|
|
22
|
+
project_fingerprint TEXT NOT NULL,
|
|
23
|
+
version TEXT NOT NULL,
|
|
24
|
+
payload TEXT NOT NULL,
|
|
25
|
+
PRIMARY KEY (relative_path, symbol)
|
|
26
|
+
);
|
|
27
|
+
`),t={evidence:e,readFileEvidence:e.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:e.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:e.prepare(`SELECT payload FROM semantic_callees
|
|
28
|
+
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),writeCallees:e.prepare(`INSERT OR REPLACE INTO semantic_callees
|
|
29
|
+
(relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:e.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?"),readReferences:e.prepare(`SELECT payload FROM semantic_references
|
|
30
|
+
WHERE relative_path = ? AND symbol = ? AND project_fingerprint = ? AND version = ?`),writeReferences:e.prepare(`INSERT OR REPLACE INTO semantic_references
|
|
31
|
+
(relative_path, symbol, project_fingerprint, version, payload) VALUES (?, ?, ?, ?, ?)`),dropStaleReferences:e.prepare("DELETE FROM semantic_references WHERE project_fingerprint != ?")}}catch(e){u("disabled (open failed)",e)}return p.set(n,t),t}function o(n,t,e){u(`disabled (${t})`,e),p.set(n,null)}function x(n,t,e,a){let r=c(n);if(!r)return null;try{return r.readFileEvidence.get(t,e,a,s)?.payload??null}catch(i){return o(n,"file_evidence read",i),null}}function I(n,t,e,a,r){let i=c(n);if(i)try{i.writeFileEvidence.run(t,e,a,s,r)}catch(l){o(n,"file_evidence write",l)}}function U(n,t,e,a,r){let i=c(n);if(!i)return null;try{return i.readCallees.get(t,e,a,r,s)?.payload??null}catch(l){return o(n,"semantic_callees read",l),null}}function j(n,t,e,a){let r=c(n);if(!r)return null;try{return r.readReferences.get(t,e,a,s)?.payload??null}catch(i){return o(n,"semantic_references read",i),null}}function X(n,t){if(t.length===0)return;let e=c(n);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let r of t){let i=`${r.relativePath}\0${r.contentHash}`;a.has(i)||(a.add(i),e.dropStaleCallees.run(r.relativePath,r.contentHash)),e.writeCallees.run(r.relativePath,r.symbol,r.contentHash,r.depsDigest,s,r.payload)}})()}catch(a){o(n,"semantic_callees write",a)}}function P(n,t){if(t.length===0)return;let e=c(n);if(e)try{e.evidence.transaction(()=>{let a=new Set;for(let r of t)a.has(r.projectFingerprint)||(a.add(r.projectFingerprint),e.dropStaleReferences.run(r.projectFingerprint)),e.writeReferences.run(r.relativePath,r.symbol,r.projectFingerprint,s,r.payload)})()}catch(a){o(n,"semantic_references write",a)}}export{f as a,w as b,F as c,x as d,I as e,U as f,j as g,X as h,P as i};
|
|
32
|
+
//# sourceMappingURL=chunk-C6ROZBJA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as Z}from"./chunk-B75HZHUP.js";import{a as v}from"./chunk-LONIY5FF.js";import{b as B,e as W,f as U,g as H}from"./chunk-MJXJ56LG.js";import{a as J}from"./chunk-MFWAZFYD.js";import{c as V,d as q,f as E,k as G}from"./chunk-W2TIXAGN.js";import{e as z}from"./chunk-U73YFD3P.js";import{b as F}from"./chunk-G2CGUNQU.js";import{f as K,m as x}from"./chunk-TJXOD4IK.js";import{c as k,f as T,g as M,h as A,i as O,j}from"./chunk-JM72FNGA.js";import{a as N,d as _}from"./chunk-5MHQI4RR.js";import{a as P}from"./chunk-DS6QEB3G.js";import{a as g}from"./chunk-64MNV6AB.js";import{b as S}from"./chunk-7S5E7KWT.js";var h=new WeakMap;function $(e,t){let n=N(t);return n==="rust"?Re(e,t):n==="typescript"||n==="tsx"||n==="javascript"?ye(e,t):[]}var me=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),pe=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,be=/\buse[A-Z][A-Za-z0-9_$]*/;function ye(e,t){let n=P(e,t);if(!n||!ge(n))return[];let r=_(e,t);if(!r)return[];let o=h.get(r);if(o)return o;let i=!1,s=r.rootNode;for(let c of s.namedChildren){if(c.type!=="expression_statement")continue;let l=c.namedChild(0);if(!l||l.type!=="call_expression")continue;let a=l.namedChild(0);if(!a)continue;let d=a.type==="member_expression"?a.namedChild(a.namedChildCount-1)?.text:a.text;if(d&&me.has(d)){i=!0;break}}let u=[];i&&u.push({startLine:0,endLine:s.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"});for(let c of s.namedChildren){let l=null,a=null;if(c.type==="function_declaration")l=c.namedChild(0)?.text??null,a=c;else if(c.type==="export_statement"){let d=c.namedChild(0);d?.type==="function_declaration"&&(l=d.namedChild(0)?.text??null,a=d)}else if(c.type==="lexical_declaration"){let d=c.namedChild(0);if(d?.type==="variable_declarator"){let m=d.namedChild(0)?.text,b=d.namedChild(1);m&&(b?.type==="arrow_function"||b?.type==="function_expression")&&(l=m,a=d)}}l&&/^use[A-Z]/.test(l)&&a&&u.push({startLine:a.startPosition.row,endLine:a.endPosition.row,reason:"React custom hook (use*)"})}return u.push(...Q(r,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),h.set(r,u),u}function ge(e){return e.includes("scip-query")||pe.test(e)||be.test(e)}var he=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function xe(e){return he.test(e)}function Q(e,t,n){let r=[],o=i=>{if(t.has(i.type)&&i.parent){let u=i.parent.children,c=-1;for(let l=0;l<u.length;l+=1)if(u[l].startIndex===i.startIndex&&u[l].type===i.type){c=l;break}if(c>0)for(let l=c-1;l>=0;l-=1){let a=u[l];if(n.has(a.type)){if(xe(a.text)){r.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(a.type==="attribute_item"||a.type==="inner_attribute_item"))break}}for(let s of i.namedChildren)o(s)};return o(e.rootNode),r}function Re(e,t){let n=_(e,t);if(!n)return[];let r=h.get(n);if(r)return r;let o=[],i=Se(n);return i?(h.set(n,i),i):(Y(n.rootNode,o,!1,!1),o.push(...Q(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),o.push(...Ie(n.rootNode)),h.set(n,o),o)}function Se(e){return Pe(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function Y(e,t,n,r){let o=n,i=r;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(i=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?_e(e,t,n,r):r&&we(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?Ee(e,t,n):e.type==="mod_item"&&C(e).some(s=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(s))&&(o=!0);for(let s of e.namedChildren)Y(s,t,o,i)}function _e(e,t,n,r){let o=C(e),i=null;r?i="trait impl method (dynamic dispatch)":n&&(i="inside #[cfg(test)] mod");for(let s of o){let u=Ce(s);if(u){i=u;break}if(ee(s)){i="#[allow(dead_code)]";break}}i&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:i})}function Ee(e,t,n){let r=C(e),o=e.namedChildren.find(i=>i.type==="type_identifier")?.text;r.some(Le)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:o}),r.some(ee)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:o}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:o})}function C(e){let t=e.parent;if(!t)return[];let n=t.children,r=-1;for(let i=0;i<n.length;i+=1)if(n[i].startIndex===e.startIndex&&n[i].type===e.type){r=i;break}if(r<=0)return[];let o=[];for(let i=r-1;i>=0;i-=1){let s=n[i];if(s.type==="attribute_item"||s.type==="inner_attribute_item")o.push(s.text);else{if(s.type==="line_comment"||s.type==="block_comment")continue;break}}return o}var ve=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function Ce(e){return ve.find(({re:t})=>t.test(e))?.reason??null}var De=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Le(e){return/#\[\s*derive\s*\(/.test(e)?De.some(t=>t.test(e)):!1}function ee(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function we(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ie(e){let t=Fe(e);if(t.size===0)return[];let n=[];for(let r of e.descendantsOfType("mod_item")){let o=r.childForFieldName("name")?.text;o&&t.has(o)&&n.push({startLine:r.startPosition.row,endLine:r.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:o})}return n}function Pe(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var Ne=/^#!?\[\s*serde\s*\(/,X=/\bwith\s*=\s*"([^"]+)"/g;function Fe(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){if(!Ne.test(n.text))continue;X.lastIndex=0;let r;for(;(r=X.exec(n.text))!==null;){let o=r[1],i=o.split("::").pop()??o;i&&t.add(i)}}return t}function te(e){let t=new Map,n=r=>{let o=t.get(r);if(o)return o;let i=$(e,r);return o={ranges:i.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(i.map(s=>s.containerName).filter(s=>!!s))},t.set(r,o),o};return(r,o,i,s)=>{let u=n(r);for(let c of u.ranges)if(o>=c.startLine&&o<=c.endLine)return!0;if(s&&u.containers.has(s))return!0;for(let c of x(i))if(u.containers.has(c))return!0;return!1}}function et(e,t={}){S(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,t,n={}){S(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function re(e,t){return t.isIgnoredPath(e.relativePath)?p("ignored-file"):A(e.symbol)?p("module-like-symbol"):ne(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&ne(e.enclosingSymbol)?p("nested-non-callable-value"):!t.includeTests&&!L(e.relativePath)?p("test-file"):!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?p("excluded-file-region"):O(e.symbol)?p("rust-trait-impl-member"):j(e.symbol)?p("rust-test-module"):!t.includeMembers&&!ke(e)?p("member"):e.endLine-e.startLine+1<t.minLoc?p("below-min-loc"):{accepted:!0}:p("non-value-symbol")}function L(e){return B(e)!=="test"}function p(e){return{accepted:!1,rejectionReason:e}}function ne(e){return M(e)||e.endsWith("().")||e.endsWith(".")}function ke(e){return T(e.symbol)||x(e.symbol).length===0}function oe(){return new Map}function ie(e,t,n){let r=new Map;for(let o of V(e,n))e.isIgnored(o.relative_path)||t.has(o.relative_path)||R(r,o.symbol_id,o.relative_path,o.ref_count,"scip-mention");return r}function se(e,t,n){let r=new Set;for(let o of q(e,t))e.isIgnored(o.relative_path)||n.has(o.relative_path)||r.add(o.symbol_id);return r}function w(e,t){let n=e.get(t);if(!n)return!1;for(let r of n.values())if(r.occurrences>0)return!0;return!1}function I(e,t,n){let r=e.get(t);if(!r)return!1;for(let[o,i]of r)if(o!==n&&i.occurrences>0)return!0;return!1}function ae(e){return e?.occurrences??0}function R(e,t,n,r,o="source-fallback"){if(r<=0)return;let i=le(e,t,n);i.occurrences+=r,i.sources.add(o)}function ce(e,t,n,r,o){if(r<=0)return;let i=le(e,t,n);i.occurrences=Math.max(r,i.occurrences),i.sources.add(o)}function le(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));let o=r.get(n);return o||(o={occurrences:0,sources:new Set},r.set(n,o)),o}var Te=3e3,Me=1e3;function Et(e,t={}){let{scope:n,minLoc:r=1,includeTests:o=!1,skipBarrels:i=!1,includeMembers:s=!1,deadCodeOnly:u=!1,scanLimit:c,semantic:l=!0}=t,a=Z(Ae(e,{scope:n,minLoc:r,includeTests:o,includeMembers:s}),c),d=i?new Set(W(e)):new Set,m=u?oe():ie(e,d,a.map(f=>f.symbolId)),b=u?se(e,a.map(f=>f.symbolId),d):new Set,y=u?a.filter(f=>!b.has(f.symbolId)):a.filter(f=>!I(m,f.symbolId,f.relativePath));u?Ue(e,y,m,d):We(e,y,m,d);let de=u?y.filter(f=>!w(m,f.symbolId)):y.filter(f=>!I(m,f.symbolId,f.relativePath));ze(e,de,m,{includeTests:o,inactiveBarrelPaths:d,includeSemantic:!u&&l});let fe=u?y.filter(f=>!w(m,f.symbolId)):a;return Be(e,Oe(fe,m))}function Ae(e,t){let n=te(e),r=[];for(let o of g(e,{scope:t.scope}))try{for(let i of K(e,o))re(i,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:u=>e.isIgnored(u),isExcludedRegion:n}).accepted&&r.push(i)}finally{D(e,o,{definitions:!0})}return r}function Oe(e,t){return e.map(n=>je(n,t)).filter(n=>n.cross_file_refs===0).sort((n,r)=>r.loc-n.loc||n.relative_path.localeCompare(r.relative_path)||n.start_line-r.start_line)}function je(e,t){let n=t.get(e.symbolId)??new Map,r=ae(n.get(e.relativePath)),o=0;for(let[i,s]of n)i!==e.relativePath&&(o+=s.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:r,cross_file_refs:o}}function Be(e,t){let n=[],r=0,o=0,i=0;for(let s of t){if(e.isIgnored(s.relative_path)||U(e,s.relative_path)||H(e,s.symbol,s.relative_path))continue;let u=s.same_file_refs===0?"dead-code":"file-internal";u==="dead-code"?r++:o++,i+=s.loc,n.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:k(s.symbol),sameFileRefs:s.same_file_refs,kind:u})}return{symbols:n,counts:{total:n.length,deadCode:r,fileInternal:o,loc:i},totalCount:n.length,deadCodeCount:r,fileInternalCount:o,totalLoc:i}}function We(e,t,n,r){if(t.length===0)return;let o=new v(e),i=new Set(t.map(c=>c.symbolId)),s=new Set(t.map(c=>c.leaf).filter(Boolean)),u=new Set(o.sourceFiles());for(let c of g(e))u.add(c);o.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:s,skipPath:c=>r.has(c)},c=>{i.has(c.target.symbolId)&&(Ve(e,c)||R(n,c.target.symbolId,c.sourceFile,qe(c),"source-fallback"))})}function Ue(e,t,n,r){if(t.length===0)return;let o=new v(e),i=He(t),s=new Set(o.sourceFiles());for(let a of g(e))s.add(a);let u=new Set(i.keys()),c=new Map,l=a=>{let d=c.get(a);return d||(d=G(e,a),c.set(a,d)),d};o.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:a=>r.has(a),resolveTargets:({sourceFile:a,name:d,kind:m})=>{let b=i.get(d);return b?Ke(a,d,b,l(a),{permissive:m!=="cross-language-dispatch"}):[]},afterPath:a=>{c.delete(a),D(e,a)}},a=>{let d=a.kind==="identifier"&&a.sourceFile===a.target.relativePath?Math.max(0,a.occurrences-1):a.occurrences;a.kind==="identifier"&&ue(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(n,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function He(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let r=t.get(n.leaf)??[];r.push(n),t.set(n.leaf,r)}return t}function Ke(e,t,n,r,o){let i=n.filter(c=>c.relativePath===e);if(i.length>0)return i;if(!o.permissive&&n.length===1)return[...n];let s=r.get(t);if(s)for(let c of s){let l=n.filter(a=>E(c,a.relativePath));if(l.length>0)return l}let u=new Set;for(let c of r.values())for(let l of c)u.add(l);for(let c of u){let l=n.filter(a=>E(c,a.relativePath));if(l.length>0&&l.length===n.length)return l}return o.permissive?[...n]:[]}function Ve(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&ue(e,t)}function qe(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ue(e,t){return t.occurrences>1?!1:F(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function ze(e,t,n,r){let o=r.includeSemantic!==!1,i=o&&t.length>=Te&&g(e).length>=Me,s=(c,l)=>{l===c.relativePath||e.isIgnored(l)||r.inactiveBarrelPaths.has(l)||!r.includeTests&&!L(l)||ce(n,c.symbolId,l,1,"caller-map")};for(let c of t){let l=J(e,c,{semantic:o&&!i});if(l.length!==0)for(let a of l)s(c,a.file)}if(!i)return;let u=z(e,t);for(let c of t){let l=u.get(c.symbolId);if(l)for(let a of l)s(c,a)}}export{et as a,Et as b};
|
|
2
|
+
//# sourceMappingURL=chunk-CMXD5VC4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as o,d as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as o,d as a}from"./chunk-FXWV2V7K.js";import{a as p}from"./chunk-PVZMPG5I.js";import{a as c,b as m,c as f}from"./chunk-HDBQHJNY.js";import{c as u}from"./chunk-YZA6PPZL.js";function D(n,i={}){let{minSimilarity:t=.62,minTokens:e=8,limit:l=20,scope:d,scanLimit:h,filePattern:k}=i,P=g(n,{scope:d,minTokens:e,scanLimit:h});return p({profiles:P,limit:l,filePattern:k,compare:(r,s)=>v(r,s,t),sort:(r,s)=>s.similarity-r.similarity||r.fileA.localeCompare(s.fileA)||r.fileB.localeCompare(s.fileB)})}function g(n,i){return u(n,{scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(t=>({file:t.file,tokens:t.templateTokens,loc:C(t)}))}function C(n){return n.totalLines}function v(n,i,t){let e=c(n.tokens,i.tokens);if(e.size<6||!T(e))return null;let l=f(n.tokens,i.tokens);return l<t?null:{fileA:n.file,fileB:i.file,similarity:l,sharedTokens:a(e),sharedComponents:o(e,"component:"),sharedProps:o(e,"prop:"),sharedEvents:o(e,"event:"),sharedDirectives:o(e,"directive:"),sharedSlots:o(e,"slot:"),sharedIdentifiers:o(e,"id:"),uniqueToA:a(m(n.tokens,i.tokens)).slice(0,25),uniqueToB:a(m(i.tokens,n.tokens)).slice(0,25),locA:n.loc,locB:i.loc}}function T(n){let i=0,t=0;for(let e of n)e.startsWith("component:")&&(i+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("directive:")||e.startsWith("slot:"))&&(t+=1);return i>=1||t>=3}export{D as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CQEJU32R.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-LONIY5FF.js";import{a as l}from"./chunk-733EF5FD.js";import{d as o,f as a}from"./chunk-JM72FNGA.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-DBTL56LR.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as C}from"./chunk-ZUTV7DDX.js";import{a as D}from"./chunk-CQEJU32R.js";import{a as f}from"./chunk-M3YEHOCD.js";import{a as g}from"./chunk-JOGZKF5W.js";import{b as y}from"./chunk-FKYPOK7P.js";import{e as h}from"./chunk-KRGBLZT2.js";import{d as p}from"./chunk-A536TEU4.js";var F=.7,S=.62,R=.45;function $(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=h(i);if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let d=A(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic}).map(r=>I(r,s,e)).filter(r=>r!==null);d.sort((r,c)=>(r.kind===c.kind?0:r.kind==="echo"?-1:1)||c.similarity-r.similarity||r.echoFile.localeCompare(c.echoFile)||r.echoSymbol.localeCompare(c.echoSymbol)||r.domain.localeCompare(c.domain));let b=d.slice(0,n).map(w);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:T(b)}}function A(i,t){let e=K(t.limit),n=[...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??F,limit:e,scanLimit:t.scanLimit,semantic:t.semantic})],a=p(i,{scope:t.scope});return a.react&&n.push(...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit})),a.vue&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit}),...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit})),n}function B(i,t){return y(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function k(i,t){return u(i,t,{query:f,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:P(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:g,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}function E(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function x(i,t){return u(i,t,{query:C,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function I(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let l=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:a)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function w(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function T(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:N(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let l of n.sharedEvidence)s.sharedEvidence.add(l)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function N(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function P(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{$ as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DOZ2X6TS.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{c as g,e as h}from"./chunk-7S5E7KWT.js";import{
|
|
2
|
-
`):[]})}var N=/^\s*(?:\/\/|#|\/\*+|\*)\s*scip-query[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar))?\b/i;function R(e){let t=N.exec(e);return t?t[1]??"":null}function X(e,t,r){if(r<=0)return!1;let n=A(e,t);if(n.length===0)return!1;for(let s=r-1;s>=0&&s>=r-5;s-=1){let a=(n[s]??"").trim();if(a!==""){if(R(a)!==null)return!0;if(!a.startsWith("//")&&!a.startsWith("*")&&!a.startsWith("/*")&&!a.startsWith("@")&&!a.startsWith("#"))return!1}}return!1}import{createRequire as P}from"module";var c=P(import.meta.url),p=null,k=!1;function T(){if(k)return null;if(p)return p;try{return p=c("tree-sitter"),p}catch{return k=!0,null}}var C=new Map,m=new Set;function
|
|
3
|
-
`).length}function z(e,t,r){let n={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!r)return n;let s;try{s=
|
|
4
|
-
`).length-1):0;return{kind:r,ownerPath:t,sourcePath:o,external:!0,src:i,attrs:s,lang:a,body:u,startLine:0,endLine:F,errors:u?[]:[`Vue ${r} block source not found: ${o}`]}}let S=Math.max(0,n.loc.start.line-1);return{kind:r,ownerPath:t,sourcePath:t,external:!1,attrs:s,lang:a,body:n.content,startLine:S,endLine:Math.max(S,n.loc.end.line-1),errors:[]}}function W(e,t){let r=t.split(/[?#]/,1)[0];if(!r||r.startsWith("/")||r.includes("://"))return null;let n=B(y.normalize(y.join(y.dirname(e),r)));return n===".."||n.startsWith("../")?null:n}function $(e){return{...e}}function L(e){return e instanceof Error?e.message:String(e)}function oe(e,t){let r=
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as g,e as h}from"./chunk-7S5E7KWT.js";import{readFileSync as w}from"fs";import{join as V}from"path";var j=g("source-text",{clearGroups:["whole-project","source-file"]}),v=g("source-lines",{clearGroups:["whole-project","source-file"]});function l(e,t){let r=t.replace(/\\/g,"/");return j.get(e,r,()=>{let n=V(e.config.projectRoot,r);try{return w(n,"utf-8")}catch(s){if(_(s))return"";throw s}})}function _(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function A(e,t){let r=t.replace(/\\/g,"/");return v.get(e,r,()=>{let n=l(e,r);return n?n.split(`
|
|
2
|
+
`):[]})}var N=/^\s*(?:\/\/|#|\/\*+|\*)\s*scip-query[\s:-]*ignore(?:[\s:-]+(dead(?:-code)?|stale|wrapper|passthrough|drift|extract|similar))?\b/i;function R(e){let t=N.exec(e);return t?t[1]??"":null}function X(e,t,r){if(r<=0)return!1;let n=A(e,t);if(n.length===0)return!1;for(let s=r-1;s>=0&&s>=r-5;s-=1){let a=(n[s]??"").trim();if(a!==""){if(R(a)!==null)return!0;if(!a.startsWith("//")&&!a.startsWith("*")&&!a.startsWith("/*")&&!a.startsWith("@")&&!a.startsWith("#"))return!1}}return!1}import{createRequire as P}from"module";var c=P(import.meta.url),p=null,k=!1;function T(){if(k)return null;if(p)return p;try{return p=c("tree-sitter"),p}catch{return k=!0,null}}var C=new Map,m=new Set;function E(e){if(m.has(e))return null;let t=C.get(e);if(t)return t;let r;try{switch(e){case"rust":r=c("tree-sitter-rust");break;case"typescript":r=c("tree-sitter-typescript").typescript;break;case"tsx":r=c("tree-sitter-typescript").tsx;break;case"javascript":r=c("tree-sitter-javascript");break;case"python":r=c("tree-sitter-python");break;case"java":r=c("tree-sitter-java");break;case"kotlin":r=c("tree-sitter-kotlin");break;case"scala":r=c("tree-sitter-scala");break;case"ruby":r=c("tree-sitter-ruby");break;case"c":r=c("tree-sitter-c");break;case"cpp":r=c("tree-sitter-cpp");break;case"csharp":r=c("tree-sitter-c-sharp");break;case"php":r=c("tree-sitter-php").php;break;case"vb":{let n=c("tree-sitter-vb-dotnet");r=n.language??n;break}}}catch{return m.add(e),null}return C.set(e,r),r}var x=new Map;function M(e){let t=x.get(e);if(t)return t;let r=E(e);if(!r)return null;let n=T();if(!n)return null;let s=new n;try{s.setLanguage(r)}catch{return m.add(e),null}return x.set(e,s),s}function Q(e,t){return e.parse(n=>n>=t.length?null:t.slice(n,Math.min(t.length,n+16384)))}function Z(e,t){let r=M(e);if(!r)return null;try{return Q(r,t)}catch{return null}}import{posix as y}from"path";import{parse as U}from"@vue/compiler-sfc";var I=h("vue-sfc-units");function ae(e,t){let r=B(t),n=l(e,r);return I.get(e,r,n,()=>z(e,r,n))}function B(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function D(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function ce(e){return!e||e.body.length===0?0:e.body.split(`
|
|
3
|
+
`).length}function z(e,t,r){let n={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!r)return n;let s;try{s=U(r,{filename:t})}catch(i){return n.errors.push(L(i)),n}n.errors.push(...s.errors.map(L));let{descriptor:a}=s;return a.template&&(n.template=f(e,t,"template",a.template)),a.script&&n.scripts.push(b(e,t,a.script,!1)),a.scriptSetup&&n.scripts.push(b(e,t,a.scriptSetup,!0)),n.styles=a.styles.map(i=>f(e,t,"style",i)),n.customBlocks=a.customBlocks.map(i=>f(e,t,"custom",i)),n.errors.push(...[n.template,...n.scripts,...n.styles,...n.customBlocks].flatMap(i=>i?.errors??[])),n}function b(e,t,r,n){let s=f(e,t,"script",r);return{...s,kind:"script",setup:n,astLanguage:D(s.lang)}}function f(e,t,r,n){let s=$(n.attrs),a=typeof s.lang=="string"?s.lang:null,i=typeof s.src=="string"?s.src:typeof n.src=="string"?n.src:void 0;if(i){let o=W(t,i);if(!o)return{kind:r,ownerPath:t,sourcePath:t,external:!0,src:i,attrs:s,lang:a,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${r} block source: ${i}`]};let u=l(e,o),F=u?Math.max(0,u.split(`
|
|
4
|
+
`).length-1):0;return{kind:r,ownerPath:t,sourcePath:o,external:!0,src:i,attrs:s,lang:a,body:u,startLine:0,endLine:F,errors:u?[]:[`Vue ${r} block source not found: ${o}`]}}let S=Math.max(0,n.loc.start.line-1);return{kind:r,ownerPath:t,sourcePath:t,external:!1,attrs:s,lang:a,body:n.content,startLine:S,endLine:Math.max(S,n.loc.end.line-1),errors:[]}}function W(e,t){let r=t.split(/[?#]/,1)[0];if(!r||r.startsWith("/")||r.includes("://"))return null;let n=B(y.normalize(y.join(y.dirname(e),r)));return n===".."||n.startsWith("../")?null:n}function $(e){return{...e}}function L(e){return e instanceof Error?e.message:String(e)}function oe(e,t){let r=O(e,t);if(!r)return null;let n=d(r);return n?{calleeLeaf:n,memberAccess:q(r),line:e.startPosition.row}:null}function O(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return e.childForFieldName("function")??e.namedChild(0);if(e.type==="new_expression")return e.childForFieldName("constructor")??e.namedChild(0)}return null}function q(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function d(e){switch(e.type){case"identifier":case"type_identifier":case"property_identifier":case"shorthand_property_identifier":return e.text;case"field_expression":case"member_expression":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?d(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?d(t):null}case"super":case"self":case"this":return null;default:return null}}export{l as a,A as b,R as c,X as d,Z as e,ae as f,D as g,ce as h,oe as i,d as j};
|
|
5
|
+
//# sourceMappingURL=chunk-DS6QEB3G.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as I,b as K,c as $}from"./chunk-FXI3AAKO.js";import{a as A}from"./chunk-PFOCOG57.js";import{a as R}from"./chunk-LONIY5FF.js";import{b as M,g as k}from"./chunk-MJXJ56LG.js";import{a as b}from"./chunk-BGBBVSH4.js";import{e as S}from"./chunk-MFWAZFYD.js";import{e as F}from"./chunk-U73YFD3P.js";import{a as P,c as w,d as p}from"./chunk-JM72FNGA.js";import{e as T}from"./chunk-OZUJ3VZS.js";import{a as h}from"./chunk-DS6QEB3G.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:o=!1,scanLimit:l}=e??{},d=e?.semantic!==!1,a=new R(t),m=a.scopedDefinitions(n),g=Q(a,n),v={high:0,medium:1,low:2};return A({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>b(c)-b(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:l,prepare:u=>{let c=z(u),f=W(t,a,u,c,{semantic:d}),y=u.filter(L=>{let x=C(t,L,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&B(L,x.realConsumers.length,g)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,y,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=C(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!B(f.definition,f.realConsumers.length,g))return null;let y=E(t,f);return!o&&y.confidence==="low"?null:y},orderResults:(u,c)=>v[u.confidence]-v[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(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=>M(s.relativePath)!=="test").filter(s=>!k(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function U(t,e,n){return I(t,e,{semantic:n.semantic,sourceFallback:n.sourceFallback})}function W(t,e,n,i,s){let r=U(e,n,{semantic:!1,sourceFallback:!1}),o=n.filter(a=>{let m=C(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&D(a.relativePath))}),l=s.semantic&&o.length>0?S(r,F(t,o)):r,d=o.filter(a=>C(t,a,l,i).realConsumers.length<=1);return S(l,e.sourceFallbackCallerFiles(d))}function z(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 C(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:o,barrelConsumers:l,importOnlyConsumers:d}=K(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:o,barrelConsumers:l+d,transitivelyReachable:a}}function E(t,e){let n=N(t,e.definition.relativePath,e.definition.startLine),i=D(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),o=V(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:w(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,actionTier:o.actionTier,stalenessKind:o.stalenessKind,recommendation:o.recommendation}}function V(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),o=r.map(a=>a.singleton);if(r.length===0)return new Set;let l=I(e,o,{semantic:s.semantic}),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,l)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=p(n.symbol);i&&e.set(j(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(N(t,n.relativePath,n.startLine)!=="class")return null;let i=p(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(j(n.relativePath,s))??null:null}function G(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)&&!$(t,r,i))}function j(t,e){return`${t}\0${e}`}function J(t,e,n){let i=h(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 Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=P(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 D(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 B(t,e,n){return!(D(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=T(t,e.relativePath),r=p(e.symbol);if(!r)return!1;let o=s.get(r);if(!o||o.size===0)return!1;let l=i.get(e.relativePath);if(!l)return!1;for(let d of o){let a=l.get(d);if(!a)continue;let m=n.get(a.symbolId);if(m){for(let g of m)if(g!==e.relativePath&&!t.isIgnored(g))return!0}}return!1}function N(t,e,n){let i=h(t,e);if(!i)return"other";let s=i.split(`
|
|
2
|
+
`),r=Math.max(0,n-2),o=Math.min(s.length-1,n+2);for(let l=r;l<=o;l++){let a=(s[l]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(a))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(a))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(a))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(a))return"enum"}return"other"}function ee(t,e){let n=h(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`),o=n.split(`
|
|
3
|
+
`);for(let l=0;l<o.length;l++)if(!(l>=e.startLine&&l<=e.endLine)&&r.test(o[l]??""))return!0;return!1}function ne(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{de as a};
|
|
4
|
+
//# sourceMappingURL=chunk-EOUTP32Q.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{e as l}from"./chunk-5MHQI4RR.js";function S(e,n={}){let{minComponentLines:o=300,minFileLines:t=800,minJsxTokens:r=80,minBehaviorTokens:a=40,limit:m=20,scope:c,scanLimit:p,filePattern:i}=n;return l(e,{scope:c,scanLimit:p}).filter(s=>s.kind==="component").filter(s=>!i||s.file.includes(i)||s.name.includes(i)).map(s=>g(s,{minComponentLines:o,minFileLines:t,minJsxTokens:r,minBehaviorTokens:a})).filter(s=>s!==null).sort((s,u)=>u.componentLines-s.componentLines||u.fileLines-s.fileLines||s.file.localeCompare(u.file)).slice(0,m)}function g(e,n){let o=[];e.loc>=n.minComponentLines&&o.push(`${e.loc} component line(s)`);let t=Math.max(80,Math.floor(n.minComponentLines/2));if(e.fileLines>=n.minFileLines&&e.loc>=t&&o.push(`${e.fileLines} file line(s)`),e.jsxTokens.size>=n.minJsxTokens&&o.push(`${e.jsxTokens.size} JSX structure token(s)`),e.behaviorTokens.size>=n.minBehaviorTokens&&o.push(`${e.behaviorTokens.size} behavior token(s)`),o.length===0)return null;let r=x(e),a=C(e,n,r),m=f(e),c=b(r,a,m);return{file:e.file,component:e.name,componentLines:e.loc,fileLines:e.fileLines,jsxTokens:e.jsxTokens.size,behaviorTokens:e.behaviorTokens.size,dominantPressure:r,pressureKinds:a,contextKind:m,recommendationKind:c,recommendation:R(c,m),reasons:o,loc:e.loc}}function x(e){let n=[{axis:"component",value:e.loc},{axis:"file",value:e.fileLines},{axis:"jsx-structure",value:e.jsxTokens.size*3},{axis:"hook-behavior",value:e.behaviorTokens.size*4}];return n.sort((o,t)=>t.value-o.value),n[0]?.axis??"component"}function C(e,n,o){let t=[];e.loc>=n.minComponentLines&&t.push("component");let r=Math.max(80,Math.floor(n.minComponentLines/2));return e.fileLines>=n.minFileLines&&e.loc>=r&&t.push("file"),e.jsxTokens.size>=n.minJsxTokens&&t.push("jsx-structure"),e.behaviorTokens.size>=n.minBehaviorTokens&&t.push("hook-behavior"),[...new Set(t.length>0?t:[o])]}function f(e){let n=e.file.split(/[\\/]+/).filter(Boolean),o=n.slice(0,-1).map(i=>i.toLowerCase()),t=(n.at(-1)??e.name).replace(/\.[^.]+$/,""),r=`${t} ${e.name}`.split(/[^A-Za-z0-9]+/).filter(Boolean).map(i=>i.toLowerCase()),a=o.findIndex(i=>v.has(i)),m=a>=0&&o.slice(a+1).some(i=>h.has(i)),c=d(t)||d(e.name);return/(?:Page|Route|Screen|View)$/.test(t)||/(?:Page|Route|Screen|View)$/.test(e.name)||r.some(i=>k.has(i))||a>=0&&!m&&!c?"route-page":"component"}function d(e){let n=e.split(/[^A-Za-z0-9]+/).filter(Boolean).map(o=>o.toLowerCase());return n.at(-1)&&L.has(n.at(-1))?!0:[...L].some(o=>e.endsWith(T(o)))}function b(e,n,o){return e==="hook-behavior"?"behavior-extraction":o==="route-page"?"route-page-decomposition":n.includes("hook-behavior")?"behavior-extraction":n.includes("jsx-structure")?"jsx-decomposition":n.includes("file")?"file-decomposition":e==="jsx-structure"?"jsx-decomposition":e==="file"&&!n.includes("component")?"file-decomposition":"component-decomposition"}function R(e,n){switch(e){case"behavior-extraction":return"Extract independent state, effects, requests, or handlers into hooks, controllers, or feature modules.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"jsx-decomposition":return n==="route-page"?"Split page JSX into named layout sections before extracting behavior.":"Split repeated JSX sections into named presentational components.";case"file-decomposition":return"Review file-level decomposition; split colocated panels or helpers before changing behavior.";case"component-decomposition":return"Review component boundaries around props, state ownership, and independently changing UI sections."}}var h=new Set(["component","components","panel","panels","partial","partials"]),L=new Set(["banner","button","card","dialog","drawer","filter","form","grid","header","item","list","menu","modal","nav","panel","picker","rail","row","section","selector","shell","sidebar","table","toolbar"]),v=new Set(["landing","page","pages","route","routes","screen","screens","view","views"]),k=new Set(["landing","page","route","screen","view"]);function T(e){return e.charAt(0).toUpperCase()+e.slice(1)}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EPPCGQUI.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as k}from"./chunk-RISLKTKQ.js";function K(i,l={}){let{limit:d=10,scope:h,minDepth:x=3}=l,f=k(i,h),w=new Map,o=[],p=new Map,a=new Map,m=new Set,b=[],g=0;for(let e of f.keys()){if(p.has(e))continue;let t=[],s=(f.get(e)??new Set).values();for(p.set(e,g),a.set(e,g),g+=1,b.push(e),m.add(e),t.push({node:e,iter:s,pendingChild:null});t.length>0;){let n=t[t.length-1];if(n.pendingChild!==null){let u=n.pendingChild;n.pendingChild=null,a.set(n.node,Math.min(a.get(n.node),a.get(u)))}let c=n.iter.next();if(c.done){if(a.get(n.node)===p.get(n.node)){let u=[];for(;;){let S=b.pop();if(m.delete(S),u.push(S),w.set(S,o.length),S===n.node)break}o.push(u)}t.pop();continue}let r=c.value;if(p.has(r))m.has(r)&&a.set(n.node,Math.min(a.get(n.node),p.get(r)));else{p.set(r,g),a.set(r,g),g+=1,b.push(r),m.add(r);let u=(f.get(r)??new Set).values();n.pendingChild=r,t.push({node:r,iter:u,pendingChild:null})}}}let C=new Map,D=new Array(o.length);for(let e=0;e<o.length;e++)D[e]=o[e].length,C.set(e,new Set);for(let[e,t]of f){let s=w.get(e);for(let n of t){let c=w.get(n);c!==s&&C.get(s).add(c)}}let y=new Array(o.length),R=new Array(o.length);for(let e=0;e<o.length;e++){let t=[],s=0;for(let n of C.get(e)){let c=R[n];c>s&&(s=c,t=y[n])}y[e]=[e,...t],R[e]=D[e]+s}function M(e){return y[e]}let T=o.map(e=>[...e].sort()),v=new Set,I=[];for(let e=0;e<o.length;e++){let t=M(e),s=[];for(let c of t)s.push(...T[c]);if(s.length<x)continue;let n=s.join(" ");v.has(n)||(v.add(n),I.push(A(s)))}return I.sort((e,t)=>t.depth-e.depth),F(I).slice(0,d)}function A(i){return{chain:i,depth:i.length,actionTier:"signal",chainKind:"transitive-dependency-depth",evidenceReasons:[`${i.length} file(s) form the representative transitive dependency path`,"cycles are condensed before longest-path calculation"],recommendation:"Review whether the chain crosses ownership or layer boundaries; shorten it only when the dependency direction is accidental."}}function F(i){let l=[];for(let d of i)l.some(h=>L(d.chain,h.chain))||l.push(d);return l}function L(i,l){if(i.length>=l.length)return!1;let d=l.length-i.length;for(let h=0;h<i.length;h++)if(i[h]!==l[d+h])return!1;return!0}export{K as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EW64FEJL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as l}from"./chunk-YZA6PPZL.js";function v(e,t={}){let{minTotalLines:n=800,minTemplateLines:i=300,minScriptLines:a=300,minStyleLines:r=500,limit:o=20,scope:m,scanLimit:p,filePattern:u}=t;return l(e,{scope:m,scanLimit:p}).filter(s=>!u||s.file.includes(u)).map(s=>L(s,{minTotalLines:n,minTemplateLines:i,minScriptLines:a,minStyleLines:r})).filter(s=>s!==null).sort((s,c)=>c.totalLines-s.totalLines||s.file.localeCompare(c.file)).slice(0,o)}function L(e,t){let n=[];if(e.totalLines>=t.minTotalLines&&n.push(`${e.totalLines} total component line(s)`),e.templateLines>=t.minTemplateLines&&n.push(`${e.templateLines} template line(s)`),e.scriptLines>=t.minScriptLines&&n.push(`${e.scriptLines} script line(s)`),e.styleLines>=t.minStyleLines&&n.push(`${e.styleLines} style line(s)`),n.length===0)return null;let i=b(e),a=g(e,t,i),r=x(e.file),o=V(i,r);return{file:e.file,totalLines:e.totalLines,sfcLines:e.sfcLines,templateLines:e.templateLines,scriptLines:e.scriptLines,styleLines:e.styleLines,externalScriptLines:e.externalScriptLines,externalScriptPaths:e.externalScriptPaths,customBlockLines:e.customBlockLines,dominantPressure:i,pressureKinds:a,contextKind:r,recommendationKind:o,recommendation:d(o,r),reasons:n,loc:e.totalLines}}function b(e){let t=[{axis:"template",lines:e.templateLines},{axis:"script",lines:e.scriptLines-e.externalScriptLines},{axis:"style",lines:e.styleLines},{axis:"external-script",lines:e.externalScriptLines},{axis:"custom-block",lines:e.customBlockLines}];return t.sort((n,i)=>i.lines-n.lines),t[0]?.lines?t[0].axis:"total"}function g(e,t,n){let i=[];return e.totalLines>=t.minTotalLines&&(i.push("total"),n!=="total"&&i.push(n)),e.templateLines>=t.minTemplateLines&&i.push("template"),e.scriptLines>=t.minScriptLines&&i.push("script"),e.styleLines>=t.minStyleLines&&i.push("style"),(e.externalScriptLines>=t.minScriptLines||n==="external-script")&&i.push("external-script"),e.customBlockLines>0&&n==="custom-block"&&i.push("custom-block"),[...new Set(i.length>0?i:[n])]}function x(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).some(i=>w.has(i))||/(?:view|page|route)\.vue$/i.test(e)||/(?:^|\/)(views|pages|routes)\//i.test(e)?"route-page":"component"}function V(e,t){return e==="style"?"style-decomposition":e==="template"?"template-decomposition":e==="external-script"?"external-script-boundary":e==="custom-block"?"custom-block-review":t==="route-page"?"route-page-decomposition":e==="script"?"script-behavior-extraction":"total-size-review"}function d(e,t){switch(e){case"template-decomposition":return t==="route-page"?"Split route template sections into named panels before extracting script behavior.":"Split repeated template sections into named presentational components.";case"script-behavior-extraction":return"Extract independent script behavior into composables, controllers, or feature modules.";case"style-decomposition":return"Review UI/style decomposition; move repeated styling to component or style primitives, not composables.";case"external-script-boundary":return"Review the external script boundary and split controller/composable modules by workflow.";case"custom-block-review":return"Review custom block ownership before splitting template or script code.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"total-size-review":return"Review the largest block first, then split by the dominant reason to change."}}var w=new Set(["landing","page","pages","route","routes","view","views"]);export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FG4NT6VY.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as L,b as C,e as q,f as B,g as v,h as z}from"./chunk-HDBQHJNY.js";import{b as M}from"./chunk-B75HZHUP.js";import{a as x}from"./chunk-LONIY5FF.js";import{a as A}from"./chunk-XAYARHNF.js";import{a as I}from"./chunk-733EF5FD.js";import{c as p,d as w,g as R}from"./chunk-JM72FNGA.js";import{b as N}from"./chunk-DS6QEB3G.js";import{d as h}from"./chunk-7S5E7KWT.js";function Te(e,n,i={}){let{minSimilarity:t=.4,limit:s=20}=i,r=J(e,n,{semantic:i.semantic!==!1});if(!r)return[];if(!R(r.symbol))return[];let o=X(e,r,t,{scanLimit:i.scanLimit,semantic:i.semantic!==!1});return o.length>0?o.slice(0,s):ae(e,n,{minSimilarity:t,limit:s})}function X(e,n,i,t){let s=P(e,{minCallees:3,scanLimit:t.scanLimit,semantic:t.semantic}),r=re(n,s),o=q([n,...s.corpus].map(l=>l.callees)),a=v(o),c=[];for(let l of r){if(l.callees.size<3)continue;let m=O(n,l,o,{minSimilarity:i,requireSignificantShared:1,requireSharedCount:0,medianIdf:a});m&&c.push(m)}return c.sort((l,m)=>m.similarity-l.similarity),c}function O(e,n,i,t){let{similarity:s,significantShared:r,trivialShared:o}=z(e.callees,n.callees,i,{medianIdf:t.medianIdf});if(s<t.minSimilarity)return null;let a=r.length+o.length;if(r.length<t.requireSignificantShared&&a<t.requireSharedCount)return null;let c=r.length>0?r:o,l=G(c,"callees");return{symbolA:e.symbol,shortNameA:p(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(p),uniqueToA:[...C(e.callees,n.callees)].map(p),uniqueToB:[...C(n.callees,e.callees)].map(p),...l}}function Ne(e,n={}){let{minSimilarity:i=.5,limit:t=20,scope:s,minCallees:r=4,crossFileOnly:o=!1,scanLimit:a}=n,c=P(e,{minCallees:r,scope:s,scanLimit:a,semantic:n.semantic!==!1}),l=c.corpus,m=[],y=0;for(let d=0;d<l.length;d+=1){let f=l[d],b=new Set;for(let S of f.callees){let u=c.candidateIndexesByCallee.get(S);if(u)for(let g of u)g>d&&b.add(g)}for(let S of b){let u=l[S];if(o&&f.file===u.file)continue;if(f.paramCount>=0&&u.paramCount>=0){let k=Math.abs(f.paramCount-u.paramCount),H=Math.max(2,Math.ceil(Math.max(f.paramCount,u.paramCount)*.5));if(k>H)continue}let g=O(f,u,c.idfWeights,{minSimilarity:i,requireSignificantShared:2,requireSharedCount:4,medianIdf:c.medianIdf});g&&(Q(m,g,t,y),y+=1)}}return m.sort((d,f)=>f.result.similarity-d.result.similarity||d.order-f.order),m.map(d=>d.result)}function Q(e,n,i,t){if(i<=0)return;if(e.length<i){e.push({result:n,order:t});return}let s=0;for(let o=1;o<e.length;o+=1){let a=e[o],c=e[s];(a.result.similarity<c.result.similarity||a.result.similarity===c.result.similarity&&a.order>c.order)&&(s=o)}let r=e[s];n.similarity<=r.result.similarity||(e[s]={result:n,order:t})}var Y=["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 J(e,n,i){let t=I(e,n),s=new x(e);if(!t)return null;let r=A(e,t,{semantic:i.semantic});return{symbol:t.symbol,file:t.relativePath,callees:j(r.map(o=>o.symbol)),paramCount:s.callableSignature(t)?.paramCount??-1}}var ee=h("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),ne=h("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function ie(e,n){let{minCallees:i,scope:t,excludeSymbol:s,scanLimit:r}=n,o=n.semantic!==!1,a=ee.get(e,()=>new Map),c=`${i}|${t??""}|${r??""}|${o}`,l=a.get(c);return l||(l=se(e,{minCallees:i,scope:t,scanLimit:r,semantic:o}),a.set(c,l)),s===void 0?l:l.filter(m=>m.symbol!==s)}function P(e,n){let{minCallees:i,scope:t,scanLimit:s}=n,r=n.semantic!==!1,o=ne.get(e,()=>new Map),a=`${i}|${t??""}|${s??""}|${r}`,c=o.get(a);return c||(c=te(ie(e,{minCallees:i,scope:t,scanLimit:s,semantic:r})),o.set(a,c)),c}function te(e){let n=new Map;for(let r of e)for(let o of r.callees)n.set(o,(n.get(o)??0)+1);let i=Math.max(8,Math.ceil(Math.sqrt(e.length))),t=B(n,e.length),s=new Map;for(let r=0;r<e.length;r+=1){let o=e[r];for(let a of o.callees){if((n.get(a)??0)>i)continue;let c=s.get(a);c||(c=[],s.set(a,c)),c.push(r)}}return{corpus:e,candidateIndexesByCallee:s,docFreq:n,idfWeights:t,medianIdf:v(t),ubiquityThreshold:i}}function re(e,n){let i=new Map;for(let t of e.callees)for(let s of n.candidateIndexesByCallee.get(t)??[]){let r=n.corpus[s];r.symbol!==e.symbol&&i.set(r.symbol,r)}return i.size>0?[...i.values()]:n.corpus.filter(t=>t.symbol!==e.symbol)}function se(e,n){let{minCallees:i,scope:t,scanLimit:s,semantic:r}=n,o=new x(e),a=M(o.productionCallableDefinitions({scope:t,minLoc:5,sortByLocDesc:typeof s=="number"&&s>0}),s),c=o.calleeMap(a,{semantic:r});return a.map(l=>({symbol:l.symbol,file:l.relativePath,callees:j((c.get(l.symbolId)??[]).map(m=>m.symbol)),paramCount:o.callableSignature(l)?.paramCount??-1})).filter(l=>l.callees.size>=i)}function j(e){return new Set([...e].filter(n=>!oe(n)))}function oe(e){return Y.some(n=>e.includes(n))}function ae(e,n,i){let t=ue(e,n);if(!t||t.tokens.size<3)return[];let s=i.minSimilarity>=.5?i.minSimilarity:.3,r=[],o=ye(t,be(e));for(let a of o){if(a.symbol===t.symbol||a.tokens.size<3)continue;let c=L(t.tokens,a.tokens);if(c.size<2)continue;let l=new Set([...t.tokens,...a.tokens]),m=l.size>0?c.size/l.size:0;m<s||r.push({symbolA:t.symbol,shortNameA:p(t.symbol),fileA:t.file,symbolB:a.symbol,shortNameB:p(a.symbol),fileB:a.file,similarity:m,similarityBasis:"source-tokens",sharedCallees:[...c].sort(),uniqueToA:[...C(t.tokens,a.tokens)].sort(),uniqueToB:[...C(a.tokens,t.tokens)].sort(),...G([...c],"source-tokens")})}return r.sort((a,c)=>c.similarity-a.similarity||a.shortNameB.localeCompare(c.shortNameB)),r.slice(0,i.limit)}function G(e,n){let i=e.flatMap(E),t=e.flatMap(u=>$(u,n)),s=D(i,U),r=D(i,V),o=D(t,T),a=[...new Set(t.filter(_))],c=e.filter(u=>{let g=$(u,n);return g.some(k=>T.has(k))&&g.some(_)}).length,l=[];s.length>0&&l.push(`access/query scaffolding: ${s.slice(0,5).join(", ")}`),r.length>0&&l.push(`framework/generic scaffolding: ${r.slice(0,5).join(", ")}`),o.length>0&&l.push(`domain behavior verbs: ${o.slice(0,5).join(", ")}`),o.length>0&&a.length>0&&l.push(`domain-specific terms: ${a.slice(0,5).join(", ")}`);let m=n==="source-tokens"&&i.length>0&&i.every(u=>K.has(u));m&&l.push("shared source tokens are generic scaffolding");let y=o.length>0&&a.length>0,d=s.length+r.length>0,f=n==="callees"&&y&&e.length>=4&&a.length>=4&&c>=2,b=f?"domain-behavior":y?d?"mixed":"domain-behavior":s.length>0?"access-query-scaffolding":r.length>0||m?"framework-scaffolding":"structural-overlap";b==="structural-overlap"&&e.length>0&&l.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let S=b==="domain-behavior"&&(e.length>=3||f)?"direct":"signal";return{evidenceClass:b,actionTier:S,evidenceClassReasons:l,recommendation:le(b,S)}}function le(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function D(e,n){return[...new Set(e.filter(i=>n.has(i)))]}function E(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function $(e,n){if(n==="source-tokens")return E(e);let i=w(e);return E(i.length>0?i:ce(e))}function ce(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(t=>t.trim()).filter(t=>/[A-Za-z]/.test(t)).at(-1)?.replace(/\.$/,"")??e}function _(e){return e.length>3&&!T.has(e)&&!U.has(e)&&!V.has(e)&&!K.has(e)&&!me.has(e)}var T=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),U=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),V=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),K=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),me=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function ue(e,n){let i=I(e,n);if(!i||!R(i.symbol))return null;let t=fe(e,i);return t?{symbol:i.symbol,file:i.relativePath,tokens:t}:null}function fe(e,n){let i=w(n.symbol),t=W(e,n.relativePath,n.startLine,n.endLine,i),s=Z(t,i);return s.size>0?s:null}var de=h("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),ge=h("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function pe(e){return de.get(e,()=>he(e))}function be(e){return ge.get(e,()=>Se(pe(e)))}function Se(e){let n=new Map;for(let s of e)for(let r of s.tokens)n.set(r,(n.get(r)??0)+1);let i=Math.max(8,Math.ceil(Math.sqrt(e.length))),t=new Map;for(let s of e)for(let r of s.tokens){if((n.get(r)??0)>i)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(s)}return{corpus:e,candidateByToken:t,docFreq:n,ubiquityThreshold:i}}function ye(e,n){let i=new Map;for(let t of e.tokens)for(let s of n.candidateByToken.get(t)??[])s.symbol!==e.symbol&&i.set(s.symbol,s);return i.size>0?[...i.values()]:n.corpus.filter(t=>t.symbol!==e.symbol)}function he(e){return new x(e).productionCallableDefinitions().map(i=>({symbol:i.symbol,file:i.relativePath,tokens:Z(W(e,i.relativePath,i.startLine,i.endLine,i.leaf),i.leaf)})).filter(i=>i.tokens.size>0)}function W(e,n,i,t,s){let r=N(e,n);if(r.length===0)return"";if(t>=i&&t-i<=12)return r.slice(i,t+1).join(`
|
|
2
|
+
`);let o=[new RegExp(`\\bdef\\s+${F(s)}\\b`),new RegExp(`\\bfun\\s+${F(s)}\\b`),new RegExp(`\\bfn\\s+${F(s)}\\b`),new RegExp(`\\bfunction\\s+${F(s)}\\b`),new RegExp(`\\b${F(s)}\\s*\\(`)],a=r.findIndex(c=>o.some(l=>l.test(c)));if(a>=0){let c=a;for(let l=a+1;l<r.length&&l<=a+8;l++){let m=r[l]??"";if(l>a&&Fe(m)||(c=l,m.trim()===""&&l>a+1))break}return r.slice(a,c+1).join(`
|
|
3
|
+
`)}return r.slice(i,Math.min(r.length,i+8)).join(`
|
|
4
|
+
`)}function Z(e,n){if(!e)return new Set;let i=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"]),t=Ce(n),r=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(o=>o.trim()).filter(o=>o.length>1).filter(o=>!i.has(o)).filter(o=>!t.has(o));return new Set(r)}function Ce(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function Fe(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function F(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{Te as a,Ne as b,Q as c,ie as d,te as e,re as f,j as g,G as h};
|
|
5
|
+
//# sourceMappingURL=chunk-FKYPOK7P.js.map
|