scip-query 0.10.10 → 0.10.11
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-2KHTSEIL.js +102 -0
- package/dist/{chunk-CCKPYPDI.js → chunk-4UZO3XCV.js} +2 -2
- package/dist/{chunk-MMLZEGMS.js → chunk-54KGX7EX.js} +2 -2
- package/dist/{chunk-2VM46FC5.js → chunk-5GOLFJEO.js} +2 -2
- package/dist/chunk-5OST6GYB.js +2 -0
- package/dist/{chunk-2UYQLFVC.js → chunk-6GN7FXCH.js} +2 -2
- package/dist/{chunk-7UQWUVRG.js → chunk-6IR2AOBM.js} +2 -2
- package/dist/{chunk-QX7LLCGB.js → chunk-6JRV4MY2.js} +2 -2
- package/dist/{chunk-IPQTC36U.js → chunk-6LJHXREW.js} +2 -2
- package/dist/{chunk-CZ425R2B.js → chunk-6QSOCTZT.js} +2 -2
- package/dist/{chunk-RYXW3KRC.js → chunk-7B6LP46R.js} +2 -2
- package/dist/chunk-7GO4EQF5.js +2 -0
- package/dist/chunk-7IVSJJZU.js +7 -0
- package/dist/{chunk-56P7PDST.js → chunk-7TWLSZK5.js} +2 -2
- package/dist/{chunk-AW2QHPLL.js → chunk-AVWPHM2Q.js} +2 -2
- package/dist/{chunk-UYD7FJ3K.js → chunk-BASVXNY3.js} +2 -2
- package/dist/{chunk-XXZXDXTD.js → chunk-BFXPG2VN.js} +2 -2
- package/dist/{chunk-UWYJDBDW.js → chunk-CO5GJRP7.js} +2 -2
- package/dist/chunk-CW5YFOCP.js +5 -0
- package/dist/{chunk-7JRRXGVZ.js → chunk-E35O7UCB.js} +2 -2
- package/dist/{chunk-XIVO4SDZ.js → chunk-EXDQ35NN.js} +2 -2
- package/dist/{chunk-UFX7EPBA.js → chunk-EY43NV4M.js} +2 -2
- package/dist/{chunk-NZ4UDB5N.js → chunk-FFVIFETB.js} +2 -2
- package/dist/{chunk-UDGXK2WA.js → chunk-FKCGBZAC.js} +2 -2
- package/dist/{chunk-TL6QPNF5.js → chunk-FXNWFMKW.js} +2 -2
- package/dist/chunk-G5UPYQGL.js +4 -0
- package/dist/{chunk-Y6E3JHC4.js → chunk-GQBMH2TQ.js} +2 -2
- package/dist/{chunk-736BLPHR.js → chunk-IHUETYFW.js} +2 -2
- package/dist/{chunk-5VG7RKEF.js → chunk-JATUZIEH.js} +2 -2
- package/dist/chunk-JCLDUKT6.js +38 -0
- package/dist/{chunk-SGLLBSCV.js → chunk-JGN2ZFJR.js} +2 -2
- package/dist/{chunk-WG6KRH5F.js → chunk-JME7OWD3.js} +2 -2
- package/dist/{chunk-F6ICF7HL.js → chunk-KDFONWTW.js} +2 -2
- package/dist/{chunk-J7RWXLUL.js → chunk-LSET2TXH.js} +2 -2
- package/dist/{chunk-ZU6PROUY.js → chunk-M4COR2H6.js} +2 -2
- package/dist/{chunk-DQVKIG3D.js → chunk-NOJAM5ZV.js} +2 -2
- package/dist/{chunk-A6TANQNV.js → chunk-O6ZH6C6Y.js} +2 -2
- package/dist/chunk-OLTESY4K.js +3 -0
- package/dist/chunk-P4KYUPBD.js +4 -0
- package/dist/{chunk-Z4I7BVIU.js → chunk-P753MDDE.js} +2 -2
- package/dist/{chunk-6LNQOOTB.js → chunk-P7AL7Y37.js} +2 -2
- package/dist/{chunk-YWDVDAD7.js → chunk-QLAUCRDJ.js} +2 -2
- package/dist/{chunk-UQLFQLAF.js → chunk-RNM6LMCF.js} +2 -2
- package/dist/{chunk-PTQVNJ4Q.js → chunk-TK7O5ER5.js} +2 -2
- package/dist/chunk-TQ5W2H3S.js +4 -0
- package/dist/chunk-USPV3T5K.js +2 -0
- package/dist/{chunk-I46WR7MT.js → chunk-VCQYSG2M.js} +2 -2
- package/dist/{chunk-XSNRACLV.js → chunk-W6BVEKYC.js} +2 -2
- package/dist/{chunk-KX5PLFZ5.js → chunk-WUCEKFQC.js} +2 -2
- package/dist/{chunk-TH2N6QHW.js → chunk-Y5NBHMQX.js} +2 -2
- package/dist/{chunk-YBEEVDJQ.js → chunk-YCOFCT4B.js} +2 -2
- package/dist/{chunk-RXRLZFUL.js → chunk-YWYFU2V3.js} +2 -2
- package/dist/{chunk-5NVUWIAN.js → chunk-Z3YYR4OS.js} +2 -2
- package/dist/{chunk-ZQO43G2T.js → chunk-Z4HICZGY.js} +2 -2
- package/dist/{chunk-3DGD6NKW.js → chunk-ZQDIXAF5.js} +2 -2
- package/dist/cli.js +250 -247
- 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/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/dataflow.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deps.js +1 -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/locality-candidates.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-signatures.js +1 -1
- package/dist/queries/similar.d.ts +11 -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-imports.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/docs/COMMAND_REFERENCE.md +1 -1
- package/package.json +1 -1
- package/skills/scip-hyper-optimization/SKILL.md +153 -24
- package/skills/scip-hyper-optimization/agents/openai.yaml +3 -3
- package/dist/chunk-3Q77KKEY.js +0 -2
- package/dist/chunk-4KTOV4QN.js +0 -3
- package/dist/chunk-4N4WONI4.js +0 -102
- package/dist/chunk-A6IDHNMC.js +0 -4
- package/dist/chunk-FRPEPTYJ.js +0 -5
- package/dist/chunk-GBEYTDY5.js +0 -2
- package/dist/chunk-PKMZCDQD.js +0 -4
- package/dist/chunk-QVI3NR7E.js +0 -7
- package/dist/chunk-SULEXAHO.js +0 -38
- package/dist/chunk-YGHUVQLR.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as y}from"./chunk-B75HZHUP.js";import{a as f}from"./chunk-BGBBVSH4.js";import{g as L}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as y}from"./chunk-B75HZHUP.js";import{a as f}from"./chunk-BGBBVSH4.js";import{g as L}from"./chunk-OLTESY4K.js";import{y as d}from"./chunk-OBGRLXWF.js";import{c as h,d as S,g as x}from"./chunk-2KHTSEIL.js";import{c as b}from"./chunk-JM72FNGA.js";import{a as g}from"./chunk-DS6QEB3G.js";function F(n,e={}){let{scope:s,minLoc:t=1,limit:i,scanLimit:a}=e,o=e.semantic!==!1,l=M(n,$(n,{scope:s,minLoc:t,scanLimit:a}),{semantic:o}),r=I(l);return i?r.slice(0,i):r}function $(n,e){let s=x(n,{scope:e.scope}).filter(t=>t.isFunctionLike&&!n.isIgnored(t.relativePath)).filter(t=>f(t)>=e.minLoc);return typeof e.scanLimit=="number"&&e.scanLimit>0&&s.sort((t,i)=>f(i)-f(t)||t.relativePath.localeCompare(i.relativePath)),y(s,e.scanLimit)}function M(n,e,s){let t=new Map;for(let i of e){let a=w(n,i,s);if(!a)continue;let o=t.get(a)??[];o.push(v(i)),t.set(a,o)}return t}function v(n){return{symbol:n.symbol,shortName:b(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:f(n)}}function I(n){let e=[];for(let[s,t]of n)t.length>=2&&e.push({signature:s,functions:t});return e.sort((s,t)=>{let i=t.functions.length-s.functions.length;if(i!==0)return i;let a=s.functions.reduce((l,r)=>l+r.loc,0);return t.functions.reduce((l,r)=>l+r.loc,0)-a}),e}function w(n,e,s){if(s.semantic){let a=L(n,e);if(a)return a}let t=G(e.documentation),i=t?A(t):null;return i||R(P(n,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)}function G(n){return h(S(n))}function P(n,e,s,t,i){let a=g(n,e);if(!a)return null;let o=a.split(/\r?\n/),l=E(o,s,t,i);for(let r of l){let p=Math.min(o.length-1,Math.max(r,r+4)),u="";for(let c=r;c<=p;c+=1){let m=o[c]?.trim();if(m&&(u=u?`${u} ${m}`:m,z(u)))return u}if(u&&u.includes("("))return u}return null}function z(n){let e=n.replace(/\s+/g," ").trim();return!e.includes("(")||d(e)>0?!1:/[;{]$/.test(e)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(e)||/\)\s*As\s+.+$/i.test(e)}function A(n){if(!n||!n.trim())return null;let e=n.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim(),s=e.indexOf("(");return s===-1||(e=e.slice(s),e=e.replace(/\s+/g,"").toLowerCase(),e.length<3)?null:e}function R(n,e){if(!n||!n.trim())return null;let s=n.replace(/\s+/g," ").trim(),t=s.indexOf("(");if(t===-1)return null;let i=s.slice(0,t),o=new RegExp(`\\b${D(e)}\\b`,"i").exec(i);o&&typeof o.index=="number"&&(i=i.slice(0,o.index)),i=i.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let l=C(s.slice(t)).replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!l.startsWith("("))return null;let r=`${i?`${i} `:""}${l}`.replace(/\s+/g,"").toLowerCase();return r.length>=3?r:null}function C(n){let e=0,s=0,t=0,i=0,a=null,o=!1;for(let l=0;l<n.length;l+=1){let r=n[l];if(a){if(o){o=!1;continue}if(r==="\\"){o=!0;continue}r===a&&(a=null);continue}if(r==='"'||r==="'"||r==="`"){a=r;continue}if(r==="(")e+=1;else if(r===")")e=Math.max(0,e-1);else if(r==="[")t+=1;else if(r==="]")t=Math.max(0,t-1);else if(r==="<")i+=1;else if(r===">")i=Math.max(0,i-1);else if(r==="{"){if(e===0&&t===0&&i===0)return n.slice(0,l);s+=1}else if(r==="}")s=Math.max(0,s-1);else if(r==="="&&n[l+1]===">"&&e===0&&s===0&&t===0&&i===0)return n.slice(0,l)}return n}function E(n,e,s,t){let i=D(t),a=new RegExp(`\\b${i}\\b\\s*\\(`,"i"),o=new RegExp(`\\bdef\\s+${i}\\b`,"i"),l=[],r=new Set,p=Math.max(0,Math.min(e,n.length-1)),u=Math.max(p,Math.min(n.length-1,Math.max(s,e+4)));for(let c=p;c<=u;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}for(let c=0;c<n.length;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}return l}function D(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FFVIFETB.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R}from"./chunk-
|
|
1
|
+
import{a as R}from"./chunk-5OST6GYB.js";import{a as _,d as f}from"./chunk-C5CTSJ6X.js";import{a as c,b as m,c as s}from"./chunk-P5RYBRIO.js";import{c as d,e as p}from"./chunk-JM72FNGA.js";import{a as l}from"./chunk-DS6QEB3G.js";import{a}from"./chunk-64MNV6AB.js";function P(e,o={}){let{scope:r,limit:n}=o,t=new R(e),i=C([...h(e,r),...N(e,t,r)]);return D(i),n?i.slice(0,n):i}function h(e,o){let r=[];for(let n of E(e,o)){if(e.isIgnored(n.barrel_path)||e.isIgnored(n.original_path)||f(e,n.barrel_path)||l(e,n.barrel_path)&&s(e,n.barrel_path).length===0)continue;let t=S(e,n),i=t?.barrel_consumers??0,u=t?.direct_consumers??0;i!==0||u!==0||r.push({barrelFile:n.barrel_path,symbol:n.symbol,shortName:d(n.symbol),originalFile:n.original_path,barrelConsumers:i,directConsumers:u,...g(e,n.barrel_path)})}return r}function E(e,o){let r=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 R}from"./chunk-GBEYTDY5.js";import{a as _,d as f}from"./chunk-C5CTSJ
|
|
|
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 N(e,o,r){let n=[];for(let t of y(e,r))x(e,t,t)>0||n.push(...I(e,o,t));return n}function y(e,o){return a(e,{scope:o,includeIgnored:!1}).filter(r=>s(e,r).length>0||c(e,r).length>0)}function I(e,o,r){let n=s(e,r).filter(i=>i.sourcePath&&!e.isIgnored(i.sourcePath)).flatMap(i=>b(e,o,r,i.sourcePath)),t=c(e,r).filter(i=>i.sourcePath&&!e.isIgnored(i.sourcePath)).flatMap(i=>b(e,o,r,i.sourcePath));return[...n,...t]}function b(e,o,r,n){let t=O(o,n);return t?[{barrelFile:r,symbol:t.symbol,shortName:d(t.symbol),originalFile:n,barrelConsumers:0,directConsumers:x(e,n,r),...g(e,r)}]:[]}function g(e,o){return _(e,o)?{actionTier:"signal",surfaceEvidence:["barrel file is declared on the package public surface"],recommendation:"Review the package API before removing this re-export; local consumers are zero, but external consumers may import through the public barrel."}:{actionTier:"direct",surfaceEvidence:[],recommendation:"Remove this unused re-export when the barrel is not part of an external API surface."}}function x(e,o,r){let n=new Set;for(let t of a(e,{includeIgnored:!1}))if(t!==r)for(let i of m(e,t))i.sourcePath===o&&n.add(t);return n.size}function O(e,o){let r=e.definitionsForFile(o);return r.find(n=>p(n.symbol)==="method")??r[0]??null}function C(e){let o=new Set,r=[];for(let n of e){let t=`${n.barrelFile}|${n.symbol}|${n.originalFile}`;o.has(t)||(o.add(t),r.push(n))}return r}function D(e){e.sort((o,r)=>r.directConsumers-o.directConsumers||o.barrelFile.localeCompare(r.barrelFile)||o.shortName.localeCompare(r.shortName))}export{P as a};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-FKCGBZAC.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-RNM6LMCF.js";import{g as l}from"./chunk-2KHTSEIL.js";import{c as r}from"./chunk-JM72FNGA.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-UQLFQLAF.js";import{g as l}from"./chunk-4N4WONI4.js";
|
|
|
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-FXNWFMKW.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as ce}from"./chunk-E35O7UCB.js";import{a as ae}from"./chunk-5GOLFJEO.js";import{a as S}from"./chunk-B32FX5KB.js";import{a as se}from"./chunk-7IVSJJZU.js";import{a as oe}from"./chunk-AVWPHM2Q.js";import{a as re}from"./chunk-C2QSK7E7.js";import{a as ie,c as ne}from"./chunk-CW5YFOCP.js";import{a as ee}from"./chunk-O6ZH6C6Y.js";import{a as te}from"./chunk-WUCEKFQC.js";import{a as X}from"./chunk-M4COR2H6.js";import{a as U,c as V,d as q,h as L,i as K}from"./chunk-NOJAM5ZV.js";import{a as W,b as A,e as Y}from"./chunk-P4KYUPBD.js";import{a as Q}from"./chunk-6QSOCTZT.js";import{b as Z}from"./chunk-USPV3T5K.js";import{a as E,c as _,d as z,e as O}from"./chunk-65AU3HFZ.js";import{g as H}from"./chunk-BSN22NRK.js";import{a as J}from"./chunk-QYB5P7GL.js";import{a as I}from"./chunk-5OST6GYB.js";import{f as F,g as v}from"./chunk-C5CTSJ6X.js";import{b as P}from"./chunk-TQ5W2H3S.js";import{d as T,e as N,f as M}from"./chunk-JM72FNGA.js";import{createHash as Oe}from"crypto";import{existsSync as me}from"fs";function le(e){let[i,t]=G(e,":"),n=i||"unknown",o=(s={})=>{let r=s.actionTier??Se(n);return{sourceAnalyzer:n,actionTier:r,rootCauseKey:s.rootCauseKey??(t||e),label:s.label??`${n} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??$e(r,n),file:s.file}};if(!t)return o({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(n)){let[s,r]=G(t,":");return o({file:s,relatedFiles:s?[s]:[],rootCauseKey:r?`${s}:${r}`:t,label:`${n} finding`,why:r?[`Baseline subject: ${r}.`]:[]})}if(n==="cycle"){let s=t.split(">").filter(Boolean);return o({relatedFiles:s,rootCauseKey:t,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(n==="similar"){let s=t.split("|").filter(Boolean);return o({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(n==="drift"){let[s,r]=G(t,":"),[l,a]=G(r,":");return o({actionTier:s==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,a].filter(Boolean))],rootCauseKey:t,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...a?[`Related dependency: ${a}.`]:[]]})}return o({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Se(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function $e(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function G(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as De,readFileSync as fe}from"fs";var w={classifyCitation:we,citationContexts:ke,citationKindLabel:Te,citationRemediation:Fe,referenceTargets:ve};function we(e){let i=e.join(`
|
|
2
|
+
`).toLowerCase(),t=[],n=A(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(n.length>0)return t.push(`configuration/example terms near citation: ${n.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:t};let o=A(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return t.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:t};let s=A(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(t.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:t}):(t.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:t})}function ke(e,i,t){let n;try{n=fe(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=t.flatMap(Re),s=[];for(let r=0;r<n.length;r+=1){let l=n[r]??"";o.some(a=>l.includes(a))&&s.push(W(n,r))}return s}function Re(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((t,n,o)=>t.length>0&&o.indexOf(t)===n)}function Te(e){switch(e){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function Fe(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function ve(e,i,t){let n=U(t),o=new Set;for(let s of i)xe(e,s,n.get(s)??[])&&o.add(s);return o}function xe(e,i,t){if(t.length===0)return!1;if(!Ae.test(i))return!0;let n=`${e.config.projectRoot}/${i}`;if(!De(n))return!0;let o=fe(n,"utf-8").split(/\r?\n/),s=Ge(o);for(let r of t)for(let l=r.startLine;l<=r.endLine;l+=1)if((o[l]??"").trim()!==""&&!s.has(l))return!0;return!1}var Ae=/\.(?:[cm]?[jt]sx?)$/i;function Ge(e){let i=new Set,t=!1;for(let n=0;n<e.length;n+=1){let o=e[n].trim();!t&&je(o)&&(t=!0),t&&(i.add(n),o.endsWith(";")&&(t=!1))}return i}function je(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}import{existsSync as Be,readFileSync as Ee,writeFileSync as Le}from"fs";import{isAbsolute as Ke,join as Ne}from"path";var Me=75e3,Pe=5e3,Ie=2500;function He(e){let i=re(e);return i.symbols>=Me||i.documents>=Pe?Ie:void 0}var _e=".scipquery-baseline.json";function j(e,i){return i&&Ke(i)?i:Ne(e.config.projectRoot,i??_e)}function de(e,i={}){let{scope:t}=i,n=He(e),o=[],s=Z(e,{scope:t,...S.dead,scanLimit:n});for(let r of s.symbols)F(e,r.relativePath)||v(e,r.symbol,r.relativePath)||r.kind==="dead-code"&&o.push(`dead:${r.relativePath}:${r.shortName}`);for(let r of ee(e,{scope:t,...S.isolated,scanLimit:n}))F(e,r.relativePath)||v(e,r.symbol,r.relativePath)||o.push(`isolated:${r.relativePath}:${r.shortName}`);for(let r of J(e,{scope:t}))r.kind==="real"&&o.push(`cycle:${ze(r.path)}`);for(let r of ne(e,{scope:t,...S.similar,scanLimit:n}))o.push(`similar:${[r.symbolA,r.symbolB].sort().join("|")}`);for(let r of X(e,{scope:t,...S.extract,scanLimit:n}))o.push(`extract:${r.relativePath}:${r.shortName}`);for(let r of se(e,{scope:t,...S.wrappers,scanLimit:n}))o.push(`wrapper:${r.file}:${r.shortName}`);for(let r of te(e,{scope:t,...S.passthroughs,scanLimit:n}))o.push(`passthrough:${r.file}:${r.shortName}`);for(let r of oe(e,{scope:t,...S.stale,scanLimit:n}))o.push(`stale:${r.file}:${r.shortName}`);for(let r of Q(e,{scope:t,...S.drift,includePatternDeviations:!1}).results)o.push(`drift:${r.kind}:${r.file}:${r.dep}`);return[...new Set(o)].sort()}function ze(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 Pt(e,i={}){let t=de(e,{scope:i.scope}),n=j(e,i.path);return Le(n,JSON.stringify({version:1,findings:t},null,2)+`
|
|
3
|
+
`),{path:n,findingCount:t.length}}function ue(e,i={}){let t=j(e,i.path);if(!Be(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let n=JSON.parse(Ee(t,"utf-8")),o=new Set(n.findings??[]),s=de(e,{scope:i.scope}),r=new Set(s);return{baselinePath:t,baselineCount:o.size,current:s,newFindings:s.filter(l=>!o.has(l)),fixedFindings:[...o].filter(l=>!r.has(l))}}var ni=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function oi(e,i={}){let t=i.base??"HEAD",{minTogether:n=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:r=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:a=!1,scanLimit:c}=i,y=i.semantic!==!1,h=new Set(i.skip??[]),f=q(e,{base:t}),p=V(e,{base:t,plan:f}),m=p.changedFiles,d=new Set(m),u=new Set(f.changedFileLines),b=new Set([...d,...u]),C=L(e.config.projectRoot,t,K(f,m)),R=mt(e.config.projectRoot,t,f,C),g={base:t,changedFiles:m,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:p.summary.note};if(m.length===0)return g;let $=(x,pe)=>{if(h.has(x)){g.skipped.push({check:x,reason:"skipped via --skip"});return}let ye=g.findings.length,be=g.skipped.length,Ce=g.checksRun.length;P(`diff-gate.check.${x}`,pe,()=>({check:x,changedFiles:m.length,changedSymbols:p.changedSymbols.length,findingsAdded:g.findings.length-ye,skippedAdded:g.skipped.length-be,checksRunAdded:g.checksRun.length-Ce}))};return $("echo",()=>Je(e,p.changedSymbols,d,R,s,l,c,y,g)),$("incomplete-migration",()=>rt(e,t,f,r,c,y,C,g)),$("co-change-partner",()=>st(e,b,n,o,g)),$("doc-reference",()=>dt(e,d,u,f.changedRanges,g)),$("unused-params",()=>ut(e,m,g)),$("new-dead",()=>ht(e,p.changedSymbols,R,g)),a&&$("baseline",()=>bt(e,g)),We(g,e.config.suppressions??[]),g.rootCauseGroups=Ue(g.findings),g}function Ue(e){let i=new Map;for(let t of e){let n=t.groupKey??`${t.check}:${t.id}`,o=i.get(n);o||(o={groupKey:n,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(n,o)),o.count+=1,o.findingIds.push(t.id),o.severity=Ve(o.severity,t.severity),o.actionTier=qe(o.actionTier,t.actionTier),t.file&&o.files.add(t.file);for(let s of t.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,n)=>n.count-t.count||B(n.severity)-B(t.severity)||t.groupKey.localeCompare(n.groupKey))}function Ve(e,i){return B(i)>B(e)?i:e}function B(e){return e==="error"?2:e==="warning"?1:0}function qe(e,i){return e?i&&he(i)>he(e)?i:e:i}function he(e){return e==="direct"?2:e==="signal"?1:0}function We(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let n of e.findings){let o=i.find(s=>Ye(s,n));o?e.suppressed.push({finding:n,suppression:o}):t.push(n)}e.findings=t}function Ye(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function k(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function Je(e,i,t,n,o,s,r,l,a){a.checksRun.push("echo");for(let c of i.slice(0,o)){if(!M(c.symbol)||n(c))continue;let y=ie(e,c.symbol,{minSimilarity:s,limit:5,scanLimit:r,semantic:l,sourceCandidateMode:"target-pruned"}),h=[];for(let d of y){let u=d.fileA===c.file?d.fileB:d.fileA,b=d.fileA===c.file?d.shortNameB:d.shortNameA,C=d.fileA===c.file?d.symbolB:d.symbolA;t.has(u)||h.push({otherFile:u,otherShort:b,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(h.length===0)continue;let f=h[0],p=D("echo",c.symbol,c.file,...h.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),m=Ze(c,h);k(a,{id:p,groupKey:p,actionTier:m,check:"echo",severity:"warning",evidence:"heuristic",confidence:f.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(h.map(d=>d.otherFile))].sort(),message:it(c,h),why:nt(c,h),remediation:ot(m,c.shortName,f.otherShort)})}i.length>o&&a.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function Ze(e,i){return i.some(n=>Qe(e.symbol,n))?"direct":"signal"}function Qe(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=T(e),n=T(i.otherSymbol);return!t||!n?!1:t===n?!0:tt(i.sharedEvidence)?!1:Xe(t,n)}function Xe(e,i){let t=ge(e),n=ge(i);if(t.length===0||n.length===0)return!1;let o=new Set(n),s=t.filter(r=>o.has(r)).length;return s>=2&&s/Math.min(t.length,n.length)>=.5}function ge(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var et=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function tt(e){return e.length>=3&&e.every(i=>et.has(i.toLowerCase()))}function it(e,i){let t=i[0],n=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${n}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${n}% similar to ${t.otherShort} (${t.otherFile})`}function nt(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let n of i.slice(0,3))t.push(`${n.otherShort} is outside this diff and scored ${Math.round(n.similarity*100)}% similar by ${n.similarityBasis} evidence.`),t.push(`Shared evidence: ${n.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function ot(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function rt(e,i,t,n,o,s,r,l){let a=ae(e,{base:i,maxHelpers:n,diffPlan:t,scanLimit:o,semantic:s,baseContentAt:r});if(!a.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),a.note&&l.skipped.push({check:"incomplete-migration",reason:a.note});for(let c of a.findings){let y=c.leftovers.map(u=>`${u.shortName} (${u.file}, ${Math.round(u.containment*100)}% helper / ${Math.round(u.siteCoverage*100)}% site, ${u.migrationScope})`).join(", "),h=c.leftovers.map(u=>`${u.shortName}: ${u.migrationScope} (${u.migrationScopeReasons[0]})`).join("; "),f=[...c.migratedFiles,...c.leftovers.map(u=>u.file)],p=c.leftovers.length===0?void 0:Math.max(...c.leftovers.map(u=>Math.min(u.containment,u.siteCoverage))),m=c.leftovers.some(u=>u.migrationScope==="possible-subtype"),d=D("incomplete-migration",c.helperSymbol,c.helperFile,f.join("|"));k(l,{id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:c.helperFile,symbol:c.helperSymbol,relatedFiles:f,message:`new helper ${c.helperShortName} (${c.helperFile}) is wired into ${c.migratedFiles.length} file(s), but ${c.leftovers.length} similar un-migrated site(s) remain: ${y}`,why:[`${c.helperShortName} is new in this diff and already referenced by ${c.migratedFiles.join(", ")}.`,`Helper shape: ${c.helperShape}; ${c.specificHelperCalleeCount}/${c.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${y}.`,`Migration scope hints: ${h}.`],remediation:m?`Migrate same-scope sites to ${c.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${c.helperShortName}, or confirm they are intentionally different.`})}}function st(e,i,t,n,o){let s=H(e,i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let r=new Set,l;for(let a of s){let c=i.has(a.fileA),y=i.has(a.fileB);if(c===y)continue;let h=c?a.fileA:a.fileB,f=c?a.fileB:a.fileA,p=c?a.changesA:a.changesB,m=p>0?a.together/p:0;if(m<n||E(f)||E(h)||!me(`${e.config.projectRoot}/${f}`))continue;let d=`${h}|${f}`;if(r.has(d))continue;r.add(d);let u=D("co-change-partner",h,f,String(a.together)),b=_(h,f),C=z({fileA:h,fileB:f,together:a.together,confidence:m,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,(l??=O(e))(h,f)),R=[h,f].sort().join("|");o.findings.push({id:u,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${R}`,confidence:m,file:h,relatedFiles:[f],sourceAnalyzer:"co-change",rootCauseKey:R,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${h} changed, but ${f} did not \u2014 they change together ${a.together}x (${Math.round(m*100)}% of the time)`,why:[`${h} is in this diff and ${f} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${at(a)}.`,`Subject context: ${ct(a.subjectContext)}.`,...lt(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:C?`Update ${f} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${f} alongside this change, or confirm the coupling no longer holds.`})}}function at(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${ft(e.lastTogetherAt)}`}function ct(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",n=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${n}; external issue/PR labels ${e.externalIssueLabelStatus}`}function lt(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function ft(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function dt(e,i,t,n,o){o.checksRun.push("doc-reference");let s=w.referenceTargets(e,i,n);if(s.size!==0)for(let r of Y(e,s)){if(t.has(r.doc))continue;let l=r.citedClaims.length>0?r.citedClaims:w.citationContexts(e,r.doc,r.cited),a=w.classifyCitation(l),c=D("doc-reference",r.doc,r.cited.join("|"));k(o,{id:c,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:r.doc,relatedFiles:r.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:l,message:`${r.doc} cites ${r.cited.join(", ")} as ${w.citationKindLabel(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${r.cited.join(", ")} changed in this diff.`,`${r.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(y=>`Citation kind evidence: ${y}`)],remediation:w.citationRemediation(a.citationKind,r.doc)})}}function ut(e,i,t){t.checksRun.push("unused-params");for(let n of ce(e,{files:i,limit:50})){let o=D("unused-params",n.symbol,n.file,n.unusedTrailing.join("|"));k(t,{id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:n.file,startLine:n.startLine,endLine:n.endLine,symbol:n.symbol,message:`${n.shortName} (${n.file}) has trailing unused parameter(s): ${n.unusedTrailing.join(", ")}`,why:[`${n.shortName} is in a changed file.`,`The trailing parameter(s) ${n.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function ht(e,i,t,n){n.checksRun.push("new-dead");let o=new I(e);for(let s of i){if(t(s)||s.fanIn>0||o.fileKind(s.file)==="test"||F(e,s.file)||v(e,s.symbol,s.file)||gt(s.symbol))continue;let r=D("new-dead",s.symbol,s.file);k(n,{id:r,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:"Wire it up, or remove it before it becomes permanent dead code."})}}function gt(e){if(N(e)!=="type")return!1;let i=T(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function mt(e,i,t,n){let o=new Map(t.renamedFiles.map(r=>[r.to,r.from])),s=n??L(e,i,K(t));return r=>{let l=o.get(r.file)??r.file,a=T(r.symbol);if(!a)return!1;let c=s(l);return c!==null&&pt(c,a)}}function pt(e,i){return new RegExp(`\\b${yt(i)}\\b`).test(e)}function yt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bt(e,i){if(!me(j(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=ue(e);for(let n of t.newFindings){let o=le(n),s=D("baseline",n);k(i,{id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${n}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation})}}function D(e,...i){return`SQ${Oe("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{de as a,Pt as b,ue as c,ni as d,oi as e,mt as f};
|
|
4
|
+
//# sourceMappingURL=chunk-G5UPYQGL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as b}from"./chunk-PFOCOG57.js";import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as b}from"./chunk-PFOCOG57.js";import{a as u}from"./chunk-5OST6GYB.js";import{c as p}from"./chunk-JM72FNGA.js";function C(e,r){let{scope:c,minLoc:l=10,limit:s=30,scanLimit:a}=r??{},o=new u(e);return b({candidates:()=>o.productionCallableDefinitions({scope:c,minLoc:l,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:o.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:o.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>d(t,n,l),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:s})}function d(e,r,c){let l=e.endLine-e.startLine+1;if(l<c)return null;let s=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],o=new Set,t=new Set;for(let m of a){let i=`${m.symbol}|${m.file}`;o.add(i),m.file!==e.relativePath&&t.add(i)}let n=t.size,y=o.size;return{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:l,fanIn:s,fanOut:n,calleeCount:y,score:Math.round(l/50*(s/5)*Math.max(n/5,1)*100)/100}}export{C as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GQBMH2TQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as p}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-5OST6GYB.js";import{a as f}from"./chunk-RNM6LMCF.js";import{a as c}from"./chunk-JCLDUKT6.js";import{c as m}from"./chunk-JM72FNGA.js";function k(o,n={}){let{limit:s=20,scope:i,minFanIn:r=2,minFanOut:a=2,scanLimit:e}=n,u=new b(o);return p(u.productionCallableDefinitions({scope:i,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof e=="number"&&e>0}),e).map(t=>d(o,t,n.semantic!==!1)).filter(t=>t.fanIn>=r&&t.fanOut>=a).sort((t,l)=>l.score-t.score||l.fanIn-t.fanIn).slice(0,s)}function d(o,n,s){let i=new Set(f(o,n,{limit:500,semantic:s}).map(e=>e.file)).size,r=new Set(c(o,n,{limit:500,semantic:s}).filter(e=>e.file!==n.relativePath).map(e=>`${e.symbol}|${e.file}`)).size,a=i*r;return{symbol:n.symbol,shortName:m(n.symbol),fanIn:i,fanOut:r,score:a,definedIn:n.relativePath,actionTier:"signal",riskKind:"coordination-hotspot",evidenceReasons:[`${i} incoming file(s) reference this symbol`,`${r} distinct cross-file callee symbol(s) are reached from it`,`centrality score is ${a} (fan-in * fan-out)`],recommendation:"Review ownership, API stability, and caller groups before changing this central symbol; do not refactor solely from graph centrality."}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IHUETYFW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{b as k}from"./chunk-
|
|
1
|
+
import{b as k}from"./chunk-USPV3T5K.js";import{a as D}from"./chunk-5OST6GYB.js";import{f as y,g as v}from"./chunk-C5CTSJ6X.js";import{p as S}from"./chunk-KDFONWTW.js";import{f as L}from"./chunk-2KHTSEIL.js";import{c as h}from"./chunk-JM72FNGA.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)||y(e,l.relativePath)||v(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:h(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"&&(y(e,t.relativePath)||v(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:h(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-JATUZIEH.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{b as J,g as B,h as W,i as U,p as Y}from"./chunk-KDFONWTW.js";import{a as K,b as z,d as Q,f as V}from"./chunk-OLTESY4K.js";import{a as q,b as C}from"./chunk-TQ5W2H3S.js";import{a as x}from"./chunk-VUKC6F77.js";import{f as H,g as $,l as j,m as G}from"./chunk-2KHTSEIL.js";import{d as F,f as P}from"./chunk-JM72FNGA.js";import{d as E}from"./chunk-72KY2ZFO.js";import{a as T}from"./chunk-HF25DFSC.js";import{a as R}from"./chunk-DS6QEB3G.js";import{a as k,b as w,f as N,h as O}from"./chunk-XUGQU7PM.js";import{c as A,d as D}from"./chunk-7S5E7KWT.js";function De(e,n,l={}){let o=X(e,[n],{additive:l.additive,semantic:l.semantic}),i=l.callableOnly?(o.get(n.symbolId)??[]).filter(a=>P(a.symbol)):o.get(n.symbolId)??[];return typeof l.limit=="number"?i.slice(0,l.limit):i}function ke(e,n,l={}){let o=oe(e)?le(e,n,{semantic:l.semantic!==!1}):ie(e).get(n.symbolId)??[];return typeof l.limit=="number"?o.slice(0,l.limit):o}var ne=D("caller-rows",{clearGroups:["whole-project"]}),te=2e4;function oe(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>te}function ie(e){return ne.get(e,()=>{let n=$(e),l=X(e,n),o=new Map;for(let r of n)o.set(r.symbol,r.symbolId);let i=new Map,a=new Map;for(let r of n){let s=l.get(r.symbolId);if(!(!s||s.length===0))for(let u of s){let m=o.get(u.symbol);if(m===void 0||m===r.symbolId)continue;let d=i.get(m);d||(d=[],i.set(m,d),a.set(m,new Set));let f=`${r.symbol}|${r.relativePath}`;a.get(m).has(f)||(a.get(m).add(f),d.push({symbol:r.symbol,file:r.relativePath,source:"caller-map-inversion"}))}}return i})}function le(e,n,l){let o=[],i=new Set,a=s=>{if(s.symbol===n.symbol)return;let u=`${s.symbol}|${s.file}`;i.has(u)||(i.add(u),o.push(s))};for(let s of Y(e,n))s.file!==n.relativePath&&a({symbol:s.enclosingSymbol??s.file,file:s.file,source:"resolved-reference"});let r=l.semantic?se(e,n):null;if(r)for(let s of Q(e,r)){if(s.file===n.relativePath||e.isIgnored(s.file))continue;let u=G(H(e,s.file),s.line);a({symbol:u?.symbol??s.file,file:s.file,source:"semantic-reference"})}return o}function se(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 X(e,n,l={}){if(n.length===0)return new Map;let o=l.additive??!1,i=[],a=[];for(let d of n)T(d.relativePath)&&E(e,d.relativePath)!==null?i.push(d):a.push(d);let r=new Map,s=new Map,u=d=>{for(let[f,t]of d){let g=r.get(f);g||(g=[],r.set(f,g));let c=s.get(f);c||(c=new Set,s.set(f,c));for(let p of t){let h=`${p.symbol}|${p.chunkId}`;c.has(h)||(c.add(h),g.push(p))}}};i.length>0&&u(de(e,i)),l.semantic!==!1&&u(be(ae(e,n)));let m=o?n:a;return m.length>0&&u(pe(e,m)),r}function ae(e,n){let l=q(),o=new Map,i=[],a=[],r=0,s=0,u=0,m=0;if(C("semantic.callees.cache-scan",()=>{for(let c of n){if(!K(c.relativePath)){l&&(r+=1);continue}let p=R(e,c.relativePath);if(!p){l&&(s+=1),a.push(c);continue}let h=w(e,c.relativePath,p),_=me(e,c.relativePath),b=N(e,c.relativePath,c.symbol,h,_);if(b!==null){let y=ce(b);if(y){l&&(u+=1),y.length>0&&o.set(c.symbolId,y);continue}l&&(m+=1)}i.push({def:c,contentHash:h,depsDigest:_})}},()=>({definitions:n.length,skippedNonTs:r,sourceMissing:s,cacheHits:u,parseFailures:m,misses:i.length,unkeyed:a.length,resultRows:o.size})),i.length===0&&a.length===0)return o;let d=[...a,...i.map(c=>c.def)],f=0,t=C("semantic.callees.compute-misses",()=>{let c=V(e,d);return f=c.size,c},()=>({definitions:d.length,misses:i.length,unkeyed:a.length,rows:f}));for(let[c,p]of t)o.set(c,p);if(z(e).availability().available){let c=i.map(p=>({relativePath:p.def.relativePath,symbol:p.def.symbol,contentHash:p.contentHash,depsDigest:p.depsDigest,payload:JSON.stringify(t.get(p.def.symbolId)??[])}));C("semantic.callees.cache-write",()=>O(e,c),()=>({entries:c.length}))}else C("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:i.length}));return o}function ce(e){try{return JSON.parse(e)}catch{return null}}var re=A("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function me(e,n){return re.get(e,n,()=>{let o=[...x(e).get(n)??[]].sort().map(i=>`${i}:${w(e,i,R(e,i))}`);return k(o.join("|"))})}function de(e,n){let l=new Map,o=ue(n,l),i=U(e);for(let[a,r]of o){let s=E(e,a);if(!s)continue;let u=j(r);for(let m of s){let d=u.get(m.line);if(!d)continue;let f=fe(e,a,i,m.calleeLeaf,m.memberAccess);f&&f.symbol!==d.symbol&&l.get(d.symbolId).push({symbol:f.symbol,file:f.file,chunkId:m.line,source:"ast-callsite"})}}return l}function ue(e,n){let l=new Map;for(let o of e){let i=l.get(o.relativePath);i?i.push(o):l.set(o.relativePath,[o]),n.set(o.symbolId,[])}for(let o of l.values())o.sort((i,a)=>i.endLine-i.startLine-(a.endLine-a.startLine));return l}function fe(e,n,l,o,i){let a=B(n,l.get(o)??[]);return a.length===0?null:W(e,n,a,i)}function pe(e,n){if(n.length===0)return new Map;let o=L(n.map(t=>t.documentId)).flatMap(t=>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
|
|
24
|
+
AND c.document_id IN (${t.map(()=>"?").join(",")})`,...t)),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 r=L(o.map(t=>t.symbol_id)).flatMap(t=>e.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
25
|
+
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
26
|
+
FROM global_symbols gs
|
|
27
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
28
|
+
LEFT JOIN (
|
|
29
|
+
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
30
|
+
FROM mentions m
|
|
31
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
32
|
+
WHERE m.role = 1
|
|
33
|
+
AND m.symbol_id IN (${t.map(()=>"?").join(",")})
|
|
34
|
+
GROUP BY m.symbol_id
|
|
35
|
+
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
|
+
WHERE gs.id IN (${t.map(()=>"?").join(",")})`,...t,...t)),s=L([...n.map(t=>t.documentId),...r.flatMap(t=>t.document_id===null?[]:[t.document_id])]),u=new Map(s.flatMap(t=>e.all(`SELECT id, relative_path FROM documents
|
|
37
|
+
WHERE id IN (${t.map(()=>"?").join(",")})`,...t).map(g=>[g.id,g.relative_path]))),m=new Map;for(let t of r)m.has(t.symbol_id)||m.set(t.symbol_id,{symbol:t.symbol,file:t.document_id!==null?u.get(t.document_id)??"":""});let d=new Map,f=u;for(let t of n){let g=i.get(t.documentId)??[],c=new Set,p=[],h=null,_=()=>{if(h)return h;let b=f.get(t.documentId)??"",y=new Set;if(b){let M=J(e,b),I=Math.max(0,t.startLine),v=Math.min(M.length-1,t.endLine);for(let S=I;S<=v;S+=1)for(let ee of M[S])y.add(ee)}return h=y,y};for(let b of g){if(b.symbol_id===t.symbolId)continue;let y=m.get(b.symbol_id);if(!y)continue;if(!(b.start_line>=t.startLine&&b.end_line<=t.endLine)){if(!(b.start_line<=t.endLine&&b.end_line>=t.startLine))continue;let S=F(y.symbol);if(!S||!_().has(S))continue}let I=`${y.symbol}|${b.chunk_id}`;c.has(I)||(c.add(I),p.push({...y,chunkId:b.chunk_id,source:"scip-chunk"}))}d.set(t.symbolId,p)}return d}var Z=500;function L(e){let n=[...new Set(e)],l=[];for(let o=0;o<n.length;o+=Z)l.push(n.slice(o,o+Z));return l}function be(e){let n=new Map;for(let[l,o]of e){let i=[];for(let a of o)i.push({symbol:a.symbol,file:a.file,chunkId:-1,source:"semantic-callee"});n.set(l,i)}return n}export{De as a,ke as b,X as c};
|
|
38
|
+
//# sourceMappingURL=chunk-JCLDUKT6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as I}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as I}from"./chunk-54KGX7EX.js";import{a as H}from"./chunk-LSET2TXH.js";import{a as p}from"./chunk-JME7OWD3.js";import{a as T}from"./chunk-ZQDIXAF5.js";import{a as G}from"./chunk-VOYOYC5T.js";import{a as k}from"./chunk-BFXPG2VN.js";import{a as v,b as F}from"./chunk-6LJHXREW.js";import{b as D}from"./chunk-65AU3HFZ.js";import{b as S}from"./chunk-BSN22NRK.js";import{a as j}from"./chunk-6IR2AOBM.js";import{a as w}from"./chunk-VCQYSG2M.js";import{a as P}from"./chunk-7TWLSZK5.js";import{a as A}from"./chunk-Z4HICZGY.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?H(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?P(t,e,{semantic:l}):null,f=s?j(t,e,{semantic:l}):null,h=s?k(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,C=s?w(t,e,{maxDepth:o,scope:n.scope}):[],i=A(t,e,{semantic:l}),d=v(t,e),g=F(t,e),u=I(t,e),x=T(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||C.length>0,file:i!==null||d.length>0||g.length>0,module:u.files.length>0||u.symbols.length>0||x.length>0},b=[];!c.symbol&&!c.file&&!c.module&&b.push("No symbol, file, or module matched target.");let B=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:O(t,B),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:C,changeSurface:i,deps:d,rdeps:g,system:u,surface:x,warnings:b}}function O(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=S(t);if(!o)return n;let r=D(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence,subjectContext:l.subjectContext})),suppressionsInFile:G(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JGN2ZFJR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-5OST6GYB.js";import{a as h}from"./chunk-JCLDUKT6.js";import{q as S}from"./chunk-KDFONWTW.js";import{a as d,b}from"./chunk-TK7O5ER5.js";import{m as y}from"./chunk-2KHTSEIL.js";import{c as m}from"./chunk-JM72FNGA.js";function v(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=d(e,o);return r?c==="backward"?w(e,r,s,{semantic:l.semantic!==!1}):M(e,r,{semantic:l.semantic!==!1}):null}function w(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let p of t){let g=h(e,p,{semantic:c.semantic});for(let a of g){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function M(e,o,l){let c=new Set,s=[],r=new u(e);for(let t of S(e,o,{semantic:l.semantic})){if(s.length>=30)break;let n=t.enclosingSymbol??y(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JME7OWD3.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as F}from"./chunk-
|
|
1
|
+
import{d as F}from"./chunk-OLTESY4K.js";import{c as R}from"./chunk-TK7O5ER5.js";import{b as h}from"./chunk-P5RYBRIO.js";import{u as w}from"./chunk-OBGRLXWF.js";import{f as y,m as _}from"./chunk-2KHTSEIL.js";import{d}from"./chunk-JM72FNGA.js";import{a as S}from"./chunk-72KY2ZFO.js";import{a as k}from"./chunk-HF25DFSC.js";import{a as m}from"./chunk-DS6QEB3G.js";import{c as E}from"./chunk-A536TEU4.js";import{c as u,d as v}from"./chunk-7S5E7KWT.js";function I(e,t,n,r={}){if(!n)return[];let i=m(e,t);return i?i.indexOf(n)===-1?[]:(N(e,t).get(n)??[]).filter(s=>!J(s,r)):[]}function J(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var U=u("file-identifiers",{clearGroups:["whole-project","source-file"]});function A(e,t){let n=S(e,t);return n?n.fileIdentifiers:U.get(e,t,()=>new Set(N(e,t).keys()))}var Z=u("file-ident-lines",{clearGroups:["whole-project","source-file"]});function N(e,t){let n=S(e,t);return n?n.identifierLineMap:Z.get(e,t,()=>Y(e,t))}var W=u("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function me(e,t){let n=S(e,t);return n?n.identifiersByLine:W.get(e,t,()=>{let r=N(e,t),i=0;for(let s of r.values()){let o=s[s.length-1];o!==void 0&&o>i&&(i=o)}let a=new Array(i+1);for(let s=0;s<=i;s+=1)a[s]=new Set;for(let[s,o]of r)for(let c of o)a[c].add(s);return a})}function Y(e,t){let n=new Map,r=(o,c)=>{let l=n.get(o);if(!l){n.set(o,[c]);return}l[l.length-1]!==c&&l.push(c)},i=m(e,t);if(!i)return n;let a=w(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let o=0;o<a.length;o+=1){let c=a[o]??"";for(let l of c.matchAll(s))l[1]&&r(l[1],o)}return n}function pe(e,t){return x(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
|
|
2
2
|
m.symbol_id,
|
|
3
3
|
d.relative_path,
|
|
4
4
|
COUNT(*) AS ref_count
|
|
@@ -37,4 +37,4 @@ import{d as F}from"./chunk-4KTOV4QN.js";import{c as R}from"./chunk-PTQVNJ4Q.js";
|
|
|
37
37
|
) mention_doc ON mention_doc.symbol_id = gs.id
|
|
38
38
|
WHERE 1 = 1
|
|
39
39
|
${e.symbolNoiseFor("gs")}`),n=new Map;for(let r of t){if(!r.relative_path||e.isIgnored(r.relative_path))continue;let i=d(r.symbol);if(!i)continue;let a=n.get(i);a||(a=[],n.set(i,a)),a.some(s=>s.symbolId===r.id)||a.push({symbol:r.symbol,symbolId:r.id,file:r.relative_path})}return n})}var j=/[A-Za-z_$][A-Za-z0-9_$]*/g,q=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function M(e){let t=[],n=!1;for(let r of e)r&&(n=!0,q.test(r)||t.push(r));return{candidateNames:e,hasUsableCandidate:n,nonIdentifierNames:t}}function B(e,t){let n=K(t)?t:M(t);if(n.candidateNames.size===0||!n.hasUsableCandidate)return!0;j.lastIndex=0;let r;for(;(r=j.exec(e))!==null;)if(n.candidateNames.has(r[0]))return!0;for(let i of n.nonIdentifierNames)if(e.includes(i))return!0;return!1}function K(e){return"candidateNames"in e}function D(e,t,n){let r=C(e).get(n);if(!r||r.length===0)return[];if(r.length===1)return[g(r[0])];let i=r.filter(c=>c.file===t);if(i.length>0)return i.map(g);let a=P(e,t),s=a.get(n);if(s)for(let c of s){let l=r.filter(f=>p(c,f.file));if(l.length>0)return l.map(g)}let o=new Set;for(let c of a.values())for(let l of c)o.add(l);for(let c of o){let l=r.filter(f=>p(c,f.file));if(l.length>0&&l.length===r.length)return l.map(g)}return[]}function Ge(e,t,n){let r=D(e,t,n);if(r.length>0)return r;let i=C(e).get(n);return!i||i.length===0?[]:i.map(g)}function G(e,t,n={}){let r=R(e,t);if(!r)return[];let i=d(r.symbol);if(!i)return[];if(n.semantic!==!1){let s=F(e,{...r,leaf:i,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let o=new Map;for(let c of s){let l=o.get(c.file)??[];l.push(c.line),o.set(c.file,l)}return H(e,o)}}let a=new Map;for(let s of E(e)){let o=m(e,s);if(!o||o.indexOf(i)===-1||s!==r.relativePath&&!D(e,s,i).some(f=>f.symbolId===r.symbolId))continue;let c=I(e,s,i,s===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{});c.length>0&&a.set(s,c)}return H(e,a)}function ze(e,t){let n=new Map;for(let o of t){if(!o.leaf)continue;let c=n.get(o.leaf)??[];c.push(o),n.set(o.leaf,c)}if(n.size===0)return new Map;let r=new Set(t.map(o=>o.symbolId)),i=new Set(n.keys()),a=M(i),s=new Map;for(let o of E(e)){if(!B(m(e,o),a))continue;let c=A(e,o);if(c.size!==0){for(let l of c)if(n.has(l))for(let f of D(e,o,l)){if(!r.has(f.symbolId)||o===f.relativePath)continue;let b=s.get(f.symbolId);b||(b=new Set,s.set(f.symbolId,b)),b.add(o)}}}return s}function g(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function H(e,t){let n=[],r=new Set;for(let[i,a]of t){let s=y(e,i);for(let o of a){let c=_(s,o),l=`${i}|${o}|${c?.symbol??""}`;r.has(l)||(r.add(l),n.push({file:i,line:o,enclosingSymbol:c?.symbol??null}))}}return n}function ee(e,t){let n=se(e,t);return n?ae(e,te(e,n.match,n.identifier)):[]}function Xe(e,t,n={}){return ne(e,t,n).map(r=>({file:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol}))}function ne(e,t,n={}){let r=G(e,t,{semantic:n.semantic}),i=r.length>0?z(r,"source-attribution"):z(ee(e,t),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(a=>!e.isIgnored(a.file))}function z(e,t){return e.map(n=>({...n,provenance:t}))}function te(e,t,n){let r=new Map;for(let[i,a]of re(e,t.symbolId))r.set(i,ie(e,i,a,t,n));return r}function re(e,t){let n=new Map;for(let r of O(e,[t])){if(e.isIgnored(r.relative_path))continue;let i=n.get(r.relative_path);i||(i=[],n.set(r.relative_path,i)),i.push({start_line:r.chunk_start,end_line:r.chunk_end})}return n}function ie(e,t,n,r,i){let a=t===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{},s=i?I(e,t,i,a):[];return n.flatMap(o=>oe(s,o))}function oe(e,t){let n=e.filter(r=>r>=t.start_line&&r<=t.end_line);return n.length>0?n:[t.start_line]}function se(e,t){let n=R(e,t);return n?{match:n,identifier:d(n.symbol)||null}:null}function ae(e,t){let n=[],r=new Set;for(let[i,a]of t){let s=y(e,i);for(let o of a){let c=_(s,o),l=`${i}|${o}|${c?.symbol??""}`;r.has(l)||(r.add(l),n.push({file:i,line:o,enclosingSymbol:c?.symbol??null}))}}return n}export{N as a,me as b,pe as c,ge as d,O as e,p as f,Ce as g,Me as h,C as i,M as j,B as k,P as l,D as m,Ge as n,ze as o,ee as p,Xe as q};
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-KDFONWTW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{q as f}from"./chunk-
|
|
1
|
+
import{q as f}from"./chunk-KDFONWTW.js";import{a as d}from"./chunk-TK7O5ER5.js";import{c as m,d as g}from"./chunk-2KHTSEIL.js";import{c as s,g as u}from"./chunk-JM72FNGA.js";import{a as c}from"./chunk-DS6QEB3G.js";function E(e,r,i={}){let n=d(e,r);if(!n)return{definitions:[],referencedBy:[]};let t=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),a=g(t?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:y(a,t?.display_name??null,n.symbol),source:S(e,n.relativePath,n.startLine,n.endLine)}],b=f(e,n,{semantic:i.semantic}).map(l=>({relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?s(l.enclosingSymbol):"(top-level)"}));return{definitions:o,referencedBy:b}}function S(e,r,i,n){let t=c(e,r);if(!t)return null;let o=t.split(`
|
|
2
2
|
`).slice(i,n+1).join(`
|
|
3
3
|
`).trimEnd();return o.length>0?o:null}function y(e,r,i){let n=m(e);if(n&&!p(n))return n;let t=(r??"").trim();return t?u(i)&&!t.endsWith("()")?`${t}()`:t:s(i)}function p(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{E as a};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-LSET2TXH.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-PFOCOG57.js";import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-PFOCOG57.js";import{a as m}from"./chunk-5OST6GYB.js";import{a as d}from"./chunk-BGBBVSH4.js";import{c as u}from"./chunk-JM72FNGA.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-M4COR2H6.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as C}from"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-5OST6GYB.js";import{e as S}from"./chunk-OLTESY4K.js";import{c as y,f as p,h as b}from"./chunk-JM72FNGA.js";import{execFileSync as g}from"child_process";import{existsSync as v,readFileSync as E}from"fs";import{basename as F}from"path";function R(e){let t=new Map;for(let i of e){let n=t.get(i.file);n||(n=[],t.set(i.file,n)),n.push(i)}return t}var B="Unable to compute git diff.";function ge(e,t={}){let i=t.plan??P(e,t);return i.note?A(i.note,i.changedFileLines):i.changedFiles.length===0?O(i.changedFileLines):T(i.changedFiles,[$(e,i.changedFiles,i.changedFiles,i.changedRanges)])}function P(e,t={}){let{base:i="HEAD"}=t;try{let n=k(e.config.projectRoot,i),r=Y(e,n),s=j(e,z(e.config.projectRoot,i));return{changedFileLines:n,changedFiles:r,changedRanges:s,renamedFiles:H(e.config.projectRoot,i,r),note:n.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:B}}}function $(e,t,i,n=[]){let r=new C(e),s=new Set(i),a=R(n),o=[],d=new Map,f=t.flatMap(c=>r.definitionsForFile(c)).filter(te).filter(c=>Z(c,a)).sort((c,m)=>c.relativePath.localeCompare(m.relativePath)||c.startLine-m.startLine),l=f.map(c=>c.symbolId),u=X(e,l),M=ee(e,l,i),N=S(e,f.filter(c=>u.get(c.symbolId)===0));for(let c of f)Q(e,c,s,o,d,N.get(c.symbolId)??new Set,u.get(c.symbolId)??0,M.get(c.symbolId)??new Set);return{changedSymbols:o,consumerEntries:[...d.entries()].map(([c,m])=>({file:c,symbols:[...m].sort()}))}}function T(e,t){let i=new Map,n=t.flatMap(s=>s.changedSymbols);for(let s of t)for(let a of s.consumerEntries){let o=i.get(a.file);o||(o=new Set,i.set(a.file,o));for(let d of a.symbols)o.add(d)}let r=ne(i);return{changedFiles:[...e],changedSymbols:n,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:n.length,totalAffectedFiles:r.length}}}function A(e,t=[]){return{changedFiles:t,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:t.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function O(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function k(e,t){let i=g("git",["diff","--name-only",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--name-only","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4}),r=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([i,n,r].flatMap(s=>s.split(`
|
|
2
2
|
`)).map(s=>s.trim()).filter(s=>s.length>0))]}function z(e,t){let i=g("git",["diff","--unified=0",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--unified=0","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4});return _([...D(i),...D(n)])}function h(e,t,i){try{return g("git",["show",`${t}:./${i}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function ue(e,t,i=[]){let n=W(e,t,i);return r=>(n.has(r)||n.set(r,h(e,t,r)),n.get(r)??null)}function me(e,t=e.changedFiles){let i=new Map(e.renamedFiles.map(n=>[n.to,n.from]));return[...new Set(t.map(n=>i.get(n)??n))]}function W(e,t,i){let n=[...new Set(i)],r=new Map;if(n.length===0)return r;try{let s=n.map(o=>`${t}:./${o}
|
|
3
3
|
`).join(""),a=g("git",["cat-file","--batch"],{cwd:e,input:s,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]});return U(a,n)}catch{for(let s of n)r.set(s,h(e,t,s));return r}}function U(e,t){let i=new Map,n=0;for(let r of t){let s=e.indexOf(10,n);if(s<0)throw new Error("git cat-file batch output ended before object header");let a=e.subarray(n,s).toString("utf-8");if(n=s+1,a.endsWith(" missing")){i.set(r,null);continue}let o=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(a);if(!o)throw new Error(`unexpected git cat-file batch header: ${a}`);let[,d,f]=o,l=Number(f);if(!Number.isFinite(l)||l<0)throw new Error(`unexpected git cat-file batch size: ${a}`);if(n+l>e.length)throw new Error("git cat-file batch output ended before blob payload");let u=e.subarray(n,n+l);i.set(r,d==="blob"?u.toString("utf-8"):null),n+=l,e[n]===10&&(n+=1)}return i}function H(e,t,i){if(i.length===0)return[];let n=new Map,r=new Set;for(let a of q(e,t))i.includes(a.to)&&(n.set(a.to,a),r.add(a.from));let s=J(e,t);if(s.length===0)return[...n.values()].sort((a,o)=>a.to.localeCompare(o.to));for(let a of i){if(n.has(a)||!v(`${e}/${a}`))continue;let o=s.filter(l=>!r.has(l)).filter(l=>F(l)===F(a));if(o.length===0)continue;let d=E(`${e}/${a}`,"utf-8"),f=o.map(l=>({from:l,to:a,similarity:G(h(e,t,l)??"",d)})).sort((l,u)=>u.similarity-l.similarity)[0];f&&f.similarity>=.45&&(n.set(a,f),r.add(f.from))}return[...n.values()].sort((a,o)=>a.to.localeCompare(o.to))}function J(e,t){let i=g("git",["diff","--name-only","--diff-filter=D",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--name-only","--diff-filter=D","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([...w(i),...w(n)])]}function q(e,t){let i=g("git",["diff","--name-status","--find-renames",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--name-status","--find-renames","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4});return[...i.split(`
|
|
4
4
|
`),...n.split(`
|
|
@@ -18,4 +18,4 @@ import{a as C}from"./chunk-GBEYTDY5.js";import{e as S}from"./chunk-4KTOV4QN.js";
|
|
|
18
18
|
AND m.role != 1
|
|
19
19
|
AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
|
|
20
20
|
${e.pathExclusionsFor("ref_d")}`,...t,...i),r=new Map;for(let s of n){let a=r.get(s.symbol_id);a||(a=new Set,r.set(s.symbol_id,a)),a.add(s.relative_path)}return r}function L(e,t,i,n,r){if(e.isIgnored(n)||t.has(n))return;let s=i.get(n);s||(s=new Set,i.set(n,s)),s.add(r)}function ne(e){return[...e.entries()].map(([t,i])=>({file:t,consumedSymbols:i.size})).sort((t,i)=>i.consumedSymbols-t.consumedSymbols)}function te(e){return!(b(e.symbol)||e.parentTypeName!==null&&!p(e.symbol))}function ie(e,t){return p(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&t>0}export{R as a,B as b,ge as c,P as d,$ as e,T as f,h as g,ue as h,me as i,W as j};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-NOJAM5ZV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as h}from"./chunk-B75HZHUP.js";import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as h}from"./chunk-B75HZHUP.js";import{a as u}from"./chunk-5OST6GYB.js";import{a as o}from"./chunk-BGBBVSH4.js";import{e as p}from"./chunk-OLTESY4K.js";import{c as y}from"./chunk-JM72FNGA.js";function W(m,c={}){let{scope:I,minLoc:C=3,scanLimit:r}=c,s=new u(m),d=c.semantic!==!1,b=h(s.productionCallableDefinitions({scope:I,minLoc:C,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof r=="number"&&r>0}),r),l=s.symbolsWithNonSelfCallees(b,{additive:!1,semantic:!1}),i=b.filter(e=>!l.has(e.symbolId)),L=s.crossFileCallerMap(i,{semantic:!1}),a=new Set(L.keys());for(let e of s.frameworkReferencedSymbolIds(i))a.add(e);let t=i.filter(e=>!a.has(e.symbolId));if(d&&t.length>0){for(let e of p(m,t).keys())a.add(e);for(let e of s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:!0}))l.add(e);t=t.filter(e=>!a.has(e.symbolId)).filter(e=>!l.has(e.symbolId))}let S=s.sourceFallbackCallerFiles(t);for(let e of S.keys())a.add(e);let f=t.filter(e=>!a.has(e.symbolId)),v=s.symbolsWithNonSelfCallees(f,{additive:!0,semantic:d});for(let e of v)l.add(e);return f.filter(e=>!l.has(e.symbolId)).sort((e,n)=>o(n)-o(e)||e.relativePath.localeCompare(n.relativePath)||e.startLine-n.startLine).map(e=>({symbol:e.symbol,shortName:y(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{W as a};
|
|
2
|
+
//# sourceMappingURL=chunk-O6ZH6C6Y.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as k,b as S}from"./chunk-TQ5W2H3S.js";import{l as H}from"./chunk-OBGRLXWF.js";import{f as D}from"./chunk-2KHTSEIL.js";import{d as P,e as oe}from"./chunk-JM72FNGA.js";import{c as ne,g as ie,i as re}from"./chunk-XUGQU7PM.js";import{a as O}from"./chunk-64MNV6AB.js";import{a as ee,c as te}from"./chunk-7S5E7KWT.js";import{performance as m}from"perf_hooks";function b(r,t,e){if(r.has(t))return r.get(t);let n=e();return r.set(t,n),n}import se from"path";function Ae(r,t){return r.getReferences().map(e=>{let n=e.getNode();return U(n,t)})}function Oe(r){let t=r;return typeof t.findReferences=="function"?t.findReferences():[]}function ae(r,t,e,n){let i=[];for(let o of Oe(r))for(let s of Ae(o,n))s.file===t.relativePath&&s.line>=t.startLine&&s.line<=t.endLine||i.push(s);for(let o of e)i.push(o);return C(i)}function ce(r,t,e,n){let i=[],o=e?.getStart();for(let s of r.getReferences()){let a=s.getNode();N(n,a.getSourceFile().getFilePath())===t&&(o!==void 0&&a.getStart()===o||i.push({location:U(a,n),node:a}))}return i}function U(r,t){let e=r.getSourceFile(),n=e.getLineAndColumnAtPos(r.getStart());return{file:N(t,e.getFilePath())??e.getBaseName(),line:n.line-1,column:n.column-1}}function le(r,t,e){let n=r.getSourceFile(),i=$(n,r),o=r.getText(),s=new RegExp(`\\b${Ue(o)}\\b`,"g"),a=n.getFullText().split(`
|
|
2
|
+
`),c=[];for(let l=0;l<a.length;l++){if(l===i)continue;let d=a[l]??"";s.lastIndex=0;let p;for(;(p=s.exec(d))!==null;)c.push({file:t,line:l,column:p.index})}return C(c.filter(l=>N(e,se.join(e,l.file))===t))}function _(r){for(let t=r;t;t=t.getParent()){let e=t.getKindName();if(e.includes("Type")||e==="InterfaceDeclaration"||e==="TypeAliasDeclaration")return!0;if(e==="CallExpression"||e==="NewExpression"||e==="ExpressionStatement")return!1}return!1}function $(r,t){return r.getLineAndColumnAtPos(t.getStart()).line-1}function C(r){let t=new Set,e=[];for(let n of r){let i=`${n.file}:${n.line}:${n.column}`;t.has(i)||(t.add(i),e.push(n))}return e}function N(r,t){let e=se.relative(r||process.cwd(),t).replace(/\\/g,"/");return!e||e.startsWith("..")?null:e}function Ue(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(r,t,e,n){let i=We(t,n);return i.size===0?new Map:Be(r,e,i)}function We(r,t){let e=new Map;for(let n of D(r,t)){let i=P(n.symbol)??n.leaf;if(!i)continue;let o=e.get(i);o||(o=[],e.set(i,o)),o.push(n)}return e}function Be(r,t,e){let n=new Map,i=new Map;return t.forEachDescendant(o=>{for(let s of He(r,o)){let a=e.get(s);if(!a)continue;let c=$(t,o);for(let l of a){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),p=i.get(l.symbolId);p!==void 0&&p<=d||(i.set(l.symbolId,d),n.set(l.symbolId,o))}}}),n}function He(r,t){let e=[],n=i=>{i&&!e.includes(i)&&e.push(i)};if("getNameNode"in t&&typeof t.getNameNode=="function"){let i=t.getNameNode();n(i?.getText())}if("getName"in t&&typeof t.getName=="function"){let i=t.getName();n(i)}return r.Node.isIdentifier(t)&&n(t.getText()),e}var _e=te("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function de(r,t,e,n){let i=me(r,t),o=pe(i.get(n)??[],e);if(o)return o;let s=[];for(let a of i.values())for(let c of a)((c.leaf||P(c.symbol)||"").includes(n)||c.symbol.includes(n))&&s.push(c);return pe(s,e)}function ue(r,t){let e=new Map;for(let[n,i]of me(r,t)){let o=i[0];o&&e.set(n,o)}return e}function me(r,t){return _e.get(r,t,()=>{let e=new Map;for(let n of D(r,t)){let i=n.leaf||P(n.symbol);if(!i)continue;let o=e.get(i);o||(o=[],e.set(i,o)),o.push({...n,leaf:i})}for(let n of e.values())n.sort((i,o)=>i.startLine-o.startLine||i.endLine-o.endLine||i.symbolId-o.symbolId);return e})}function pe(r,t){let e=null,n=Number.POSITIVE_INFINITY;for(let i of r){let o=Math.abs(i.startLine-t);(o<n||o===n&&e&&i.startLine<e.startLine)&&(e=i,n=o)}return e}import z from"path";var T=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function R(r){let t=r.toLowerCase();return T.some(e=>t.endsWith(e))}function ge(r,t){let e=new Map,n=null,i=null,o=()=>(i??=O(r,{extensions:T}),i),s=()=>(n??=S("typescript.source-file-index",()=>$e(r.config.projectRoot,t,o()),()=>({projects:t.length,indexedDocuments:o().length})),n),a=c=>R(c)?b(e,c,()=>{let l=w(z.resolve(r.config.projectRoot,c));for(let{project:d,sourceFiles:p}of s()){let f=p.get(l)??null;if(f||(f=d.addSourceFileAtPathIfExists(l)??null,f&&p.set(w(f.getFilePath()),f)),f)return{project:d,sourceFile:f}}return null}):null;return{sourceFile:c=>a(c)?.sourceFile??null,sourceFileMatch:a,indexedTypeScriptLikeDocuments:o}}function $e(r,t,e){let n=t.map(({project:i})=>({project:i,sourceFiles:new Map(i.getSourceFiles().map(o=>[w(o.getFilePath()),o]))}));for(let i of e){let o=w(z.resolve(r,i));for(let s of n){if(s.sourceFiles.has(o))break;let a=s.project.addSourceFileAtPathIfExists(o)??null;if(a){s.sourceFiles.set(w(a.getFilePath()),a);break}}}return n}function w(r){return z.resolve(r)}import F from"path";import{existsSync as W,readdirSync as ze,readFileSync as ye}from"fs";function he(r){let t=F.join(r,"package.json");if(!W(t))return[];let e;try{e=JSON.parse(ye(t,"utf8"))}catch{return[]}return(Array.isArray(e.workspaces)?e.workspaces:e.workspaces?.packages??[]).flatMap(i=>Ve(r,i)).flatMap(i=>qe(r,i))}function Ve(r,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let s=F.join(r,t);return W(F.join(s,"package.json"))?[s]:[]}let e=t.indexOf("*"),n=t.slice(0,e).replace(/\/$/,""),i=t.slice(e+1).replace(/^\//,""),o=F.join(r,n||".");if(!W(o))return[];try{return ze(o).map(s=>F.join(o,s,i)).filter(s=>W(F.join(s,"package.json")))}catch{return[]}}function qe(r,t){try{let e=JSON.parse(ye(F.join(t,"package.json"),"utf8"));if(!e.name)return[];let n=F.relative(r,t).replace(/\\/g,"/");return[{name:e.name,rootRelative:n,sourceRootRelative:`${n}/src`}]}catch{return[]}}function Se(r,t){for(let e of r)if(t===e.name||t.startsWith(`${e.name}/`))return e.name;return null}function be(r){return[`${r.sourceRootRelative}/index.ts`,`${r.sourceRootRelative}/index.tsx`,`${r.sourceRootRelative}/index.mts`,`${r.sourceRootRelative}/index.cts`]}import{existsSync as L,readFileSync as Je,readdirSync as Ke,statSync as Ge}from"fs";import h from"path";var q=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function J(r,t){let n=t?h.dirname(h.join(r,t)):r,i=h.resolve(r);for(;n.startsWith(i);){for(let s of q){let a=h.join(n,s);if(L(a))return a}let o=h.dirname(n);if(o===n)break;n=o}for(let o of q){let s=h.join(r,o);if(L(s))return s}return null}function Me(r){let t=r.config.projectRoot,e=new Set(Ye(t,r.config.semantic?.typescript?.tsconfigs)),n=O(r,{includeIgnored:!1,extensions:T});for(let i of n){let o=J(t,i);o&&e.add(h.resolve(o))}if(e.size===0){let i=J(t);i&&e.add(h.resolve(i))}return[...e].filter(i=>!Ie(t,i)).sort((i,o)=>i.localeCompare(o))}function Ye(r,t=[]){let e=new Set;for(let n of t){let i=h.isAbsolute(n)?n:h.join(r,n);L(i)&&e.add(h.resolve(i))}for(let n of Xe(r))for(let i of q){let o=h.join(n,i);L(o)&&e.add(h.resolve(o))}if(e.size===0){let n=J(r);n&&e.add(h.resolve(n))}return[...e].filter(n=>!Ie(r,n)).sort((n,i)=>n.localeCompare(i))}function Xe(r){let t=h.join(r,"package.json");if(!L(t))return[];let e;try{e=JSON.parse(Je(t,"utf8"))}catch{return[]}return(Array.isArray(e.workspaces)?e.workspaces:e.workspaces?.packages??[]).flatMap(i=>Qe(r,i))}function Qe(r,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let s=h.join(r,t);return V(s)?[s]:[]}let e=t.indexOf("*"),n=t.slice(0,e).replace(/\/$/,""),i=t.slice(e+1).replace(/^\//,""),o=h.join(r,n||".");return V(o)?Ke(o).map(s=>h.join(o,s,i)).filter(V):[]}function V(r){try{return Ge(r).isDirectory()}catch{return!1}}function Ie(r,t){let e=h.relative(r,t).replace(/\\/g,"/");return e.startsWith("..")||e.includes("/node_modules/")||e.startsWith("node_modules/")||e.includes("/dist/")||e.startsWith("dist/")}import{createRequire as Ze}from"module";var et=Ze(import.meta.url),j;function xe(){if(j!==void 0)return j;try{j=et("ts-morph")}catch{j=null}return j}function ke(r,t){return t.map(e=>({tsconfigPath:e,project:new r.Project({tsConfigFilePath:e,skipFileDependencyResolution:!0})}))}function B(r,t,e){return{language:"typescript",availability:()=>({available:!1,reason:r,tsconfigPath:t,tsconfigPaths:e}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var tt=32;function Ce(r,t){let e=S("typescript.provider.load",()=>xe());if(!e)return B("ts-morph is not installed");let n=S("typescript.provider.tsconfig-discovery",()=>Me(r));if(n.length===0)return B("no tsconfig found");try{let i=S("typescript.provider.project-bundles",()=>ke(e,n),()=>({tsconfigs:n.length}));return S("typescript.provider.construct",()=>new K(r,e,i),()=>({tsconfigs:n.length}))}catch(i){return B(i instanceof Error?i.message:String(i),n[0],n)}}var K=class{constructor(t,e,n){this.db=t;this.tsMorph=e;this.projects=n;this.workspacePackages=he(t.config.projectRoot),this.sourceFiles=ge(t,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(t=>t.tsconfigPath)}}importUsage(t){return b(this.importUsageCache,t,()=>{let e=this.sourceFiles.sourceFile(t);if(!e)return[];let n=it();return S("typescript.import-usage.file",()=>this.importUsageForSourceFile(t,e,n),()=>({file:t,...n}))})}referencesFor(t){return b(this.referencesCache,t.symbolId,()=>{let e=this.nodeForDefinition(t);return this.referencesForDefinitionNode(t,e)})}referencesForDefinitions(t){let e=new Map,n=k(),i=[];for(let c of t){let l=this.referencesCache.get(c.symbolId);l?e.set(c.symbolId,l):i.push(c)}if(i.length===0)return e;let o=i,s=i.filter(c=>!ve(c));if(s.length>=tt){let c=this.referencesForDefinitionsBySymbolScan(s);for(let l of s){let d=c.get(l.symbolId)??[];this.referencesCache.set(l.symbolId,d),e.set(l.symbolId,d)}if(o=i.filter(l=>ve(l)),o.length===0)return e}let a=new Map;for(let c of o){let l=a.get(c.relativePath);l?l.push(c):a.set(c.relativePath,[c])}for(let[c,l]of a){let d=De();S("typescript.references-map.file",()=>{let p=this.definitionNodesForFile(c);for(let f of l){n&&(d.cacheMisses+=1);let u=p.get(f.symbolId)??null;n&&(u?d.nodeHits+=1:d.nodeMisses+=1);let g=this.referencesForDefinitionNode(f,u,n?d:void 0);this.referencesCache.set(f.symbolId,g),e.set(f.symbolId,g)}},()=>({relativePath:c,definitions:l.length,...Re(d)}))}return e}referencesForDefinitionsBySymbolScan(t){let e=k(),n=De(),i=new Map,o=new Set(t.map(a=>a.symbolId)),s=new Map(t.map(a=>[a.symbolId,a]));for(let a of t)i.set(a.symbolId,[]);return S("typescript.references-map.inverted-scan",()=>{let a=e?m.now():0;for(let p of t){let f=this.packageImportReferencesForDefinition(p);if(f.length>0){let u=i.get(p.symbolId)??[];u.push(...f),i.set(p.symbolId,u)}e&&(n.packageReferenceCount+=f.length)}e&&(n.packageRefsMs+=m.now()-a);let c=new Map,l=new Set(t.map(p=>p.leaf).filter(Boolean)),d=e?m.now():0;for(let p of this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(p))continue;let f=this.sourceFiles.sourceFile(p);f&&(e&&(n.scanFiles+=1),this.addReferencesFromSourceFileScan(f,p,o,s,l,c,i,e?n:void 0))}e&&(n.scanMs+=m.now()-d);for(let[p,f]of i){let u=C(f);i.set(p,u),e&&(n.referenceCount+=u.length)}},()=>({definitions:t.length,...Re(n)})),i}addReferencesFromSourceFileScan(t,e,n,i,o,s,a,c){let l=this.compilerCheckerForSourceFile(t),d=t.compilerNode,p=st(t),f=u=>{if(this.tsMorph.ts.isIdentifier(u)){if(c&&(c.identifiers+=1),!o.has(u.text)&&!p.has(u.text)){this.tsMorph.ts.forEachChild(u,f);return}let g=this.compilerReferenceSymbol(l,u,c);if(g){let y;if(s.has(g)?y=s.get(g)??null:(y=this.definitionFromCompilerSymbol(g),s.set(g,y)),c&&(y?c.targetHits+=1:c.targetMisses+=1),y&&n.has(y.symbolId)){c&&(c.requestedHits+=1);let v=i.get(y.symbolId);if(v&&!ct(v,e,Fe(d,u))){let I=a.get(y.symbolId)??[],A=d.getLineAndCharacterOfPosition(u.getStart(d));I.push({file:e,line:A.line,column:A.character}),a.set(y.symbolId,I)}}}}this.tsMorph.ts.forEachChild(u,f)};f(d)}compilerReferenceSymbol(t,e,n){n&&(n.symbolLookups+=1);let i=t.getSymbolAtLocation(e);if(i){if((i.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return i;try{return n&&(n.aliasResolutions+=1),t.getAliasedSymbol(i)}catch{return i}}}calleesFor(t){return b(this.calleesCache,t.symbolId,()=>b(this.fileCalleesCache,t.relativePath,()=>this.calleeMapForFile(t.relativePath)).get(t.symbolId)??[])}calleesForDefinitions(t){let e=new Map,n=new Map;for(let i of t){let o=n.get(i.relativePath);o?o.push(i):n.set(i.relativePath,[i])}for(let[i,o]of n){let s=this.fileCalleesCache.get(i),a=new Set(o.map(l=>l.symbolId)),c=s??this.calleeMapForFile(i,a);for(let l of o){let d=c.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,d),e.set(l.symbolId,d)}}return e}referencesForDefinitionNode(t,e,n){let i=n?m.now():0,o=this.packageImportReferencesForDefinition(t);if(n&&(n.packageRefsMs+=m.now()-i,n.packageReferenceCount+=o.length),!e)return o;let s=n?m.now():0,a=ae(e,t,o,this.db.config.projectRoot);return n&&(n.semanticRefsMs+=m.now()-s,n.referenceCount+=a.length),a}signatureFor(t){return b(this.signatureCache,t.symbolId,()=>{let e=this.nodeForDefinition(t);if(!e||!this.tsMorph.Node.isFunctionDeclaration(e)&&!this.tsMorph.Node.isMethodDeclaration(e)&&!this.tsMorph.Node.isArrowFunction(e)&&!this.tsMorph.Node.isFunctionExpression(e)&&!this.tsMorph.Node.isConstructorDeclaration(e))return null;let n=e.getType().getCallSignatures()[0];if(!n)return null;let i=n.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return Pe(c)}),o=n.getReturnType().getText(e);return`(${i.join(",")})=>${Pe(o)}`})}importUsageForSourceFile(t,e,n){let i=[],o=new Map;for(let s of e.getImportDeclarations()){n.declarations+=1;let a=H(this.db,t,s.getModuleSpecifierValue()),c=s.getImportClause()?.isTypeOnly()??!1;for(let l of G(s)){n.entries+=1;let d=c?null:l.identifier?.getSymbol()?.compilerSymbol??null;!c&&l.identifier&&(d?n.bindingSymbols+=1:n.missingBindingSymbols+=1);let p={sourcePath:a,entry:l,typeOnlyDeclaration:c,bindingSymbol:d,references:[]};if(i.push(p),c||!l.localName||!d)continue;let f=o.get(l.localName);f?f.push(p):o.set(l.localName,[p])}}return o.size>0&&e.forEachDescendant(s=>{if(s.getKindName()!=="Identifier")return;let a=o.get(s.getText());if(!a||rt(s))return;n.scannedIdentifiers+=1;let c=s.getSymbol()?.compilerSymbol;if(n.symbolLookups+=1,!!c){for(let l of a)if(l.bindingSymbol===c){l.references.push({location:U(s,this.db.config.projectRoot),node:s}),n.matchedReferences+=1;break}}}),i.map(s=>s.typeOnlyDeclaration?nt(t,s.sourcePath,s.entry):s.entry.identifier&&!s.bindingSymbol?(n.fallbackEntries+=1,this.valueImportUsageForEntry(t,s.sourcePath,s.entry)):this.valueImportUsageFromLocations(t,s.sourcePath,s.entry,s.references))}valueImportUsageForEntry(t,e,n){let i=n.identifier?n.identifier.findReferences():[],o=[];for(let s of i)for(let a of ce(s,t,n.identifier,this.db.config.projectRoot))o.push(a);return this.valueImportUsageFromLocations(t,e,n,o)}valueImportUsageFromLocations(t,e,n,i){let o=i.some(c=>!_(c.node)),s=i.some(c=>_(c.node)),a=n.isTypeOnly;return{importer:t,sourcePath:e,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:a,isUsed:a||i.length>0,isTypeUsed:a||s,isValueUsed:o,references:i.map(c=>c.location)}}packageImportReferencesForDefinition(t){return this.packageImportReferences().get(t.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let t=new Map,e=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(t,e,n);for(let[n,i]of t)t.set(n,C(i));return this.packageImportReferenceIndex=t,t}addPackageImportReferencesForDocument(t,e,n){if(this.db.isIgnored(n))return;let i=this.sourceFiles.sourceFileMatch(n);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(t,e,n,o)}addPackageImportReferencesForDeclaration(t,e,n,i){let o=Se(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=e.get(o);if(s)for(let a of G(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let l=le(a.identifier,n,this.db.config.projectRoot);l.length>0&&pt(t,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let t=new Map;for(let e of this.workspacePackages){let n=new Map;for(let i of be(e))this.collectPackageExports(e,i,n,new Set);n.size>0&&t.set(e.name,n)}return this.packageExportIndex=t,t}collectPackageExports(t,e,n,i){if(i.has(e))return;i.add(e);let o=this.sourceFiles.sourceFile(e);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?H(this.db,e,a):e;if(!c||!c.startsWith(`${t.sourceRootRelative}/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(t,c,n,i);continue}for(let d of l){let p=d.getNameNode().getText(),f=d.getAliasNode()?.getText()??p,u=this.indexedDefinitionByLeaf(c,p);if(!u)continue;let g=n.get(f);g||(g=new Set,n.set(f,g)),g.add(u.symbolId)}}}indexedDefinitionByLeaf(t,e){return b(this.indexedDefinitionLeafCache,t,()=>ue(this.db,t)).get(e)??null}nodeForDefinition(t){return b(this.definitionNodeCache,t.symbolId,()=>this.definitionNodesForFile(t.relativePath).get(t.symbolId)??null)}definitionNodesForFile(t){return b(this.fileDefinitionNodeCache,t,()=>{let e=this.sourceFiles.sourceFile(t);return e?fe(this.tsMorph,this.db,e,t):new Map})}definitionFromCompilerSymbol(t,e){let n=t.name,i=e?m.now():0,o=t.declarations??[];e&&(e.declarationsMs+=m.now()-i,e.declarationChecks+=o.length);for(let s of o){let a=e?m.now():0,c=s.getSourceFile(),l=N(this.db.config.projectRoot,c.fileName),d=c.getLineAndCharacterOfPosition(s.getStart(c)).line;if(e&&(e.declarationLocationMs+=m.now()-a),!l||this.db.isIgnored(l))continue;let p=e?m.now():0,f=de(this.db,l,d,n);if(e&&(e.indexedLookupMs+=m.now()-p),f)return{symbolId:f.symbolId,symbol:f.symbol,file:f.relativePath,line:f.startLine}}return null}calleeMapForFile(t,e){let n=k(),i=0,o=0,s=0,a=0,c=0,l=0,d=0,p=0,f=n?lt():void 0;return S("typescript.callee-map.file",()=>{let u=n?m.now():0,g=this.sourceFiles.sourceFile(t);if(n&&(c=Math.round(m.now()-u)),!g)return new Map;let y=n?m.now():0,v=D(this.db,t).sort((M,x)=>M.startLine-x.startLine||x.endLine-M.endLine);if(n&&(l=Math.round(m.now()-y)),i=v.length,v.length===0)return new Map;let I=new Map,A=n?m.now():0,Le=this.compilerCheckerForSourceFile(g),Q=g.compilerNode;n&&(d=Math.round(m.now()-A));let je=new Map,Z=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){n&&(o+=1);let x=this.semanticCalleeForCallNode(Le,Q,v,M,je,e,f);x&&(n&&(s+=1),ot(I,x.callerId,x.target))}this.tsMorph.ts.forEachChild(M,Z)},Ee=n?m.now():0;Z(Q),n&&(p=Math.round(m.now()-Ee));for(let[M,x]of I)I.set(M,dt(x));return a=I.size,I},()=>({relativePath:t,definitions:i,callNodes:o,resolvedCallees:s,outputRows:a,requestedDefinitions:e?.size??i,sourceFileLookupMs:c,definitionsLoadMs:l,checkerLookupMs:d,traversalMs:p,...f?ft(f):{}}))}semanticCalleeForCallNode(t,e,n,i,o,s,a){let c=a?m.now():0,l=at(n,Fe(e,i));if(a&&(a.callerLookupMs+=m.now()-c),!l)return null;if(s&&!s.has(l.symbolId))return a&&(a.skippedUnrequestedCallers+=1),null;let d=i.expression,p=this.compilerSymbolForExpression(t,d,a),f=null;if(p)if(a&&(a.targetSymbolHits+=1),o.has(p))a&&(a.compilerSymbolCacheHits+=1),f=o.get(p)??null;else{a&&(a.compilerSymbolCacheMisses+=1);let u=a?m.now():0;f=this.definitionFromCompilerSymbol(p,a),a&&(a.targetLookupMs+=m.now()-u),o.set(p,f)}else a&&(a.targetMisses+=1);return f?{callerId:l.symbolId,target:{symbol:f.symbol,file:f.file,line:f.line}}:null}compilerSymbolForExpression(t,e,n){let i=n?m.now():0,o=t.getSymbolAtLocation(e);if(n&&(n.expressionSymbolMs+=m.now()-i),o)return o;n&&(n.typeFallbacks+=1);let s=n?m.now():0,a=t.getTypeAtLocation(e).getSymbol();return n&&(n.typeSymbolMs+=m.now()-s),a}compilerCheckerForSourceFile(t){let e=t.getProject(),n=this.compilerCheckerCache.get(e);return n||(n=e.getTypeChecker().compilerObject,this.compilerCheckerCache.set(e,n)),n}};function G(r){let t=[],e=r.getDefaultImport();e&&t.push({identifier:e,importedName:"default",localName:e.getText(),kind:"default",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});let n=r.getNamespaceImport();n&&t.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});for(let i of r.getNamedImports()){let o=i.getNameNode(),a=i.getAliasNode()??(o.getKindName()==="Identifier"?o:null);t.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(r.getImportClause()?.isTypeOnly()??!1)})}return t.length===0&&t.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),t}function nt(r,t,e){return{importer:r,sourcePath:t,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function it(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function rt(r){for(let t=r;t;t=t.getParent())if(t.getKindName()==="ImportDeclaration")return!0;return!1}function ot(r,t,e){let n=r.get(t);n||(n=[],r.set(t,n)),n.push(e)}function st(r){let t=new Set;for(let e of r.getImportDeclarations())for(let n of G(e))n.localName&&t.add(n.localName);return t}function at(r,t){let e=null;for(let n of r)t<n.startLine||t>n.endLine||(!e||n.startLine>=e.startLine)&&(e=n);return e}function Fe(r,t){return r.getLineAndCharacterOfPosition(t.getStart(r)).line}function ct(r,t,e){return t===r.relativePath&&e>=r.startLine&&e<=r.endLine}function ve(r){return r.symbol.includes("#")?oe(r.symbol)==="type"&&r.relativePath.endsWith(".d.ts"):!1}function lt(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function ft(r){return{...r,callerLookupMs:Math.round(r.callerLookupMs),expressionSymbolMs:Math.round(r.expressionSymbolMs),typeSymbolMs:Math.round(r.typeSymbolMs),targetLookupMs:Math.round(r.targetLookupMs),declarationsMs:Math.round(r.declarationsMs),declarationLocationMs:Math.round(r.declarationLocationMs),indexedLookupMs:Math.round(r.indexedLookupMs)}}function De(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0}}function Re(r){return{...r,scanMs:Math.round(r.scanMs),packageRefsMs:Math.round(r.packageRefsMs),semanticRefsMs:Math.round(r.semanticRefsMs)}}function pt(r,t,e){for(let n of t){let i=r.get(n)??[];i.push(...e),r.set(n,i)}}function dt(r){let t=new Set,e=[];for(let n of r){let i=`${n.symbol}|${n.file}|${n.line}`;t.has(i)||(t.add(i),e.push(n))}return e}function Pe(r){return r.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var Y=new WeakMap;ee({name:"semantic-provider",groups:["semantic-provider"],clearAll:r=>Y.delete(r)});function X(r,t){let e=`${r.config.projectRoot}:typescript-workspace`,n=Y.get(r);n||(n=new Map,Y.set(r,n));let i=n.get(e);if(i)return i;let o=Ce(r,t);return n.set(e,o),o}function dn(r,t){let e=E(r,t);return e?e.importUsage(t):[]}function un(r,t){let e=E(r,t.relativePath);return e?e.referencesFor(t):[]}function mn(r,t){let e=k(),n=new Map,i=ne(r),o=[],s=[],a=[],c=0,l=0,d=0,p=0;if(S("semantic.references.cache-scan",()=>{for(let f of t){if(!i||!R(f.relativePath)){e&&!R(f.relativePath)&&(c+=1),a.push(f);continue}let u=ie(r,f.relativePath,f.symbol,i);if(u!==null){let g=mt(u);if(g){e&&(l+=1),p+=Te(r,n,f,g);continue}e&&(d+=1)}s.push(f)}},()=>({definitions:t.length,skippedNonTs:c,cacheHits:l,parseFailures:d,misses:s.length,unkeyed:a.length,resultRows:n.size,callerFiles:p})),s.length>0||a.length>0){let f=[...a,...s],u=0,g=S("semantic.references.compute-misses",()=>{let y=ut(r,f);return u=y.size,y},()=>({definitions:f.length,misses:s.length,unkeyed:a.length,rows:u}));for(let y of f)p+=Te(r,n,y,g.get(y.symbolId)??[]);if(i)for(let y of s)o.push({relativePath:y.relativePath,symbol:y.symbol,projectFingerprint:i,payload:JSON.stringify(g.get(y.symbolId)??[])})}return o.length>0&&(X(r).availability().available?S("semantic.references.cache-write",()=>re(r,o),()=>({entries:o.length})):S("semantic.references.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",entries:o.length}))),n}function ut(r,t){let e=k(),n=new Map,i=0,o=0,s=0,a=0;return S("semantic.references.provider-loop",()=>{let c=new Map,l=[];for(let d of t){let p=E(r,d.relativePath);if(!p){e&&(o+=1);continue}if(e&&(i+=1),p.referencesForDefinitions){let f=c.get(p);f?f.push(d):c.set(p,[d])}else l.push({provider:p,definition:d})}for(let[d,p]of c){let f=d.referencesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Ne(n,u.symbolId,g,e,y=>{s+=1,a+=y})}}for(let{provider:d,definition:p}of l){let f=d.referencesFor(p);Ne(n,p.symbolId,f,e,u=>{s+=1,a+=u})}return n},()=>({definitions:t.length,providerHits:i,providerMisses:o,definitionsWithReferences:s,referenceCount:a,rows:n.size}))}function Ne(r,t,e,n,i){r.set(t,e),n&&e.length>0&&i(e.length)}function Te(r,t,e,n){let i=0;for(let o of n){if(o.file===e.relativePath||r.isIgnored(o.file))continue;let s=t.get(e.symbolId);s||(s=new Set,t.set(e.symbolId,s));let a=s.size;s.add(o.file),s.size!==a&&(i+=1)}return i}function mt(r){try{return JSON.parse(r)}catch{return null}}function gn(r,t){let e=k(),n=new Map,i=0,o=0,s=0,a=0;return S("semantic.callees.provider-loop",()=>{let c=new Map,l=[];for(let d of t){let p=E(r,d.relativePath);if(!p){e&&(o+=1);continue}e&&(i+=1);let f=d;if(p.calleesForDefinitions){let u=c.get(p);u?u.push(f):c.set(p,[f])}else l.push({provider:p,definition:f})}for(let[d,p]of c){let f=d.calleesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];we(n,u.symbolId,g,e,y=>{s+=1,a+=y})}}for(let{provider:d,definition:p}of l){let f=d.calleesFor(p);we(n,p.symbolId,f,e,u=>{s+=1,a+=u})}return n},()=>({definitions:t.length,providerHits:i,providerMisses:o,definitionsWithCallees:s,calleeCount:a,rows:n.size}))}function we(r,t,e,n,i){e.length>0&&(r.set(t,e),n&&i(e.length))}function yn(r,t){let e=E(r,t.relativePath);return e?e.signatureFor(t):null}function E(r,t){if(!R(t))return null;let e=X(r,t);return e.availability().available?e:null}export{R as a,X as b,dn as c,un as d,mn as e,gn as f,yn as g};
|
|
3
|
+
//# sourceMappingURL=chunk-OLTESY4K.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as X,d as R}from"./chunk-BSN22NRK.js";import{a as P,b as z}from"./chunk-TQ5W2H3S.js";import{b as j,d as O,e as L,j as B,k as A}from"./chunk-XUGQU7PM.js";import{existsSync as G,readFileSync as F}from"fs";import{join as x}from"path";function U(t,n){let e=K(t,n)??Q(t,n)??V(t,n)??Y(t,n);return tt(t,e,n)}function K(t,n){let e=-1,i=null;for(let r=0;r<=n;r+=1){let o=w(t[r]??"");o&&(i===null?(i=o,e=r):o===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let r=n+1;r<t.length;r+=1)if(w(t[r]??"")===i)return{start:e,end:r+1};return{start:e,end:t.length}}function w(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function Q(t,n){if(!I(t[n]??""))return null;let e=n;for(;e>0&&I(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&I(t[i]??"");)i+=1;return{start:e,end:i}}function I(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function V(t,n){let e=n;for(;e>=0;){let o=t[e]??"";if(v(o)!==null)break;if(E(o)!==null)return null;e-=1}if(e<0)return null;let i=v(t[e]??"");if(i===null)return null;let r=e+1;for(;r<t.length;){let o=t[r]??"",s=v(o);if(s!==null){if(s<=i)break;r+=1;continue}if(E(o)!==null)break;r+=1}return{start:e,end:r}}function v(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function Y(t,n){let e=t[n]??"";if($(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&H(t[i-1]??"");)i-=1;let r=n+1;for(;r<t.length&&H(t[r]??"");)r+=1;return{start:i,end:r}}function H(t){return E(t)===null}function E(t){return t.trim().length===0?"blank":$(t)?"heading":w(t)?"fence":I(t)?"table":v(t)!==null?"list":null}function $(t){return/^#{1,6}\s+/.test(t.trim())}function tt(t,n,e){let{start:i,end:r}=n;if(r-i>40){let s=Math.floor(20);i=Math.max(i,e-s),r=Math.min(r,i+40),i=Math.max(n.start,r-40)}let o=t.slice(i,r).join(`
|
|
2
|
+
`).trim();return o.length<=2e3?o:`${o.slice(0,2e3).trimEnd()}...`}function _(t,n){return n.filter(e=>t.includes(e))}var b=/\.(?:md|mdx|rst|txt)$/i;function nt(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var et=3,it=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function kt(t,n={}){let{doc:e,limit:i=20,minCoupling:r=et}=n,o=ct(t);if(!o)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let s=[];for(let c of o.docFiles){if(e!==void 0&&!c.includes(e)||e===void 0&&!W(t,c)||e!==void 0&&!G(x(t.config.projectRoot,c)))continue;let u=Math.max(0,...o.changeTimes.get(c)??[]),f=rt(t,c),d=new Map,{resolved:h,broken:l,citations:g}=dt(t,c,o.tracked,o.trackedBySuffix,o.everSeenInHistory),m=new Map(g.map(a=>[a.file,a.contexts]));for(let a of h){if(a===c||b.test(a))continue;let p=(o.changeTimes.get(a)??[]).filter(S=>S>u).length;p!==0&&d.set(a,{file:a,evidence:"reference",coChanges:0,changesSinceDocUpdate:p,...N("reference",f),citationContexts:m.get(a)})}for(let[a,p]of o.coupling.get(c)??[]){if(p<r||!o.tracked.has(a))continue;let S=(o.changeTimes.get(a)??[]).filter(T=>T>u).length;if(S===0)continue;let C=d.get(a);C?(C.evidence="both",C.coChanges=p,Object.assign(C,N("both",f))):d.set(a,{file:a,evidence:"co-change",coChanges:p,changesSinceDocUpdate:S,...N("co-change",f)})}if(d.size===0&&l.length===0)continue;let D=[...d.values()].sort((a,p)=>p.changesSinceDocUpdate-a.changesSinceDocUpdate);s.push({doc:c,docLastChangedAt:u,staleness:D.reduce((a,p)=>a+p.changesSinceDocUpdate,0)+l.length*10,subjects:D.slice(0,8),brokenReferences:l})}return s.sort((c,u)=>u.staleness-c.staleness),{available:!0,commitsAnalyzed:o.historyCommitCount,docsScanned:o.docFiles.length,findings:s.slice(0,i)}}function rt(t,n){let e;try{e=F(x(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
|
|
3
|
+
${e}`.toLowerCase(),r=_(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(r.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${r.join(", ")}`]};let o=_(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return o.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${o.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function N(t,n){return{actionTier:ot(t,n.docIntent),docIntent:n.docIntent,docIntentReasons:n.reasons}}function ot(t,n){return n==="historical-note"?"support":t==="co-change"?"signal":"direct"}function ct(t){let n=X(t);if(!n)return null;let e=R(t)??new Set,i=new Map,r=new Map,o=new Set;for(let s of n.commits){let c=[...new Set(s.files)],u=c.filter(d=>b.test(d)),f=c.filter(d=>!b.test(d));for(let d of c){o.add(d);let h=i.get(d)??[];h.push(s.timestamp),i.set(d,h)}for(let d of u){let h=r.get(d);h||(h=new Map,r.set(d,h));for(let l of f)h.set(l,(h.get(l)??0)+1)}}return{changeTimes:i,coupling:r,docFiles:[...e].filter(s=>b.test(s)),everSeenInHistory:o,historyCommitCount:n.commits.length,tracked:e,trackedBySuffix:Z(e)}}function At(t,n){if(n.size===0)return[];let e=P(),i=0,r=0,o=0,s=0,c=0,u=0;return z("doc-reference.docs-citing-files",()=>{let f=R(t)??new Set;i=f.size;let d=Z(f),h=st(n,d),l=[];for(let g of f){if(!W(t,g))continue;e&&(r+=1);let m;try{m=F(x(t.config.projectRoot,g),"utf-8")}catch{e&&(o+=1);continue}if(!ut(m,h)){e&&(s+=1);continue}let D=J(t,g,m);if(!D)continue;e&&(c+=1);let a=at(D.candidates,n,h,f,d);if(a.size===0)continue;let p=[...new Set([...a.values()].flatMap(y=>[...y]))],S=lt(D.contextsByCandidate,p),C=[...a].map(([y,k])=>({file:y,contexts:M([...k].flatMap(q=>S.get(q)??[])).slice(0,3)})).filter(y=>y.contexts.length>0),T=[...a.keys()];if(T.length>0){e&&(u+=1);let y=T.sort();l.push({doc:g,cited:y,citations:C,citedClaims:M(C.flatMap(k=>k.contexts)).slice(0,3)})}}return l},()=>({targets:n.size,trackedFiles:i,livingDocs:r,unreadableDocs:o,candidateMisses:s,evidenceDocs:c,citedDocs:u}))}function W(t,n){return b.test(n)&&!nt(n)&&G(x(t.config.projectRoot,n))}function Z(t){let n=new Map;for(let e of t){let i=e.split("/");for(let r of[2,3]){if(i.length<r)continue;let o=i.slice(-r).join("/"),s=n.get(o)??[];s.push(e),n.set(o,s)}}return n}function st(t,n){let e=new Set(t);for(let i of t){let r=i.split("/");for(let o of[2,3]){if(r.length<o)continue;let s=r.slice(-o).join("/"),c=n.get(s);c?.length===1&&c[0]===i&&e.add(s)}}return e}function at(t,n,e,i,r){let o=new Map;for(let s of t){if(!e.has(s))continue;let c;if(i.has(s))c=s;else{let f=r.get(s);f?.length===1&&(c=f[0])}if(!c||!n.has(c))continue;let u=o.get(c)??new Set;u.add(s),o.set(c,u)}return o}function dt(t,n,e,i,r){let o=new Set,s=new Set,c=J(t,n);if(!c)return{resolved:o,broken:[],citations:[]};let u=c.candidates,f=c.contextsByCandidate,d=new Map,h=(l,g)=>{let m=f.get(g);if(!m||m.length===0)return;let D=d.get(l)??[];D.push(...m),d.set(l,M(D).slice(0,3))};for(let l of u){if(e.has(l)){o.add(l),h(l,l);continue}let g=i.get(l);if(g&&g.length===1){o.add(g[0]),h(g[0],l);continue}g&&g.length>1||r.has(l)&&s.add(l)}return{resolved:o,broken:[...s],citations:[...d].map(([l,g])=>({file:l,contexts:g}))}}function lt(t,n){let e=new Map;for(let i of n){let r=t.get(i);r&&r.length>0&&e.set(i,[...r])}return e}function J(t,n,e){let i=e;if(i===void 0)try{i=F(x(t.config.projectRoot,n),"utf-8")}catch{return null}let r=j(t,n,i),o=O(t,"doc-path-evidence",n,r);if(o!==null){let c=ht(o);if(c)return c}let s=ft(i);return L(t,"doc-path-evidence",n,r,gt(s)),s}function ut(t,n){for(let e of n)if(t.includes(e))return!0;return!1}function ft(t){let n=t.split(/\r?\n/),e=new Set,i=new Map;for(let r=0;r<n.length;r+=1){let o=n[r]??"";for(let s of o.matchAll(it)){let c=s[0].replace(/^\.?\//,"");e.add(c);let u=U(n,r);if(u.length===0)continue;let f=i.get(c)??[];f.push(u),i.set(c,M(f).slice(0,3))}}return{candidates:[...e],contextsByCandidate:i}}function gt(t){let n={candidates:t.candidates,contextsByCandidate:[...t.contextsByCandidate.entries()]};return JSON.stringify(n)}function ht(t){try{let n=JSON.parse(t);if(!B(n))return null;let e=A(n.candidates),i=pt(n.contextsByCandidate);return!e||!i?null:{candidates:e,contextsByCandidate:new Map(i)}}catch{return null}}function pt(t){if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string")return null;let i=A(e[1]);if(!i)return null;n.push([e[0],i])}return n}function M(t){let n=[];for(let e of new Set(t))n.some(i=>mt(i,e))||n.push(e);return n}function mt(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),i=n.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),r=Math.min(e.length,i.length);if(r===0)return!1;if(r<3)return t.includes(n)||n.includes(t);let o=new Set(i),s=e.filter(c=>o.has(c)).length;return s>=3&&s/r>=.6}export{U as a,_ as b,nt as c,kt as d,At as e};
|
|
4
|
+
//# sourceMappingURL=chunk-P4KYUPBD.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-TK7O5ER5.js";import{a as g,c as m}from"./chunk-JM72FNGA.js";function _(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
|
|
2
2
|
WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,h=1;s>=0;s--,h++){let p=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:p,shortName:p,depth:h})}return b}export{_ as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-P753MDDE.js.map
|