scip-query 0.6.1 → 0.6.3
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-K5FQFCSN.js → chunk-2OXZVIED.js} +2 -2
- package/dist/{chunk-ZSRXMNMK.js → chunk-56LPZC3S.js} +3 -3
- package/dist/chunk-5IM4IQ6N.js +2 -0
- package/dist/chunk-5KWWENJZ.js +2 -0
- package/dist/chunk-5OV6CUTY.js +2 -0
- package/dist/{chunk-2DSS2NGF.js → chunk-6QXYWGE5.js} +2 -2
- package/dist/{chunk-XVDASCN7.js → chunk-6TRXTRCW.js} +2 -2
- package/dist/{chunk-BDBRZPX3.js → chunk-C6PQLWHR.js} +2 -2
- package/dist/{chunk-ZXKURFVB.js → chunk-CH47OLNL.js} +2 -2
- package/dist/{chunk-4QJ7LVW5.js → chunk-DM56ECPZ.js} +2 -2
- package/dist/{chunk-WTSTDJZ7.js → chunk-DX5YEUX4.js} +2 -2
- package/dist/chunk-DXXROCSQ.js +19 -0
- package/dist/chunk-EARGTC7U.js +12 -0
- package/dist/{chunk-D7YBWSON.js → chunk-EJXPKSWV.js} +2 -2
- package/dist/{chunk-BE6EQIWY.js → chunk-EUHHVFTI.js} +2 -2
- package/dist/chunk-F2TGKDMW.js +2 -0
- package/dist/{chunk-JS2RNIC7.js → chunk-GSVIC6KN.js} +2 -2
- package/dist/{chunk-LX4H4LLG.js → chunk-H4IWC7KJ.js} +2 -2
- package/dist/{chunk-STOGKRJH.js → chunk-H7BWAMFI.js} +2 -2
- package/dist/{chunk-RWE6FHG3.js → chunk-HLILTI7S.js} +2 -2
- package/dist/chunk-HUEIPY4M.js +5 -0
- package/dist/chunk-ID7TO4P6.js +65 -0
- package/dist/{chunk-IBGBI3VU.js → chunk-IUNRL2AQ.js} +2 -2
- package/dist/chunk-J22I2FWD.js +6 -0
- package/dist/chunk-KOGVTPGE.js +7 -0
- package/dist/chunk-LUYN4IWJ.js +2 -0
- package/dist/{chunk-DE5ZBHMK.js → chunk-MDUIJELV.js} +2 -2
- package/dist/{chunk-GXVB36TG.js → chunk-MMKNCPHB.js} +2 -2
- package/dist/chunk-MSNW2AR2.js +2 -0
- package/dist/chunk-NB3GIT4Z.js +7 -0
- package/dist/{chunk-FCC3XJTI.js → chunk-OBPP5RRE.js} +2 -2
- package/dist/chunk-ORBQ3HJD.js +2 -0
- package/dist/{chunk-NXMYYHDO.js → chunk-P6IUCZA3.js} +2 -2
- package/dist/chunk-Q2MCCKWZ.js +2 -0
- package/dist/{chunk-IYFZS4PV.js → chunk-QRULHDMO.js} +6 -6
- package/dist/{chunk-YIPCV7M7.js → chunk-RAJHIEBM.js} +2 -2
- package/dist/{chunk-XAZTIDST.js → chunk-RKZBRDFK.js} +2 -2
- package/dist/{chunk-AJ5PWKD4.js → chunk-RPRIZ43D.js} +2 -2
- package/dist/{chunk-D7KLLMPB.js → chunk-RXGCTLHY.js} +2 -2
- package/dist/{chunk-HMKJTAZD.js → chunk-S6IGA6KK.js} +2 -2
- package/dist/{chunk-DHYIJHXZ.js → chunk-TPOYTT6O.js} +2 -2
- package/dist/{chunk-SG35Y7J2.js → chunk-TRBNQ273.js} +2 -2
- package/dist/chunk-TVJMEDHH.js +2 -0
- package/dist/{chunk-2RLP74AO.js → chunk-UDKLKBPQ.js} +2 -2
- package/dist/{chunk-SDX6MDBL.js → chunk-UGUBEKK5.js} +2 -2
- package/dist/{chunk-Y7LOQSWY.js → chunk-VKYLXCV6.js} +2 -2
- package/dist/{chunk-BQ3INTYT.js → chunk-VQXXSUQF.js} +2 -2
- package/dist/{chunk-NTDA4A2D.js → chunk-VZE4SOJG.js} +2 -2
- package/dist/{chunk-QXE6EDY2.js → chunk-VZHI3TUX.js} +2 -2
- package/dist/chunk-YSEQFGGH.js +2 -0
- package/dist/cli.js +218 -169
- package/dist/{db-BSTtBG_H.d.ts → db-DKhNQ75l.d.ts} +15 -1
- package/dist/index.d.ts +36 -3
- package/dist/index.js +60 -12
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +63 -5
- package/package.json +15 -16
- package/skills/concrete-plan/SKILL.md +48 -22
- package/dist/chunk-5IADAU5B.js +0 -7
- package/dist/chunk-7754WFFV.js +0 -18
- package/dist/chunk-7VOF4ZG6.js +0 -2
- package/dist/chunk-7Z4COVMC.js +0 -2
- package/dist/chunk-EEF3YEHW.js +0 -2
- package/dist/chunk-F2LLHRRZ.js +0 -2
- package/dist/chunk-GNXRLK5G.js +0 -2
- package/dist/chunk-JH3A7HTU.js +0 -2
- package/dist/chunk-K6GBKEQE.js +0 -6
- package/dist/chunk-KO7YJRWP.js +0 -12
- package/dist/chunk-PZ6ESKRH.js +0 -7
- package/dist/chunk-RJ7SPBJ5.js +0 -5
- package/dist/chunk-TINPMWJK.js +0 -2
- package/dist/chunk-UJB62HV3.js +0 -2
- package/dist/chunk-VEUMRDHW.js +0 -2
- package/dist/chunk-WCDXJGYT.js +0 -65
- package/dist/chunk-Y7H6D2EV.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as a,i as c}from"./chunk-ID7TO4P6.js";import{q as d}from"./chunk-QRULHDMO.js";import{b as l}from"./chunk-5IM4IQ6N.js";function E(e,t={}){let{limit:m=20,scope:s,minFanIn:n=2,minFanOut:f=2}=t,_=s?`AND def_d.relative_path LIKE '%${s}%'`:"",r=e.all(`SELECT * FROM (
|
|
2
2
|
SELECT
|
|
3
3
|
gs.symbol,
|
|
4
4
|
def_d.relative_path AS defined_in,
|
|
@@ -38,4 +38,4 @@ import{e as a,f as c}from"./chunk-WCDXJGYT.js";import{q as d}from"./chunk-IYFZS4
|
|
|
38
38
|
) WHERE fan_in >= ? AND fan_out >= ?
|
|
39
39
|
ORDER BY (fan_in * fan_out) DESC
|
|
40
40
|
LIMIT ?`,n,f,m).filter(o=>!e.isIgnored(o.defined_in)).map(o=>({symbol:o.symbol,shortName:l(o.symbol),fanIn:o.fan_in,fanOut:o.fan_out,score:o.fan_in*o.fan_out,definedIn:o.defined_in}));return r.length>0?r:u(e,s,{minFanIn:n,minFanOut:f,limit:m})}function u(e,t,m){let{minFanIn:s,minFanOut:n,limit:f}=m;return d(e,{scope:t}).filter(i=>!e.isIgnored(i.relativePath)).map(i=>b(e,i)).filter(i=>i.fanIn>=s&&i.fanOut>=n).sort((i,r)=>r.score-i.score||r.fanIn-i.fanIn).slice(0,f)}function b(e,t){let m=new Set(c(e,t,{limit:500}).map(n=>n.file)).size,s=new Set(a(e,t,{limit:500}).filter(n=>n.file!==t.relativePath).map(n=>`${n.symbol}|${n.file}`)).size;return{symbol:t.symbol,shortName:l(t.symbol),fanIn:m,fanOut:s,score:m*s,definedIn:t.relativePath}}export{E as a};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-2OXZVIED.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-QRULHDMO.js";import{readdirSync as l}from"fs";import{extname as d,join as p}from"path";var x=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],v=[".vue"],S=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function _(o,i={}){let s=i.includeIndexed??!0,r=i.includeAuxiliary??!0,t=i.extensions?new Set(i.extensions.map(n=>n.toLowerCase())):new Set(x.map(n=>n.toLowerCase())),c=`${s?"1":"0"}|${r?"1":"0"}|${[...t].sort().join(",")}`;return f.get(o,c,()=>{let n=new Set;if(s){let e=o.all(`SELECT relative_path
|
|
2
2
|
FROM documents
|
|
3
3
|
WHERE 1 = 1
|
|
4
|
-
${o.pathExclusionsFor("documents")}`);for(let a of e)o.isIgnored(a.relative_path)||t.has(d(a.relative_path).toLowerCase())&&n.add(a.relative_path)}if(r)for(let e of g(o.config.projectRoot,t))o.isIgnored(e)||n.add(e);return[...n].sort()})}var f=u("source-files");function g(o,i){let s=new Set,r=t=>{let c=t?p(o,t):o,n=[];try{n=l(c,{withFileTypes:!0})}catch{return}for(let e of n)if(!S.has(e.name)){if(e.isDirectory()){r(t?`${t}/${e.name}`:e.name);continue}i.has(d(e.name).toLowerCase())&&s.add(t?`${t}/${e.name}`:e.name)}};return r(""),s}export{v as a};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
${o.pathExclusionsFor("documents")}`);for(let a of e)o.isIgnored(a.relative_path)||t.has(d(a.relative_path).toLowerCase())&&n.add(a.relative_path)}if(r)for(let e of g(o.config.projectRoot,t))o.isIgnored(e)||n.add(e);return[...n].sort()})}var f=u("source-files");function g(o,i){let s=new Set,r=t=>{let c=t?p(o,t):o,n=[];try{n=l(c,{withFileTypes:!0})}catch{return}for(let e of n)if(!S.has(e.name)){if(e.isDirectory()){r(t?`${t}/${e.name}`:e.name);continue}i.has(d(e.name).toLowerCase())&&s.add(t?`${t}/${e.name}`:e.name)}};return r(""),s}export{v as a,S as b,_ as c};
|
|
5
|
+
//# sourceMappingURL=chunk-56LPZC3S.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var d={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function l(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let s=t[0],i=t[1],r=e.slice(s.length+1+i.length+1),n;if(r.startsWith("`")){let f=r.indexOf("`",1);f===-1?(n=r.slice(1),r=""):(n=r.slice(1,f),r=r.slice(f+2))}else{let f=r.indexOf(" ");f===-1?(n=r,r=""):(n=r.slice(0,f),r=r.slice(f+1))}let c,o=r.indexOf(" ");o===-1?(c=r,r=""):(c=r.slice(0,o),r=r.slice(o+1));let a=m(r);return{scheme:s,manager:i,packageName:n,version:c,descriptors:a,raw:e}}function m(e){let t=[],s=0;for(;s<e.length;){if(e[s]==="["){let n=e.indexOf("]",s+1);if(n===-1){t.push({name:e.slice(s+1),suffix:"type-param"});break}t.push({name:e.slice(s+1,n),suffix:"type-param"}),s=n+1;continue}if(e[s]==="("&&(t.length===0||s===0||u(e[s-1]))){let n=e.indexOf(")",s+1);if(n!==-1&&e[n+1]!=="."){t.push({name:e.slice(s+1,n),suffix:"parameter"}),s=n+1;continue}}let i;if(e[s]==="`"){let n=e.indexOf("`",s+1);if(n===-1){i=e.slice(s+1),t.push({name:i,suffix:"term"});break}i=e.slice(s+1,n),s=n+1}else{let n=s;for(;s<e.length&&!u(e[s]);)s++;i=e.slice(n,s)}if(s>=e.length){i&&t.push({name:i,suffix:"term"});break}let r=e[s];if(r==="("){let n=e.indexOf(")",s+1);n!==-1&&e[n+1]==="."?(t.push({name:i,suffix:"method"}),s=n+2):n!==-1?(t.push({name:i,suffix:"method"}),s=n+1):(t.push({name:i,suffix:"term"}),s++)}else{let n=d[r];n&&t.push({name:i,suffix:n}),s+=1}}return t}function u(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function x(e){let t=l(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let s=t;if(s.descriptors.length===0)return s.raw;let i=[];for(let r of s.descriptors){let n=r.name;r.suffix==="namespace"&&(n=n.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")),n&&(r.suffix==="method"?i.push(`${n}()`):i.push(n))}return i.join(":")}function S(e){let t=l(e);if("kind"in t&&t.kind==="local")return t.id;let s=t;return s.descriptors.length===0?"":s.descriptors[s.descriptors.length-1].name}function p(e){let t=l(e);if("kind"in t&&t.kind==="local")return null;let s=t;return s.descriptors[s.descriptors.length-1]?.suffix??null}function b(e){return e.endsWith("().")||p(e)==="method"}function y(e){let t=p(e);return t==="method"||t==="term"}function k(e){return p(e)==="namespace"}var h=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function D(e){return h.test(e)}var g=new Set(["test","tests","_tests"]);function $(e){let t=l(e);if("kind"in t)return!1;for(let s=0;s<t.descriptors.length-1;s+=1){let i=t.descriptors[s];if(i?.suffix==="namespace"&&i.name&&g.has(i.name))return!0}return!1}function T(e,t){let s=l(e),i=l(t);if("kind"in s||"kind"in i)return!1;let r=s.descriptors,n=i.descriptors;if(n.length!==r.length+1)return!1;for(let c=0;c<r.length;c++){let o=r[c],a=n[c];if(o.name!==a.name||o.suffix!==a.suffix)return!1}return!0}function M(e,t){let s=l(e),i=l(t);if("kind"in s||"kind"in i)return!1;let r=s.descriptors,n=i.descriptors;if(n.length<=r.length)return!1;for(let c=0;c<r.length;c++){let o=r[c],a=n[c];if(o.name!==a.name||o.suffix!==a.suffix)return!1}return!0}export{l as a,x as b,S as c,p as d,b as e,y as f,k as g,D as h,$ as i,T as j,M as k};
|
|
2
|
+
//# sourceMappingURL=chunk-5IM4IQ6N.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as a}from"./chunk-56LPZC3S.js";import{g as p}from"./chunk-ID7TO4P6.js";import{b as f}from"./chunk-QRULHDMO.js";function c(t){let r=o(t);return x(r)?"test":S(r)?"worker":y(r)?"entry":P(r)?"barrel":"source"}function _(t){return c(t)==="barrel"}function g(t){return h.get(t,()=>{let r=p(t),e=a(t).filter(s=>{let u=c(s);return u==="entry"||u==="worker"}),n=new Set,i=new Set;for(;e.length>0;){let s=e.shift();if(!n.has(s)){n.add(s),c(s)==="barrel"&&i.add(s);for(let u of r.get(s)??[])n.has(u)||e.push(u)}}return i})}var h=f("live-barrels");function b(t,r){return g(t).has(o(r))}function w(t){let r=g(t);return a(t).filter(e=>_(e)&&!r.has(e))}function D(t,r){let e=c(r);return e==="entry"||e==="worker"||b(t,r)}function E(t,r,e){let n=t.config.entryRoots;if(!n)return!1;let i=o(e);return!!(n.files?.some(s=>o(s)===i)||n.pathPrefixes?.some(s=>i.startsWith(o(s)))||n.qualifiedVars?.some(s=>$(r,s))||n.symbolPatterns?.some(s=>{try{return new RegExp(s).test(r)}catch{return!1}}))}var m=["%/__tests__/%","%.test.%","%.spec.%","%/test/%","%/tests/%","%_test.%","%_spec.%","%/test_%.%","%/spec_%.%"],B=["%/test-utils/%"];function x(t){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(t)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(t)||/(?:^|\/)spec_[^/]+$/i.test(t)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(t)||/(?:^|\/)[^/]+_tests\.rs$/i.test(t)||/(?:^|\/)tests\.rs$/i.test(t)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(t)||/(?:^|\/)__tests__\//i.test(t)||/(?:^|\/)test\//i.test(t)||/(?:^|\/)tests\//i.test(t)||/(?:^|\/)__fixtures__\//i.test(t)||/(?:^|\/)__mocks__\//i.test(t)||/(?:^|\/)test-support\//i.test(t)||/(?:^|\/)test-utils\//i.test(t)||/(?:^|\/)testing\//i.test(t))}function S(t){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(t)}function y(t){let r=t.split("/"),e=r[r.length-1]??t;return e==="cli.ts"||e==="cli.js"||e==="postinstall.ts"||e==="postinstall.js"||e==="main.ts"||e==="main.js"||e==="main.rs"||e==="main.go"||e==="main.py"||e==="build.rs"||e==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(t)||/(?:^|\/)examples\/[^/]+\.rs$/.test(t)||/(?:^|\/)tests\/[^/]+\.rs$/.test(t)||/(?:^|\/)benches\/[^/]+\.rs$/.test(t)?!0:e==="index.ts"||e==="index.js"?r.length<=2:!1}function P(t){return t==="index.ts"||t==="index.js"||t.endsWith("/index.ts")||t.endsWith("/index.js")||t.endsWith("/mod.rs")||t.endsWith("/__init__.py")}function o(t){return t.replace(/\\/g,"/")}function $(t,r){let e=r.lastIndexOf("/");if(e<0)return!1;let n=r.slice(0,e),i=r.slice(e+1);return t.includes(l(n)+"/")&&t.includes(l(i)+".")}function l(t){return/^[A-Za-z0-9_$+-]+$/.test(t)?t:"`"+t.replace(/`/g,"``")+"`"}export{c as a,_ as b,b as c,w as d,D as e,E as f,m as g,B as h};
|
|
2
|
+
//# sourceMappingURL=chunk-5KWWENJZ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-DX5YEUX4.js";import{p as c}from"./chunk-QRULHDMO.js";import{b as a}from"./chunk-5IM4IQ6N.js";function _(t,d){let s=u(t,d);if(!s)return null;let n=t.get(`SELECT id, relative_path FROM documents
|
|
2
2
|
WHERE relative_path = ?
|
|
3
3
|
${t.pathExclusionsFor("documents")}
|
|
4
4
|
LIMIT 1`,s);if(!n||t.isIgnored(n.relative_path))return null;let f=c(t,n.relative_path).sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine),m=[],l=0;for(let e of f){let o=t.get(`SELECT COUNT(DISTINCT c.document_id) AS consumer_count
|
|
@@ -7,4 +7,4 @@ import{a as u}from"./chunk-WTSTDJZ7.js";import{p as c}from"./chunk-IYFZS4PV.js";
|
|
|
7
7
|
WHERE m.symbol_id = ?
|
|
8
8
|
AND m.role != 1
|
|
9
9
|
AND c.document_id != ?`,e.symbolId,n.id)?.consumer_count??0,r;o>10?r="high":o>0?r="medium":r="low",l+=o,m.push({symbol:e.symbol,shortName:a(e.symbol),startLine:e.startLine,endLine:e.endLine,externalConsumers:o,riskLevel:r})}return{file:n.relative_path,symbols:m,totalExternalConsumers:l}}export{_ as a};
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-6QXYWGE5.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
1
|
+
import{b as o}from"./chunk-DX5YEUX4.js";import{s as m}from"./chunk-QRULHDMO.js";function y(t,l){let s=o(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
|
|
2
2
|
WHERE relative_path IN (${d})
|
|
3
3
|
ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=m(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
|
|
4
4
|
FROM mentions m
|
|
@@ -32,4 +32,4 @@ import{b as o}from"./chunk-WTSTDJZ7.js";import{s as m}from"./chunk-IYFZS4PV.js";
|
|
|
32
32
|
WHERE d2.relative_path IN (${d})
|
|
33
33
|
AND d1.relative_path NOT IN (${d})
|
|
34
34
|
ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{y as a};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-6TRXTRCW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{k as g}from"./chunk-ID7TO4P6.js";import{a as b}from"./chunk-H4IWC7KJ.js";import{b as m}from"./chunk-5IM4IQ6N.js";import{readFileSync as y}from"fs";import{join as d}from"path";function I(o,i){let t=b(o,i);if(!t)return null;let l=o.get("SELECT language FROM documents WHERE relative_path = ?",t.relativePath)?.language??"unknown",s=d(o.config.projectRoot,t.relativePath),n="";try{n=y(s,"utf-8").split(`
|
|
2
2
|
`).slice(t.startLine,t.endLine+1).join(`
|
|
3
3
|
`)}catch{}let e=S(n,l),f=t.endLine-t.startLine+1,a=g(o,[t],{additive:!0}).get(t.symbolId)??[],p=new Set(a.map(r=>r.symbol)),u=o.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
4
|
FROM mentions m
|
|
5
5
|
JOIN chunks c ON m.chunk_id = c.id
|
|
6
6
|
WHERE m.symbol_id = ? AND m.role != 1`,t.symbolId),h=new Set(a.filter(r=>r.file!==t.relativePath).map(r=>r.symbol)).size;return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:f,branches:e,cyclomaticEstimate:e+1,calleeCount:p.size,fanIn:u?.c??0,fanOut:h}}function S(o,i){let t=P(o),c=0,l=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let s of l){let n=t.match(s);n&&(c+=n.length)}if(i==="python"){let s=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="rust"){let s=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="ruby"){let s=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="go"){let s=[/\bselect\b/g,/\bdefer\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}return c}function P(o){return o.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*/g,"").replace(/#.*/g,"").replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/'(?:[^'\\]|\\.)*'/g,"''").replace(/`(?:[^`\\]|\\.)*`/g,"``")}export{I as a};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-C6PQLWHR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-DX5YEUX4.js";function c(e,n,o){let d=m(e,n)??n,s=m(e,o)??o,t=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
WHERE (
|
|
4
4
|
-- Defined in file1, referenced in file2
|
|
@@ -53,4 +53,4 @@ import{a as m}from"./chunk-WTSTDJZ7.js";function c(e,n,o){let d=m(e,n)??n,s=m(e,
|
|
|
53
53
|
GROUP BY def_d.id, ref_d.id
|
|
54
54
|
ORDER BY shared DESC
|
|
55
55
|
LIMIT ?`,o).filter(i=>!e.isIgnored(i.file1)&&!e.isIgnored(i.file2)).map(i=>({file1:i.file1,file2:i.file2,sharedSymbols:i.shared}))}export{c as a,r as b};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
56
|
+
//# sourceMappingURL=chunk-CH47OLNL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as d}from"./chunk-LORWXBOO.js";import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as d}from"./chunk-LORWXBOO.js";import{g as a}from"./chunk-ID7TO4P6.js";function F(t,i={}){let{minSimilarity:f=.5,limit:n=20,scope:o,filePattern:s}=i,u=i.minDeps??(s?1:3),e=g(t,{scope:o,minDeps:u}),p=[];if(s){let r=e.find(l=>l.file.includes(s));if(!r)return[];for(let l of e){if(l.file===r.file)continue;let c=m(r,l,f);c&&p.push(c)}}else for(let r=0;r<e.length;r++){for(let l=r+1;l<e.length;l++){let c=m(e[r],e[l],f);c&&p.push(c)}if(p.length>n*5)break}return p.sort((r,l)=>l.similarity-r.similarity),p.slice(0,n)}function g(t,i){let{scope:f,minDeps:n}=i,o=a(t,f),s=h(o),u=[];for(let[e,p]of o)p.size>=n&&u.push({file:e,deps:new Set([...p].filter(r=>!s.has(r)))});return u}function h(t){let i=new Set,f=t.size;if(f===0)return i;let n=new Map;for(let o of t.values())for(let s of o)n.set(s,(n.get(s)??0)+1);for(let[o,s]of n)s>=5&&s/f>.3&&i.add(o);return i}function m(t,i,f){let n=new Set;for(let e of t.deps)i.deps.has(e)&&n.add(e);if(n.size<3||t.deps.size<4||i.deps.size<4)return null;let o=d(t.deps,i.deps);if(o<f)return null;let s=[];for(let e of t.deps)i.deps.has(e)||s.push(e);let u=[];for(let e of i.deps)t.deps.has(e)||u.push(e);return{fileA:t.file,fileB:i.file,similarity:o,sharedDeps:[...n],uniqueToA:s,uniqueToB:u}}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DM56ECPZ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-H4IWC7KJ.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as f,join as g}from"path";function S(e,r){let t=u(e,r,{allowMultiple:!1})[0]?.relativePath;return t||v(e,r)}function M(e,r){return u(e,r,{allowMultiple:!0}).map(t=>t.relativePath)}function v(e,r){if(!r)return null;let t=r.replace(/\\/g,"/").replace(/^\.\//,""),a=f(t)&&t.startsWith(e.config.projectRoot)?t.slice(e.config.projectRoot.length).replace(/^\/+/,""):t,n=g(e.config.projectRoot,a);return m(n)?a:null}function u(e,r,t){let a=h(r);if(!a)return[];let i=e.all(`SELECT relative_path
|
|
2
2
|
FROM documents
|
|
3
3
|
WHERE 1 = 1
|
|
4
4
|
${e.pathExclusionsFor("documents")}
|
|
5
5
|
ORDER BY relative_path`).filter(o=>!e.isIgnored(o.relative_path)).map(o=>({relativePath:o.relative_path,score:d(o.relative_path,a)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=c(e,r);return!o||e.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let s=i.filter(o=>o.score>=800);return s.length>0?t.allowMultiple?s:[s[0]]:t.allowMultiple?i:[i[0]]}function d(e,r){let t=h(e),a=p(t),n=p(r),i=0;return t===r&&(i+=1200),t.endsWith(`/${r}`)&&(i+=1100),a===n&&(i+=900),t.startsWith(`${r}/`)&&(i+=850),t.includes(r)&&(i+=250),i}function h(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,M as b};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-DX5YEUX4.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{b as v}from"./chunk-F2TGKDMW.js";import{a as $}from"./chunk-5KWWENJZ.js";import{b as y,f as S,g as I}from"./chunk-ID7TO4P6.js";import{e as k}from"./chunk-VQXXSUQF.js";import{f as _}from"./chunk-QRULHDMO.js";import g from"path";function J(t,r){let{scope:s}=r??{},l=I(t,s),n=O(t,s),c=[];for(let[e,a]of l){if(m(e))continue;let u=n.get(e)??new Set;for(let o of a)if(!m(o)&&!u.has(o)){if(E(o)||R(t,e,o))continue;c.push({file:e,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o})}}let i=D(l);for(let[e,a]of l){if(m(e))continue;let u=h(e);for(let o of a){if(m(o))continue;let f=h(o);if(u===f)continue;i.get(`${u}->${f}`)==="violation"&&c.push({file:e,kind:"layer-violation",description:`Imports from ${f}/ (${o}) \u2014 may cross architectural boundary`,dep:o,detail:`${u}/ should not depend on ${f}/`})}}let p=new Map;for(let e of l.keys()){let a=g.dirname(e);p.has(a)||p.set(a,[]),p.get(a).push(e)}for(let[e,a]of p){let u=a.filter(f=>!m(f));if(u.length<5)continue;let o=new Map;for(let f of u)for(let d of l.get(f)??[])m(d)||o.set(d,(o.get(d)??0)+1);for(let f of u)for(let d of l.get(f)??[])m(d)||(o.get(d)??0)===1&&g.dirname(d)!==e&&g.dirname(d)!==g.dirname(e)&&c.push({file:f,kind:"pattern-deviation",description:`Only file in ${e}/ that depends on ${d}`,dep:d})}return{results:c,unusedImports:c.filter(e=>e.kind==="unused-import").length,layerViolations:c.filter(e=>e.kind==="layer-violation").length,patternDeviations:c.filter(e=>e.kind==="pattern-deviation").length}}function O(t,r){let s=r?`AND d1.relative_path LIKE '%${r}%'`:"",l=t.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents d1 ON c.document_id = d1.id
|
|
5
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
+
JOIN (
|
|
7
|
+
SELECT m2.symbol_id, c2.document_id
|
|
8
|
+
FROM mentions m2
|
|
9
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
10
|
+
WHERE m2.role = 1
|
|
11
|
+
GROUP BY m2.symbol_id
|
|
12
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
13
|
+
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
14
|
+
WHERE d1.id != d2.id
|
|
15
|
+
AND m.role != 1
|
|
16
|
+
${t.pathExclusionsFor("d1","d2")}
|
|
17
|
+
${s}`),n=new Map;for(let i of l)t.isIgnored(i.from_file)||t.isIgnored(i.to_file)||(n.has(i.from_file)||n.set(i.from_file,new Set),n.get(i.from_file).add(i.to_file));let c=t.all(`SELECT relative_path FROM documents
|
|
18
|
+
WHERE 1 = 1 ${t.pathExclusionsFor("documents")}`);for(let i of c){if(t.isIgnored(i.relative_path)||!_(i.relative_path))continue;let p=S(t,i.relative_path),e=n.get(i.relative_path);for(let a of p.keys()){let u=v(t,i.relative_path,a);for(let o of u)o.relativePath!==i.relative_path&&(t.isIgnored(o.relativePath)||(e||(e=new Set,n.set(i.relative_path,e)),e.add(o.relativePath)))}if(_(i.relative_path)==="rust"){let a=y(t,i.relative_path);for(let u of a){let o=v(t,i.relative_path,u);for(let f of o)f.relativePath!==i.relative_path&&(t.isIgnored(f.relativePath)||(e||(e=new Set,n.set(i.relative_path,e)),e.add(f.relativePath)))}}}return n}function D(t){let r=new Map,s=new Set;for(let[n,c]of t){if(m(n))continue;let i=h(n);s.add(i);for(let p of c){if(m(p))continue;let e=h(p);if(i===e)continue;s.add(e);let a=`${i}->${e}`;r.set(a,(r.get(a)??0)+1)}}let l=new Map;for(let[n,c]of r)l.set(n,c<=2?"violation":"ok");return l}function h(t){let s=t.replace(/\\/g,"/").split("/").filter(Boolean);return s.length<=1?"(root)":s.length>=3&&["src","lib","app","server","client"].includes(s[0])?`${s[0]}/${s[1]}`:s[0]}function E(t){return t.includes("types")||t.endsWith(".d.ts")}function R(t,r,s){let l=k(t,r).filter(n=>n.sourcePath===s);return l.length===0?!1:l.every(n=>n.kind==="side-effect"||n.kind==="namespace"&&n.usedMembers.length===0&&!n.used)}function m(t){let r=$(t);return!!(r==="entry"||r==="barrel"||r==="test"||r==="worker"||N(g.basename(t)))}function N(t){return!!(t==="index.ts"||t==="index.js"||t==="cli.ts"||t==="main.ts"||t==="main.rs"||t.includes("worker.")||t.includes("postinstall.")||t==="health.ts"||t==="health.js")}export{J as a};
|
|
19
|
+
//# sourceMappingURL=chunk-DXXROCSQ.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{a as y,b as A}from"./chunk-F2TGKDMW.js";import{d as C,e as B,f as $,g as W,h as H}from"./chunk-5KWWENJZ.js";import{c as M}from"./chunk-56LPZC3S.js";import{a as w,b as D,c as O,f as k}from"./chunk-ID7TO4P6.js";import{f as T,g as I,q as x,v as N}from"./chunk-QRULHDMO.js";import{b as L,f as R,g as E,h as P,i as F}from"./chunk-5IM4IQ6N.js";function se(t,a={}){let{scope:p,minLoc:c=1,includeTests:o=!1,skipBarrels:m=!1,includeMembers:s=!1}=a,n=m?new Set(C(t)):new Set,i=t.all(`SELECT
|
|
2
|
+
m.symbol_id,
|
|
3
|
+
d.relative_path,
|
|
4
|
+
COUNT(*) AS ref_count
|
|
5
|
+
FROM mentions m
|
|
6
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
+
JOIN documents d ON c.document_id = d.id
|
|
8
|
+
WHERE m.role != 1
|
|
9
|
+
${t.pathExclusionsFor("d")}
|
|
10
|
+
GROUP BY m.symbol_id, d.relative_path`),f=new Map;for(let e of i){if(t.isIgnored(e.relative_path)||n.has(e.relative_path))continue;let r=f.get(e.symbol_id);r||(r=new Map,f.set(e.symbol_id,r)),r.set(e.relative_path,e.ref_count)}V(t,f,n);let u=G(t),g=x(t,{scope:p}).filter(e=>!t.isIgnored(e.relativePath)).filter(e=>!E(e.symbol)).filter(e=>b(e.symbol)).filter(e=>e.isFunctionLike||!e.enclosingSymbol||!b(e.enclosingSymbol)).filter(e=>o||Y(e.relativePath)).filter(e=>o||!u(e.relativePath,e.startLine,e.symbol,e.parentTypeName)).filter(e=>!P(e.symbol)).filter(e=>!F(e.symbol)).filter(e=>s||b(e.symbol)).filter(e=>e.endLine-e.startLine+1>=c).map(e=>{let r=f.get(e.symbolId)??new Map,U=r.get(e.relativePath)??0,v=0;for(let[j,J]of r)j!==e.relativePath&&(v+=J);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:U,cross_file_refs:v}}).filter(e=>e.cross_file_refs===0).sort((e,r)=>r.loc-e.loc||e.relative_path.localeCompare(r.relative_path)||e.start_line-r.start_line),l=0,d=0,_=0,S=g.filter(e=>!t.isIgnored(e.relative_path)).filter(e=>!B(t,e.relative_path)).filter(e=>!$(t,e.symbol,e.relative_path)).map(e=>{let r=e.same_file_refs===0?"dead-code":"file-internal";return r==="dead-code"?l++:d++,_+=e.loc,{relativePath:e.relative_path,startLine:e.start_line,endLine:e.end_line,loc:e.loc,symbol:e.symbol,shortName:L(e.symbol),sameFileRefs:e.same_file_refs,kind:r}});return{symbols:S,totalCount:S.length,deadCodeCount:l,fileInternalCount:d,totalLoc:_}}function V(t,a,p){let c=t.all(`SELECT relative_path FROM documents
|
|
11
|
+
WHERE 1 = 1 ${t.pathExclusionsFor("documents")}`),o=new Set(c.map(n=>n.relative_path)),m=new Set(M(t));for(let n of o)m.add(n);let s=(n,i,f)=>{if(f<=0)return;let u=a.get(n);u||(u=new Map,a.set(n,u)),u.set(i,(u.get(i)??0)+f)};for(let n of m){if(!T(n)&&!I(n)||t.isIgnored(n)||p.has(n))continue;let i=k(t,n);for(let[h,g]of i){let l=A(t,n,h);if(l.length!==0)for(let d of l){let _=d.relativePath===n?Math.max(0,g.length-1):g.length;s(d.symbolId,n,_)}}let f=O(t,n);for(let h of f){let g=y(t,n,h);for(let l of g)l.relativePath!==n&&s(l.symbolId,n,1)}let u=D(t,n);for(let h of u){let g=y(t,n,h);for(let l of g)s(l.symbolId,n,1)}}}function G(t){let a=new Map,p=c=>{let o=a.get(c);if(o)return o;let m=w(t,c);return o={ranges:m.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(m.map(s=>s.containerName).filter(s=>!!s))},a.set(c,o),o};return(c,o,m,s)=>{let n=p(c);for(let i of n.ranges)if(o>=i.startLine&&o<=i.endLine)return!0;if(s&&n.containers.has(s))return!0;for(let i of N(m))if(n.containers.has(i))return!0;return!1}}function Y(t){return[...new Set([...W,...H])].every(p=>!q(t,p))}function q(t,a){return new RegExp(`^${a.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/%/g,".*").replace(/_/g,".")}$`).test(t)}function b(t){return R(t)||t.endsWith("().")||t.endsWith(".")}export{se as a};
|
|
12
|
+
//# sourceMappingURL=chunk-EARGTC7U.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as m}from"./chunk-
|
|
1
|
+
import{b as m}from"./chunk-DX5YEUX4.js";import{p as a}from"./chunk-QRULHDMO.js";import{b as d,e as l}from"./chunk-5IM4IQ6N.js";function u(t,n){let s=m(t,n);if(s.length===0)return[];let i=s.map(()=>"?").join(", "),c=t.all(`SELECT DISTINCT d1.relative_path, gs.symbol
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -26,4 +26,4 @@ import{b as m}from"./chunk-WTSTDJZ7.js";import{p as a}from"./chunk-IYFZS4PV.js";
|
|
|
26
26
|
AND ${t.localSymbolPredicate}
|
|
27
27
|
${t.pathExclusionsFor("d1")}
|
|
28
28
|
ORDER BY d1.relative_path`,...s,...s,...s),p=s.flatMap(e=>a(t,e).filter(o=>l(o.symbol)).map(o=>({relative_path:e,symbol:o.symbol}))),r=new Set;return[...c,...p].filter(e=>!t.isIgnored(e.relative_path)).filter(e=>{let o=`${e.relative_path}|${e.symbol}`;return r.has(o)?!1:(r.add(o),!0)}).map(e=>({consumer:e.relative_path,symbol:e.symbol,shortName:d(e.symbol)}))}export{u as a};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-EJXPKSWV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as n}from"./chunk-H4IWC7KJ.js";import{p as l}from"./chunk-QRULHDMO.js";import{b as m,d as o,j as i}from"./chunk-5IM4IQ6N.js";function f(r,a){let t=n(r,a);return t?l(r,t.relativePath).filter(e=>e.symbol!==t.symbol).filter(e=>i(t.symbol,e.symbol)).sort((e,s)=>e.startLine-s.startLine||e.endLine-s.endLine).map(e=>({symbol:e.symbol,shortName:m(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:o(e.symbol)??"unknown"})):[]}export{f as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EUHHVFTI.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as u}from"./chunk-56LPZC3S.js";import{d as I,e as x,l as p}from"./chunk-ID7TO4P6.js";import{e as R}from"./chunk-VQXXSUQF.js";import{c as h}from"./chunk-H4IWC7KJ.js";import{d as b,p as S,t as y}from"./chunk-QRULHDMO.js";import{c as d}from"./chunk-5IM4IQ6N.js";function g(o,c,n){let e=p(o).get(n);if(!e||e.length===0)return[];if(e.length===1)return[l(e[0])];let i=e.filter(f=>f.file===c);if(i.length>0)return i.map(l);let t=P(o,c),r=t.get(n);if(r)for(let f of r){let s=e.filter(m=>D(f,m.file));if(s.length>0)return s.map(l)}let a=new Set;for(let f of t.values())for(let s of f)a.add(s);for(let f of a){let s=e.filter(m=>D(f,m.file));if(s.length>0&&s.length===e.length)return s.map(l)}return[]}function j(o,c,n){let e=g(o,c,n);if(e.length>0)return e;let i=p(o).get(n);return!i||i.length===0?[]:i.map(l)}function C(o,c){let n=h(o,c);if(!n)return[];let e=d(n.symbol);if(!e)return[];let i=new Map;for(let t of u(o)){let r=b(o,t);if(!r||r.indexOf(e)===-1||t!==n.relativePath&&!g(o,t,e).some(s=>s.symbolId===n.symbolId))continue;let a=I(o,t,e,t===n.relativePath?{excludeStartLine:n.startLine,excludeEndLine:n.endLine}:{});a.length>0&&i.set(t,a)}return w(o,i)}function E(o,c){let n=new Map;for(let t of c){if(!t.leaf)continue;let r=n.get(t.leaf)??[];r.push(t),n.set(t.leaf,r)}if(n.size===0)return new Map;let e=new Set(c.map(t=>t.symbolId)),i=new Map;for(let t of u(o)){let r=x(o,t);if(r.size!==0){for(let a of r)if(n.has(a))for(let f of g(o,t,a)){if(!e.has(f.symbolId)||t===f.relativePath)continue;let s=i.get(f.symbolId);s||(s=new Set,i.set(f.symbolId,s)),s.add(t)}}}return i}function P(o,c){let n=new Map;for(let e of R(o,c)){if(!e.sourcePath)continue;let i=e.localName??e.importedName;if(i){let t=n.get(i);t||(t=new Set,n.set(i,t)),t.add(e.sourcePath)}if(e.kind==="namespace")for(let t of e.usedMembers){let r=n.get(t);r||(r=new Set,n.set(t,r)),r.add(e.sourcePath)}}return n}function D(o,c){let n=e=>e.replace(/\\/g,"/").replace(/^\.\//,"");return n(o)===n(c)}function l(o){return{symbolId:o.symbolId,symbol:o.symbol,relativePath:o.file}}function w(o,c){let n=[],e=new Set;for(let[i,t]of c){let r=S(o,i);for(let a of t){let f=y(r,a),s=`${i}|${a}|${f?.symbol??""}`;e.has(s)||(e.add(s),n.push({file:i,line:a,enclosingSymbol:f?.symbol??null}))}}return n}export{g as a,j as b,C as c,E as d};
|
|
2
|
+
//# sourceMappingURL=chunk-F2TGKDMW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-H4IWC7KJ.js";import{p as l}from"./chunk-QRULHDMO.js";import{c as r,e as a}from"./chunk-5IM4IQ6N.js";import{basename as p}from"path";function M(t,c){let o=m(t,c);if(!o)return[];let s=r(o.symbol),i=l(t,o.relativePath).filter(e=>a(e.symbol)),n=i.filter(e=>e.parentTypeName===s||e.symbol.includes(s));return(n.length>0?n:f(p(o.relativePath))===s?i.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:r(e.symbol)}))}function f(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GSVIC6KN.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as p}from"./chunk-
|
|
1
|
+
import{u as p}from"./chunk-QRULHDMO.js";import{b as N,c as E,f as R,g as I}from"./chunk-5IM4IQ6N.js";function T(e,t){let n=v(e,t.trim());if(n)return n;let i=t.match(/^(.+):(\d+)-(\d+)$/);if(i){let[,c,_,h]=i,u=Math.max(0,parseInt(_,10)-1),f=Math.max(u,parseInt(h,10)-1),m=e.get(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
4
4
|
JOIN documents d ON der.document_id = d.id
|
|
@@ -86,4 +86,4 @@ import{u as p}from"./chunk-IYFZS4PV.js";import{b as N,c as E,f as R,g as I}from"
|
|
|
86
86
|
${e.pathExclusionsFor("d")}
|
|
87
87
|
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name
|
|
88
88
|
LIMIT 200`,...i)}function D(e,t,n,i){let d=t.trim(),o=n,l=o.replace(/\(\)$/,""),a=t.toLowerCase(),r=n.toLowerCase(),c=r.replace(/\(\)$/,""),_=e.symbol,h=N(e.symbol),u=E(e.symbol),f=e.display_name??"",m=e.symbol.toLowerCase(),y=h.toLowerCase(),S=u.toLowerCase(),O=f.toLowerCase(),g=e.relative_path.toLowerCase(),L=/[/:.]/.test(n),s=0;return(_===d||_===o)&&(s+=1150),(h===d||h===o)&&(s+=1100),f===l&&(s+=980),u===l&&(s+=960),(`${u}()`===d||`${u}()`===o)&&(s+=955),(m===a||m===r)&&(s+=1e3),(y===a||y===r)&&(s+=950),(g===a||g===r)&&(s+=925),(g.endsWith(`/${r}`)||g.endsWith(`/${a}`))&&(s+=875),O===c&&(s+=850),S===c&&(s+=825),(`${S}()`===a||`${S}()`===r)&&(s+=820),(y.endsWith(`:${r}`)||y.endsWith(`:${c}`)||y.endsWith(`:${c}()`))&&(s+=800),m.includes(r)&&(s+=120),y.includes(r)&&(s+=140),g.includes(r)&&(s+=140),O.includes(r)&&(s+=110),i.every(C=>{let b=C.toLowerCase();return m.includes(b)||y.includes(b)||g.includes(b)||O.includes(b)})&&(s+=100+i.length*15),R(e.symbol)&&S===c&&(s+=60),!L&&I(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function M(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function w(e){let t=M(e),n=t.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return n.length>0?[...new Set(n)]:[t]}function x(e,t,n){let i=t.trim(),d=e.filter(o=>{let l=N(o.symbol),a=(o.display_name??"").trim();return o.symbol===i||l===i||l===n||a===i||a===n||`${a}()`===i||o.relative_path===i});return d.length===0?null:(d.sort((o,l)=>o.end_line-o.start_line-(l.end_line-l.start_line)||o.relative_path.localeCompare(l.relative_path)||o.symbol.localeCompare(l.symbol)),d[0]??null)}export{T as a,v as b,W as c};
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
89
|
+
//# sourceMappingURL=chunk-H4IWC7KJ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as S}from"./chunk-F2TGKDMW.js";import{j as d}from"./chunk-ID7TO4P6.js";import{a as g}from"./chunk-H4IWC7KJ.js";import{d as u,n as m,o as f}from"./chunk-QRULHDMO.js";import{b as s,f as a}from"./chunk-5IM4IQ6N.js";function _(n,o){let e=g(n,o);if(!e)return{definitions:[],referencedBy:[]};let i=n.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",e.symbolId),t=f(i?.documentation??null),c=n.isIgnored(e.relativePath)?[]:[{relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,signature:b(t,i?.display_name??null,e.symbol),source:y(n,e.relativePath,e.startLine,e.endLine)}],l=S(n,e),p=(l.length>0?l:d(n,e)).filter(r=>!n.isIgnored(r.file)).map(r=>({relativePath:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol,enclosingShort:r.enclosingSymbol?s(r.enclosingSymbol):"(top-level)"}));return{definitions:c,referencedBy:p}}function y(n,o,e,i){let t=u(n,o);if(!t)return null;let l=t.split(`
|
|
2
2
|
`).slice(e,i+1).join(`
|
|
3
3
|
`).trimEnd();return l.length>0?l:null}function b(n,o,e){let i=m(n);if(i&&!h(i))return i;let t=(o??"").trim();return t?a(e)&&!t.endsWith("()")?`${t}()`:t:s(e)}function h(n){return n.startsWith("undefined")||n.includes("|")||n.includes("```")}export{_ as a};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-H7BWAMFI.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-H4IWC7KJ.js";import{a as g,b as m}from"./chunk-5IM4IQ6N.js";function S(n,d){let c=f(n,d);if(!c)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
|
|
2
2
|
WHERE id = ? LIMIT 1`,c.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,a=new Set([t.symbol]);for(;e&&!a.has(e)&&r<20;){a.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,p=1;s>=0;s--,p++){let h=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:h,shortName:h,depth:p})}return b}export{S as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-HLILTI7S.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{d as T}from"./chunk-F2TGKDMW.js";import{m as I}from"./chunk-ID7TO4P6.js";import{d as k}from"./chunk-VQXXSUQF.js";import{a as M,d as y,e as D,f as P,h as w,j as A,r as C}from"./chunk-QRULHDMO.js";import{a as x,b as F,c as b}from"./chunk-5IM4IQ6N.js";function ie(t,s){let{scope:n,minLoc:r=3,maxLoc:i=80,limit:o=30,includeLowConfidence:c=!1}=s??{},a=E(t,n),l=C(t,n).filter(e=>e.isTypeLike&&L(e)>=r).filter(e=>L(e)<=i).filter(e=>!t.isIgnored(e.relativePath)).filter(e=>!$(e.symbol)).filter(e=>!D(t,e.relativePath,e.startLine)),f=I(t,l),u=T(t,l),g=q(f,u),d=new Map;for(let e of l){let m=d.get(e.relativePath);m||(m=new Map,d.set(e.relativePath,m));let p=b(e.symbol);p&&m.set(p,e)}return l.map(e=>{let p=[...g.get(e.symbolId)??new Set].filter(v=>v!==e.relativePath&&!t.isIgnored(v)),{realConsumers:h,barrelConsumers:S}=O(t,e.relativePath,e.symbol,p),R=U(t,e,g,d);return{definition:e,realConsumers:h,barrelConsumers:S,transitivelyReachable:R}}).filter(e=>!e.transitivelyReachable).filter(e=>e.realConsumers.length<=1).filter(e=>!(e.realConsumers.length===0&&e.barrelConsumers>0)).filter(e=>N(e.definition,e.realConsumers.length,a)).map(e=>{let m=G(t,e.definition.relativePath,e.definition.startLine),p=_(e.definition.relativePath)?!0:H(t,e.definition),{confidence:h,reason:S}=K(e.realConsumers.length,m,p);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:L(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:m,definerUsesType:p,confidence:h,reason:S}}).filter(e=>c||e.confidence!=="low").sort((e,m)=>{let p={high:0,medium:1,low:2};return p[e.confidence]-p[m.confidence]||m.loc-e.loc||e.file.localeCompare(m.file)||e.startLine-m.startLine}).slice(0,o)}function E(t,s){return new Set(C(t,s).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function $(t){let s=x(t);if("kind"in s)return!1;let n=s.descriptors;if(n.length<2)return!1;let r=n[n.length-1],i=n[n.length-2];return r?.suffix==="type"&&i?.suffix==="type"}function _(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t))}function N(t,s,n){return!(_(t.relativePath)&&s>0||s===0&&n.has(t.relativePath))}function O(t,s,n,r){let i=[],o=0,c=b(n);for(let a of r)z(t,a,s,c)||B(t,a,c)?o++:i.push(a);return{realConsumers:i,barrelConsumers:o}}function U(t,s,n,r){let i=A(t,s.relativePath),o=b(s.symbol);if(!o)return!1;let c=i.get(o);if(!c||c.size===0)return!1;let a=r.get(s.relativePath);if(!a)return!1;for(let l of c){let f=a.get(l);if(!f)continue;let u=n.get(f.symbolId);if(u){for(let g of u)if(g!==s.relativePath&&!t.isIgnored(g))return!0}}return!1}var j=M("stale-abs-file-usage");function B(t,s,n){if(!n)return!1;let r=P(s);if(!r)return!1;let i=j.get(t,s,()=>W(t,s,r));return i.importedLeaves.has(n)&&!i.usedLeaves.has(n)}function W(t,s,n){let r=new Set,i=new Set,o=w(t,s);if(!o)return{importedLeaves:r,usedLeaves:i};let c=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),a=(l,f)=>{let u=f||c.has(l.type);(l.type==="identifier"||l.type==="type_identifier"||l.type==="property_identifier"||l.type==="field_identifier")&&(u?r.add(l.text):i.add(l.text));for(let g of l.children)a(g,u)};return a(o.rootNode,!1),{importedLeaves:r,usedLeaves:i}}function z(t,s,n,r){if(!r)return!1;let i=y(t,s);if(!i)return!1;let o=k(t,s);if(o.length===0)return!1;let c=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${c}\\b`),l=i.split(`
|
|
2
|
+
`),f=0;for(let u=0;u<l.length;u++){if(!a.test(l[u]??""))continue;if(f++,!o.find(d=>d.startLine<=u&&u<=d.endLine))return!1}return f>0}function G(t,s,n){let r=y(t,s);if(!r)return"other";let i=r.split(`
|
|
3
|
+
`),o=Math.max(0,n-2),c=Math.min(i.length-1,n+2);for(let a=o;a<=c;a++){let f=(i[a]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(f))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(f))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(f))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(f))return"enum"}return"other"}function H(t,s){let n=y(t,s.relativePath);if(!n)return!1;let r=b(s.symbol);if(!r)return!1;let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`\\b${i}\\b`),c=n.split(`
|
|
4
|
+
`);for(let a=0;a<c.length;a++)if(!(a>=s.startLine&&a<=s.endLine)&&o.test(c[a]??""))return!0;return!1}function K(t,s,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&s==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}function L(t){return t.endLine-t.startLine+1}function q(...t){let s=new Map;for(let n of t)for(let[r,i]of n){let o=s.get(r);o||(o=new Set,s.set(r,o));for(let c of i)o.add(c)}return s}export{ie as a};
|
|
5
|
+
//# sourceMappingURL=chunk-HUEIPY4M.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{a as T,b as H,c as $,e as J}from"./chunk-VQXXSUQF.js";import{c as P}from"./chunk-H4IWC7KJ.js";import{a as I,b as N,d as A,f as E,h as L,i as k,k as C,m as v,p as O,q as D,t as F}from"./chunk-QRULHDMO.js";import{c as R}from"./chunk-5IM4IQ6N.js";var x=new WeakMap;function xe(n,o){let i=E(o);return i==="rust"?ne(n,o):i==="typescript"||i==="tsx"||i==="javascript"?Q(n,o):[]}var X=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function Q(n,o){let i=L(n,o);if(!i)return[];let l=x.get(i);if(l)return l;let a=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(o)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(o),r=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(o),d=!1,t=i.rootNode;for(let s of t.namedChildren){if(s.type!=="expression_statement")continue;let f=s.namedChild(0);if(!f||f.type!=="call_expression")continue;let e=f.namedChild(0);if(!e)continue;let u=e.type==="member_expression"?e.namedChild(e.namedChildCount-1)?.text:e.text;if(u&&X.has(u)){d=!0;break}}let c=[];d&&c.push({startLine:0,endLine:t.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(a||r)&&c.push({startLine:0,endLine:t.endPosition.row,reason:a?"Next.js / Remix route file":"Vite/Vue route component"});for(let s of t.namedChildren){let f=null,e=null;if(s.type==="function_declaration")f=s.namedChild(0)?.text??null,e=s;else if(s.type==="export_statement"){let u=s.namedChild(0);u?.type==="function_declaration"&&(f=u.namedChild(0)?.text??null,e=u)}else if(s.type==="lexical_declaration"){let u=s.namedChild(0);if(u?.type==="variable_declarator"){let p=u.namedChild(0)?.text,m=u.namedChild(1);p&&(m?.type==="arrow_function"||m?.type==="function_expression")&&(f=p,e=u)}}f&&/^use[A-Z]/.test(f)&&e&&c.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"React custom hook (use*)"})}return c.push(...z(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),x.set(i,c),c}var ee=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function te(n){return ee.test(n)}function z(n,o,i){let l=[],a=r=>{if(o.has(r.type)&&r.parent){let t=r.parent.children,c=-1;for(let s=0;s<t.length;s+=1)if(t[s].startIndex===r.startIndex&&t[s].type===r.type){c=s;break}if(c>0)for(let s=c-1;s>=0;s-=1){let f=t[s];if(i.has(f.type)){if(te(f.text)){l.push({startLine:r.startPosition.row,endLine:r.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(f.type==="attribute_item"||f.type==="inner_attribute_item"))break}}for(let d of r.namedChildren)a(d)};return a(n.rootNode),l}function ne(n,o){let i=L(n,o);if(!i)return[];let l=x.get(i);if(l)return l;let a=[];if(ie(i.rootNode)){let e={startLine:0,endLine:i.rootNode.endPosition.row,reason:"generated file (@generated header)"};return x.set(i,[e]),[e]}let r=e=>{let u=e.parent;if(!u)return[];let p=u.children,m=-1;for(let g=0;g<p.length;g+=1)if(p[g].startIndex===e.startIndex&&p[g].type===e.type){m=g;break}if(m<=0)return[];let b=[];for(let g=m-1;g>=0;g-=1){let _=p[g];if(_.type==="attribute_item"||_.type==="inner_attribute_item")b.push(_.text);else{if(_.type==="line_comment"||_.type==="block_comment")continue;break}}return b},d=e=>/#\[\s*tauri::command\b/.test(e)?"#[tauri::command]":/#\[\s*command\b/.test(e)?"#[command]":/#\[\s*test\b/.test(e)?"#[test]":/#\[\s*bench\b/.test(e)?"#[bench]":/#\[\s*tokio::test\b/.test(e)?"#[tokio::test]":/#\[\s*async_std::test\b/.test(e)?"#[async_std::test]":/#\[\s*wasm_bindgen\b/.test(e)?"#[wasm_bindgen]":/#\[\s*no_mangle\b/.test(e)?"#[no_mangle]":/#\[\s*napi\b/.test(e)?"#[napi]":/#\[\s*pyfunction\b/.test(e)?"#[pyfunction]":/#\[\s*pymethod\b/.test(e)?"#[pymethod]":/#\[\s*pyo3\b/.test(e)?"#[pyo3]":/#\[\s*cfg\s*\(\s*test\s*\)/.test(e)?"#[cfg(test)]":/#\[\s*doc\s*\(\s*hidden\s*\)/.test(e)?"#[doc(hidden)]":null,t=e=>/#\[\s*derive\s*\(/.test(e)?/\bSerialize\b/.test(e)||/\bDeserialize\b/.test(e)||/\bFromRow\b/.test(e)||/\bDeriveEntityModel\b/.test(e)||/\bIntoSchema\b/.test(e)||/\bToSchema\b/.test(e)||/\bDeriveValueType\b/.test(e)||/\bsqlx::FromRow\b/.test(e)||/\bError\b/.test(e)||/\bthiserror::Error\b/.test(e):!1,c=e=>/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e),s=(e,u,p,m)=>{let b=u,g=p,_=m;if(e.type==="trait_item"&&(_=!0,a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"})),e.type==="impl_item"&&e.childForFieldName("trait")&&(g=!0,a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"){let y=r(e),h=null;p?h="trait impl method (dynamic dispatch)":u&&(h="inside #[cfg(test)] mod");for(let S of y){let w=d(S);if(w){h=w;break}if(c(S)){h="#[allow(dead_code)]";break}}h&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:h})}else if(p&&(e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"))a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"});else if(e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"){let y=r(e),h=y.some(t),S=y.some(c),w=e.namedChildren.find(Z=>Z.type==="type_identifier")?.text;h&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:w}),S&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:w}),u&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:w})}else e.type==="mod_item"&&r(e).some(h=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(h))&&(b=!0);for(let y of e.namedChildren)s(y,b,g,_)};s(i.rootNode,!1,!1,!1),a.push(...z(i,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"])));let f=ce(i.rootNode);if(f.size>0)for(let e of i.rootNode.descendantsOfType("mod_item")){let u=e.childForFieldName("name")?.text;u&&f.has(u)&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:u})}return x.set(i,a),a}function ie(n){for(let o=0;o<Math.min(n.namedChildCount,12);o+=1){let i=n.namedChild(o);if(!i||i.type!=="line_comment"&&i.type!=="block_comment")break;if(/@generated\b/.test(i.text)||/This file is .*generated\b/i.test(i.text)||/Code generated by/i.test(i.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(i.text)||/openapi-generator/i.test(i.text)&&/Generated by/i.test(i.text))return!0}return!1}var se=[{key:"default",re:/\bdefault\s*=\s*"([^"]+)"/g},{key:"with",re:/\bwith\s*=\s*"([^"]+)"/g},{key:"serialize_with",re:/\bserialize_with\s*=\s*"([^"]+)"/g},{key:"deserialize_with",re:/\bdeserialize_with\s*=\s*"([^"]+)"/g},{key:"skip_serializing_if",re:/\bskip_serializing_if\s*=\s*"([^"]+)"/g},{key:"getter",re:/\bgetter\s*=\s*"([^"]+)"/g},{key:"rename_all_with",re:/\brename_all_with\s*=\s*"([^"]+)"/g},{key:"schema_with",re:/\bschema_with\s*=\s*"([^"]+)"/g}],j=/^#!?\[\s*serde\s*\(/,oe=/^#!?\[\s*schemars\s*\(/,re=/^#!?\[\s*validate\s*\(/,W=/\bwith\s*=\s*"([^"]+)"/g;function G(n,o){return C(n,o,ae,()=>new Set,(i,l,a)=>{if(l==="rust"){for(let r of i.rootNode.descendantsOfType("attribute_item"))B(r.text,a);for(let r of i.rootNode.descendantsOfType("inner_attribute_item"))B(r.text,a)}})??new Set}var ae=new WeakMap;function B(n,o){let i=j.test(n),l=oe.test(n),a=re.test(n);if(!(!i&&!l&&!a))for(let{re:r}of se){r.lastIndex=0;let d;for(;(d=r.exec(n))!==null;){let t=d[1],c=t.split("::").pop()??t;c==="is_none"&&/\bOption\b/.test(t)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(t)||c&&o.add(c)}}}function ce(n){let o=new Set;for(let i of n.descendantsOfType("attribute_item")){if(!j.test(i.text))continue;W.lastIndex=0;let l;for(;(l=W.exec(i.text))!==null;){let a=l[1],r=a.split("::").pop()??a;r&&o.add(r)}}return o}var le=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function Re(n,o){return C(n,o,de,()=>new Set,(i,l,a)=>{if(!(l!=="typescript"&&l!=="tsx"&&l!=="javascript"))for(let r of i.rootNode.descendantsOfType("call_expression")){let d=r.namedChild(0);if(!d)continue;let t=v(d);if(!t||!le.has(t))continue;let c=r.namedChildren.find(e=>e.type==="arguments");if(!c)continue;let s=c.namedChild(0);if(!s||s.type!=="string")continue;let f=s.namedChildren.find(e=>e.type==="string_fragment");f&&a.add(f.text)}})??new Set}var de=new WeakMap;function Y(n,o,i,l={}){if(!i)return[];let a=A(n,o);if(!a)return[];if(a.indexOf(i)===-1)return[];if(E(o))return(M(n,o).get(i)??[]).filter(f=>!V(f,l));let r=H(n,o,a),d=new RegExp(`\\b${$(i)}\\b`),t=[];for(let c=0;c<r.length;c++)V(c,l)||d.test(r[c]??"")&&t.push(c);return t}function V(n,o){return typeof o.excludeStartLine=="number"&&typeof o.excludeEndLine=="number"&&n>=o.excludeStartLine&&n<=o.excludeEndLine}var ue=I("file-identifiers");function ve(n,o){return ue.get(n,o,()=>new Set(M(n,o).keys()))}var fe=I("file-ident-lines");function M(n,o){return fe.get(n,o,()=>pe(n,o))}var me=I("file-idents-by-line");function U(n,o){return me.get(n,o,()=>{let i=M(n,o),l=0;for(let r of i.values()){let d=r[r.length-1];d!==void 0&&d>l&&(l=d)}let a=new Array(l+1);for(let r=0;r<=l;r+=1)a[r]=new Set;for(let[r,d]of i)for(let t of d)a[t].add(r);return a})}function pe(n,o){let i=new Map,l=(t,c)=>{let s=i.get(t);if(!s){i.set(t,[c]);return}s[s.length-1]!==c&&s.push(c)};if(E(o)){let t=L(n,o);if(t){let c=E(o),s=c==="rust"?new Set(["identifier","type_identifier","field_identifier"]):c==="python"?new Set(["identifier"]):new Set(["identifier","property_identifier","type_identifier"]),f=new Set(["rust","python"]),e=/\{([^{}]*)\}/g,u=/\b([A-Za-z_][\w]*)\b/g,p=m=>{if(s.has(m.type)&&l(m.text,m.startPosition.row),c&&f.has(c)&&m.type==="string_content"){let b=m.startPosition.row;for(let g of m.text.matchAll(e)){let _=g[1]??"";for(let y of _.matchAll(u))y[1]&&l(y[1],b)}}for(let b of m.children)p(b)};return p(t.rootNode),i}}let a=A(n,o);if(!a)return i;let r=T(a).split(/\r?\n/),d=/\b([A-Za-z_$][\w$]*)\b/g;for(let t=0;t<r.length;t+=1){let c=r[t]??"";for(let s of c.matchAll(d))s[1]&&l(s[1],t)}return i}var be=I("file-dep-graph");function Be(n,o){return be.get(n,o??"",()=>{let i=o?`AND d1.relative_path LIKE '%${o}%'`:"",l=n.all(`SELECT DISTINCT
|
|
2
|
+
d1.relative_path AS from_file,
|
|
3
|
+
d2.relative_path AS to_file
|
|
4
|
+
FROM mentions m
|
|
5
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
6
|
+
JOIN documents d1 ON c.document_id = d1.id
|
|
7
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
8
|
+
JOIN (
|
|
9
|
+
SELECT m2.symbol_id, c2.document_id
|
|
10
|
+
FROM mentions m2
|
|
11
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
12
|
+
WHERE m2.role = 1
|
|
13
|
+
GROUP BY m2.symbol_id
|
|
14
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
15
|
+
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
16
|
+
WHERE d1.id != d2.id
|
|
17
|
+
AND m.role != 1
|
|
18
|
+
${n.pathExclusionsFor("d1","d2")}
|
|
19
|
+
${i}`),a=new Map,r=new Set(n.all(`SELECT relative_path
|
|
20
|
+
FROM documents
|
|
21
|
+
WHERE 1 = 1
|
|
22
|
+
${n.pathExclusionsFor("documents")}
|
|
23
|
+
ORDER BY relative_path`).map(t=>t.relative_path).filter(t=>!n.isIgnored(t))),d=(t,c)=>{t!==c&&(n.isIgnored(t)||n.isIgnored(c)||r.has(c)&&(a.has(t)||a.set(t,new Set),a.get(t).add(c)))};for(let t of l)d(t.from_file,t.to_file);for(let t of r)if(!(o&&!t.includes(o)))for(let c of J(n,t))c.sourcePath&&d(t,c.sourcePath);return a})}function ze(n,o,i={}){let a=K(n,[o]).get(o.symbolId)??[];return typeof i.limit=="number"?a.slice(0,i.limit):a}function je(n,o,i={}){let a=ye(n).get(o.symbolId)??[];return typeof i.limit=="number"?a.slice(0,i.limit):a}var ge=N("caller-rows");function ye(n){return ge.get(n,()=>{let o=D(n),i=K(n,o),l=new Map;for(let d of o)l.set(d.symbol,d.symbolId);let a=new Map,r=new Map;for(let d of o){let t=i.get(d.symbolId);if(!(!t||t.length===0))for(let c of t){let s=l.get(c.symbol);if(s===void 0||s===d.symbolId)continue;let f=a.get(s);f||(f=[],a.set(s,f),r.set(s,new Set));let e=`${d.symbol}|${d.relativePath}`;r.get(s).has(e)||(r.get(s).add(e),f.push({symbol:d.symbol,file:d.relativePath}))}}return a})}function Ge(n,o){let i=he(n,o);return i?Se(n,_e(n,i.match,i.identifier)):[]}function _e(n,o,i){let l=n.all(`SELECT DISTINCT d.relative_path, c.start_line, c.end_line
|
|
24
|
+
FROM mentions m
|
|
25
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
26
|
+
JOIN documents d ON c.document_id = d.id
|
|
27
|
+
WHERE m.symbol_id = ?
|
|
28
|
+
AND m.role != 1
|
|
29
|
+
${n.pathExclusionsFor("d")}
|
|
30
|
+
ORDER BY d.relative_path, c.start_line`,o.symbolId),a=new Map;for(let d of l){if(n.isIgnored(d.relative_path))continue;let t=a.get(d.relative_path);t||(t=[],a.set(d.relative_path,t)),t.push({start_line:d.start_line,end_line:d.end_line})}let r=new Map;for(let[d,t]of a){let c=d===o.relativePath?{excludeStartLine:o.startLine,excludeEndLine:o.endLine}:{},s=i?Y(n,d,i,c):[],f=[];for(let e of t){let u=s.filter(m=>m>=e.start_line&&m<=e.end_line),p=u.length>0?u:[e.start_line];for(let m of p)f.push(m)}r.set(d,f)}return r}function he(n,o){let i=P(n,o);return i?{match:i,identifier:R(i.symbol)||null}:null}function Se(n,o){let i=[],l=new Set;for(let[a,r]of o){let d=O(n,a);for(let t of r){let c=F(d,t),s=`${a}|${t}|${c?.symbol??""}`;l.has(s)||(l.add(s),i.push({file:a,line:t,enclosingSymbol:c?.symbol??null}))}}return i}function K(n,o,i={}){if(o.length===0)return new Map;let l=i.additive??!1,a=[],r=[];for(let s of o)E(s.relativePath)&&k(n,s.relativePath)!==null?a.push(s):r.push(s);let d=new Map,t=s=>{for(let[f,e]of s){let u=d.get(f);u||(u=[],d.set(f,u));let p=new Set(u.map(m=>`${m.symbol}|${m.chunkId}`));for(let m of e){let b=`${m.symbol}|${m.chunkId}`;p.has(b)||(p.add(b),u.push(m))}}};a.length>0&&t(Ee(n,a));let c=l?o:r;return c.length>0&&t(Ie(n,c)),d}function Ee(n,o){let i=new Map,l=new Map;for(let r of o){let d=l.get(r.relativePath);d?d.push(r):l.set(r.relativePath,[r]),i.set(r.symbolId,[])}let a=q(n);for(let[r,d]of l){let t=k(n,r);if(!t)continue;let c=[...d].sort((s,f)=>{let e=s.endLine-s.startLine,u=f.endLine-f.startLine;return e-u});for(let s of t){let f=null;for(let b of c)if(s.line>=b.startLine&&s.line<=b.endLine){f=b;break}if(!f)continue;let e=a.get(s.calleeLeaf);if(!e||e.length===0)continue;let u=null,p=e.find(b=>b.file===r);if(p?u=p:e.length===1&&(u=e[0]),!u||u.symbol===f.symbol)continue;i.get(f.symbolId).push({symbol:u.symbol,file:u.file,chunkId:s.line})}}return i}var we=N("global-leaf-index");function q(n){return we.get(n,()=>{let o=n.all(`SELECT gs.id, gs.symbol,
|
|
31
|
+
COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
|
|
32
|
+
FROM global_symbols gs
|
|
33
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
34
|
+
LEFT JOIN documents der_doc ON der_doc.id = der.document_id
|
|
35
|
+
LEFT JOIN (
|
|
36
|
+
SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
|
|
37
|
+
FROM mentions m
|
|
38
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
39
|
+
JOIN documents d ON c.document_id = d.id
|
|
40
|
+
WHERE m.role = 1
|
|
41
|
+
GROUP BY m.symbol_id
|
|
42
|
+
) mention_doc ON mention_doc.symbol_id = gs.id
|
|
43
|
+
WHERE 1 = 1
|
|
44
|
+
${n.symbolNoiseFor("gs")}`),i=new Map;for(let l of o){if(!l.relative_path||n.isIgnored(l.relative_path))continue;let a=R(l.symbol);if(!a)continue;let r=i.get(a);r||(r=[],i.set(a,r)),r.some(d=>d.symbolId===l.id)||r.push({symbol:l.symbol,symbolId:l.id,file:l.relative_path})}return i})}function Ie(n,o){if(o.length===0)return new Map;let i=n.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
45
|
+
FROM mentions m
|
|
46
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
47
|
+
WHERE m.role != 1`),l=new Map;for(let s of i)l.has(s.document_id)||l.set(s.document_id,[]),l.get(s.document_id).push(s);let a=new Map(n.all("SELECT id, relative_path FROM documents").map(s=>[s.id,s.relative_path])),r=new Map,d=n.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
48
|
+
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
49
|
+
FROM global_symbols gs
|
|
50
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
51
|
+
LEFT JOIN (
|
|
52
|
+
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
53
|
+
FROM mentions m
|
|
54
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
55
|
+
WHERE m.role = 1
|
|
56
|
+
GROUP BY m.symbol_id
|
|
57
|
+
) def_chunk ON def_chunk.symbol_id = gs.id`);for(let s of d)r.has(s.symbol_id)||r.set(s.symbol_id,{symbol:s.symbol,file:s.document_id!==null?a.get(s.document_id)??"":""});let t=new Map,c=a;for(let s of o){let f=l.get(s.documentId)??[],e=new Set,u=[],p=null,m=()=>{if(p)return p;let b=c.get(s.documentId)??"",g=new Set;if(b){let _=U(n,b),y=Math.max(0,s.startLine),h=Math.min(_.length-1,s.endLine);for(let S=y;S<=h;S+=1)for(let w of _[S])g.add(w)}return p=g,g};for(let b of f){if(b.symbol_id===s.symbolId)continue;let g=r.get(b.symbol_id);if(!g)continue;if(!(b.start_line>=s.startLine&&b.end_line<=s.endLine)){if(!(b.start_line<=s.endLine&&b.end_line>=s.startLine))continue;let S=R(g.symbol);if(!S||!m().has(S))continue}let y=`${g.symbol}|${b.chunk_id}`;e.has(y)||(e.add(y),u.push({...g,chunkId:b.chunk_id}))}t.set(s.symbolId,u)}return t}function Ve(n,o){let i=new Map,l=n.all(`SELECT relative_path FROM documents
|
|
58
|
+
WHERE 1 = 1 ${n.pathExclusionsFor("documents")}`),a=q(n);for(let t of l){if(!E(t.relative_path)||n.isIgnored(t.relative_path))continue;let c=k(n,t.relative_path);if(c)for(let s of c){let f=a.get(s.calleeLeaf);if(!f||f.length===0)continue;let u=f.find(m=>m.file===t.relative_path)??(f.length===1?f[0]:null);if(!u||u.file===t.relative_path)continue;let p=i.get(u.symbolId);p||(p=new Set,i.set(u.symbolId,p)),p.add(t.relative_path)}}let r=n.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
|
|
59
|
+
c.start_line AS chunk_start, c.end_line AS chunk_end
|
|
60
|
+
FROM mentions m
|
|
61
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
62
|
+
JOIN documents d ON c.document_id = d.id
|
|
63
|
+
WHERE m.role != 1
|
|
64
|
+
${n.pathExclusionsFor("d")}`),d=new Map;if(o)for(let t of o)d.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});for(let t of r){if(n.isIgnored(t.relative_path))continue;let c=d.get(t.symbol_id);if(c&&c.docId===t.document_id&&t.chunk_start>=c.startLine&&t.chunk_end<=c.endLine)continue;let s=i.get(t.symbol_id);s||(s=new Set,i.set(t.symbol_id,s)),s.add(t.relative_path)}for(let t of l){if(n.isIgnored(t.relative_path)||E(t.relative_path)!=="rust")continue;let c=G(n,t.relative_path);if(c.size!==0)for(let s of c){let f=a.get(s);if(f)for(let e of f){if(e.file===t.relative_path)continue;let u=i.get(e.symbolId);u||(u=new Set,i.set(e.symbolId,u)),u.add(t.relative_path)}}}return i}export{xe as a,G as b,Re as c,Y as d,ve as e,M as f,Be as g,ze as h,je as i,Ge as j,K as k,q as l,Ve as m};
|
|
65
|
+
//# sourceMappingURL=chunk-ID7TO4P6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{g as y}from"./chunk-ID7TO4P6.js";function L(D,k={}){let{limit:x=10,scope:M,minDepth:j=3}=k,g=y(D,M),u=new Map,o=[],l=new Map,r=new Map,a=new Set,f=[],d=0;for(let t of g.keys()){if(l.has(t))continue;let n=[],s=(g.get(t)??new Set).values();for(l.set(t,d),r.set(t,d),d+=1,f.push(t),a.add(t),n.push({node:t,iter:s,pendingChild:null});n.length>0;){let e=n[n.length-1];if(e.pendingChild!==null){let h=e.pendingChild;e.pendingChild=null,r.set(e.node,Math.min(r.get(e.node),r.get(h)))}let c=e.iter.next();if(c.done){if(r.get(e.node)===l.get(e.node)){let h=[];for(;;){let p=f.pop();if(a.delete(p),h.push(p),u.set(p,o.length),p===e.node)break}o.push(h)}n.pop();continue}let i=c.value;if(l.has(i))a.has(i)&&r.set(e.node,Math.min(r.get(e.node),l.get(i)));else{l.set(i,d),r.set(i,d),d+=1,f.push(i),a.add(i);let h=(g.get(i)??new Set).values();e.pendingChild=i,n.push({node:i,iter:h,pendingChild:null})}}}let m=new Map,b=new Array(o.length);for(let t=0;t<o.length;t++)b[t]=o[t].length,m.set(t,new Set);for(let[t,n]of g){let s=u.get(t);for(let e of n){let c=u.get(e);c!==s&&m.get(s).add(c)}}let S=new Array(o.length),I=new Array(o.length);for(let t=0;t<o.length;t++){let n=[],s=0;for(let e of m.get(t)){let c=I[e];c>s&&(s=c,n=S[e])}S[t]=[t,...n],I[t]=b[t]+s}function v(t){return S[t]}let A=o.map(t=>[...t].sort()),C=new Set,w=[];for(let t=0;t<o.length;t++){let n=v(t),s=[];for(let c of n)s.push(...A[c]);if(s.length<j)continue;let e=s.join(" ");C.has(e)||(C.add(e),w.push({chain:s,depth:s.length}))}return w.sort((t,n)=>n.depth-t.depth),w.slice(0,x)}export{L as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IUNRL2AQ.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as w,b as h,d as R,e as N}from"./chunk-LORWXBOO.js";import{a as P}from"./chunk-5KWWENJZ.js";import{h as T,k as j}from"./chunk-ID7TO4P6.js";import{a as A}from"./chunk-H4IWC7KJ.js";import{d as D,e as L,l as z,q as $,r as B}from"./chunk-QRULHDMO.js";import{b,c as q,f as F,i as x}from"./chunk-5IM4IQ6N.js";function ae(i,e,r={}){let{minSimilarity:s=.4,limit:l=20}=r,o=U(i,e);if(!o)return[];if(!F(o.symbol))return[];let n=K(i,o,s);return n.length>0?n.slice(0,l):G(i,e,{minSimilarity:s,limit:l})}function K(i,e,r){let s=E(i,{minCallees:3,excludeSymbol:e.symbol}),l=R([e,...s].map(n=>n.callees)),o=[];for(let n of s){if(n.callees.size<3)continue;let t=I(e,n,l,{minSimilarity:r,requireSignificantShared:1,requireSharedCount:0});t&&o.push(t)}return o.sort((n,t)=>t.similarity-n.similarity),o}function I(i,e,r,s){let{similarity:l,significantShared:o}=N(i.callees,e.callees,r);if(l<s.minSimilarity)return null;let n=w(i.callees,e.callees).size;if(o.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let t=o.length>0?o:[...w(i.callees,e.callees)];return{symbolA:i.symbol,shortNameA:b(i.symbol),fileA:i.file,symbolB:e.symbol,shortNameB:b(e.symbol),fileB:e.file,similarity:l,sharedCallees:t.map(b),uniqueToA:[...h(i.callees,e.callees)].map(b),uniqueToB:[...h(e.callees,i.callees)].map(b)}}function me(i,e={}){let{minSimilarity:r=.5,limit:s=20,scope:l,minCallees:o=4,crossFileOnly:n=!1}=e,t=E(i,{minCallees:o,scope:l}),c=R(t.map(a=>a.callees)),u=new Map;for(let a of t)for(let m of a.callees)u.set(m,(u.get(m)??0)+1);let f=Math.max(8,Math.ceil(Math.sqrt(t.length))),S=new Map;for(let a=0;a<t.length;a+=1)for(let m of t[a].callees){if((u.get(m)??0)>f)continue;let g=S.get(m);g||(g=[],S.set(m,g)),g.push(a)}let C=[],v=new Set;e:for(let a=0;a<t.length;a+=1){let m=t[a],g=new Set;for(let k of m.callees){let y=S.get(k);if(y)for(let p of y)p>a&&g.add(p)}for(let k of g){let y=`${a}|${k}`;if(v.has(y))continue;v.add(y);let p=t[k];if(n&&m.file===p.file)continue;if(m.paramCount>=0&&p.paramCount>=0){let _=Math.abs(m.paramCount-p.paramCount),W=Math.max(2,Math.ceil(Math.max(m.paramCount,p.paramCount)*.5));if(_>W)continue}let M=I(m,p,c,{minSimilarity:r,requireSignificantShared:2,requireSharedCount:4});if(M&&(C.push(M),C.length>s*5))break e}}return C.sort((a,m)=>m.similarity-a.similarity),C.slice(0,s)}function U(i,e){let r=A(i,e);if(!r)return null;let s=T(i,r);return{symbol:r.symbol,file:r.relativePath,callees:new Set(s.map(l=>l.symbol)),paramCount:z(i,r.relativePath,r.startLine,r.endLine)?.paramCount??-1}}function E(i,e){let{minCallees:r,scope:s,excludeSymbol:l}=e,o=B(i,s).filter(t=>!i.isIgnored(t.relativePath)).filter(t=>t.isFunctionLike).filter(t=>l===void 0||t.symbol!==l).filter(t=>t.endLine-t.startLine+1>=5).filter(t=>P(t.relativePath)!=="test").filter(t=>!x(t.symbol)).filter(t=>!L(i,t.relativePath,t.startLine)),n=j(i,o);return o.map(t=>({symbol:t.symbol,file:t.relativePath,callees:new Set((n.get(t.symbolId)??[]).map(c=>c.symbol)),paramCount:z(i,t.relativePath,t.startLine,t.endLine)?.paramCount??-1})).filter(t=>t.callees.size>=r)}function G(i,e,r){let s=H(i,e);if(!s||s.tokens.size<3)return[];let l=r.minSimilarity>=.5?r.minSimilarity:.3,o=[];for(let n of Q(i)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let t=w(s.tokens,n.tokens);if(t.size<2)continue;let c=new Set([...s.tokens,...n.tokens]),u=c.size>0?t.size/c.size:0;u<l||o.push({symbolA:s.symbol,shortNameA:b(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:b(n.symbol),fileB:n.file,similarity:u,sharedCallees:[...t].sort(),uniqueToA:[...h(s.tokens,n.tokens)].sort(),uniqueToB:[...h(n.tokens,s.tokens)].sort()})}return o.sort((n,t)=>t.similarity-n.similarity||n.shortNameB.localeCompare(t.shortNameB)),o.slice(0,r.limit)}function H(i,e){let r=A(i,e);if(!r||!F(r.symbol))return null;let s=J(i,r);return s?{symbol:r.symbol,file:r.relativePath,tokens:s}:null}function J(i,e){let r=q(e.symbol),s=O(i,e.relativePath,e.startLine,e.endLine,r),l=Z(s,r);return l.size>0?l:null}function Q(i){return $(i).filter(e=>e.isFunctionLike).filter(e=>P(e.relativePath)!=="test").filter(e=>!x(e.symbol)).map(e=>({symbol:e.symbol,file:e.relativePath,tokens:Z(O(i,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)})).filter(e=>e.tokens.size>0)}function O(i,e,r,s,l){let o=D(i,e);if(!o)return"";let n=o.split(`
|
|
2
|
+
`);if(s>=r&&s-r<=12)return n.slice(r,s+1).join(`
|
|
3
|
+
`);let t=[new RegExp(`\\bdef\\s+${d(l)}\\b`),new RegExp(`\\bfun\\s+${d(l)}\\b`),new RegExp(`\\bfn\\s+${d(l)}\\b`),new RegExp(`\\bfunction\\s+${d(l)}\\b`),new RegExp(`\\b${d(l)}\\s*\\(`)],c=n.findIndex(u=>t.some(f=>f.test(u)));if(c>=0){let u=c;for(let f=c+1;f<n.length&&f<=c+8;f++){let S=n[f]??"";if(f>c&&X(S)||(u=f,S.trim()===""&&f>c+1))break}return n.slice(c,u+1).join(`
|
|
4
|
+
`)}return n.slice(r,Math.min(n.length,r+8)).join(`
|
|
5
|
+
`)}function Z(i,e){if(!i)return new Set;let r=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),s=V(e),o=i.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>!r.has(n)).filter(n=>!s.has(n));return new Set(o)}function V(i){return new Set(i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(e=>e.toLowerCase()).filter(e=>e.length>1))}function X(i){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(i)}function d(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{ae as a,me as b};
|
|
6
|
+
//# sourceMappingURL=chunk-J22I2FWD.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{c as m}from"./chunk-F2TGKDMW.js";import{j as g}from"./chunk-ID7TO4P6.js";import{a as R}from"./chunk-H4IWC7KJ.js";import{d as h}from"./chunk-QRULHDMO.js";import{f as u}from"./chunk-5IM4IQ6N.js";function $(t,a){let e=R(t,a);if(!e)return[];let i=!u(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],r=m(t,e),l=(r.length>0?r:g(t,e)).filter(n=>!t.isIgnored(n.file)).map(n=>({relativePath:n.file,line:n.line})),c=S(t,e),o=new Set,f=[];for(let n of[...i,...l,...c]){let p=`${n.relativePath}:${n.line}`;o.has(p)||(o.add(p),f.push(n))}return f}function S(t,a){if(!a.relativePath.endsWith(".rb"))return[];let e=d(a.symbol);if(e.length===0)return[];let s=t.all(`SELECT relative_path
|
|
2
|
+
FROM documents
|
|
3
|
+
WHERE relative_path LIKE '%.rb'
|
|
4
|
+
${t.pathExclusionsFor("documents")}
|
|
5
|
+
ORDER BY relative_path`),i=[];for(let r of s){if(t.isIgnored(r.relative_path))continue;let l=h(t,r.relative_path);if(!l)continue;let c=l.split(`
|
|
6
|
+
`);for(let o=0;o<c.length;o++){let f=c[o]??"";e.some(n=>new RegExp(`@${n}\\b|\\b${n}:`).test(f))&&i.push({relativePath:r.relative_path,line:o})}}return i}function d(t){let e=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),s=e.split("_").filter(Boolean),i=new Set;return e&&i.add(e),s.length>=1&&i.add(s[s.length-1]),s.length>=2&&i.add(s.slice(-2).join("_")),[...i]}export{$ as a};
|
|
7
|
+
//# sourceMappingURL=chunk-KOGVTPGE.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as W}from"./chunk-NB3GIT4Z.js";import{b as I}from"./chunk-J22I2FWD.js";import{a as q}from"./chunk-HUEIPY4M.js";import{a as j}from"./chunk-N3Z2SJCR.js";import{a as B}from"./chunk-MSNW2AR2.js";import{a as E}from"./chunk-ORBQ3HJD.js";import{a as z}from"./chunk-DXXROCSQ.js";import{a as V}from"./chunk-TVJMEDHH.js";import{a as A}from"./chunk-YSEQFGGH.js";import{a as k}from"./chunk-EARGTC7U.js";import{a as F}from"./chunk-Q2MCCKWZ.js";import{e as y,f as R}from"./chunk-5KWWENJZ.js";function ht(e,N={}){let{scope:n}=N,c=j(e),T=k(e,{scope:n,minLoc:3,skipBarrels:!0}),w=B(e,{scope:n,minLoc:3}),P=A(e,{scope:n}),U=I(e,{scope:n,minSimilarity:.6,limit:50,minCallees:4}),m=V(e,{scope:n,minLoc:15,minCallees:5,limit:50}),l=W(e,{scope:n,maxLoc:15,limit:50}),a=E(e,{scope:n,maxLoc:15,limit:50}),x=q(e,{scope:n,minLoc:3,limit:50}),s=z(e,{scope:n}),C=F(e,{scope:n,minLoc:10,limit:10}),S=T.symbols.filter(t=>!y(e,t.relativePath)&&!R(e,t.symbol,t.relativePath)&&t.kind==="dead-code"),u=S.length,$=S.reduce((t,o)=>t+o.loc,0),h=w.filter(t=>!y(e,t.relativePath)&&!R(e,t.symbol,t.relativePath)).length,p=x.length,v=s.unusedImports+s.layerViolations,d=U.length,r=[];u>0&&r.push({category:"Dead code",description:`${u} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:u,locRecoverable:$}),h>0&&r.push({category:"Isolated symbols",description:`${h} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:h,locRecoverable:w.filter(t=>!y(e,t.relativePath)&&!R(e,t.symbol,t.relativePath)).reduce((t,o)=>t+o.loc,0)});let b=P.filter(t=>t.kind==="real");if(b.length>0&&r.push({category:"Circular dependencies",description:`${b.length} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:b.length,locRecoverable:0}),d>0&&r.push({category:"Similar functions",description:`${d} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:d,locRecoverable:0}),m.length>0&&r.push({category:"Extraction candidates",description:`${m.length} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:m.length,locRecoverable:0}),l.length>0&&r.push({category:"Wrapper functions",description:`${l.length} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:l.length,locRecoverable:l.reduce((t,o)=>t+o.loc,0)}),a.length>0&&r.push({category:"Passthrough functions",description:`${a.length} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:a.length,locRecoverable:a.reduce((t,o)=>t+o.loc,0)}),p>0){let t=x.filter(M=>M.consumers===0).length,o=p-t,g=[];t>0&&g.push(`${t} unused`),o>0&&g.push(`${o} single-consumer (not in types file)`),r.push({category:"Stale abstractions",description:`${g.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:p,locRecoverable:x.reduce((M,_)=>M+_.loc,0)})}if(v>0||s.patternDeviations>0){let t=[];s.unusedImports>0&&t.push(`${s.unusedImports} unused imports`),s.layerViolations>0&&t.push(`${s.layerViolations} layer violations`),s.patternDeviations>0&&t.push(`${s.patternDeviations} unique deps`),r.push({category:"Structural drift",description:t.join(", "),effort:s.layerViolations>0?"medium":"low",impact:s.layerViolations>0?"medium":"low",count:v,locRecoverable:0})}let D={high:3,medium:2,low:1},L={low:3,medium:2,high:1};r.sort((t,o)=>{let g=D[t.impact]*L[t.effort];return D[o.impact]*L[o.effort]-g});let G=Math.max(c.documents,1),f=Math.max(c.symbols,1),i=100,J=u/f;i-=Math.min(20,Math.round(J*200));let K=h/f;i-=Math.min(10,Math.round(K*200));let H=P.filter(t=>t.kind==="real").length;i-=Math.min(15,H*5);let O=d/f*1e3;i-=Math.min(10,Math.round(O));let Q=m.length/f*1e3;i-=Math.min(5,Math.round(Q/2)),i-=Math.min(3,l.length),i-=Math.min(3,a.length);let X=p/Math.max(f*.1,1);i-=Math.min(8,Math.round(X*10));let Y=v/G;i-=Math.min(5,Math.round(Y*50));let Z=C.filter(t=>t.score>50).length;return i-=Math.min(5,Z*2),i=Math.max(0,Math.min(100,i)),{score:i,overview:{documents:c.documents,symbols:c.symbols,indexSizeBytes:c.indexSizeBytes},findings:{deadSymbols:u,deadLoc:$,isolatedSymbols:h,isolatedLoc:w.filter(t=>!y(e,t.relativePath)).reduce((t,o)=>t+o.loc,0),cycles:H,similarPairs:d,extractionCandidates:m.length,wrappers:l.length,passthroughs:a.length,staleTypes:p,driftedFiles:v,complexityHotspotCount:C.length},actions:r,topComplexity:C.slice(0,5).map(t=>({symbol:t.shortName,score:t.score}))}}export{ht as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LUYN4IWJ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-DX5YEUX4.js";import{e as p}from"./chunk-VQXXSUQF.js";import{a as _}from"./chunk-H4IWC7KJ.js";import{b as d,c,g as f}from"./chunk-5IM4IQ6N.js";function v(e,i){return b(e,i)?.map(t=>({symbol:t.symbol,shortName:t.shortName,fromFile:t.fromFile}))??[]}function F(e,i){let a=e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d ON c.document_id = d.id
|
|
@@ -36,4 +36,4 @@ import{a as h}from"./chunk-WTSTDJZ7.js";import{e as p}from"./chunk-BQ3INTYT.js";
|
|
|
36
36
|
WHERE imp_d.relative_path = ?
|
|
37
37
|
AND m.role = 2
|
|
38
38
|
ORDER BY def_d.relative_path, gs.symbol`,t).filter(r=>!e.isIgnored(r.importer));return o.length>0?o.map(r=>({symbol:r.symbol,shortName:d(r.symbol),fromFile:r.from_file??"(external)",importer:r.importer,used:r.used!==0})):p(e,t).map(r=>{let m=I(r.importedName,r.localName,r.kind),u=r.kind==="side-effect"?!0:r.used;return{symbol:m,shortName:m,fromFile:r.sourcePath??"(external)",importer:t,used:u}})}function I(e,i,t){return t==="namespace"&&e==="*"&&i?`* as ${i}`:t==="default"&&i?`default as ${i}`:t==="side-effect"?"(side effect import)":i&&i!==e?`${e} as ${i}`:e}function g(e){return e.replace(/\\/g,"/")}function E(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{v as a,F as b,D as c};
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-MDUIJELV.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-DX5YEUX4.js";import{g as r}from"./chunk-ID7TO4P6.js";import{a as c}from"./chunk-H4IWC7KJ.js";import{b as d}from"./chunk-5IM4IQ6N.js";function f(e,t){let o=c(e,t);if(!o)return[];let i=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
WHERE m.symbol_id = ?
|
|
@@ -59,4 +59,4 @@ import{a as l}from"./chunk-WTSTDJZ7.js";import{d as r}from"./chunk-WCDXJGYT.js";
|
|
|
59
59
|
GROUP BY d.id
|
|
60
60
|
ORDER BY symbol_count DESC
|
|
61
61
|
LIMIT ?`,o).filter(s=>!e.isIgnored(s.relative_path)).map(s=>({name:s.relative_path,count:s.symbol_count}))}export{f as a,y as b,b as c,I as d};
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-MMKNCPHB.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as L}from"./chunk-F2TGKDMW.js";import{e as h}from"./chunk-5KWWENJZ.js";import{b as y,k as d,m as b}from"./chunk-ID7TO4P6.js";import{f,r as u}from"./chunk-QRULHDMO.js";import{b as i,c as m,h as c,i as p}from"./chunk-5IM4IQ6N.js";function x(s,v={}){let{scope:I,minLoc:S=3}=v,o=u(s,I).filter(e=>!s.isIgnored(e.relativePath)).filter(e=>!h(s,e.relativePath)).filter(e=>e.isFunctionLike).filter(e=>!c(e.symbol)).filter(e=>!p(e.symbol)).filter(e=>e.endLine-e.startLine+1>=S),C=b(s,o),M=L(s,o),n=new Set([...C.keys(),...M.keys()]),l=new Map;for(let e of o){let t=m(e.symbol);if(!t)continue;let a=l.get(t)??[];a.push(e.symbolId),l.set(t,a)}let g=s.all(`SELECT relative_path FROM documents WHERE 1 = 1 ${s.pathExclusionsFor("documents")}`);for(let e of g){if(s.isIgnored(e.relative_path)||f(e.relative_path)!=="rust")continue;let t=y(s,e.relative_path);for(let a of t){let r=l.get(a);if(r)for(let F of r)n.add(F)}}let R=new Map(o.map(e=>[e.symbolId,e.symbol])),k=d(s,o,{additive:!0}),E=new Set([...k.entries()].filter(([e,t])=>{let a=R.get(e);return t.some(r=>r.symbol!==a)}).map(([e])=>e));return o.filter(e=>!n.has(e.symbolId)).filter(e=>!E.has(e.symbolId)).sort((e,t)=>t.endLine-t.startLine-(e.endLine-e.startLine)||e.relativePath.localeCompare(t.relativePath)||e.startLine-t.startLine).map(e=>({symbol:e.symbol,shortName:i(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1}))}export{x as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MSNW2AR2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{d as x}from"./chunk-F2TGKDMW.js";import{a as w}from"./chunk-5KWWENJZ.js";import{f as k,g as P,m as R}from"./chunk-ID7TO4P6.js";import{e as D,p as v,r as _,t as N}from"./chunk-QRULHDMO.js";import{b as S,c as C,f as M,i as h}from"./chunk-5IM4IQ6N.js";import{basename as p,extname as g}from"path";function Z(e,t){let{scope:i,maxLoc:n=15,limit:s=30}=t??{},o=H(P(e,i)),l=j(e,i,n),c=G(R(e,l),x(e,l)),y=[];for(let r of l){if(D(e,r.relativePath,r.startLine))continue;let b=p(r.relativePath,g(r.relativePath)),L=[...c.get(r.symbolId)??[]].filter(m=>m!==r.relativePath).filter(m=>p(m,g(m))!==b).filter(m=>{let u=w(m);return u!=="barrel"&&u!=="entry"&&u!=="test"});if(L.length!==1)continue;let f=L[0],F=e.get(`SELECT c.start_line, c.end_line
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents d ON c.document_id = d.id
|
|
5
|
+
WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
|
|
6
|
+
LIMIT 1`,r.symbolId,f);if(!F)continue;let O=v(e,f),T=J(e,f,r.symbol,F.start_line,F.end_line),a=N(O,T);if(a&&h(a.symbol))continue;let d,W=a?.symbol??"",A=a?.isFunctionLike?S(a.symbol):p(f);if(a?.isFunctionLike&&a.symbolId!==r.symbolId){let m=[...c.get(a.symbolId)??[]].filter(u=>u!==a.relativePath);d=m.length>0?m.length:E(o,f)}else d=E(o,f);d<=3||y.push({symbol:r.symbol,shortName:S(r.symbol),file:r.relativePath,startLine:r.startLine,endLine:r.endLine,loc:I(r),singleCaller:W,singleCallerShort:A,callerFanIn:d})}return y.sort((r,b)=>b.callerFanIn-r.callerFanIn||b.loc-r.loc),y.slice(0,s)}function I(e){return e.endLine-e.startLine+1}function j(e,t,i){return _(e,t).filter(n=>!e.isIgnored(n.relativePath)).filter(n=>M(n.symbol)).filter(n=>!h(n.symbol)).filter(n=>I(n)<=i&&I(n)>=2)}function J(e,t,i,n,s){let o=C(i);if(!o)return n;let l=k(e,t).get(o);if(!l||l.length===0)return n;for(let c of l)if(c>=n&&c<=s)return c;return n}function G(...e){let t=new Map;for(let i of e)for(let[n,s]of i){let o=t.get(n);o||(o=new Set,t.set(n,o));for(let l of s)o.add(l)}return t}function H(e){let t=new Map;for(let[i,n]of e){t.has(i)||t.set(i,t.get(i)??0);for(let s of n)t.set(s,(t.get(s)??0)+1)}return t}function E(e,t){let i=e.get(t)??0;if(i>0)return i;let n=p(t,g(t)),s=0;for(let[o,l]of e)o!==t&&p(o,g(o))===n&&l>s&&(s=l);return s}export{Z as a};
|
|
7
|
+
//# sourceMappingURL=chunk-NB3GIT4Z.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{h as n,i as a}from"./chunk-ID7TO4P6.js";import{a as i}from"./chunk-H4IWC7KJ.js";import{b as m}from"./chunk-5IM4IQ6N.js";function b(s,e){let o=i(s,e);if(!o)return null;let t=a(s,o,{limit:50}),r=y(n(s,o,{limit:50}));return{symbol:o.symbol,shortName:m(o.symbol),callers:t.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file})),callees:r.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file}))}}function y(s){let e=new Set,o=[];for(let t of s){let r=`${t.symbol}|${t.file}`;e.has(r)||(e.add(r),o.push(t))}return o}export{b as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OBPP5RRE.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{k as x}from"./chunk-ID7TO4P6.js";import{e as C,f as S,h as L,r as _}from"./chunk-QRULHDMO.js";import{b as y,f as d,h as g,i as b}from"./chunk-5IM4IQ6N.js";function P(i,r,a,t){let s=S(r);if(!s)return!0;let n=L(i,r);if(!n)return!0;let l=w.get(n);return l||(l=T(n,s),w.set(n,l)),l.get(`${a}:${t}`)??!0}var w=new WeakMap;function T(i,r){let a=r==="rust"?new Set(["function_item","function_signature_item"]):r==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),t=new Map,s=n=>{a.has(n.type)&&t.set(`${n.startPosition.row}:${n.endPosition.row}`,N(n,r));for(let l of n.children)s(l)};return s(i.rootNode),t}function N(i,r){let a=i.namedChildren.find(e=>e.type==="block"||e.type==="statement_block");if(!a)return!1;let t=a.namedChildren.filter(e=>e.type!=="comment"&&e.type!=="line_comment"&&e.type!=="block_comment");if(t.length!==1)return!1;let s=t[0],n=null;if(s.type==="return_statement"||s.type==="expression_statement"?n=s.namedChild(0)??null:r==="rust"&&(s.type==="call_expression"||s.type==="macro_invocation")&&(n=s),!n)return!1;let l=r==="python"?"call":"call_expression";if(n.type!==l)return!1;let c=n.namedChildren.find(e=>e.type==="arguments"||e.type==="argument_list");if(!c)return!1;let o=c.namedChildren.filter(e=>e.type!=="comment"),f=i.namedChildren.find(e=>e.type==="parameters"||e.type==="formal_parameters");if(!f)return!1;let p=[];for(let e of f.namedChildren)if(e.type==="identifier")p.push(e.text);else{let m=e.namedChildren.find(u=>u.type==="identifier");m&&p.push(m.text)}if(o.length!==p.length)return!1;for(let e=0;e<p.length;e+=1){let m=o[e];if(m.type!=="identifier"||m.text!==p[e])return!1}return!0}function j(i,r){let{scope:a,maxLoc:t=15,limit:s=30}=r??{},n=D(i,a,t),l=x(i,n),c=[];for(let o of n){if(C(i,o.relativePath,o.startLine))continue;let f=l.get(o.symbolId)??[],p=f.some(u=>d(u.symbol))?f.filter(u=>d(u.symbol)):f,e=new Map;for(let u of p)e.has(u.symbol)||e.set(u.symbol,u);if(e.size!==1||!P(i,o.relativePath,o.startLine,o.endLine))continue;let[,m]=[...e.entries()][0];c.push({symbol:o.symbol,shortName:y(o.symbol),file:o.relativePath,startLine:o.startLine,endLine:o.endLine,loc:h(o),forwardsTo:m.symbol,forwardsToShort:y(m.symbol),forwardsToFile:m.file})}return c.sort((o,f)=>o.loc-f.loc||o.file.localeCompare(f.file)),c.slice(0,s)}function D(i,r,a){return _(i,r).filter(t=>!i.isIgnored(t.relativePath)).filter(t=>d(t.symbol)).filter(t=>!g(t.symbol)).filter(t=>!b(t.symbol)).filter(t=>h(t)>=3&&h(t)<=a)}function h(i){return i.endLine-i.startLine+1}export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ORBQ3HJD.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as g}from"./chunk-
|
|
1
|
+
import{b as g}from"./chunk-5IM4IQ6N.js";import{execFileSync as r}from"child_process";function N(e,a={}){let{base:m="HEAD"}=a,o;try{o=b(e.config.projectRoot,m)}catch{return{changedFiles:[],changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:0,totalChangedSymbols:0,totalAffectedFiles:0,note:"Unable to compute git diff."}}}if(o.length===0)return{changedFiles:[],changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:0,totalChangedSymbols:0,totalAffectedFiles:0,note:"No changed files found."}};let i=[],n=[];for(let t of o){let s=e.get(`SELECT id, relative_path FROM documents
|
|
2
2
|
WHERE relative_path LIKE ?
|
|
3
3
|
LIMIT 1`,`%${t}`);s&&!e.isIgnored(s.relative_path)&&(i.push(s.relative_path),n.push(s.id))}if(n.length===0)return{changedFiles:o,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:o.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}};let u=n.map(()=>"?").join(","),p=e.all(`SELECT DISTINCT gs.id AS symbol_id, gs.symbol, d.relative_path
|
|
4
4
|
FROM mentions m
|
|
@@ -21,4 +21,4 @@ import{b as g}from"./chunk-TINPMWJK.js";import{execFileSync as r}from"child_proc
|
|
|
21
21
|
AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
|
|
22
22
|
${e.pathExclusionsFor("ref_d")}`,t.symbol_id,...i);for(let c of y)e.isIgnored(c.relative_path)||(l.has(c.relative_path)||l.set(c.relative_path,new Set),l.get(c.relative_path).add(h))}let f=[...l.entries()].map(([t,s])=>({file:t,consumedSymbols:s.size})).sort((t,s)=>s.consumedSymbols-t.consumedSymbols);return{changedFiles:i,changedSymbols:d,affectedConsumers:f,summary:{totalChangedFiles:i.length,totalChangedSymbols:d.length,totalAffectedFiles:f.length}}}function b(e,a){let m=r("git",["diff","--name-only",a],{encoding:"utf-8",cwd:e,timeout:1e4}),o=r("git",["diff","--name-only","--cached",a],{encoding:"utf-8",cwd:e,timeout:1e4}),i=r("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([m,o,i].flatMap(n=>n.split(`
|
|
23
23
|
`)).map(n=>n.trim()).filter(n=>n.length>0))]}export{N as a};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-P6IUCZA3.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as C}from"./chunk-5KWWENJZ.js";import{k as b,m as f}from"./chunk-ID7TO4P6.js";import{r as u}from"./chunk-QRULHDMO.js";import{b as n,e as c,i as y}from"./chunk-5IM4IQ6N.js";function R(o,r){let{scope:s,minLoc:t=10,limit:M=30}=r??{},{definitions:d,callerMap:S,calleeMap:L}=g(o,s);return d.map(e=>{let a=e.endLine-e.startLine+1,i=S.get(e.symbolId)?.size??0,p=L.get(e.symbolId)??[],h=p.filter(l=>l.file!==e.relativePath),m=new Set(h.map(l=>`${l.symbol}|${l.file}`)).size,x=new Set(p.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:n(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:a,fanIn:i,fanOut:m,calleeCount:x,score:Math.round(a/50*(i/5)*Math.max(m/5,1)*100)/100}}).filter(e=>e.loc>=t).sort((e,a)=>a.score-e.score||a.loc-e.loc).slice(0,M)}function g(o,r){let s=u(o,r).filter(t=>c(t.symbol)&&!o.isIgnored(t.relativePath)).filter(t=>C(t.relativePath)!=="test").filter(t=>!y(t.symbol));return{definitions:s,callerMap:f(o,s),calleeMap:b(o,s)}}export{R as a};
|
|
2
|
+
//# sourceMappingURL=chunk-Q2MCCKWZ.js.map
|