scip-query 0.9.0 → 0.10.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/dist/{chunk-GD7XRHSV.js → chunk-2BMFRBV6.js} +2 -2
- package/dist/{chunk-3YQO3S5D.js → chunk-2WEH5QHC.js} +2 -2
- package/dist/{chunk-PE4EJOLN.js → chunk-4DAPXOWD.js} +2 -2
- package/dist/{chunk-EKP7XJ6L.js → chunk-4HTJZC6G.js} +2 -2
- package/dist/{chunk-RCRK4E7E.js → chunk-4JQFTUKD.js} +2 -2
- package/dist/{chunk-7I6KNKE3.js → chunk-4MHT7LKP.js} +2 -2
- package/dist/chunk-5OHZEO3U.js +3 -0
- package/dist/chunk-5QJIEYFB.js +34 -0
- package/dist/{chunk-Z2AJQ7VA.js → chunk-6DEX3XP6.js} +2 -2
- package/dist/{chunk-OMNT7E2T.js → chunk-6IGXZZQ4.js} +2 -2
- package/dist/{chunk-TA4DDU7J.js → chunk-6K2JQ2VI.js} +2 -2
- package/dist/{chunk-YO6DU7QZ.js → chunk-6QVCPUK6.js} +2 -2
- package/dist/chunk-6VL4AIEO.js +8 -0
- package/dist/{chunk-VHENVDS2.js → chunk-772YYL6I.js} +2 -2
- package/dist/{chunk-VTF5EH22.js → chunk-A2VTV2QB.js} +2 -2
- package/dist/{chunk-YSSTUCNS.js → chunk-ADRYSISR.js} +2 -2
- package/dist/{chunk-NM3BZXHA.js → chunk-AI2ECT7L.js} +2 -2
- package/dist/{chunk-TR5AU6A5.js → chunk-AP5GTKSG.js} +2 -2
- package/dist/{chunk-TCCUWKH4.js → chunk-BGRPMGTD.js} +2 -2
- package/dist/{chunk-7TYJD45F.js → chunk-BNW3Q24R.js} +2 -2
- package/dist/{chunk-K3V6XUTL.js → chunk-BUAC4Q4G.js} +2 -2
- package/dist/{chunk-SEZZ24IG.js → chunk-BZ6LCGE6.js} +2 -2
- package/dist/{chunk-ZJ737ZMD.js → chunk-CMXFASVD.js} +2 -2
- package/dist/{chunk-L6TOEQ2M.js → chunk-CO3AL7NZ.js} +2 -2
- package/dist/{chunk-ITUU3VE3.js → chunk-FVIKFWUL.js} +2 -2
- package/dist/{chunk-APLCSDXL.js → chunk-FVVT7GV6.js} +2 -2
- package/dist/chunk-HXXRN77A.js +2 -0
- package/dist/{chunk-NK7TQQG4.js → chunk-IC3RC3KJ.js} +2 -2
- package/dist/chunk-ISCKLDSS.js +22 -0
- package/dist/chunk-ITHQJZTG.js +2 -0
- package/dist/{chunk-RIXOMSOR.js → chunk-IVAIPXNO.js} +2 -2
- package/dist/{chunk-NO2TPMCQ.js → chunk-IW7ASGVF.js} +2 -2
- package/dist/{chunk-I66MQD5U.js → chunk-JODYQDE4.js} +2 -2
- package/dist/{chunk-HDA2V5DC.js → chunk-L2KFPRMA.js} +2 -2
- package/dist/{chunk-U254PV4S.js → chunk-MCW36F2D.js} +2 -2
- package/dist/{chunk-SDGCKEB7.js → chunk-MN75T4UB.js} +2 -2
- package/dist/{chunk-AGW2MVIO.js → chunk-NC4IUW25.js} +2 -2
- package/dist/{chunk-2DVVHNC3.js → chunk-NGI4V4AB.js} +2 -2
- package/dist/{chunk-SOGLYIJ4.js → chunk-O6KCZPJQ.js} +2 -2
- package/dist/chunk-OAI5GEIN.js +6 -0
- package/dist/chunk-OH5HIAID.js +4 -0
- package/dist/{chunk-NGLRXEWN.js → chunk-OLCKSG3Y.js} +2 -2
- package/dist/{chunk-JTCEWV7Q.js → chunk-OXKEUWMJ.js} +2 -2
- package/dist/{chunk-LBAMALDV.js → chunk-PRVDXGSK.js} +2 -2
- package/dist/{chunk-46ILZVMX.js → chunk-QJWN6LA5.js} +2 -2
- package/dist/{chunk-BCFED24F.js → chunk-QKO474FG.js} +2 -2
- package/dist/{chunk-TQTVM27C.js → chunk-QYKKTYBN.js} +2 -2
- package/dist/{chunk-UUDYI3FF.js → chunk-R6XDPWJA.js} +2 -2
- package/dist/{chunk-D43L5PQF.js → chunk-SCEMECW7.js} +2 -2
- package/dist/{chunk-2Y2WIJI4.js → chunk-SJR4SB7B.js} +2 -2
- package/dist/chunk-SYKCO25G.js +16 -0
- package/dist/{chunk-FYT2PE7C.js → chunk-T22X7WT6.js} +2 -2
- package/dist/{chunk-Y3RUPPIU.js → chunk-VDY4HYNK.js} +2 -2
- package/dist/{chunk-EAU4RDFG.js → chunk-VDZIEDJB.js} +2 -2
- package/dist/{chunk-6ZFKI5EP.js → chunk-VGBSY6N7.js} +2 -2
- package/dist/{chunk-VN6B6HFB.js → chunk-VZRILF2Z.js} +2 -2
- package/dist/{chunk-CVRXOP6M.js → chunk-WJIS6BNI.js} +2 -2
- package/dist/{chunk-SLX5XBCD.js → chunk-WN5Z3UVT.js} +2 -2
- package/dist/{chunk-6G76D2YM.js → chunk-XCW7DYHM.js} +2 -2
- package/dist/{chunk-6HP3BKIP.js → chunk-Y5H7TBVE.js} +2 -2
- package/dist/{chunk-I7OTKWNY.js → chunk-YWZBKYLS.js} +2 -2
- package/dist/{chunk-64UY7VTR.js → chunk-ZF6P2NAT.js} +3 -3
- package/dist/{chunk-VQGQHIAT.js → chunk-ZGIK464P.js} +2 -2
- package/dist/{chunk-WC43FMAB.js → chunk-ZOT3WUZW.js} +2 -2
- package/dist/{chunk-TFO4OMJZ.js → chunk-ZZ2W5P3D.js} +2 -2
- package/dist/cli.js +171 -151
- package/dist/index.js +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +5 -1
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-44G4P3GJ.js +0 -2
- package/dist/chunk-IBM6FXOQ.js +0 -3
- package/dist/chunk-LR7E2ATW.js +0 -8
- package/dist/chunk-PCMVXWDC.js +0 -34
- package/dist/chunk-PLFYFZX3.js +0 -2
- package/dist/chunk-SQ6VENQY.js +0 -6
- package/dist/chunk-T4AK46CM.js +0 -16
- package/dist/chunk-WQFOZIID.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as m}from"./chunk-
|
|
1
|
+
import{b as m}from"./chunk-ZOT3WUZW.js";import{u as o}from"./chunk-O6KCZPJQ.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
|
|
2
2
|
WHERE relative_path IN (${d})
|
|
3
3
|
ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
|
|
4
4
|
FROM mentions m
|
|
@@ -32,4 +32,4 @@ import{b as m}from"./chunk-WC43FMAB.js";import{u as o}from"./chunk-SOGLYIJ4.js";
|
|
|
32
32
|
WHERE d2.relative_path IN (${d})
|
|
33
33
|
AND d1.relative_path NOT IN (${d})
|
|
34
34
|
ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{h as a};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-2BMFRBV6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-IW7ASGVF.js";import{a as l}from"./chunk-4MHT7LKP.js";import{d as o,f as a}from"./chunk-O6KCZPJQ.js";import{basename as d}from"path";function M(t,c){let n=l(t,c);if(!n)return[];let r=o(n.symbol),s=new m(t).definitionsForFile(n.relativePath).filter(e=>a(e.symbol)),i=s.filter(e=>e.parentTypeName===r||e.symbol.includes(r));return(i.length>0?i:p(d(n.relativePath))===r?s.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:o(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
|
|
2
|
+
//# sourceMappingURL=chunk-2WEH5QHC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as y}from"./chunk-IVAIPXNO.js";function R(D,k={}){let{limit:x=10,scope:M,minDepth:v=3}=k,a=y(D,M),u=new Map,c=[],l=new Map,r=new Map,g=new Set,f=[],h=0;for(let t of a.keys()){if(l.has(t))continue;let n=[],s=(a.get(t)??new Set).values();for(l.set(t,h),r.set(t,h),h+=1,f.push(t),g.add(t),n.push({node:t,iter:s,pendingChild:null});n.length>0;){let e=n[n.length-1];if(e.pendingChild!==null){let d=e.pendingChild;e.pendingChild=null,r.set(e.node,Math.min(r.get(e.node),r.get(d)))}let o=e.iter.next();if(o.done){if(r.get(e.node)===l.get(e.node)){let d=[];for(;;){let p=f.pop();if(g.delete(p),d.push(p),u.set(p,c.length),p===e.node)break}c.push(d)}n.pop();continue}let i=o.value;if(l.has(i))g.has(i)&&r.set(e.node,Math.min(r.get(e.node),l.get(i)));else{l.set(i,h),r.set(i,h),h+=1,f.push(i),g.add(i);let d=(a.get(i)??new Set).values();e.pendingChild=i,n.push({node:i,iter:d,pendingChild:null})}}}let m=new Map,w=new Array(c.length);for(let t=0;t<c.length;t++)w[t]=c[t].length,m.set(t,new Set);for(let[t,n]of a){let s=u.get(t);for(let e of n){let o=u.get(e);o!==s&&m.get(s).add(o)}}let S=new Array(c.length),I=new Array(c.length);for(let t=0;t<c.length;t++){let n=[],s=0;for(let e of m.get(t)){let o=I[e];o>s&&(s=o,n=S[e])}S[t]=[t,...n],I[t]=w[t]+s}function A(t){return S[t]}let F=c.map(t=>[...t].sort()),C=new Set,b=[];for(let t=0;t<c.length;t++){let n=A(t),s=[];for(let o of n)s.push(...F[o]);if(s.length<v)continue;let e=s.join(" ");C.has(e)||(C.add(e),b.push({chain:s,depth:s.length}))}return b.sort((t,n)=>n.depth-t.depth),b.slice(0,x)}export{R as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4DAPXOWD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d,b as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d,b as m}from"./chunk-QYKKTYBN.js";import{a as B}from"./chunk-IVAIPXNO.js";function F(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],a=new Set,l=new Set,f=[];function y(t,o){if(o>c)return;if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),g=u.indexOf(u.reduce((x,$)=>x<$?x:$)),p=[...u.slice(g,-1),...u.slice(0,g),u[g]],S=p.join(" -> ");b.has(S)||(b.add(S),i.push({path:p,kind:R(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)y(h,o+1);f.pop(),l.delete(t)}let b=new Set;for(let t of n.keys())a.has(t)||y(t,0);return i.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),i}function R(s){for(let c of s){let n=d(c);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(s.length!==3)return"real";let[e,r]=s;return!e||!r?"real":m(e)||m(r)||C(e,r)||C(r,e)||D(e,r)||D(r,e)||d(e)==="entry"||d(r)==="entry"?"module-hierarchy":"real"}function C(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=e.replace(/\.rs$/,"/");return s.startsWith(r)?!s.slice(r.length).includes("/"):!1}function D(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=s.replace(/\.rs$/,""),c=e.replace(/\.rs$/,"");if(r===c+"_tests"||r===c+"/tests")return!0;let n=s.split("/"),i=e.split("/");if(n.length===i.length&&n.includes("tests")&&i.includes("src")){let a=n[n.length-1],l=i[i.length-1];if(a&&a===l)return!0}return!1}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4HTJZC6G.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d,c as f,e as u,s as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d,c as f,e as u,s as p}from"./chunk-O6KCZPJQ.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function y(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function K(e,i,s={}){let{scope:n,limit:r=100}=s,o=y(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:g(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=g(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function g(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):k(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function k(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{K as a,P as b};
|
|
2
|
+
//# sourceMappingURL=chunk-4JQFTUKD.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as D,c as $,d as Q,f as v,g as A,h as N,m as y,n as d,q as w,w as f}from"./chunk-
|
|
1
|
+
import{b as D,c as $,d as Q,f as v,g as A,h as N,m as y,n as d,q as w,w as f}from"./chunk-O6KCZPJQ.js";function re(e,n){let t=Z(e,n.trim());if(t)return t;let i=q(e,n);if(i)return i;let o=F(e,n);return o||j(e,n)}function F(e,n){let t=x(n),i=I(t);if(!i)return null;let o=`%${i.path}%`,r=i.leaf,c=O(e,o,r,t)[0];return c?f(e,c):null}function O(e,n,t,i){let o=w([],[...z(e,n,t),...W(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>h(r,i)>1);return o.sort((r,a)=>h(a,i)-h(r,i)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),o}function z(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function W(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function j(e,n){let t=x(n),i=U(n),o=H(e,i),r=V(o,n,t);if(r&&!e.isIgnored(r.relative_path))return f(e,r);let a=null;for(let c of o){if(e.isIgnored(c.relative_path))continue;let l=J(c,n,t,i);l<=0||(!a||l>a.score)&&(a={row:c,score:l})}return a?f(e,a.row):null}function q(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return null;let[,i,o,r]=t,a=Math.max(0,parseInt(o,10)-1),c=Math.max(a,parseInt(r,10)-1),l=T(e,i,a,c)??X(e,i,a,c);return l&&!e.isIgnored(l.relative_path)?f(e,l):null}function T(e,n,t,i){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function X(e,n,t,i){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Z(e,n){let i=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line",limit:1})[0]??d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line",limit:1})[0];return!i||e.isIgnored(i.relative_path)?null:f(e,i)}function ae(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=G(e,n.symbolId)[0];return t?f(e,t):null}function G(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),i=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return w(t,i)}function H(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=n.flatMap(c=>{let l=`%${c}%`;return[l,l,l]}),o=t.join(`
|
|
2
2
|
AND `),r=y(e,{where:o,params:i,limit:200}),a=d(e,{where:o,params:i,limit:200});return w(r,a)}function J(e,n,t,i){let o=n.trim(),r=t,a=r.replace(/\(\)$/,""),c=n.toLowerCase(),l=t.toLowerCase(),S=l.replace(/\(\)$/,""),k=e.symbol,C=$(e.symbol),b=Q(e.symbol),E=e.display_name??"",g=e.symbol.toLowerCase(),u=C.toLowerCase(),m=b.toLowerCase(),R=E.toLowerCase(),p=e.relative_path.toLowerCase(),K=/[/:.]/.test(t),M=I(t),_=M?.leaf.toLowerCase(),s=0;return(k===o||k===r)&&(s+=1150),(C===o||C===r)&&(s+=1100),E===a&&(s+=1180),b===a&&(s+=1160),(`${b}()`===o||`${b}()`===r)&&(s+=955),(g===c||g===l)&&(s+=1e3),(u===c||u===l)&&(s+=950),(p===c||p===l)&&(s+=925),(p.endsWith(`/${l}`)||p.endsWith(`/${c}`))&&(s+=875),R===S&&(s+=850),m===S&&(s+=825),(`${m}()`===c||`${m}()`===l)&&(s+=820),(u.endsWith(`:${l}`)||u.endsWith(`:${S}`)||u.endsWith(`:${S}()`))&&(s+=800),g.includes(l)&&(s+=120),u.includes(l)&&(s+=140),p.includes(l)&&(s+=140),R.includes(l)&&(s+=110),i.every(B=>{let L=B.toLowerCase();return g.includes(L)||u.includes(L)||p.includes(L)||R.includes(L)})&&(s+=100+i.length*15),M&&p.includes(M.path.toLowerCase())&&(s+=360,_&&(m===_||`${m}()`===_||`${m}()`==`${_}()`)&&(s+=700),v(e.symbol)&&(s+=180)),A(e.symbol)&&m===S&&(s+=60),!K&&N(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function I(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let i=n.slice(t+1).replace(/\(\)$/,"");return!i||i.includes(".")?null:{path:n.slice(0,t),leaf:i}}function x(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function U(e){let n=x(e),t=n.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return t.length>0?[...new Set(t)]:[n]}function V(e,n,t){let i=n.trim(),o=e.filter(r=>{let a=$(r.symbol),c=(r.display_name??"").trim();return r.symbol===i||a===i||a===t||c===i||c===t||`${c}()`===i||h(r,t)>1||r.relative_path===i});return o.length===0?null:(o.sort((r,a)=>h(a,t)-h(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),o[0]??null)}function h(e,n){let t=I(n);if(!t)return 0;let i=e.relative_path.toLowerCase(),o=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return i.includes(r)?o!==a?1:v(e.symbol)?D(e.symbol)===null?5:4:D(e.symbol)===null?3:2:0}export{re as a,Z as b,ae as c};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-4MHT7LKP.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as L}from"./chunk-SJR4SB7B.js";import{a as d}from"./chunk-B32FX5KB.js";import{a as B}from"./chunk-6IGXZZQ4.js";import{a as G}from"./chunk-AQYBOORI.js";import{a as I}from"./chunk-WN5Z3UVT.js";import{a as F}from"./chunk-BUAC4Q4G.js";import{a as v}from"./chunk-VDY4HYNK.js";import{a as E}from"./chunk-MCW36F2D.js";import{a as _}from"./chunk-6VL4AIEO.js";import{a as A,b as x}from"./chunk-OAI5GEIN.js";import{b as R}from"./chunk-SYKCO25G.js";import{c as N}from"./chunk-HXXRN77A.js";import{a as w}from"./chunk-NGI4V4AB.js";import{b as $}from"./chunk-6QVCPUK6.js";import{a as S}from"./chunk-JODYQDE4.js";import{f as D}from"./chunk-R3G6ERW7.js";import{a as C}from"./chunk-4HTJZC6G.js";import{a as k}from"./chunk-IW7ASGVF.js";import{e as g,f as y}from"./chunk-QYKKTYBN.js";import{existsSync as H}from"fs";import{existsSync as M,readFileSync as O,writeFileSync as U}from"fs";import{isAbsolute as q,join as K}from"path";var Y=75e3,z=5e3,J=2500;function V(e){let i=G(e);return i.symbols>=Y||i.documents>=z?J:void 0}var W=".scipquery-baseline.json";function b(e,i){return i&&q(i)?i:K(e.config.projectRoot,i??W)}function P(e,i={}){let{scope:t}=i,o=V(e),s=[],a=$(e,{scope:t,...d.dead,scanLimit:o});for(let n of a.symbols)g(e,n.relativePath)||y(e,n.symbol,n.relativePath)||n.kind==="dead-code"&&s.push(`dead:${n.relativePath}:${n.shortName}`);for(let n of F(e,{scope:t,...d.isolated,scanLimit:o}))g(e,n.relativePath)||y(e,n.symbol,n.relativePath)||s.push(`isolated:${n.relativePath}:${n.shortName}`);for(let n of C(e,{scope:t}))n.kind==="real"&&s.push(`cycle:${Q(n.path)}`);for(let n of x(e,{scope:t,...d.similar,scanLimit:o}))s.push(`similar:${[n.symbolA,n.symbolB].sort().join("|")}`);for(let n of E(e,{scope:t,...d.extract,scanLimit:o}))s.push(`extract:${n.relativePath}:${n.shortName}`);for(let n of I(e,{scope:t,...d.wrappers,scanLimit:o}))s.push(`wrapper:${n.file}:${n.shortName}`);for(let n of v(e,{scope:t,...d.passthroughs,scanLimit:o}))s.push(`passthrough:${n.file}:${n.shortName}`);for(let n of B(e,{scope:t,...d.stale,scanLimit:o}))s.push(`stale:${n.file}:${n.shortName}`);for(let n of w(e,{scope:t,...d.drift}).results)n.kind!=="pattern-deviation"&&s.push(`drift:${n.kind}:${n.file}:${n.dep}`);return[...new Set(s)].sort()}function Q(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 Se(e,i={}){let t=P(e,{scope:i.scope}),o=b(e,i.path);return U(o,JSON.stringify({version:1,findings:t},null,2)+`
|
|
2
|
+
`),{path:o,findingCount:t.length}}function T(e,i={}){let t=b(e,i.path);if(!M(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let o=JSON.parse(O(t,"utf-8")),s=new Set(o.findings??[]),a=P(e,{scope:i.scope}),n=new Set(a);return{baselinePath:t,baselineCount:s.size,current:a,newFindings:a.filter(r=>!s.has(r)),fixedFindings:[...s].filter(r=>!n.has(r))}}var Be=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function Ge(e,i={}){let t=i.base??"HEAD",{minTogether:o=6,minConfidence:s=.6,maxEchoChecks:a=Number.POSITIVE_INFINITY,maxHelpers:n=Number.POSITIVE_INFINITY,minSimilarity:r=.8}=i,c=new Set(i.skip??[]),h=R(e,{base:t}),l=h.changedFiles,p=new Set(l),f={base:t,changedFiles:l,changedSymbols:h.changedSymbols.length,checksRun:[],skipped:[],findings:[],note:h.summary.note};if(l.length===0)return f;let m=(u,j)=>{if(c.has(u)){f.skipped.push({check:u,reason:"skipped via --skip"});return}j()};return m("echo",()=>X(e,h.changedSymbols,p,a,r,f)),m("incomplete-migration",()=>Z(e,t,n,f)),m("co-change-partner",()=>ee(e,p,o,s,f)),m("doc-reference",()=>ne(e,p,f)),m("unused-params",()=>ie(e,l,f)),m("new-dead",()=>te(e,h.changedSymbols,f)),m("baseline",()=>oe(e,f)),f}function X(e,i,t,o,s,a){a.checksRun.push("echo");for(let n of i.slice(0,o)){let r=A(e,n.symbol,{minSimilarity:s,limit:3});for(let c of r){let h=c.fileA===n.file?c.fileB:c.fileA,l=c.fileA===n.file?c.shortNameB:c.shortNameA;t.has(h)||a.findings.push({check:"echo",message:`${n.shortName} (${n.file}) is ${Math.round(c.similarity*100)}% similar to established ${l} (${h})`,remediation:`Extend or reuse ${l} instead of keeping the re-implementation.`})}}i.length>o&&a.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function Z(e,i,t,o){let s=_(e,{base:i,maxHelpers:t});if(!s.available){o.skipped.push({check:"incomplete-migration",reason:"no git history"});return}o.checksRun.push("incomplete-migration"),s.note&&o.skipped.push({check:"incomplete-migration",reason:s.note});for(let a of s.findings){let n=a.leftovers.map(r=>`${r.shortName} (${r.file}, ${Math.round(r.containment*100)}%)`).join(", ");o.findings.push({check:"incomplete-migration",message:`new helper ${a.helperShortName} (${a.helperFile}) is wired into ${a.migratedFiles.length} file(s), but ${a.leftovers.length} similar un-migrated site(s) remain: ${n}`,remediation:`Migrate the remaining sites to ${a.helperShortName}, or confirm they are intentionally different.`})}}function ee(e,i,t,o,s){let a=D(e,{minTogether:t,minConfidence:0});if(!a){s.skipped.push({check:"co-change-partner",reason:"no git history"});return}s.checksRun.push("co-change-partner");let n=new Set;for(let r of a){let c=i.has(r.fileA),h=i.has(r.fileB);if(c===h)continue;let l=c?r.fileA:r.fileB,p=c?r.fileB:r.fileA,f=c?r.changesA:r.changesB,m=f>0?r.together/f:0;if(m<o||S(p)||S(l)||!H(`${e.config.projectRoot}/${p}`))continue;let u=`${l}|${p}`;n.has(u)||(n.add(u),s.findings.push({check:"co-change-partner",message:`${l} changed, but ${p} did not \u2014 they change together ${r.together}x (${Math.round(m*100)}% of the time)`,remediation:`Update ${p} alongside this change, or confirm the coupling no longer holds.`}))}}function ne(e,i,t){t.checksRun.push("doc-reference");for(let o of N(e,i))i.has(o.doc)||t.findings.push({check:"doc-reference",message:`${o.doc} cites ${o.cited.join(", ")} \u2014 changed in this diff, doc untouched`,remediation:`Re-read ${o.doc} and update its claims, or update its citations.`})}function ie(e,i,t){t.checksRun.push("unused-params");for(let o of L(e,{files:i,limit:50}))t.findings.push({check:"unused-params",message:`${o.shortName} (${o.file}) has trailing unused parameter(s): ${o.unusedTrailing.join(", ")}`,remediation:"Drop the unused trailing parameters and their call-site arguments."})}function te(e,i,t){t.checksRun.push("new-dead");let o=new k(e);for(let s of i)s.fanIn>0||o.fileKind(s.file)!=="test"&&(g(e,s.file)||y(e,s.symbol,s.file)||t.findings.push({check:"new-dead",message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,remediation:"Wire it up, or remove it before it becomes permanent dead code."}))}function oe(e,i){if(!H(b(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=T(e);for(let o of t.newFindings)i.findings.push({check:"baseline",message:`new finding vs committed baseline: ${o}`,remediation:"Fix the finding, or knowingly accept it via health --write-baseline."})}export{P as a,Se as b,T as c,Be as d,Ge as e};
|
|
3
|
+
//# sourceMappingURL=chunk-5OHZEO3U.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{b as P,g as F,h as H,i as G,n as W}from"./chunk-VGBSY6N7.js";import{a as $,b as J,d as j,f as B}from"./chunk-ZF6P2NAT.js";import{a as v}from"./chunk-IVAIPXNO.js";import{d as k,f as O,r as N,s as T,v as x}from"./chunk-O6KCZPJQ.js";import{a as C,c as I,i as M}from"./chunk-OH5HIAID.js";import{a as L,b as _,e as A,f as D}from"./chunk-ISCKLDSS.js";import{c as E,d as w}from"./chunk-VDZL45XI.js";function Me(e,n,o={}){let i=U(e,[n],{additive:o.additive,semantic:o.semantic}),s=o.callableOnly?(i.get(n.symbolId)??[]).filter(r=>O(r.symbol)):i.get(n.symbolId)??[];return typeof o.limit=="number"?s.slice(0,o.limit):s}function Re(e,n,o={}){let i=q(e)?Q(e,n,{semantic:o.semantic!==!1}):z(e).get(n.symbolId)??[];return typeof o.limit=="number"?i.slice(0,o.limit):i}var V=w("caller-rows",{clearGroups:["whole-project"]}),Y=2e4;function q(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>Y}function z(e){return V.get(e,()=>{let n=T(e),o=U(e,n),i=new Map;for(let l of n)i.set(l.symbol,l.symbolId);let s=new Map,r=new Map;for(let l of n){let a=o.get(l.symbolId);if(!(!a||a.length===0))for(let m of a){let t=i.get(m.symbol);if(t===void 0||t===l.symbolId)continue;let c=s.get(t);c||(c=[],s.set(t,c),r.set(t,new Set));let u=`${l.symbol}|${l.relativePath}`;r.get(t).has(u)||(r.get(t).add(u),c.push({symbol:l.symbol,file:l.relativePath,source:"caller-map-inversion"}))}}return s})}function Q(e,n,o){let i=[],s=new Set,r=a=>{if(a.symbol===n.symbol)return;let m=`${a.symbol}|${a.file}`;s.has(m)||(s.add(m),i.push(a))};for(let a of W(e,n))a.file!==n.relativePath&&r({symbol:a.enclosingSymbol??a.file,file:a.file,source:"resolved-reference"});let l=o.semantic?X(e,n):null;if(l)for(let a of j(e,l)){if(a.file===n.relativePath||e.isIgnored(a.file))continue;let m=x(N(e,a.file),a.line);r({symbol:m?.symbol??a.file,file:a.file,source:"semantic-reference"})}return i}function X(e,n){return e.get(`SELECT
|
|
2
|
+
d.id AS documentId,
|
|
3
|
+
gs.id AS symbolId,
|
|
4
|
+
gs.symbol,
|
|
5
|
+
d.relative_path AS relativePath,
|
|
6
|
+
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
7
|
+
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
8
|
+
COALESCE(gs.display_name, '') AS leaf,
|
|
9
|
+
NULL AS parentTypeName,
|
|
10
|
+
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
+
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
12
|
+
gs.kind AS kind,
|
|
13
|
+
gs.documentation AS documentation,
|
|
14
|
+
gs.enclosing_symbol AS enclosingSymbol
|
|
15
|
+
FROM global_symbols gs
|
|
16
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
17
|
+
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
18
|
+
JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
|
|
19
|
+
WHERE gs.id = ?
|
|
20
|
+
LIMIT 1`,n.symbolId)??null}function U(e,n,o={}){if(n.length===0)return new Map;let i=o.additive??!1,s=[],r=[];for(let c of n)I(c.relativePath)&&M(e,c.relativePath)!==null?s.push(c):r.push(c);let l=new Map,a=new Map,m=c=>{for(let[u,g]of c){let b=l.get(u);b||(b=[],l.set(u,b));let y=a.get(u);y||(y=new Set,a.set(u,y));for(let d of g){let f=`${d.symbol}|${d.chunkId}`;y.has(f)||(y.add(f),b.push(d))}}};s.length>0&&m(oe(e,s)),o.semantic!==!1&&m(re(Z(e,n)));let t=i?n:r;return t.length>0&&m(ae(e,t)),l}function Z(e,n){let o=new Map,i=[],s=[];for(let l of n){if(!$(l.relativePath))continue;let a=C(e,l.relativePath);if(!a){s.push(l);continue}let m=_(e,l.relativePath,a),t=te(e,l.relativePath),c=A(e,l.relativePath,l.symbol,m,t);if(c!==null){let u=ee(c);if(u){u.length>0&&o.set(l.symbolId,u);continue}}i.push({def:l,contentHash:m,depsDigest:t})}if(i.length===0&&s.length===0)return o;let r=B(e,[...s,...i.map(l=>l.def)]);for(let[l,a]of r)o.set(l,a);return J(e).availability().available&&D(e,i.map(l=>({relativePath:l.def.relativePath,symbol:l.def.symbol,contentHash:l.contentHash,depsDigest:l.depsDigest,payload:JSON.stringify(r.get(l.def.symbolId)??[])}))),o}function ee(e){try{return JSON.parse(e)}catch{return null}}var ne=E("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function te(e,n){return ne.get(e,n,()=>{let i=[...v(e).get(n)??[]].sort().map(s=>`${s}:${_(e,s,C(e,s))}`);return L(i.join("|"))})}function oe(e,n){let o=new Map,i=le(n,o),s=G(e);for(let[r,l]of i){let a=M(e,r);if(a)for(let m of a){let t=ie(l,m.line);if(!t)continue;let c=se(e,r,s,m.calleeLeaf,m.memberAccess);c&&c.symbol!==t.symbol&&o.get(t.symbolId).push({symbol:c.symbol,file:c.file,chunkId:m.line,source:"ast-callsite"})}}return o}function le(e,n){let o=new Map;for(let i of e){let s=o.get(i.relativePath);s?s.push(i):o.set(i.relativePath,[i]),n.set(i.symbolId,[])}for(let i of o.values())i.sort((s,r)=>s.endLine-s.startLine-(r.endLine-r.startLine));return o}function ie(e,n){return e.find(o=>n>=o.startLine&&n<=o.endLine)??null}function se(e,n,o,i,s){let r=F(n,o.get(i)??[]);return r.length===0?null:H(e,n,r,s)}function ae(e,n){if(n.length===0)return new Map;let o=e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
21
|
+
FROM mentions m
|
|
22
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
23
|
+
WHERE m.role != 1`),i=new Map;for(let t of o)i.has(t.document_id)||i.set(t.document_id,[]),i.get(t.document_id).push(t);let s=new Map(e.all("SELECT id, relative_path FROM documents").map(t=>[t.id,t.relative_path])),r=new Map,l=e.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
24
|
+
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
25
|
+
FROM global_symbols gs
|
|
26
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
27
|
+
LEFT JOIN (
|
|
28
|
+
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
29
|
+
FROM mentions m
|
|
30
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
31
|
+
WHERE m.role = 1
|
|
32
|
+
GROUP BY m.symbol_id
|
|
33
|
+
) def_chunk ON def_chunk.symbol_id = gs.id`);for(let t of l)r.has(t.symbol_id)||r.set(t.symbol_id,{symbol:t.symbol,file:t.document_id!==null?s.get(t.document_id)??"":""});let a=new Map,m=s;for(let t of n){let c=i.get(t.documentId)??[],u=new Set,g=[],b=null,y=()=>{if(b)return b;let d=m.get(t.documentId)??"",f=new Set;if(d){let S=P(e,d),h=Math.max(0,t.startLine),R=Math.min(S.length-1,t.endLine);for(let p=h;p<=R;p+=1)for(let K of S[p])f.add(K)}return b=f,f};for(let d of c){if(d.symbol_id===t.symbolId)continue;let f=r.get(d.symbol_id);if(!f)continue;if(!(d.start_line>=t.startLine&&d.end_line<=t.endLine)){if(!(d.start_line<=t.endLine&&d.end_line>=t.startLine))continue;let p=k(f.symbol);if(!p||!y().has(p))continue}let h=`${f.symbol}|${d.chunk_id}`;u.has(h)||(u.add(h),g.push({...f,chunkId:d.chunk_id,source:"scip-chunk"}))}a.set(t.symbolId,g)}return a}function re(e){let n=new Map;for(let[o,i]of e){let s=[];for(let r of i)s.push({symbol:r.symbol,file:r.file,chunkId:-1,source:"semantic-callee"});n.set(o,s)}return n}export{Me as a,Re as b,U as c};
|
|
34
|
+
//# sourceMappingURL=chunk-5QJIEYFB.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-ZOT3WUZW.js";import{a as h}from"./chunk-4MHT7LKP.js";import{c as p}from"./chunk-O6KCZPJQ.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let l=h(t,e);return l?R(t,l,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),l;try{l=f(r,"utf-8")}catch{return null}let n=l.split(`
|
|
2
2
|
`),c=Math.max(0,e.startLine-a),i=Math.min(n.length-1,e.endLine+a),u=n.slice(c,i+1).join(`
|
|
3
3
|
`);return{symbol:e.symbol,shortName:p(e.symbol),relativePath:e.relativePath,startLine:c,endLine:i,language:s?.language??v(e.relativePath),source:u}}function j(t,e,a,s,r){let l=m(t,e);if(!l)return null;let n=t.get("SELECT relative_path, language FROM documents WHERE relative_path = ?",l);if(!n)return null;let c=d(t.config.projectRoot,n.relative_path),i;try{i=f(c,"utf-8")}catch{return null}let u=i.split(`
|
|
4
4
|
`),o=Math.max(0,a-1-r),g=Math.min(u.length-1,s-1+r),b=u.slice(o,g+1).join(`
|
|
5
5
|
`);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:o,endLine:g,language:n.language??v(n.relative_path),source:b}}function v(t){switch(y(t).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{M as a};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-6DEX3XP6.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h,b as F,c as w}from"./chunk-
|
|
1
|
+
import{a as h,b as F,c as w}from"./chunk-WJIS6BNI.js";import{a as M}from"./chunk-V76FCF5F.js";import{a as b}from"./chunk-MX6F756F.js";import{a as P}from"./chunk-IW7ASGVF.js";import{a as S,f as D}from"./chunk-QYKKTYBN.js";import{a as L,c as v,d as p}from"./chunk-O6KCZPJQ.js";import{a as y,j as I}from"./chunk-OH5HIAID.js";function ie(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:a}=e??{},f=e?.semantic!==!1,o=new P(t),d=o.scopedDefinitions(n),g=V(o,n),x={high:0,medium:1,low:2};return M({candidates:()=>$(t,o,d,{minLoc:i,maxLoc:s}),orderCandidates:(c,u)=>b(u)-b(c)||c.relativePath.localeCompare(u.relativePath),scanLimit:a,prepare:c=>({consumerFileMap:A(o,c,{semantic:f}),singletonBackedClassIds:O(t,o,d,c,{semantic:f}),candidateIndex:B(c)}),evaluate:(c,u)=>{if(u.singletonBackedClassIds.has(c.symbolId))return null;let m=N(t,c,u.consumerFileMap,u.candidateIndex);if(m.transitivelyReachable||m.realConsumers.length>1||m.realConsumers.length===0&&m.barrelConsumers>0||!Z(m.definition,m.realConsumers.length,g))return null;let C=j(t,m);return!l&&C.confidence==="low"?null:C},orderResults:(c,u)=>x[c.confidence]-x[u.confidence]||u.loc-c.loc||c.file.localeCompare(u.file)||c.startLine-u.startLine,limit:r})}function $(t,e,n,i){return n.filter(s=>s.isTypeLike&&b(s)>=i.minLoc).filter(s=>b(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>S(s.relativePath)!=="test").filter(s=>!D(t,s.symbol,s.relativePath)).filter(s=>!H(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function A(t,e,n){return h(t,e,{semantic:n.semantic})}function B(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=p(n.symbol);s&&i.set(s,n)}return e}function N(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(d=>d!==e.relativePath&&!t.isIgnored(d)),{realConsumers:l,barrelConsumers:a,importOnlyConsumers:f}=F(t,e,r),o=_(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:a+f,transitivelyReachable:o}}function j(t,e){let n=k(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:q(t,e.definition),{confidence:s,reason:r}=G(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:v(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:b(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r}}function O(t,e,n,i,s){let r=W(t,U(n),i),l=r.map(o=>o.singleton);if(r.length===0)return new Set;let a=h(e,l,{semantic:s.semantic}),f=new Set;for(let{singleton:o,classId:d}of r)E(t,o,a)&&f.add(d);return f}function U(t){let e=new Map;for(let n of t){let i=p(n.symbol);i&&e.set(R(n.relativePath,i),n)}return e}function W(t,e,n){let i=[];for(let s of n){let r=z(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function z(t,e,n){if(k(t,n.relativePath,n.startLine)!=="class")return null;let i=p(n.symbol);if(!i)return null;let s=K(t,n.relativePath,i);return s?e.get(R(n.relativePath,s))??null:null}function E(t,e,n){let i=p(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!w(t,r,i))}function R(t,e){return`${t}\0${e}`}function K(t,e,n){let i=y(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function V(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function H(t){let e=L(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function Z(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function _(t,e,n,i){let s=I(t,e.relativePath),r=p(e.symbol);if(!r)return!1;let l=s.get(r);if(!l||l.size===0)return!1;let a=i.get(e.relativePath);if(!a)return!1;for(let f of l){let o=a.get(f);if(!o)continue;let d=n.get(o.symbolId);if(d){for(let g of d)if(g!==e.relativePath&&!t.isIgnored(g))return!0}}return!1}function k(t,e,n){let i=y(t,e);if(!i)return"other";let s=i.split(`
|
|
2
2
|
`),r=Math.max(0,n-2),l=Math.min(s.length-1,n+2);for(let a=r;a<=l;a++){let o=(s[a]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(o))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(o))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(o))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(o))return"enum"}return"other"}function q(t,e){let n=y(t,e.relativePath);if(!n)return!1;let i=p(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),l=n.split(`
|
|
3
3
|
`);for(let a=0;a<l.length;a++)if(!(a>=e.startLine&&a<=e.endLine)&&r.test(l[a]??""))return!0;return!1}function G(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{ie as a};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-6IGXZZQ4.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _}from"./chunk-
|
|
1
|
+
import{a as _}from"./chunk-IW7ASGVF.js";import{c as u}from"./chunk-QYKKTYBN.js";import{b as l,c as d}from"./chunk-FVVT7GV6.js";import{c as a,e as m}from"./chunk-O6KCZPJQ.js";import{a as s}from"./chunk-NN3O7TPH.js";function A(e,o={}){let{scope:n,limit:r}=o,t=new _(e),i=h([...b(e,n),...g(e,t,n)]);return y(i),r?i.slice(0,r):i}function b(e,o){let n=[];for(let r of f(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||u(e,r.barrel_path))continue;let t=R(e,r),i=t?.barrel_consumers??0,c=t?.direct_consumers??0;i!==0||c!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:a(r.symbol),originalFile:r.original_path,barrelConsumers:i,directConsumers:c})}return n}function f(e,o){let n=o?`AND barrel_d.relative_path LIKE '%${o}%'`:"";return e.all(`SELECT DISTINCT
|
|
2
2
|
barrel_d.id AS barrel_doc_id,
|
|
3
3
|
barrel_d.relative_path AS barrel_path,
|
|
4
4
|
gs.id AS symbol_id,
|
|
@@ -58,4 +58,4 @@ import{a as _}from"./chunk-NO2TPMCQ.js";import{c as u}from"./chunk-TQTVM27C.js";
|
|
|
58
58
|
${e.pathExclusionsFor("consumer_d")}
|
|
59
59
|
GROUP BY consumer_d.id
|
|
60
60
|
)`,o.barrel_doc_id,o.symbol_id,o.barrel_doc_id,o.original_doc_id)}function g(e,o,n){let r=[];for(let t of E(e,n))p(e,t,t)>0||r.push(...S(e,o,t));return r}function E(e,o){return s(e,{scope:o,includeIgnored:!1}).filter(n=>d(e,n).length>0)}function S(e,o,n){return d(e,n).filter(r=>r.sourcePath&&!e.isIgnored(r.sourcePath)).flatMap(r=>x(e,o,n,r.sourcePath))}function x(e,o,n,r){let t=N(o,r);return t?[{barrelFile:n,symbol:t.symbol,shortName:a(t.symbol),originalFile:r,barrelConsumers:0,directConsumers:p(e,r,n)}]:[]}function p(e,o,n){let r=new Set;for(let t of s(e,{includeIgnored:!1}))if(t!==n)for(let i of l(e,t))i.sourcePath===o&&r.add(t);return r.size}function N(e,o){let n=e.definitionsForFile(o);return n.find(r=>m(r.symbol)==="method")??n[0]??null}function h(e){let o=new Set,n=[];for(let r of e){let t=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;o.has(t)||(o.add(t),n.push(r))}return n}function y(e){e.sort((o,n)=>n.directConsumers-o.directConsumers||o.barrelFile.localeCompare(n.barrelFile)||o.shortName.localeCompare(n.shortName))}export{A as a};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-6K2JQ2VI.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as G}from"./chunk-MX6F756F.js";import{a as E}from"./chunk-NO2TPMCQ.js";import{a as F,d as N,e as k,f as T}from"./chunk-TQTVM27C.js";import{a as z}from"./chunk-EAU4RDFG.js";import{c as H,d as U,f as v,j as q}from"./chunk-6ZFKI5EP.js";import{b as I}from"./chunk-APLCSDXL.js";import{c as M,f as A,g as j,h as O,i as B,j as W,r as V,x}from"./chunk-SOGLYIJ4.js";import{c as P,e as _}from"./chunk-WQFOZIID.js";import{a as h}from"./chunk-NN3O7TPH.js";import{b as S}from"./chunk-VDZL45XI.js";var g=new WeakMap;function J(e,n){let t=P(n);return t==="rust"?pe(e,n):t==="typescript"||t==="tsx"||t==="javascript"?de(e,n):[]}var ue=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function de(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(n)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(n),o=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(n),s=!1,c=t.rootNode;for(let u of c.namedChildren){if(u.type!=="expression_statement")continue;let a=u.namedChild(0);if(!a||a.type!=="call_expression")continue;let d=a.namedChild(0);if(!d)continue;let f=d.type==="member_expression"?d.namedChild(d.namedChildCount-1)?.text:d.text;if(f&&ue.has(f)){s=!0;break}}let l=[];s&&l.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(r||o)&&l.push({startLine:0,endLine:c.endPosition.row,reason:r?"Next.js / Remix route file":"Vite/Vue route component"});for(let u of c.namedChildren){let a=null,d=null;if(u.type==="function_declaration")a=u.namedChild(0)?.text??null,d=u;else if(u.type==="export_statement"){let f=u.namedChild(0);f?.type==="function_declaration"&&(a=f.namedChild(0)?.text??null,d=f)}else if(u.type==="lexical_declaration"){let f=u.namedChild(0);if(f?.type==="variable_declarator"){let b=f.namedChild(0)?.text,y=f.namedChild(1);b&&(y?.type==="arrow_function"||y?.type==="function_expression")&&(a=b,d=f)}}a&&/^use[A-Z]/.test(a)&&d&&l.push({startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"React custom hook (use*)"})}return l.push(...K(t,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),g.set(t,l),l}var fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function me(e){return fe.test(e)}function K(e,n,t){let i=[],r=o=>{if(n.has(o.type)&&o.parent){let c=o.parent.children,l=-1;for(let u=0;u<c.length;u+=1)if(c[u].startIndex===o.startIndex&&c[u].type===o.type){l=u;break}if(l>0)for(let u=l-1;u>=0;u-=1){let a=c[u];if(t.has(a.type)){if(me(a.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(a.type==="attribute_item"||a.type==="inner_attribute_item"))break}}for(let s of o.namedChildren)r(s)};return r(e.rootNode),i}function pe(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=[],o=be(t);return o?(g.set(t,o),o):(X(t.rootNode,r,!1,!1),r.push(...K(t,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...ve(t.rootNode)),g.set(t,r),r)}function be(e){return Ee(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function X(e,n,t,i){let r=t,o=i;e.type==="trait_item"&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?ye(e,n,t,i):i&&_e(e)?n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?ge(e,n,t):e.type==="mod_item"&&C(e).some(s=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(s))&&(r=!0);for(let s of e.namedChildren)X(s,n,r,o)}function ye(e,n,t,i){let r=C(e),o=null;i?o="trait impl method (dynamic dispatch)":t&&(o="inside #[cfg(test)] mod");for(let s of r){let c=xe(s);if(c){o=c;break}if(Z(s)){o="#[allow(dead_code)]";break}}o&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o})}function ge(e,n,t){let i=C(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some(Se)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:r}),i.some(Z)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:r}),t&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:r})}function C(e){let n=e.parent;if(!n)return[];let t=n.children,i=-1;for(let o=0;o<t.length;o+=1)if(t[o].startIndex===e.startIndex&&t[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let s=t[o];if(s.type==="attribute_item"||s.type==="inner_attribute_item")r.push(s.text);else{if(s.type==="line_comment"||s.type==="block_comment")continue;break}}return r}var he=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function xe(e){return he.find(({re:n})=>n.test(e))?.reason??null}var Re=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Se(e){return/#\[\s*derive\s*\(/.test(e)?Re.some(n=>n.test(e)):!1}function Z(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function _e(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function ve(e){let n=De(e);if(n.size===0)return[];let t=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&n.has(r)&&t.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:r})}return t}function Ee(e){for(let n=0;n<Math.min(e.namedChildCount,12);n+=1){let t=e.namedChild(n);if(!t||t.type!=="line_comment"&&t.type!=="block_comment")break;if(/@generated\b/.test(t.text)||/This file is .*generated\b/i.test(t.text)||/Code generated by/i.test(t.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(t.text)||/openapi-generator/i.test(t.text)&&/Generated by/i.test(t.text))return!0}return!1}var Ce=/^#!?\[\s*serde\s*\(/,$=/\bwith\s*=\s*"([^"]+)"/g;function De(e){let n=new Set;for(let t of e.descendantsOfType("attribute_item")){if(!Ce.test(t.text))continue;$.lastIndex=0;let i;for(;(i=$.exec(t.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&n.add(o)}}return n}function Q(e){let n=new Map,t=i=>{let r=n.get(i);if(r)return r;let o=J(e,i);return r={ranges:o.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(o.map(s=>s.containerName).filter(s=>!!s))},n.set(i,r),r};return(i,r,o,s)=>{let c=t(i);for(let l of c.ranges)if(r>=l.startLine&&r<=l.endLine)return!0;if(s&&c.containers.has(s))return!0;for(let l of x(o))if(c.containers.has(l))return!0;return!1}}function ze(e,n={}){S(e,{groups:n.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,n,t={}){S(e,{groups:t.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:n.replace(/\\/g,"/")})}function ee(e,n){return n.isIgnoredPath(e.relativePath)?m("ignored-file"):O(e.symbol)?m("module-like-symbol"):Y(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&Y(e.enclosingSymbol)?m("nested-non-callable-value"):!n.includeTests&&!w(e.relativePath)?m("test-file"):!n.includeTests&&n.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?m("excluded-file-region"):B(e.symbol)?m("rust-trait-impl-member"):W(e.symbol)?m("rust-test-module"):!n.includeMembers&&!we(e)?m("member"):e.endLine-e.startLine+1<n.minLoc?m("below-min-loc"):{accepted:!0}:m("non-value-symbol")}function w(e){return F(e)!=="test"}function m(e){return{accepted:!1,rejectionReason:e}}function Y(e){return j(e)||e.endsWith("().")||e.endsWith(".")}function we(e){return A(e.symbol)||x(e.symbol).length===0}function te(){return new Map}function ne(e,n,t){let i=new Map;for(let r of H(e,t))e.isIgnored(r.relative_path)||n.has(r.relative_path)||R(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function re(e,n,t){let i=new Set;for(let r of U(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||i.add(r.symbol_id);return i}function L(e,n){let t=e.get(n);if(!t)return!1;for(let i of t.values())if(i.occurrences>0)return!0;return!1}function ie(e){return e?.occurrences??0}function R(e,n,t,i,r="source-fallback"){if(i<=0)return;let o=se(e,n,t);o.occurrences+=i,o.sources.add(r)}function oe(e,n,t,i,r){if(i<=0)return;let o=se(e,n,t);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function se(e,n,t){let i=e.get(n);i||(i=new Map,e.set(n,i));let r=i.get(t);return r||(r={occurrences:0,sources:new Set},i.set(t,r)),r}function mt(e,n={}){let{scope:t,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:s=!1,deadCodeOnly:c=!1,scanLimit:l,semantic:u=!0}=n,a=G(Le(e,{scope:t,minLoc:i,includeTests:r,includeMembers:s}),l),d=o?new Set(N(e)):new Set,f=c?te():ne(e,d,a.map(p=>p.symbolId)),b=c?re(e,a.map(p=>p.symbolId),d):new Set,y=c?a.filter(p=>!b.has(p.symbolId)):a;c?ke(e,y,f,d):Ne(e,y,f,d);let ce=c?y.filter(p=>!L(f,p.symbolId)):a;Oe(e,ce,f,{includeTests:r,inactiveBarrelPaths:d,includeSemantic:!c&&u});let le=c?y.filter(p=>!L(f,p.symbolId)):a;return Fe(e,Pe(le,f))}function Le(e,n){let t=Q(e),i=[];for(let r of h(e,{scope:n.scope}))try{for(let o of V(e,r))ee(o,{minLoc:n.minLoc,includeTests:n.includeTests,includeMembers:n.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:t}).accepted&&i.push(o)}finally{D(e,r,{definitions:!0})}return i}function Pe(e,n){return e.map(t=>Ie(t,n)).filter(t=>t.cross_file_refs===0).sort((t,i)=>i.loc-t.loc||t.relative_path.localeCompare(i.relative_path)||t.start_line-i.start_line)}function Ie(e,n){let t=n.get(e.symbolId)??new Map,i=ie(t.get(e.relativePath)),r=0;for(let[o,s]of t)o!==e.relativePath&&(r+=s.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:i,cross_file_refs:r}}function Fe(e,n){let t=[],i=0,r=0,o=0;for(let s of n){if(e.isIgnored(s.relative_path)||k(e,s.relative_path)||T(e,s.symbol,s.relative_path))continue;let c=s.same_file_refs===0?"dead-code":"file-internal";c==="dead-code"?i++:r++,o+=s.loc,t.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:M(s.symbol),sameFileRefs:s.same_file_refs,kind:c})}return{symbols:t,totalCount:t.length,deadCodeCount:i,fileInternalCount:r,totalLoc:o}}function Ne(e,n,t,i){if(n.length===0)return;let r=new E(e),o=new Set(n.map(l=>l.symbolId)),s=new Set(n.map(l=>l.leaf).filter(Boolean)),c=new Set(r.sourceFiles());for(let l of h(e))c.add(l);r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:s,skipPath:l=>i.has(l)},l=>{o.has(l.target.symbolId)&&(Ae(e,l)||R(t,l.target.symbolId,l.sourceFile,je(l),"source-fallback"))})}function ke(e,n,t,i){if(n.length===0)return;let r=new E(e),o=Te(n),s=new Set(r.sourceFiles());for(let a of h(e))s.add(a);let c=new Set(o.keys()),l=new Map,u=a=>{let d=l.get(a);return d||(d=q(e,a),l.set(a,d)),d};r.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:a=>i.has(a),resolveTargets:({sourceFile:a,name:d,kind:f})=>{let b=o.get(d);return b?Me(a,d,b,u(a),{permissive:f!=="cross-language-dispatch"}):[]},afterPath:a=>{l.delete(a),D(e,a)}},a=>{let d=a.kind==="identifier"&&a.sourceFile===a.target.relativePath?Math.max(0,a.occurrences-1):a.occurrences;a.kind==="identifier"&&ae(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(t,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function Te(e){let n=new Map;for(let t of e){if(!t.leaf)continue;let i=n.get(t.leaf)??[];i.push(t),n.set(t.leaf,i)}return n}function Me(e,n,t,i,r){let o=t.filter(l=>l.relativePath===e);if(o.length>0)return o;if(!r.permissive&&t.length===1)return[...t];let s=i.get(n);if(s)for(let l of s){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0)return u}let c=new Set;for(let l of i.values())for(let u of l)c.add(u);for(let l of c){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0&&u.length===t.length)return u}return r.permissive?[...t]:[]}function Ae(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&ae(e,n)}function je(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ae(e,n){return n.occurrences>1?!1:I(e,n.sourceFile).some(t=>t.used||t.sourcePath!==n.target.relativePath?!1:t.importedName===n.name||t.localName===n.name)}function Oe(e,n,t,i){for(let r of n){let o=z(e,r,{semantic:i.includeSemantic!==!1});if(o.length!==0)for(let s of o){let c=s.file;c===r.relativePath||e.isIgnored(c)||i.inactiveBarrelPaths.has(c)||!i.includeTests&&!w(c)||oe(t,r.symbolId,c,1,"caller-map")}}}export{ze as a,mt as b};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as G}from"./chunk-MX6F756F.js";import{a as E}from"./chunk-IW7ASGVF.js";import{a as F,d as N,e as k,f as T}from"./chunk-QYKKTYBN.js";import{a as z}from"./chunk-VDZIEDJB.js";import{c as H,d as U,f as v,j as q}from"./chunk-VGBSY6N7.js";import{b as I}from"./chunk-FVVT7GV6.js";import{c as M,f as A,g as j,h as O,i as B,j as W,r as V,x}from"./chunk-O6KCZPJQ.js";import{c as P,e as _}from"./chunk-OH5HIAID.js";import{a as h}from"./chunk-NN3O7TPH.js";import{b as S}from"./chunk-VDZL45XI.js";var g=new WeakMap;function J(e,n){let t=P(n);return t==="rust"?pe(e,n):t==="typescript"||t==="tsx"||t==="javascript"?de(e,n):[]}var ue=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function de(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(n)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(n),o=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(n),s=!1,c=t.rootNode;for(let u of c.namedChildren){if(u.type!=="expression_statement")continue;let a=u.namedChild(0);if(!a||a.type!=="call_expression")continue;let d=a.namedChild(0);if(!d)continue;let f=d.type==="member_expression"?d.namedChild(d.namedChildCount-1)?.text:d.text;if(f&&ue.has(f)){s=!0;break}}let l=[];s&&l.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(r||o)&&l.push({startLine:0,endLine:c.endPosition.row,reason:r?"Next.js / Remix route file":"Vite/Vue route component"});for(let u of c.namedChildren){let a=null,d=null;if(u.type==="function_declaration")a=u.namedChild(0)?.text??null,d=u;else if(u.type==="export_statement"){let f=u.namedChild(0);f?.type==="function_declaration"&&(a=f.namedChild(0)?.text??null,d=f)}else if(u.type==="lexical_declaration"){let f=u.namedChild(0);if(f?.type==="variable_declarator"){let b=f.namedChild(0)?.text,y=f.namedChild(1);b&&(y?.type==="arrow_function"||y?.type==="function_expression")&&(a=b,d=f)}}a&&/^use[A-Z]/.test(a)&&d&&l.push({startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"React custom hook (use*)"})}return l.push(...K(t,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),g.set(t,l),l}var fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function me(e){return fe.test(e)}function K(e,n,t){let i=[],r=o=>{if(n.has(o.type)&&o.parent){let c=o.parent.children,l=-1;for(let u=0;u<c.length;u+=1)if(c[u].startIndex===o.startIndex&&c[u].type===o.type){l=u;break}if(l>0)for(let u=l-1;u>=0;u-=1){let a=c[u];if(t.has(a.type)){if(me(a.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(a.type==="attribute_item"||a.type==="inner_attribute_item"))break}}for(let s of o.namedChildren)r(s)};return r(e.rootNode),i}function pe(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=[],o=be(t);return o?(g.set(t,o),o):(X(t.rootNode,r,!1,!1),r.push(...K(t,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...ve(t.rootNode)),g.set(t,r),r)}function be(e){return Ee(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function X(e,n,t,i){let r=t,o=i;e.type==="trait_item"&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?ye(e,n,t,i):i&&_e(e)?n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?ge(e,n,t):e.type==="mod_item"&&C(e).some(s=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(s))&&(r=!0);for(let s of e.namedChildren)X(s,n,r,o)}function ye(e,n,t,i){let r=C(e),o=null;i?o="trait impl method (dynamic dispatch)":t&&(o="inside #[cfg(test)] mod");for(let s of r){let c=xe(s);if(c){o=c;break}if(Z(s)){o="#[allow(dead_code)]";break}}o&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o})}function ge(e,n,t){let i=C(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some(Se)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:r}),i.some(Z)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:r}),t&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:r})}function C(e){let n=e.parent;if(!n)return[];let t=n.children,i=-1;for(let o=0;o<t.length;o+=1)if(t[o].startIndex===e.startIndex&&t[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let s=t[o];if(s.type==="attribute_item"||s.type==="inner_attribute_item")r.push(s.text);else{if(s.type==="line_comment"||s.type==="block_comment")continue;break}}return r}var he=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function xe(e){return he.find(({re:n})=>n.test(e))?.reason??null}var Re=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Se(e){return/#\[\s*derive\s*\(/.test(e)?Re.some(n=>n.test(e)):!1}function Z(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function _e(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function ve(e){let n=De(e);if(n.size===0)return[];let t=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&n.has(r)&&t.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:r})}return t}function Ee(e){for(let n=0;n<Math.min(e.namedChildCount,12);n+=1){let t=e.namedChild(n);if(!t||t.type!=="line_comment"&&t.type!=="block_comment")break;if(/@generated\b/.test(t.text)||/This file is .*generated\b/i.test(t.text)||/Code generated by/i.test(t.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(t.text)||/openapi-generator/i.test(t.text)&&/Generated by/i.test(t.text))return!0}return!1}var Ce=/^#!?\[\s*serde\s*\(/,$=/\bwith\s*=\s*"([^"]+)"/g;function De(e){let n=new Set;for(let t of e.descendantsOfType("attribute_item")){if(!Ce.test(t.text))continue;$.lastIndex=0;let i;for(;(i=$.exec(t.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&n.add(o)}}return n}function Q(e){let n=new Map,t=i=>{let r=n.get(i);if(r)return r;let o=J(e,i);return r={ranges:o.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(o.map(s=>s.containerName).filter(s=>!!s))},n.set(i,r),r};return(i,r,o,s)=>{let c=t(i);for(let l of c.ranges)if(r>=l.startLine&&r<=l.endLine)return!0;if(s&&c.containers.has(s))return!0;for(let l of x(o))if(c.containers.has(l))return!0;return!1}}function ze(e,n={}){S(e,{groups:n.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,n,t={}){S(e,{groups:t.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:n.replace(/\\/g,"/")})}function ee(e,n){return n.isIgnoredPath(e.relativePath)?m("ignored-file"):O(e.symbol)?m("module-like-symbol"):Y(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&Y(e.enclosingSymbol)?m("nested-non-callable-value"):!n.includeTests&&!w(e.relativePath)?m("test-file"):!n.includeTests&&n.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?m("excluded-file-region"):B(e.symbol)?m("rust-trait-impl-member"):W(e.symbol)?m("rust-test-module"):!n.includeMembers&&!we(e)?m("member"):e.endLine-e.startLine+1<n.minLoc?m("below-min-loc"):{accepted:!0}:m("non-value-symbol")}function w(e){return F(e)!=="test"}function m(e){return{accepted:!1,rejectionReason:e}}function Y(e){return j(e)||e.endsWith("().")||e.endsWith(".")}function we(e){return A(e.symbol)||x(e.symbol).length===0}function te(){return new Map}function ne(e,n,t){let i=new Map;for(let r of H(e,t))e.isIgnored(r.relative_path)||n.has(r.relative_path)||R(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function re(e,n,t){let i=new Set;for(let r of U(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||i.add(r.symbol_id);return i}function L(e,n){let t=e.get(n);if(!t)return!1;for(let i of t.values())if(i.occurrences>0)return!0;return!1}function ie(e){return e?.occurrences??0}function R(e,n,t,i,r="source-fallback"){if(i<=0)return;let o=se(e,n,t);o.occurrences+=i,o.sources.add(r)}function oe(e,n,t,i,r){if(i<=0)return;let o=se(e,n,t);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function se(e,n,t){let i=e.get(n);i||(i=new Map,e.set(n,i));let r=i.get(t);return r||(r={occurrences:0,sources:new Set},i.set(t,r)),r}function mt(e,n={}){let{scope:t,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:s=!1,deadCodeOnly:c=!1,scanLimit:l,semantic:u=!0}=n,a=G(Le(e,{scope:t,minLoc:i,includeTests:r,includeMembers:s}),l),d=o?new Set(N(e)):new Set,f=c?te():ne(e,d,a.map(p=>p.symbolId)),b=c?re(e,a.map(p=>p.symbolId),d):new Set,y=c?a.filter(p=>!b.has(p.symbolId)):a;c?ke(e,y,f,d):Ne(e,y,f,d);let ce=c?y.filter(p=>!L(f,p.symbolId)):a;Oe(e,ce,f,{includeTests:r,inactiveBarrelPaths:d,includeSemantic:!c&&u});let le=c?y.filter(p=>!L(f,p.symbolId)):a;return Fe(e,Pe(le,f))}function Le(e,n){let t=Q(e),i=[];for(let r of h(e,{scope:n.scope}))try{for(let o of V(e,r))ee(o,{minLoc:n.minLoc,includeTests:n.includeTests,includeMembers:n.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:t}).accepted&&i.push(o)}finally{D(e,r,{definitions:!0})}return i}function Pe(e,n){return e.map(t=>Ie(t,n)).filter(t=>t.cross_file_refs===0).sort((t,i)=>i.loc-t.loc||t.relative_path.localeCompare(i.relative_path)||t.start_line-i.start_line)}function Ie(e,n){let t=n.get(e.symbolId)??new Map,i=ie(t.get(e.relativePath)),r=0;for(let[o,s]of t)o!==e.relativePath&&(r+=s.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:i,cross_file_refs:r}}function Fe(e,n){let t=[],i=0,r=0,o=0;for(let s of n){if(e.isIgnored(s.relative_path)||k(e,s.relative_path)||T(e,s.symbol,s.relative_path))continue;let c=s.same_file_refs===0?"dead-code":"file-internal";c==="dead-code"?i++:r++,o+=s.loc,t.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:M(s.symbol),sameFileRefs:s.same_file_refs,kind:c})}return{symbols:t,totalCount:t.length,deadCodeCount:i,fileInternalCount:r,totalLoc:o}}function Ne(e,n,t,i){if(n.length===0)return;let r=new E(e),o=new Set(n.map(l=>l.symbolId)),s=new Set(n.map(l=>l.leaf).filter(Boolean)),c=new Set(r.sourceFiles());for(let l of h(e))c.add(l);r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:s,skipPath:l=>i.has(l)},l=>{o.has(l.target.symbolId)&&(Ae(e,l)||R(t,l.target.symbolId,l.sourceFile,je(l),"source-fallback"))})}function ke(e,n,t,i){if(n.length===0)return;let r=new E(e),o=Te(n),s=new Set(r.sourceFiles());for(let a of h(e))s.add(a);let c=new Set(o.keys()),l=new Map,u=a=>{let d=l.get(a);return d||(d=q(e,a),l.set(a,d)),d};r.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:a=>i.has(a),resolveTargets:({sourceFile:a,name:d,kind:f})=>{let b=o.get(d);return b?Me(a,d,b,u(a),{permissive:f!=="cross-language-dispatch"}):[]},afterPath:a=>{l.delete(a),D(e,a)}},a=>{let d=a.kind==="identifier"&&a.sourceFile===a.target.relativePath?Math.max(0,a.occurrences-1):a.occurrences;a.kind==="identifier"&&ae(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(t,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function Te(e){let n=new Map;for(let t of e){if(!t.leaf)continue;let i=n.get(t.leaf)??[];i.push(t),n.set(t.leaf,i)}return n}function Me(e,n,t,i,r){let o=t.filter(l=>l.relativePath===e);if(o.length>0)return o;if(!r.permissive&&t.length===1)return[...t];let s=i.get(n);if(s)for(let l of s){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0)return u}let c=new Set;for(let l of i.values())for(let u of l)c.add(u);for(let l of c){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0&&u.length===t.length)return u}return r.permissive?[...t]:[]}function Ae(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&ae(e,n)}function je(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ae(e,n){return n.occurrences>1?!1:I(e,n.sourceFile).some(t=>t.used||t.sourcePath!==n.target.relativePath?!1:t.importedName===n.name||t.localName===n.name)}function Oe(e,n,t,i){for(let r of n){let o=z(e,r,{semantic:i.includeSemantic!==!1});if(o.length!==0)for(let s of o){let c=s.file;c===r.relativePath||e.isIgnored(c)||i.inactiveBarrelPaths.has(c)||!i.includeTests&&!w(c)||oe(t,r.symbolId,c,1,"caller-map")}}}export{ze as a,mt as b};
|
|
2
|
+
//# sourceMappingURL=chunk-6QVCPUK6.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{c as k,d as P}from"./chunk-OAI5GEIN.js";import{d as E}from"./chunk-UIWAZ2NT.js";import{a as w,c as x}from"./chunk-SYKCO25G.js";import{a as _}from"./chunk-IW7ASGVF.js";import{c as u}from"./chunk-O6KCZPJQ.js";import{execFileSync as T}from"child_process";var $=5;function U(n,l={}){let{base:s="HEAD",minContainment:m=.7,minCallees:c=3,maxHelpers:o=Number.POSITIVE_INFINITY,limit:a=20}=l,y=l.semantic!==!1,g=x(n,{base:s}),t={available:g.note!==w,base:s,changedFiles:g.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!t.available||g.changedFiles.length===0)return t;let v=new _(n),S=new Set(g.changedFiles),h=A(n,v,S,s);if(h.length===0)return t;let C=h.slice(0,o);h.length>o&&(t.note=`helper scoring capped at ${o} of ${h.length} new symbols`);let d=k(n,{minCallees:Math.min(3,c),semantic:y}),R=v.calleeMap(C,{semantic:y}),D=C.map(e=>({def:e,callees:P((R.get(e.symbolId)??[]).map(i=>i.symbol))})),b=new Map;for(let e of d)for(let i of e.callees)b.set(i,(b.get(i)??0)+1);let L=Math.max(8,Math.ceil(Math.sqrt(d.length)));for(let{def:e,callees:i}of D){let F=u(e.symbol);if(i.size<c){t.skipped.push({helperShortName:F,helperFile:e.relativePath,reason:`fewer than ${c} meaningful callees \u2014 too small to score`});continue}let M=H(n,e.symbolId);if(M.length===0){t.skipped.push({helperShortName:F,helperFile:e.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}t.helpersChecked+=1;let f=[];for(let r of d){if(r.symbol===e.symbol||S.has(r.file)||r.callees.has(e.symbol))continue;let p=E(i,r.callees);if(p<m)continue;let N=[...i].filter(I=>r.callees.has(I));N.some(I=>(b.get(I)??0)<=L)&&f.push({symbol:r.symbol,shortName:u(r.symbol),file:r.file,containment:p,sharedCallees:N.map(u).sort()})}f.length!==0&&(f.sort((r,p)=>p.containment-r.containment||r.file.localeCompare(p.file)),t.findings.push({helperSymbol:e.symbol,helperShortName:F,helperFile:e.relativePath,migratedFiles:M.sort(),leftovers:f.slice(0,$)}))}return t.findings.sort((e,i)=>(i.leftovers[0]?.containment??0)-(e.leftovers[0]?.containment??0)||e.helperFile.localeCompare(i.helperFile)),t.findings=t.findings.slice(0,a),t}function A(n,l,s,m){let c=new Map;return l.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(o=>{if(!s.has(o.relativePath))return!1;let a=c.get(o.relativePath);return a===void 0&&(a=O(n.config.projectRoot,m,o.relativePath),c.set(o.relativePath,a)),a===null||!new RegExp(`\\b${j(o.leaf)}\\b`).test(a)})}function O(n,l,s){try{return T("git",["show",`${l}:./${s}`],{encoding:"utf-8",cwd:n,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function H(n,l){return n.all(`SELECT DISTINCT ref_d.relative_path
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
5
|
+
WHERE m.symbol_id = ?
|
|
6
|
+
AND m.role != 1
|
|
7
|
+
${n.pathExclusionsFor("ref_d")}`,l).map(m=>m.relative_path)}function j(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{U as a};
|
|
8
|
+
//# sourceMappingURL=chunk-6VL4AIEO.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-V76FCF5F.js";import{a as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-V76FCF5F.js";import{a as p}from"./chunk-IW7ASGVF.js";import{c as i}from"./chunk-O6KCZPJQ.js";function x(e,r){let{scope:m,minLoc:o=10,limit:c=30,scanLimit:a}=r??{},s=new p(e);return u({candidates:()=>s.productionCallableDefinitions({scope:m,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:s.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:s.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>b(t,n,o),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:c})}function b(e,r,m){let o=e.endLine-e.startLine+1;if(o<m)return null;let c=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],s=a.filter(l=>l.file!==e.relativePath),t=new Set(s.map(l=>`${l.symbol}|${l.file}`)).size,n=new Set(a.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:i(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:c,fanOut:t,calleeCount:n,score:Math.round(o/50*(c/5)*Math.max(t/5,1)*100)/100}}export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-772YYL6I.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{b as k}from"./chunk-
|
|
1
|
+
import{b as k}from"./chunk-6QVCPUK6.js";import{a as D}from"./chunk-IW7ASGVF.js";import{e as h,f as y}from"./chunk-QYKKTYBN.js";import{n as S}from"./chunk-VGBSY6N7.js";import{c as v,r as L}from"./chunk-O6KCZPJQ.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||h(e,l.relativePath)||y(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:v(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(h(e,t.relativePath)||y(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:v(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
4
4
|
JOIN documents d ON d.id = der.document_id
|
|
5
5
|
WHERE gs.symbol = ?
|
|
6
6
|
LIMIT 1`,n);return s?L(e,s.relative_path).find(c=>c.symbol===n)??null:null}function B(e,n,s){let c=S(e,n);if(c.length===0)return{removable:!1,blockingFiles:[]};let a=new Set;for(let f of c)f.file===n.relativePath&&f.line>=n.startLine&&f.line<=n.endLine||s.contains(f.file,f.line)||a.add(f.file);return{removable:a.size===0,blockingFiles:[...a]}}function C(e,n,s,c){let a=[...s].sort((i,o)=>i.file.localeCompare(o.file)||i.startLine-o.startLine),f=new Set(a.map(i=>i.file)),t=[];for(let i of f){let o=L(e,i);o.length>0&&o.every(m=>c.contains(i,m.startLine))&&t.push(i)}return{depth:n,entries:a.map(({definition:i,...o})=>o),loc:a.reduce((i,o)=>i+o.loc,0),filesEmptied:t.sort()}}var P=class{ranges=new Map;add(n){let s=this.ranges.get(n.file)??[];s.push({start:n.startLine,end:n.endLine}),this.ranges.set(n.file,s)}contains(n,s){let c=this.ranges.get(n);return c?c.some(a=>s>=a.start&&s<=a.end):!1}};export{z as a,P as b};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-A2VTV2QB.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-IW7ASGVF.js";import{a as b}from"./chunk-4MHT7LKP.js";import{t as l}from"./chunk-WEJYUS5O.js";import{c as m}from"./chunk-O6KCZPJQ.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
|
|
2
2
|
`).slice(r,t+1).join(`
|
|
3
3
|
`)}catch{return""}}function S(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
4
|
FROM mentions m
|
|
5
5
|
JOIN chunks c ON m.chunk_id = c.id
|
|
6
6
|
WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function L(e,n){return new Set(e.filter(r=>r.file!==n).map(r=>r.symbol)).size}function P(e,n){let r=l(e),t=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=r.match(o);s&&(t+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}return t}export{O as a};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-ADRYSISR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as I}from"./chunk-JTCEWV7Q.js";import{a as u}from"./chunk-B32FX5KB.js";import{a as F}from"./chunk-OMNT7E2T.js";import{a as k}from"./chunk-AQYBOORI.js";import{a as z}from"./chunk-SLX5XBCD.js";import{a as _}from"./chunk-K3V6XUTL.js";import{a as M}from"./chunk-Y3RUPPIU.js";import{a as B}from"./chunk-U254PV4S.js";import{b as $}from"./chunk-SQ6VENQY.js";import{a as T}from"./chunk-2DVVHNC3.js";import{a as x,b as R}from"./chunk-YO6DU7QZ.js";import{b as A}from"./chunk-I66MQD5U.js";import{b as E,c as P}from"./chunk-R3G6ERW7.js";import{a as L}from"./chunk-VHENVDS2.js";import{a as D}from"./chunk-EKP7XJ6L.js";import{e as C,f as H}from"./chunk-TQTVM27C.js";function y(e){let i=K(e),{breakdown:t}=Z(e),r=O(t,"risk"),n=O(t,"hygiene");return{score:Math.min(r,n),riskScore:r,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null},axes:Q(e),validation:X(e),suppressions:e.suppressions,actions:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function Q(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:Y(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function Y(e){let i=e.gitEvidence?.fileStats;return i?e.complexity.top.map(t=>{let r=t.file?i[t.file]?.changes??0:0;return{...t,changes:r,weighted:p(t.score*Math.log2(1+r))}}).sort((t,r)=>r.weighted-t.weighted):null}function X(e){let i=e.gitEvidence?.fileStats;if(!i)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[]},r=new Set(Object.values(t).flat()),n=0,o=0,a=0;for(let[f,d]of Object.entries(i))r.has(f)?n+=d.fixChanges:(o+=d.fixChanges,a+=1);let m=r.size>0?p(n/r.size):0,l=a>0?p(o/a):0,g={};for(let[f,d]of Object.entries(t)){let h=new Set(d);if(h.size===0)continue;let b=0;for(let q of h)b+=i[q]?.fixChanges??0;let w=p(b/h.size);g[f]={flaggedFiles:h.size,fixDensity:w,lift:l>0?p(w/l):null}}return{flaggedFiles:r.size,flaggedFixDensity:m,baselineFixDensity:l,ratio:r.size>0&&l>0?p(m/l):null,byCategory:g}}function p(e){return Math.round(e*100)/100}function K(e){let i=[];if(e.dead.count>0&&i.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&i.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&i.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&i.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.extractCount>0&&i.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&i.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&i.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let n=[];e.stale.unused>0&&n.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&n.push(`${e.stale.singleUse} single-consumer (not in types file)`),i.push({category:"Stale abstractions",evidence:"heuristic",description:`${n.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let n=[];e.drift.unusedImports>0&&n.push(`${e.drift.unusedImports} unused imports`),e.drift.layerViolations>0&&n.push(`${e.drift.layerViolations} layer violations`),i.push({category:"Structural drift",evidence:"heuristic",description:n.join(", "),effort:e.drift.layerViolations>0?"medium":"low",impact:e.drift.layerViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let n=e.gitEvidence.hiddenCoupling.top[0];i.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a dependency edge`+(n?` (e.g. ${n.fileA} \u2194 ${n.fileB})`:"")+" \u2014 name the shared concept or enforce the sync",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},r={low:3,medium:2,high:1};return i.sort((n,o)=>{let a=t[n.impact]*r[n.effort];return t[o.impact]*r[o.effort]-a}),i}var J={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk",similar:"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene"};function O(e,i){let t=e.filter(r=>r.kind===i).reduce((r,n)=>r+n.points,0);return Math.max(0,Math.min(100,100-t))}function Z(e){let i=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),r=[],n=(d,h,b)=>{h>0&&r.push({axis:d,points:h,detail:b,kind:J[d]??"hygiene"})},o=e.dead.count/t;n("dead-code",Math.min(20,Math.round(o*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let a=e.isolated.count/t;n("isolated",Math.min(10,Math.round(a*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let m=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(m)),`${e.similarCount} similar function pair(s)`);let l=e.extractCount/t*1e3;n("extract",Math.min(5,Math.round(l/2)),`${e.extractCount} extraction candidate(s)`),n("wrappers",Math.min(3,e.wrappers.count),`${e.wrappers.count} wrapper candidate(s)`),n("passthroughs",Math.min(3,e.passthroughs.count),`${e.passthroughs.count} passthrough candidate(s)`);let g=e.stale.count/Math.max(t*.1,1);n("stale-abstractions",Math.min(8,Math.round(g*10)),`${e.stale.count} stale abstraction(s)`);let f=e.drift.count/i;return n("drift",Math.min(5,Math.round(f*50)),`${e.drift.count} drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence&&n("hidden-coupling",Math.min(5,e.gitEvidence.hiddenCoupling.pairCount),`${e.gitEvidence.hiddenCoupling.pairCount} co-changing pair(s) without a dependency edge`),{breakdown:r}}import{getHeapStatistics as ee}from"v8";var te=64*1024*1024;function S(){let e=globalThis.gc;if(!e)return;let i=ee();i.heap_size_limit-i.used_heap_size<te||e()}var ie=50,re=75e3,ne=5e3,V=2500,oe=["overview","dead","isolated","cycles","similar","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions"],N={overview:(e,i,t,r)=>({phase:"overview",statsResult:r,warnings:t.warnings}),dead:(e,i,t)=>({phase:"dead",dead:se(e,i,t)}),isolated:(e,i,t)=>({phase:"isolated",isolated:ce(e,i,t)}),cycles:(e,i,t)=>({phase:"cycles",realCycleCount:ue(e,i,t)}),similar:(e,i,t)=>({phase:"similar",similarCount:le(e,i,t)}),"extract-candidates":(e,i,t)=>({phase:"extract-candidates",extractCount:de(e,i,t)}),"wrapper-candidates":(e,i,t)=>({phase:"wrapper-candidates",wrappers:he(e,i,t)}),"passthrough-candidates":(e,i,t)=>({phase:"passthrough-candidates",passthroughs:pe(e,i,t)}),"stale-abstractions":(e,i,t)=>({phase:"stale-abstractions",stale:me(e,i,t)}),drift:(e,i,t)=>({phase:"drift",drift:be(e,i,t)}),"complexity-hotspots":(e,i,t)=>({phase:"complexity-hotspots",complexity:Ce(e,i,t)}),"git-evidence":(e,i,t)=>({phase:"git-evidence",gitEvidence:fe(e,t)}),suppressions:(e,i,t)=>({phase:"suppressions",suppressions:ge(e,t)})};function Ue(e,i={}){return G(e,i.full===!0,(t,r)=>{let n=ae(e,i.scope,t,r);return y(n)})}function qe(e,i,t={}){return G(e,t.full===!0,(r,n)=>N[i](e,t.scope,n,r))}function G(e,i,t){let r=k(e),n=He(r,i);try{return t(r,n)}finally{x(e,{semanticProvider:!0}),S()}}function Qe(e){return y(W(e))}function W(e){let i=s(e,"overview");return{statsResult:i.statsResult,warnings:i.warnings,dead:s(e,"dead").dead,isolated:s(e,"isolated").isolated,realCycleCount:s(e,"cycles").realCycleCount,similarCount:s(e,"similar").similarCount,extractCount:s(e,"extract-candidates").extractCount,wrappers:s(e,"wrapper-candidates").wrappers,passthroughs:s(e,"passthrough-candidates").passthroughs,stale:s(e,"stale-abstractions").stale,drift:s(e,"drift").drift,complexity:s(e,"complexity-hotspots").complexity,gitEvidence:j(e,"git-evidence")?.gitEvidence??null,suppressions:j(e,"suppressions")?.suppressions??null}}function j(e,i){return e.find(t=>t.phase===i)}function s(e,i){let t=e.find(r=>r.phase===i);if(!t)throw new Error(`Missing health phase result: ${i}`);return t}function ae(e,i,t,r){return W(oe.map(n=>N[n](e,i,r,t)))}function se(e,i,t){return c(e,t,"dead",()=>{let r=R(e,{scope:i,...u.dead,scanLimit:t.candidateScanLimit});return v(Se(e,r.symbols))})}function ce(e,i,t){return c(e,t,"isolated",()=>{let r=_(e,{scope:i,...u.isolated,scanLimit:t.candidateScanLimit});return v(ve(e,r))})}function ue(e,i,t){return c(e,t,"cycles",()=>D(e,{scope:i}).filter(n=>n.kind==="real").length)}function le(e,i,t){return c(e,t,"similar",()=>$(e,{scope:i,...u.similar,scanLimit:t.candidateScanLimit}).length)}function de(e,i,t){return c(e,t,"extract-candidates",()=>B(e,{scope:i,...u.extract,scanLimit:t.candidateScanLimit}).length)}function he(e,i,t){return U(e,t,"wrapper-candidates",()=>z(e,{scope:i,...u.wrappers,scanLimit:t.candidateScanLimit}))}function pe(e,i,t){return U(e,t,"passthrough-candidates",()=>M(e,{scope:i,...u.passthroughs,scanLimit:t.candidateScanLimit}))}function me(e,i,t){return c(e,t,"stale-abstractions",()=>{let r=F(e,{scope:i,...u.stale,scanLimit:t.candidateScanLimit}),n=r.filter(o=>o.consumers===0).length;return{count:r.length,loc:r.reduce((o,a)=>o+a.loc,0),files:[...new Set(r.map(o=>o.file))],unused:n,singleUse:r.length-n}})}function fe(e,i){return c(e,i,"git-evidence",()=>{let t=E(e);if(!t)return null;let r=A(e,void 0,{limit:50}),n={};for(let[o,a]of t)n[o]={changes:a.changes,fixChanges:a.fixChanges};return{amplification:P(e),hiddenCoupling:{pairCount:r.findings.length,top:r.findings.slice(0,5).map(o=>({fileA:o.fileA,fileB:o.fileB,together:o.together,confidence:o.confidence}))},fileStats:n}})}function ge(e,i){return c(e,i,"suppressions",()=>{let t=I(e);return{total:t.total,byCategory:{...t.byCategory}}})}function be(e,i,t){return c(e,t,"drift",()=>{let r=T(e,{scope:i,...u.drift});return{count:r.unusedImports+r.layerViolations,unusedImports:r.unusedImports,layerViolations:r.layerViolations}})}function Ce(e,i,t){return c(e,t,"complexity-hotspots",()=>{let r=L(e,{scope:i,minLoc:10,limit:10,scanLimit:t.candidateScanLimit,semantic:!1});return{top:r.slice(0,5).map(n=>({symbol:n.shortName,score:n.score,file:n.file})),extremeCount:r.filter(n=>n.score>ie).length}})}function He(e,i){return e.symbols>=re||e.documents>=ne?i?{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:["Large index detected; running unbounded health analyses because --full was supplied."]}:{candidateScanLimit:V,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${V} symbols. Run "scip-query health --full" for unbounded candidate counts.`]}:{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:[]}}function xe(e,i){i.releaseCachesBetweenPhases&&(x(e),S())}function c(e,i,t,r){ye(t);try{return r()}finally{xe(e,i)}}function U(e,i,t,r){return c(e,i,t,()=>v(r()))}function ye(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Se(e,i){return i.filter(t=>!C(e,t.relativePath)&&!H(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function ve(e,i){return i.filter(t=>!C(e,t.relativePath)&&!H(e,t.symbol,t.relativePath))}function v(e){let i=new Set;for(let t of e){let r=t.relativePath??t.file;r&&i.add(r)}return{count:e.length,loc:e.reduce((t,r)=>t+r.loc,0),files:[...i]}}export{oe as a,Ue as b,qe as c,Qe as d};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as I}from"./chunk-OXKEUWMJ.js";import{a as u}from"./chunk-B32FX5KB.js";import{a as F}from"./chunk-6IGXZZQ4.js";import{a as k}from"./chunk-AQYBOORI.js";import{a as z}from"./chunk-WN5Z3UVT.js";import{a as _}from"./chunk-BUAC4Q4G.js";import{a as M}from"./chunk-VDY4HYNK.js";import{a as B}from"./chunk-MCW36F2D.js";import{b as $}from"./chunk-OAI5GEIN.js";import{a as T}from"./chunk-NGI4V4AB.js";import{a as x,b as R}from"./chunk-6QVCPUK6.js";import{b as A}from"./chunk-JODYQDE4.js";import{b as E,c as P}from"./chunk-R3G6ERW7.js";import{a as L}from"./chunk-772YYL6I.js";import{a as D}from"./chunk-4HTJZC6G.js";import{e as C,f as H}from"./chunk-QYKKTYBN.js";function y(e){let i=K(e),{breakdown:t}=Z(e),r=O(t,"risk"),n=O(t,"hygiene");return{score:Math.min(r,n),riskScore:r,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null},axes:Q(e),validation:X(e),suppressions:e.suppressions,actions:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function Q(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:Y(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function Y(e){let i=e.gitEvidence?.fileStats;return i?e.complexity.top.map(t=>{let r=t.file?i[t.file]?.changes??0:0;return{...t,changes:r,weighted:p(t.score*Math.log2(1+r))}}).sort((t,r)=>r.weighted-t.weighted):null}function X(e){let i=e.gitEvidence?.fileStats;if(!i)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[]},r=new Set(Object.values(t).flat()),n=0,o=0,a=0;for(let[f,d]of Object.entries(i))r.has(f)?n+=d.fixChanges:(o+=d.fixChanges,a+=1);let m=r.size>0?p(n/r.size):0,l=a>0?p(o/a):0,g={};for(let[f,d]of Object.entries(t)){let h=new Set(d);if(h.size===0)continue;let b=0;for(let q of h)b+=i[q]?.fixChanges??0;let w=p(b/h.size);g[f]={flaggedFiles:h.size,fixDensity:w,lift:l>0?p(w/l):null}}return{flaggedFiles:r.size,flaggedFixDensity:m,baselineFixDensity:l,ratio:r.size>0&&l>0?p(m/l):null,byCategory:g}}function p(e){return Math.round(e*100)/100}function K(e){let i=[];if(e.dead.count>0&&i.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&i.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&i.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&i.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.extractCount>0&&i.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&i.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&i.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let n=[];e.stale.unused>0&&n.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&n.push(`${e.stale.singleUse} single-consumer (not in types file)`),i.push({category:"Stale abstractions",evidence:"heuristic",description:`${n.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let n=[];e.drift.unusedImports>0&&n.push(`${e.drift.unusedImports} unused imports`),e.drift.layerViolations>0&&n.push(`${e.drift.layerViolations} layer violations`),i.push({category:"Structural drift",evidence:"heuristic",description:n.join(", "),effort:e.drift.layerViolations>0?"medium":"low",impact:e.drift.layerViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let n=e.gitEvidence.hiddenCoupling.top[0];i.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a dependency edge`+(n?` (e.g. ${n.fileA} \u2194 ${n.fileB})`:"")+" \u2014 name the shared concept or enforce the sync",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},r={low:3,medium:2,high:1};return i.sort((n,o)=>{let a=t[n.impact]*r[n.effort];return t[o.impact]*r[o.effort]-a}),i}var J={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk",similar:"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene"};function O(e,i){let t=e.filter(r=>r.kind===i).reduce((r,n)=>r+n.points,0);return Math.max(0,Math.min(100,100-t))}function Z(e){let i=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),r=[],n=(d,h,b)=>{h>0&&r.push({axis:d,points:h,detail:b,kind:J[d]??"hygiene"})},o=e.dead.count/t;n("dead-code",Math.min(20,Math.round(o*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let a=e.isolated.count/t;n("isolated",Math.min(10,Math.round(a*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let m=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(m)),`${e.similarCount} similar function pair(s)`);let l=e.extractCount/t*1e3;n("extract",Math.min(5,Math.round(l/2)),`${e.extractCount} extraction candidate(s)`),n("wrappers",Math.min(3,e.wrappers.count),`${e.wrappers.count} wrapper candidate(s)`),n("passthroughs",Math.min(3,e.passthroughs.count),`${e.passthroughs.count} passthrough candidate(s)`);let g=e.stale.count/Math.max(t*.1,1);n("stale-abstractions",Math.min(8,Math.round(g*10)),`${e.stale.count} stale abstraction(s)`);let f=e.drift.count/i;return n("drift",Math.min(5,Math.round(f*50)),`${e.drift.count} drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence&&n("hidden-coupling",Math.min(5,e.gitEvidence.hiddenCoupling.pairCount),`${e.gitEvidence.hiddenCoupling.pairCount} co-changing pair(s) without a dependency edge`),{breakdown:r}}import{getHeapStatistics as ee}from"v8";var te=64*1024*1024;function S(){let e=globalThis.gc;if(!e)return;let i=ee();i.heap_size_limit-i.used_heap_size<te||e()}var ie=50,re=75e3,ne=5e3,V=2500,oe=["overview","dead","isolated","cycles","similar","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions"],N={overview:(e,i,t,r)=>({phase:"overview",statsResult:r,warnings:t.warnings}),dead:(e,i,t)=>({phase:"dead",dead:se(e,i,t)}),isolated:(e,i,t)=>({phase:"isolated",isolated:ce(e,i,t)}),cycles:(e,i,t)=>({phase:"cycles",realCycleCount:ue(e,i,t)}),similar:(e,i,t)=>({phase:"similar",similarCount:le(e,i,t)}),"extract-candidates":(e,i,t)=>({phase:"extract-candidates",extractCount:de(e,i,t)}),"wrapper-candidates":(e,i,t)=>({phase:"wrapper-candidates",wrappers:he(e,i,t)}),"passthrough-candidates":(e,i,t)=>({phase:"passthrough-candidates",passthroughs:pe(e,i,t)}),"stale-abstractions":(e,i,t)=>({phase:"stale-abstractions",stale:me(e,i,t)}),drift:(e,i,t)=>({phase:"drift",drift:be(e,i,t)}),"complexity-hotspots":(e,i,t)=>({phase:"complexity-hotspots",complexity:Ce(e,i,t)}),"git-evidence":(e,i,t)=>({phase:"git-evidence",gitEvidence:fe(e,t)}),suppressions:(e,i,t)=>({phase:"suppressions",suppressions:ge(e,t)})};function Ue(e,i={}){return G(e,i.full===!0,(t,r)=>{let n=ae(e,i.scope,t,r);return y(n)})}function qe(e,i,t={}){return G(e,t.full===!0,(r,n)=>N[i](e,t.scope,n,r))}function G(e,i,t){let r=k(e),n=He(r,i);try{return t(r,n)}finally{x(e,{semanticProvider:!0}),S()}}function Qe(e){return y(W(e))}function W(e){let i=s(e,"overview");return{statsResult:i.statsResult,warnings:i.warnings,dead:s(e,"dead").dead,isolated:s(e,"isolated").isolated,realCycleCount:s(e,"cycles").realCycleCount,similarCount:s(e,"similar").similarCount,extractCount:s(e,"extract-candidates").extractCount,wrappers:s(e,"wrapper-candidates").wrappers,passthroughs:s(e,"passthrough-candidates").passthroughs,stale:s(e,"stale-abstractions").stale,drift:s(e,"drift").drift,complexity:s(e,"complexity-hotspots").complexity,gitEvidence:j(e,"git-evidence")?.gitEvidence??null,suppressions:j(e,"suppressions")?.suppressions??null}}function j(e,i){return e.find(t=>t.phase===i)}function s(e,i){let t=e.find(r=>r.phase===i);if(!t)throw new Error(`Missing health phase result: ${i}`);return t}function ae(e,i,t,r){return W(oe.map(n=>N[n](e,i,r,t)))}function se(e,i,t){return c(e,t,"dead",()=>{let r=R(e,{scope:i,...u.dead,scanLimit:t.candidateScanLimit});return v(Se(e,r.symbols))})}function ce(e,i,t){return c(e,t,"isolated",()=>{let r=_(e,{scope:i,...u.isolated,scanLimit:t.candidateScanLimit});return v(ve(e,r))})}function ue(e,i,t){return c(e,t,"cycles",()=>D(e,{scope:i}).filter(n=>n.kind==="real").length)}function le(e,i,t){return c(e,t,"similar",()=>$(e,{scope:i,...u.similar,scanLimit:t.candidateScanLimit}).length)}function de(e,i,t){return c(e,t,"extract-candidates",()=>B(e,{scope:i,...u.extract,scanLimit:t.candidateScanLimit}).length)}function he(e,i,t){return U(e,t,"wrapper-candidates",()=>z(e,{scope:i,...u.wrappers,scanLimit:t.candidateScanLimit}))}function pe(e,i,t){return U(e,t,"passthrough-candidates",()=>M(e,{scope:i,...u.passthroughs,scanLimit:t.candidateScanLimit}))}function me(e,i,t){return c(e,t,"stale-abstractions",()=>{let r=F(e,{scope:i,...u.stale,scanLimit:t.candidateScanLimit}),n=r.filter(o=>o.consumers===0).length;return{count:r.length,loc:r.reduce((o,a)=>o+a.loc,0),files:[...new Set(r.map(o=>o.file))],unused:n,singleUse:r.length-n}})}function fe(e,i){return c(e,i,"git-evidence",()=>{let t=E(e);if(!t)return null;let r=A(e,void 0,{limit:50}),n={};for(let[o,a]of t)n[o]={changes:a.changes,fixChanges:a.fixChanges};return{amplification:P(e),hiddenCoupling:{pairCount:r.findings.length,top:r.findings.slice(0,5).map(o=>({fileA:o.fileA,fileB:o.fileB,together:o.together,confidence:o.confidence}))},fileStats:n}})}function ge(e,i){return c(e,i,"suppressions",()=>{let t=I(e);return{total:t.total,byCategory:{...t.byCategory}}})}function be(e,i,t){return c(e,t,"drift",()=>{let r=T(e,{scope:i,...u.drift});return{count:r.unusedImports+r.layerViolations,unusedImports:r.unusedImports,layerViolations:r.layerViolations}})}function Ce(e,i,t){return c(e,t,"complexity-hotspots",()=>{let r=L(e,{scope:i,minLoc:10,limit:10,scanLimit:t.candidateScanLimit,semantic:!1});return{top:r.slice(0,5).map(n=>({symbol:n.shortName,score:n.score,file:n.file})),extremeCount:r.filter(n=>n.score>ie).length}})}function He(e,i){return e.symbols>=re||e.documents>=ne?i?{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:["Large index detected; running unbounded health analyses because --full was supplied."]}:{candidateScanLimit:V,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${V} symbols. Run "scip-query health --full" for unbounded candidate counts.`]}:{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:[]}}function xe(e,i){i.releaseCachesBetweenPhases&&(x(e),S())}function c(e,i,t,r){ye(t);try{return r()}finally{xe(e,i)}}function U(e,i,t,r){return c(e,i,t,()=>v(r()))}function ye(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Se(e,i){return i.filter(t=>!C(e,t.relativePath)&&!H(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function ve(e,i){return i.filter(t=>!C(e,t.relativePath)&&!H(e,t.symbol,t.relativePath))}function v(e){let i=new Set;for(let t of e){let r=t.relativePath??t.file;r&&i.add(r)}return{count:e.length,loc:e.reduce((t,r)=>t+r.loc,0),files:[...i]}}export{oe as a,Ue as b,qe as c,Qe as d};
|
|
2
|
+
//# sourceMappingURL=chunk-AI2ECT7L.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-ZOT3WUZW.js";import{a as l}from"./chunk-4MHT7LKP.js";import{a as c}from"./chunk-IVAIPXNO.js";import{c as d}from"./chunk-O6KCZPJQ.js";function p(e,t){let o=l(e,t);if(!o)return[];let n=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
WHERE m.symbol_id = ?
|
|
@@ -59,4 +59,4 @@ import{a as r}from"./chunk-WC43FMAB.js";import{a as c}from"./chunk-RIXOMSOR.js";
|
|
|
59
59
|
GROUP BY d.id
|
|
60
60
|
ORDER BY symbol_count DESC
|
|
61
61
|
LIMIT ?`,o).filter(i=>!e.isIgnored(i.relative_path)).map(i=>({name:i.relative_path,count:i.symbol_count}))}export{p as a,b,y as c,I as d};
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-AP5GTKSG.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as l}from"./chunk-
|
|
1
|
+
import{b as l}from"./chunk-ZOT3WUZW.js";import{a}from"./chunk-IW7ASGVF.js";import{c as i,f as n}from"./chunk-O6KCZPJQ.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -26,4 +26,4 @@ import{b as l}from"./chunk-WC43FMAB.js";import{a}from"./chunk-NO2TPMCQ.js";impor
|
|
|
26
26
|
AND ${e.localSymbolPredicate}
|
|
27
27
|
${e.pathExclusionsFor("d1")}
|
|
28
28
|
ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-BGRPMGTD.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-VDZIEDJB.js";import{c as r,s as l}from"./chunk-O6KCZPJQ.js";function b(o,t={}){let{limit:n=30,scope:e}=t,i=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
|
|
2
2
|
gs.symbol,
|
|
3
3
|
COUNT(*) AS ref_count,
|
|
4
4
|
COUNT(DISTINCT ref_d.id) AS file_count,
|
|
@@ -22,4 +22,4 @@ import{a as d}from"./chunk-EAU4RDFG.js";import{c as r,s as l}from"./chunk-SOGLYI
|
|
|
22
22
|
GROUP BY gs.id
|
|
23
23
|
ORDER BY ref_count DESC
|
|
24
24
|
LIMIT ?`,n).filter(s=>!o.isIgnored(s.defined_in)).map(s=>({symbol:s.symbol,shortName:r(s.symbol),refCount:s.ref_count,fileCount:s.file_count,definedIn:s.defined_in}));return m.length>0?m:f(o,e,n)}function f(o,t,n){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,i)=>i.refCount-e.refCount||i.fileCount-e.fileCount).slice(0,n)}function u(o,t){let n=d(o,t,{limit:500});return{symbol:t.symbol,shortName:r(t.symbol),refCount:n.length,fileCount:new Set(n.map(e=>e.file)).size,definedIn:t.relativePath}}export{b as a};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-BNW3Q24R.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,c as p}from"./chunk-MX6F756F.js";import{a as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o,c as p}from"./chunk-MX6F756F.js";import{a as y}from"./chunk-IW7ASGVF.js";import{c as b}from"./chunk-O6KCZPJQ.js";function P(u,c={}){let{scope:f,minLoc:L=3,scanLimit:l}=c,s=new y(u),r=c.semantic!==!1,t=p(s.productionCallableDefinitions({scope:f,minLoc:L,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),h=s.crossFileCallerMap(t,{semantic:r}),a=new Set(h.keys());for(let e of s.frameworkReferencedSymbolIds(t))a.add(e);let n=s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:r}),m=t.filter(e=>!a.has(e.symbolId)).filter(e=>!n.has(e.symbolId)),I=s.sourceFallbackCallerFiles(m);for(let e of I.keys())a.add(e);let d=m.filter(e=>!a.has(e.symbolId)),C=s.symbolsWithNonSelfCallees(d,{additive:!0,semantic:r});for(let e of C)n.add(e);return d.filter(e=>!n.has(e.symbolId)).sort((e,i)=>o(i)-o(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{P as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BUAC4Q4G.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b}from"./chunk-OAI5GEIN.js";import{e as d}from"./chunk-R3G6ERW7.js";function C(m,r={}){let{windowCommits:a=100,minSimilarity:u=.7,limit:c=30,scope:g,scanLimit:f}=r,o=d(m);if(!o)return{available:!1,windowCommits:a,findings:[]};let A=b(m,{scope:g,minSimilarity:u,limit:c*5,crossFileOnly:!0,scanLimit:f,semantic:r.semantic}),n=[];for(let e of A){let i=o.get(e.fileA)?.commitsAgo??null,t=o.get(e.fileB)?.commitsAgo??null,s=i!==null&&i<=a,h=t!==null&&t<=a;if(!(!s&&!h)){if(s&&h){let l=(i??0)<=(t??0);n.push({kind:"twin",echoSymbol:l?e.shortNameA:e.shortNameB,echoFile:l?e.fileA:e.fileB,echoAgeCommits:(l?i:t)??0,establishedSymbol:l?e.shortNameB:e.shortNameA,establishedFile:l?e.fileB:e.fileA,establishedAgeCommits:l?t:i,similarity:e.similarity,sharedCallees:e.sharedCallees})}else n.push({kind:"echo",echoSymbol:s?e.shortNameA:e.shortNameB,echoFile:s?e.fileA:e.fileB,echoAgeCommits:(s?i:t)??0,establishedSymbol:s?e.shortNameB:e.shortNameA,establishedFile:s?e.fileB:e.fileA,establishedAgeCommits:s?t:i,similarity:e.similarity,sharedCallees:e.sharedCallees});if(n.length>=c)break}}return n.sort((e,i)=>(e.kind===i.kind?0:e.kind==="echo"?-1:1)||i.similarity-e.similarity),{available:!0,windowCommits:a,findings:n}}export{C as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BZ6LCGE6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b}from"./chunk-ZOT3WUZW.js";import{l as d,u as f}from"./chunk-O6KCZPJQ.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-CMXFASVD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as b}from"./chunk-MX6F756F.js";import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as b}from"./chunk-MX6F756F.js";import{a as u}from"./chunk-IW7ASGVF.js";import{a as f}from"./chunk-VDZIEDJB.js";import{a as c}from"./chunk-5QJIEYFB.js";import{c as l}from"./chunk-O6KCZPJQ.js";function R(o,e={}){let{limit:r=20,scope:s,minFanIn:i=2,minFanOut:n=2,scanLimit:m}=e,p=new u(o);return b(p.productionCallableDefinitions({scope:s,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof m=="number"&&m>0}),m).map(t=>y(o,t,e.semantic!==!1)).filter(t=>t.fanIn>=i&&t.fanOut>=n).sort((t,a)=>a.score-t.score||a.fanIn-t.fanIn).slice(0,r)}function y(o,e,r){let s=new Set(f(o,e,{limit:500,semantic:r}).map(n=>n.file)).size,i=new Set(c(o,e,{limit:500,semantic:r}).filter(n=>n.file!==e.relativePath).map(n=>`${n.symbol}|${n.file}`)).size;return{symbol:e.symbol,shortName:l(e.symbol),fanIn:s,fanOut:i,score:s*i,definedIn:e.relativePath}}export{R as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CO3AL7NZ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-ZOT3WUZW.js";import{a as d}from"./chunk-IW7ASGVF.js";import{e as c}from"./chunk-ZF6P2NAT.js";import{c as u}from"./chunk-O6KCZPJQ.js";function L(e,n,i={}){let t=f(e,n);if(!t)return null;let r=h(e,t);if(!r||e.isIgnored(r.relative_path))return null;let s=[],m=0,l=g(e,r.relative_path),p=i.semantic===!1?new Map:c(e,l);for(let o of l){let a=S(e,r,o,p.get(o.symbolId)??new Set);m+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:b(a)})}return{file:r.relative_path,symbols:s,totalExternalConsumers:m}}function h(e,n){return e.get(`SELECT id, relative_path FROM documents
|
|
2
2
|
WHERE relative_path = ?
|
|
3
3
|
${e.pathExclusionsFor("documents")}
|
|
4
4
|
LIMIT 1`,n)??null}function g(e,n){return new d(e).definitionsForFile(n).sort((i,t)=>i.startLine-t.startLine||i.endLine-t.endLine)}function S(e,n,i,t){let r=e.all(`SELECT DISTINCT consumer_d.relative_path
|
|
@@ -8,4 +8,4 @@ import{a as f}from"./chunk-WC43FMAB.js";import{a as d}from"./chunk-NO2TPMCQ.js";
|
|
|
8
8
|
WHERE m.symbol_id = ?
|
|
9
9
|
AND m.role != 1
|
|
10
10
|
AND c.document_id != ?`,i.symbolId,n.id);return new Set([...r.map(s=>s.relative_path),...[...t].filter(s=>s!==n.relative_path)]).size}function b(e){return e>10?"high":e>0?"medium":"low"}export{L as a};
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-FVIKFWUL.js.map
|