scip-query 0.10.11 → 0.10.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -35
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-2DOW7QCA.js +71 -0
- package/dist/chunk-2FMFF4RI.js +2 -0
- package/dist/{chunk-LSET2TXH.js → chunk-2GLNBCHB.js} +2 -2
- package/dist/chunk-2UVCH7CQ.js +2 -0
- package/dist/{chunk-LM5SHAN4.js → chunk-3XSNW5XB.js} +2 -2
- package/dist/chunk-4ISHQ7UW.js +35 -0
- package/dist/{chunk-BFXPG2VN.js → chunk-5GXTUANY.js} +2 -2
- package/dist/{chunk-FXNWFMKW.js → chunk-5JHEN5VN.js} +2 -2
- package/dist/chunk-62ULXMQ7.js +18 -0
- package/dist/chunk-63CI3IXR.js +102 -0
- package/dist/{chunk-P753MDDE.js → chunk-6BN3EHQE.js} +2 -2
- package/dist/chunk-7C6JBBE4.js +23 -0
- package/dist/chunk-7EK7OSWS.js +2 -0
- package/dist/chunk-7IWIMNHI.js +2 -0
- package/dist/chunk-7XTO4YXB.js +8 -0
- package/dist/{chunk-Z3YYR4OS.js → chunk-A4UTLKHU.js} +2 -2
- package/dist/{chunk-FDEQIPPK.js → chunk-ANUEY5WV.js} +2 -2
- package/dist/chunk-AOWFUGDL.js +2 -0
- package/dist/chunk-AREANYIA.js +3 -0
- package/dist/{chunk-6IR2AOBM.js → chunk-AZBELWZQ.js} +2 -2
- package/dist/{chunk-JME7OWD3.js → chunk-CXWCLVYL.js} +2 -2
- package/dist/chunk-CYHIKTJN.js +3 -0
- package/dist/{chunk-BVRS7RKQ.js → chunk-DDQONX6B.js} +2 -2
- package/dist/{chunk-IHUETYFW.js → chunk-DFSEARAU.js} +2 -2
- package/dist/{chunk-EY43NV4M.js → chunk-DQ6433ZG.js} +2 -2
- package/dist/chunk-DVFP6PZI.js +2 -0
- package/dist/chunk-E3ADDB43.js +2 -0
- package/dist/{chunk-YWOOQ4FF.js → chunk-ELC77ZDE.js} +1 -1
- package/dist/chunk-EOLGSSDR.js +2 -0
- package/dist/chunk-F6IXELII.js +20 -0
- package/dist/{chunk-QYB5P7GL.js → chunk-FMGVZBS2.js} +2 -2
- package/dist/{chunk-VOYOYC5T.js → chunk-FX6ULETZ.js} +2 -2
- package/dist/chunk-GG5LHT27.js +2 -0
- package/dist/chunk-GKB4JJDU.js +2 -0
- package/dist/chunk-H7JF2CKK.js +2 -0
- package/dist/chunk-HHOMJCP5.js +4 -0
- package/dist/chunk-HRDSU5FN.js +9 -0
- package/dist/{chunk-BZ53S4ZN.js → chunk-HWVYTJOV.js} +2 -2
- package/dist/chunk-JJ5SAWBT.js +2 -0
- package/dist/chunk-JNMLBL36.js +2 -0
- package/dist/chunk-JS6B76AQ.js +2 -0
- package/dist/{chunk-Z4HICZGY.js → chunk-KZ4MG5NY.js} +2 -2
- package/dist/{chunk-RNM6LMCF.js → chunk-L446VQYQ.js} +2 -2
- package/dist/{chunk-FFVIFETB.js → chunk-LDJUB7XW.js} +2 -2
- package/dist/{chunk-54KGX7EX.js → chunk-LEHVP4DY.js} +2 -2
- package/dist/chunk-MNCQPMCH.js +2 -0
- package/dist/chunk-MYTUWXHK.js +4 -0
- package/dist/chunk-N25HPUOK.js +2 -0
- package/dist/chunk-NABVR6B7.js +2 -0
- package/dist/{chunk-TK7O5ER5.js → chunk-NBNEVLRC.js} +2 -2
- package/dist/chunk-NTSR6SRP.js +2 -0
- package/dist/{chunk-7B6LP46R.js → chunk-OFXN2BCT.js} +2 -2
- package/dist/chunk-PWAK75BU.js +2 -0
- package/dist/chunk-Q5P7NOVM.js +2 -0
- package/dist/{chunk-G5UPYQGL.js → chunk-RGKRYO22.js} +4 -4
- package/dist/chunk-RM2WQ75T.js +2 -0
- package/dist/chunk-ROGZXWN2.js +2 -0
- package/dist/chunk-RSSXKJ6J.js +38 -0
- package/dist/chunk-RUV5IY25.js +7 -0
- package/dist/chunk-RVGEZYMQ.js +2 -0
- package/dist/{chunk-6LJHXREW.js → chunk-RXINFVBN.js} +2 -2
- package/dist/{chunk-YWYFU2V3.js → chunk-S2MRVIJ5.js} +2 -2
- package/dist/chunk-SA3DPTHT.js +7 -0
- package/dist/chunk-SGTKURU6.js +52 -0
- package/dist/chunk-SQNHOOJ5.js +3 -0
- package/dist/chunk-T3AEVJBG.js +4 -0
- package/dist/{chunk-NOJAM5ZV.js → chunk-T4N2ZRVY.js} +2 -2
- package/dist/{chunk-JATUZIEH.js → chunk-TBCHRDAC.js} +2 -2
- package/dist/chunk-THB6AM3V.js +11 -0
- package/dist/{chunk-TQ5W2H3S.js → chunk-ULHLDOD6.js} +1 -1
- package/dist/chunk-UQ73QF5D.js +43 -0
- package/dist/chunk-UVPY3RUZ.js +2 -0
- package/dist/chunk-V5FGK3DZ.js +2 -0
- package/dist/{chunk-ZQDIXAF5.js → chunk-VB2EZZPA.js} +2 -2
- package/dist/{chunk-7TWLSZK5.js → chunk-WTY5FERW.js} +2 -2
- package/dist/chunk-WUOB4DHH.js +6 -0
- package/dist/chunk-XHMVZFA6.js +2 -0
- package/dist/chunk-XRUGSM76.js +10 -0
- package/dist/{chunk-BASVXNY3.js → chunk-XUCZ3RQ5.js} +2 -2
- package/dist/chunk-YFQIKYOP.js +2 -0
- package/dist/chunk-Z2LDWIJV.js +5 -0
- package/dist/chunk-ZNWWVYQL.js +3 -0
- package/dist/{chunk-FKCGBZAC.js → chunk-ZUUNREKS.js} +2 -2
- package/dist/cli.js +238 -216
- package/dist/{config-types-BDIWAYzr.d.ts → config-types-dvHOz0zU.d.ts} +4 -1
- package/dist/{db-Djj3Nqrb.d.ts → db-rMZO5JFK.d.ts} +1 -1
- package/dist/{health-D5J42g4D.d.ts → health-CtTIGh6H.d.ts} +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.js +2 -2
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +2 -2
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +3 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +7 -4
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +46 -17
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +9 -9
- package/dist/reindex.d.ts +30 -4
- package/dist/reindex.js +19 -19
- package/dist/runtime.d.ts +4 -3
- package/dist/runtime.js +2 -2
- package/dist/{scip-cli-CnK9Va4O.d.ts → scip-cli-trnNvymv.d.ts} +1 -1
- package/docs/COMMAND_REFERENCE.md +1 -1
- package/docs/analyzer-inventory.md +8 -0
- package/docs/analyzer-validation-ledger.md +7 -0
- package/package.json +3 -1
- package/scripts/evidence-product-contract.mjs +197 -0
- package/dist/chunk-2KHTSEIL.js +0 -102
- package/dist/chunk-3VD3JMK2.js +0 -2
- package/dist/chunk-4UZO3XCV.js +0 -35
- package/dist/chunk-5GOLFJEO.js +0 -8
- package/dist/chunk-5OST6GYB.js +0 -2
- package/dist/chunk-65AU3HFZ.js +0 -2
- package/dist/chunk-6GN7FXCH.js +0 -2
- package/dist/chunk-6JRV4MY2.js +0 -23
- package/dist/chunk-6QSOCTZT.js +0 -18
- package/dist/chunk-72KY2ZFO.js +0 -2
- package/dist/chunk-7GO4EQF5.js +0 -2
- package/dist/chunk-7IVSJJZU.js +0 -7
- package/dist/chunk-A536TEU4.js +0 -3
- package/dist/chunk-AVWPHM2Q.js +0 -4
- package/dist/chunk-BSN22NRK.js +0 -9
- package/dist/chunk-C5CTSJ6X.js +0 -6
- package/dist/chunk-CO5GJRP7.js +0 -2
- package/dist/chunk-CW5YFOCP.js +0 -5
- package/dist/chunk-DS6QEB3G.js +0 -5
- package/dist/chunk-E35O7UCB.js +0 -2
- package/dist/chunk-EXDQ35NN.js +0 -2
- package/dist/chunk-FAYI6KZ5.js +0 -2
- package/dist/chunk-FG4NT6VY.js +0 -2
- package/dist/chunk-GQBMH2TQ.js +0 -2
- package/dist/chunk-GRJY65YT.js +0 -2
- package/dist/chunk-HF25DFSC.js +0 -3
- package/dist/chunk-HHN2B5KA.js +0 -2
- package/dist/chunk-JCLDUKT6.js +0 -38
- package/dist/chunk-JGN2ZFJR.js +0 -2
- package/dist/chunk-JM72FNGA.js +0 -2
- package/dist/chunk-KDFONWTW.js +0 -40
- package/dist/chunk-LPL4MA6R.js +0 -2
- package/dist/chunk-LZHUWKGD.js +0 -2
- package/dist/chunk-M4COR2H6.js +0 -2
- package/dist/chunk-O6ZH6C6Y.js +0 -2
- package/dist/chunk-OBGRLXWF.js +0 -3
- package/dist/chunk-OLTESY4K.js +0 -3
- package/dist/chunk-P4KYUPBD.js +0 -4
- package/dist/chunk-P5RYBRIO.js +0 -4
- package/dist/chunk-P7AL7Y37.js +0 -2
- package/dist/chunk-PFOCOG57.js +0 -2
- package/dist/chunk-QLAUCRDJ.js +0 -2
- package/dist/chunk-QPU7EXAW.js +0 -2
- package/dist/chunk-RVWSAMTT.js +0 -2
- package/dist/chunk-USPV3T5K.js +0 -2
- package/dist/chunk-VCQYSG2M.js +0 -10
- package/dist/chunk-VUKC6F77.js +0 -20
- package/dist/chunk-W2CBNBEL.js +0 -71
- package/dist/chunk-W6BVEKYC.js +0 -3
- package/dist/chunk-WUCEKFQC.js +0 -3
- package/dist/chunk-XUGQU7PM.js +0 -41
- package/dist/chunk-Y5NBHMQX.js +0 -2
- package/dist/chunk-YCOFCT4B.js +0 -2
- package/dist/chunk-YZA6PPZL.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-NBNEVLRC.js";import{b as g,d as m}from"./chunk-NABVR6B7.js";function _(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
|
|
2
2
|
WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,h=1;s>=0;s--,h++){let p=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:p,shortName:p,depth:h})}return b}export{_ as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-6BN3EHQE.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{a as b,b as y,c as m}from"./chunk-DVFP6PZI.js";import{g as p}from"./chunk-63CI3IXR.js";import{b as f,d as g,f as d}from"./chunk-NABVR6B7.js";import{a as c}from"./chunk-64MNV6AB.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
|
|
2
|
+
FROM defn_enclosing_ranges der
|
|
3
|
+
JOIN global_symbols gs ON der.symbol_id = gs.id
|
|
4
|
+
JOIN documents d ON der.document_id = d.id
|
|
5
|
+
WHERE gs.kind IS NOT NULL
|
|
6
|
+
AND gs.kind != 0
|
|
7
|
+
AND gs.symbol NOT LIKE '%#'
|
|
8
|
+
AND d.relative_path IN (${i})
|
|
9
|
+
GROUP BY gs.kind`,...e);for(let u of l)t.set(u.kind,(t.get(u.kind)??0)+u.count)}return t}function S(n,s){let t=[];for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", ");t.push(...n.all(`SELECT gs.symbol,
|
|
10
|
+
gs.kind,
|
|
11
|
+
gs.documentation,
|
|
12
|
+
gs.enclosing_symbol,
|
|
13
|
+
d.relative_path,
|
|
14
|
+
der.start_line,
|
|
15
|
+
der.end_line
|
|
16
|
+
FROM defn_enclosing_ranges der
|
|
17
|
+
JOIN global_symbols gs ON der.symbol_id = gs.id
|
|
18
|
+
JOIN documents d ON der.document_id = d.id
|
|
19
|
+
WHERE (gs.kind IS NULL OR gs.kind = 0 OR gs.symbol LIKE '%#')
|
|
20
|
+
${n.symbolNoiseFor("gs")}
|
|
21
|
+
AND d.relative_path IN (${i})
|
|
22
|
+
ORDER BY d.relative_path, der.start_line, der.end_line, gs.symbol`,...e))}return t}function N(n){let s=[];for(let t=0;t<n.length;t+=_)s.push(n.slice(t,t+_));return s}function R(n){return{symbol:n.symbol,kind:n.kind,documentation:n.documentation,enclosing_symbol:n.enclosingSymbol,relative_path:n.relativePath,start_line:n.startLine,end_line:n.endLine}}function k(n){return n.kind!==null&&n.kind!==0?D(n.kind,n.symbol,n.documentation):C(n.symbol,n.documentation,n.enclosing_symbol)}function D(n,s,t){let e=(t??"").toLowerCase();if(d(s)==="type"){if(e.includes("type "))return o.TypeAlias;if(e.includes("interface "))return o.Interface;if(e.includes("struct "))return o.Struct;if(e.includes("trait "))return o.Trait;if(e.includes("class "))return o.Class}return n}function C(n,s,t){let e=f(n);if("kind"in e)return null;let i=e.descriptors,l=i[i.length-2]??null,u=d(n),r=(s??"").toLowerCase();return u==="type"?r.includes("type ")?o.TypeAlias:r.includes("interface ")?o.Interface:r.includes("struct ")?o.Struct:r.includes("trait ")?o.Trait:r.includes("class ")?o.Class:o.Class:u==="method"?l?.suffix==="type"?o.Method:o.Function:u==="namespace"?o.Module:u!=="term"?null:r.includes("async def ")||r.includes("def ")?o.Function:(t?d(t):l?.suffix??null)==="type"?o.Field:o.Variable}export{v as a,T as b};
|
|
23
|
+
//# sourceMappingURL=chunk-7C6JBBE4.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as Q}from"./chunk-RM2WQ75T.js";import{q as O}from"./chunk-UQ73QF5D.js";import{b as x,d as T,f as v}from"./chunk-CYHIKTJN.js";import{d as A}from"./chunk-NABVR6B7.js";import{d as b}from"./chunk-THB6AM3V.js";import{e as g}from"./chunk-SA3DPTHT.js";function N(e,n={}){let{samples:o=50,scope:i,maxDisagreements:u=5}=n,a=new Q(e),r=z(a.productionCallableDefinitions({scope:i,minLoc:2,requireFunctionLikeSymbol:!0}),o),l=L(e,r);if(r.length===0||!l)return{available:!1,sampleSize:r.length,oracleCoverage:0,scores:[],topDisagreements:[]};let t={references:C(),callees:C()},c=[],f=0,m=l==="semantic"?v(e,r):new Map,D=l==="source"?K(e,a,r):null;for(let s of r){let p=S(s,l==="semantic"?T(e,s).map(d=>d.file):[...D?.referencesBySymbolId.get(s.symbolId)??[]]),I=S(s,l==="semantic"?(m.get(s.symbolId)??[]).map(d=>d.file):[...D?.calleesBySymbolId.get(s.symbolId)??[]]);if(p.size===0&&I.size===0)continue;f+=1;let R=S(s,O(e,s).map(d=>d.file)),j=S(s,(a.calleeMap([s],{semantic:!1}).get(s.symbolId)??[]).map(d=>d.file));M(t.references,s,"references",R,p,c),M(t.callees,s,"callees",j,I,c)}return c.sort((s,p)=>p.cheapOnly.length+p.oracleOnly.length-(s.cheapOnly.length+s.oracleOnly.length)),{available:!0,sampleSize:r.length,oracleCoverage:r.length>0?h(f/r.length):0,oracleKind:l,scores:["references","callees"].map(s=>B(s,t[s],l)),topDisagreements:c.slice(0,u)}}function C(){return{comparedSymbols:0,agreed:0,cheapTotal:0,oracleTotal:0}}function z(e,n){let o=[...e].sort((a,r)=>a.symbolId-r.symbolId);if(o.length<=n)return o;let i=o.length/n,u=[];for(let a=0;a<n;a++)u.push(o[Math.floor(a*i)]);return u}function L(e,n){let o=n[0];if(!o)return null;if(y(e,o))return"source";try{if(x(e).capability("semantic-references",o.relativePath).available)return"semantic"}catch{}return n.some(i=>y(e,i))?"source":null}function S(e,n){let o=new Set;for(let i of n)i!==e.relativePath&&o.add(i);return o}function M(e,n,o,i,u,a){if(i.size===0&&u.size===0)return;e.comparedSymbols+=1,e.cheapTotal+=i.size,e.oracleTotal+=u.size;let r=[],l=[];for(let t of i)u.has(t)?e.agreed+=1:r.push(t);for(let t of u)i.has(t)||l.push(t);(r.length>0||l.length>0)&&a.push({symbol:A(n.symbol),question:o,cheapOnly:r,oracleOnly:l})}var w={references:!0,callees:!1};function B(e,n,o){let i=n.oracleTotal>0?n.agreed/n.oracleTotal:1,u=n.cheapTotal-n.agreed,a=o==="semantic"?w[e]:!1;return{question:e,comparedSymbols:n.comparedSymbols,precision:a&&n.cheapTotal>0?h(n.agreed/n.cheapTotal):null,recall:h(i),unverified:u}}function y(e,n){return g(n.relativePath)==="clojure"&&b(e,n.relativePath)!==null}function K(e,n,o){let i=new Map,u=new Map,a=o.filter(t=>y(e,t)),r=new Map;for(let t of a){let c=r.get(t.leaf)??[];c.push(t),r.set(t.leaf,c)}for(let t of n.sourceFiles()){if(g(t)!=="clojure")continue;let c=b(e,t);if(c)for(let f of c.fileIdentifiers)for(let m of r.get(f)??[])P(i,m.symbolId,t)}let l=new Map;for(let t of n.scopedDefinitions()){if(g(t.relativePath)!=="clojure")continue;let c=l.get(t.leaf)??[];c.push(t),l.set(t.leaf,c)}for(let t of a){let c=b(e,t.relativePath);if(c){for(let f of c.callSites)if(!(f.line<t.startLine||f.line>t.endLine))for(let m of l.get(f.calleeLeaf)??[])P(u,t.symbolId,m.relativePath)}}return{referencesBySymbolId:i,calleesBySymbolId:u}}function P(e,n,o){let i=e.get(n);if(i){i.add(o);return}e.set(n,new Set([o]))}function h(e){return Math.round(e*1e3)/1e3}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7EK7OSWS.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as C,b as k,c as a,d as v}from"./chunk-HWVYTJOV.js";import{a as V,b as R}from"./chunk-MNCQPMCH.js";import{a as B,b}from"./chunk-ELC77ZDE.js";import{m as y}from"./chunk-SA3DPTHT.js";function W(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:l=6,limit:i=20,scope:o,scanLimit:d,filePattern:h,focusFiles:u}=s,t=y(e).vueProfiles({scope:o,minBehaviorTokens:Math.max(3,l),scanLimit:d}).map(n=>({file:n.file,tokens:n.behaviorTokens,profile:n})),r=V(t,n=>n.tokens);return R({profiles:t,limit:i,filePattern:h,focusFiles:u,candidateIndex:r,profile:{name:"vue-composable-candidates"},compare:(n,c)=>F(n,c,m,l),sort:(n,c)=>c.similarity-n.similarity||n.fileA.localeCompare(c.fileA)||n.fileB.localeCompare(c.fileB)})}function F(e,s,m,l){let i=B(e.tokens,s.tokens);if(i.size<l||!S(i))return null;let o=k(e.tokens,s.tokens);if(o<m)return null;let d=a(i,"composable:"),h=a(i,"store:"),u=a(i,"reactivity:"),t=a(i,"lifecycle:"),r=a(i,"request:"),n=a(i,"function:"),c=a(i,"function-verb:"),g=a(i,"template-binding:"),p=a(i,"template-event:"),f=T({sharedComposables:d,sharedStores:h,sharedReactivity:u,sharedLifecycle:t,sharedRequests:r,sharedFunctions:n,sharedFunctionVerbs:c,sharedBindings:g,sharedTemplateEvents:p});return{fileA:e.file,fileB:s.file,similarity:o,sharedTokens:v(i),sharedComposables:d,sharedStores:h,sharedReactivity:u,sharedLifecycle:t,sharedRequests:r,sharedFunctions:n,sharedFunctionVerbs:c,sharedBindings:g,sharedTemplateEvents:p,evidenceClass:f.evidenceClass,actionTier:f.actionTier,evidenceClassReasons:f.reasons,recommendation:f.recommendation,uniqueToA:v(b(e.tokens,s.tokens)).slice(0,25),uniqueToB:v(b(s.tokens,e.tokens)).slice(0,25),reason:w({sharedComposables:d,sharedStores:h,sharedRequests:r,sharedLifecycle:t,sharedFunctions:n,sharedFunctionVerbs:c,sharedBindings:g}),locA:e.profile.totalLines,locB:s.profile.totalLines}}function T(e){return C({genericWords:q,primitiveGroups:[{values:e.sharedReactivity,reasonPrefix:"shared reactivity primitive",bucket:"generic"},{values:e.sharedLifecycle,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedComposables,label:"shared composable",fallbackBucket:"shared-abstraction"},{names:e.sharedStores,label:"shared store",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedFunctions,label:"shared function",fallbackBucket:"generic"},{names:e.sharedFunctionVerbs,label:"shared action verb",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"},{names:e.sharedTemplateEvents,label:"shared template event",fallbackBucket:"generic"}],recommendation:P})}function P(e){switch(e){case"domain-behavior":return"Review for a shared composable, store, or feature module around the named domain behavior.";case"mixed":return"Separate generic Vue mechanics from domain-specific behavior before extracting a composable.";case"shared-abstraction":return"Review the existing composable/store usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct composable-extraction evidence."}}function S(e){let s=0,m=0,l=0,i=0,o=0,d=0,h=0;for(let r of e)r.startsWith("composable:")?s+=1:r.startsWith("store:")?m+=1:r.startsWith("request:")?l+=1:r.startsWith("lifecycle:")?i+=1:r.startsWith("function:")?o+=1:r.startsWith("reactivity:")?d+=1:(r.startsWith("function-verb:")||r.startsWith("template-binding:")||r.startsWith("template-event:"))&&(h+=1);let u=s+m,t=u+l+i+o+h;return l>=1&&t>=4||i>=1&&o>=2&&t>=4||u>=2&&(l>=1||o>=2)&&t>=5||o>=2&&d>=1&&t>=4}function w(e){let s=[];return e.sharedComposables.length&&s.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&s.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&s.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&s.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&s.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&s.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&s.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),s.join("; ")||"shared Vue behavior profile"}var q=new Set(["add","apply","cancel","change","clear","close","composable","create","data","delete","draft","edit","error","fetch","filter","form","item","items","load","loading","name","open","reactive","ref","refresh","remove","request","reset","resource","row","rows","save","saving","search","select","selected","store","submit","toggle","update","use","value","watch"]);export{W as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7IWIMNHI.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{h as H,k as O}from"./chunk-Z2LDWIJV.js";import{d as D}from"./chunk-ELC77ZDE.js";import{b as _,d as T,h as E,i as L}from"./chunk-T4N2ZRVY.js";import{a as w}from"./chunk-RM2WQ75T.js";import{d as C,e as F}from"./chunk-NABVR6B7.js";var G=5;function oe(e,t={}){let{base:a="HEAD",minContainment:o=.7,minCallees:r=3,minSiteCoverage:n=.4,maxHelpers:c=Number.POSITIVE_INFINITY,limit:m=20,scanLimit:g}=t,f=t.semantic!==!1,s=t.diffPlan??T(e,{base:a}),l={available:s.note!==_,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!l.available||s.changedFiles.length===0)return l;let x=new w(e),k=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from])),z=t.baseContentAt??E(e.config.projectRoot,a,L(s)),h=Y(x,k,$,z);if(h.length===0)return l;let R=h.slice(0,c);h.length>c&&(l.note=`helper scoring capped at ${c} of ${h.length} new symbols`);let j=x.calleeMap(R,{semantic:f}),q=R.map(i=>({def:i,callees:O((j.get(i.symbolId)??[]).map(p=>p.symbol))})),B=H(e),M,V=()=>(M??=B.calleeIndex({minCallees:Math.min(3,r),scanLimit:g,semantic:f}),M);for(let{def:i,callees:p}of q){let d=C(i.symbol);if(p.size<r){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:`fewer than ${r} meaningful callees \u2014 too small to score`});continue}let P=V(),N=X(p,P);if(N===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let b=Z(e,i.symbolId);if(b.length===0){l.skipped.push({helperShortName:d,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}l.helpersChecked+=1;let I=J({candidateIndex:P,changed:k,helperCallees:p,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:o,minSiteCoverage:n,migratedFiles:b});I.length!==0&&(I.sort((u,S)=>A(S.migrationScope)-A(u.migrationScope)||S.containment-u.containment||S.siteCoverage-u.siteCoverage||u.file.localeCompare(S.file)),l.findings.push({helperSymbol:i.symbol,helperShortName:d,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:p.size,specificHelperCalleeCount:N,migratedFiles:b.sort(),leftovers:I.slice(0,G)}))}return l.findings.sort((i,p)=>(p.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(p.helperFile)),l.findings=l.findings.slice(0,m),l}function J(e){let t=[],a=K(e.helperSymbol,e.helperFile,e.migratedFiles),o=new Set;for(let r of e.helperCallees)for(let n of e.candidateIndex.candidateIndexesByCallee.get(r)??[])o.add(n);for(let r of o){let n=e.candidateIndex.corpus[r];if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let c=D(e.helperCallees,n.callees);if(c<e.minContainment)continue;let m=[...e.helperCallees].filter(s=>n.callees.has(s)),g=n.callees.size===0?0:m.length/n.callees.size;if(g<e.minSiteCoverage||!m.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let f=U(a,n.symbol,n.file);t.push({symbol:n.symbol,shortName:C(n.symbol),file:n.file,...f,containment:c,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,n.callees.size-m.length),sharedCallees:m.map(C).sort()})}return t}function A(e){return e==="same-scope"?2:e==="unknown"?1:0}function K(e,t,a){let o=new Set([...y(t),...v(F(e))]);for(let r of a)for(let n of y(r))o.add(n);return o}function U(e,t,a){let o=new Set([...y(a),...v(F(t))]);if(e.size===0||o.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let r=[...o].filter(n=>e.has(n)).sort();return r.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${r.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var W=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function y(e){return v(e.replace(/\.[^.]+$/,""))}function v(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(t=>t.length>1&&!W.has(t))}function X(e,t){let a=0;for(let o of e)(t.docFreq.get(o)??0)<=t.ubiquityThreshold&&(a+=1);return a}function Y(e,t,a,o){return e.productionCallableDefinitions({files:[...t],requireFunctionLikeSymbol:!0}).filter(r=>{if(!t.has(r.relativePath))return!1;let n=a.get(r.relativePath)??r.relativePath,c=o(n);return c===null||!new RegExp(`\\b${Q(r.leaf)}\\b`).test(c)})}function Z(e,t){return e.all(`SELECT DISTINCT ref_d.relative_path
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
5
|
+
WHERE m.symbol_id = ?
|
|
6
|
+
AND m.role != 1
|
|
7
|
+
${e.pathExclusionsFor("ref_d")}`,t).map(o=>o.relative_path)}function Q(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{oe as a};
|
|
8
|
+
//# sourceMappingURL=chunk-7XTO4YXB.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b}from"./chunk-OFXN2BCT.js";import{k as f}from"./chunk-63CI3IXR.js";import{m as d}from"./chunk-NABVR6B7.js";function S(a,g){let p=b(a,g),i=f(a,p,{sort:!0});if(i.length===0)return[];let o=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,signature:e.signature,children:[]})),s=new Map;for(let e of o)s.set(e.symbol,e);let c=[];for(let e=0;e<i.length;e++){let r=i[e],n=o[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of o)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!d(t.symbol,n.symbol))continue;let u=t.endLine-t.startLine;u<m&&(m=u,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-A4UTLKHU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-F6IXELII.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ANUEY5WV.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as d}from"./chunk-64MNV6AB.js";import{c as S}from"./chunk-7S5E7KWT.js";import{readdirSync as m}from"fs";import{execFileSync as x}from"child_process";import{extname as l,join as y}from"path";var h=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],X=[".vue"],f=[".tsx",".jsx"],g=[".vue"],_=[...f,...g],C=new Set(f),O=new Set(g),p=new Set(h.map(e=>e.toLowerCase())),I=[...p].sort().join(","),E=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function R(e,t={}){let s=t.includeIndexed??!0,i=t.includeAuxiliary??!0,n=t.extensions?.map(c=>c.toLowerCase()),o=n?new Set(n):p,u=n?[...o].sort().join(","):I,r=`${s?"1":"0"}|${i?"1":"0"}|${u}`;return w.get(e,r,()=>{let c=new Set;if(s)for(let a of d(e,{includeIgnored:!1}))o.has(l(a).toLowerCase())&&c.add(a);if(i)for(let a of N(e.config.projectRoot,o))e.isIgnored(a)||s&&c.has(a)||c.add(a);return[...c].sort()})}function D(e,t={}){let s=!1,i=!1;for(let n of R(e,{extensions:_})){if(t.scope&&!n.includes(t.scope))continue;let o=l(n).toLowerCase();if(s||=C.has(o),i||=O.has(o),s&&i)break}return{react:s,vue:i}}var w=S("source-files",{clearGroups:[]});function N(e,t){return T(e,t)??v(e,t)}function T(e,t){try{let s=x("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,stdio:["ignore","pipe","ignore"]}),i=new Set;for(let n of s.split(`
|
|
2
|
+
`)){let o=n.trim();o&&(j(o)||t.has(l(o).toLowerCase())&&i.add(o))}return i}catch{return null}}function j(e){return e.split("/").some(t=>E.has(t))}function v(e,t){let s=new Set,i=n=>{let o=n?y(e,n):e,u;try{u=m(o,{withFileTypes:!0})}catch{return}for(let r of u)if(!E.has(r.name)){if(r.isDirectory()){i(n?`${n}/${r.name}`:r.name);continue}t.has(l(r.name).toLowerCase())&&s.add(n?`${n}/${r.name}`:r.name)}};return i(""),s}export{X as a,E as b,R as c,D as d};
|
|
3
|
+
//# sourceMappingURL=chunk-AREANYIA.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-RM2WQ75T.js";import{a as b}from"./chunk-NBNEVLRC.js";import{d as m}from"./chunk-NABVR6B7.js";import{b as l}from"./chunk-THB6AM3V.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
|
|
2
2
|
`).slice(r,t+1).join(`
|
|
3
3
|
`)}catch{return""}}function S(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
4
|
FROM mentions m
|
|
5
5
|
JOIN chunks c ON m.chunk_id = c.id
|
|
6
6
|
WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function L(e,n){return new Set(e.filter(r=>r.file!==n).map(r=>r.symbol)).size}function P(e,n){let r=l(e),t=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=r.match(o);s&&(t+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}return t}export{O as a};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-AZBELWZQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-RM2WQ75T.js";import{a as h}from"./chunk-RSSXKJ6J.js";import{r as S}from"./chunk-UQ73QF5D.js";import{a as d,b}from"./chunk-NBNEVLRC.js";import{m as y}from"./chunk-63CI3IXR.js";import{d as m}from"./chunk-NABVR6B7.js";function v(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=d(e,o);return r?c==="backward"?w(e,r,s,{semantic:l.semantic!==!1}):M(e,r,{semantic:l.semantic!==!1}):null}function w(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let p of t){let g=h(e,p,{semantic:c.semantic});for(let a of g){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function M(e,o,l){let c=new Set,s=[],r=new u(e);for(let t of S(e,o,{semantic:l.semantic})){if(s.length>=30)break;let n=t.enclosingSymbol??y(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CXWCLVYL.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as k,b as h}from"./chunk-ULHLDOD6.js";import{f as R}from"./chunk-63CI3IXR.js";import{e as C,f as se}from"./chunk-NABVR6B7.js";import{a as _}from"./chunk-THB6AM3V.js";import{c as ie,e as re,g as oe}from"./chunk-SGTKURU6.js";import{a as O}from"./chunk-64MNV6AB.js";import{a as ne,c as te}from"./chunk-7S5E7KWT.js";import{performance as m}from"perf_hooks";function b(i,e,n){if(i.has(e))return i.get(e);let t=n();return i.set(e,t),t}import ae from"path";function Oe(i,e){return i.getReferences().map(n=>{let t=n.getNode();return W(t,e)})}function We(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function ce(i,e,n,t){let r=[];for(let o of We(i))for(let s of Oe(o,t))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||r.push(s);for(let o of n)r.push(o);return P(r)}function le(i,e,n,t){let r=[],o=n?.getStart();for(let s of i.getReferences()){let a=s.getNode();N(t,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||r.push({location:W(a,t),node:a}))}return r}function W(i,e){let n=i.getSourceFile(),t=n.getLineAndColumnAtPos(i.getStart());return{file:N(e,n.getFilePath())??n.getBaseName(),line:t.line-1,column:t.column-1}}function fe(i,e,n){let t=i.getSourceFile(),r=z(t,i),o=i.getText(),s=new RegExp(`\\b${Be(o)}\\b`,"g"),a=t.getFullText().split(`
|
|
2
|
+
`),c=[];for(let l=0;l<a.length;l++){if(l===r)continue;let d=a[l]??"";s.lastIndex=0;let p;for(;(p=s.exec(d))!==null;)c.push({file:e,line:l,column:p.index})}return P(c.filter(l=>N(n,ae.join(n,l.file))===e))}function $(i){for(let e=i;e;e=e.getParent()){let n=e.getKindName();if(n.includes("Type")||n==="InterfaceDeclaration"||n==="TypeAliasDeclaration")return!0;if(n==="CallExpression"||n==="NewExpression"||n==="ExpressionStatement")return!1}return!1}function z(i,e){return i.getLineAndColumnAtPos(e.getStart()).line-1}function P(i){let e=new Set,n=[];for(let t of i){let r=`${t.file}:${t.line}:${t.column}`;e.has(r)||(e.add(r),n.push(t))}return n}function N(i,e){let n=ae.relative(i||process.cwd(),e).replace(/\\/g,"/");return!n||n.startsWith("..")?null:n}function Be(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pe(i,e,n,t){let r=He(e,t);return r.size===0?new Map:_e(i,n,r)}function He(i,e){let n=new Map;for(let t of R(i,e)){let r=C(t.symbol)??t.leaf;if(!r)continue;let o=n.get(r);o||(o=[],n.set(r,o)),o.push(t)}return n}function _e(i,e,n){let t=new Map,r=new Map;return e.forEachDescendant(o=>{for(let s of $e(i,o)){let a=n.get(s);if(!a)continue;let c=z(e,o);for(let l of a){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),p=r.get(l.symbolId);p!==void 0&&p<=d||(r.set(l.symbolId,d),t.set(l.symbolId,o))}}}),t}function $e(i,e){let n=[],t=r=>{r&&!n.includes(r)&&n.push(r)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let r=e.getNameNode();t(r?.getText())}if("getName"in e&&typeof e.getName=="function"){let r=e.getName();t(r)}return i.Node.isIdentifier(e)&&t(e.getText()),n}var ze=te("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function ue(i,e,n,t){let r=ge(i,e),o=de(r.get(t)??[],n);if(o)return o;let s=[];for(let a of r.values())for(let c of a)((c.leaf||C(c.symbol)||"").includes(t)||c.symbol.includes(t))&&s.push(c);return de(s,n)}function me(i,e){let n=new Map;for(let[t,r]of ge(i,e)){let o=r[0];o&&n.set(t,o)}return n}function ge(i,e){return ze.get(i,e,()=>{let n=new Map;for(let t of R(i,e)){let r=t.leaf||C(t.symbol);if(!r)continue;let o=n.get(r);o||(o=[],n.set(r,o)),o.push({...t,leaf:r})}for(let t of n.values())t.sort((r,o)=>r.startLine-o.startLine||r.endLine-o.endLine||r.symbolId-o.symbolId);return n})}function de(i,e){let n=null,t=Number.POSITIVE_INFINITY;for(let r of i){let o=Math.abs(r.startLine-e);(o<t||o===t&&n&&r.startLine<n.startLine)&&(n=r,t=o)}return n}import V from"path";var T=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function D(i){let e=i.toLowerCase();return T.some(n=>e.endsWith(n))}function ye(i,e){let n=new Map,t=null,r=null,o=()=>(r??=O(i,{extensions:T}),r),s=()=>(t??=h("typescript.source-file-index",()=>Ve(i.config.projectRoot,e,o()),()=>({projects:e.length,indexedDocuments:o().length})),t),a=c=>D(c)?b(n,c,()=>{let l=w(V.resolve(i.config.projectRoot,c));for(let{project:d,sourceFiles:p}of s()){let f=p.get(l)??null;if(f||(f=d.addSourceFileAtPathIfExists(l)??null,f&&p.set(w(f.getFilePath()),f)),f)return{project:d,sourceFile:f}}return null}):null;return{sourceFile:c=>a(c)?.sourceFile??null,sourceFileMatch:a,indexedTypeScriptLikeDocuments:o}}function Ve(i,e,n){let t=e.map(({project:r})=>({project:r,sourceFiles:new Map(r.getSourceFiles().map(o=>[w(o.getFilePath()),o]))}));for(let r of n){let o=w(V.resolve(i,r));for(let s of t){if(s.sourceFiles.has(o))break;let a=s.project.addSourceFileAtPathIfExists(o)??null;if(a){s.sourceFiles.set(w(a.getFilePath()),a);break}}}return t}function w(i){return V.resolve(i)}import v from"path";import{existsSync as B,readdirSync as qe,readFileSync as Se}from"fs";function he(i){let e=v.join(i,"package.json");if(!B(e))return[];let n;try{n=JSON.parse(Se(e,"utf8"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(r=>Je(i,r)).flatMap(r=>Ke(i,r))}function Je(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=v.join(i,e);return B(v.join(s,"package.json"))?[s]:[]}let n=e.indexOf("*"),t=e.slice(0,n).replace(/\/$/,""),r=e.slice(n+1).replace(/^\//,""),o=v.join(i,t||".");if(!B(o))return[];try{return qe(o).map(s=>v.join(o,s,r)).filter(s=>B(v.join(s,"package.json")))}catch{return[]}}function Ke(i,e){try{let n=JSON.parse(Se(v.join(e,"package.json"),"utf8"));if(!n.name)return[];let t=v.relative(i,e).replace(/\\/g,"/");return[{name:n.name,rootRelative:t,sourceRootRelative:`${t}/src`}]}catch{return[]}}function be(i,e){for(let n of i)if(e===n.name||e.startsWith(`${n.name}/`))return n.name;return null}function Me(i){return[`${i.sourceRootRelative}/index.ts`,`${i.sourceRootRelative}/index.tsx`,`${i.sourceRootRelative}/index.mts`,`${i.sourceRootRelative}/index.cts`]}import{existsSync as L,readFileSync as Ge,readdirSync as Ye,statSync as Xe}from"fs";import S from"path";var J=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function K(i,e){let t=e?S.dirname(S.join(i,e)):i,r=S.resolve(i);for(;t.startsWith(r);){for(let s of J){let a=S.join(t,s);if(L(a))return a}let o=S.dirname(t);if(o===t)break;t=o}for(let o of J){let s=S.join(i,o);if(L(s))return s}return null}function Ie(i){let e=i.config.projectRoot,n=new Set(Qe(e,i.config.semantic?.typescript?.tsconfigs)),t=O(i,{includeIgnored:!1,extensions:T});for(let r of t){let o=K(e,r);o&&n.add(S.resolve(o))}if(n.size===0){let r=K(e);r&&n.add(S.resolve(r))}return[...n].filter(r=>!xe(e,r)).sort((r,o)=>r.localeCompare(o))}function Qe(i,e=[]){let n=new Set;for(let t of e){let r=S.isAbsolute(t)?t:S.join(i,t);L(r)&&n.add(S.resolve(r))}for(let t of Ze(i))for(let r of J){let o=S.join(t,r);L(o)&&n.add(S.resolve(o))}if(n.size===0){let t=K(i);t&&n.add(S.resolve(t))}return[...n].filter(t=>!xe(i,t)).sort((t,r)=>t.localeCompare(r))}function Ze(i){let e=S.join(i,"package.json");if(!L(e))return[];let n;try{n=JSON.parse(Ge(e,"utf8"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(r=>en(i,r))}function en(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=S.join(i,e);return q(s)?[s]:[]}let n=e.indexOf("*"),t=e.slice(0,n).replace(/\/$/,""),r=e.slice(n+1).replace(/^\//,""),o=S.join(i,t||".");return q(o)?Ye(o).map(s=>S.join(o,s,r)).filter(q):[]}function q(i){try{return Xe(i).isDirectory()}catch{return!1}}function xe(i,e){let n=S.relative(i,e).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}import{createRequire as nn}from"module";var tn=nn(import.meta.url),E;function ke(){if(E!==void 0)return E;try{E=tn("ts-morph")}catch{E=null}return E}function ve(i,e){return e.map(n=>({tsconfigPath:n,project:new i.Project({tsConfigFilePath:n,skipFileDependencyResolution:!0})}))}function H(i,e,n){return{language:"typescript",availability:()=>({available:!1,reason:i,tsconfigPath:e,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var rn=32;function Ne(i,e){let n=h("typescript.provider.load",()=>ke());if(!n)return H("ts-morph is not installed");let t=h("typescript.provider.tsconfig-discovery",()=>Ie(i));if(t.length===0)return H("no tsconfig found");try{let r=h("typescript.provider.project-bundles",()=>ve(n,t),()=>({tsconfigs:t.length}));return h("typescript.provider.construct",()=>new G(i,n,r),()=>({tsconfigs:t.length}))}catch(r){return H(r instanceof Error?r.message:String(r),t[0],t)}}var G=class{constructor(e,n,t){this.db=e;this.tsMorph=n;this.projects=t;this.workspacePackages=he(e.config.projectRoot),this.sourceFiles=ye(e,t)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return b(this.importUsageCache,e,()=>{let n=this.sourceFiles.sourceFile(e);if(!n)return[];let t=sn();return h("typescript.import-usage.file",()=>this.importUsageForSourceFile(e,n,t),()=>({file:e,...t}))})}referencesFor(e){return b(this.referencesCache,e.symbolId,()=>{let n=this.nodeForDefinition(e);return this.referencesForDefinitionNode(e,n)})}referencesForDefinitions(e){let n=new Map,t=k(),r=[];for(let c of e){let l=this.referencesCache.get(c.symbolId);l?n.set(c.symbolId,l):r.push(c)}if(r.length===0)return n;let o=r,s=r.filter(c=>!Fe(c));if(s.length>=rn){let c=this.referencesForDefinitionsBySymbolScan(s);for(let l of s){let d=c.get(l.symbolId)??[];this.referencesCache.set(l.symbolId,d),n.set(l.symbolId,d)}if(o=r.filter(l=>Fe(l)),o.length===0)return n}let a=new Map;for(let c of o){let l=a.get(c.relativePath);l?l.push(c):a.set(c.relativePath,[c])}for(let[c,l]of a){let d=Re();h("typescript.references-map.file",()=>{let p=this.definitionNodesForFile(c);for(let f of l){t&&(d.cacheMisses+=1);let u=p.get(f.symbolId)??null;t&&(u?d.nodeHits+=1:d.nodeMisses+=1);let g=this.referencesForDefinitionNode(f,u,t?d:void 0);this.referencesCache.set(f.symbolId,g),n.set(f.symbolId,g)}},()=>({relativePath:c,definitions:l.length,...Ce(d)}))}return n}referencesForDefinitionsBySymbolScan(e){let n=k(),t=Re(),r=new Map,o=new Set(e.map(a=>a.symbolId)),s=new Map(e.map(a=>[a.symbolId,a]));for(let a of e)r.set(a.symbolId,[]);return h("typescript.references-map.inverted-scan",()=>{let a=n?m.now():0;for(let p of e){let f=this.packageImportReferencesForDefinition(p);if(f.length>0){let u=r.get(p.symbolId)??[];u.push(...f),r.set(p.symbolId,u)}n&&(t.packageReferenceCount+=f.length)}n&&(t.packageRefsMs+=m.now()-a);let c=new Map,l=new Set(e.map(p=>p.leaf).filter(Boolean)),d=n?m.now():0;for(let p of this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(p))continue;let f=this.sourceFiles.sourceFile(p);f&&(n&&(t.scanFiles+=1),this.addReferencesFromSourceFileScan(f,p,o,s,l,c,r,n?t:void 0))}n&&(t.scanMs+=m.now()-d);for(let[p,f]of r){let u=P(f);r.set(p,u),n&&(t.referenceCount+=u.length)}},()=>({definitions:e.length,...Ce(t)})),r}addReferencesFromSourceFileScan(e,n,t,r,o,s,a,c){let l=this.compilerCheckerForSourceFile(e),d=e.compilerNode,p=ln(e),f=u=>{if(this.tsMorph.ts.isIdentifier(u)){if(c&&(c.identifiers+=1),!o.has(u.text)&&!p.has(u.text)){this.tsMorph.ts.forEachChild(u,f);return}let g=this.compilerReferenceSymbol(l,u,c);if(g){let y;if(s.has(g)?y=s.get(g)??null:(y=this.definitionFromCompilerSymbol(g),s.set(g,y)),c&&(y?c.targetHits+=1:c.targetMisses+=1),y&&t.has(y.symbolId)){c&&(c.requestedHits+=1);let F=r.get(y.symbolId);if(F&&!pn(F,n,De(d,u))){let I=a.get(y.symbolId)??[],U=d.getLineAndCharacterOfPosition(u.getStart(d));I.push({file:n,line:U.line,column:U.character}),a.set(y.symbolId,I)}}}}this.tsMorph.ts.forEachChild(u,f)};f(d)}compilerReferenceSymbol(e,n,t){t&&(t.symbolLookups+=1);let r=e.getSymbolAtLocation(n);if(r){if((r.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return r;try{return t&&(t.aliasResolutions+=1),e.getAliasedSymbol(r)}catch{return r}}}calleesFor(e){return b(this.calleesCache,e.symbolId,()=>b(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}calleesForDefinitions(e){let n=new Map,t=new Map;for(let r of e){let o=t.get(r.relativePath);o?o.push(r):t.set(r.relativePath,[r])}for(let[r,o]of t){let s=this.fileCalleesCache.get(r),a=new Set(o.map(l=>l.symbolId)),c=s??this.calleeMapForFile(r,a);for(let l of o){let d=c.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,d),n.set(l.symbolId,d)}}return n}referencesForDefinitionNode(e,n,t){let r=t?m.now():0,o=this.packageImportReferencesForDefinition(e);if(t&&(t.packageRefsMs+=m.now()-r,t.packageReferenceCount+=o.length),!n)return o;let s=t?m.now():0,a=ce(n,e,o,this.db.config.projectRoot);return t&&(t.semanticRefsMs+=m.now()-s,t.referenceCount+=a.length),a}signatureFor(e){return b(this.signatureCache,e.symbolId,()=>{let n=this.nodeForDefinition(e);if(!n||!this.tsMorph.Node.isFunctionDeclaration(n)&&!this.tsMorph.Node.isMethodDeclaration(n)&&!this.tsMorph.Node.isArrowFunction(n)&&!this.tsMorph.Node.isFunctionExpression(n)&&!this.tsMorph.Node.isConstructorDeclaration(n))return null;let t=n.getType().getCallSignatures()[0];if(!t)return null;let r=t.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return Pe(c)}),o=t.getReturnType().getText(n);return`(${r.join(",")})=>${Pe(o)}`})}importUsageForSourceFile(e,n,t){let r=[],o=new Map;for(let s of n.getImportDeclarations()){t.declarations+=1;let a=_(this.db,e,s.getModuleSpecifierValue()),c=s.getImportClause()?.isTypeOnly()??!1;for(let l of Y(s)){t.entries+=1;let d=c?null:l.identifier?.getSymbol()?.compilerSymbol??null;!c&&l.identifier&&(d?t.bindingSymbols+=1:t.missingBindingSymbols+=1);let p={sourcePath:a,entry:l,typeOnlyDeclaration:c,bindingSymbol:d,references:[]};if(r.push(p),c||!l.localName||!d)continue;let f=o.get(l.localName);f?f.push(p):o.set(l.localName,[p])}}return o.size>0&&n.forEachDescendant(s=>{if(s.getKindName()!=="Identifier")return;let a=o.get(s.getText());if(!a||an(s))return;t.scannedIdentifiers+=1;let c=s.getSymbol()?.compilerSymbol;if(t.symbolLookups+=1,!!c){for(let l of a)if(l.bindingSymbol===c){l.references.push({location:W(s,this.db.config.projectRoot),node:s}),t.matchedReferences+=1;break}}}),r.map(s=>s.typeOnlyDeclaration?on(e,s.sourcePath,s.entry):s.entry.identifier&&!s.bindingSymbol?(t.fallbackEntries+=1,this.valueImportUsageForEntry(e,s.sourcePath,s.entry)):this.valueImportUsageFromLocations(e,s.sourcePath,s.entry,s.references))}valueImportUsageForEntry(e,n,t){let r=t.identifier?t.identifier.findReferences():[],o=[];for(let s of r)for(let a of le(s,e,t.identifier,this.db.config.projectRoot))o.push(a);return this.valueImportUsageFromLocations(e,n,t,o)}valueImportUsageFromLocations(e,n,t,r){let o=r.some(c=>!$(c.node)),s=r.some(c=>$(c.node)),a=t.isTypeOnly;return{importer:e,sourcePath:n,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:a,isUsed:a||r.length>0,isTypeUsed:a||s,isValueUsed:o,references:r.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,n=this.packageExports();for(let t of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,n,t);for(let[t,r]of e)e.set(t,P(r));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,n,t){if(this.db.isIgnored(t))return;let r=this.sourceFiles.sourceFileMatch(t);if(r)for(let o of r.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,n,t,o)}addPackageImportReferencesForDeclaration(e,n,t,r){let o=be(this.workspacePackages,r.getModuleSpecifierValue());if(!o)return;let s=n.get(o);if(s)for(let a of Y(r)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let l=fe(a.identifier,t,this.db.config.projectRoot);l.length>0&&mn(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let n of this.workspacePackages){let t=new Map;for(let r of Me(n))this.collectPackageExports(n,r,t,new Set);t.size>0&&e.set(n.name,t)}return this.packageExportIndex=e,e}collectPackageExports(e,n,t,r){if(r.has(n))return;r.add(n);let o=this.sourceFiles.sourceFile(n);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?_(this.db,n,a):n;if(!c||!c.startsWith(`${e.sourceRootRelative}/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,c,t,r);continue}for(let d of l){let p=d.getNameNode().getText(),f=d.getAliasNode()?.getText()??p,u=this.indexedDefinitionByLeaf(c,p);if(!u)continue;let g=t.get(f);g||(g=new Set,t.set(f,g)),g.add(u.symbolId)}}}indexedDefinitionByLeaf(e,n){return b(this.indexedDefinitionLeafCache,e,()=>me(this.db,e)).get(n)??null}nodeForDefinition(e){return b(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return b(this.fileDefinitionNodeCache,e,()=>{let n=this.sourceFiles.sourceFile(e);return n?pe(this.tsMorph,this.db,n,e):new Map})}definitionFromCompilerSymbol(e,n){let t=e.name,r=n?m.now():0,o=e.declarations??[];n&&(n.declarationsMs+=m.now()-r,n.declarationChecks+=o.length);for(let s of o){let a=n?m.now():0,c=s.getSourceFile(),l=N(this.db.config.projectRoot,c.fileName),d=c.getLineAndCharacterOfPosition(s.getStart(c)).line;if(n&&(n.declarationLocationMs+=m.now()-a),!l||this.db.isIgnored(l))continue;let p=n?m.now():0,f=ue(this.db,l,d,t);if(n&&(n.indexedLookupMs+=m.now()-p),f)return{symbolId:f.symbolId,symbol:f.symbol,file:f.relativePath,line:f.startLine}}return null}calleeMapForFile(e,n){let t=k(),r=0,o=0,s=0,a=0,c=0,l=0,d=0,p=0,f=t?dn():void 0;return h("typescript.callee-map.file",()=>{let u=t?m.now():0,g=this.sourceFiles.sourceFile(e);if(t&&(c=Math.round(m.now()-u)),!g)return new Map;let y=t?m.now():0,F=R(this.db,e).sort((M,x)=>M.startLine-x.startLine||x.endLine-M.endLine);if(t&&(l=Math.round(m.now()-y)),r=F.length,F.length===0)return new Map;let I=new Map,U=t?m.now():0,je=this.compilerCheckerForSourceFile(g),Z=g.compilerNode;t&&(d=Math.round(m.now()-U));let Ae=new Map,ee=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){t&&(o+=1);let x=this.semanticCalleeForCallNode(je,Z,F,M,Ae,n,f);x&&(t&&(s+=1),cn(I,x.callerId,x.target))}this.tsMorph.ts.forEachChild(M,ee)},Ue=t?m.now():0;ee(Z),t&&(p=Math.round(m.now()-Ue));for(let[M,x]of I)I.set(M,gn(x));return a=I.size,I},()=>({relativePath:e,definitions:r,callNodes:o,resolvedCallees:s,outputRows:a,requestedDefinitions:n?.size??r,sourceFileLookupMs:c,definitionsLoadMs:l,checkerLookupMs:d,traversalMs:p,...f?un(f):{}}))}semanticCalleeForCallNode(e,n,t,r,o,s,a){let c=a?m.now():0,l=fn(t,De(n,r));if(a&&(a.callerLookupMs+=m.now()-c),!l)return null;if(s&&!s.has(l.symbolId))return a&&(a.skippedUnrequestedCallers+=1),null;let d=r.expression,p=this.compilerSymbolForExpression(e,d,a),f=null;if(p)if(a&&(a.targetSymbolHits+=1),o.has(p))a&&(a.compilerSymbolCacheHits+=1),f=o.get(p)??null;else{a&&(a.compilerSymbolCacheMisses+=1);let u=a?m.now():0;f=this.definitionFromCompilerSymbol(p,a),a&&(a.targetLookupMs+=m.now()-u),o.set(p,f)}else a&&(a.targetMisses+=1);return f?{callerId:l.symbolId,target:{symbol:f.symbol,file:f.file,line:f.line}}:null}compilerSymbolForExpression(e,n,t){let r=t?m.now():0,o=e.getSymbolAtLocation(n);if(t&&(t.expressionSymbolMs+=m.now()-r),o)return o;t&&(t.typeFallbacks+=1);let s=t?m.now():0,a=e.getTypeAtLocation(n).getSymbol();return t&&(t.typeSymbolMs+=m.now()-s),a}compilerCheckerForSourceFile(e){let n=e.getProject(),t=this.compilerCheckerCache.get(n);return t||(t=n.getTypeChecker().compilerObject,this.compilerCheckerCache.set(n,t)),t}};function Y(i){let e=[],n=i.getDefaultImport();n&&e.push({identifier:n,importedName:"default",localName:n.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let t=i.getNamespaceImport();t&&e.push({identifier:t,importedName:"*",localName:t.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let r of i.getNamedImports()){let o=r.getNameNode(),a=r.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:r.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function on(i,e,n){return{importer:i,sourcePath:e,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function sn(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function an(i){for(let e=i;e;e=e.getParent())if(e.getKindName()==="ImportDeclaration")return!0;return!1}function cn(i,e,n){let t=i.get(e);t||(t=[],i.set(e,t)),t.push(n)}function ln(i){let e=new Set;for(let n of i.getImportDeclarations())for(let t of Y(n))t.localName&&e.add(t.localName);return e}function fn(i,e){let n=null;for(let t of i)e<t.startLine||e>t.endLine||(!n||t.startLine>=n.startLine)&&(n=t);return n}function De(i,e){return i.getLineAndCharacterOfPosition(e.getStart(i)).line}function pn(i,e,n){return e===i.relativePath&&n>=i.startLine&&n<=i.endLine}function Fe(i){return i.symbol.includes("#")?se(i.symbol)==="type"&&i.relativePath.endsWith(".d.ts"):!1}function dn(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function un(i){return{...i,callerLookupMs:Math.round(i.callerLookupMs),expressionSymbolMs:Math.round(i.expressionSymbolMs),typeSymbolMs:Math.round(i.typeSymbolMs),targetLookupMs:Math.round(i.targetLookupMs),declarationsMs:Math.round(i.declarationsMs),declarationLocationMs:Math.round(i.declarationLocationMs),indexedLookupMs:Math.round(i.indexedLookupMs)}}function Re(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0}}function Ce(i){return{...i,scanMs:Math.round(i.scanMs),packageRefsMs:Math.round(i.packageRefsMs),semanticRefsMs:Math.round(i.semanticRefsMs)}}function mn(i,e,n){for(let t of e){let r=i.get(t)??[];r.push(...n),i.set(t,r)}}function gn(i){let e=new Set,n=[];for(let t of i){let r=`${t.symbol}|${t.file}|${t.line}`;e.has(r)||(e.add(r),n.push(t))}return n}function Pe(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var X=new WeakMap;ne({name:"semantic-provider",groups:["semantic-provider"],clearAll:i=>X.delete(i)});function Q(i,e){let n=`${i.config.projectRoot}:typescript-workspace`,t=X.get(i);t||(t=new Map,X.set(i,t));let r=t.get(n);if(r)return r;let o=Ne(i,e);return t.set(n,o),o}function j(i){return{capability:(e,n)=>Ee(i,e,n),importUsage:e=>yn(i,e),references:e=>Sn(i,e),callerMap:e=>hn(i,e),calleeMap:e=>In(i,e),signature:e=>xn(i,e)}}function bt(i,e){return j(i).importUsage(e)}function yn(i,e){let n=A(i,e);return n?n.importUsage(e):[]}function Mt(i,e){return j(i).references(e)}function Sn(i,e){let n=A(i,e.relativePath);return n?n.referencesFor(e):[]}function It(i,e){return j(i).callerMap(e)}function hn(i,e){let n=k(),t=new Map,r=ie(i),o=[],s=[],a=[],c=0,l=0,d=0,p=0;if(h("semantic.references.cache-scan",()=>{for(let f of e){if(!r||!D(f.relativePath)){n&&!D(f.relativePath)&&(c+=1),a.push(f);continue}let u=re(i,f.relativePath,f.symbol,r);if(u!==null){let g=Mn(u);if(g){n&&(l+=1),p+=we(i,t,f,g);continue}n&&(d+=1)}s.push(f)}},()=>({definitions:e.length,skippedNonTs:c,cacheHits:l,parseFailures:d,misses:s.length,unkeyed:a.length,resultRows:t.size,callerFiles:p})),s.length>0||a.length>0){let f=[...a,...s],u=0,g=h("semantic.references.compute-misses",()=>{let y=bn(i,f);return u=y.size,y},()=>({definitions:f.length,misses:s.length,unkeyed:a.length,rows:u}));for(let y of f)p+=we(i,t,y,g.get(y.symbolId)??[]);if(r)for(let y of s)o.push({relativePath:y.relativePath,symbol:y.symbol,projectFingerprint:r,payload:JSON.stringify(g.get(y.symbolId)??[])})}return o.length>0&&(Ee(i,"semantic-references").available?h("semantic.references.cache-write",()=>oe(i,o),()=>({entries:o.length})):h("semantic.references.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",entries:o.length}))),t}function bn(i,e){let n=k(),t=new Map,r=0,o=0,s=0,a=0;return h("semantic.references.provider-loop",()=>{let c=new Map,l=[];for(let d of e){let p=A(i,d.relativePath);if(!p){n&&(o+=1);continue}if(n&&(r+=1),p.referencesForDefinitions){let f=c.get(p);f?f.push(d):c.set(p,[d])}else l.push({provider:p,definition:d})}for(let[d,p]of c){let f=d.referencesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Te(t,u.symbolId,g,n,y=>{s+=1,a+=y})}}for(let{provider:d,definition:p}of l){let f=d.referencesFor(p);Te(t,p.symbolId,f,n,u=>{s+=1,a+=u})}return t},()=>({definitions:e.length,providerHits:r,providerMisses:o,definitionsWithReferences:s,referenceCount:a,rows:t.size}))}function Te(i,e,n,t,r){i.set(e,n),t&&n.length>0&&r(n.length)}function we(i,e,n,t){let r=0;for(let o of t){if(o.file===n.relativePath||i.isIgnored(o.file))continue;let s=e.get(n.symbolId);s||(s=new Set,e.set(n.symbolId,s));let a=s.size;s.add(o.file),s.size!==a&&(r+=1)}return r}function Mn(i){try{return JSON.parse(i)}catch{return null}}function xt(i,e){return j(i).calleeMap(e)}function In(i,e){let n=k(),t=new Map,r=0,o=0,s=0,a=0;return h("semantic.callees.provider-loop",()=>{let c=new Map,l=[];for(let d of e){let p=A(i,d.relativePath);if(!p){n&&(o+=1);continue}n&&(r+=1);let f=d;if(p.calleesForDefinitions){let u=c.get(p);u?u.push(f):c.set(p,[f])}else l.push({provider:p,definition:f})}for(let[d,p]of c){let f=d.calleesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Le(t,u.symbolId,g,n,y=>{s+=1,a+=y})}}for(let{provider:d,definition:p}of l){let f=d.calleesFor(p);Le(t,p.symbolId,f,n,u=>{s+=1,a+=u})}return t},()=>({definitions:e.length,providerHits:r,providerMisses:o,definitionsWithCallees:s,calleeCount:a,rows:t.size}))}function Le(i,e,n,t,r){n.length>0&&(i.set(e,n),t&&r(n.length))}function kt(i,e){return j(i).signature(e)}function xn(i,e){let n=A(i,e.relativePath);return n?n.signatureFor(e):null}function Ee(i,e,n){if(n!==void 0&&!D(n))return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript files"};try{return{slot:e,language:"typescript",...Q(i,n).availability()}}catch(t){return{slot:e,language:"typescript",available:!1,reason:t instanceof Error?t.message:String(t)}}}function A(i,e){if(!D(e))return null;let n=Q(i,e);return n.availability().available?n:null}export{D as a,j as b,bt as c,Mt as d,It as e,xt as f,kt as g};
|
|
3
|
+
//# sourceMappingURL=chunk-CYHIKTJN.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as k}from"./chunk-F6IXELII.js";function K(i,l={}){let{limit:d=10,scope:h,minDepth:x=3}=l,f=k(i,h),w=new Map,o=[],p=new Map,a=new Map,m=new Set,b=[],g=0;for(let e of f.keys()){if(p.has(e))continue;let t=[],s=(f.get(e)??new Set).values();for(p.set(e,g),a.set(e,g),g+=1,b.push(e),m.add(e),t.push({node:e,iter:s,pendingChild:null});t.length>0;){let n=t[t.length-1];if(n.pendingChild!==null){let u=n.pendingChild;n.pendingChild=null,a.set(n.node,Math.min(a.get(n.node),a.get(u)))}let c=n.iter.next();if(c.done){if(a.get(n.node)===p.get(n.node)){let u=[];for(;;){let S=b.pop();if(m.delete(S),u.push(S),w.set(S,o.length),S===n.node)break}o.push(u)}t.pop();continue}let r=c.value;if(p.has(r))m.has(r)&&a.set(n.node,Math.min(a.get(n.node),p.get(r)));else{p.set(r,g),a.set(r,g),g+=1,b.push(r),m.add(r);let u=(f.get(r)??new Set).values();n.pendingChild=r,t.push({node:r,iter:u,pendingChild:null})}}}let C=new Map,D=new Array(o.length);for(let e=0;e<o.length;e++)D[e]=o[e].length,C.set(e,new Set);for(let[e,t]of f){let s=w.get(e);for(let n of t){let c=w.get(n);c!==s&&C.get(s).add(c)}}let y=new Array(o.length),R=new Array(o.length);for(let e=0;e<o.length;e++){let t=[],s=0;for(let n of C.get(e)){let c=R[n];c>s&&(s=c,t=y[n])}y[e]=[e,...t],R[e]=D[e]+s}function M(e){return y[e]}let T=o.map(e=>[...e].sort()),v=new Set,I=[];for(let e=0;e<o.length;e++){let t=M(e),s=[];for(let c of t)s.push(...T[c]);if(s.length<x)continue;let n=s.join(" ");v.has(n)||(v.add(n),I.push(A(s)))}return I.sort((e,t)=>t.depth-e.depth),F(I).slice(0,d)}function A(i){return{chain:i,depth:i.length,actionTier:"signal",chainKind:"transitive-dependency-depth",evidenceReasons:[`${i.length} file(s) form the representative transitive dependency path`,"cycles are condensed before longest-path calculation"],recommendation:"Review whether the chain crosses ownership or layer boundaries; shorten it only when the dependency direction is accidental."}}function F(i){let l=[];for(let d of i)l.some(h=>L(d.chain,h.chain))||l.push(d);return l}function L(i,l){if(i.length>=l.length)return!1;let d=l.length-i.length;for(let h=0;h<i.length;h++)if(i[h]!==l[d+h])return!1;return!0}export{K as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DDQONX6B.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as p}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-RM2WQ75T.js";import{a as f}from"./chunk-L446VQYQ.js";import{a as c}from"./chunk-RSSXKJ6J.js";import{d as m}from"./chunk-NABVR6B7.js";function k(o,n={}){let{limit:s=20,scope:i,minFanIn:r=2,minFanOut:a=2,scanLimit:e}=n,u=new b(o);return p(u.productionCallableDefinitions({scope:i,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof e=="number"&&e>0}),e).map(t=>d(o,t,n.semantic!==!1)).filter(t=>t.fanIn>=r&&t.fanOut>=a).sort((t,l)=>l.score-t.score||l.fanIn-t.fanIn).slice(0,s)}function d(o,n,s){let i=new Set(f(o,n,{limit:500,semantic:s}).map(e=>e.file)).size,r=new Set(c(o,n,{limit:500,semantic:s}).filter(e=>e.file!==n.relativePath).map(e=>`${e.symbol}|${e.file}`)).size,a=i*r;return{symbol:n.symbol,shortName:m(n.symbol),fanIn:i,fanOut:r,score:a,definedIn:n.relativePath,actionTier:"signal",riskKind:"coordination-hotspot",evidenceReasons:[`${i} incoming file(s) reference this symbol`,`${r} distinct cross-file callee symbol(s) are reached from it`,`centrality score is ${a} (fan-in * fan-out)`],recommendation:"Review ownership, API stability, and caller groups before changing this central symbol; do not refactor solely from graph centrality."}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DFSEARAU.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-OFXN2BCT.js";import{a as l}from"./chunk-NBNEVLRC.js";import{a as c}from"./chunk-F6IXELII.js";import{d}from"./chunk-NABVR6B7.js";function p(e,t){let o=l(e,t);if(!o)return[];let n=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
WHERE m.symbol_id = ?
|
|
@@ -59,4 +59,4 @@ import{a as r}from"./chunk-7B6LP46R.js";import{a as l}from"./chunk-TK7O5ER5.js";
|
|
|
59
59
|
GROUP BY d.id
|
|
60
60
|
ORDER BY symbol_count DESC
|
|
61
61
|
LIMIT ?`,o).filter(i=>!e.isIgnored(i.relative_path)).map(i=>({name:i.relative_path,count:i.symbol_count}))}export{p as a,b,y as c,I as d};
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-DQ6433ZG.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{SymbolInformation_Kind as t}from"@c4312/scip";var r=new Map(Object.entries(t).filter(([e,n])=>Number.isInteger(Number(e))&&typeof n=="string").map(([e,n])=>[Number(e),n])),i=new Map([...r.entries()].map(([e,n])=>[n.toLowerCase(),e]));function s(e){return r.get(e)??"Unknown"}function u(){return[t.Function,t.Method,t.Macro,t.Constructor,t.Getter,t.Setter,t.StaticMethod,t.SingletonMethod,t.AbstractMethod,t.ProtocolMethod,t.TraitMethod]}function a(){return[t.Class,t.Interface,t.Struct,t.Trait,t.Type,t.TypeAlias,t.Enum,t.Union,t.Protocol]}export{r as a,i as b,s as c,u as d,a as e};
|
|
2
|
+
//# sourceMappingURL=chunk-DVFP6PZI.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as R,b as H,c as h,d as k}from"./chunk-HWVYTJOV.js";import{a as b,b as y}from"./chunk-MNCQPMCH.js";import{a as p,b as g}from"./chunk-ELC77ZDE.js";import{m as v}from"./chunk-SA3DPTHT.js";function j(e,s={}){let{minSimilarity:f=.45,minSharedBehaviors:l=6,limit:t=20,scope:c,scanLimit:n,filePattern:d,focusFiles:m}=s,i=v(e).reactProfiles({scope:c,minBehaviorTokens:Math.max(3,l),scanLimit:n}).map(r=>({file:r.file,component:r.name,tokens:r.behaviorTokens,profile:r})),o=b(i,r=>r.tokens);return y({profiles:i,limit:t,filePattern:d,focusFiles:m,candidateIndex:o,profile:{name:"react-hook-candidates"},compare:(r,a)=>B(r,a,f,l),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.componentA.localeCompare(a.componentA)||r.fileB.localeCompare(a.fileB)||r.componentB.localeCompare(a.componentB)})}function B(e,s,f,l){let t=p(e.tokens,s.tokens);if(t.size<l||!E(t))return null;let c=H(e.tokens,s.tokens);if(c<f)return null;let n=h(t,"hook:"),d=h(t,"react-hook:"),m=h(t,"effect:"),i=h(t,"state:"),o=h(t,"request:"),r=h(t,"handler:"),a=h(t,"handler-verb:"),u=C({sharedHooks:n,sharedReactHooks:d,sharedEffects:m,sharedState:i,sharedRequests:o,sharedHandlers:r,sharedHandlerVerbs:a});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:c,sharedTokens:k(t),sharedHooks:n,sharedReactHooks:d,sharedEffects:m,sharedState:i,sharedRequests:o,sharedHandlers:r,sharedHandlerVerbs:a,evidenceClass:u.evidenceClass,actionTier:u.actionTier,evidenceClassReasons:u.reasons,recommendation:u.recommendation,uniqueToA:k(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:k(g(s.tokens,e.tokens)).slice(0,25),reason:P({sharedHooks:n,sharedReactHooks:d,sharedEffects:m,sharedState:i,sharedRequests:o,sharedHandlers:r,sharedHandlerVerbs:a}),locA:e.profile.loc,locB:s.profile.loc}}function C(e){return R({genericWords:S,stripPrefixes:T,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:A})}function A(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function E(e){let s=0,f=0,l=0,t=0,c=0,n=0,d=0;for(let o of e)o.startsWith("hook:")?s+=1:o.startsWith("react-hook:")?f+=1:o.startsWith("effect:")?l+=1:o.startsWith("request:")?t+=1:o.startsWith("handler:")||o.startsWith("handler-verb:")?c+=1:o.startsWith("state:")?n+=1:o.startsWith("state-hook:")&&(d+=1);let m=n+d,i=s+f+l+t+c+m;return t>=1&&i>=4||s>=1&&(t>=1||n>=1||c>=2)&&i>=5||n>=1&&c>=2&&(l>=1||f>=2)&&i>=5}function P(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}var S=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]),T=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-E3ADDB43.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function g(r,t){let e=new Set;for(let n of r)t.has(n)&&e.add(n);return e}function l(r,t){let e=new Set;for(let n of r)t.has(n)||e.add(n);return e}function S(r,t){if(r.size===0&&t.size===0)return 0;let e=0;for(let i of r)t.has(i)&&(e+=1);let n=r.size+t.size-e;return n===0?0:e/n}function p(r,t){if(r.size===0)return 0;let e=0;for(let n of r)t.has(n)&&(e+=1);return e/r.size}function M(r,t){if(t<=0)return new Map;let e=new Map;for(let[n,i]of r)i>0&&e.set(n,Math.log(t/i));return e}function m(r){let t=[...r.values()].sort((n,i)=>n-i);if(t.length===0)return 0;let e=Math.floor(t.length/2);return t.length%2===0?(t[e-1]+t[e])/2:t[e]}function b(r,t){let e=0;for(let n of r){let i=t.get(n)??0;e+=i*i}return Math.sqrt(e)}function w(r,t,e,n={}){let i=0,T=0,u=0,d=n.medianIdf??m(e),f=[],h=[];for(let s of r){let o=e.get(s)??0;T+=o*o,t.has(s)&&(i+=o*o,o>=d?f.push(s):h.push(s))}if(f.length===0&&h.length===0)return{similarity:0,significantShared:[],trivialShared:[]};for(let s of t){let o=e.get(s)??0;u+=o*o}let a=Math.sqrt(T)*Math.sqrt(u),c=a>0?i/a:0;return f.sort((s,o)=>(e.get(o)??0)-(e.get(s)??0)),{similarity:c,significantShared:f,trivialShared:h}}function y(r,t,e,n){let i=0,T=n.medianIdf??m(e),u=[],d=[];for(let a of r){if(!t.has(a))continue;let c=e.get(a)??0;i+=c*c,c>=T?u.push(a):d.push(a)}if(u.length===0&&d.length===0)return{similarity:0,significantShared:[],trivialShared:[]};let f=n.magnitudeA*n.magnitudeB,h=f>0?i/f:0;return u.sort((a,c)=>(e.get(c)??0)-(e.get(a)??0)),{similarity:h,significantShared:u,trivialShared:d}}export{g as a,l as b,S as c,p as d,M as e,m as f,b as g,w as h,y as i};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-ELC77ZDE.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as f}from"./chunk-RM2WQ75T.js";import{a as L}from"./chunk-NBNEVLRC.js";import{d as i,e as b,f as u,l as c}from"./chunk-NABVR6B7.js";import{d as l}from"./chunk-THB6AM3V.js";import{e as a}from"./chunk-SA3DPTHT.js";function S(o,s){let t=L(o,s);if(!t)return[];let e=new f(o).definitionsForFile(t.relativePath).filter(r=>r.symbol!==t.symbol).filter(r=>c(t.symbol,r.symbol)).sort((r,m)=>r.startLine-m.startLine||r.endLine-m.endLine).map(r=>({symbol:r.symbol,shortName:i(r.symbol),startLine:r.startLine,endLine:r.endLine,kind:u(r.symbol)??"unknown"}));return a(t.relativePath)!=="clojure"?e:d(e,y(o,t))}function y(o,s){let t=b(s.symbol);if(!t)return[];let n=i(s.symbol);return(l(o,s.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({symbol:`${s.symbol}${e.memberName}().`,shortName:`${n}:${e.memberName}()`,startLine:e.startLine,endLine:e.endLine,kind:e.memberKind}))}function d(o,s){let t=new Map;for(let n of[...o,...s])t.set(`${n.shortName}:${n.startLine}:${n.endLine}`,n);return[...t.values()].sort((n,e)=>n.startLine-e.startLine||n.endLine-e.endLine)}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EOLGSSDR.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{b as u}from"./chunk-ULHLDOD6.js";import{l as I}from"./chunk-THB6AM3V.js";import{a as m,c as F,k as _}from"./chunk-SGTKURU6.js";import{a as S}from"./chunk-64MNV6AB.js";import{c as E}from"./chunk-7S5E7KWT.js";var D=_({kind:"file-dependency-graph",serialize:e=>JSON.stringify(e),deserialize:w}),P=E("file-dep-graph",{clearGroups:["whole-project"]});function T(e,r){return P.get(e,r??"",()=>{let t=new Set(S(e,{includeIgnored:!1})),i=0,o=0,n=u("file-dep-graph.source-imports",()=>{let a=C(e,t,r);return i=a.files.length,o=a.edges.length,a},()=>({scope:r??null,files:i,edges:o})),g=F(e),c=g?G(g,n.fingerprint):null,y=!1,p=0,f=0;return u("file-dep-graph.product",()=>{let a=O(r);if(c){let s=D.read(e,a,c);if(s?.sourceImportFingerprint===n.fingerprint){y=!0;let l=b(s);return f=l.size,l}}let d=new Map,h=(s,l)=>M(e,d,t,s,l);u("file-dep-graph.scip-edges",()=>{for(let s of k(e,r))p+=1,h(s.from_file,s.to_file)},()=>({scope:r??null,edges:p}));for(let s of n.edges)h(s.fromFile,s.toFile);return f=d.size,c&&D.write(e,a,c,{sourceImportFingerprint:n.fingerprint,sourceFileCount:n.files.length,sourceEdgeCount:n.edges.length,scipEdgeCount:p,graph:A(d)}),d},()=>({scope:r??null,available:c!==null,hit:y,files:n.files.length,sourceEdges:n.edges.length,scipEdges:p,graphFiles:f,sourceImportFingerprint:n.fingerprint}))})}function C(e,r,t){let i=[],o=[];for(let n of r)if(!(t&&!n.includes(t))){i.push(n);for(let g of I(e,n))g.sourcePath&&o.push({fromFile:n,toFile:g.sourcePath})}return{files:i,edges:o,fingerprint:N(i,o)}}function N(e,r){let t=r.map(i=>`${i.fromFile}\0${i.toFile}`).sort();return m(JSON.stringify({files:e,edges:t}))}function O(e){return e??"<all>"}function G(e,r){return m(JSON.stringify({projectFingerprint:e,sourceImportFingerprint:r}))}function A(e){return[...e].map(([r,t])=>[r,[...t]])}function b(e){return new Map(e.graph.map(([r,t])=>[r,new Set(t)]))}function w(e){let r=JSON.parse(e);return J(r)?r:null}function J(e){if(!e||typeof e!="object")return!1;let r=e;return typeof r.sourceImportFingerprint=="string"&&typeof r.sourceFileCount=="number"&&typeof r.sourceEdgeCount=="number"&&typeof r.scipEdgeCount=="number"&&Array.isArray(r.graph)&&r.graph.every(R)}function R(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(r=>typeof r=="string")}function k(e,r){let t=r?`AND d1.relative_path LIKE '%${r}%'`:"";return e.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
|
+
${e.pathExclusionsFor("d1","d2")}
|
|
19
|
+
${t}`)}function M(e,r,t,i,o){if(i===o||e.isIgnored(i)||e.isIgnored(o)||!t.has(o))return;let n=r.get(i);n||(n=new Set,r.set(i,n)),n.add(o)}export{T as a};
|
|
20
|
+
//# sourceMappingURL=chunk-F6IXELII.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as d,c as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as d,c as m}from"./chunk-WUOB4DHH.js";import{a as B}from"./chunk-F6IXELII.js";function F(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],a=new Set,l=new Set,f=[];function y(t,o){if(o>c)return;if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),g=u.indexOf(u.reduce((x,$)=>x<$?x:$)),p=[...u.slice(g,-1),...u.slice(0,g),u[g]],S=p.join(" -> ");b.has(S)||(b.add(S),i.push({path:p,kind:R(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)y(h,o+1);f.pop(),l.delete(t)}let b=new Set;for(let t of n.keys())a.has(t)||y(t,0);return i.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),i}function R(s){for(let c of s){let n=d(c);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(s.length!==3)return"real";let[e,r]=s;return!e||!r?"real":m(e)||m(r)||C(e,r)||C(r,e)||D(e,r)||D(r,e)||d(e)==="entry"||d(r)==="entry"?"module-hierarchy":"real"}function C(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=e.replace(/\.rs$/,"/");return s.startsWith(r)?!s.slice(r.length).includes("/"):!1}function D(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=s.replace(/\.rs$/,""),c=e.replace(/\.rs$/,"");if(r===c+"_tests"||r===c+"/tests")return!0;let n=s.split("/"),i=e.split("/");if(n.length===i.length&&n.includes("tests")&&i.includes("src")){let a=n[n.length-1],l=i[i.length-1];if(a&&a===l)return!0}return!1}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FMGVZBS2.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p,c as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p,c as u}from"./chunk-SA3DPTHT.js";import{c}from"./chunk-AREANYIA.js";import{d as a}from"./chunk-7S5E7KWT.js";var l=a("suppression-inventory",{clearGroups:["whole-project"]});function b(e){return l.get(e,()=>f(e))}function f(e){let r={dead:0,stale:0,wrapper:0,passthrough:0,drift:0,extract:0,similar:0,uncategorized:0},t=new Map,s=0;for(let o of c(e)){let n=p(e,o);if(!(!n||!n.includes("scip-query")))for(let g of n.split(/\r?\n/)){let i=u(g);if(i===null)continue;s+=1,t.set(o,(t.get(o)??0)+1);let y=d(i);r[y]+=1}}return{total:s,byCategory:r,byFile:t}}function d(e){if(!e)return"uncategorized";let r=e.toLowerCase();return r==="dead-code"?"dead":r}export{b as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FX6ULETZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as S}from"./chunk-HRDSU5FN.js";import{b as d}from"./chunk-WUOB4DHH.js";import{a as h}from"./chunk-F6IXELII.js";import{existsSync as R}from"fs";import{join as $}from"path";function U(t){return C.test(t)}var C=/(?:^|\/)(?:package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Cargo\.lock|CHANGELOG(?:\.[a-z]+)?|.*\.map)$|(?:^|\/)(?:dist|build|out|node_modules|docs\/plans)\//i;function X(t,e,n={}){let{minTogether:s=4,minConfidence:o=.6,limit:a=30,maxFilesPerCommit:l=20}=n,g=S(t),r=g.commitHistory(),c=e!==void 0,p=g.coChangePairs({minTogether:c?Math.min(s,2):s,minConfidence:c?0:o,maxFilesPerCommit:l});if(!r||!p)return{available:!1,commitsAnalyzed:0,findings:[]};let A=h(t),E=x(t),k=L(t,A,E),w=n.includeLinked===!0||c,u=[];for(let i of p){if(C.test(i.fileA)||C.test(i.fileB)||!y(t,i.fileA)||!y(t,i.fileB)||c&&!i.fileA.includes(e)&&!i.fileB.includes(e)||!c&&(d(i.fileA)==="test"||d(i.fileB)==="test"||j(i.fileA,i.fileB)))continue;let m=k(i.fileA,i.fileB);if(!w&&m)continue;let f=v(i.fileA,i.fileB),b=F(i,f,m);if(u.push({...i,structurallyLinked:m,partnerClass:f.partnerClass,partnerClassReasons:f.reasons,...b?{declaredCouplingSuggestion:b}:{}}),u.length>=a)break}return{available:!0,commitsAnalyzed:r.commits.length,findings:u}}function y(t,e){return R($(t.config.projectRoot,e))}function v(t,e){let n=P(t),s=P(e),o=[],a=r=>{o.includes(r)||o.push(r)},l=(r,c)=>n.tags.has(r)&&s.tags.has(c)||n.tags.has(c)&&s.tags.has(r);if(l("doc","code"))return a("one side is documentation and the other is executable source"),{partnerClass:"doc-code",reasons:o};if(n.tags.has("test")||s.tags.has("test"))return a("one side is classified as a test file"),{partnerClass:"test-code",reasons:o};if(l("schema","script"))return a("schema or contract file changes with a script or generated-code path"),{partnerClass:"schema-script",reasons:o};if(l("model","view"))return a("model or state path changes with a view or component path"),{partnerClass:"model-view",reasons:o};if(l("config","code"))return a("configuration file changes with executable source"),{partnerClass:"config-code",reasons:o};let g=q(n.tokens,s.tokens).filter(r=>!G.has(r));return T(t,e)||g.length>=2?(a(T(t,e)?"both files live in the same directory":`files share feature tokens: ${g.slice(0,4).join(", ")}`),{partnerClass:"same-feature",reasons:o}):(a("no specific relationship pattern matched"),{partnerClass:"unknown",reasons:o})}function F(t,e,n){if(n||t.together<4||t.confidence<.75||t.commitScope==="broad-sweep"||t.recency==="stale"||!M.has(e.partnerClass))return;let s=[t.fileA,t.fileB].sort();return{name:`co-change ${e.partnerClass}: ${Z(s)}`,files:s,reason:`${e.partnerClass} pair changed together ${t.together}x with ${Math.round(t.confidence*100)}% confidence; declare it if future edits should require both sides.`}}function L(t,e=h(t),n=x(t)){return(s,o)=>_(e,n,s,o)}function j(t,e){let n=t.lastIndexOf("/"),s=e.lastIndexOf("/");if(t.slice(0,n)!==e.slice(0,s))return!1;let o=t.slice(n+1).split(".")[0],a=e.slice(s+1).split(".")[0];return o!==""&&o===a}function x(t){return(t.config.declaredCouplings??[]).filter(e=>Array.isArray(e.files)&&e.files.length>=2).map(e=>new Set(e.files))}function _(t,e,n,s){return t.get(n)?.has(s)===!0||t.get(s)?.has(n)===!0?!0:e.some(o=>o.has(n)&&o.has(s))}var I=/(?:^|\/)(?:readme|docs?|guides?|adr|architecture|design)(?:\/|$)|\.(?:md|mdx|rst|adoc|txt)$/i,N=/(?:^|\/)(?:\.[a-z0-9-]+rc|config|configs|settings|\.github)(?:\/|$)|(?:^|\/)(?:package\.json|tsconfig(?:\.[^.]+)?\.json|vite\.config\.[cm]?[jt]s|rollup\.config\.[cm]?[jt]s|eslint\.config\.[cm]?[jt]s)$|\.(?:json|ya?ml|toml|ini|env)$/i,D=/(?:^|\/)(?:schemas?|contracts?|migrations?|models?|types?)(?:\/|$)|(?:^|\/)[^/]*(?:schema|contract|migration|model|types?)[^/]*|(?:\.schema)?\.(?:graphql|gql|proto|prisma)$/i,O=/(?:^|\/)(?:scripts?|bin|tools?|tasks?|generators?|codegen|migrations?|seeds?)(?:\/|$)|(?:^|\/)[^/]*(?:generate|codegen|migrate|seed|script)[^/]*\.[cm]?[jt]s$/i,B=/(?:^|\/)(?:models?|entities|domain|state|stores?|reducers?)(?:\/|$)|(?:^|\/)[^/]*(?:model|entity|state|store|reducer|viewmodel)[^/]*\.[^.]+$/i,z=/(?:^|\/)(?:views?|pages?|components?|screens?|routes?|templates?)(?:\/|$)|(?:^|\/)[^/]*(?:view|page|component|screen|template)[^/]*\.[^.]+$|\.(?:vue|svelte|tsx|jsx)$/i,M=new Set(["doc-code","config-code","schema-script","model-view","test-code"]),G=new Set(["src","lib","app","test","tests","spec","index","main","utils","util","types","type","config","docs","doc"]);function P(t){let e=t.replace(/\\/g,"/"),n=new Set;return I.test(e)&&n.add("doc"),N.test(e)&&n.add("config"),D.test(e)&&n.add("schema"),O.test(e)&&n.add("script"),B.test(e)&&n.add("model"),z.test(e)&&n.add("view"),d(e)==="test"&&n.add("test"),!n.has("doc")&&!n.has("config")&&n.add("code"),{tags:n,tokens:H(e)}}function T(t,e){let n=t.lastIndexOf("/"),s=e.lastIndexOf("/"),o=n>=0?t.slice(0,n):"",a=s>=0?e.slice(0,s):"";return o!==""&&o===a}function H(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(e=>e.toLowerCase()).filter(e=>e.length>=2)}function q(t,e){let n=new Set(e);return[...new Set(t.filter(s=>n.has(s)))].sort()}function Z(t){return t.map(e=>e.split("/").pop()?.replace(/\.[^.]+$/,"")||e).join(" + ")}export{U as a,X as b,v as c,F as d,L as e};
|
|
2
|
+
//# sourceMappingURL=chunk-GG5LHT27.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as g}from"./chunk-UVPY3RUZ.js";import{a as m}from"./chunk-RM2WQ75T.js";import{a as d}from"./chunk-BGBBVSH4.js";import{d as u}from"./chunk-NABVR6B7.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GKB4JJDU.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as ie}from"./chunk-N25HPUOK.js";import{a as oe}from"./chunk-FX6ULETZ.js";import{a as ee}from"./chunk-V5FGK3DZ.js";import{a as re}from"./chunk-7IWIMNHI.js";import{a as te}from"./chunk-JNMLBL36.js";import{a as K}from"./chunk-YFQIKYOP.js";import{a as Z}from"./chunk-E3ADDB43.js";import{a as p}from"./chunk-B32FX5KB.js";import{a as Q}from"./chunk-RUV5IY25.js";import{a as Y}from"./chunk-T3AEVJBG.js";import{a as X}from"./chunk-C2QSK7E7.js";import{d as G}from"./chunk-Z2LDWIJV.js";import{a as q}from"./chunk-JJ5SAWBT.js";import{a as j}from"./chunk-ZNWWVYQL.js";import{a as W}from"./chunk-GKB4JJDU.js";import{a as U}from"./chunk-62ULXMQ7.js";import{a as T,b as O}from"./chunk-ROGZXWN2.js";import{b as z}from"./chunk-GG5LHT27.js";import{a as I}from"./chunk-HRDSU5FN.js";import{a as J}from"./chunk-HHOMJCP5.js";import{a as N}from"./chunk-FMGVZBS2.js";import{f as A,g as k}from"./chunk-WUOB4DHH.js";function m(e){return e.scoreCount??e.count}function M(e){let r=Te(e),{breakdown:t,pressure:i}=Me(e),o=ae(t,"risk"),a=ae(t,"hygiene");return{score:Math.min(o,a),riskScore:o,hygieneScore:a,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:m(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:m(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:m(e.wrappers),passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null,hiddenCouplingScoreCount:e.gitEvidence?.hiddenCoupling.scoreCount??null},axes:Ee(e),validation:ke(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function Ee(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:Ae(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function Ae(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:d(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function ke(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),o=0,a=0,n=0;for(let[b,g]of Object.entries(r))i.has(b)?o+=g.fixChanges:(a+=g.fixChanges,n+=1);let u=i.size>0?d(o/i.size):0,h=n>0?d(a/n):0,S={};for(let[b,g]of Object.entries(t)){let f=new Set(g);if(f.size===0)continue;let H=0;for(let L of f)H+=r[L]?.fixChanges??0;let x=d(H/f.size);S[b]={flaggedFiles:f.size,fixDensity:x,lift:h>0?d(x/h):null}}return{flaggedFiles:i.size,flaggedFixDensity:u,baselineFixDensity:h,ratio:i.size>0&&h>0?d(u/h):null,byCategory:S}}function d(e){return Math.round(e*100)/100}function se(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function P(e,r="existing shared infrastructure discount"){let t=m(e);return Math.abs(t-e.count)<.01?"":` (${se(t)} score-weighted after ${r})`}function v(e,r){let t=m(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${se(t)} score-weighted)`}function Te(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 extract or reuse the shared UI concept`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${P(e.reactHookCandidates)} \u2014 extract or reuse a hook`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 extract or reuse the shared UI concept`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${P(e.vueComposableCandidates)} \u2014 extract or reuse a composable`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 review same-file or feature-local extraction seams`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols${P(e.wrappers,"boundary-evidence discount")} \u2014 inline direct wrappers or review boundary signals`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let o=[];e.stale.unused>0&&o.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&o.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${o.join(", ")} \u2014 remove unused abstractions; review single-consumer ownership before moving or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let o=[];e.drift.unusedImports>0&&o.push(`${e.drift.unusedImports} unused imports`),e.drift.layerViolations>0&&o.push(`${e.drift.layerViolations} layer violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${o.join(", ")} \u2014 remove direct drift; review signal drift against layer ownership`,effort:e.drift.layerViolations>0?"medium":"low",impact:e.drift.layerViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let o=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+P({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(o?` (e.g. ${o.fileA} \u2194 ${o.fileB})`:"")+" \u2014 name the shared concept or enforce the sync",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((o,a)=>{let n=t[o.impact]*i[o.effort];return t[a.impact]*i[a.effort]-n}),r}var ne={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function ae(e,r){let t=e.filter(i=>i.kind===r).reduce((i,o)=>i+o.points,0);return Math.max(0,Math.min(100,100-t))}function Me(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],a=(l,y,C)=>{y>0&&i.push({axis:l,points:y,detail:C,kind:ne[l]??"hygiene"})},n=(l,y,C,ye,we,Pe,Re)=>{let w=Math.max(ye,1);if(C<=w)return;let D=C/w,E=Math.min(we,Math.ceil(Math.log2(D)*Pe));if(E<=0)return;let De=ne[l]??"hygiene";o.push({axis:l,category:y,kind:De,count:C,threshold:d(w),ratio:d(D),extraPenalty:E}),a(l,E,`${C} ${Re} exceed pressure threshold ${d(w)} (${d(D)}x)`)},u=e.dead.count/t;a("dead-code",Math.min(20,Math.round(u*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let h=e.isolated.count/t;a("isolated",Math.min(10,Math.round(h*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),a("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let S=e.similarCount/t*1e3;a("similar",Math.min(10,Math.round(S)),`${e.similarCount} similar function pair(s)`);let b=e.reactComponentDuplicates.count/r*1e3;a("react-component-duplicates",Math.min(10,Math.round(b)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let g=m(e.reactHookCandidates),f=g/r*1e3;a("react-hook-candidates",Math.min(10,Math.round(f)),v(e.reactHookCandidates,"duplicated React behavior pair(s)"));let H=e.reactLargeComponentPressure.count/r*1e3;a("react-large-component-pressure",Math.min(5,Math.round(H/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let x=e.vueComponentDuplicates.count/r*1e3;a("vue-component-duplicates",Math.min(10,Math.round(x)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let L=m(e.vueComposableCandidates),He=L/r*1e3;a("vue-composable-candidates",Math.min(10,Math.round(He)),v(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let xe=e.vueLargeViewPressure.count/r*1e3;a("vue-large-view-pressure",Math.min(5,Math.round(xe/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let _=m(e.wrappers);a("wrappers",Math.min(3,_),v(e.wrappers,"wrapper candidate(s)"));let F=m(e.passthroughs);a("passthroughs",Math.min(3,F),v(e.passthroughs,"passthrough candidate(s)")),a("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let Le=e.drift.direct/r;if(a("drift",Math.min(5,Math.round(Le*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),a("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let l=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling",Math.min(5,Math.ceil(l/10)),v({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:l},"co-changing pair(s) without a structural link"))}if(n("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),n("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let l=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling-pressure","Hidden coupling",l,50,10,4,"score-weighted co-changing pair(s)")}return n("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),n("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),n("react-hook-candidates-pressure","Duplicated React hook behavior",g,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),n("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),n("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),n("vue-composable-candidates-pressure","Duplicated Vue behavior",L,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),n("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),n("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),n("wrappers-pressure","Wrapper functions",_,50,4,2,"wrapper candidate(s)"),n("passthroughs-pressure","Passthrough functions",F,50,4,2,"passthrough candidate(s)"),n("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),n("drift-pressure","Structural drift signals",e.drift.signal,Math.max(10,r*.1),4,2,"signal drift finding(s)"),{breakdown:i,pressure:o}}import{getHeapStatistics as Be}from"v8";var Ve=64*1024*1024;function B(){let e=globalThis.gc;if(!e)return;let r=Be();r.heap_size_limit-r.used_heap_size<Ve||e()}var $e=50,_e=25e3,Fe=2500,ce=2500,ue=50,Ie=10,ze=["overview","dead","isolated","cycles","similar","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions"],pe={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:Ue(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:We(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:qe(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:je(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:Ye(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Xe(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:Qe(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Je(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Ke(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:Ze(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Ge(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:et(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:tt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:rt(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:nt(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:at(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:it(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:ot(e,t)})};function qt(e,r={}){return me(e,r.full!==!1,(t,i)=>{let o=Oe(e,r.scope,t,i);return M(o)})}function jt(e,r,t={}){return Ne(e,[r],t)[0]}function Ne(e,r,t={}){return me(e,t.full!==!1,(i,o)=>{let a={...o,releaseCachesBetweenPhases:!1};return r.map(n=>pe[n](e,t.scope,a,i))})}function me(e,r,t){let i=X(e),o=st(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),B()}}function Gt(e){return M(he(e))}function he(e){let r=c(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,dead:c(e,"dead").dead,isolated:c(e,"isolated").isolated,realCycleCount:c(e,"cycles").realCycleCount,similarCount:c(e,"similar").similarCount,reactComponentDuplicates:c(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:c(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:c(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:c(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:c(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:c(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:c(e,"extract-candidates").extractCount,wrappers:c(e,"wrapper-candidates").wrappers,passthroughs:c(e,"passthrough-candidates").passthroughs,stale:c(e,"stale-abstractions").stale,drift:c(e,"drift").drift,complexity:c(e,"complexity-hotspots").complexity,gitEvidence:le(e,"git-evidence")?.gitEvidence??null,suppressions:le(e,"suppressions")?.suppressions??null}}function le(e,r){return e.find(t=>t.phase===r)}function c(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function Oe(e,r,t,i){return he(ze.map(o=>pe[o](e,r,i,t)))}function Ue(e,r,t){return s(e,t,"dead",()=>{let i=O(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit});return R(lt(e,i.symbols))})}function We(e,r,t){return s(e,t,"isolated",()=>{let i=q(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit});return R(dt(e,i))})}function qe(e,r,t){return s(e,t,"cycles",()=>N(e,{scope:r}).filter(o=>o.kind==="real").length)}function je(e,r,t){let i=s(e,t,"similar",()=>G(e,{scope:r,...p.similar,scanLimit:t.candidateScanLimit}));return Math.min(i,t.candidateResultLimit)}function Ge(e,r,t){return s(e,t,"extract-candidates",()=>W(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function Ye(e,r,t){return s(e,t,"react-component-duplicates",()=>{let i=K(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Xe(e,r,t){return s(e,t,"react-hook-candidates",()=>{let i=Z(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,mt)})}function Qe(e,r,t){return s(e,t,"react-large-component-pressure",()=>{let i=ee(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return pt(i)})}function Je(e,r,t){return s(e,t,"vue-component-duplicates",()=>{let i=te(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Ke(e,r,t){return s(e,t,"vue-composable-candidates",()=>{let i=re(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,ht)})}function Ze(e,r,t){return s(e,t,"vue-large-view-pressure",()=>{let i=ie(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return R(i)})}function et(e,r,t){return s(e,t,"wrapper-candidates",()=>{let i=Q(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return ge(i,gt)})}function tt(e,r,t){return s(e,t,"passthrough-candidates",()=>{let i=j(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return ge(i,ft)})}function rt(e,r,t){return s(e,t,"stale-abstractions",()=>{let i=Y(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=i.filter(a=>a.consumers===0).length;return{count:i.length,loc:i.reduce((a,n)=>a+n.loc,0),files:[...new Set(i.map(a=>a.file))],unused:o,singleUse:i.length-o}})}function it(e,r){return s(e,r,"git-evidence",()=>{let t=I(e),i=t.fileChurn();if(!i)return null;let o=z(e,void 0,{limit:r.candidateResultLimit}),a={};for(let[n,u]of i)a[n]={changes:u.changes,fixChanges:u.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:o.findings.length,scoreCount:$(o.findings.reduce((n,u)=>n+de(u),0)),top:o.findings.slice(0,5).map(n=>({fileA:n.fileA,fileB:n.fileB,together:n.together,confidence:n.confidence,focusedTogether:n.focusedTogether,broadTogether:n.broadTogether,broadCommitRatio:n.broadCommitRatio,lastTogetherAt:n.lastTogetherAt,recentTogether:n.recentTogether,commitScope:n.commitScope,recency:n.recency,scoreWeight:de(n),subjectContext:n.subjectContext}))},fileStats:a}})}function ot(e,r){return s(e,r,"suppressions",()=>{let t=oe(e);return{total:t.total,byCategory:{...t.byCategory}}})}function nt(e,r,t){return s(e,t,"drift",()=>{let i=U(e,{scope:r,...p.drift,includePatternDeviations:!1}),o=i.results.filter(u=>u.kind!=="pattern-deviation"),a=o.filter(u=>u.actionTier==="direct").length,n=o.length-a;return{count:o.length,unusedImports:i.unusedImports,layerViolations:i.layerViolations,direct:a,signal:n}})}function at(e,r,t){return s(e,t,"complexity-hotspots",()=>{let i=J(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:!1});return{top:i.slice(0,5).map(o=>({symbol:o.shortName,score:o.score,file:o.file})),extremeCount:i.filter(o=>o.score>$e).length}})}function st(e,r){let t=e.symbols>=_e||e.documents>=Fe,i=r?Number.POSITIVE_INFINITY:ue,o=r?Number.POSITIVE_INFINITY:Ie;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:o,releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because full mode is enabled."]:[]}:{candidateScanLimit:ce,candidateResultLimit:i,complexityResultLimit:o,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${ce} symbols and reported their top ${ue} findings. Enable full mode for unbounded candidate counts.`]}}function ct(e,r){r.releaseCachesBetweenPhases&&(T(e),B())}function s(e,r,t,i){ut(t);try{return i()}finally{ct(e,r)}}function ut(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function lt(e,r){return r.filter(t=>!A(e,t.relativePath)&&!k(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function dt(e,r){return r.filter(t=>!A(e,t.relativePath)&&!k(e,t.symbol,t.relativePath))}function R(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function ge(e,r){return{...R(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function pt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function V(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function fe(e,r){return{...V(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function mt(e){let r=e.sharedHooks.length>0,t=Ce({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:be(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function ht(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=Ce({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:be(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function Ce(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Se.has(ve(r))).length+Math.min(e.functions.length,3)}function be(e,r,t){let i=[...e,...r,...t].map(ve);return i.length>0&&i.every(o=>Se.has(o))}function ve(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function gt(e){return e.actionTier==="signal"?.25:1}function ft(e){return e.actionTier==="signal"?.25:1}function de(e){return e.commitScope==="broad-sweep"?e.recency==="recent"?.25:0:e.commitScope==="mixed"?e.recency==="recent"?.5:.25:e.recency==="recent"?1:.5}function $(e){return Math.round(e*100)/100}var Se=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{ze as a,qt as b,jt as c,Ne as d,Gt as e};
|
|
2
|
+
//# sourceMappingURL=chunk-H7JF2CKK.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as y}from"./chunk-UVPY3RUZ.js";import{a as g}from"./chunk-RM2WQ75T.js";import{d as p}from"./chunk-NABVR6B7.js";import{d as m}from"./chunk-THB6AM3V.js";function C(e,n){let{scope:o,minLoc:l=10,limit:i=30,scanLimit:t}=n??{},r=new g(e);return y({candidates:()=>r.productionCallableDefinitions({scope:o,minLoc:l,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof t=="number"&&t>0}),scanLimit:t,profile:{name:"complexity-hotspots"},prepare:a=>{let s=f(e,a);return{callerMap:r.crossFileCallerMap(a,{semantic:n?.semantic!==!1}),calleeMap:r.calleeMap(a,{semantic:n?.semantic!==!1}),languageByFile:s,clojureCallableIds:h(e,a,s)}},evaluate:(a,s)=>d(a,s,l),orderResults:(a,s)=>s.score-a.score||s.loc-a.loc,limit:i})}function d(e,n,o){if(n.languageByFile.get(e.relativePath)==="clojure"&&!n.clojureCallableIds.has(e.symbolId))return null;let l=e.endLine-e.startLine+1;if(l<o)return null;let i=n.callerMap.get(e.symbolId)?.size??0,t=n.calleeMap.get(e.symbolId)??[],r=new Set,a=new Set;for(let c of t){let u=`${c.symbol}|${c.file}`;r.add(u),c.file!==e.relativePath&&a.add(u)}let s=a.size,b=r.size;return{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:l,fanIn:i,fanOut:s,calleeCount:b,score:Math.round(l/50*(i/5)*Math.max(s/5,1)*100)/100}}function f(e,n){let o=[...new Set(n.map(t=>t.relativePath))];if(o.length===0)return new Map;let l=o.map(()=>"?").join(", "),i=e.all(`SELECT relative_path, language
|
|
2
|
+
FROM documents
|
|
3
|
+
WHERE relative_path IN (${l})`,...o);return new Map(i.map(t=>[t.relative_path,t.language?.toLowerCase()??null]))}function h(e,n,o){let l=new Set,i=new Map;for(let t of n){if(o.get(t.relativePath)!=="clojure")continue;let r=i.get(t.relativePath);r||(r=new Set((m(e,t.relativePath)?.callables??[]).map(a=>`${a.name}:${a.startLine}`)),i.set(t.relativePath,r)),r.has(`${t.leaf}:${t.startLine}`)&&l.add(t.symbolId)}return l}export{C as a};
|
|
4
|
+
//# sourceMappingURL=chunk-HHOMJCP5.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{j as D}from"./chunk-SGTKURU6.js";import{d as F}from"./chunk-7S5E7KWT.js";import{execFileSync as N}from"child_process";var x=2e3,S=50,B=64,I=8,$=3,U=2160*60*60,K=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,J=3,V=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,W=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function R(e){let t=F(e,{clearGroups:["whole-project"]});return(n,i)=>{let r=P(n.config.projectRoot);if(!r)return null;let o=t.has(n)?t.get(n,()=>({head:"",value:null})):null;return o&&o.head===r?o.value:(t.invalidate(n),t.get(n,()=>({head:r,value:i(n.config.projectRoot,r)})).value)}}function _(e){let t=F(e,{clearGroups:["whole-project"]});return(n,i,r)=>{let o=P(n.config.projectRoot);if(!o)return null;let s=t.has(n)?t.get(n,()=>({head:"",values:new Map})):null;(!s||s.head!==o)&&t.invalidate(n);let l=t.get(n,()=>({head:o,values:new Map}));if(l.values.has(i))return l.values.get(i)??null;let u=r(n.config.projectRoot,o);return l.values.set(i,u),u}}var X=R("git-commit-history");function Re(e){return{capability:t=>Y(e,t),commitHistory:()=>A(e),fileChurn:()=>Q(e),changeAmplification:()=>ee(e),trackedFiles:()=>ne(e),fileAddRecords:()=>re(e),coChangePairs:(t={})=>ue(e,t),coChangePairsForFiles:(t,n={})=>G(e,t,n),directionalCoChangePairsForFiles:(t,n={})=>me(e,t,n)}}function A(e){return X(e,Z)}function Y(e,t){let n=P(e.config.projectRoot);return n?{slot:t,available:!0,head:n}:{slot:t,available:!1,head:null,reason:"git history is unavailable for this project"}}function P(e){try{return C(e,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(e,t){return N("git",["-C",e,...t],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"]})}function Z(e,t){let n;try{n=C(e,["log","--no-merges","--name-only","-n",String(x),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}return{head:t,...E(n,S)}}function q(e){return K.test(e.subject)}function Q(e){let t=A(e);if(!t)return null;let n=new Map;for(let i of t.commits){let r=q(i);for(let o of i.files){let s=n.get(o)??{changes:0,fixChanges:0,lastChangedAt:0};s.changes+=1,r&&(s.fixChanges+=1),i.timestamp>s.lastChangedAt&&(s.lastChangedAt=i.timestamp),n.set(o,s)}}return n}function ee(e){let t=A(e);if(!t||t.commits.length===0)return null;let n=t.commits.map(i=>i.files.length).filter(i=>i>0).sort((i,r)=>i-r);return n.length===0?null:{medianFilesPerCommit:v(n,.5),p90FilesPerCommit:v(n,.9),commitsAnalyzed:n.length}}function v(e,t){let n=Math.min(e.length-1,Math.floor(e.length*t));return e[n]}var te=R("git-tracked-files");function ne(e){return te(e,t=>{try{let n=C(t,["ls-files"]);return new Set(n.split(`
|
|
2
|
+
`).map(i=>i.trim()).filter(i=>i!==""))}catch{return null}})}var ie=R("git-file-adds"),k="__git__/file-adds",O=D({kind:"git-file-adds",serialize:se,deserialize:ae});function re(e){return ie(e,(t,n)=>oe(e,t,n))}function oe(e,t,n){let i=O.read(e,k,n);if(i)return i;let r=ce(t);return r&&O.write(e,k,n,r),r}function se(e){return JSON.stringify([...e.entries()])}function ae(e){if(!e)return null;try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=new Map;for(let i of t){if(!Array.isArray(i)||i.length!==2||typeof i[0]!="string")return null;let r=i[1];if(!r||typeof r.commitsAgo!="number"||!Number.isFinite(r.commitsAgo)||typeof r.addedAt!="number"||!Number.isFinite(r.addedAt))return null;n.set(i[0],{commitsAgo:r.commitsAgo,addedAt:r.addedAt})}return n}catch{return null}}function ce(e){let t;try{t=C(e,["log","--no-merges","--diff-filter=A","--name-only","-n",String(x),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let n=new Map,i=-1;for(let r of t.split("")){if(r.trim()==="")continue;i+=1;let o=r.indexOf(`
|
|
3
|
+
`),s=o>=0?r.slice(0,o):r,[,l]=s.split("\0"),u=Number(l)||0;if(!(o<0))for(let d of r.slice(o+1).split(`
|
|
4
|
+
`)){let h=d.trim();h!==""&&n.set(h,{commitsAgo:i,addedAt:u})}}return n}var M=_("git-co-change-pairs"),le=_("git-directional-co-change-pairs");function ue(e,t){let n=`all\0${T(t)}`,i=M(e,n,()=>{let r=A(e);return r?w(r,t):null});return i&&[...i]}function G(e,t,n){if(t.size===0)return[];let i=`files\0${j(t)}\0${T(n)}`,r=M(e,i,()=>{let o=A(e);return o?w(o,n,t):null});return r&&[...r]}function me(e,t,n){if(t.size===0)return[];let i=n.maxFilesPerCommit??S;if(t.size>B)return G(e,t,n);let r=`directional\0${j(t)}\0${T({...n,maxFilesPerCommit:i})}`,o=le(e,r,(s,l)=>{let u=ge(s,l,t,i);return u?w(u,n,t):null});return o&&[...o]}function T(e){let t=e.minTogether??4,n=e.minConfidence??.6,i=e.maxFilesPerCommit??S;return`${t}\0${n}\0${i}`}function j(e){return[...e].sort().join("\0")}function w(e,t,n){let{minTogether:i=4,minConfidence:r=.6,maxFilesPerCommit:o=S}=t,s=new Map,l=new Map,u=e.newestAnalyzedAt??0;for(let a of e.commits){let c=[...new Set(a.files)].sort();if(c.length>o)continue;e.newestAnalyzedAt===void 0&&a.timestamp>u&&(u=a.timestamp);let f=he(c),y=n===void 0||c.some(m=>n.has(m));for(let m of c)s.set(m,(s.get(m)??0)+1);if(y)for(let m=0;m<c.length;m++)for(let p=m+1;p<c.length;p++){if(n&&!n.has(c[m])&&!n.has(c[p]))continue;let b=`${c[m]}\0${c[p]}`,g=l.get(b)??{together:0,focusedTogether:0,broadTogether:0,lastTogetherAt:0,timestamps:[],subjects:[]};g.together+=1,f?g.broadTogether+=1:g.focusedTogether+=1,a.timestamp>g.lastTogetherAt&&(g.lastTogetherAt=a.timestamp),g.timestamps.push(a.timestamp),g.subjects.push(a.subject),l.set(b,g)}}let d=[],h=u-U;for(let[a,c]of l){let f=c.together;if(f<i)continue;let[y,m]=a.split("\0"),p=s.get(y)??f,b=s.get(m)??f,g=Math.max(f/p,f/b);if(g<r)continue;let z=c.broadTogether/f,H=c.timestamps.filter(L=>L>=h).length;d.push({fileA:y,fileB:m,together:f,confidence:g,changesA:p,changesB:b,focusedTogether:c.focusedTogether,broadTogether:c.broadTogether,broadCommitRatio:z,lastTogetherAt:c.lastTogetherAt,recentTogether:H,commitScope:pe(c.broadTogether,f),recency:H>0?"recent":"stale",subjectContext:be(c.subjects)})}return d.sort((a,c)=>c.together-a.together||c.confidence-a.confidence||a.fileA.localeCompare(c.fileA)),d}function ge(e,t,n,i){let r;try{r=de(e)}catch{return null}if(r.length===0)return{head:t,commits:[],skippedBulkCommits:0,newestAnalyzedAt:0};let o;try{o=C(e,["log","--no-merges","--format=%H","-n",String(x),"--",...[...n].sort()])}catch{return null}let s=new Set(r.map(a=>a.hash)),l=o.split(`
|
|
5
|
+
`).map(a=>a.trim()).filter(a=>a!==""&&s.has(a)),u=fe(e,r,i);if(l.length===0)return{head:t,commits:[],skippedBulkCommits:0,newestAnalyzedAt:u};let d;try{d=C(e,["show","--no-walk=unsorted","--name-only","--pretty=format:%x01%H%x00%ct%x00%s",...l])}catch{return null}let h=E(d,i);return{head:t,...h,newestAnalyzedAt:u}}function de(e){return C(e,["log","--no-merges","--format=%H%x00%ct","-n",String(x)]).split(`
|
|
6
|
+
`).map(n=>n.trim()).filter(n=>n!=="").map(n=>{let[i,r]=n.split("\0");return{hash:i??"",timestamp:Number(r)||0}}).filter(n=>n.hash!=="")}function fe(e,t,n){for(let r=0;r<t.length;r+=20){let o=t.slice(r,r+20),s;try{s=C(e,["show","--no-walk=unsorted","--name-only","--pretty=format:%x01%H%x00%ct%x00%s",...o.map(u=>u.hash)])}catch{return t[0]?.timestamp??0}let l=E(s,n);if(l.commits.length>0)return l.commits[0].timestamp}return 0}function E(e,t){let n=[],i=0;for(let r of e.split("")){if(r.trim()==="")continue;let o=r.indexOf(`
|
|
7
|
+
`),s=o>=0?r.slice(0,o):r,[l,u,d]=s.split("\0");if(!l||!u)continue;let h=o>=0?r.slice(o+1).split(`
|
|
8
|
+
`).map(a=>a.trim()).filter(a=>a!==""):[];if(h.length>t){i+=1;continue}n.push({hash:l,timestamp:Number(u)||0,subject:d??"",files:h})}return{commits:n,skippedBulkCommits:i}}function he(e){return e.length>=I?!0:Ce(e).size>=$}function Ce(e){let t=new Set;for(let n of e){let i=n.indexOf("/");t.add(i>=0?n.slice(0,i):".")}return t}function pe(e,t){return e===0?"focused":e/t>=.5?"broad-sweep":"mixed"}function be(e){let t=new Set,n=[],i=[];for(let r of e){!i.includes(r)&&i.length<J&&i.push(r);for(let o of Ae(r))t.add(o);for(let o of r.match(V)??[])n.includes(o)||n.push(o)}return{subjectLabels:[...t].sort(),issueRefs:n,sampleSubjects:i,externalIssueLabelStatus:"unavailable"}}function Ae(e){let t=new Set,n=W.exec(e)?.[1]?.toLowerCase();return n&&t.add(ye(n)),/\b(?:feat|feature)\b/i.test(e)&&t.add("feature"),/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i.test(e)&&t.add("fix"),/\b(?:docs?|documentation|guide|readme)\b/i.test(e)&&t.add("docs"),/\brefactor(?:ing|ed)?\b/i.test(e)&&t.add("refactor"),/\btests?\b/i.test(e)&&t.add("test"),/\b(?:release|version|v\d+\.\d+)\b/i.test(e)&&t.add("release"),/\bchore\b/i.test(e)&&t.add("chore"),/\bbuild\b/i.test(e)&&t.add("build"),/\bci\b/i.test(e)&&t.add("ci"),/\bperf(?:ormance)?\b/i.test(e)&&t.add("perf"),[...t]}function ye(e){return e==="feat"?"feature":e}export{Re as a};
|
|
9
|
+
//# sourceMappingURL=chunk-HRDSU5FN.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l,c as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as l,c as g}from"./chunk-ELC77ZDE.js";function v(e){let n=[],r=[],i=[];for(let o of e.primitiveGroups)o.values.length!==0&&h(o.bucket,r,i).push(`${o.reasonPrefix}: ${o.values.join(", ")}`);for(let o of e.nameGroups)u(o.names,o.label,e.genericWords,e.stripPrefixes??[],n,h(o.fallbackBucket,r,i));let c=n.length>0,d=r.length>0,s=i.length>0,t=c?d||s?"mixed":"domain-behavior":s?"shared-abstraction":"generic-workflow-scaffolding";return{actionTier:t==="domain-behavior"||t==="mixed"?"signal":"support",evidenceClass:t,reasons:[...n,...i,...r].slice(0,6),recommendation:e.recommendation(t)}}function x(e,n){if(e.size===0||n.size===0)return 0;let i=l(e,n).size/Math.min(e.size,n.size);return Math.max(g(e,n),i)}function y(e,n){return[...e].filter(r=>r.startsWith(n)).map(r=>r.slice(n.length)).sort()}function b(e){return[...e].sort()}function u(e,n,r,i,c,d){let s=[],t=[];for(let a of e)m(a,i).filter(f=>!r.has(f)).length>0?s.push(a):t.push(a);s.length&&c.push(`${n} has domain term(s): ${s.slice(0,6).join(", ")}`),t.length&&d.push(`${n} is generic workflow: ${t.slice(0,6).join(", ")}`)}function m(e,n){let r=e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2");for(let i of n)r=r.replace(i,"");return r.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function h(e,n,r){return e==="generic"?n:r}export{v as a,x as b,y as c,b as d};
|
|
2
|
+
//# sourceMappingURL=chunk-HWVYTJOV.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as k}from"./chunk-B75HZHUP.js";import{a as g}from"./chunk-RM2WQ75T.js";import{b as S}from"./chunk-WUOB4DHH.js";import{a as n}from"./chunk-BGBBVSH4.js";import{e as v}from"./chunk-CYHIKTJN.js";import{b as a}from"./chunk-ULHLDOD6.js";import{d as L}from"./chunk-NABVR6B7.js";function q(u,b={}){let{scope:P,minLoc:x=3,scanLimit:c}=b,t=new g(u),f=b.semantic!==!1,y=0,d=a("isolated.candidates",()=>{let e=k(t.productionCallableDefinitions({scope:P,minLoc:x,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:typeof c=="number"&&c>0}),c);return y=e.length,e},()=>({definitions:y})),p=0,o=a("isolated.strict-callees",()=>{let e=t.symbolsWithNonSelfCallees(d,{additive:!1,semantic:!1});return p=e.size,e},()=>({definitions:d.length,symbols:p})),r=d.filter(e=>!o.has(e.symbolId)),h=0,N=a("isolated.scip-callers",()=>{let e=t.crossFileCallerMap(r,{semantic:!1});return h=e.size,e},()=>({definitions:r.length,symbols:h})),l=new Set(N.keys());for(let e of t.frameworkReferencedSymbolIds(r))l.add(e);let s=r.filter(e=>!l.has(e.symbolId));if(f&&s.length>0){for(let e of v(u,s).keys())l.add(e);for(let e of t.symbolsWithNonSelfCallees(s,{additive:!1,semantic:!0}))o.add(e);s=s.filter(e=>!l.has(e.symbolId)).filter(e=>!o.has(e.symbolId))}let C=0,W=a("isolated.source-fallback-callers",()=>{let e=t.sourceFallbackCallerFiles(s,{skipPath:i=>S(i)==="test"});return C=e.size,e},()=>({definitions:s.length,symbols:C}));for(let e of W.keys())l.add(e);let m=s.filter(e=>!l.has(e.symbolId)),I=0,F=a("isolated.additive-callees",()=>{let e=t.symbolsWithNonSelfCallees(m,{additive:!0,semantic:f});return I=e.size,e},()=>({definitions:m.length,symbols:I}));for(let e of F)o.add(e);return m.filter(e=>!o.has(e.symbolId)).sort((e,i)=>n(i)-n(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:L(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:n(e)}))}export{q as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JJ5SAWBT.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as r,d as a}from"./chunk-HWVYTJOV.js";import{a as d,b as h}from"./chunk-MNCQPMCH.js";import{a as f,b as m,c as p}from"./chunk-ELC77ZDE.js";import{m as c}from"./chunk-SA3DPTHT.js";function A(n,i={}){let{minSimilarity:t=.62,minTokens:e=8,limit:l=20,scope:k,scanLimit:P,filePattern:g,focusFiles:v}=i,u=T(n,{scope:k,minTokens:e,scanLimit:P}),C=d(u,o=>o.tokens);return h({profiles:u,limit:l,filePattern:g,focusFiles:v,candidateIndex:C,profile:{name:"vue-component-duplicates"},compare:(o,s)=>y(o,s,t),sort:(o,s)=>s.similarity-o.similarity||o.fileA.localeCompare(s.fileA)||o.fileB.localeCompare(s.fileB)})}function T(n,i){return c(n).vueProfiles({scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(t=>({file:t.file,tokens:t.templateTokens,loc:b(t)}))}function b(n){return n.totalLines}function y(n,i,t){let e=f(n.tokens,i.tokens);if(e.size<6||!V(e))return null;let l=p(n.tokens,i.tokens);return l<t?null:{fileA:n.file,fileB:i.file,similarity:l,sharedTokens:a(e),sharedComponents:r(e,"component:"),sharedProps:r(e,"prop:"),sharedEvents:r(e,"event:"),sharedDirectives:r(e,"directive:"),sharedSlots:r(e,"slot:"),sharedIdentifiers:r(e,"id:"),uniqueToA:a(m(n.tokens,i.tokens)).slice(0,25),uniqueToB:a(m(i.tokens,n.tokens)).slice(0,25),locA:n.loc,locB:i.loc}}function V(n){let i=0,t=0;for(let e of n)e.startsWith("component:")&&(i+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("directive:")||e.startsWith("slot:"))&&(t+=1);return i>=1||t>=3}export{A as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JNMLBL36.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as f}from"./chunk-RM2WQ75T.js";import{a as h}from"./chunk-NBNEVLRC.js";import{e as s,g as u}from"./chunk-NABVR6B7.js";import{d}from"./chunk-THB6AM3V.js";import{e as c}from"./chunk-SA3DPTHT.js";import{basename as p}from"path";function N(r,o){let t=h(r,o);if(!t)return[];let e=s(t.symbol),a=new f(r).definitionsForFile(t.relativePath).filter(n=>u(n.symbol)),l=a.filter(n=>n.parentTypeName===e||n.symbol.includes(e)),m=(l.length>0?l:L(p(t.relativePath))===e?a.filter(n=>n.symbol.includes("<invalid-global-code>")):[]).map(n=>({startLine:n.startLine,endLine:n.endLine,name:s(n.symbol)}));return c(t.relativePath)!=="clojure"?m:b(m,M(r,t))}function L(r){return r.replace(/\.[^.]+$/,"")}function M(r,o){let t=s(o.symbol);return t?(d(r,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function b(r,o){let t=new Map;for(let e of[...r,...o])t.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...t.values()].sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine)}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JS6B76AQ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-OFXN2BCT.js";import{a as d}from"./chunk-RM2WQ75T.js";import{e as c}from"./chunk-CYHIKTJN.js";import{d as u}from"./chunk-NABVR6B7.js";function L(e,n,i={}){let t=f(e,n);if(!t)return null;let r=h(e,t);if(!r||e.isIgnored(r.relative_path))return null;let s=[],m=0,l=g(e,r.relative_path),p=i.semantic===!1?new Map:c(e,l);for(let o of l){let a=S(e,r,o,p.get(o.symbolId)??new Set);m+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:b(a)})}return{file:r.relative_path,symbols:s,totalExternalConsumers:m}}function h(e,n){return e.get(`SELECT id, relative_path FROM documents
|
|
2
2
|
WHERE relative_path = ?
|
|
3
3
|
${e.pathExclusionsFor("documents")}
|
|
4
4
|
LIMIT 1`,n)??null}function g(e,n){return new d(e).definitionsForFile(n).sort((i,t)=>i.startLine-t.startLine||i.endLine-t.endLine)}function S(e,n,i,t){let r=e.all(`SELECT DISTINCT consumer_d.relative_path
|
|
@@ -8,4 +8,4 @@ import{a as f}from"./chunk-7B6LP46R.js";import{a as d}from"./chunk-5OST6GYB.js";
|
|
|
8
8
|
WHERE m.symbol_id = ?
|
|
9
9
|
AND m.role != 1
|
|
10
10
|
AND c.document_id != ?`,i.symbolId,n.id);return new Set([...r.map(s=>s.relative_path),...[...t].filter(s=>s!==n.relative_path)]).size}function b(e){return e>10?"high":e>0?"medium":"low"}export{L as a};
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-KZ4MG5NY.js.map
|