scip-query 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +40 -9
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-WN6XEYVX.js → chunk-27YDE22N.js} +2 -2
- package/dist/{chunk-VLSI5MYU.js → chunk-2DBY4MO7.js} +2 -2
- package/dist/{chunk-YSUD2S7T.js → chunk-2HCWAL42.js} +2 -2
- package/dist/{chunk-YCVYOV4A.js → chunk-34RCSYMZ.js} +2 -2
- package/dist/{chunk-3LAKH6BV.js → chunk-3CJXFMR5.js} +2 -2
- package/dist/{chunk-2EU6WVR3.js → chunk-3EBDPBBU.js} +2 -2
- package/dist/{chunk-6EVORGCB.js → chunk-42YU6TEB.js} +2 -2
- package/dist/{chunk-3YAZH3JU.js → chunk-45QWQSWS.js} +2 -2
- package/dist/{chunk-5XDNFOAH.js → chunk-4FLF7BHJ.js} +2 -2
- package/dist/{chunk-JRFCWCOD.js → chunk-4L4X66GE.js} +2 -2
- package/dist/{chunk-NLRWGGPY.js → chunk-5CJ6AQN7.js} +2 -2
- package/dist/{chunk-CM4EZLW4.js → chunk-5GAUXLOE.js} +2 -2
- package/dist/{chunk-QB7NRST4.js → chunk-5N5ZC566.js} +2 -2
- package/dist/{chunk-P5QZILZ4.js → chunk-5ODF4JGH.js} +2 -2
- package/dist/{chunk-OYGKBDAD.js → chunk-6G3GQWTK.js} +2 -2
- package/dist/{chunk-IRIM3SUR.js → chunk-75H6GOND.js} +2 -2
- package/dist/{chunk-VSQRU3AP.js → chunk-7CHIAMKS.js} +2 -2
- package/dist/{chunk-L27UIF3E.js → chunk-7MT6UM4D.js} +2 -2
- package/dist/{chunk-OO6S4ECV.js → chunk-7XP7ZRSI.js} +2 -2
- package/dist/{chunk-5TVNLPUM.js → chunk-7Z5UT44B.js} +2 -2
- package/dist/{chunk-A46JTKTM.js → chunk-A4KRWTXD.js} +2 -2
- package/dist/{chunk-BFWVHD2P.js → chunk-ABRWGVC6.js} +2 -2
- package/dist/{chunk-7II7NFRV.js → chunk-AQ34B63A.js} +2 -2
- package/dist/{chunk-EVCSXWER.js → chunk-BBBZB5WY.js} +2 -2
- package/dist/{chunk-MZB3DTHW.js → chunk-BGUYAA3Q.js} +2 -2
- package/dist/{chunk-ZHGUZKJL.js → chunk-CMLHZWRS.js} +2 -2
- package/dist/{chunk-3I34FZ6R.js → chunk-CYDOV3AQ.js} +2 -2
- package/dist/{chunk-GWWYLYD3.js → chunk-DQYG5JHT.js} +2 -2
- package/dist/{chunk-W3ZVRLCH.js → chunk-EPDV3SQD.js} +2 -2
- package/dist/{chunk-U6BJVXWQ.js → chunk-GRHA5NGF.js} +2 -2
- package/dist/{chunk-YD37KSEK.js → chunk-H4SMB657.js} +2 -2
- package/dist/{chunk-XBPAJASV.js → chunk-H4T2AST4.js} +2 -2
- package/dist/{chunk-SOCS3467.js → chunk-HGO3D2JD.js} +2 -2
- package/dist/{chunk-RLB7FZKR.js → chunk-HV4N3UBV.js} +2 -2
- package/dist/{chunk-VZCR3VQY.js → chunk-IK2NG76R.js} +2 -2
- package/dist/{chunk-CS3FXTUC.js → chunk-J4HK7PQS.js} +2 -2
- package/dist/{chunk-QSNG3NHQ.js → chunk-J7WYG63U.js} +2 -2
- package/dist/{chunk-7RAS466A.js → chunk-JJAH2VLD.js} +2 -2
- package/dist/{chunk-NLVKD45E.js → chunk-JLZUM476.js} +2 -2
- package/dist/{chunk-JQ2PCFZW.js → chunk-JUADXGUH.js} +2 -2
- package/dist/{chunk-DKK2H4D7.js → chunk-JVTMRIKU.js} +2 -2
- package/dist/{chunk-YFEJIYWH.js → chunk-JYBF5CPE.js} +2 -2
- package/dist/{chunk-S5RZQA6V.js → chunk-K3UVTL3J.js} +2 -2
- package/dist/{chunk-363TZ64I.js → chunk-KAOWSWEX.js} +2 -2
- package/dist/{chunk-RPMT6MTX.js → chunk-KLFCCRI7.js} +2 -2
- package/dist/{chunk-6GZ7LM7S.js → chunk-KO2TFDIP.js} +2 -2
- package/dist/{chunk-S5MTSES5.js → chunk-KTZACYL6.js} +2 -2
- package/dist/{chunk-6DNE65QS.js → chunk-KYUYAWKA.js} +2 -2
- package/dist/{chunk-PCCMMI2M.js → chunk-KZ2LZBQT.js} +2 -2
- package/dist/chunk-L7UITWFE.js +120 -0
- package/dist/{chunk-CVBS2FD4.js → chunk-LC57FSPX.js} +2 -2
- package/dist/{chunk-S3IXCXW2.js → chunk-LG33DNTZ.js} +2 -2
- package/dist/chunk-M2TRDR25.js +84 -0
- package/dist/{chunk-2Y7YX54K.js → chunk-MVFNACWB.js} +2 -2
- package/dist/{chunk-Q65QYKU7.js → chunk-NJBARXRO.js} +2 -2
- package/dist/{chunk-5UKDCXVC.js → chunk-OP5JXGDV.js} +2 -2
- package/dist/{chunk-SEEJPIWG.js → chunk-OP5RO2CF.js} +2 -2
- package/dist/{chunk-EBSSCVR4.js → chunk-OQRMCT2N.js} +5 -5
- package/dist/{chunk-CKIAEVGM.js → chunk-PA2MQKXD.js} +2 -2
- package/dist/{chunk-XC6PUFNN.js → chunk-PVXSHZLW.js} +2 -2
- package/dist/{chunk-AAMZRDJT.js → chunk-PYOZHG6A.js} +2 -2
- package/dist/{chunk-G4KQ7S74.js → chunk-QEIGJJBC.js} +2 -2
- package/dist/{chunk-DA34GNNO.js → chunk-QNCVN5EH.js} +2 -2
- package/dist/chunk-RSZ4KX4B.js +7 -0
- package/dist/{chunk-HGUNWXJX.js → chunk-RUQE7DZT.js} +2 -2
- package/dist/{chunk-VYQY75NA.js → chunk-RZEVUYMG.js} +2 -2
- package/dist/chunk-SMBIGBGN.js +67 -0
- package/dist/{chunk-AMPN2VMF.js → chunk-SREWDA7Q.js} +2 -2
- package/dist/{chunk-S2FZILCF.js → chunk-TAB7AWKO.js} +2 -2
- package/dist/{chunk-UO4IADXJ.js → chunk-TCOWAGR2.js} +2 -2
- package/dist/{chunk-BVHP2B4D.js → chunk-TL2IXVGH.js} +2 -2
- package/dist/{chunk-MCNWCJYL.js → chunk-TLTLJ4SW.js} +2 -2
- package/dist/{chunk-JXAJDINF.js → chunk-TR7C5HOC.js} +2 -2
- package/dist/{chunk-3OPIMH42.js → chunk-U244OVE6.js} +2 -2
- package/dist/chunk-U3JW5AYG.js +2 -0
- package/dist/{chunk-2HFXPIBT.js → chunk-UWR52GNZ.js} +2 -2
- package/dist/{chunk-62Y3PC27.js → chunk-VCOAUTSI.js} +2 -2
- package/dist/{chunk-BVUA3GZC.js → chunk-VCRMI56V.js} +2 -2
- package/dist/{chunk-753JWTUH.js → chunk-VDHEX6YO.js} +2 -2
- package/dist/{chunk-RYFIRFYJ.js → chunk-VPVAQRHM.js} +2 -2
- package/dist/{chunk-RQWNF2RM.js → chunk-VT2KFEPG.js} +2 -2
- package/dist/{chunk-LT6AHYVY.js → chunk-WH65EY7U.js} +2 -2
- package/dist/{chunk-HLRWOFXC.js → chunk-X566NT42.js} +2 -2
- package/dist/{chunk-ZEKBAMCN.js → chunk-XKWEMFHP.js} +2 -2
- package/dist/{chunk-KI4WPR7Q.js → chunk-Y3DG4J6A.js} +2 -2
- package/dist/{chunk-KP2DJY7D.js → chunk-Y5BOEWAE.js} +2 -2
- package/dist/{chunk-2LGPMYS2.js → chunk-YD7GGLGE.js} +2 -2
- package/dist/{chunk-K32ZOW3P.js → chunk-ZMD4O5UP.js} +2 -2
- package/dist/cli.js +321 -303
- package/dist/{config-types-SVkUIufk.d.ts → config-types-70s7NxKB.d.ts} +2 -0
- package/dist/{db-CS0TuVH6.d.ts → db-BBmJ0v3b.d.ts} +1 -1
- package/dist/{health-Btal3mQi.d.ts → health-CWpFL_6z.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- 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/decorative-checkers.d.ts +2 -2
- package/dist/queries/decorative-checkers.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 +2 -2
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- 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/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.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 +2 -2
- 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/not-implemented.d.ts +2 -2
- package/dist/queries/not-implemented.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 +2 -2
- 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/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/twin-drift.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 +26 -26
- package/dist/reindex.d.ts +3 -3
- package/dist/reindex.js +38 -34
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.js +1 -2
- package/dist/{scip-cli-BKL-26TZ.d.ts → scip-cli-CoMzb7Zu.d.ts} +1 -1
- package/dist/watch-server.js +4 -4
- package/docs/COMMAND_REFERENCE.md +1 -1
- package/package.json +1 -1
- package/skills/_shared/SKILL.md +2 -2
- package/skills/scip-calibrate/SKILL.md +5 -4
- package/skills/scip-verify/SKILL.md +3 -2
- package/dist/chunk-5P26M63Y.js +0 -2
- package/dist/chunk-FFIYGYQR.js +0 -67
- package/dist/chunk-WFRZGMWJ.js +0 -71
- package/dist/chunk-XAEU4ROB.js +0 -101
- package/dist/chunk-Y42DMR6F.js +0 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-BGUYAA3Q.js";import{a as m}from"./chunk-CYDOV3AQ.js";import{a as d}from"./chunk-BGBBVSH4.js";import{d as u}from"./chunk-7XP7ZRSI.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-PYOZHG6A.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as C}from"./chunk-
|
|
1
|
+
import{p as C}from"./chunk-JLZUM476.js";import{a as _}from"./chunk-64MNV6AB.js";import{c as F,g as S,i as I,s as f,w as D,x as P}from"./chunk-M2TRDR25.js";var N=D({kind:"file-dependency-graph",invalidation:P("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:R}),O=F("file-dep-graph",{clearGroups:["whole-project"]});function K(e,r,o={}){let t=o.scipEdges??"all-references";return O.get(e,`${t}:${r??""}`,()=>{let s=new Set(_(e,{includeIgnored:!1})),i=I(e),a=b(r,t),d=0,l=0,m=null,h=!1,c=0,y=0;return f("file-dep-graph.product",()=>{if(i){let n=N.read(e,a,i);if(n){h=!0;let u=w(n);return d=n.sourceFileCount,l=n.sourceEdgeCount,c=n.scipEdgeCount,y=u.size,m=n.sourceImportFingerprint,u}}let p=f("file-dep-graph.source-imports",()=>{let n=A(e,s,r);return d=n.files.length,l=n.edges.length,m=n.fingerprint,n},()=>({scope:r??null,files:d,edges:l})),g=new Map,E=(n,u)=>M(e,g,s,n,u);f("file-dep-graph.scip-edges",()=>{for(let n of J(e,r,t))c+=1,E(n.from_file,n.to_file)},()=>({scope:r??null,edges:c}));for(let n of p.edges)E(n.fromFile,n.toFile);return y=g.size,i&&N.write(e,a,i,{sourceImportFingerprint:p.fingerprint,sourceFileCount:p.files.length,sourceEdgeCount:p.edges.length,scipEdgeCount:c,graph:v(g)}),g},()=>({scope:r??null,available:i!==null,hit:h,files:d,sourceEdges:l,scipEdges:c,graphFiles:y,sourceImportFingerprint:m}))})}function A(e,r,o){let t=[],s=[];for(let i of r)if(!(o&&!i.includes(o))){t.push(i);for(let a of C(e,i))a.sourcePath&&s.push({fromFile:i,toFile:a.sourcePath})}return{files:t,edges:s,fingerprint:G(t,s)}}function G(e,r){let o=r.map(t=>`${t.fromFile}\0${t.toFile}`).sort();return S(JSON.stringify({files:e,edges:o}))}function b(e,r){return`edge-mode-v2:${r}:${e??"<all>"}`}function v(e){return[...e].map(([r,o])=>[r,[...o]])}function w(e){return new Map(e.graph.map(([r,o])=>[r,new Set(o)]))}function R(e){let r=JSON.parse(e);return $(r)?r:null}function $(e){if(!e||typeof e!="object")return!1;let r=e;return typeof r.sourceImportFingerprint=="string"&&typeof r.sourceFileCount=="number"&&typeof r.sourceEdgeCount=="number"&&typeof r.scipEdgeCount=="number"&&Array.isArray(r.graph)&&r.graph.every(k)}function k(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(r=>typeof r=="string")}function J(e,r,o){let t=r?"AND d1.relative_path LIKE ?":"",s=r?[`%${r}%`]:[],i=o==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
|
|
2
2
|
d1.relative_path AS from_file,
|
|
3
3
|
d2.relative_path AS to_file
|
|
4
4
|
FROM mentions m
|
|
@@ -17,4 +17,4 @@ import{p as C}from"./chunk-NLVKD45E.js";import{a as _}from"./chunk-64MNV6AB.js";
|
|
|
17
17
|
${i}
|
|
18
18
|
${e.pathExclusionsFor("d1","d2")}
|
|
19
19
|
${t}`,...s)}function M(e,r,o,t,s){if(t===s||e.isIgnored(t)||e.isIgnored(s)||!o.has(s))return;let i=r.get(t);i||(i=new Set,r.set(t,i)),i.add(s)}export{K as a};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-QEIGJJBC.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as G,F as W,G as Z,k as te,l as ie,m as re,n as $,w as B,x}from"./chunk-OQRMCT2N.js";import{a as J}from"./chunk-JLZUM476.js";import{d as X,g as U,i as z,k as ee,m as ne,q as O,s as P,v as L,w as j,x as F}from"./chunk-M2TRDR25.js";import{existsSync as Re,readFileSync as Ie}from"fs";import{resolve as De}from"path";function Je(n,e){return N(n,e,t=>{let i=t?`AND m.symbol_id IN (${t.map(()=>"?").join(",")})`:"";return n.all(`SELECT
|
|
2
2
|
m.symbol_id,
|
|
3
3
|
d.relative_path,
|
|
4
4
|
COUNT(*) AS ref_count
|
|
@@ -26,4 +26,4 @@ import{C as G,E as W,F as Z,k as te,l as ie,m as re,n as $,v as B,w as x}from"./
|
|
|
26
26
|
${i}
|
|
27
27
|
${n.pathExclusionsFor("d")}
|
|
28
28
|
ORDER BY d.relative_path, c.start_line`,...t??[])})}function N(n,e,t){if(!e)return t();if(e.length===0)return[];let i=[];for(let r=0;r<e.length;r+=750)i.push(...t(e.slice(r,r+750)));return i}var ve=/^[A-Za-z_][A-Za-z0-9_]*$/,oe=/\bDefault::default\b/g,Me=/^\.\.\s*Default::default\b/;function se(n,e){let t=new Map,i=new Map;for(let r of e){let a=Y(n,r,i);a!==null&&t.set(r.symbolId,a)}return t}function Y(n,e,t=new Map){let i=xe(e.symbol);if(!i)return null;let r=ae(n,[e.symbolId]);if(r.length===0)return null;let a=new RegExp(`(^|[^A-Za-z0-9_])${J(i)}::default\\b`,"g"),o=new RegExp(`(^|[^A-Za-z0-9_])${J(i)}\\s*$`),f=Ce(n,e.symbolId),m=[];for(let S of r){let d=Ee(n,S.relative_path,t);if(d===null)return null;let l=d.split(/\r?\n/),u=0,p=[],b=0;for(let R=S.chunk_start;R<=S.chunk_end&&R<l.length;R+=1){let D=l[R]??"",w=new Set;a.lastIndex=0;let M;for(;M=a.exec(D);)m.push({file:S.relative_path,line:R,column:M.index+M[1].length+i.length+2}),b+=1;for(let c=0;c<D.length;c+=1){let y=Me.exec(D.slice(c));if(y){if(f&&p.includes(u)){let g=c+y[0].lastIndexOf("default");m.push({file:S.relative_path,line:R,column:g}),w.add(g),b+=1}c+=y[0].length-1;continue}let h=D[c];if(h==="{"){let g=o.test(D.slice(0,c));u+=1,g&&p.push(u);continue}if(h==="}")for(u=Math.max(0,u-1);p.length>0&&p[p.length-1]>u;)p.pop()}for(oe.lastIndex=0;M=oe.exec(D);){let c=M.index+9;if(!w.has(c))return null}}if(b===0)return null}return te(m)}function Ce(n,e){return n.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",e)?.present===1}function xe(n){let e=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(n)?.[1]??null;return!e||!ve.test(e)?null:e}function Ee(n,e,t){if(t.has(e))return t.get(e)??null;let i=n.get("SELECT text FROM documents WHERE relative_path = ?",e),r=typeof i?.text=="string"?i.text:_e(n,e);return t.set(e,r),r}function _e(n,e){let t=De(n.config.projectRoot,e);if(!Re(t))return null;try{return Ie(t,"utf8")}catch{return null}}function ce(n){let e=new Map;for(let t of n){let i=e.get(t.relativePath)??[];i.push(t),e.set(t.relativePath,i)}return e}var Pe="typescript-import-usage-v1",we="typescript-signatures-v1",Q=X("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),le=j({kind:"semantic-import-usage",invalidation:F("semantic-import-usage"),serialize:n=>JSON.stringify(n),deserialize:he}),ue=j({kind:"semantic-signatures",invalidation:F("semantic-signatures"),serialize:n=>JSON.stringify(n),deserialize:Le}),fe=L({kind:"typescript-import-usage",invalidation:F("typescript-import-usage"),serialize:n=>JSON.stringify(n),deserialize:he}),me=L({kind:"typescript-signatures",invalidation:F("typescript-signatures"),serialize:n=>JSON.stringify(n),deserialize:je});function k(n){let e=new Map,t=new Set;return{capability:(i,r)=>ye(n,i,r),importUsage:i=>Fe(n,i),references:i=>de(n,i),materializeReferences:(i,r)=>ge(n,i,e,t,r),callerMap:i=>Ae(n,i,e,t),calleeMap:i=>He(n,i),signature:i=>Ue(n,i)}}function Te(n,e){if(e.size===0)return;let t=Q.get(n,()=>new Map);for(let[i,r]of e)t.set(i,[...r])}function fn(n,e){if(!Q.has(n))return{hits:[],misses:[...e]};let t=Q.get(n,()=>new Map),i=[],r=[];for(let a of e)t.has(a.symbolId)?i.push({definition:a,callees:t.get(a.symbolId)??[]}):r.push(a);return{hits:i,misses:r}}function mn(n,e){return k(n).importUsage(e)}function Fe(n,e){if(x(e)==="typescript"){let a="fallback",o=0,f=0,m=0,S=0;return P("typescript.import-usage.materialize",()=>{let d=G(n,e,Pe);if(d?.key){o=1;let u=fe.read(n,e,d.key);if(u)return a="hit",f=1,u;m=1;let p=E(n,e);if(!p)return a="unavailable",[];let b=p.importUsage(e);return fe.write(n,e,d.key,b),a="computed",b}S=1;let l=E(n,e);return l?(a="direct-fallback",l.importUsage(e)):(a="unavailable",[])},()=>({state:a,eligible:o,cacheHits:f,cacheMisses:m,fallbacks:S}))}let t=Se(n,"semantic-import-usage",e);if(t){let a=le.read(n,e,t);if(a)return a}let i=E(n,e);if(!i)return[];let r=i.importUsage(e);return t&&le.write(n,e,t,r),r}function pn(n,e){return k(n).references(e)}function de(n,e){let t=Y(n,e);if(t)return t;let i=re(n,e);if(i)return i;let r=E(n,e.relativePath);return r?r.referencesFor(e):[]}function dn(n,e){return k(n).callerMap(e)}function gn(n,e){let t=new Map,i=new Map;for(let r of e){if(x(r.relativePath)==="typescript"){let a=E(n,r.relativePath);if(!a)continue;let o=i.get(a)??[];o.push(r),i.set(a,o);continue}K(n,t,r,de(n,r))}for(let[r,a]of i){let o=Z(n,a),f=o?.references??(r.referencesForDefinitions?r.referencesForDefinitions(a,{exact:!0}):new Map(a.map(m=>[m.symbolId,r.referencesFor(m)])));!o&&O()&&W(n,a,f);for(let m of a)K(n,t,m,f.get(m.symbolId)??[])}return t}function Ae(n,e,t=new Map,i=new Set){let r=new Map,a=ge(n,e,t,i),o=0;return P("semantic.callers.from-references",()=>{for(let f of e)o+=K(n,r,f,t.get(f.symbolId)??[])},()=>({definitions:e.length,materialized:a.definitions,inMemoryHits:a.inMemoryHits,incompleteInMemoryHits:a.incompleteInMemoryHits,resultRows:r.size,callerFiles:o})),r}function ge(n,e,t,i,r={}){let a=z(n),o=[],f=[],m=[],S=0,d=0,l=0,u=0,p=0,b=0,R=0,_=0,D=0,w=0,M=0,c=0,y=[],h=new Map,g=e.filter(s=>x(s.relativePath)==="typescript"&&!t.has(s.symbolId)&&!i.has(s.symbolId)),v=Z(n,g);if(v){D=g.length,w=v.cacheHits,M=v.cacheMisses,c=v.computedFiles;for(let s of g)t.set(s.symbolId,v.references.get(s.symbolId)??[])}if(P("semantic.references.cache-scan",()=>{for(let[s,I]of ce(e)){let T=[];for(let C of I)t.has(C.symbolId)?d+=1:i.has(C.symbolId)?_+=1:T.push(C);if(T.length===0){R+=1;continue}let H=ke(n,a,s);if(!H){for(let C of T)x(C.relativePath)||(S+=1),m.push(C);continue}b+=1;let be=ee(n,s,H);for(let C of T){let V=be.get(C.symbol)??null;if(V!==null){let q=Ne(V);if(q){l+=1,t.set(C.symbolId,q);continue}u+=1}f.push({definition:C,cacheFingerprint:H})}}},()=>({definitions:e.length,skippedUnsupportedLanguage:S,cacheHits:l,parseFailures:u,misses:f.length,unkeyed:m.length,inMemoryHits:d,incompleteInMemoryHits:_,fullyInMemoryFiles:R,cacheReadFiles:b})),f.length>0||m.length>0){y=[...m,...f.map(s=>s.definition)],h=P("semantic.references.compute-misses",()=>{let s=Oe(n,y,r);return p=s.size,s},()=>({definitions:y.length,misses:f.length,unkeyed:m.length,rows:p}));for(let s of y)h.has(s.symbolId)?(t.set(s.symbolId,h.get(s.symbolId)??[]),i.delete(s.symbolId)):i.add(s.symbolId);for(let{definition:s,cacheFingerprint:I}of f)h.has(s.symbolId)&&ye(n,"semantic-references",s.relativePath).available&&o.push({relativePath:s.relativePath,symbol:s.symbol,projectFingerprint:I,payload:JSON.stringify(h.get(s.symbolId)??[])})}return o.length>0&&P("semantic.references.cache-write",()=>ne(n,o),()=>({entries:o.length})),h.size>0&&W(n,y,h),{definitions:e.length,inMemoryHits:d,incompleteInMemoryHits:_,cacheHits:l,misses:f.length,unkeyed:m.length,skippedUnsupportedLanguage:S,parseFailures:u,computed:p,incomplete:i.size,cacheWrites:o.length,fragmentDefinitions:D,fragmentCacheHits:w,fragmentCacheMisses:M,fragmentComputedFiles:c}}function ke(n,e,t){if(!e)return null;let i=x(t);return i==="typescript"?e:i==="rust"?U(JSON.stringify({kind:"semantic-references",language:i,engine:$(n.config.projectRoot),projectFingerprint:e})):null}function Oe(n,e,t={}){let i=O(),r=new Map,a=0,o=0,f=0,m=0,S=0,d=0,l=0,u=0,p=0;return P("semantic.references.provider-loop",()=>{let b=se(n,e),R=ie(n,e),_=new Map,D=t.prefetchCallees?new Map:null,w=[];for(let c of e){let y,h=()=>(y??=E(n,c.relativePath),y);if(D){let I=h();if(I?.referencesAndCalleesForDefinitions){let T=D.get(I);T?T.push(c):D.set(I,[c]),p+=1}}let g=b.get(c.symbolId);if(g){f+=1,m+=g.length,A(r,c.symbolId,g,i,I=>{l+=1,u+=I});continue}let v=R.get(c.symbolId);if(v){S+=1,d+=v.length,A(r,c.symbolId,v,i,I=>{l+=1,u+=I});continue}let s=h();if(!s){i&&(o+=1);continue}if(i&&(a+=1),s.referencesForDefinitions){let I=_.get(s);I?I.push(c):_.set(s,[c])}else w.push({provider:s,definition:c})}let M=new Set;if(D)for(let[c,y]of D){if(!c.referencesAndCalleesForDefinitions)continue;let h=_.get(c)??[],g=c.referencesAndCalleesForDefinitions(h,y);M.add(c),Te(n,g.callees);for(let v of h){if(!g.references.has(v.symbolId))continue;let s=g.references.get(v.symbolId)??[];A(r,v.symbolId,s,i,I=>{l+=1,u+=I})}}for(let[c,y]of _){if(M.has(c))continue;let h=c.referencesForDefinitions(y);for(let g of y){if(!h.has(g.symbolId))continue;let v=h.get(g.symbolId)??[];A(r,g.symbolId,v,i,s=>{l+=1,u+=s})}}for(let{provider:c,definition:y}of w){let h=c.referencesFor(y);A(r,y.symbolId,h,i,g=>{l+=1,u+=g})}return r},()=>({definitions:e.length,providerHits:a,providerMisses:o,rustDefaultFastPathRows:f,rustDefaultFastPathReferences:m,rustScipOccurrenceFastPathRows:S,rustScipOccurrenceFastPathReferences:d,prefetchCalleeDefinitions:p,definitionsWithReferences:l,referenceCount:u,rows:r.size}))}function A(n,e,t,i,r){n.set(e,t),i&&t.length>0&&r(t.length)}function K(n,e,t,i){let r=0;for(let a of i){if(a.file===t.relativePath||n.isIgnored(a.file))continue;let o=e.get(t.symbolId);o||(o=new Set,e.set(t.symbolId,o));let f=o.size;o.add(a.file),o.size!==f&&(r+=1)}return r}function Ne(n){try{return JSON.parse(n)}catch{return null}}function Sn(n,e){return k(n).calleeMap(e)}function He(n,e){let t=O(),i=new Map,r=0,a=0,o=0,f=0;return P("semantic.callees.provider-loop",()=>{let m=new Map,S=[];for(let d of e){let l=E(n,d.relativePath);if(!l){t&&(a+=1);continue}t&&(r+=1);let u=d;if(l.calleesForDefinitions){let p=m.get(l);p?p.push(u):m.set(l,[u])}else S.push({provider:l,definition:u})}for(let[d,l]of m){let u=d.calleesForDefinitions(l);for(let p of l){let b=u.get(p.symbolId)??[];pe(i,p.symbolId,b,t,R=>{o+=1,f+=R})}}for(let{provider:d,definition:l}of S){let u=d.calleesFor(l);pe(i,l.symbolId,u,t,p=>{o+=1,f+=p})}return i},()=>({definitions:e.length,providerHits:r,providerMisses:a,definitionsWithCallees:o,calleeCount:f,rows:i.size}))}function pe(n,e,t,i,r){t.length>0&&(n.set(e,t),i&&r(t.length))}function hn(n,e){return k(n).signature(e)}function Ue(n,e){if(x(e.relativePath)==="typescript"){let o="fallback",f=0,m=0,S=0,d=0;return P("typescript.signature.materialize",()=>{let l=G(n,e.relativePath,we);if(l?.key){f=1;let p=me.read(n,e.relativePath,l.key)??{};if(Object.prototype.hasOwnProperty.call(p,e.symbol))return o="hit",m=1,p[e.symbol]??null;S=1;let b=E(n,e.relativePath);if(!b)return o="unavailable",null;let R=b.signatureFor(e);return me.write(n,e.relativePath,l.key,{...p,[e.symbol]:R}),o="computed",R}d=1;let u=E(n,e.relativePath);return u?(o="direct-fallback",u.signatureFor(e)):(o="unavailable",null)},()=>({state:o,eligible:f,cacheHits:m,cacheMisses:S,fallbacks:d}))}let t=Se(n,"semantic-signatures",e.relativePath),i=ze(e);if(t){let o=ue.read(n,i,t);if(o)return o.signature}let r=E(n,e.relativePath);if(!r)return null;let a=r.signatureFor(e);return t&&ue.write(n,i,t,{signature:a}),a}function Se(n,e,t){let i=z(n);if(!i)return null;let r=x(t);return r!=="rust"?null:U(JSON.stringify({kind:e,language:r,engine:$(n.config.projectRoot),projectFingerprint:i}))}function ze(n){return`${n.relativePath}\0${n.symbol}`}function he(n){try{let e=JSON.parse(n);return Array.isArray(e)?e:null}catch{return null}}function Le(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e.signature;return t!==null&&typeof t!="string"?null:{signature:t}}catch{return null}}function je(n){try{let e=JSON.parse(n);if(!e||typeof e!="object"||Array.isArray(e))return null;for(let t of Object.values(e))if(t!==null&&typeof t!="string")return null;return e}catch{return null}}function ye(n,e,t){let i=x(t);if(!i)return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:e,language:i,...B(n,t).availability()}}catch(r){return{slot:e,language:i,available:!1,reason:r instanceof Error?r.message:String(r)}}}function E(n,e){if(!x(e))return null;let t=B(n,e);return t.availability().available?t:null}export{Je as a,$e as b,Be as c,ae as d,ce as e,k as f,fn as g,mn as h,pn as i,dn as j,gn as k,Sn as l,hn as m};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-QNCVN5EH.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as i}from"./chunk-QVZSWLLZ.js";import{execFileSync as p}from"child_process";import{createRequire as O}from"module";import{existsSync as M}from"fs";import{platform as c,arch as C}from"os";var v="v0.8.1",f="https://github.com/sourcegraph/scip",w="SCIP_QUERY_SCIP_BIN";function D(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let r=e.env[w];if(r&&e.fileExists(r))return{source:"env",path:r};if(e.platform==="win32"){let t=e.resolveSidecar(e.arch);if(t&&e.fileExists(t))return{source:"sidecar",path:t}}return null}function N(e){let r=O(import.meta.url);for(let t of e==="arm64"?["arm64","x64"]:[e])try{return r.resolve(`scip-query-scip-windows/scip-win32-${t}.exe`)}catch{}return null}function S(e=process.env){return D({platform:c(),arch:C(),env:e,isOnPath:i,fileExists:M,resolveSidecar:N})?.path??null}function oe(){return S()!==null}function se(){let e=S();if(!e)return null;try{return p(e,["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function T(){let e=c(),r=C(),t,n,s;switch(e){case"darwin":t="darwin",s="tar.gz";break;case"linux":t="linux",s="tar.gz";break;default:return null}switch(r){case"arm64":n="arm64";break;case"x64":n="amd64";break;default:return null}let a=`scip-${t}-${n}.${s}`;return{url:`${f}/releases/download/${v}/${a}`,filename:a}}function ie(){let e=T();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),c()==="darwin"?(console.log("Install via Homebrew:"),console.log(` brew install sourcegraph/scip/scip
|
|
2
|
+
`),console.log("Or download manually:")):c()==="win32"?(console.log("On Windows the scip binary ships via the npm sidecar package scip-query-scip-windows,"),console.log("installed automatically with scip-query. If it is missing:"),console.log(" npm install -g scip-query-scip-windows"),console.log(`Or set ${w} to a local scip.exe path.
|
|
3
|
+
`),console.log("Upstream release page:")):console.log("Download from:"),console.log(e?` ${e.url}
|
|
4
|
+
`:` ${f}/releases/tag/${v}
|
|
5
|
+
`),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function ae(e){if(c()==="darwin"&&i("brew")){e("Installing scip CLI via Homebrew...");try{if(p("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),i("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(r){let t=r instanceof Error?r.message:String(r);e(`Homebrew install failed: ${t}`)}}if(i("go")){e("Installing scip CLI via go install...");try{if(p("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),i("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(r){let t=r instanceof Error?r.message:String(r);e(`go install failed: ${t}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${f}/releases`),!1}import{execFileSync as G}from"child_process";import{createHash as U}from"crypto";import{realpathSync as Y}from"fs";import{isAbsolute as L,resolve as E}from"path";var h={run(e,r){try{return G("git",["-C",e,...r],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).trimEnd()}catch{return}}};function W(e,r=h){let t=r.run(e,["rev-parse","--show-toplevel"])?.trim();return t?d(t):void 0}function de(e,r=h){let t=W(e,r);if(!t)return;let n=r.run(t,["rev-parse","--absolute-git-dir"])?.trim(),s=r.run(t,["rev-parse","--git-common-dir"])?.trim();if(!n||!s)return;let a=d(b(t,n)),u=d(b(t,s)),$=g(r.run(t,["rev-parse","--verify","HEAD"])),I=g(r.run(t,["rev-parse","--verify","HEAD^{tree}"])),y=r.run(t,["status","--porcelain=v1","-z","--untracked-files=all"]);if(y!==void 0)return{projectRoot:t,gitDir:a,commonDir:u,repositoryId:x("repository",u),worktreeId:x("worktree",`${t}\0${a}`),headCommit:$,treeOid:I,clean:y.length===0}}function ge(e,r,t=h){return g(t.run(e,r))}function b(e,r){return L(r)?r:E(e,r)}function d(e){try{return Y(e)}catch{return E(e)}}function x(e,r){return U("sha256").update(`${e}\0${r}`).digest("hex").slice(0,24)}function g(e){return e?.trim()||void 0}import{readFileSync as q,writeFileSync as F,existsSync as P,mkdirSync as H,realpathSync as B}from"fs";import{isAbsolute as Ce,join as o,relative as ve,resolve as R}from"path";import{createHash as K}from"crypto";import{homedir as J}from"os";var l=".scipquery.json",_=250,j=0,A=10*6e4,V={enabled:!1,debounceMs:_,cooldownMs:j,gitPollMs:2e3,idleTimeoutMs:A,autoRefresh:!0,ignore:[]},z=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"];var be=new Set(z);function xe(e){let r=o(e,l);if(!P(r))return{};try{let t=q(r,"utf-8");return JSON.parse(t)}catch(t){let n=t instanceof Error?t.message:String(t);throw t instanceof SyntaxError?new Error(`invalid ${l} at ${r}: ${n}`,{cause:t}):new Error(`unable to read ${l} at ${r}: ${n}`,{cause:t})}}function Ee(e){return{...V,...e.watch}}function Q(e,r){let t=process.env.SCIP_QUERY_CACHE_DIR;if(t)return m(t);if(r?.dbPath)return m(R(e,r.dbPath));let n=X(e);return m(n)}function k(){let e=process.env.XDG_CACHE_HOME;return o(e||o(J(),".cache"),"scip-query")}function X(e){let r=R(e);try{r=B(r)}catch{}let t=K("sha256").update(r).digest("hex").slice(0,12);return o(k(),"projects",t)}function Pe(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);return o(k(),"repositories",e)}function Re(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function _e(e,r){let t=Q(e,r);return{cacheDir:t,dbPath:o(t,"index.db"),indexPath:o(t,"index.scip"),metaPath:o(t,"meta.json")}}function je(e,r){let t=o(e,l);return P(t)||F(t,JSON.stringify({languages:r,watch:{enabled:!0,debounceMs:_,cooldownMs:j,gitPollMs:2e3,idleTimeoutMs:A,autoRefresh:!0}},null,2)+`
|
|
6
|
+
`),t}function m(e){return H(e,{recursive:!0}),e}export{S as a,oe as b,se as c,ie as d,ae as e,de as f,ge as g,xe as h,Ee as i,X as j,Pe as k,Re as l,_e as m,je as n};
|
|
7
|
+
//# sourceMappingURL=chunk-RSZ4KX4B.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as k}from"./chunk-QEIGJJBC.js";function $(r,t={}){let{limit:a=10,scope:l,minDepth:m=3}=t,p=k(r,l),w=new Map,h=[],g=new Map,d=new Map,S=new Set,y=[],u=0;for(let e of p.keys()){if(g.has(e))continue;let s=[],o=(p.get(e)??new Set).values();for(g.set(e,u),d.set(e,u),u+=1,y.push(e),S.add(e),s.push({node:e,iter:o,pendingChild:null});s.length>0;){let n=s[s.length-1];if(n.pendingChild!==null){let f=n.pendingChild;n.pendingChild=null,d.set(n.node,Math.min(d.get(n.node),d.get(f)))}let c=n.iter.next();if(c.done){if(d.get(n.node)===g.get(n.node)){let f=[];for(;;){let C=y.pop();if(S.delete(C),f.push(C),w.set(C,h.length),C===n.node)break}h.push(f)}s.pop();continue}let i=c.value;if(g.has(i))S.has(i)&&d.set(n.node,Math.min(d.get(n.node),g.get(i)));else{g.set(i,u),d.set(i,u),u+=1,y.push(i),S.add(i);let f=(p.get(i)??new Set).values();n.pendingChild=i,s.push({node:i,iter:f,pendingChild:null})}}}let b=new Map;for(let e=0;e<h.length;e++)b.set(e,new Set);for(let[e,s]of p){let o=w.get(e);for(let n of s){let c=w.get(n);c!==o&&b.get(o).add(c)}}let I=new Array(h.length),R=new Array(h.length);for(let e=0;e<h.length;e++){let s=[],o=0;for(let n of b.get(e)){let c=R[n];c>o&&(o=c,s=I[n])}I[e]=[e,...s],R[e]=1+o}function x(e){return I[e]}let M=h.map(e=>[...e].sort()),v=new Set,D=[];for(let e=0;e<h.length;e++){let o=x(e).map(i=>M[i]),n=o.map(i=>i[0]);if(o.length<m)continue;let c=n.join(" ");v.has(c)||(v.add(c),D.push(T(n,o)))}return D.sort((e,s)=>s.depth-e.depth),F(D).slice(0,a)}function T(r,t){let a=t.reduce((m,p)=>m+p.length,0),l=t.filter(m=>m.length>1).length;return{chain:r,components:t,depth:t.length,fileCount:a,actionTier:"signal",chainKind:"transitive-dependency-depth",evidenceReasons:[`${t.length} condensed dependency component(s) form the representative transitive path`,`${a} file(s) are represented; ${l} component(s) contain a dependency cycle`,"cycles count once toward depth and retain their full membership separately"],recommendation:"Review whether the chain crosses ownership or layer boundaries; shorten it only when the dependency direction is accidental."}}function F(r){let t=[];for(let a of r)t.some(l=>L(a.chain,l.chain))||t.push(a);return t}function L(r,t){if(r.length>=t.length)return!1;let a=t.length-r.length;for(let l=0;l<r.length;l++)if(r[l]!==t[a+l])return!1;return!0}export{$ as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RUQE7DZT.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as v}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as v}from"./chunk-JYBF5CPE.js";import{a as j}from"./chunk-75H6GOND.js";import{a as w}from"./chunk-AQ34B63A.js";import{a as p}from"./chunk-KAOWSWEX.js";import{a as H}from"./chunk-H4T2AST4.js";import{a as T}from"./chunk-Y3DG4J6A.js";import{a as P,b as A}from"./chunk-PA2MQKXD.js";import{b as D}from"./chunk-GRHA5NGF.js";import{a as S}from"./chunk-X566NT42.js";import{a as I}from"./chunk-ABRWGVC6.js";import{a as G}from"./chunk-HV4N3UBV.js";import{a as k}from"./chunk-7CHIAMKS.js";import{a as F}from"./chunk-IK2NG76R.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?w(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?k(t,e,{semantic:l}):null,f=s?I(t,e,{semantic:l}):null,h=s?T(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,d=s?G(t,e,{maxDepth:o,scope:n.scope}):[],i=F(t,e,{semantic:l}),C=P(t,e),g=A(t,e),u=j(t,e),x=v(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||d.length>0,file:i!==null||C.length>0||g.length>0,module:u.files.length>0||u.symbols.length>0||x.length>0},b=[];!c.symbol&&!c.file&&!c.module&&b.push("No symbol, file, or module matched target.");let B=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:O(t,B),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:d,changeSurface:i,deps:C,rdeps:g,system:u,surface:x,warnings:b}}function O(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=S(t).fileChurn();if(!o)return n;let r=D(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence,subjectContext:l.subjectContext})),suppressionsInFile:H(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RZEVUYMG.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import{execFileSync as F}from"child_process";import{createHash as m}from"crypto";import{lstatSync as k,readdirSync as V,readFileSync as w,readlinkSync as I,realpathSync as b}from"fs";import{isAbsolute as A,join as y,relative as _,sep as L}from"path";function se(e,t){let r=e.split("/").at(-1)??e;if(j.has(r)||r===".scipquery.json"||/^tsconfig(?:\..+)?\.json$/.test(r))return"config";if(/\.d\.(?:ts|mts|cts)$/.test(e.toLowerCase()))return"ambient";let s=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return t.some(n=>(P[n]??[]).includes(s))?"source":"other"}function O(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function E(e){return(T(e)??W(e)).filter(t=>t&&!S(t)).sort()}function G(e,t={}){let r=E(e).filter(n=>!t.language||M(n,t.language,t.markerFiles)).filter(n=>!t.includePath||t.includePath(n)),s=b(e);return r.map(n=>{let i=y(e,n);try{if(k(i).isSymbolicLink()){let o=b(i),c=_(s,o);if(c===".."||c.startsWith(`..${L}`)||A(c))throw new Error("external symlink");let l=I(i);return{path:n,size:Buffer.byteLength(l),hash:m("sha256").update("symlink\0").update(l).digest("hex")}}let a=w(i);return{path:n,size:a.byteLength,hash:m("sha256").update(a).digest("hex")}}catch{return{path:n,size:-1,hash:"unreadable"}}})}function ae(e,t,r){return{version:2,languages:[...t].sort(),pnpmWorkspaces:r.typescriptProjectMode!=="workspace"&&r.pnpmWorkspaces===!0,typescriptProjectMode:r.typescriptProjectMode??"single",typescriptProjects:O(r.typescriptProjects),clojureConfigPath:$(r.clojureConfigPath),files:G(e)}}function $(e){return e?.trim()||void 0}function M(e,t,r){let s=e.split("/").at(-1)??e;if(r?.includes(e)||r?.includes(s)||j.has(s))return!0;let n=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(P[t]??[]).includes(n)}function T(e){try{return F("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
2
|
+
`).filter(Boolean)}catch{return null}}function W(e){let t=[],r=[""];for(;r.length>0;){let s=r.pop(),n=s?y(e,s):e,i;try{i=V(n,{withFileTypes:!0})}catch{continue}for(let a of i){let o=s?`${s}/${a.name}`:a.name;if(a.isDirectory()){S(o)||r.push(o);continue}t.push(o)}}return t}function S(e){let t=e.split("/");return e==="meta.json"||t.some(r=>K.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var K=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]),j=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock","deps.edn","project.clj","bb.edn","shadow-cljs.edn"]),P={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import z from"ignore";import{readFileSync as N,existsSync as C,readdirSync as R}from"fs";import{dirname as g,isAbsolute as x,join as u,relative as B,resolve as q}from"path";function ue(e){let t=z();return U(e,t)||t.add(X),{isIgnored:s=>f(t,e,s),filter:s=>s.filter(n=>!f(t,e,n))}}function U(e,t){let r=new Set,s=(a,o)=>{if(!(r.has(a)||!C(a)))try{let c=N(a,"utf-8");t.add(o?H(c,o):c),r.add(a)}catch{}},n=g(e),i=0;for(;n!==g(n)&&i<5&&(s(u(n,".gitignore"),""),!C(u(n,".git")));)n=g(n),i++;return D(e,"",t,s),r.size>0}function D(e,t,r,s){let n=t?u(e,t):e;s(u(n,".gitignore"),t);let i;try{i=R(n,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory()||a.name===".git")continue;let o=t?`${t}/${a.name}`:a.name;f(r,e,`${o}/`)||D(e,o,r,s)}}function H(e,t){let r=t.replaceAll("\\","/").replace(/\/+$/,"");return e.split(/\r?\n/).map(s=>J(s,r)).join(`
|
|
3
|
+
`)}function J(e,t){let r=e.trimStart();if(!r||r.startsWith("#"))return e;let s=e.slice(0,e.length-r.length),n=r.startsWith("!"),i=n?r.slice(1):r;if(!i||i.startsWith("#"))return e;let a=i.startsWith("/"),o=a?i.slice(1):i,p=(o.endsWith("/")?o.slice(0,-1):o).includes("/")||a?`${t}/${o}`:`${t}/**/${o}`;return`${s}${n?"!":""}${p}`}var X=`
|
|
4
|
+
# Dependencies
|
|
5
|
+
node_modules/
|
|
6
|
+
vendor/
|
|
7
|
+
.bundle/
|
|
8
|
+
|
|
9
|
+
# Build output
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
out/
|
|
13
|
+
target/
|
|
14
|
+
bin/
|
|
15
|
+
obj/
|
|
16
|
+
|
|
17
|
+
# Python
|
|
18
|
+
__pycache__/
|
|
19
|
+
*.pyc
|
|
20
|
+
*.pyo
|
|
21
|
+
.venv/
|
|
22
|
+
venv/
|
|
23
|
+
.env/
|
|
24
|
+
env/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
|
|
27
|
+
# Rust
|
|
28
|
+
target/
|
|
29
|
+
|
|
30
|
+
# Java / Kotlin / Scala
|
|
31
|
+
*.class
|
|
32
|
+
.gradle/
|
|
33
|
+
.mvn/
|
|
34
|
+
|
|
35
|
+
# C# / .NET
|
|
36
|
+
bin/
|
|
37
|
+
obj/
|
|
38
|
+
packages/
|
|
39
|
+
|
|
40
|
+
# Go
|
|
41
|
+
vendor/
|
|
42
|
+
|
|
43
|
+
# Dart
|
|
44
|
+
.dart_tool/
|
|
45
|
+
build/
|
|
46
|
+
|
|
47
|
+
# PHP
|
|
48
|
+
vendor/
|
|
49
|
+
|
|
50
|
+
# IDE / OS
|
|
51
|
+
.idea/
|
|
52
|
+
.vscode/
|
|
53
|
+
*.swp
|
|
54
|
+
*.swo
|
|
55
|
+
.DS_Store
|
|
56
|
+
Thumbs.db
|
|
57
|
+
|
|
58
|
+
# Type definitions (often noise in queries)
|
|
59
|
+
*.d.ts
|
|
60
|
+
`;function f(e,t,r){let s=Y(t,r);if(!s)return!1;try{return e.ignores(s)}catch{return!1}}function Y(e,t){if(!t||t===".")return null;if(!x(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=x(t)?t:q(e,t),s=B(e,r).replaceAll("\\","/");return!s||s==="."||s.startsWith("..")?null:s}var Q=[];function d(e){e.groups.length>0&&Q.push(e)}function v(){let e=new WeakMap;return{cache:e,ensure(t){let r=e.get(t);return r||(r=new Map,e.set(t,r)),r}}}function he(e,t){let{cache:r,ensure:s}=v(),n={get(i,a,o){let c=s(i);if(c.has(a))return c.get(a);let l=o();return c.set(a,l),l},invalidate(i,a){r.get(i)?.delete(a)},invalidateAll(i){r.delete(i)},size(i){return r.get(i)?.size??0}};return d({name:e,groups:t.clearGroups,clearAll:i=>n.invalidateAll(i),clearFile:(i,a)=>n.invalidate(i,a)}),n}function me(e,t){let r=new WeakMap,s={get(n,i){let a=r.get(n);if(a)return a.value;let o=i();return r.set(n,{value:o}),o},invalidate(n){r.delete(n)},has(n){return r.has(n)}};return d({name:e,groups:t.clearGroups,clearAll:n=>s.invalidate(n)}),s}var Z={clearGroups:["whole-project","source-file"]};function be(e){return ee(e,Z)}function ee(e,t){let{cache:r,ensure:s}=v(),n={get(i,a,o,c){let l=s(i),p=l.get(a);if(p&&p.source===o)return p.value;let h=c();return l.set(a,{source:o,value:h}),h},invalidate(i,a){r.get(i)?.delete(a)},invalidateAll(i){r.delete(i)}};return d({name:e,groups:t.clearGroups,clearAll:i=>n.invalidateAll(i),clearFile:(i,a)=>n.invalidate(i,a)}),n}function Se(e,t={}){let r=t.scope?"AND relative_path LIKE ?":"",s=t.like?"AND relative_path LIKE ?":"",n=[...t.scope?[`%${t.scope}%`]:[],...t.like?[t.like]:[]],i=e.all(`SELECT relative_path
|
|
61
|
+
FROM documents
|
|
62
|
+
WHERE 1 = 1
|
|
63
|
+
${e.pathExclusionsFor("documents")}
|
|
64
|
+
${r}
|
|
65
|
+
${s}
|
|
66
|
+
ORDER BY relative_path`,...n).map(o=>o.relative_path),a=t.extensions?i.filter(o=>t.extensions.some(c=>o.toLowerCase().endsWith(c.toLowerCase()))):i;return t.includeIgnored===!1?a.filter(o=>!e.isIgnored(o)):a}export{d as a,he as b,me as c,be as d,ee as e,Se as f,se as g,O as h,G as i,ae as j,ue as k};
|
|
67
|
+
//# sourceMappingURL=chunk-SMBIGBGN.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as $e}from"./chunk-
|
|
1
|
+
import{a as $e}from"./chunk-JJAH2VLD.js";import{a as Se}from"./chunk-42YU6TEB.js";import{a as se,c as ae,d as ce,e as D}from"./chunk-2DBY4MO7.js";import{a as Ce}from"./chunk-34RCSYMZ.js";import{a as ye}from"./chunk-VCOAUTSI.js";import{a as be}from"./chunk-C2QSK7E7.js";import{a as ge}from"./chunk-3EBDPBBU.js";import{a as he}from"./chunk-J4HK7PQS.js";import{a as fe}from"./chunk-WH65EY7U.js";import{a as ue}from"./chunk-PYOZHG6A.js";import{b as re}from"./chunk-HGO3D2JD.js";import{a as ne,b as oe}from"./chunk-VDHEX6YO.js";import{a as Q,b as X,c as ee,g as M,h as K}from"./chunk-KLFCCRI7.js";import{a as ie,b as F,e as te}from"./chunk-OP5JXGDV.js";import{b as de}from"./chunk-JUADXGUH.js";import{a as B,c as J,d as Y,e as Z}from"./chunk-GRHA5NGF.js";import{a as V}from"./chunk-X566NT42.js";import{a as me,e as pe}from"./chunk-A4KRWTXD.js";import{a as le}from"./chunk-27YDE22N.js";import{a as W}from"./chunk-CYDOV3AQ.js";import{f as T,g as A}from"./chunk-5CJ6AQN7.js";import{e as q}from"./chunk-MVFNACWB.js";import{e as R,f as U,g as N}from"./chunk-7XP7ZRSI.js";import{a as O}from"./chunk-JLZUM476.js";import{e as H}from"./chunk-TLTLJ4SW.js";import{s as z}from"./chunk-M2TRDR25.js";import{createHash as ei}from"crypto";import{existsSync as _}from"fs";function we(e){let[i,t]=j(e,":"),o=i||"unknown",n=(a={})=>{let s=a.actionTier??Me(o);return{sourceAnalyzer:o,actionTier:s,rootCauseKey:a.rootCauseKey??(t||e),label:a.label??`${o} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??Ke(s,o),file:a.file}};if(!t)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(o)){let[a,s]=j(t,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:t,label:`${o} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(o==="cycle"){let a=t.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:t,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(o==="similar"){let a=t.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(o==="drift"){let[a,s]=j(t,":"),[c,d]=j(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,d].filter(Boolean))],rootCauseKey:t,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...d?[`Related dependency: ${d}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Me(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 Ke(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 j(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as Le,readFileSync as Pe,writeFileSync as _e}from"fs";import{isAbsolute as He,join as ze}from"path";var Oe=25e3,Ue=2500,qe=2500;function We(e){let i=be(e);return i.symbols>=Oe||i.documents>=Ue?qe:void 0}var Ve=".scipquery-baseline.json";function E(e,i){return i&&He(i)?i:ze(e.config.projectRoot,i??Ve)}function De(e,i={}){let{scope:t}=i,o=We(e),n=[],a=de(e,{scope:t,...D.dead,scanLimit:o});for(let s of a.symbols)T(e,s.relativePath)||A(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of he(e,{scope:t,...D.isolated,scanLimit:o}))T(e,s.relativePath)||A(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of le(e,{scope:t}))s.kind==="real"&&n.push(`cycle:${Je(s.path)}`);for(let s of pe(e,{scope:t,...D.similar,scanLimit:o}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of ne(e,{scope:t,...D.duplicateBodies,scanLimit:o}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(c=>c.symbol).sort().join("|")}`);for(let s of ue(e,{scope:t,...D.extract,scanLimit:o}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of Ce(e,{scope:t,...D.wrappers,scanLimit:o}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of ge(e,{scope:t,...D.passthroughs,scanLimit:o}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of ye(e,{scope:t,...D.stale,scanLimit:o}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of fe(e,{scope:t,...D.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return[...new Set(n)].sort()}function Je(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 qi(e,i={}){let t=De(e,{scope:i.scope}),o=E(e,i.path);return _e(o,JSON.stringify({version:1,findings:t},null,2)+`
|
|
2
2
|
`),{path:o,findingCount:t.length}}function ke(e,i={}){let t=E(e,i.path);if(!Le(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let o=JSON.parse(Pe(t,"utf-8")),n=new Set(o.findings??[]),a=De(e,{scope:i.scope}),s=new Set(a);return{baselinePath:t,baselineCount:n.size,current:a,newFindings:a.filter(c=>!n.has(c)),fixedFindings:[...n].filter(c=>!s.has(c))}}import{existsSync as Ye,mkdirSync as Ji,readdirSync as Ze,readFileSync as Qe,writeFileSync as Yi}from"fs";import{createHash as Qi}from"crypto";import{join as L}from"path";var x=L(".scipquery","suppressions");function Xe(e){return L(e,x)}function ve(e){let i=Xe(e);if(!Ye(i))return{suppressions:[],warnings:[]};let t=[],o=[];for(let n of Ze(i).sort()){if(!n.endsWith(".json"))continue;let a=L(i,n),s;try{s=JSON.parse(Qe(a,"utf-8"))}catch{o.push(`${x}/${n}: malformed JSON \u2014 ignored`);continue}if(typeof s!="object"||s===null||Array.isArray(s)){o.push(`${x}/${n}: not a suppression object \u2014 ignored`);continue}let c=s;if(typeof c.reason!="string"||c.reason.trim()===""){o.push(`${x}/${n}: missing reason \u2014 ignored`);continue}if(!c.id&&!c.check){o.push(`${x}/${n}: needs an id or a check \u2014 ignored`);continue}t.push(c)}return{suppressions:t,warnings:o}}var kt=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","doc-reference","unused-params","new-dead","baseline"];function vt(e,i={}){let t=i.base??"HEAD",{minTogether:o=6,minConfidence:n=.6,maxEchoChecks:a=Number.POSITIVE_INFINITY,maxHelpers:s=Number.POSITIVE_INFINITY,minSimilarity:c=.8,includeBaseline:d=!1,scanLimit:r}=i,f=i.semantic!==!1,m=i.historyMode??"bounded",u=new Set(i.skip??[]),h=ee(e,{base:t}),p=X(e,{base:t,plan:h}),y=p.changedFiles,S=new Set(y),l=new Set(h.changedFileLines),w=new Set([...S,...l]),$=M(e.config.projectRoot,t,K(h,y)),C=Ri(e.config.projectRoot,t,h,$),g={base:t,changedFiles:y,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],attributionNotes:p.attributionNotes,rootCauseGroups:[],note:p.summary.note};if(y.length===0)return g;let k=(G,Ee)=>{if(u.has(G)){g.skipped.push({check:G,reason:"skipped via --skip"});return}let Ie=g.findings.length,Ne=g.skipped.length,Be=g.checksRun.length;z(`diff-gate.check.${G}`,Ee,()=>({check:G,changedFiles:y.length,changedSymbols:p.changedSymbols.length,findingsAdded:g.findings.length-Ie,skippedAdded:g.skipped.length-Ne,checksRunAdded:g.checksRun.length-Be}))};return k("echo",()=>oi(e,p.changedSymbols,S,C,a,c,r,f,g)),k("incomplete-migration",()=>di(e,t,h,s,r,f,$,g)),k("co-change-partner",()=>fi(e,w,o,n,m,g)),k("twin-partner",()=>ui(e,p.changedSymbols,S,r,g)),k("coverage-contract",()=>hi(e,w,g)),k("doc-reference",()=>bi(e,S,l,h.changedRanges,h.renamedFiles,g)),k("unused-params",()=>wi(e,y,g)),k("new-dead",()=>Di(e,p.changedSymbols,C,g)),d&&k("baseline",()=>Ai(e,g)),ti(g,[...e.config.suppressions??[],...ve(e.config.projectRoot).suppressions]),g.rootCauseGroups=ii(g.findings),g}function Ft(e){return e.checksRun.length===0&&e.note===Q}function Rt(e){return e.filter(i=>!i.advisory)}function ii(e){let i=new Map;for(let t of e){let o=t.groupKey??`${t.check}:${t.id}`,n=i.get(o);n||(n={groupKey:o,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(o,n)),n.count+=1,n.findingIds.push(t.id),n.severity=Ge(n.severity,t.severity),n.actionTier=je(n.actionTier,t.actionTier),t.file&&n.files.add(t.file);for(let a of t.relatedFiles??[])n.relatedFiles.add(a)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,o)=>o.count-t.count||I(o.severity)-I(t.severity)||t.groupKey.localeCompare(o.groupKey))}function Ge(e,i){return I(i)>I(e)?i:e}function I(e){return e==="error"?2:e==="warning"?1:0}function je(e,i){return e?i&&Fe(i)>Fe(e)?i:e:i}function Fe(e){return e==="direct"?2:e==="signal"?1:0}function ti(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let o of e.findings){let n=i.find(a=>ni(a,o));n?e.suppressed.push({finding:o,suppression:n}):t.push(o)}e.findings=t}function ni(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id&&!i.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function v(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function oi(e,i,t,o,n,a,s,c,d){d.checksRun.push("echo");for(let r of i.slice(0,n)){if(!N(r.symbol)||o(r))continue;let f=oe(e,r.symbol,{maxLoc:15,scanLimit:s}).filter(l=>!t.has(l.file)).slice(0,5).map(l=>({otherFile:l.file,otherShort:l.shortName,otherSymbol:l.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${l.loc} LOC)`]}));if(f.length>0){let l=b("echo",r.symbol,r.file),w=b("echo",r.symbol,r.file,...f.map(C=>`${C.otherSymbol}|${C.otherFile}`).sort()),$=f[0];v(d,{id:l,legacySuppressionIds:w===l?void 0:[w],groupKey:l,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(f.map(C=>C.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${r.symbol}:${$.otherSymbol}`,message:Te(r,f),why:Ae(r,f),remediation:xe("direct",r.shortName,$.otherShort)});continue}let m=me(e,r.symbol,{minSimilarity:a,limit:5,scanLimit:s,semantic:c,sourceCandidateMode:"target-pruned"}),u=[];for(let l of m){let w=l.fileA===r.file?l.fileB:l.fileA,$=l.fileA===r.file?l.shortNameB:l.shortNameA,C=l.fileA===r.file?l.symbolB:l.symbolA;t.has(w)||u.push({otherFile:w,otherShort:$,otherSymbol:C,similarity:l.similarity,similarityBasis:l.similarityBasis??"callees",sharedEvidence:l.sharedCallees})}if(u.length===0)continue;let h=u[0],p=b("echo",r.symbol,r.file,...u.map(l=>`${l.otherSymbol}|${l.otherFile}`).sort()),y=b("echo",r.symbol,r.file),S=ri(r,u);v(d,{id:y,legacySuppressionIds:p===y?void 0:[p],groupKey:y,actionTier:S,check:"echo",severity:"warning",evidence:"heuristic",confidence:h.similarity,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(u.map(l=>l.otherFile))].sort(),message:Te(r,u),why:Ae(r,u),remediation:xe(S,r.shortName,h.otherShort)})}i.length>n&&d.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${i.length} changed symbols`})}function ri(e,i){return i.some(o=>si(e.symbol,o))?"direct":"signal"}function si(e,i){if(i.similarityBasis==="exact-body")return!0;if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=R(e),o=R(i.otherSymbol);return!t||!o?!1:t===o?!0:li(i.sharedEvidence)?!1:ai(t,o)}function ai(e,i){let t=Re(e),o=Re(i);if(t.length===0||o.length===0)return!1;let n=new Set(o),a=t.filter(s=>n.has(s)).length;return a>=2&&a/Math.min(t.length,o.length)>=.5}function Re(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 ci=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function li(e){return e.length>=3&&e.every(i=>ci.has(i.toLowerCase()))}function Te(e,i){let t=i[0],o=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${o}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${o}% similar to ${t.otherShort} (${t.otherFile})`}function Ae(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let o of i.slice(0,3))t.push(`${o.otherShort} is outside this diff and scored ${Math.round(o.similarity*100)}% similar by ${o.similarityBasis} evidence.`),t.push(`Shared evidence: ${o.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 xe(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 di(e,i,t,o,n,a,s,c){let d=Se(e,{base:i,maxHelpers:o,diffPlan:t,scanLimit:n,semantic:a,baseContentAt:s});if(!d.available){c.skipped.push({check:"incomplete-migration",reason:"no git history"});return}c.checksRun.push("incomplete-migration"),d.note&&c.skipped.push({check:"incomplete-migration",reason:d.note});for(let r of d.findings){let f=r.leftovers.map(l=>`${l.shortName} (${l.file}, ${Math.round(l.containment*100)}% helper / ${Math.round(l.siteCoverage*100)}% site, ${l.migrationScope})`).join(", "),m=r.leftovers.map(l=>`${l.shortName}: ${l.migrationScope} (${l.migrationScopeReasons[0]})`).join("; "),u=[...r.migratedFiles,...r.leftovers.map(l=>l.file)],h=r.leftovers.length===0?void 0:Math.max(...r.leftovers.map(l=>Math.min(l.containment,l.siteCoverage))),p=r.leftovers.some(l=>l.migrationScope==="possible-subtype"),y=b("incomplete-migration",r.helperSymbol,r.helperFile,u.join("|")),S=b("incomplete-migration",r.helperSymbol,r.helperFile);v(c,{id:S,legacySuppressionIds:y===S?void 0:[y],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:h,file:r.helperFile,symbol:r.helperSymbol,relatedFiles:u,message:`new helper ${r.helperShortName} (${r.helperFile}) is wired into ${r.migratedFiles.length} file(s), but ${r.leftovers.length} similar un-migrated site(s) remain: ${f}`,why:[`${r.helperShortName} is new in this diff and already referenced by ${r.migratedFiles.join(", ")}.`,`Helper shape: ${r.helperShape}; ${r.specificHelperCalleeCount}/${r.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${f}.`,`Migration scope hints: ${m}.`],remediation:p?`Migrate same-scope sites to ${r.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${r.helperShortName}, or confirm they are intentionally different.`})}}function fi(e,i,t,o,n,a){let s=V(e,{historyMode:n}).directionalCoChangePairsForFiles(i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){a.skipped.push({check:"co-change-partner",reason:"no git history"});return}a.checksRun.push("co-change-partner");let c=new Set,d;for(let r of s){let f=i.has(r.fileA),m=i.has(r.fileB);if(f===m)continue;let u=f?r.fileA:r.fileB,h=f?r.fileB:r.fileA,p=f?r.changesA:r.changesB,y=p>0?r.together/p:0;if(y<o||B(h)||B(u)||!_(`${e.config.projectRoot}/${h}`))continue;let S=`${u}|${h}`;if(c.has(S))continue;c.add(S);let l=b("co-change-partner",u,h,String(r.together)),w=b("co-change-partner",u,h),$=J(u,h),C=Y({fileA:u,fileB:h,together:r.together,confidence:y,commitScope:r.commitScope,recency:r.recency,subjectContext:r.subjectContext},$,(d??=Z(e))(u,h)),g=[u,h].sort().join("|");a.findings.push({id:w,legacySuppressionIds:l===w?void 0:[l],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${g}`,confidence:y,file:u,relatedFiles:[h],sourceAnalyzer:"co-change",rootCauseKey:g,partnerClass:$.partnerClass,partnerClassReasons:$.reasons,commitScope:r.commitScope,recency:r.recency,focusedTogether:r.focusedTogether,broadTogether:r.broadTogether,broadCommitRatio:r.broadCommitRatio,lastTogetherAt:r.lastTogetherAt,recentTogether:r.recentTogether,subjectContext:r.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${u} changed, but ${h} did not \u2014 they change together ${r.together}x (${Math.round(y*100)}% of the time)`,why:[`${u} is in this diff and ${h} is not.`,`Git history shows ${r.together} co-change(s), which is ${Math.round(y*100)}% of changes to the edited side.`,`History context: ${gi(r)}.`,`Subject context: ${mi(r.subjectContext)}.`,...pi(r),`Partner class: ${$.partnerClass} (${$.reasons.join("; ")}).`],remediation:C?`Update ${h} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${h} alongside this change, or confirm the coupling no longer holds.`})}}function ui(e,i,t,o,n){n.checksRun.push("twin-partner");let a=re(e,{scanLimit:o}).filter(d=>d.relationship==="divergent"||d.relationship==="identical");if(a.length===0)return;let s=new Map;for(let d of a)for(let r of d.members)s.set(r.symbol,d);let c=new Set;for(let d of i){if(!N(d.symbol))continue;let r=s.get(d.symbol);if(!r)continue;let f=r.members.filter(p=>p.symbol!==d.symbol&&!t.has(p.file));if(f.length===0)continue;let m=[d.symbol,...f.map(p=>p.symbol)].sort().join("|");if(c.has(m))continue;c.add(m);let u=f[0],h=b("twin-partner",d.symbol,d.file,u.symbol);v(n,{id:h,groupKey:`twin-partner:${m}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:r.relationship==="identical"?1:Math.max(0,1-r.maxDivergence),file:d.file,symbol:d.symbol,relatedFiles:f.map(p=>p.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:m,message:`${d.shortName} (${d.file}) changed but its same-name twin ${u.shortName} (${u.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${d.symbol} is in this diff.`,`${u.symbol} shares its (near-)name and is classified '${r.relationship}' with it, but ${u.file} is not in this diff.`,r.relationship==="divergent"?`The two bodies already diverge (~${Math.round(r.maxDivergence*100)}% token difference) \u2014 this diff may widen or narrow that drift.`:"The two bodies were byte-identical before this diff.","Advisory: twin-partner never fails the gate by itself \u2014 see the twin-partner entry in the diff-gate checks table."],remediation:`Update ${u.file} alongside this change, consolidate ${d.shortName}/${u.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function hi(e,i,t){t.checksRun.push("coverage-contract");let o=e.config.coverageContracts??[];for(let n of o){if(!ae(n,i))continue;let a=se(e,n);if(a.status==="ok")continue;let s=b("coverage-contract",n.name,n.file);v(t,{id:s,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:a.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:ce(a),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,a.status==="unavailable"?`The declared side could not be evaluated: ${a.unavailableReason}.`:`Missing: ${a.missing.join(", ")||"none"}. Extra: ${a.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:a.status==="unavailable"?"Investigate why the declared key set could not be parsed (see the reason above) \u2014 do not treat this as a pass.":`Update ${n.file} so its ${n.keys.type==="object-literal-keys"||n.keys.type==="string-array"?n.keys.identifier:n.keys.marker} matches ${n.mustEqual.type}, or fix the ground-truth source if the declared set is right.`})}}function gi(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${yi(e.lastTogetherAt)}`}function mi(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",o=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${o}; external issue/PR labels ${e.externalIssueLabelStatus}`}function pi(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 yi(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var P=3;function bi(e,i,t,o,n,a){a.checksRun.push("doc-reference");let s=F.referenceTargets(e,i,o);if(s.size===0)return;let c=new Set(n.map(r=>r.from)),d=[];for(let r of te(e,s))t.has(r.doc)||ie(e,r.doc)||d.push(Ci(e,r,c));for(let r of Si(d))v(a,r)}function Ci(e,i,t){let o=i.citedClaims.length>0?i.citedClaims:F.citationContexts(e,i.doc,i.cited),n=F.classifyCitation(o),a=F.hasLineAnchoredCitation(i.citations),s=i.cited.some(m=>t.has(m)||!_(`${e.config.projectRoot}/${m}`)),c=!(a||s),d=i.cited[0]??"",r=b("doc-reference",i.doc,i.cited.join("|")),f=b("doc-reference",i.doc,d);return{id:f,legacySuppressionIds:r===f?void 0:[r],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${d}`,rootCauseKey:d,confidence:1,file:i.doc,relatedFiles:i.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:o,...c?{advisory:!0}:{},message:`${i.doc} cites ${i.cited.join(", ")} as ${F.citationKindLabel(n.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${i.cited.join(", ")} changed in this diff.`,`${i.doc} cites the changed file(s) but was not updated in the same diff.`,...n.reasons.map(m=>`Citation kind evidence: ${m}`),c?"Advisory: bare file-mention citation (no line anchor, cited file still present under the same path) \u2014 21.2 calibration found this citation shape low-precision; verify at your leisure.":a?"Blocking: citation includes a line anchor that may now point at the wrong lines.":"Blocking: the cited file was deleted or renamed in this diff \u2014 the citation almost certainly needs an update."],remediation:F.citationRemediation(n.citationKind,i.doc)}}function Si(e){let i=new Map;for(let o of e){let n=o.rootCauseKey??"",a=i.get(n);a?a.push(o):i.set(n,[o])}let t=[];for(let[o,n]of i)n.length<=P?t.push(...n):t.push($i(o,n));return t}function $i(e,i){let t=[...i].sort((f,m)=>(f.file??"").localeCompare(m.file??"")),o=t.slice(0,P).map(f=>({doc:f.file??"",citedClaims:f.citedClaims??[]})),n=t.length-o.length,a=t.every(f=>f.advisory===!0),s=t.reduce((f,m)=>Ge(f,m.severity),"info"),c=t.reduce((f,m)=>je(f,m.actionTier),void 0),d=t.map(f=>f.file??"").filter(f=>f.length>0),r=[...new Set(t.flatMap(f=>[f.id,...f.legacySuppressionIds??[]]))];return{id:b("doc-reference","hub-cluster",e),memberFindingIds:r,check:"doc-reference",severity:s,evidence:"change-graph",actionTier:c,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:o[0]?.doc,relatedFiles:[e],citationCount:t.length,citationExemplars:o,suppressedCount:n,...a?{advisory:!0}:{},message:`${e} is cited by ${t.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${o.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${t.length} doc(s) cite it but were not updated in the same diff: ${d.join(", ")}.`,...o.map(f=>`Example \u2014 ${f.doc}: ${f.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${P}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,a?"Advisory: every citation in this cluster is a bare file-mention (no line anchor, cited file still present).":"Blocking: at least one citation in this cluster is line-anchored or cites a deleted/renamed file."],remediation:`Review the ${o.length} example doc(s) above; ${t.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function wi(e,i,t){t.checksRun.push("unused-params");for(let o of $e(e,{files:i,limit:50})){let n=b("unused-params",o.symbol,o.file,o.unusedTrailing.join("|")),a=b("unused-params",o.symbol,o.file);v(t,{id:a,legacySuppressionIds:n===a?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:o.file,startLine:o.startLine,endLine:o.endLine,symbol:o.symbol,message:`${o.shortName} (${o.file}) has trailing unused parameter(s): ${o.unusedTrailing.join(", ")}`,why:[`${o.shortName} is in a changed file.`,`The trailing parameter(s) ${o.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function Di(e,i,t,o){o.checksRun.push("new-dead");let n=new W(e),a=H(e.config.projectRoot),s=a.length>1;for(let c of i){if(t(c)||c.fanIn>0||n.fileKind(c.file)==="test"||T(e,c.file)||A(e,c.symbol,c.file)||Fi(c.symbol))continue;let d=b("new-dead",c.symbol,c.file),r=s&&ki(a,c.file)&&vi(e,c.symbol);v(o,{id:d,check:"new-dead",severity:"warning",evidence:r?"heuristic":"graph-fact",confidence:r?.4:.9,file:c.file,symbol:c.symbol,message:r?`${c.shortName} (${c.file}) unconfirmed (cross-package ambiguous-name resolution gap): zero indexed consumers found, but this name is ambiguous project-wide and lives in a workspace package \u2014 verify manually before treating as dead`:`${c.shortName} (${c.file}) was changed but has zero indexed consumers`,why:r?[`${c.shortName} is a changed production symbol in a workspace package.`,"The index, semantic, and source-fallback layers all report zero consumers for this symbol.","Its leaf name is ambiguous project-wide (a same-named definition exists elsewhere), and cross-package consumers reached only through a re-exporting barrel are a known unresolvable shape for this tool \u2014 see docs/plans/2026-07-02-followups.md item 2."]:[`${c.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:r?"Verify with a direct code search before deleting; this tool cannot confidently resolve this symbol.":"Wire it up, or remove it before it becomes permanent dead code."})}}function ki(e,i){return e.some(t=>i===t.relativeDir||i.startsWith(`${t.relativeDir}/`))}function vi(e,i){let t=R(i);return t?(q(e).get(t)?.length??0)>1:!1}function Fi(e){if(U(e)!=="type")return!1;let i=R(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function Ri(e,i,t,o){let n=new Map(t.renamedFiles.map(s=>[s.to,s.from])),a=o??M(e,i,K(t));return s=>{let c=n.get(s.file)??s.file,d=R(s.symbol);if(!d)return!1;let r=a(c);return r!==null&&Ti(r,d)}}function Ti(e,i){return new RegExp(`\\b${O(i)}\\b`).test(e)}function Ai(e,i){if(!_(E(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=ke(e);for(let o of t.newFindings){let n=we(o),a=b("baseline",o);v(i,{id:a,groupKey:`baseline:${n.sourceAnalyzer}:${n.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:n.actionTier,confidence:1,file:n.file,relatedFiles:n.relatedFiles.length>0?n.relatedFiles:void 0,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${o}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${n.sourceAnalyzer}.`,`Inherited action tier: ${n.actionTier}.`,`Root cause key: ${n.rootCauseKey}.`,...n.why],remediation:n.remediation})}}function b(e,...i){return`SQ${ei("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{De as a,qi as b,ke as c,kt as d,vt as e,Ft as f,Rt as g,Ri as h};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-SREWDA7Q.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A as l,z as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{A as l,z as c}from"./chunk-M2TRDR25.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-TAB7AWKO.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as ae,c as O,d as T,e as H,k as pe,l as be}from"./chunk-
|
|
1
|
+
import{b as ae,c as O,d as T,e as H,k as pe,l as be}from"./chunk-MVFNACWB.js";import{d as le,e as me,f as $,g as de,i as ue,l as fe}from"./chunk-QNCVN5EH.js";import{D as ce,n as re,x as j}from"./chunk-OQRMCT2N.js";import{a as ne}from"./chunk-QEIGJJBC.js";import{d as ye,e as ge}from"./chunk-MTDBHTSF.js";import{e as P,g as te,s as oe,t as F,y as ie,z as se}from"./chunk-7XP7ZRSI.js";import{k as E,m as X,p as ee}from"./chunk-JLZUM476.js";import{B as w,c as Z}from"./chunk-TLTLJ4SW.js";import{a as Y}from"./chunk-64MNV6AB.js";import{c as V,d as z,g as B,h as x,j as Q,l as K,q,s as D,y as N}from"./chunk-M2TRDR25.js";function Mn(e,n,t={}){let o=Ce(e,[n],{additive:t.additive,semantic:t.semantic}),s=t.callableOnly?(o.get(n.symbolId)??[]).filter(a=>te(a.symbol)||a.source==="ast-callsite"):o.get(n.symbolId)??[];return typeof t.limit=="number"?s.slice(0,t.limit):s}function Se(e,n,t={}){let o=De(e)?ke(e,n,{semantic:t.semantic!==!1}):we(e).get(n.symbolId)??[];return typeof t.limit=="number"?o.slice(0,t.limit):o}var Le=z("caller-rows",{clearGroups:["whole-project"]}),_e=2e4;function De(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>_e}function we(e){return Le.get(e,()=>{let n=F(e),t=Ce(e,n),o=new Map;for(let i of n)o.set(i.symbol,i.symbolId);let s=new Map,a=new Map;for(let i of n){let l=t.get(i.symbolId);if(!(!l||l.length===0))for(let m of l){let c=o.get(m.symbol);if(c===void 0||c===i.symbolId)continue;let d=s.get(c);d||(d=[],s.set(c,d),a.set(c,new Set));let b=`${i.symbol}|${i.relativePath}`;a.get(c).has(b)||(a.get(c).add(b),d.push({symbol:i.symbol,file:i.relativePath,source:"caller-map-inversion"}))}}return s})}function ke(e,n,t){let o=[],s=new Set,a=l=>{if(l.symbol===n.symbol)return;let m=`${l.symbol}|${l.file}`;s.has(m)||(s.add(m),o.push(l))};for(let l of be(e,n))l.file!==n.relativePath&&a({symbol:l.enclosingSymbol??l.file,file:l.file,source:"resolved-reference"});let i=t.semantic?Ee(e,n):null;if(i)for(let l of ue(e,i)){if(l.file===n.relativePath||e.isIgnored(l.file))continue;let m=se(oe(e,l.file),l.line);a({symbol:m?.symbol??l.file,file:l.file,source:"semantic-reference"})}return o}function Ee(e,n){let t=ye().join(", "),o=ge().join(", ");return e.get(`SELECT
|
|
2
2
|
d.id AS documentId,
|
|
3
3
|
gs.id AS symbolId,
|
|
4
4
|
gs.symbol,
|
|
@@ -35,4 +35,4 @@ import{b as ae,c as O,d as T,e as H,k as pe,l as be}from"./chunk-2Y7YX54K.js";im
|
|
|
35
35
|
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
36
|
WHERE gs.id IN (${r.map(()=>"?").join(",")})`,...r,...r)),l=J([...n.map(r=>r.documentId),...i.flatMap(r=>r.document_id===null?[]:[r.document_id])]),m=new Map(l.flatMap(r=>e.all(`SELECT id, relative_path FROM documents
|
|
37
37
|
WHERE id IN (${r.map(()=>"?").join(",")})`,...r).map(y=>[y.id,y.relative_path]))),c=new Map;for(let r of i)c.has(r.symbol_id)||c.set(r.symbol_id,{symbol:r.symbol,file:r.document_id!==null?m.get(r.document_id)??"":""});let d=new Map,b=m,L=Ge(n);for(let[r,y]of L){let S=[...s.get(r)??[]].sort((u,g)=>u.start_line-g.start_line||u.end_line-g.end_line),v=[...y].sort((u,g)=>u.startLine-g.startLine||u.endLine-g.endLine),C=new Set,f=0;for(let u of v){for(;f<S.length&&S[f].start_line<=u.endLine;)C.add(S[f]),f+=1;for(let p of C)p.end_line<u.startLine&&C.delete(p);let g=new Set,k=[],R=null,G=()=>{if(R)return R;let p=b.get(u.documentId)??"",h=new Set;if(p){let I=ae(e,p),A=Math.max(0,u.startLine),W=Math.min(I.length-1,u.endLine);for(let _=A;_<=W;_+=1)for(let Ie of I[_])h.add(Ie)}return R=h,h};for(let p of C){if(p.symbol_id===u.symbolId)continue;let h=c.get(p.symbol_id);if(!h)continue;if(!(p.start_line>=u.startLine&&p.end_line<=u.endLine)){if(!(p.start_line<=u.endLine&&p.end_line>=u.startLine))continue;let _=P(h.symbol);if(!_||!G().has(_))continue}let A=`${h.symbol}|${p.chunk_id}`;g.has(A)||(g.add(A),k.push({...h,chunkId:p.chunk_id,source:"scip-chunk"}))}d.set(u.symbolId,k)}}return d}var he=500;function J(e){let n=[...new Set(e)],t=[];for(let o=0;o<n.length;o+=he)t.push(n.slice(o,o+he));return t}function Ge(e){let n=new Map;for(let t of e){let o=n.get(t.documentId);o?o.push(t):n.set(t.documentId,[t])}return n}function Be(e){let n=new Map;for(let[t,o]of e){let s=[];for(let a of o)s.push({symbol:a.symbol,file:a.file,chunkId:-1,source:"semantic-callee"});n.set(t,s)}return n}function Re(e,n,t={}){let o=new Map;if(n&&n.length===0)return o;let s=Y(e,{includeIgnored:!1}),a=H(e),i=n??F(e),l=new Set(i.map(c=>c.symbolId)),m=Qe(i);if(Ke(e,o,s,a,l,m),Je(e,o,i,l),ze(e,o,s,a,l,m),t.semantic!==!1){let c=$(e);Ze(o,c.callerMap(Ye(i)))}return o}function Ke(e,n,t,o,s,a){for(let i of t){if(!w(i))continue;let l=E(e,i);if(l)for(let m of l){if(a&&!a.has(m.calleeLeaf))continue;let c=O(i,o.get(m.calleeLeaf)??[]);if(!c||c.length===0)continue;let d=T(e,i,c,m.memberAccess);d&&s.has(d.symbolId)&&d.file!==i&&U(n,d.symbolId,i)}}}function Je(e,n,t,o){let s=We(t);for(let a of Ue(e,o))e.isIgnored(a.relative_path)||Ve(a,s.get(a.symbol_id))||U(n,a.symbol_id,a.relative_path)}function Ue(e,n){return le(e,n?[...n]:void 0)}function We(e){let n=new Map;for(let t of e)n.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return n}function Ve(e,n){return!!n&&n.docId===e.document_id&&e.chunk_start>=n.startLine&&e.chunk_end<=n.endLine}function ze(e,n,t,o,s,a){for(let i of t){if(w(i)!=="rust")continue;let l=X(e,i,{includeRustAttributeNames:!0});if(l.length!==0)for(let{name:m}of l){if(a&&!a.has(m))continue;let c=o.get(m);if(c)for(let d of c)s.has(d.symbolId)&&d.file!==i&&U(n,d.symbolId,i)}}}function U(e,n,t){let o=e.get(n);o||(o=new Set,e.set(n,o)),o.add(t)}function Qe(e){let n=new Set;for(let t of e){let o="leaf"in t&&typeof t.leaf=="string"?t.leaf:"symbol"in t&&typeof t.symbol=="string"?P(t.symbol):"";o&&n.add(o)}return n.size>0?n:null}function Ye(e){return e.filter(n=>"relativePath"in n&&"symbol"in n&&"leaf"in n)}function Ze(e,n){for(let[t,o]of n){let s=e.get(t);s||(s=new Set,e.set(t,s));for(let a of o)s.add(a)}}function Pn(e,n,t={}){return Se(e,n,t)}function qe(e,n,t={}){return Re(e,n,t)}function Xe(e,n,t={}){return pe(e,n,t)}function Fn(e,n,t={}){let o=qe(e,n,{semantic:t.semantic});return t.sourceFallback===!1?o:en(o,Xe(e,n))}function en(e,n){let t=new Map;for(let[o,s]of e)t.set(o,new Set(s));for(let[o,s]of n){let a=t.get(o)??new Set;for(let i of s)a.add(i);t.set(o,a)}return t}export{Mn as a,Ce as b,Pn as c,qe as d,Xe as e,Fn as f,en as g};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-TCOWAGR2.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R}from"./chunk-
|
|
1
|
+
import{a as R}from"./chunk-CYDOV3AQ.js";import{a as _,d as f}from"./chunk-5CJ6AQN7.js";import{d as l}from"./chunk-7XP7ZRSI.js";import{o as u,p,q as a}from"./chunk-JLZUM476.js";import{a as d}from"./chunk-64MNV6AB.js";import{y as m}from"./chunk-M2TRDR25.js";function $(e,o={}){let{scope:n,limit:r}=o,i=new R(e),t=D([...x(e,n),...O(e,i,n)]);return y(t),r?t.slice(0,r):t}function x(e,o){let n=[];for(let r of S(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||f(e,r.barrel_path)||m(e,r.barrel_path)&&a(e,r.barrel_path).length===0)continue;let i=N(e,r),t=i?.barrel_consumers??0,s=i?.direct_consumers??0;t!==0||s!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:l(r.symbol),originalFile:r.original_path,barrelConsumers:t,directConsumers:s,...b(e,r.barrel_path)})}return n}function S(e,o){let n=o?"AND barrel_d.relative_path LIKE ?":"",r=o?[`%${o}%`]:[];return e.all(`SELECT DISTINCT
|
|
2
2
|
barrel_d.id AS barrel_doc_id,
|
|
3
3
|
barrel_d.relative_path AS barrel_path,
|
|
4
4
|
gs.id AS symbol_id,
|
|
@@ -58,4 +58,4 @@ import{a as R}from"./chunk-3I34FZ6R.js";import{a as _,d as f}from"./chunk-NLRWGG
|
|
|
58
58
|
${e.pathExclusionsFor("consumer_d")}
|
|
59
59
|
GROUP BY consumer_d.id
|
|
60
60
|
)`,o.barrel_doc_id,o.symbol_id,o.barrel_doc_id,o.original_doc_id)}function O(e,o,n){let r=[];for(let i of C(e,n))h(e,i,i)>0||r.push(...I(e,o,i));return r}function C(e,o){return d(e,{scope:o,includeIgnored:!1}).filter(n=>a(e,n).length>0||u(e,n).length>0)}function I(e,o,n){let r=a(e,n).filter(t=>t.sourcePath&&!e.isIgnored(t.sourcePath)).flatMap(t=>g(e,o,n,t.sourcePath,[A(t.specifier)])),i=u(e,n).filter(t=>t.sourcePath&&!e.isIgnored(t.sourcePath)).flatMap(t=>g(e,o,n,t.sourcePath,t.kind==="named"&&t.names.length>0?t.names:[t.kind==="star"?`* from ${t.sourcePath}`:`* namespace from ${t.sourcePath}`]));return[...r,...i]}function g(e,o,n,r,i){let t=o.definitionsForFile(r);return i.map(s=>{let c=t.find(E=>E.leaf===s);return{barrelFile:n,symbol:c?.symbol??`source-reexport:${n}:${s}`,shortName:c?l(c.symbol):s,originalFile:r,barrelConsumers:0,directConsumers:h(e,r,n),...b(e,n)}})}function A(e){return e.split("::").at(-1)?.split("/").at(-1)?.replace(/\.[^.]+$/,"")??e}function b(e,o){return _(e,o)?{actionTier:"signal",surfaceEvidence:["barrel file is declared on the package public surface"],recommendation:"Review the package API before removing this re-export; local consumers are zero, but external consumers may import through the public barrel."}:{actionTier:"direct",surfaceEvidence:[],recommendation:"Remove this unused re-export when the barrel is not part of an external API surface."}}function h(e,o,n){let r=new Set;for(let i of d(e,{includeIgnored:!1}))if(i!==n)for(let t of p(e,i))t.sourcePath===o&&r.add(i);return r.size}function D(e){let o=new Set,n=[];for(let r of e){let i=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;o.has(i)||(o.add(i),n.push(r))}return n}function y(e){e.sort((o,n)=>n.directConsumers-o.directConsumers||o.barrelFile.localeCompare(n.barrelFile)||o.shortName.localeCompare(n.shortName))}export{$ as a};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-TL2IXVGH.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as q}from"./chunk-64MNV6AB.js";import{c as I,d as M,e as L,f as ke,g as Te,h as _e,o as Le,p as y,v as Fe,x as Pe,y as g,z as Ee}from"./chunk-
|
|
1
|
+
import{a as q}from"./chunk-64MNV6AB.js";import{c as I,d as M,e as L,f as ke,g as Te,h as _e,o as Le,p as y,v as Fe,x as Pe,y as g,z as Ee}from"./chunk-M2TRDR25.js";import{isAbsolute as jt,relative as Vt}from"path";function we(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function v(e){return e.replace(/\\/g,"/")}function Bo(e,t){return we(e)===we(t)}function Io(e,t){let n=Vt(e,t);return n===""||!n.startsWith("..")&&!jt(n)}import{existsSync as ce,readFileSync as le,readdirSync as Bt,statSync as It}from"fs";import{join as w,relative as $t}from"path";function Ae(e){let t=Ot(e)??zt(e);if(!t||t.length===0)return[];let n=[],r=new Set;for(let o of t)for(let s of Mt(e,o)){if(r.has(s))continue;r.add(s);let i=qt(e,s);i&&n.push(i)}return n}function Ot(e){let t=w(e,"pnpm-workspace.yaml");if(!ce(t))return null;try{return Dt(le(t,"utf8"))}catch{return null}}function Dt(e){let t=[],n=!1;for(let r of e.split(/\r?\n/)){let o=Wt(r);if(!n){/^packages\s*:\s*$/.test(o.trim())&&(n=!0);continue}let s=/^\s+-\s*(.+)$/.exec(o);if(s){let i=Ut(s[1].trim());i&&t.push(i);continue}if(o.trim()!=="")break}return t}function Wt(e){let t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function Ut(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function zt(e){let t=w(e,"package.json");if(!ce(t))return null;try{let n=JSON.parse(le(t,"utf8"));return n.workspaces?Array.isArray(n.workspaces)?n.workspaces:n.workspaces.packages??[]:null}catch{return null}}function Mt(e,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let i=w(e,t);return ae(i)?[i]:[]}let n=t.indexOf("*"),r=t.slice(0,n).replace(/\/$/,""),o=t.slice(n+1).replace(/^\//,""),s=w(e,r||".");return ae(s)?Bt(s).map(i=>w(s,i,o)).filter(ae):[]}function ae(e){try{return It(e).isDirectory()}catch{return!1}}function qt(e,t){let n=w(t,"package.json");if(!ce(n))return null;try{let r=JSON.parse(le(n,"utf8"));return typeof r.name!="string"||r.name.length===0?null:{name:r.name,relativeDir:$t(e,t).replace(/\\/g,"/"),exports:r.exports}}catch{return null}}import{extname as Re}from"path";var Xt={".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",".clj":"clojure",".cljs":"clojure",".cljc":"clojure"};function X(e){return Xt[Re(e).toLowerCase()]??null}function je(e){return Re(e).toLowerCase()===".vue"}import{createRequire as Ht}from"module";var d=Ht(import.meta.url),H=null,Ve=!1;function Jt(){if(Ve)return null;if(H)return H;try{return H=d("tree-sitter"),H}catch{return Ve=!0,null}}var Be=new Map,J=new Set;function Zt(e){if(J.has(e))return null;let t=Be.get(e);if(t)return t;let n;try{switch(e){case"rust":n=d("tree-sitter-rust");break;case"typescript":n=d("tree-sitter-typescript").typescript;break;case"tsx":n=d("tree-sitter-typescript").tsx;break;case"javascript":n=d("tree-sitter-javascript");break;case"python":n=d("tree-sitter-python");break;case"java":n=d("tree-sitter-java");break;case"kotlin":n=d("tree-sitter-kotlin");break;case"scala":n=d("tree-sitter-scala");break;case"ruby":n=d("tree-sitter-ruby");break;case"c":n=d("tree-sitter-c");break;case"cpp":n=d("tree-sitter-cpp");break;case"csharp":n=d("tree-sitter-c-sharp");break;case"php":n=d("tree-sitter-php").php;break;case"vb":{let r=d("tree-sitter-vb-dotnet");n=r.language??r;break}case"clojure":return J.add(e),null}}catch{return J.add(e),null}return Be.set(e,n),n}var Ie=new Map;function Gt(e){let t=Ie.get(e);if(t)return t;let n=Zt(e);if(!n)return null;let r=Jt();if(!r)return null;let o=new r;try{o.setLanguage(n)}catch{return J.add(e),null}return Ie.set(e,o),o}function Qt(e,t){return e.parse(r=>r>=t.length?null:t.slice(r,Math.min(t.length,r+16384)))}function $(e,t){let n=Gt(e);if(!n)return null;try{return Qt(n,t)}catch{return null}}import{posix as ue}from"path";import{parse as Kt}from"@vue/compiler-sfc";var Yt=L("vue-sfc-units");function A(e,t){let n=De(t),r=g(e,n);return Yt.get(e,n,r,()=>pe(e,n,r))}function De(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function en(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function F(e){return!e||e.body.length===0?0:e.body.split(`
|
|
2
2
|
`).length}function pe(e,t,n){let r={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!n)return r;let o;try{o=Kt(n,{filename:t})}catch(i){return r.errors.push(Oe(i)),r}r.errors.push(...o.errors.map(Oe));let{descriptor:s}=o;return s.template&&(r.template=Z(e,t,"template",s.template)),s.script&&r.scripts.push($e(e,t,s.script,!1)),s.scriptSetup&&r.scripts.push($e(e,t,s.scriptSetup,!0)),r.styles=s.styles.map(i=>Z(e,t,"style",i)),r.customBlocks=s.customBlocks.map(i=>Z(e,t,"custom",i)),r.errors.push(...[r.template,...r.scripts,...r.styles,...r.customBlocks].flatMap(i=>i?.errors??[])),r}function $e(e,t,n,r){let o=Z(e,t,"script",n);return{...o,kind:"script",setup:r,astLanguage:en(o.lang)}}function Z(e,t,n,r){let o=nn(r.attrs),s=typeof o.lang=="string"?o.lang:null,i=typeof o.src=="string"?o.src:typeof r.src=="string"?r.src:void 0;if(i){let c=tn(t,i);if(!c)return{kind:n,ownerPath:t,sourcePath:t,external:!0,src:i,attrs:o,lang:s,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${n} block source: ${i}`]};let l=g(e,c),f=l?Math.max(0,l.split(`
|
|
3
3
|
`).length-1):0;return{kind:n,ownerPath:t,sourcePath:c,external:!0,src:i,attrs:o,lang:s,body:l,startLine:0,endLine:f,errors:l?[]:[`Vue ${n} block source not found: ${c}`]}}let a=Math.max(0,r.loc.start.line-1);return{kind:n,ownerPath:t,sourcePath:t,external:!1,attrs:o,lang:s,body:r.content,startLine:a,endLine:Math.max(a,r.loc.end.line-1),errors:[]}}function tn(e,t){let n=t.split(/[?#]/,1)[0];if(!n||n.startsWith("/")||n.includes("://"))return null;let r=De(ue.normalize(ue.join(ue.dirname(e),n)));return r===".."||r.startsWith("../")?null:r}function nn(e){return{...e}}function Oe(e){return e instanceof Error?e.message:String(e)}function We(e,t,n){let o=pe(e,t,n).scripts.filter(i=>i.astLanguage&&i.body.length>0),s=o[0]?.astLanguage;return s?{body:o.map(i=>`${`
|
|
4
4
|
`.repeat(i.startLine)}${i.body}`).join(`
|
|
@@ -8,4 +8,4 @@ import{a as q}from"./chunk-64MNV6AB.js";import{c as I,d as M,e as L,f as ke,g as
|
|
|
8
8
|
`)))}var ko=new Set(["in","key","of"]),To=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]),_o=L("vue-component-behavior-profiles");function wt(e,t={}){let n=O(e,{extensions:[".vue"]}).filter(o=>!t.scope||o.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(o=>Ce(e,o)).filter(o=>(t.minTemplateTokens===void 0||o.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||o.behaviorTokens.size>=t.minBehaviorTokens))}function Ce(e,t){let n=t.replace(/\\/g,"/"),r=g(e,n),o=_o.get(e,n,r,()=>Lo(e,n,r));return Po(o)}function Lo(e,t,n){let r=A(e,t),o=re(e,t),s=ne(r),i=Ao(o),a=o.expressionIdentifiers.map(m=>m.name).filter(m=>!i.includes(m)).filter((m,b,B)=>B.indexOf(m)===b).sort(),c=o.componentTags.map(m=>m.normalized).filter((m,b,B)=>B.indexOf(m)===b).sort(),l=n?n.split(`
|
|
9
9
|
`).length:0,f=F(r.template),u=s.lineCount,N=r.styles.reduce((m,b)=>m+F(b),0),V=r.customBlocks.reduce((m,b)=>m+F(b),0),{lines:se,paths:ie}=Fo(e,t,s);return{file:t,sfc:r,templateFacts:o,scriptFacts:s,templateTokens:new Set(o.structuralTokens),behaviorTokens:wo(o,s,a),templateBindingNames:a,templateLocalNames:i,componentNames:c,sfcLines:l,totalLines:l+s.externalLineCount,templateLines:f,scriptLines:u,styleLines:N,externalScriptLines:s.externalLineCount,externalScriptPaths:s.externalScriptPaths,customBlockLines:V,delegatedComposableLines:se,delegatedComposablePaths:ie}}function Fo(e,t,n){let r=new Set;for(let i of n.composables){let a=n.imports.find(l=>l.local===i);if(!a)continue;let c=Pt(e,a.sourcePath,a.source);!c||c===t||r.add(c)}let o=[...r].sort();return{lines:o.reduce((i,a)=>{let c=g(e,a);return i+(c?c.split(`
|
|
10
10
|
`).length:0)},0),paths:o}}function Po(e){let t=Eo(e.scriptFacts);return{...e,scriptFacts:t,templateTokens:new Set(e.templateTokens),behaviorTokens:new Set(e.behaviorTokens),templateBindingNames:[...e.templateBindingNames],templateLocalNames:[...e.templateLocalNames],componentNames:[...e.componentNames],externalScriptPaths:t.externalScriptPaths,delegatedComposablePaths:[...e.delegatedComposablePaths]}}function Eo(e){return{...e,imports:e.imports.map(t=>({...t})),functions:e.functions.map(t=>({...t})),calls:e.calls.map(t=>({...t,categories:[...t.categories]})),composables:[...e.composables],stores:[...e.stores],reactivity:[...e.reactivity],lifecycle:[...e.lifecycle],requests:[...e.requests],macros:[...e.macros],externalScriptPaths:[...e.externalScriptPaths],unresolvedScripts:e.unresolvedScripts.map(t=>({...t}))}}function wo(e,t,n){let r=new Set;for(let o of t.composables)r.add(`composable:${o}`);for(let o of t.stores)r.add(`store:${o}`);for(let o of t.reactivity)r.add(`reactivity:${o}`);for(let o of t.lifecycle)r.add(`lifecycle:${o}`);for(let o of t.requests)r.add(`request:${o}`);for(let o of t.macros)r.add(`macro:${o}`);for(let o of t.functions){if(To.has(o.name))continue;r.add(`function:${o.name}`);let s=/^[a-z]+/.exec(o.name)?.[0]??null;s&&s.length>2&&s!==o.name&&r.add(`function-verb:${s}`)}for(let o of e.events)r.add(`template-event:${o.name}`);for(let o of n)r.add(`template-binding:${o}`);return r}function Ao(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of Ro(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of At(n.value))t.add(r);return[...t].sort()}function Ro(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?At(t[1]??""):[]}function At(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];ko.has(r)||t.push(r)}return t}function gi(e){return{capability:(t,n)=>jo(t,n),reactProfiles:(t={})=>Ye(e,t),reactProfilesForFile:t=>me(e,t),vueProfiles:(t={})=>wt(e,t),vueProfileForFile:t=>Ce(e,t),vueTemplateFacts:t=>re(e,t),vueScriptFacts:t=>ne(A(e,t))}}function jo(e,t){let n=e.startsWith("react-")?"react":"vue";if(t===void 0)return{slot:e,available:!0,framework:n};let r=t.replace(/\\/g,"/").toLowerCase();return n==="react"&&!r.endsWith(".tsx")&&!r.endsWith(".jsx")?{slot:e,available:!1,framework:n,reason:"React behavior profiles are only available for .tsx and .jsx files"}:n==="vue"&&!r.endsWith(".vue")?{slot:e,available:!1,framework:n,reason:"Vue behavior facts are only available for .vue files"}:{slot:e,available:!0,framework:n}}export{we as a,v as b,Bo as c,Io as d,Ae as e,Mt as f,z as g,ht as h,St as i,yt as j,xt as k,vt as l,Nt as m,bt as n,Ct as o,oe as p,Ys as q,Kr as r,Pt as s,fo as t,mo as u,go as v,ho as w,So as x,yo as y,xo as z,ei as A,X as B,je as C,We as D,ze as E,K as F,Q as G,at as H,pt as I,us as J,He as K,O as L,ps as M,gi as N};
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-TLTLJ4SW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b}from"./chunk-5N5ZC566.js";import{m as d,x as f}from"./chunk-7XP7ZRSI.js";function S(a,g){let p=b(a,g),i=f(a,p,{sort:!0});if(i.length===0)return[];let o=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,signature:e.signature,children:[]})),s=new Map;for(let e of o)s.set(e.symbol,e);let c=[];for(let e=0;e<i.length;e++){let r=i[e],n=o[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of o)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!d(t.symbol,n.symbol))continue;let u=t.endLine-t.startLine;u<m&&(m=u,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-TR7C5HOC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as C,b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as C,b}from"./chunk-XKWEMFHP.js";import{a as P,c as y,e as r,f}from"./chunk-B3X6KU75.js";import{a as g,b as h,c as k}from"./chunk-KMVGRIO2.js";import{N as v}from"./chunk-TLTLJ4SW.js";function L(e,i={}){let{minSimilarity:o=.62,minTokens:n=8,limit:c=20,scope:l,scanLimit:u,filePattern:m,focusFiles:d}=i,s=B(e,{scope:l,minTokens:n,scanLimit:u}),p=C(s,t=>t.tokens);return b({profiles:s,limit:c,filePattern:m,focusFiles:d,candidateIndex:p,profile:{name:"vue-component-duplicates"},compare:(t,a)=>V(t,a,o),sort:(t,a)=>a.similarity-t.similarity||t.fileA.localeCompare(a.fileA)||t.fileB.localeCompare(a.fileB)})}function B(e,i){return v(e).vueProfiles({scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(o=>({file:o.file,tokens:o.templateTokens,loc:T(o)}))}function T(e){return e.totalLines}function V(e,i,o){let n=g(e.tokens,i.tokens);if(n.size<6||!R(n))return null;let c=k(e.tokens,i.tokens);if(c<o)return null;let l=r(n,"component:"),u=r(n,"prop:"),m=r(n,"event:"),d=r(n,"directive:"),s=r(n,"slot:"),p=r(n,"id:"),t=S({sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p});return{fileA:e.file,fileB:i.file,similarity:c,tokenCountA:e.tokens.size,tokenCountB:i.tokens.size,sharedTokens:f(n),sharedComponents:l,sharedProps:u,sharedEvents:m,sharedDirectives:d,sharedSlots:s,sharedIdentifiers:p,evidenceClass:t.evidenceClass,actionTier:t.actionTier,evidenceClassReasons:t.reasons,recommendation:t.recommendation,uniqueToA:f(h(e.tokens,i.tokens)).slice(0,25),uniqueToB:f(h(i.tokens,e.tokens)).slice(0,25),locA:e.loc,locB:i.loc}}function R(e){let i=0,o=0;for(let n of e)n.startsWith("component:")&&(i+=1),(n.startsWith("prop:")||n.startsWith("event:")||n.startsWith("directive:")||n.startsWith("slot:"))&&(o+=1);return y([{name:"component",count:i},{name:"behavior",count:o}],[{min:{component:1},reason:"shared custom component"},{min:{behavior:3},reason:"shared Vue template structure"}]).pass}function S(e){return P({genericWords:x,primitiveGroups:[{values:e.sharedProps,reasonPrefix:"shared props",bucket:"generic"},{values:e.sharedEvents,reasonPrefix:"shared events",bucket:"generic"},{values:e.sharedDirectives,reasonPrefix:"shared directives",bucket:"generic"},{values:e.sharedSlots,reasonPrefix:"shared slots",bucket:"generic"}],nameGroups:[{names:e.sharedComponents,label:"shared component",fallbackBucket:"generic"},{names:e.sharedIdentifiers,label:"shared identifier",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":case"mixed":return"Review for a shared component or feature-specific Vue primitive around the named domain structure.";case"shared-abstraction":return"Review the existing shared component usage first; extract only if duplicated structure remains outside it.";case"generic-workflow-scaffolding":return"Generic structural overlap \u2014 verify intent before consolidating."}}var x=new Set(["actions","app","button","card","content","container","dialog","field","form","header","input","item","label","layout","list","modal","page","panel","row","section","shell","table","text","toolbar","ui","value","view","wrapper"]);export{L as a};
|
|
2
|
+
//# sourceMappingURL=chunk-U244OVE6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{E as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{E as s}from"./chunk-TLTLJ4SW.js";var p=new Set(["componentDidCatch","componentDidMount","componentDidUpdate","componentWillUnmount","getDerivedStateFromError","getDerivedStateFromProps","getSnapshotBeforeUpdate","render","shouldComponentUpdate","UNSAFE_componentWillMount","UNSAFE_componentWillReceiveProps","UNSAFE_componentWillUpdate"]);function l(i,t){if(!t.parentTypeName||!/\.[cm]?[jt]sx?$/.test(t.relativePath))return!1;let r=s(i,t.relativePath);if(!r)return!1;let n=r.rootNode.descendantsOfType("method_definition").find(a=>a.startPosition.row<=t.startLine&&a.endPosition.row>=t.endLine);if(!n)return!1;if(/\boverride\b/.test(n.text.slice(0,Math.max(0,n.text.indexOf("{")))))return!0;let e=n.parent;for(;e&&e.type!=="class_declaration"&&e.type!=="class";)e=e.parent;if(!e)return!1;let o=e.text.slice(0,Math.max(0,e.text.indexOf("{")));return/\bimplements\b/.test(o)||/\bextends\b/.test(o)?!0:p.has(t.leaf)&&/\bextends\s+(?:React\.)?(?:Component|PureComponent)\b/.test(o)}export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-UWR52GNZ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as D,b as v,c as $,d as B}from"./chunk-
|
|
1
|
+
import{a as D,b as v,c as $,d as B}from"./chunk-LC57FSPX.js";import{a as K}from"./chunk-BGUYAA3Q.js";import{a as A}from"./chunk-CYDOV3AQ.js";import{b as M,g as R}from"./chunk-5CJ6AQN7.js";import{a as g}from"./chunk-BGBBVSH4.js";import{g as I}from"./chunk-TCOWAGR2.js";import{b as k,d as F,e as b}from"./chunk-7XP7ZRSI.js";import{l as w}from"./chunk-JLZUM476.js";import{y as C}from"./chunk-M2TRDR25.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},d=e?.semantic!==!1,a=new A(t),m=a.scopedDefinitions(n),y=Q(a,n),p={high:0,medium:1,low:2};return K({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>g(c)-g(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:u=>{let c=U(u),f=W(t,a,u,c,{semantic:d}),h=u.filter(P=>{let x=S(t,P,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&j(P,x.realConsumers.length,y)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,h,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=S(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!j(f.definition,f.realConsumers.length,y))return null;let h=V(t,f);return!l&&h.confidence==="low"?null:h},orderResults:(u,c)=>p[u.confidence]-p[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&&g(s)>=i.minLoc).filter(s=>g(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!s.relativePath.endsWith(".d.ts")).filter(s=>M(s.relativePath)!=="test").filter(s=>!R(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function L(t,e,n,i){return v(D(t,e).forDefinitions(n,{semantic:i.semantic,sourceFallback:i.sourceFallback}))}function W(t,e,n,i,s){let r=L(t,e,n,{semantic:!1,sourceFallback:!1}),l=n.filter(a=>{let m=S(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&T(a.relativePath))}),o=s.semantic&&l.length>0?I(r,L(t,e,l,{semantic:!0,sourceFallback:!1})):r,d=l.filter(a=>S(t,a,o,i).realConsumers.length<=1);return I(o,L(t,e,d,{semantic:!1,sourceFallback:!0}))}function U(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=b(n.symbol);s&&i.set(s,n)}return e}function S(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:l,barrelConsumers:o,importOnlyConsumers:d}=$(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:o+d,transitivelyReachable:a}}function V(t,e){let n=E(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),l=z(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:g(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:l.actionTier,stalenessKind:l.stalenessKind,recommendation:l.recommendation}}function z(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),l=r.map(a=>a.singleton);if(r.length===0)return new Set;let o=v(D(t,e).forDefinitions(l,{semantic:s.semantic,sourceFallback:!0})),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,o)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=b(n.symbol);i&&e.set(N(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(E(t,n.relativePath,n.startLine)!=="class")return null;let i=b(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(N(n.relativePath,s))??null:null}function G(t,e,n){let i=b(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!B(t,r,i))}function N(t,e){return`${t}\0${e}`}function J(t,e,n){let i=C(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=k(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function j(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=w(t,e.relativePath),r=b(e.symbol);if(!r)return!1;let l=i.get(e.relativePath);if(!l)return!1;let o=[...s.get(r)??[]],d=new Set;for(;o.length>0;){let a=o.pop();if(d.has(a))continue;d.add(a);let m=l.get(a);if(!m)continue;let y=n.get(m.symbolId);if(y){for(let p of y)if(p!==e.relativePath&&!t.isIgnored(p))return!0}for(let p of s.get(a)??[])o.push(p)}return!1}function E(t,e,n){let i=C(t,e);if(!i)return"other";let s=i.split(`
|
|
2
2
|
`),r=Math.max(0,n-2),l=Math.min(s.length-1,n+2);for(let o=r;o<=l;o++){let a=(s[o]??"").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=C(t,e.relativePath);if(!n)return!1;let i=b(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),l=n.split(`
|
|
3
3
|
`);for(let o=0;o<l.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&r.test(l[o]??""))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-
|
|
4
|
+
//# sourceMappingURL=chunk-VCOAUTSI.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{b as f,d as g,f as d,t as p}from"./chunk-
|
|
1
|
+
import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{b as f,d as g,f as d,t as p}from"./chunk-7XP7ZRSI.js";import{a as c}from"./chunk-64MNV6AB.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
|
|
2
2
|
FROM defn_enclosing_ranges der
|
|
3
3
|
JOIN global_symbols gs ON der.symbol_id = gs.id
|
|
4
4
|
JOIN documents d ON der.document_id = d.id
|
|
@@ -20,4 +20,4 @@ import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{b as f,d as g,f as
|
|
|
20
20
|
${n.symbolNoiseFor("gs")}
|
|
21
21
|
AND d.relative_path IN (${i})
|
|
22
22
|
ORDER BY d.relative_path, der.start_line, der.end_line, gs.symbol`,...e))}return t}function N(n){let s=[];for(let t=0;t<n.length;t+=_)s.push(n.slice(t,t+_));return s}function R(n){return{symbol:n.symbol,kind:n.kind,documentation:n.documentation,enclosing_symbol:n.enclosingSymbol,relative_path:n.relativePath,start_line:n.startLine,end_line:n.endLine}}function k(n){return n.kind!==null&&n.kind!==0?D(n.kind,n.symbol,n.documentation):C(n.symbol,n.documentation,n.enclosing_symbol)}function D(n,s,t){let e=(t??"").toLowerCase();if(d(s)==="type"){if(e.includes("type "))return o.TypeAlias;if(e.includes("interface "))return o.Interface;if(e.includes("struct "))return o.Struct;if(e.includes("trait "))return o.Trait;if(e.includes("class "))return o.Class}return n}function C(n,s,t){let e=f(n);if("kind"in e)return null;let i=e.descriptors,l=i[i.length-2]??null,u=d(n),r=(s??"").toLowerCase();return u==="type"?r.includes("type ")?o.TypeAlias:r.includes("interface ")?o.Interface:r.includes("struct ")?o.Struct:r.includes("trait ")?o.Trait:r.includes("class ")?o.Class:o.Class:u==="method"?l?.suffix==="type"?o.Method:o.Function:u==="namespace"?o.Module:u!=="term"?null:r.includes("async def ")||r.includes("def ")?o.Function:(t?d(t):l?.suffix??null)==="type"?o.Field:o.Variable}export{v as a,T as b};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-VCRMI56V.js.map
|