scip-query 0.10.8 → 0.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/chunk-2KHTSEIL.js +102 -0
- package/dist/chunk-3VD3JMK2.js +2 -0
- package/dist/{chunk-MEKSFV6H.js → chunk-4UZO3XCV.js} +2 -2
- package/dist/{chunk-BJWNO6BU.js → chunk-54KGX7EX.js} +2 -2
- package/dist/chunk-5GOLFJEO.js +8 -0
- package/dist/chunk-5OST6GYB.js +2 -0
- package/dist/{chunk-C6BYNIH4.js → chunk-65AU3HFZ.js} +2 -2
- package/dist/{chunk-E2CCBFLR.js → chunk-6GN7FXCH.js} +2 -2
- package/dist/{chunk-RHKMQNFI.js → chunk-6IR2AOBM.js} +2 -2
- package/dist/{chunk-6EO3E3IP.js → chunk-6JRV4MY2.js} +2 -2
- package/dist/{chunk-5SMUKUV5.js → chunk-6LJHXREW.js} +2 -2
- package/dist/chunk-6QSOCTZT.js +18 -0
- package/dist/{chunk-6TDOT7B3.js → chunk-72KY2ZFO.js} +2 -2
- package/dist/{chunk-LGX2Y4BA.js → chunk-7B6LP46R.js} +2 -2
- package/dist/chunk-7GO4EQF5.js +2 -0
- package/dist/chunk-7IVSJJZU.js +7 -0
- package/dist/{chunk-EBIQY3RK.js → chunk-7TWLSZK5.js} +2 -2
- package/dist/{chunk-X3Z4MLVL.js → chunk-AVWPHM2Q.js} +2 -2
- package/dist/{chunk-GZQID3FS.js → chunk-BASVXNY3.js} +2 -2
- package/dist/{chunk-BJG67TCR.js → chunk-BFXPG2VN.js} +2 -2
- package/dist/chunk-BSN22NRK.js +9 -0
- package/dist/{chunk-ZDR4VTOP.js → chunk-BVRS7RKQ.js} +2 -2
- package/dist/{chunk-ANIOISCE.js → chunk-C5CTSJ6X.js} +2 -2
- package/dist/{chunk-VXT7WVIN.js → chunk-CO5GJRP7.js} +2 -2
- package/dist/chunk-CW5YFOCP.js +5 -0
- package/dist/chunk-E35O7UCB.js +2 -0
- package/dist/{chunk-LWTML2AN.js → chunk-EXDQ35NN.js} +2 -2
- package/dist/{chunk-Q34NWRPP.js → chunk-EY43NV4M.js} +2 -2
- package/dist/chunk-FAYI6KZ5.js +2 -0
- package/dist/{chunk-ZL52RLDK.js → chunk-FDEQIPPK.js} +2 -2
- package/dist/{chunk-5G5VI7J4.js → chunk-FFVIFETB.js} +2 -2
- package/dist/{chunk-JUIAOOK7.js → chunk-FKCGBZAC.js} +2 -2
- package/dist/{chunk-JRUKS66S.js → chunk-FXNWFMKW.js} +2 -2
- package/dist/chunk-G5UPYQGL.js +4 -0
- package/dist/chunk-GQBMH2TQ.js +2 -0
- package/dist/{chunk-VFLHKRTW.js → chunk-GRJY65YT.js} +2 -2
- package/dist/chunk-HF25DFSC.js +3 -0
- package/dist/chunk-HHN2B5KA.js +2 -0
- package/dist/{chunk-7KJBH4IP.js → chunk-IHUETYFW.js} +2 -2
- package/dist/{chunk-BEUQVBE3.js → chunk-JATUZIEH.js} +2 -2
- package/dist/chunk-JCLDUKT6.js +38 -0
- package/dist/{chunk-B4EHYG6M.js → chunk-JGN2ZFJR.js} +2 -2
- package/dist/{chunk-L4QKEQ4S.js → chunk-JME7OWD3.js} +2 -2
- package/dist/chunk-KDFONWTW.js +40 -0
- package/dist/{chunk-VMPB52FG.js → chunk-LPL4MA6R.js} +2 -2
- package/dist/{chunk-FGTHPJON.js → chunk-LSET2TXH.js} +2 -2
- package/dist/chunk-LZHUWKGD.js +2 -0
- package/dist/{chunk-JYSAYZNX.js → chunk-M4COR2H6.js} +2 -2
- package/dist/{chunk-QDGKE5HN.js → chunk-NOJAM5ZV.js} +2 -2
- package/dist/chunk-O6ZH6C6Y.js +2 -0
- package/dist/{chunk-3LQFMQPY.js → chunk-OBGRLXWF.js} +2 -2
- package/dist/chunk-OLTESY4K.js +3 -0
- package/dist/chunk-P4KYUPBD.js +4 -0
- package/dist/chunk-P5RYBRIO.js +4 -0
- package/dist/{chunk-6N6QTGSD.js → chunk-P753MDDE.js} +2 -2
- package/dist/{chunk-NWFSC356.js → chunk-P7AL7Y37.js} +2 -2
- package/dist/chunk-QLAUCRDJ.js +2 -0
- package/dist/{chunk-FHWEEQVO.js → chunk-QPU7EXAW.js} +2 -2
- package/dist/{chunk-AA7L7GKI.js → chunk-QYB5P7GL.js} +2 -2
- package/dist/chunk-RNM6LMCF.js +2 -0
- package/dist/chunk-RVWSAMTT.js +2 -0
- package/dist/{chunk-T633QLYF.js → chunk-TK7O5ER5.js} +2 -2
- package/dist/chunk-TQ5W2H3S.js +4 -0
- package/dist/chunk-USPV3T5K.js +2 -0
- package/dist/{chunk-FKUCFCLU.js → chunk-VCQYSG2M.js} +2 -2
- package/dist/{chunk-2YI45TNM.js → chunk-VUKC6F77.js} +2 -2
- package/dist/{chunk-N7F5UM6J.js → chunk-W6BVEKYC.js} +2 -2
- package/dist/{chunk-63MSELOP.js → chunk-WUCEKFQC.js} +2 -2
- package/dist/chunk-XUGQU7PM.js +41 -0
- package/dist/{chunk-KZYHFI2X.js → chunk-Y5NBHMQX.js} +2 -2
- package/dist/{chunk-6BNOACLT.js → chunk-YCOFCT4B.js} +2 -2
- package/dist/{chunk-SHM5D3DQ.js → chunk-YWYFU2V3.js} +2 -2
- package/dist/{chunk-BWL2ECGQ.js → chunk-Z3YYR4OS.js} +2 -2
- package/dist/{chunk-3FYGJ2GY.js → chunk-Z4HICZGY.js} +2 -2
- package/dist/{chunk-24S6MYOC.js → chunk-ZQDIXAF5.js} +2 -2
- package/dist/cli.js +298 -244
- package/dist/{db-BAVwb4Pb.d.ts → db-Djj3Nqrb.d.ts} +2 -0
- package/dist/{health-B17sVFYf.d.ts → health-D5J42g4D.d.ts} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -3
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +1 -1
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +1 -1
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/health.d.ts +2 -2
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +1 -1
- 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 +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -1
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -1
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +1 -1
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +13 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-imports.d.ts +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +1 -1
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/docs/COMMAND_REFERENCE.md +1 -1
- package/docs/analyzer-inventory.md +29 -0
- package/docs/analyzer-validation-ledger.md +32 -1
- package/package.json +1 -1
- package/skills/scip-hyper-optimization/SKILL.md +153 -24
- package/skills/scip-hyper-optimization/agents/openai.yaml +3 -3
- package/dist/chunk-2H57MJLI.js +0 -2
- package/dist/chunk-4TMJDHC6.js +0 -5
- package/dist/chunk-5GVOJOBL.js +0 -2
- package/dist/chunk-7XWXGANX.js +0 -4
- package/dist/chunk-AETMKBZR.js +0 -40
- package/dist/chunk-BTCASU5J.js +0 -3
- package/dist/chunk-C6ROZBJA.js +0 -32
- package/dist/chunk-COUFCH64.js +0 -2
- package/dist/chunk-EKECQP6Z.js +0 -2
- package/dist/chunk-FVA3NH4P.js +0 -2
- package/dist/chunk-I274B3B3.js +0 -7
- package/dist/chunk-J6ADQKQA.js +0 -2
- package/dist/chunk-K7VBTWNR.js +0 -2
- package/dist/chunk-KLXVEBVC.js +0 -2
- package/dist/chunk-KRGBLZT2.js +0 -7
- package/dist/chunk-P3K7LX7M.js +0 -4
- package/dist/chunk-PVZMPG5I.js +0 -2
- package/dist/chunk-RSKOYTSY.js +0 -3
- package/dist/chunk-RY7CAOJF.js +0 -4
- package/dist/chunk-S7YOLFLX.js +0 -2
- package/dist/chunk-SOGKYB5I.js +0 -8
- package/dist/chunk-VAXDTQHE.js +0 -18
- package/dist/chunk-X3BJUFSN.js +0 -62
- package/dist/chunk-XPOZO76D.js +0 -2
- package/dist/chunk-XWC67C3Q.js +0 -2
- package/dist/chunk-YNSVAJR6.js +0 -2
- package/dist/chunk-ZMU6IWDK.js +0 -38
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as C,b as k,c as o,d as f}from"./chunk-BZ53S4ZN.js";import{a as V}from"./chunk-3VD3JMK2.js";import{a as B,b}from"./chunk-YWOOQ4FF.js";import{c as y}from"./chunk-YZA6PPZL.js";function L(e,i={}){let{minSimilarity:u=.45,minSharedBehaviors:a=6,limit:r=20,scope:n,scanLimit:c,filePattern:d,focusFiles:h}=i,t=y(e,{scope:n,minBehaviorTokens:Math.max(3,a),scanLimit:c}).map(s=>({file:s.file,tokens:s.behaviorTokens,profile:s}));return V({profiles:t,limit:r,filePattern:d,focusFiles:h,compare:(s,l)=>R(s,l,u,a),sort:(s,l)=>l.similarity-s.similarity||s.fileA.localeCompare(l.fileA)||s.fileB.localeCompare(l.fileB)})}function R(e,i,u,a){let r=B(e.tokens,i.tokens);if(r.size<a||!P(r))return null;let n=k(e.tokens,i.tokens);if(n<u)return null;let c=o(r,"composable:"),d=o(r,"store:"),h=o(r,"reactivity:"),t=o(r,"lifecycle:"),s=o(r,"request:"),l=o(r,"function:"),g=o(r,"function-verb:"),v=o(r,"template-binding:"),p=o(r,"template-event:"),m=F({sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:t,sharedRequests:s,sharedFunctions:l,sharedFunctionVerbs:g,sharedBindings:v,sharedTemplateEvents:p});return{fileA:e.file,fileB:i.file,similarity:n,sharedTokens:f(r),sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:t,sharedRequests:s,sharedFunctions:l,sharedFunctionVerbs:g,sharedBindings:v,sharedTemplateEvents:p,evidenceClass:m.evidenceClass,actionTier:m.actionTier,evidenceClassReasons:m.reasons,recommendation:m.recommendation,uniqueToA:f(b(e.tokens,i.tokens)).slice(0,25),uniqueToB:f(b(i.tokens,e.tokens)).slice(0,25),reason:S({sharedComposables:c,sharedStores:d,sharedRequests:s,sharedLifecycle:t,sharedFunctions:l,sharedFunctionVerbs:g,sharedBindings:v}),locA:e.profile.totalLines,locB:i.profile.totalLines}}function F(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:T})}function T(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 P(e){let i=0,u=0,a=0,r=0,n=0,c=0,d=0;for(let s of e)s.startsWith("composable:")?i+=1:s.startsWith("store:")?u+=1:s.startsWith("request:")?a+=1:s.startsWith("lifecycle:")?r+=1:s.startsWith("function:")?n+=1:s.startsWith("reactivity:")?c+=1:(s.startsWith("function-verb:")||s.startsWith("template-binding:")||s.startsWith("template-event:"))&&(d+=1);let h=i+u,t=h+a+r+n+d;return a>=1&&t>=4||r>=1&&n>=2&&t>=4||h>=2&&(a>=1||n>=2)&&t>=5||n>=2&&c>=1&&t>=4}function S(e){let i=[];return e.sharedComposables.length&&i.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&i.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&i.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&i.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&i.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&i.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&i.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),i.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{L as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LZHUWKGD.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-PFOCOG57.js";import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-PFOCOG57.js";import{a as m}from"./chunk-5OST6GYB.js";import{a as d}from"./chunk-BGBBVSH4.js";import{c as u}from"./chunk-JM72FNGA.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-M4COR2H6.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as C}from"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-5OST6GYB.js";import{e as S}from"./chunk-OLTESY4K.js";import{c as y,f as p,h as b}from"./chunk-JM72FNGA.js";import{execFileSync as g}from"child_process";import{existsSync as v,readFileSync as E}from"fs";import{basename as F}from"path";function R(e){let t=new Map;for(let i of e){let n=t.get(i.file);n||(n=[],t.set(i.file,n)),n.push(i)}return t}var B="Unable to compute git diff.";function ge(e,t={}){let i=t.plan??P(e,t);return i.note?A(i.note,i.changedFileLines):i.changedFiles.length===0?O(i.changedFileLines):T(i.changedFiles,[$(e,i.changedFiles,i.changedFiles,i.changedRanges)])}function P(e,t={}){let{base:i="HEAD"}=t;try{let n=k(e.config.projectRoot,i),r=Y(e,n),s=j(e,z(e.config.projectRoot,i));return{changedFileLines:n,changedFiles:r,changedRanges:s,renamedFiles:H(e.config.projectRoot,i,r),note:n.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:B}}}function $(e,t,i,n=[]){let r=new C(e),s=new Set(i),a=R(n),o=[],d=new Map,f=t.flatMap(c=>r.definitionsForFile(c)).filter(te).filter(c=>Z(c,a)).sort((c,m)=>c.relativePath.localeCompare(m.relativePath)||c.startLine-m.startLine),l=f.map(c=>c.symbolId),u=X(e,l),M=ee(e,l,i),N=S(e,f.filter(c=>u.get(c.symbolId)===0));for(let c of f)Q(e,c,s,o,d,N.get(c.symbolId)??new Set,u.get(c.symbolId)??0,M.get(c.symbolId)??new Set);return{changedSymbols:o,consumerEntries:[...d.entries()].map(([c,m])=>({file:c,symbols:[...m].sort()}))}}function T(e,t){let i=new Map,n=t.flatMap(s=>s.changedSymbols);for(let s of t)for(let a of s.consumerEntries){let o=i.get(a.file);o||(o=new Set,i.set(a.file,o));for(let d of a.symbols)o.add(d)}let r=ne(i);return{changedFiles:[...e],changedSymbols:n,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:n.length,totalAffectedFiles:r.length}}}function A(e,t=[]){return{changedFiles:t,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:t.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function O(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function k(e,t){let i=g("git",["diff","--name-only",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--name-only","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4}),r=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([i,n,r].flatMap(s=>s.split(`
|
|
2
2
|
`)).map(s=>s.trim()).filter(s=>s.length>0))]}function z(e,t){let i=g("git",["diff","--unified=0",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--unified=0","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4});return _([...D(i),...D(n)])}function h(e,t,i){try{return g("git",["show",`${t}:./${i}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function ue(e,t,i=[]){let n=W(e,t,i);return r=>(n.has(r)||n.set(r,h(e,t,r)),n.get(r)??null)}function me(e,t=e.changedFiles){let i=new Map(e.renamedFiles.map(n=>[n.to,n.from]));return[...new Set(t.map(n=>i.get(n)??n))]}function W(e,t,i){let n=[...new Set(i)],r=new Map;if(n.length===0)return r;try{let s=n.map(o=>`${t}:./${o}
|
|
3
3
|
`).join(""),a=g("git",["cat-file","--batch"],{cwd:e,input:s,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]});return U(a,n)}catch{for(let s of n)r.set(s,h(e,t,s));return r}}function U(e,t){let i=new Map,n=0;for(let r of t){let s=e.indexOf(10,n);if(s<0)throw new Error("git cat-file batch output ended before object header");let a=e.subarray(n,s).toString("utf-8");if(n=s+1,a.endsWith(" missing")){i.set(r,null);continue}let o=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(a);if(!o)throw new Error(`unexpected git cat-file batch header: ${a}`);let[,d,f]=o,l=Number(f);if(!Number.isFinite(l)||l<0)throw new Error(`unexpected git cat-file batch size: ${a}`);if(n+l>e.length)throw new Error("git cat-file batch output ended before blob payload");let u=e.subarray(n,n+l);i.set(r,d==="blob"?u.toString("utf-8"):null),n+=l,e[n]===10&&(n+=1)}return i}function H(e,t,i){if(i.length===0)return[];let n=new Map,r=new Set;for(let a of q(e,t))i.includes(a.to)&&(n.set(a.to,a),r.add(a.from));let s=J(e,t);if(s.length===0)return[...n.values()].sort((a,o)=>a.to.localeCompare(o.to));for(let a of i){if(n.has(a)||!v(`${e}/${a}`))continue;let o=s.filter(l=>!r.has(l)).filter(l=>F(l)===F(a));if(o.length===0)continue;let d=E(`${e}/${a}`,"utf-8"),f=o.map(l=>({from:l,to:a,similarity:G(h(e,t,l)??"",d)})).sort((l,u)=>u.similarity-l.similarity)[0];f&&f.similarity>=.45&&(n.set(a,f),r.add(f.from))}return[...n.values()].sort((a,o)=>a.to.localeCompare(o.to))}function J(e,t){let i=g("git",["diff","--name-only","--diff-filter=D",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--name-only","--diff-filter=D","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([...w(i),...w(n)])]}function q(e,t){let i=g("git",["diff","--name-status","--find-renames",t],{encoding:"utf-8",cwd:e,timeout:1e4}),n=g("git",["diff","--name-status","--find-renames","--cached",t],{encoding:"utf-8",cwd:e,timeout:1e4});return[...i.split(`
|
|
4
4
|
`),...n.split(`
|
|
@@ -18,4 +18,4 @@ import{a as C}from"./chunk-XPOZO76D.js";import{e as S}from"./chunk-RSKOYTSY.js";
|
|
|
18
18
|
AND m.role != 1
|
|
19
19
|
AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
|
|
20
20
|
${e.pathExclusionsFor("ref_d")}`,...t,...i),r=new Map;for(let s of n){let a=r.get(s.symbol_id);a||(a=new Set,r.set(s.symbol_id,a)),a.add(s.relative_path)}return r}function L(e,t,i,n,r){if(e.isIgnored(n)||t.has(n))return;let s=i.get(n);s||(s=new Set,i.set(n,s)),s.add(r)}function ne(e){return[...e.entries()].map(([t,i])=>({file:t,consumedSymbols:i.size})).sort((t,i)=>i.consumedSymbols-t.consumedSymbols)}function te(e){return!(b(e.symbol)||e.parentTypeName!==null&&!p(e.symbol))}function ie(e,t){return p(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&t>0}export{R as a,B as b,ge as c,P as d,$ as e,T as f,h as g,ue as h,me as i,W as j};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-NOJAM5ZV.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as h}from"./chunk-B75HZHUP.js";import{a as u}from"./chunk-5OST6GYB.js";import{a as o}from"./chunk-BGBBVSH4.js";import{e as p}from"./chunk-OLTESY4K.js";import{c as y}from"./chunk-JM72FNGA.js";function W(m,c={}){let{scope:I,minLoc:C=3,scanLimit:r}=c,s=new u(m),d=c.semantic!==!1,b=h(s.productionCallableDefinitions({scope:I,minLoc:C,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof r=="number"&&r>0}),r),l=s.symbolsWithNonSelfCallees(b,{additive:!1,semantic:!1}),i=b.filter(e=>!l.has(e.symbolId)),L=s.crossFileCallerMap(i,{semantic:!1}),a=new Set(L.keys());for(let e of s.frameworkReferencedSymbolIds(i))a.add(e);let t=i.filter(e=>!a.has(e.symbolId));if(d&&t.length>0){for(let e of p(m,t).keys())a.add(e);for(let e of s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:!0}))l.add(e);t=t.filter(e=>!a.has(e.symbolId)).filter(e=>!l.has(e.symbolId))}let S=s.sourceFallbackCallerFiles(t);for(let e of S.keys())a.add(e);let f=t.filter(e=>!a.has(e.symbolId)),v=s.symbolsWithNonSelfCallees(f,{additive:!0,semantic:d});for(let e of v)l.add(e);return f.filter(e=>!l.has(e.symbolId)).sort((e,n)=>o(n)-o(e)||e.relativePath.localeCompare(n.relativePath)||e.startLine-n.startLine).map(e=>({symbol:e.symbol,shortName:y(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{W as a};
|
|
2
|
+
//# sourceMappingURL=chunk-O6ZH6C6Y.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as w}from"./chunk-
|
|
1
|
+
import{a as w}from"./chunk-XUGQU7PM.js";import{a as v}from"./chunk-64MNV6AB.js";import{a as O,d as D,f as P}from"./chunk-7S5E7KWT.js";function V(t){return t.replace(/'''[\s\S]*?'''/g,f).replace(/"""[\s\S]*?"""/g,f).replace(/#.*$/gm,f).replace(/\/\/.*$/gm,f).replace(/\/\*[\s\S]*?\*\//g,f).replace(/`(?:\\[\s\S]|[^`])*`/g,f).replace(/'(?:\\.|[^'\\\r\n])*'/g,f).replace(/"(?:\\.|[^"\\\r\n])*"/g,f)}function f(t){return t.replace(/[^\r\n]/g," ")}var Rt=P("stripped-lines",{clearGroups:["whole-project","source-file"]});O({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{_=null,h=""},clearFile:()=>{_=null,h=""}});var _=null,h="";function Y(t){return _===t||(_=t,h=V(t)),h}function Ct(t,n,e){let r=Y(t);return`${r.slice(0,n)}${" ".repeat(e-n)}${r.slice(e)}`}function $t(t,n){return new RegExp(`\\b${X(n)}\\b`,"m").test(t)}function jt(t,n){let e=new Set,r=new RegExp(`\\b${X(n)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let o of t.matchAll(r)){let s=o[1];s&&e.add(s)}return[...e]}function X(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yt(t){let n=0;for(let e of t)e==="("&&(n+=1),e===")"&&(n-=1);return n}import{existsSync as T}from"fs";import{basename as K,dirname as S,extname as p,join as g,relative as m,resolve as u}from"path";var Q=D("indexed-paths",{clearGroups:[]}),Z=D("indexed-path-digest",{clearGroups:[]}),I=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],b=[".py",".pyi"],k=[".java",".scala",".kt",".kts"],A=[".rs"],L=[".rb"],W=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],H=[".cs",".vb"],U=[".dart"],G=[".php"],q=new Set(I),R=new Set(b),J=new Set(k),C=new Set(A),$=new Set(L),M=new Set(W),B=new Set(H),j=new Set(U),F=new Set(G),tt=[{extensions:I,lookup:q},{extensions:b,lookup:R},{extensions:k,lookup:J},{extensions:A,lookup:C},{extensions:L,lookup:$},{extensions:W,lookup:M},{extensions:H,lookup:B},{extensions:U,lookup:j},{extensions:G,lookup:F}];function x(t,n){return n.has(p(t).toLowerCase())}function nt(t){return x(t,R)}function et(t){return x(t,J)}function rt(t){return x(t,C)}function ot(t){return x(t,$)}function st(t){return x(t,M)}function it(t){return x(t,B)}function kt(t){return p(t).toLowerCase()===".vb"}function ct(t){return x(t,j)}function at(t){return x(t,F)}function lt(t){let n=p(t).toLowerCase();for(let e of tt)if(e.lookup.has(n))return e.extensions;return I}function ut(t){return et(t)||it(t)||at(t)}function At(t,n,e){return nt(n)?pt(t,n,e):rt(n)?ft(t,n,e):ot(n)?St(t,n,e):st(n)?xt(t,n,e):ut(n)?dt(t,e.replace(/\\/g,"."),lt(n)):ct(n)?Et(t,n,e):gt(t,n,e)}function gt(t,n,e){if(!e.startsWith(".")&&!e.startsWith("/"))return null;let r=S(g(t.config.projectRoot,n)),o=u(r,e),s=E(t);for(let c of _t(o)){let a=d(m(t.config.projectRoot,c));if(s.has(a)||T(c))return a}return d(m(t.config.projectRoot,o))}function pt(t,n,e){let r=E(t),o;if(e.startsWith(".")){let s=e.match(/^(\.+)(.*)$/);if(!s)return null;let c=s[1].length,a=s[2].replace(/^\./,""),i=S(g(t.config.projectRoot,n));for(let l=1;l<c;l++)i=S(i);o=a?u(i,a.replace(/\./g,"/")):i}else o=u(t.config.projectRoot,e.replace(/\./g,"/"));for(let s of ht(o)){let c=d(m(t.config.projectRoot,s));if(r.has(c)||T(s))return c}return null}function ft(t,n,e){if(!e)return null;let r=e.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let o=S(g(t.config.projectRoot,n)),s;return r.startsWith("crate::")?s=u(t.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?s=u(o,r.slice(6).replace(/::/g,"/")):s=u(S(o),r.slice(7).replace(/::/g,"/")),y(t,mt(s))}function St(t,n,e){let r=S(g(t.config.projectRoot,n)),o=u(r,e);return y(t,It(o))}function xt(t,n,e){let r=S(g(t.config.projectRoot,n)),o=[u(r,e),u(t.config.projectRoot,e),u(t.config.projectRoot,"include",e),u(t.config.projectRoot,"src",e)];return y(t,o)}function dt(t,n,e){let r=E(t),o=n.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),s=o.replace(/\./g,"/"),c=o.split(".").pop()??o;for(let i of e){let l=`${s}${i}`,N=[...r].find(z=>z.endsWith(l));if(N)return N}for(let i of e){let l=[...r].find(N=>K(N)===`${c}${i}`);if(l)return l}let a=[...r].filter(i=>e.includes(p(i).toLowerCase())).filter(i=>i.includes(`/${s}/`)||i.includes(`/${c}/`)).sort((i,l)=>i.localeCompare(l));return a.length===1?a[0]:null}function Et(t,n,e){let r=E(t);if(e.startsWith("package:")){let c=e.slice(8),a=c.indexOf("/");if(a<0)return null;let i=c.slice(a+1),l=d(i.startsWith("lib/")?i:`lib/${i}`);return r.has(l)?l:null}let o=S(g(t.config.projectRoot,n)),s=u(o,e);for(let c of Nt(s)){let a=d(m(t.config.projectRoot,c));if(r.has(a)||T(c))return a}return null}function ht(t){let n=p(t);return R.has(n)?[t]:[`${t}.py`,`${t}.pyi`,g(t,"__init__.py"),g(t,"__init__.pyi")]}function y(t,n){let e=E(t);for(let r of n){let o=d(m(t.config.projectRoot,r));if(e.has(o)||T(r))return o}return null}function mt(t){let n=p(t);return C.has(n)?[t]:[`${t}.rs`,g(t,"mod.rs")]}function It(t){let n=p(t);return $.has(n)?[t]:[`${t}.rb`,g(t,"index.rb")]}function Nt(t){let n=p(t);return j.has(n)?[t]:[`${t}.dart`,t]}function _t(t){let n=p(t),e=new Set;if(n){e.add(t);for(let r of I)e.add(t.slice(0,-n.length)+r)}else for(let r of I)e.add(`${t}${r}`),e.add(g(t,`index${r}`));return[...e]}function E(t){return Q.get(t,()=>new Set(v(t,{includeIgnored:!1}).map(d)))}function Lt(t){return Z.get(t,()=>w([...E(t)].sort().join(`
|
|
2
2
|
`)))}function d(t){return t.replace(/\\/g,"/")}export{I as a,b,k as c,A as d,L as e,W as f,H as g,U as h,G as i,kt as j,lt as k,At as l,pt as m,ft as n,St as o,xt as p,dt as q,Et as r,Lt as s,d as t,V as u,Ct as v,$t as w,jt as x,yt as y};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-OBGRLXWF.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as k,b as S}from"./chunk-TQ5W2H3S.js";import{l as H}from"./chunk-OBGRLXWF.js";import{f as D}from"./chunk-2KHTSEIL.js";import{d as P,e as oe}from"./chunk-JM72FNGA.js";import{c as ne,g as ie,i as re}from"./chunk-XUGQU7PM.js";import{a as O}from"./chunk-64MNV6AB.js";import{a as ee,c as te}from"./chunk-7S5E7KWT.js";import{performance as m}from"perf_hooks";function b(r,t,e){if(r.has(t))return r.get(t);let n=e();return r.set(t,n),n}import se from"path";function Ae(r,t){return r.getReferences().map(e=>{let n=e.getNode();return U(n,t)})}function Oe(r){let t=r;return typeof t.findReferences=="function"?t.findReferences():[]}function ae(r,t,e,n){let i=[];for(let o of Oe(r))for(let s of Ae(o,n))s.file===t.relativePath&&s.line>=t.startLine&&s.line<=t.endLine||i.push(s);for(let o of e)i.push(o);return C(i)}function ce(r,t,e,n){let i=[],o=e?.getStart();for(let s of r.getReferences()){let a=s.getNode();N(n,a.getSourceFile().getFilePath())===t&&(o!==void 0&&a.getStart()===o||i.push({location:U(a,n),node:a}))}return i}function U(r,t){let e=r.getSourceFile(),n=e.getLineAndColumnAtPos(r.getStart());return{file:N(t,e.getFilePath())??e.getBaseName(),line:n.line-1,column:n.column-1}}function le(r,t,e){let n=r.getSourceFile(),i=$(n,r),o=r.getText(),s=new RegExp(`\\b${Ue(o)}\\b`,"g"),a=n.getFullText().split(`
|
|
2
|
+
`),c=[];for(let l=0;l<a.length;l++){if(l===i)continue;let d=a[l]??"";s.lastIndex=0;let p;for(;(p=s.exec(d))!==null;)c.push({file:t,line:l,column:p.index})}return C(c.filter(l=>N(e,se.join(e,l.file))===t))}function _(r){for(let t=r;t;t=t.getParent()){let e=t.getKindName();if(e.includes("Type")||e==="InterfaceDeclaration"||e==="TypeAliasDeclaration")return!0;if(e==="CallExpression"||e==="NewExpression"||e==="ExpressionStatement")return!1}return!1}function $(r,t){return r.getLineAndColumnAtPos(t.getStart()).line-1}function C(r){let t=new Set,e=[];for(let n of r){let i=`${n.file}:${n.line}:${n.column}`;t.has(i)||(t.add(i),e.push(n))}return e}function N(r,t){let e=se.relative(r||process.cwd(),t).replace(/\\/g,"/");return!e||e.startsWith("..")?null:e}function Ue(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(r,t,e,n){let i=We(t,n);return i.size===0?new Map:Be(r,e,i)}function We(r,t){let e=new Map;for(let n of D(r,t)){let i=P(n.symbol)??n.leaf;if(!i)continue;let o=e.get(i);o||(o=[],e.set(i,o)),o.push(n)}return e}function Be(r,t,e){let n=new Map,i=new Map;return t.forEachDescendant(o=>{for(let s of He(r,o)){let a=e.get(s);if(!a)continue;let c=$(t,o);for(let l of a){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),p=i.get(l.symbolId);p!==void 0&&p<=d||(i.set(l.symbolId,d),n.set(l.symbolId,o))}}}),n}function He(r,t){let e=[],n=i=>{i&&!e.includes(i)&&e.push(i)};if("getNameNode"in t&&typeof t.getNameNode=="function"){let i=t.getNameNode();n(i?.getText())}if("getName"in t&&typeof t.getName=="function"){let i=t.getName();n(i)}return r.Node.isIdentifier(t)&&n(t.getText()),e}var _e=te("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function de(r,t,e,n){let i=me(r,t),o=pe(i.get(n)??[],e);if(o)return o;let s=[];for(let a of i.values())for(let c of a)((c.leaf||P(c.symbol)||"").includes(n)||c.symbol.includes(n))&&s.push(c);return pe(s,e)}function ue(r,t){let e=new Map;for(let[n,i]of me(r,t)){let o=i[0];o&&e.set(n,o)}return e}function me(r,t){return _e.get(r,t,()=>{let e=new Map;for(let n of D(r,t)){let i=n.leaf||P(n.symbol);if(!i)continue;let o=e.get(i);o||(o=[],e.set(i,o)),o.push({...n,leaf:i})}for(let n of e.values())n.sort((i,o)=>i.startLine-o.startLine||i.endLine-o.endLine||i.symbolId-o.symbolId);return e})}function pe(r,t){let e=null,n=Number.POSITIVE_INFINITY;for(let i of r){let o=Math.abs(i.startLine-t);(o<n||o===n&&e&&i.startLine<e.startLine)&&(e=i,n=o)}return e}import z from"path";var T=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function R(r){let t=r.toLowerCase();return T.some(e=>t.endsWith(e))}function ge(r,t){let e=new Map,n=null,i=null,o=()=>(i??=O(r,{extensions:T}),i),s=()=>(n??=S("typescript.source-file-index",()=>$e(r.config.projectRoot,t,o()),()=>({projects:t.length,indexedDocuments:o().length})),n),a=c=>R(c)?b(e,c,()=>{let l=w(z.resolve(r.config.projectRoot,c));for(let{project:d,sourceFiles:p}of s()){let f=p.get(l)??null;if(f||(f=d.addSourceFileAtPathIfExists(l)??null,f&&p.set(w(f.getFilePath()),f)),f)return{project:d,sourceFile:f}}return null}):null;return{sourceFile:c=>a(c)?.sourceFile??null,sourceFileMatch:a,indexedTypeScriptLikeDocuments:o}}function $e(r,t,e){let n=t.map(({project:i})=>({project:i,sourceFiles:new Map(i.getSourceFiles().map(o=>[w(o.getFilePath()),o]))}));for(let i of e){let o=w(z.resolve(r,i));for(let s of n){if(s.sourceFiles.has(o))break;let a=s.project.addSourceFileAtPathIfExists(o)??null;if(a){s.sourceFiles.set(w(a.getFilePath()),a);break}}}return n}function w(r){return z.resolve(r)}import F from"path";import{existsSync as W,readdirSync as ze,readFileSync as ye}from"fs";function he(r){let t=F.join(r,"package.json");if(!W(t))return[];let e;try{e=JSON.parse(ye(t,"utf8"))}catch{return[]}return(Array.isArray(e.workspaces)?e.workspaces:e.workspaces?.packages??[]).flatMap(i=>Ve(r,i)).flatMap(i=>qe(r,i))}function Ve(r,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let s=F.join(r,t);return W(F.join(s,"package.json"))?[s]:[]}let e=t.indexOf("*"),n=t.slice(0,e).replace(/\/$/,""),i=t.slice(e+1).replace(/^\//,""),o=F.join(r,n||".");if(!W(o))return[];try{return ze(o).map(s=>F.join(o,s,i)).filter(s=>W(F.join(s,"package.json")))}catch{return[]}}function qe(r,t){try{let e=JSON.parse(ye(F.join(t,"package.json"),"utf8"));if(!e.name)return[];let n=F.relative(r,t).replace(/\\/g,"/");return[{name:e.name,rootRelative:n,sourceRootRelative:`${n}/src`}]}catch{return[]}}function Se(r,t){for(let e of r)if(t===e.name||t.startsWith(`${e.name}/`))return e.name;return null}function be(r){return[`${r.sourceRootRelative}/index.ts`,`${r.sourceRootRelative}/index.tsx`,`${r.sourceRootRelative}/index.mts`,`${r.sourceRootRelative}/index.cts`]}import{existsSync as L,readFileSync as Je,readdirSync as Ke,statSync as Ge}from"fs";import h from"path";var q=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function J(r,t){let n=t?h.dirname(h.join(r,t)):r,i=h.resolve(r);for(;n.startsWith(i);){for(let s of q){let a=h.join(n,s);if(L(a))return a}let o=h.dirname(n);if(o===n)break;n=o}for(let o of q){let s=h.join(r,o);if(L(s))return s}return null}function Me(r){let t=r.config.projectRoot,e=new Set(Ye(t,r.config.semantic?.typescript?.tsconfigs)),n=O(r,{includeIgnored:!1,extensions:T});for(let i of n){let o=J(t,i);o&&e.add(h.resolve(o))}if(e.size===0){let i=J(t);i&&e.add(h.resolve(i))}return[...e].filter(i=>!Ie(t,i)).sort((i,o)=>i.localeCompare(o))}function Ye(r,t=[]){let e=new Set;for(let n of t){let i=h.isAbsolute(n)?n:h.join(r,n);L(i)&&e.add(h.resolve(i))}for(let n of Xe(r))for(let i of q){let o=h.join(n,i);L(o)&&e.add(h.resolve(o))}if(e.size===0){let n=J(r);n&&e.add(h.resolve(n))}return[...e].filter(n=>!Ie(r,n)).sort((n,i)=>n.localeCompare(i))}function Xe(r){let t=h.join(r,"package.json");if(!L(t))return[];let e;try{e=JSON.parse(Je(t,"utf8"))}catch{return[]}return(Array.isArray(e.workspaces)?e.workspaces:e.workspaces?.packages??[]).flatMap(i=>Qe(r,i))}function Qe(r,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let s=h.join(r,t);return V(s)?[s]:[]}let e=t.indexOf("*"),n=t.slice(0,e).replace(/\/$/,""),i=t.slice(e+1).replace(/^\//,""),o=h.join(r,n||".");return V(o)?Ke(o).map(s=>h.join(o,s,i)).filter(V):[]}function V(r){try{return Ge(r).isDirectory()}catch{return!1}}function Ie(r,t){let e=h.relative(r,t).replace(/\\/g,"/");return e.startsWith("..")||e.includes("/node_modules/")||e.startsWith("node_modules/")||e.includes("/dist/")||e.startsWith("dist/")}import{createRequire as Ze}from"module";var et=Ze(import.meta.url),j;function xe(){if(j!==void 0)return j;try{j=et("ts-morph")}catch{j=null}return j}function ke(r,t){return t.map(e=>({tsconfigPath:e,project:new r.Project({tsConfigFilePath:e,skipFileDependencyResolution:!0})}))}function B(r,t,e){return{language:"typescript",availability:()=>({available:!1,reason:r,tsconfigPath:t,tsconfigPaths:e}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var tt=32;function Ce(r,t){let e=S("typescript.provider.load",()=>xe());if(!e)return B("ts-morph is not installed");let n=S("typescript.provider.tsconfig-discovery",()=>Me(r));if(n.length===0)return B("no tsconfig found");try{let i=S("typescript.provider.project-bundles",()=>ke(e,n),()=>({tsconfigs:n.length}));return S("typescript.provider.construct",()=>new K(r,e,i),()=>({tsconfigs:n.length}))}catch(i){return B(i instanceof Error?i.message:String(i),n[0],n)}}var K=class{constructor(t,e,n){this.db=t;this.tsMorph=e;this.projects=n;this.workspacePackages=he(t.config.projectRoot),this.sourceFiles=ge(t,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(t=>t.tsconfigPath)}}importUsage(t){return b(this.importUsageCache,t,()=>{let e=this.sourceFiles.sourceFile(t);if(!e)return[];let n=it();return S("typescript.import-usage.file",()=>this.importUsageForSourceFile(t,e,n),()=>({file:t,...n}))})}referencesFor(t){return b(this.referencesCache,t.symbolId,()=>{let e=this.nodeForDefinition(t);return this.referencesForDefinitionNode(t,e)})}referencesForDefinitions(t){let e=new Map,n=k(),i=[];for(let c of t){let l=this.referencesCache.get(c.symbolId);l?e.set(c.symbolId,l):i.push(c)}if(i.length===0)return e;let o=i,s=i.filter(c=>!ve(c));if(s.length>=tt){let c=this.referencesForDefinitionsBySymbolScan(s);for(let l of s){let d=c.get(l.symbolId)??[];this.referencesCache.set(l.symbolId,d),e.set(l.symbolId,d)}if(o=i.filter(l=>ve(l)),o.length===0)return e}let a=new Map;for(let c of o){let l=a.get(c.relativePath);l?l.push(c):a.set(c.relativePath,[c])}for(let[c,l]of a){let d=De();S("typescript.references-map.file",()=>{let p=this.definitionNodesForFile(c);for(let f of l){n&&(d.cacheMisses+=1);let u=p.get(f.symbolId)??null;n&&(u?d.nodeHits+=1:d.nodeMisses+=1);let g=this.referencesForDefinitionNode(f,u,n?d:void 0);this.referencesCache.set(f.symbolId,g),e.set(f.symbolId,g)}},()=>({relativePath:c,definitions:l.length,...Re(d)}))}return e}referencesForDefinitionsBySymbolScan(t){let e=k(),n=De(),i=new Map,o=new Set(t.map(a=>a.symbolId)),s=new Map(t.map(a=>[a.symbolId,a]));for(let a of t)i.set(a.symbolId,[]);return S("typescript.references-map.inverted-scan",()=>{let a=e?m.now():0;for(let p of t){let f=this.packageImportReferencesForDefinition(p);if(f.length>0){let u=i.get(p.symbolId)??[];u.push(...f),i.set(p.symbolId,u)}e&&(n.packageReferenceCount+=f.length)}e&&(n.packageRefsMs+=m.now()-a);let c=new Map,l=new Set(t.map(p=>p.leaf).filter(Boolean)),d=e?m.now():0;for(let p of this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(p))continue;let f=this.sourceFiles.sourceFile(p);f&&(e&&(n.scanFiles+=1),this.addReferencesFromSourceFileScan(f,p,o,s,l,c,i,e?n:void 0))}e&&(n.scanMs+=m.now()-d);for(let[p,f]of i){let u=C(f);i.set(p,u),e&&(n.referenceCount+=u.length)}},()=>({definitions:t.length,...Re(n)})),i}addReferencesFromSourceFileScan(t,e,n,i,o,s,a,c){let l=this.compilerCheckerForSourceFile(t),d=t.compilerNode,p=st(t),f=u=>{if(this.tsMorph.ts.isIdentifier(u)){if(c&&(c.identifiers+=1),!o.has(u.text)&&!p.has(u.text)){this.tsMorph.ts.forEachChild(u,f);return}let g=this.compilerReferenceSymbol(l,u,c);if(g){let y;if(s.has(g)?y=s.get(g)??null:(y=this.definitionFromCompilerSymbol(g),s.set(g,y)),c&&(y?c.targetHits+=1:c.targetMisses+=1),y&&n.has(y.symbolId)){c&&(c.requestedHits+=1);let v=i.get(y.symbolId);if(v&&!ct(v,e,Fe(d,u))){let I=a.get(y.symbolId)??[],A=d.getLineAndCharacterOfPosition(u.getStart(d));I.push({file:e,line:A.line,column:A.character}),a.set(y.symbolId,I)}}}}this.tsMorph.ts.forEachChild(u,f)};f(d)}compilerReferenceSymbol(t,e,n){n&&(n.symbolLookups+=1);let i=t.getSymbolAtLocation(e);if(i){if((i.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return i;try{return n&&(n.aliasResolutions+=1),t.getAliasedSymbol(i)}catch{return i}}}calleesFor(t){return b(this.calleesCache,t.symbolId,()=>b(this.fileCalleesCache,t.relativePath,()=>this.calleeMapForFile(t.relativePath)).get(t.symbolId)??[])}calleesForDefinitions(t){let e=new Map,n=new Map;for(let i of t){let o=n.get(i.relativePath);o?o.push(i):n.set(i.relativePath,[i])}for(let[i,o]of n){let s=this.fileCalleesCache.get(i),a=new Set(o.map(l=>l.symbolId)),c=s??this.calleeMapForFile(i,a);for(let l of o){let d=c.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,d),e.set(l.symbolId,d)}}return e}referencesForDefinitionNode(t,e,n){let i=n?m.now():0,o=this.packageImportReferencesForDefinition(t);if(n&&(n.packageRefsMs+=m.now()-i,n.packageReferenceCount+=o.length),!e)return o;let s=n?m.now():0,a=ae(e,t,o,this.db.config.projectRoot);return n&&(n.semanticRefsMs+=m.now()-s,n.referenceCount+=a.length),a}signatureFor(t){return b(this.signatureCache,t.symbolId,()=>{let e=this.nodeForDefinition(t);if(!e||!this.tsMorph.Node.isFunctionDeclaration(e)&&!this.tsMorph.Node.isMethodDeclaration(e)&&!this.tsMorph.Node.isArrowFunction(e)&&!this.tsMorph.Node.isFunctionExpression(e)&&!this.tsMorph.Node.isConstructorDeclaration(e))return null;let n=e.getType().getCallSignatures()[0];if(!n)return null;let i=n.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return Pe(c)}),o=n.getReturnType().getText(e);return`(${i.join(",")})=>${Pe(o)}`})}importUsageForSourceFile(t,e,n){let i=[],o=new Map;for(let s of e.getImportDeclarations()){n.declarations+=1;let a=H(this.db,t,s.getModuleSpecifierValue()),c=s.getImportClause()?.isTypeOnly()??!1;for(let l of G(s)){n.entries+=1;let d=c?null:l.identifier?.getSymbol()?.compilerSymbol??null;!c&&l.identifier&&(d?n.bindingSymbols+=1:n.missingBindingSymbols+=1);let p={sourcePath:a,entry:l,typeOnlyDeclaration:c,bindingSymbol:d,references:[]};if(i.push(p),c||!l.localName||!d)continue;let f=o.get(l.localName);f?f.push(p):o.set(l.localName,[p])}}return o.size>0&&e.forEachDescendant(s=>{if(s.getKindName()!=="Identifier")return;let a=o.get(s.getText());if(!a||rt(s))return;n.scannedIdentifiers+=1;let c=s.getSymbol()?.compilerSymbol;if(n.symbolLookups+=1,!!c){for(let l of a)if(l.bindingSymbol===c){l.references.push({location:U(s,this.db.config.projectRoot),node:s}),n.matchedReferences+=1;break}}}),i.map(s=>s.typeOnlyDeclaration?nt(t,s.sourcePath,s.entry):s.entry.identifier&&!s.bindingSymbol?(n.fallbackEntries+=1,this.valueImportUsageForEntry(t,s.sourcePath,s.entry)):this.valueImportUsageFromLocations(t,s.sourcePath,s.entry,s.references))}valueImportUsageForEntry(t,e,n){let i=n.identifier?n.identifier.findReferences():[],o=[];for(let s of i)for(let a of ce(s,t,n.identifier,this.db.config.projectRoot))o.push(a);return this.valueImportUsageFromLocations(t,e,n,o)}valueImportUsageFromLocations(t,e,n,i){let o=i.some(c=>!_(c.node)),s=i.some(c=>_(c.node)),a=n.isTypeOnly;return{importer:t,sourcePath:e,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:a,isUsed:a||i.length>0,isTypeUsed:a||s,isValueUsed:o,references:i.map(c=>c.location)}}packageImportReferencesForDefinition(t){return this.packageImportReferences().get(t.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let t=new Map,e=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(t,e,n);for(let[n,i]of t)t.set(n,C(i));return this.packageImportReferenceIndex=t,t}addPackageImportReferencesForDocument(t,e,n){if(this.db.isIgnored(n))return;let i=this.sourceFiles.sourceFileMatch(n);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(t,e,n,o)}addPackageImportReferencesForDeclaration(t,e,n,i){let o=Se(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=e.get(o);if(s)for(let a of G(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let l=le(a.identifier,n,this.db.config.projectRoot);l.length>0&&pt(t,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let t=new Map;for(let e of this.workspacePackages){let n=new Map;for(let i of be(e))this.collectPackageExports(e,i,n,new Set);n.size>0&&t.set(e.name,n)}return this.packageExportIndex=t,t}collectPackageExports(t,e,n,i){if(i.has(e))return;i.add(e);let o=this.sourceFiles.sourceFile(e);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?H(this.db,e,a):e;if(!c||!c.startsWith(`${t.sourceRootRelative}/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(t,c,n,i);continue}for(let d of l){let p=d.getNameNode().getText(),f=d.getAliasNode()?.getText()??p,u=this.indexedDefinitionByLeaf(c,p);if(!u)continue;let g=n.get(f);g||(g=new Set,n.set(f,g)),g.add(u.symbolId)}}}indexedDefinitionByLeaf(t,e){return b(this.indexedDefinitionLeafCache,t,()=>ue(this.db,t)).get(e)??null}nodeForDefinition(t){return b(this.definitionNodeCache,t.symbolId,()=>this.definitionNodesForFile(t.relativePath).get(t.symbolId)??null)}definitionNodesForFile(t){return b(this.fileDefinitionNodeCache,t,()=>{let e=this.sourceFiles.sourceFile(t);return e?fe(this.tsMorph,this.db,e,t):new Map})}definitionFromCompilerSymbol(t,e){let n=t.name,i=e?m.now():0,o=t.declarations??[];e&&(e.declarationsMs+=m.now()-i,e.declarationChecks+=o.length);for(let s of o){let a=e?m.now():0,c=s.getSourceFile(),l=N(this.db.config.projectRoot,c.fileName),d=c.getLineAndCharacterOfPosition(s.getStart(c)).line;if(e&&(e.declarationLocationMs+=m.now()-a),!l||this.db.isIgnored(l))continue;let p=e?m.now():0,f=de(this.db,l,d,n);if(e&&(e.indexedLookupMs+=m.now()-p),f)return{symbolId:f.symbolId,symbol:f.symbol,file:f.relativePath,line:f.startLine}}return null}calleeMapForFile(t,e){let n=k(),i=0,o=0,s=0,a=0,c=0,l=0,d=0,p=0,f=n?lt():void 0;return S("typescript.callee-map.file",()=>{let u=n?m.now():0,g=this.sourceFiles.sourceFile(t);if(n&&(c=Math.round(m.now()-u)),!g)return new Map;let y=n?m.now():0,v=D(this.db,t).sort((M,x)=>M.startLine-x.startLine||x.endLine-M.endLine);if(n&&(l=Math.round(m.now()-y)),i=v.length,v.length===0)return new Map;let I=new Map,A=n?m.now():0,Le=this.compilerCheckerForSourceFile(g),Q=g.compilerNode;n&&(d=Math.round(m.now()-A));let je=new Map,Z=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){n&&(o+=1);let x=this.semanticCalleeForCallNode(Le,Q,v,M,je,e,f);x&&(n&&(s+=1),ot(I,x.callerId,x.target))}this.tsMorph.ts.forEachChild(M,Z)},Ee=n?m.now():0;Z(Q),n&&(p=Math.round(m.now()-Ee));for(let[M,x]of I)I.set(M,dt(x));return a=I.size,I},()=>({relativePath:t,definitions:i,callNodes:o,resolvedCallees:s,outputRows:a,requestedDefinitions:e?.size??i,sourceFileLookupMs:c,definitionsLoadMs:l,checkerLookupMs:d,traversalMs:p,...f?ft(f):{}}))}semanticCalleeForCallNode(t,e,n,i,o,s,a){let c=a?m.now():0,l=at(n,Fe(e,i));if(a&&(a.callerLookupMs+=m.now()-c),!l)return null;if(s&&!s.has(l.symbolId))return a&&(a.skippedUnrequestedCallers+=1),null;let d=i.expression,p=this.compilerSymbolForExpression(t,d,a),f=null;if(p)if(a&&(a.targetSymbolHits+=1),o.has(p))a&&(a.compilerSymbolCacheHits+=1),f=o.get(p)??null;else{a&&(a.compilerSymbolCacheMisses+=1);let u=a?m.now():0;f=this.definitionFromCompilerSymbol(p,a),a&&(a.targetLookupMs+=m.now()-u),o.set(p,f)}else a&&(a.targetMisses+=1);return f?{callerId:l.symbolId,target:{symbol:f.symbol,file:f.file,line:f.line}}:null}compilerSymbolForExpression(t,e,n){let i=n?m.now():0,o=t.getSymbolAtLocation(e);if(n&&(n.expressionSymbolMs+=m.now()-i),o)return o;n&&(n.typeFallbacks+=1);let s=n?m.now():0,a=t.getTypeAtLocation(e).getSymbol();return n&&(n.typeSymbolMs+=m.now()-s),a}compilerCheckerForSourceFile(t){let e=t.getProject(),n=this.compilerCheckerCache.get(e);return n||(n=e.getTypeChecker().compilerObject,this.compilerCheckerCache.set(e,n)),n}};function G(r){let t=[],e=r.getDefaultImport();e&&t.push({identifier:e,importedName:"default",localName:e.getText(),kind:"default",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});let n=r.getNamespaceImport();n&&t.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});for(let i of r.getNamedImports()){let o=i.getNameNode(),a=i.getAliasNode()??(o.getKindName()==="Identifier"?o:null);t.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(r.getImportClause()?.isTypeOnly()??!1)})}return t.length===0&&t.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),t}function nt(r,t,e){return{importer:r,sourcePath:t,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function it(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function rt(r){for(let t=r;t;t=t.getParent())if(t.getKindName()==="ImportDeclaration")return!0;return!1}function ot(r,t,e){let n=r.get(t);n||(n=[],r.set(t,n)),n.push(e)}function st(r){let t=new Set;for(let e of r.getImportDeclarations())for(let n of G(e))n.localName&&t.add(n.localName);return t}function at(r,t){let e=null;for(let n of r)t<n.startLine||t>n.endLine||(!e||n.startLine>=e.startLine)&&(e=n);return e}function Fe(r,t){return r.getLineAndCharacterOfPosition(t.getStart(r)).line}function ct(r,t,e){return t===r.relativePath&&e>=r.startLine&&e<=r.endLine}function ve(r){return r.symbol.includes("#")?oe(r.symbol)==="type"&&r.relativePath.endsWith(".d.ts"):!1}function lt(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function ft(r){return{...r,callerLookupMs:Math.round(r.callerLookupMs),expressionSymbolMs:Math.round(r.expressionSymbolMs),typeSymbolMs:Math.round(r.typeSymbolMs),targetLookupMs:Math.round(r.targetLookupMs),declarationsMs:Math.round(r.declarationsMs),declarationLocationMs:Math.round(r.declarationLocationMs),indexedLookupMs:Math.round(r.indexedLookupMs)}}function De(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0}}function Re(r){return{...r,scanMs:Math.round(r.scanMs),packageRefsMs:Math.round(r.packageRefsMs),semanticRefsMs:Math.round(r.semanticRefsMs)}}function pt(r,t,e){for(let n of t){let i=r.get(n)??[];i.push(...e),r.set(n,i)}}function dt(r){let t=new Set,e=[];for(let n of r){let i=`${n.symbol}|${n.file}|${n.line}`;t.has(i)||(t.add(i),e.push(n))}return e}function Pe(r){return r.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var Y=new WeakMap;ee({name:"semantic-provider",groups:["semantic-provider"],clearAll:r=>Y.delete(r)});function X(r,t){let e=`${r.config.projectRoot}:typescript-workspace`,n=Y.get(r);n||(n=new Map,Y.set(r,n));let i=n.get(e);if(i)return i;let o=Ce(r,t);return n.set(e,o),o}function dn(r,t){let e=E(r,t);return e?e.importUsage(t):[]}function un(r,t){let e=E(r,t.relativePath);return e?e.referencesFor(t):[]}function mn(r,t){let e=k(),n=new Map,i=ne(r),o=[],s=[],a=[],c=0,l=0,d=0,p=0;if(S("semantic.references.cache-scan",()=>{for(let f of t){if(!i||!R(f.relativePath)){e&&!R(f.relativePath)&&(c+=1),a.push(f);continue}let u=ie(r,f.relativePath,f.symbol,i);if(u!==null){let g=mt(u);if(g){e&&(l+=1),p+=Te(r,n,f,g);continue}e&&(d+=1)}s.push(f)}},()=>({definitions:t.length,skippedNonTs:c,cacheHits:l,parseFailures:d,misses:s.length,unkeyed:a.length,resultRows:n.size,callerFiles:p})),s.length>0||a.length>0){let f=[...a,...s],u=0,g=S("semantic.references.compute-misses",()=>{let y=ut(r,f);return u=y.size,y},()=>({definitions:f.length,misses:s.length,unkeyed:a.length,rows:u}));for(let y of f)p+=Te(r,n,y,g.get(y.symbolId)??[]);if(i)for(let y of s)o.push({relativePath:y.relativePath,symbol:y.symbol,projectFingerprint:i,payload:JSON.stringify(g.get(y.symbolId)??[])})}return o.length>0&&(X(r).availability().available?S("semantic.references.cache-write",()=>re(r,o),()=>({entries:o.length})):S("semantic.references.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",entries:o.length}))),n}function ut(r,t){let e=k(),n=new Map,i=0,o=0,s=0,a=0;return S("semantic.references.provider-loop",()=>{let c=new Map,l=[];for(let d of t){let p=E(r,d.relativePath);if(!p){e&&(o+=1);continue}if(e&&(i+=1),p.referencesForDefinitions){let f=c.get(p);f?f.push(d):c.set(p,[d])}else l.push({provider:p,definition:d})}for(let[d,p]of c){let f=d.referencesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Ne(n,u.symbolId,g,e,y=>{s+=1,a+=y})}}for(let{provider:d,definition:p}of l){let f=d.referencesFor(p);Ne(n,p.symbolId,f,e,u=>{s+=1,a+=u})}return n},()=>({definitions:t.length,providerHits:i,providerMisses:o,definitionsWithReferences:s,referenceCount:a,rows:n.size}))}function Ne(r,t,e,n,i){r.set(t,e),n&&e.length>0&&i(e.length)}function Te(r,t,e,n){let i=0;for(let o of n){if(o.file===e.relativePath||r.isIgnored(o.file))continue;let s=t.get(e.symbolId);s||(s=new Set,t.set(e.symbolId,s));let a=s.size;s.add(o.file),s.size!==a&&(i+=1)}return i}function mt(r){try{return JSON.parse(r)}catch{return null}}function gn(r,t){let e=k(),n=new Map,i=0,o=0,s=0,a=0;return S("semantic.callees.provider-loop",()=>{let c=new Map,l=[];for(let d of t){let p=E(r,d.relativePath);if(!p){e&&(o+=1);continue}e&&(i+=1);let f=d;if(p.calleesForDefinitions){let u=c.get(p);u?u.push(f):c.set(p,[f])}else l.push({provider:p,definition:f})}for(let[d,p]of c){let f=d.calleesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];we(n,u.symbolId,g,e,y=>{s+=1,a+=y})}}for(let{provider:d,definition:p}of l){let f=d.calleesFor(p);we(n,p.symbolId,f,e,u=>{s+=1,a+=u})}return n},()=>({definitions:t.length,providerHits:i,providerMisses:o,definitionsWithCallees:s,calleeCount:a,rows:n.size}))}function we(r,t,e,n,i){e.length>0&&(r.set(t,e),n&&i(e.length))}function yn(r,t){let e=E(r,t.relativePath);return e?e.signatureFor(t):null}function E(r,t){if(!R(t))return null;let e=X(r,t);return e.availability().available?e:null}export{R as a,X as b,dn as c,un as d,mn as e,gn as f,yn as g};
|
|
3
|
+
//# sourceMappingURL=chunk-OLTESY4K.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as X,d as R}from"./chunk-BSN22NRK.js";import{a as P,b as z}from"./chunk-TQ5W2H3S.js";import{b as j,d as O,e as L,j as B,k as A}from"./chunk-XUGQU7PM.js";import{existsSync as G,readFileSync as F}from"fs";import{join as x}from"path";function U(t,n){let e=K(t,n)??Q(t,n)??V(t,n)??Y(t,n);return tt(t,e,n)}function K(t,n){let e=-1,i=null;for(let r=0;r<=n;r+=1){let o=w(t[r]??"");o&&(i===null?(i=o,e=r):o===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let r=n+1;r<t.length;r+=1)if(w(t[r]??"")===i)return{start:e,end:r+1};return{start:e,end:t.length}}function w(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function Q(t,n){if(!I(t[n]??""))return null;let e=n;for(;e>0&&I(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&I(t[i]??"");)i+=1;return{start:e,end:i}}function I(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function V(t,n){let e=n;for(;e>=0;){let o=t[e]??"";if(v(o)!==null)break;if(E(o)!==null)return null;e-=1}if(e<0)return null;let i=v(t[e]??"");if(i===null)return null;let r=e+1;for(;r<t.length;){let o=t[r]??"",s=v(o);if(s!==null){if(s<=i)break;r+=1;continue}if(E(o)!==null)break;r+=1}return{start:e,end:r}}function v(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function Y(t,n){let e=t[n]??"";if($(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&H(t[i-1]??"");)i-=1;let r=n+1;for(;r<t.length&&H(t[r]??"");)r+=1;return{start:i,end:r}}function H(t){return E(t)===null}function E(t){return t.trim().length===0?"blank":$(t)?"heading":w(t)?"fence":I(t)?"table":v(t)!==null?"list":null}function $(t){return/^#{1,6}\s+/.test(t.trim())}function tt(t,n,e){let{start:i,end:r}=n;if(r-i>40){let s=Math.floor(20);i=Math.max(i,e-s),r=Math.min(r,i+40),i=Math.max(n.start,r-40)}let o=t.slice(i,r).join(`
|
|
2
|
+
`).trim();return o.length<=2e3?o:`${o.slice(0,2e3).trimEnd()}...`}function _(t,n){return n.filter(e=>t.includes(e))}var b=/\.(?:md|mdx|rst|txt)$/i;function nt(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var et=3,it=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function kt(t,n={}){let{doc:e,limit:i=20,minCoupling:r=et}=n,o=ct(t);if(!o)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let s=[];for(let c of o.docFiles){if(e!==void 0&&!c.includes(e)||e===void 0&&!W(t,c)||e!==void 0&&!G(x(t.config.projectRoot,c)))continue;let u=Math.max(0,...o.changeTimes.get(c)??[]),f=rt(t,c),d=new Map,{resolved:h,broken:l,citations:g}=dt(t,c,o.tracked,o.trackedBySuffix,o.everSeenInHistory),m=new Map(g.map(a=>[a.file,a.contexts]));for(let a of h){if(a===c||b.test(a))continue;let p=(o.changeTimes.get(a)??[]).filter(S=>S>u).length;p!==0&&d.set(a,{file:a,evidence:"reference",coChanges:0,changesSinceDocUpdate:p,...N("reference",f),citationContexts:m.get(a)})}for(let[a,p]of o.coupling.get(c)??[]){if(p<r||!o.tracked.has(a))continue;let S=(o.changeTimes.get(a)??[]).filter(T=>T>u).length;if(S===0)continue;let C=d.get(a);C?(C.evidence="both",C.coChanges=p,Object.assign(C,N("both",f))):d.set(a,{file:a,evidence:"co-change",coChanges:p,changesSinceDocUpdate:S,...N("co-change",f)})}if(d.size===0&&l.length===0)continue;let D=[...d.values()].sort((a,p)=>p.changesSinceDocUpdate-a.changesSinceDocUpdate);s.push({doc:c,docLastChangedAt:u,staleness:D.reduce((a,p)=>a+p.changesSinceDocUpdate,0)+l.length*10,subjects:D.slice(0,8),brokenReferences:l})}return s.sort((c,u)=>u.staleness-c.staleness),{available:!0,commitsAnalyzed:o.historyCommitCount,docsScanned:o.docFiles.length,findings:s.slice(0,i)}}function rt(t,n){let e;try{e=F(x(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
|
|
3
|
+
${e}`.toLowerCase(),r=_(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(r.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${r.join(", ")}`]};let o=_(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return o.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${o.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function N(t,n){return{actionTier:ot(t,n.docIntent),docIntent:n.docIntent,docIntentReasons:n.reasons}}function ot(t,n){return n==="historical-note"?"support":t==="co-change"?"signal":"direct"}function ct(t){let n=X(t);if(!n)return null;let e=R(t)??new Set,i=new Map,r=new Map,o=new Set;for(let s of n.commits){let c=[...new Set(s.files)],u=c.filter(d=>b.test(d)),f=c.filter(d=>!b.test(d));for(let d of c){o.add(d);let h=i.get(d)??[];h.push(s.timestamp),i.set(d,h)}for(let d of u){let h=r.get(d);h||(h=new Map,r.set(d,h));for(let l of f)h.set(l,(h.get(l)??0)+1)}}return{changeTimes:i,coupling:r,docFiles:[...e].filter(s=>b.test(s)),everSeenInHistory:o,historyCommitCount:n.commits.length,tracked:e,trackedBySuffix:Z(e)}}function At(t,n){if(n.size===0)return[];let e=P(),i=0,r=0,o=0,s=0,c=0,u=0;return z("doc-reference.docs-citing-files",()=>{let f=R(t)??new Set;i=f.size;let d=Z(f),h=st(n,d),l=[];for(let g of f){if(!W(t,g))continue;e&&(r+=1);let m;try{m=F(x(t.config.projectRoot,g),"utf-8")}catch{e&&(o+=1);continue}if(!ut(m,h)){e&&(s+=1);continue}let D=J(t,g,m);if(!D)continue;e&&(c+=1);let a=at(D.candidates,n,h,f,d);if(a.size===0)continue;let p=[...new Set([...a.values()].flatMap(y=>[...y]))],S=lt(D.contextsByCandidate,p),C=[...a].map(([y,k])=>({file:y,contexts:M([...k].flatMap(q=>S.get(q)??[])).slice(0,3)})).filter(y=>y.contexts.length>0),T=[...a.keys()];if(T.length>0){e&&(u+=1);let y=T.sort();l.push({doc:g,cited:y,citations:C,citedClaims:M(C.flatMap(k=>k.contexts)).slice(0,3)})}}return l},()=>({targets:n.size,trackedFiles:i,livingDocs:r,unreadableDocs:o,candidateMisses:s,evidenceDocs:c,citedDocs:u}))}function W(t,n){return b.test(n)&&!nt(n)&&G(x(t.config.projectRoot,n))}function Z(t){let n=new Map;for(let e of t){let i=e.split("/");for(let r of[2,3]){if(i.length<r)continue;let o=i.slice(-r).join("/"),s=n.get(o)??[];s.push(e),n.set(o,s)}}return n}function st(t,n){let e=new Set(t);for(let i of t){let r=i.split("/");for(let o of[2,3]){if(r.length<o)continue;let s=r.slice(-o).join("/"),c=n.get(s);c?.length===1&&c[0]===i&&e.add(s)}}return e}function at(t,n,e,i,r){let o=new Map;for(let s of t){if(!e.has(s))continue;let c;if(i.has(s))c=s;else{let f=r.get(s);f?.length===1&&(c=f[0])}if(!c||!n.has(c))continue;let u=o.get(c)??new Set;u.add(s),o.set(c,u)}return o}function dt(t,n,e,i,r){let o=new Set,s=new Set,c=J(t,n);if(!c)return{resolved:o,broken:[],citations:[]};let u=c.candidates,f=c.contextsByCandidate,d=new Map,h=(l,g)=>{let m=f.get(g);if(!m||m.length===0)return;let D=d.get(l)??[];D.push(...m),d.set(l,M(D).slice(0,3))};for(let l of u){if(e.has(l)){o.add(l),h(l,l);continue}let g=i.get(l);if(g&&g.length===1){o.add(g[0]),h(g[0],l);continue}g&&g.length>1||r.has(l)&&s.add(l)}return{resolved:o,broken:[...s],citations:[...d].map(([l,g])=>({file:l,contexts:g}))}}function lt(t,n){let e=new Map;for(let i of n){let r=t.get(i);r&&r.length>0&&e.set(i,[...r])}return e}function J(t,n,e){let i=e;if(i===void 0)try{i=F(x(t.config.projectRoot,n),"utf-8")}catch{return null}let r=j(t,n,i),o=O(t,"doc-path-evidence",n,r);if(o!==null){let c=ht(o);if(c)return c}let s=ft(i);return L(t,"doc-path-evidence",n,r,gt(s)),s}function ut(t,n){for(let e of n)if(t.includes(e))return!0;return!1}function ft(t){let n=t.split(/\r?\n/),e=new Set,i=new Map;for(let r=0;r<n.length;r+=1){let o=n[r]??"";for(let s of o.matchAll(it)){let c=s[0].replace(/^\.?\//,"");e.add(c);let u=U(n,r);if(u.length===0)continue;let f=i.get(c)??[];f.push(u),i.set(c,M(f).slice(0,3))}}return{candidates:[...e],contextsByCandidate:i}}function gt(t){let n={candidates:t.candidates,contextsByCandidate:[...t.contextsByCandidate.entries()]};return JSON.stringify(n)}function ht(t){try{let n=JSON.parse(t);if(!B(n))return null;let e=A(n.candidates),i=pt(n.contextsByCandidate);return!e||!i?null:{candidates:e,contextsByCandidate:new Map(i)}}catch{return null}}function pt(t){if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string")return null;let i=A(e[1]);if(!i)return null;n.push([e[0],i])}return n}function M(t){let n=[];for(let e of new Set(t))n.some(i=>mt(i,e))||n.push(e);return n}function mt(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),i=n.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),r=Math.min(e.length,i.length);if(r===0)return!1;if(r<3)return t.includes(n)||n.includes(t);let o=new Set(i),s=e.filter(c=>o.has(c)).length;return s>=3&&s/r>=.6}export{U as a,_ as b,nt as c,kt as d,At as e};
|
|
4
|
+
//# sourceMappingURL=chunk-P4KYUPBD.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as oe,b as ie,c as P,d as ae,e as pe,f as ce,g as j,h as me,i as F,j as le,k as ue,l as _,m as U,n as T,o as G,p as Y,q as S,r as K,s as Z,t as J,v as R,w as h,x as M,y as ee}from"./chunk-OBGRLXWF.js";import{b as ge}from"./chunk-YZA6PPZL.js";import{a as de,b as fe,d as C}from"./chunk-HF25DFSC.js";import{a as v}from"./chunk-DS6QEB3G.js";import{b as B,d as V,e as Q}from"./chunk-XUGQU7PM.js";import{c as L}from"./chunk-7S5E7KWT.js";import{basename as Se}from"path";var je=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(t){let r=[],e=0,s=0;for(let n=0;n<t.length;n++){let o=t[n];(o==="{"||o==="["||o==="(")&&e++,(o==="}"||o==="]"||o===")")&&e--,o===","&&e===0&&(r.push(t.slice(s,n)),s=n+1)}return r.push(t.slice(s)),r}function y(t,r){for(let e of t.namedChildren)if(e.type===r)return e;return null}function g(t,r){let e=new Set,s=(n,o)=>{let i=o||r.has(n.type);!i&&je.has(n.type)&&e.add(n.text);for(let a of n.children)s(a,i)};return s(t.rootNode,!1),e}function b(t,r,e,s,n,o,i){return{importedName:n,localName:o,sourcePath:i??S(t,s,ue(r)),kind:"named",used:h(e,o),usedMembers:[]}}function f(t,r,e,s,n="named",o={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s.has(r),usedMembers:[],isTypeOnly:o.isTypeOnly}}function $(t,r,e,s,n="named",o=[],i={}){return{importedName:t,localName:r,sourcePath:e,kind:n,used:s,usedMembers:o,isTypeOnly:i.isTypeOnly}}function O(t,r){return{importedName:t,localName:null,sourcePath:r,kind:"side-effect",used:!0,usedMembers:[]}}function D(t,r,e={}){return{importedName:t,localName:e.localName??null,sourcePath:r,kind:"namespace",used:e.used??!0,usedMembers:e.usedMembers??[],isTypeOnly:e.isTypeOnly}}function N(t,r,e){let s=[];for(let n of t.matchAll(r)){let o=n[0];if(!o||typeof n.index!="number")continue;let i=R(t,n.index,n.index+o.length);for(let a of e(n,i))s.push(a)}return s}function I(t,r,e,s){let n=C(t,r);if(n){let o=e(n);if(o)return o}return s()}function z(t,r,e,s){let n=C(t,r),o=de(r),i=o?e[o]:void 0;return n&&i?i(n):s()}function he(t,r,e){return I(t,r,s=>Me(t,r,s),()=>ve(t,r,e))}function ve(t,r,e){return N(e,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(s,n)=>{let o=s[1]?.trim();if(!o)return[];let i=Se(o).replace(/\.[^.]+$/,"");return[$(o,i,Y(t,r,o),h(n,i))]})}function Me(t,r,e){let s=g(e,new Set(["preproc_include"])),n=[];for(let o of e.rootNode.descendantsOfType("preproc_include")){let i=null;for(let p of o.namedChildren){if(p.type==="system_lib_string"){i=p.text.replace(/^<|>$/g,"");break}if(p.type==="string_literal"){i=p.namedChildren.find(m=>m.type==="string_content")?.text??p.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=Se(i).replace(/\.[^.]+$/,"");n.push(f(i,a,Y(t,r,i),s))}return n}function xe(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=n[1]?.trim(),i=n[2]?.trim()??null,a=n[0];if(!o||!a||typeof n.index!="number")continue;let p=R(e,n.index,n.index+a.length);s.push({importedName:o,localName:i,sourcePath:K(t,r,o),kind:i?"namespace":"side-effect",used:i?h(p,i):!0,usedMembers:i?M(p,i):[]})}return s}function ye(t,r,e){let s=[];for(let n of e.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=n[1]?.trim();o&&s.push({specifier:o,sourcePath:K(t,r,o)})}return s}function Ne(t,r,e){return z(t,r,{csharp:s=>qe(t,r,s),vb:s=>$e(t,r,s)},()=>{let s=le(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(e,s,(n,o)=>{let i=n[1]?.trim();if(!i)return[];let[a,p]=i.split(/\s*=\s*/),c=!!p,m=(c?p:a)?.trim()??i,l=m.split(".").pop()??m,u=c?a?.trim()??l:l;return[b(t,r,o,m,l,u,S(t,m,j))]})})}function $e(t,r,e){let s=g(e,new Set(["imports_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(u=>u.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],p=i.length>1?i[0]:null,c=a.text,m=c.split(".").pop()??c,l=p?.text??m;n.push(f(m,l,S(t,c,j),s,p?"namespace":"named"))}return n}function qe(t,r,e){let s=g(e,new Set(["using_directive"])),n=[];for(let o of e.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,p;i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],p=i[1]):p=i[i.length-1];let c=p.text,m=c.split(".").pop()??c,l=a?.text??m;n.push(f(m,l,S(t,c,j),s,a?"namespace":"named"))}return n}var Fe=L("vue-non-script-identifiers",{clearGroups:["whole-project","source-file"]});function Ie(t,r){return Fe.get(t,r,()=>{let e=new Set,s=v(t,r);if(!s)return e;let o=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))e.add(i[0]);return e})}function te(t,r,e){return I(t,r,s=>We(t,r,s),()=>Ue(t,r,e))}function Ue(t,r,e){return Ze(e).flatMap(s=>et(t,r,s.clause,s.specifier,s.start,s.end,e))}function We(t,r,e){let s=Je(t,r,e),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))n.push(...ze(t,r,e,o,s));return n}function Je(t,r,e){let s=g(e,new Set(["import_statement"]));if(fe(r))for(let n of Ie(t,r))s.add(n);return s}function ze(t,r,e,s,n){let o=Qe(s);if(!o)return[];let i=_(t,r,o),a=y(s,"import_clause");return a?Xe(e,a,i,n,Ge(s.text)):[O("*",i)]}function Xe(t,r,e,s,n){let o=[];for(let i of r.namedChildren)if(i.type==="identifier")o.push(He(i.text,e,s,n));else if(i.type==="namespace_import"){let a=Be(t,i,e,s,n);a&&o.push(a)}else i.type==="named_imports"&&o.push(...Ve(i,e,s,n));return o}function He(t,r,e,s){return f("default",t,r,e,"default",{isTypeOnly:s})}function Be(t,r,e,s,n){let i=y(r,"identifier")?.text??"";if(!i)return null;let a=Ke(t,i);return D("*",e,{localName:i,usedMembers:a,isTypeOnly:n,used:a.length>0||s.has(i)})}function Ve(t,r,e,s){let n=[];for(let o of t.namedChildren){if(o.type!=="import_specifier")continue;let i=o.namedChild(0),a=o.namedChild(1);if(!i)continue;let p=i.text,c=a?.text??p;n.push(f(p,c,r,e,"named",{isTypeOnly:s||Ye(o.text)}))}return n}function Qe(t){let r=y(t,"string");if(!r)return null;let e=y(r,"string_fragment");return e?e.text:null}function Ge(t){return/^\s*import\s+type\b/.test(t)}function Ye(t){return/^\s*type\b/.test(t.trim())}function Ke(t,r){let e=new Set;for(let s of t.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),o=s.namedChild(1);!n||!o||n.type!=="identifier"||n.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&e.add(o.text)}return[...e]}function Ze(t){let r=[],e=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(e)){let o=n[0],i=n[1],a=n[2];!o||!a||typeof n.index!="number"||r.push({clause:i,specifier:a,start:n.index,end:n.index+o.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of t.matchAll(s)){let o=n[0],i=n[1];!o||!i||typeof n.index!="number"||r.push({clause:null,specifier:i,start:n.index,end:n.index+o.length})}return r.sort((n,o)=>n.start-o.start)}function et(t,r,e,s,n,o,i){let a=_(t,r,s),p=R(i,n,o);return e?tt(e).map(m=>({...m,sourcePath:a})).map(m=>{if(m.kind==="namespace"){let l=M(p,m.localName);return D(m.importedName,m.sourcePath,{localName:m.localName,usedMembers:l,used:l.length>0||h(p,m.localName),isTypeOnly:m.isTypeOnly})}return m.kind==="side-effect"?O(m.importedName,m.sourcePath):$(m.importedName,m.localName??"",m.sourcePath,m.localName?h(p,m.localName):!1,m.kind,[],{isTypeOnly:m.isTypeOnly})}):[O("*",a)]}function tt(t){let r=t.trim(),e=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,o]=rt(s),i=[];return n&&i.push(...Pe(n,e)),o&&i.push(...Pe(o,e)),i}function Pe(t,r){let e=t.trim();if(!e)return[];if(e.startsWith("{")){let s=e.slice(1,-1).trim();return s?x(s).map(n=>{let o=n.trim(),i=r||/^type\b/.test(o),a=o.replace(/^type\s+/,""),[p,c]=a.split(/\s+as\s+/);return{importedName:p.trim(),localName:(c??p).trim(),kind:"named",isTypeOnly:i}}):[]}return e.startsWith("* as ")?[{importedName:"*",localName:e.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:e,kind:"default",isTypeOnly:r}]}function rt(t){let r=0;for(let e=0;e<t.length;e++){let s=t[e];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[t.slice(0,e).trim(),t.slice(e+1).trim()]}return[t.trim(),null]}function re(t,r,e){let s=C(t,r);return s?pt(t,r,s):st(t,r,e)}function st(t,r,e){return[...nt(t,r,e),...ot(t,r,e),...it(t,r,e)]}function nt(t,r,e){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=o[2]??"",p=x(i).map(l=>at(l.trim())).filter(l=>!!l),c=q(e,o.index),m=q(e,o.index+o[0].length-1);s.push({kind:"named",sourcePath:_(t,r,a),names:p,startLine:c,endLine:m})}return s}function ot(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[2]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star-as",sourcePath:_(t,r,i),names:[],startLine:a,endLine:p})}return s}function it(t,r,e){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let o of e.matchAll(n)){if(typeof o.index!="number")continue;let i=o[1]??"",a=q(e,o.index),p=q(e,o.index+o[0].length-1);s.push({kind:"star",sourcePath:_(t,r,i),names:[],startLine:a,endLine:p})}return s}function at(t){if(!t)return null;let r=t.replace(/^type\s+/,"").trim();if(!r)return null;let e=r.match(/^(\w+)\s+as\s+(\w+)$/);if(e)return e[2]??null;let s=r.match(/^(\w+)$/);return s?s[1]??null:null}function q(t,r){let e=0;for(let s=0;s<r&&s<t.length;s++)t.charCodeAt(s)===10&&e++;return e}function pt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("export_statement")){let o=ct(t,r,n);if(o===void 0)continue;let i=n.startPosition.row,a=n.endPosition.row,p=mt(n,o,i,a);s.push(p)}return s}function ct(t,r,e){let s=y(e,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return _(t,r,n.text)}function mt(t,r,e,s){let n=y(t,"export_clause");if(n){let i=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let p=a.namedChild(0),c=a.namedChild(1);p&&i.push((c??p).text)}return{kind:"named",sourcePath:r,names:i,startLine:e,endLine:s}}return y(t,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:e,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:e,endLine:s}}function be(t,r,e){return z(t,r,{java:s=>lt(t,r,s),kotlin:s=>ut(t,r,s),scala:s=>dt(t,r,s)},()=>N(e,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(s,n)=>{let o=s[1]?.trim();return o?ft(t,r,o,n):[]}))}function lt(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(l=>l.type==="asterisk"),p=o.namedChildren.find(l=>l.type==="scoped_identifier")??o.namedChildren.find(l=>l.type==="identifier");if(!p)continue;let c=p.text;if(i){n.push(D("*",S(t,c,P)));continue}let m=c.split(".").pop()??c;n.push(f(m,m,S(t,c,P),s))}return n}function ut(t,r,e){let s=g(e,new Set(["import_header","import_list"])),n=[];for(let o of e.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(d=>d.type==="identifier");if(!i)continue;let a=o.namedChildren.some(d=>d.type==="wildcard_import"),p=o.namedChildren.find(d=>d.type==="import_alias");if(a){n.push(D("*",S(t,i.text,P)));continue}let c=i.text,m=c.split(".").pop()??c,u=p?.namedChild(0)?.text??m;n.push(f(m,u,S(t,c,P),s))}return n}function dt(t,r,e){let s=g(e,new Set(["import_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(l=>l.type==="namespace_selectors"||l.type==="namespace_wildcard"),a=o.namedChildren.filter(l=>l!==i&&(l.type==="identifier"||l.type==="stable_identifier")),p=a.map(l=>l.text).join(".");if(!p)continue;if(i?.type==="namespace_wildcard"){n.push(D("*",S(t,p,P)));continue}if(i?.type==="namespace_selectors"){for(let l of i.namedChildren)if(l.type==="arrow_renamed_identifier"){let[u,d]=l.namedChildren;if(!u)continue;let E=u.text,A=d?.text??E;if(E==="_")continue;n.push(f(E,A,S(t,`${p}.${E}`,P),s))}else if(l.type==="identifier"){let u=l.text;n.push(f(u,u,S(t,`${p}.${u}`,P),s))}continue}let c=a[a.length-1]?.text??p,m=a.slice(0,-1).map(l=>l.text).join(".")||p;n.push(f(c,c,S(t,m&&a.length>1?`${m}.${c}`:p,P),s))}return n}function ft(t,r,e,s){if(e.includes("{")&&e.includes("}")){let n=e.slice(0,e.indexOf("{")).replace(/\.$/,"").trim(),o=e.slice(e.indexOf("{")+1,e.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,c]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),m=p?.trim();if(!m||m==="_")return[];let l=(c??m.split(".").pop()??m).trim(),u=m==="_"?n:`${n}.${m}`.replace(/\.\./g,".");return[b(t,r,s,u,m,l)]})}return[b(t,r,s,e,e.split(".").pop()??e,e.split(".").pop()??e)]}function _e(t,r,e){return I(t,r,s=>gt(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?x(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[p,c]=a.split(/\s+as\s+/i),m=p?.trim()??a,l=m.split("\\").pop()??m,u=(c??l).trim();return[b(t,r,n,m,l,u,S(t,m.replace(/\\/g,"."),F))]}):[]}))}function gt(t,r,e){let s=g(e,new Set(["namespace_use_declaration"])),n=[],o=(i,a,p)=>{n.push(f(a,p,S(t,i.replace(/\\/g,"."),F),s))};for(let i of e.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(p=>p.type==="namespace_use_group");if(a){let p=i.namedChildren.find(c=>c.type==="namespace_name")?.text??"";for(let c of a.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:m,localName:l,qualified:u}=Ee(c,p);m&&o(u,m,l)}continue}for(let p of i.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:c,localName:m,qualified:l}=Ee(p,"");c&&o(l,c,m)}}return n}function Ee(t,r){let e=t.namedChildren.find(c=>c.type==="qualified_name"),s=t.namedChildren.filter(c=>c.type==="name"),n="";e?n=e.text:s.length>=1&&(n=s[0].text);let o=e&&s.length>0?s[s.length-1]:null,i=n.split("\\").pop()??n,a=o?.text??i,p=r?`${r}\\${n}`:n;return{importedName:i,localName:a,qualified:p}}function Re(t,r,e){return I(t,r,s=>St(t,r,s),()=>xt(e).flatMap(s=>Nt(t,r,s,e)))}function St(t,r,e){let s=g(e,new Set(["import_statement","import_from_statement"])),n=[];for(let o of e.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=Te(i);if(!a)continue;let p=U(t,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:p,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let o of e.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=ht(i);if(a===null)continue;let p=U(t,r,a);for(let c=1;c<o.namedChildCount;c+=1){let m=o.namedChild(c);if(m.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:p,kind:"side-effect",used:!0,usedMembers:[]});continue}let l=Te(m);l&&n.push({importedName:l.qualifiedName,localName:l.localName,sourcePath:p,kind:"named",used:s.has(l.localName),usedMembers:[]})}}return n}function Te(t){if(t.type==="aliased_import"){let r=t.namedChild(0),e=t.namedChild(1);return!r||!e?null:{qualifiedName:r.text,localName:e.text}}if(t.type==="dotted_name"){let r=t.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return t.type==="identifier"?{qualifiedName:t.text,localName:t.text}:null}function ht(t){if(t.type==="dotted_name")return t.text;if(t.type==="relative_import"){let r=y(t,"import_prefix")?.text??"",e=y(t,"dotted_name")?.text??"";return`${r}${e}`}return null}function xt(t){let r=t.split(`
|
|
2
|
+
`),e=[],s=0;for(let n=0;n<r.length;n++){let o=r[n],i=o.trimStart(),a=s;if(s+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let p=o,c=a+o.length,m=ee(o);for(;n+1<r.length&&(m>0||p.trimEnd().endsWith("\\"));){n++;let u=r[n];p+=`
|
|
3
|
+
${u}`,c+=1+u.length,m+=ee(u),s+=u.length+1}let l=yt(p);l&&e.push({...l,start:a,end:c})}return e}function yt(t){let r=t.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let e=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!e)return null;let s=e[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:e[1],clause:s}}function Nt(t,r,e,s){let n=R(s,e.start,e.end),o=e.clause.replace(/\n/g," ").trim();if(e.kind==="import")return x(o).flatMap(p=>{let c=p.trim().replace(/,$/,"");if(!c)return[];let[m,l]=c.split(/\s+as\s+/),u=m.trim(),d=(l??u.split(".")[0]??u).trim(),E=U(t,r,u),A=M(n,d);return[{importedName:u,localName:d,sourcePath:E,kind:"namespace",used:h(n,d)||A.length>0,usedMembers:A}]});let i=e.module?U(t,r,e.module):null,a=[];for(let p of x(o)){let c=p.trim().replace(/,$/,"");if(!c)continue;if(c==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[m,l]=c.split(/\s+as\s+/),u=(l??m).trim();a.push({importedName:m.trim(),localName:u,sourcePath:i,kind:"named",used:h(n,u),usedMembers:[]})}return a}import{basename as It}from"path";function Ce(t,r,e){return I(t,r,s=>bt(t,r,s),()=>Pt(t,r,e))}function Pt(t,r,e){return N(e,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(s,n)=>{let o=s[1],i=s[2];if(!o||!i)return[];let a=o==="require_relative"?G(t,r,i):null;if(a){let p=Oe(i);return[$(p,p,a,h(n,p))]}return[O(i,a)]})}function bt(t,r,e){let s=g(e,new Set([])),n=[],o=new Set(["require","require_relative","load"]);for(let i of e.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let c=i.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!c||c.type!=="string")continue;let l=c.namedChildren.find(d=>d.type==="string_content")?.text;if(!l)continue;let u=a.text==="require_relative"?G(t,r,l):null;if(u){let d=Oe(l);n.push(f(d,d,u,s))}else n.push(O(l,u))}return n}function Oe(t){return ge(It(t).replace(/\.[^.]+$/,""),/_/)}function De(t,r,e){return I(t,r,s=>Et(t,r,s),()=>N(e,/^[ \t]*use\s+(.+?)\s*;$/gm,(s,n)=>{let o=s[1]?.trim();return o?_t(t,r,o,n):[]}))}function Et(t,r,e){let s=g(e,new Set(["use_declaration"])),n=[];for(let o of e.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of W(i,"")){if(!a.importedName||a.importedName==="*")continue;let p=T(t,r,a.qualifiedName)??T(t,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push(f(a.importedName,a.localName,p,s))}}return n}function W(t,r){switch(t.type){case"identifier":case"super":case"self":case"crate":{let e=t.text;return[{qualifiedName:X(r,e),importedName:e,localName:e}]}case"scoped_identifier":{let e=t.text,s=e.split("::").pop()??e;return[{qualifiedName:X(r,e),importedName:s,localName:s}]}case"scoped_use_list":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=X(r,e.text),o=[];for(let i of s.namedChildren)o.push(...W(i,n));return o}case"use_list":{let e=[];for(let s of t.namedChildren)e.push(...W(s,r));return e}case"use_as_clause":{let e=t.namedChild(0),s=t.namedChild(1);if(!e||!s)return[];let n=W(e,r),o=s.text;return n.map(i=>({...i,localName:o}))}case"use_wildcard":{let e=t.namedChild(0),s=e?e.text:"";return[{qualifiedName:X(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function X(t,r){return t?r?`${t}::${r}`:t:r}function _t(t,r,e,s){let n=e.trim();if(n.includes("{")&&n.includes("}")){let m=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),l=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return x(l).flatMap(u=>{let d=u.trim();if(!d||d==="self")return[];let[E,A]=d.split(/\s+as\s+/),w=E?.trim();if(!w)return[];let we=(A??w.split("::").pop()??w).trim(),Le=`${m}::${w}`.replace(/::::/g,"::");return[b(t,r,s,Le,w.split("::").pop()??w,we,T(t,r,m))]})}let[o,i]=n.split(/\s+as\s+/),a=o?.trim()??n,p=(i??a.split("::").pop()??a).trim(),c=T(t,r,a)??T(t,r,a.split("::").slice(0,-1).join("::"));return[b(t,r,s,a,a.split("::").pop()??a,p,c)]}function ke(t,r,e){let s=C(t,r);if(s)return Tt(t,r,s);let n=[];for(let o of e.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&n.push(...Ct(t,r,i))}return n}function Tt(t,r,e){let s=[];for(let n of e.rootNode.descendantsOfType("use_declaration")){if(!Rt(n))continue;let o=n.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of W(o,""))i.importedName&&s.push(se(t,r,i.qualifiedName))}return s}function Rt(t){for(let r of t.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function Ct(t,r,e){let s=e.trim();if(s.includes("{")&&s.includes("}")){let n=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),o=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return x(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[p]=a.split(/\s+as\s+/),c=`${n}::${p?.trim()??a}`.replace(/::::/g,"::");return[se(t,r,c)]})}return[se(t,r,s)]}function se(t,r,e){return{specifier:e,sourcePath:T(t,r,e)??T(t,r,e.split("::").slice(0,-1).join("::"))}}function k({language:t,extensions:r,imports:e,parseImports:s}){return{language:t,extensions:r,capabilities:{imports:e},parseImports:s}}function Ae(t,r){let e=r.toLowerCase();for(let s of t)for(let n of s.extensions)if(e.endsWith(n))return s;return null}var Ot={language:"javascript",extensions:oe,capabilities:{imports:"ast-with-regex-fallback",reExports:"ast-with-regex-fallback"},parseImports:te,parseReExports:re},Dt=k({language:"python",extensions:ie,imports:"ast-with-regex-fallback",parseImports:Re}),kt=k({language:"jvm",extensions:P,imports:"ast-dispatch-with-regex-fallback",parseImports:be}),At={language:"rust",extensions:ae,capabilities:{imports:"ast-with-regex-fallback",exports:"ast-with-regex-fallback"},parseImports:De,parseExports:ke},wt=k({language:"ruby",extensions:pe,imports:"ast-with-regex-fallback",parseImports:Ce}),Lt=k({language:"c/cpp",extensions:ce,imports:"ast-with-regex-fallback",parseImports:he}),jt=k({language:"dotnet",extensions:j,imports:"ast-dispatch-with-regex-fallback",parseImports:Ne}),vt={language:"dart",extensions:me,capabilities:{imports:"regex-only",exports:"regex-only"},parseImports:xe,parseExports:ye},Mt=k({language:"php",extensions:F,imports:"ast-with-regex-fallback",parseImports:_e}),$t=[Ot,Dt,kt,At,wt,Lt,jt,vt,Mt];function H(t){return Ae($t,t)}var ne={clearGroups:["whole-project","source-file"]},qt=L("source-imports",ne),Ft=L("source-exports",ne),Ut=L("source-reexports",ne);function ns(t,r){let e=J(r);return Ut.get(t,e,()=>{let s=H(e);if(!s?.parseReExports)return[];let n=v(t,e);if(!n)return[];let o=B(t,e,n),i=Z(t),a=V(t,"source-reexports",e,o);if(a!==null)try{let c=JSON.parse(a);if(c.resolutionFingerprint===i&&Array.isArray(c.reExports))return c.reExports}catch{}let p=s.parseReExports(t,e,n);return Q(t,"source-reexports",e,o,JSON.stringify({resolutionFingerprint:i,reExports:p})),p})}function os(t,r){let e=J(r);return qt.get(t,e,()=>{let s=H(e);if(!s)return[];let n=v(t,e);if(!n)return[];let o=B(t,e,n),i=Z(t),a=V(t,"source-imports",e,o);if(a!==null)try{let c=JSON.parse(a);if(c.resolutionFingerprint===i&&Array.isArray(c.imports))return c.imports}catch{}let p=s.parseImports(t,e,n);return Q(t,"source-imports",e,o,JSON.stringify({resolutionFingerprint:i,imports:p})),p})}function is(t,r){let e=J(r);return Ft.get(t,e,()=>{let s=H(e);if(!s?.parseExports)return[];let n=v(t,e);return n?s.parseExports(t,e,n):[]})}export{ns as a,os as b,is as c};
|
|
4
|
+
//# sourceMappingURL=chunk-P5RYBRIO.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-TK7O5ER5.js";import{a as g,c as m}from"./chunk-JM72FNGA.js";function _(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
|
|
2
2
|
WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,h=1;s>=0;s--,h++){let p=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:p,shortName:p,depth:h})}return b}export{_ as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-P753MDDE.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as oe}from"./chunk-FG4NT6VY.js";import{a as ne}from"./chunk-VOYOYC5T.js";import{a as te}from"./chunk-FHWEEQVO.js";import{a as ie}from"./chunk-EKECQP6Z.js";import{a as re}from"./chunk-2H57MJLI.js";import{a as Z}from"./chunk-XWC67C3Q.js";import{a as ee}from"./chunk-KLXVEBVC.js";import{a as p}from"./chunk-B32FX5KB.js";import{a as J}from"./chunk-I274B3B3.js";import{a as X}from"./chunk-X3Z4MLVL.js";import{a as Q}from"./chunk-C2QSK7E7.js";import{c as Y}from"./chunk-4TMJDHC6.js";import{a as j}from"./chunk-5GVOJOBL.js";import{a as G}from"./chunk-63MSELOP.js";import{a as q}from"./chunk-JYSAYZNX.js";import{a as W}from"./chunk-VAXDTQHE.js";import{a as T,b as U}from"./chunk-FVA3NH4P.js";import{b as N}from"./chunk-C6BYNIH4.js";import{b as I,c as z}from"./chunk-KRGBLZT2.js";import{a as K}from"./chunk-J6ADQKQA.js";import{a as O}from"./chunk-AA7L7GKI.js";import{f as A,g as k}from"./chunk-ANIOISCE.js";function m(e){return e.scoreCount??e.count}function M(e){let r=Me(e),{breakdown:t,pressure:i}=Be(e),o=se(t,"risk"),n=se(t,"hygiene");return{score:Math.min(o,n),riskScore:o,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,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:Ae(e),validation:Te(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function Ae(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:ke(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 ke(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:l(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function Te(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,n=0,a=0;for(let[b,g]of Object.entries(r))i.has(b)?o+=g.fixChanges:(n+=g.fixChanges,a+=1);let d=i.size>0?l(o/i.size):0,h=a>0?l(n/a):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=l(H/f.size);S[b]={flaggedFiles:f.size,fixDensity:x,lift:h>0?l(x/h):null}}return{flaggedFiles:i.size,flaggedFixDensity:d,baselineFixDensity:h,ratio:i.size>0&&h>0?l(d/h):null,byCategory:S}}function l(e){return Math.round(e*100)/100}function ce(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?"":` (${ce(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} (${ce(t)} score-weighted)`}function Me(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,n)=>{let a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var ae={"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 se(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 Be(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(u,y,C)=>{y>0&&i.push({axis:u,points:y,detail:C,kind:ae[u]??"hygiene"})},a=(u,y,C,we,Pe,Re,De)=>{let w=Math.max(we,1);if(C<=w)return;let D=C/w,E=Math.min(Pe,Math.ceil(Math.log2(D)*Re));if(E<=0)return;let Ee=ae[u]??"hygiene";o.push({axis:u,category:y,kind:Ee,count:C,threshold:l(w),ratio:l(D),extraPenalty:E}),n(u,E,`${C} ${De} exceed pressure threshold ${l(w)} (${l(D)}x)`)},d=e.dead.count/t;n("dead-code",Math.min(20,Math.round(d*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let h=e.isolated.count/t;n("isolated",Math.min(10,Math.round(h*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let S=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(S)),`${e.similarCount} similar function pair(s)`);let b=e.reactComponentDuplicates.count/r*1e3;n("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;n("react-hook-candidates",Math.min(10,Math.round(f)),v(e.reactHookCandidates,"duplicated React behavior pair(s)"));let H=e.reactLargeComponentPressure.count/r*1e3;n("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;n("vue-component-duplicates",Math.min(10,Math.round(x)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let L=m(e.vueComposableCandidates),xe=L/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(xe)),v(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Le=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(Le/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let _=m(e.wrappers);n("wrappers",Math.min(3,_),v(e.wrappers,"wrapper candidate(s)"));let F=m(e.passthroughs);n("passthroughs",Math.min(3,F),v(e.passthroughs,"passthrough candidate(s)")),n("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let ye=e.drift.direct/r;if(n("drift",Math.min(5,Math.round(ye*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let u=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling",Math.min(5,Math.ceil(u/10)),v({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:u},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let u=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",u,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",g,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",L,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",_,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",F,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("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 Ve}from"v8";var $e=64*1024*1024;function B(){let e=globalThis.gc;if(!e)return;let r=Ve();r.heap_size_limit-r.used_heap_size<$e||e()}var _e=50,Fe=75e3,Ie=5e3,ue=2500,le=50,ze=10,Ne=["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"],me={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:We(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:qe(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:je(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:Ge(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:Xe(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Qe(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:Je(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Ke(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Ze(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:et(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Ye(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:tt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:rt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:it(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:at(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:st(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:ot(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:nt(e,t)})};function jt(e,r={}){return he(e,r.full!==!1,(t,i)=>{let o=Ue(e,r.scope,t,i);return M(o)})}function Gt(e,r,t={}){return Oe(e,[r],t)[0]}function Oe(e,r,t={}){return he(e,t.full!==!1,(i,o)=>{let n={...o,releaseCachesBetweenPhases:!1};return r.map(a=>me[a](e,t.scope,n,i))})}function he(e,r,t){let i=Q(e),o=ct(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),B()}}function Yt(e){return M(ge(e))}function ge(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:de(e,"git-evidence")?.gitEvidence??null,suppressions:de(e,"suppressions")?.suppressions??null}}function de(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 Ue(e,r,t,i){return ge(Ne.map(o=>me[o](e,r,i,t)))}function We(e,r,t){return s(e,t,"dead",()=>{let i=U(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit});return R(dt(e,i.symbols))})}function qe(e,r,t){return s(e,t,"isolated",()=>{let i=j(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit});return R(pt(e,i))})}function je(e,r,t){return s(e,t,"cycles",()=>O(e,{scope:r}).filter(o=>o.kind==="real").length)}function Ge(e,r,t){return s(e,t,"similar",()=>Y(e,{scope:r,...p.similar,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function Ye(e,r,t){return s(e,t,"extract-candidates",()=>q(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function Xe(e,r,t){return s(e,t,"react-component-duplicates",()=>{let i=Z(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Qe(e,r,t){return s(e,t,"react-hook-candidates",()=>{let i=ee(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Ce(i,ht)})}function Je(e,r,t){return s(e,t,"react-large-component-pressure",()=>{let i=te(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return mt(i)})}function Ke(e,r,t){return s(e,t,"vue-component-duplicates",()=>{let i=re(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Ze(e,r,t){return s(e,t,"vue-composable-candidates",()=>{let i=ie(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Ce(i,gt)})}function et(e,r,t){return s(e,t,"vue-large-view-pressure",()=>{let i=oe(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return R(i)})}function tt(e,r,t){return s(e,t,"wrapper-candidates",()=>{let i=J(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,ft)})}function rt(e,r,t){return s(e,t,"passthrough-candidates",()=>{let i=G(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,Ct)})}function it(e,r,t){return s(e,t,"stale-abstractions",()=>{let i=X(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function ot(e,r){return s(e,r,"git-evidence",()=>{let t=I(e);if(!t)return null;let i=N(e,void 0,{limit:r.candidateResultLimit}),o={};for(let[n,a]of t)o[n]={changes:a.changes,fixChanges:a.fixChanges};return{amplification:z(e),hiddenCoupling:{pairCount:i.findings.length,scoreCount:$(i.findings.reduce((n,a)=>n+pe(a),0)),top:i.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:pe(n),subjectContext:n.subjectContext}))},fileStats:o}})}function nt(e,r){return s(e,r,"suppressions",()=>{let t=ne(e);return{total:t.total,byCategory:{...t.byCategory}}})}function at(e,r,t){return s(e,t,"drift",()=>{let i=W(e,{scope:r,...p.drift}),o=i.results.filter(d=>d.kind!=="pattern-deviation"),n=o.filter(d=>d.actionTier==="direct").length,a=o.length-n;return{count:o.length,unusedImports:i.unusedImports,layerViolations:i.layerViolations,direct:n,signal:a}})}function st(e,r,t){return s(e,t,"complexity-hotspots",()=>{let i=K(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 ct(e,r){let t=e.symbols>=Fe||e.documents>=Ie,i=r?Number.POSITIVE_INFINITY:le,o=r?Number.POSITIVE_INFINITY:ze;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:ue,candidateResultLimit:i,complexityResultLimit:o,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${ue} symbols and reported their top ${le} findings. Enable full mode for unbounded candidate counts.`]}}function ut(e,r){r.releaseCachesBetweenPhases&&(T(e),B())}function s(e,r,t,i){lt(t);try{return i()}finally{ut(e,r)}}function lt(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function dt(e,r){return r.filter(t=>!A(e,t.relativePath)&&!k(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function pt(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 fe(e,r){return{...R(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function mt(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 Ce(e,r){return{...V(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function ht(e){let r=e.sharedHooks.length>0,t=be({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:ve(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function gt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=be({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:ve(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function be(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!He.has(Se(r))).length+Math.min(e.functions.length,3)}function ve(e,r,t){let i=[...e,...r,...t].map(Se);return i.length>0&&i.every(o=>He.has(o))}function Se(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function ft(e){return e.actionTier==="signal"?.25:1}function Ct(e){return e.actionTier==="signal"?.25:1}function pe(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 He=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{Ne as a,jt as b,Gt as c,Oe as d,Yt as e};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as oe}from"./chunk-FG4NT6VY.js";import{a as ne}from"./chunk-VOYOYC5T.js";import{a as te}from"./chunk-QPU7EXAW.js";import{a as ie}from"./chunk-LZHUWKGD.js";import{a as re}from"./chunk-HHN2B5KA.js";import{a as Z}from"./chunk-FAYI6KZ5.js";import{a as ee}from"./chunk-RVWSAMTT.js";import{a as p}from"./chunk-B32FX5KB.js";import{a as J}from"./chunk-7IVSJJZU.js";import{a as X}from"./chunk-AVWPHM2Q.js";import{a as Q}from"./chunk-C2QSK7E7.js";import{d as Y}from"./chunk-CW5YFOCP.js";import{a as j}from"./chunk-O6ZH6C6Y.js";import{a as G}from"./chunk-WUCEKFQC.js";import{a as q}from"./chunk-M4COR2H6.js";import{a as W}from"./chunk-6QSOCTZT.js";import{a as T,b as U}from"./chunk-USPV3T5K.js";import{b as N}from"./chunk-65AU3HFZ.js";import{b as I,c as z}from"./chunk-BSN22NRK.js";import{a as K}from"./chunk-GQBMH2TQ.js";import{a as O}from"./chunk-QYB5P7GL.js";import{f as A,g as k}from"./chunk-C5CTSJ6X.js";function m(e){return e.scoreCount??e.count}function M(e){let r=Me(e),{breakdown:t,pressure:i}=Be(e),o=se(t,"risk"),n=se(t,"hygiene");return{score:Math.min(o,n),riskScore:o,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,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:Ae(e),validation:Te(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function Ae(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:ke(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 ke(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:l(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function Te(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,n=0,a=0;for(let[b,g]of Object.entries(r))i.has(b)?o+=g.fixChanges:(n+=g.fixChanges,a+=1);let d=i.size>0?l(o/i.size):0,h=a>0?l(n/a):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=l(H/f.size);S[b]={flaggedFiles:f.size,fixDensity:x,lift:h>0?l(x/h):null}}return{flaggedFiles:i.size,flaggedFixDensity:d,baselineFixDensity:h,ratio:i.size>0&&h>0?l(d/h):null,byCategory:S}}function l(e){return Math.round(e*100)/100}function ce(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?"":` (${ce(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} (${ce(t)} score-weighted)`}function Me(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,n)=>{let a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var ae={"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 se(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 Be(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(u,y,C)=>{y>0&&i.push({axis:u,points:y,detail:C,kind:ae[u]??"hygiene"})},a=(u,y,C,we,Pe,Re,De)=>{let w=Math.max(we,1);if(C<=w)return;let D=C/w,E=Math.min(Pe,Math.ceil(Math.log2(D)*Re));if(E<=0)return;let Ee=ae[u]??"hygiene";o.push({axis:u,category:y,kind:Ee,count:C,threshold:l(w),ratio:l(D),extraPenalty:E}),n(u,E,`${C} ${De} exceed pressure threshold ${l(w)} (${l(D)}x)`)},d=e.dead.count/t;n("dead-code",Math.min(20,Math.round(d*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let h=e.isolated.count/t;n("isolated",Math.min(10,Math.round(h*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let S=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(S)),`${e.similarCount} similar function pair(s)`);let b=e.reactComponentDuplicates.count/r*1e3;n("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;n("react-hook-candidates",Math.min(10,Math.round(f)),v(e.reactHookCandidates,"duplicated React behavior pair(s)"));let H=e.reactLargeComponentPressure.count/r*1e3;n("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;n("vue-component-duplicates",Math.min(10,Math.round(x)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let L=m(e.vueComposableCandidates),xe=L/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(xe)),v(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Le=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(Le/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let _=m(e.wrappers);n("wrappers",Math.min(3,_),v(e.wrappers,"wrapper candidate(s)"));let F=m(e.passthroughs);n("passthroughs",Math.min(3,F),v(e.passthroughs,"passthrough candidate(s)")),n("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let ye=e.drift.direct/r;if(n("drift",Math.min(5,Math.round(ye*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let u=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling",Math.min(5,Math.ceil(u/10)),v({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:u},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let u=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",u,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",g,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",L,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",_,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",F,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("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 Ve}from"v8";var $e=64*1024*1024;function B(){let e=globalThis.gc;if(!e)return;let r=Ve();r.heap_size_limit-r.used_heap_size<$e||e()}var _e=50,Fe=75e3,Ie=5e3,ue=2500,le=50,ze=10,Ne=["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"],me={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:We(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:qe(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:je(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:Ge(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:Xe(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Qe(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:Je(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Ke(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Ze(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:et(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Ye(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:tt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:rt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:it(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:at(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:st(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:ot(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:nt(e,t)})};function jt(e,r={}){return he(e,r.full!==!1,(t,i)=>{let o=Ue(e,r.scope,t,i);return M(o)})}function Gt(e,r,t={}){return Oe(e,[r],t)[0]}function Oe(e,r,t={}){return he(e,t.full!==!1,(i,o)=>{let n={...o,releaseCachesBetweenPhases:!1};return r.map(a=>me[a](e,t.scope,n,i))})}function he(e,r,t){let i=Q(e),o=ct(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),B()}}function Yt(e){return M(ge(e))}function ge(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:de(e,"git-evidence")?.gitEvidence??null,suppressions:de(e,"suppressions")?.suppressions??null}}function de(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 Ue(e,r,t,i){return ge(Ne.map(o=>me[o](e,r,i,t)))}function We(e,r,t){return s(e,t,"dead",()=>{let i=U(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit});return R(dt(e,i.symbols))})}function qe(e,r,t){return s(e,t,"isolated",()=>{let i=j(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit});return R(pt(e,i))})}function je(e,r,t){return s(e,t,"cycles",()=>O(e,{scope:r}).filter(o=>o.kind==="real").length)}function Ge(e,r,t){return s(e,t,"similar",()=>Y(e,{scope:r,...p.similar,scanLimit:t.candidateScanLimit}))}function Ye(e,r,t){return s(e,t,"extract-candidates",()=>q(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function Xe(e,r,t){return s(e,t,"react-component-duplicates",()=>{let i=Z(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Qe(e,r,t){return s(e,t,"react-hook-candidates",()=>{let i=ee(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Ce(i,ht)})}function Je(e,r,t){return s(e,t,"react-large-component-pressure",()=>{let i=te(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return mt(i)})}function Ke(e,r,t){return s(e,t,"vue-component-duplicates",()=>{let i=re(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Ze(e,r,t){return s(e,t,"vue-composable-candidates",()=>{let i=ie(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Ce(i,gt)})}function et(e,r,t){return s(e,t,"vue-large-view-pressure",()=>{let i=oe(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return R(i)})}function tt(e,r,t){return s(e,t,"wrapper-candidates",()=>{let i=J(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,ft)})}function rt(e,r,t){return s(e,t,"passthrough-candidates",()=>{let i=G(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return fe(i,Ct)})}function it(e,r,t){return s(e,t,"stale-abstractions",()=>{let i=X(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function ot(e,r){return s(e,r,"git-evidence",()=>{let t=I(e);if(!t)return null;let i=N(e,void 0,{limit:r.candidateResultLimit}),o={};for(let[n,a]of t)o[n]={changes:a.changes,fixChanges:a.fixChanges};return{amplification:z(e),hiddenCoupling:{pairCount:i.findings.length,scoreCount:$(i.findings.reduce((n,a)=>n+pe(a),0)),top:i.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:pe(n),subjectContext:n.subjectContext}))},fileStats:o}})}function nt(e,r){return s(e,r,"suppressions",()=>{let t=ne(e);return{total:t.total,byCategory:{...t.byCategory}}})}function at(e,r,t){return s(e,t,"drift",()=>{let i=W(e,{scope:r,...p.drift,includePatternDeviations:!1}),o=i.results.filter(d=>d.kind!=="pattern-deviation"),n=o.filter(d=>d.actionTier==="direct").length,a=o.length-n;return{count:o.length,unusedImports:i.unusedImports,layerViolations:i.layerViolations,direct:n,signal:a}})}function st(e,r,t){return s(e,t,"complexity-hotspots",()=>{let i=K(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 ct(e,r){let t=e.symbols>=Fe||e.documents>=Ie,i=r?Number.POSITIVE_INFINITY:le,o=r?Number.POSITIVE_INFINITY:ze;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:ue,candidateResultLimit:i,complexityResultLimit:o,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${ue} symbols and reported their top ${le} findings. Enable full mode for unbounded candidate counts.`]}}function ut(e,r){r.releaseCachesBetweenPhases&&(T(e),B())}function s(e,r,t,i){lt(t);try{return i()}finally{ut(e,r)}}function lt(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function dt(e,r){return r.filter(t=>!A(e,t.relativePath)&&!k(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function pt(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 fe(e,r){return{...R(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function mt(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 Ce(e,r){return{...V(e),scoreCount:$(e.reduce((i,o)=>i+r(o),0))}}function ht(e){let r=e.sharedHooks.length>0,t=be({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:ve(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function gt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=be({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:ve(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function be(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!He.has(Se(r))).length+Math.min(e.functions.length,3)}function ve(e,r,t){let i=[...e,...r,...t].map(Se);return i.length>0&&i.every(o=>He.has(o))}function Se(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function ft(e){return e.actionTier==="signal"?.25:1}function Ct(e){return e.actionTier==="signal"?.25:1}function pe(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 He=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{Ne as a,jt as b,Gt as c,Oe as d,Yt as e};
|
|
2
|
+
//# sourceMappingURL=chunk-P7AL7Y37.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as D}from"./chunk-LZHUWKGD.js";import{a as F}from"./chunk-HHN2B5KA.js";import{a as f}from"./chunk-FAYI6KZ5.js";import{a as g}from"./chunk-RVWSAMTT.js";import{c as y}from"./chunk-CW5YFOCP.js";import{e as h}from"./chunk-BSN22NRK.js";import{d as p}from"./chunk-A536TEU4.js";var v=.7,R=.62,S=.45;function Y(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=h(i);if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let l=I(s,e);if(l.size===0)return{available:!0,windowCommits:e,findings:[]};let d=A(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:l}).map(r=>w(r,s,e)).filter(r=>r!==null);d.sort((r,c)=>(r.kind===c.kind?0:r.kind==="echo"?-1:1)||c.similarity-r.similarity||r.echoFile.localeCompare(c.echoFile)||r.echoSymbol.localeCompare(c.echoSymbol)||r.domain.localeCompare(c.domain));let b=d.slice(0,n).map(T);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:N(b)}}function A(i,t){let e=K(t.limit),n=[...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??v,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=p(i,{scope:t.scope});return a.react&&n.push(...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function B(i,t){return y(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function k(i,t){return u(i,t,{query:f,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:P(...e.evidenceBuckets(n)),sharedCallees:[]}))}function E(i,t){return u(i,t,{query:g,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}function L(i,t){return u(i,t,{query:F,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function x(i,t){return u(i,t,{query:D,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function I(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function w(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let l=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:a)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function T(i){let t=C(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function C(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??C(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:O(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let l of n.sharedEvidence)s.sharedEvidence.add(l)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function O(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function P(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{Y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QLAUCRDJ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{e as l}from"./chunk-HF25DFSC.js";function S(e,n={}){let{minComponentLines:o=300,minFileLines:t=800,minJsxTokens:r=80,minBehaviorTokens:a=40,limit:m=20,scope:c,scanLimit:p,filePattern:i}=n;return l(e,{scope:c,scanLimit:p}).filter(s=>s.kind==="component").filter(s=>!i||s.file.includes(i)||s.name.includes(i)).map(s=>g(s,{minComponentLines:o,minFileLines:t,minJsxTokens:r,minBehaviorTokens:a})).filter(s=>s!==null).sort((s,u)=>u.componentLines-s.componentLines||u.fileLines-s.fileLines||s.file.localeCompare(u.file)).slice(0,m)}function g(e,n){let o=[];e.loc>=n.minComponentLines&&o.push(`${e.loc} component line(s)`);let t=Math.max(80,Math.floor(n.minComponentLines/2));if(e.fileLines>=n.minFileLines&&e.loc>=t&&o.push(`${e.fileLines} file line(s)`),e.jsxTokens.size>=n.minJsxTokens&&o.push(`${e.jsxTokens.size} JSX structure token(s)`),e.behaviorTokens.size>=n.minBehaviorTokens&&o.push(`${e.behaviorTokens.size} behavior token(s)`),o.length===0)return null;let r=x(e),a=C(e,n,r),m=f(e),c=b(r,a,m);return{file:e.file,component:e.name,componentLines:e.loc,fileLines:e.fileLines,jsxTokens:e.jsxTokens.size,behaviorTokens:e.behaviorTokens.size,dominantPressure:r,pressureKinds:a,contextKind:m,recommendationKind:c,recommendation:R(c,m),reasons:o,loc:e.loc}}function x(e){let n=[{axis:"component",value:e.loc},{axis:"file",value:e.fileLines},{axis:"jsx-structure",value:e.jsxTokens.size*3},{axis:"hook-behavior",value:e.behaviorTokens.size*4}];return n.sort((o,t)=>t.value-o.value),n[0]?.axis??"component"}function C(e,n,o){let t=[];e.loc>=n.minComponentLines&&t.push("component");let r=Math.max(80,Math.floor(n.minComponentLines/2));return e.fileLines>=n.minFileLines&&e.loc>=r&&t.push("file"),e.jsxTokens.size>=n.minJsxTokens&&t.push("jsx-structure"),e.behaviorTokens.size>=n.minBehaviorTokens&&t.push("hook-behavior"),[...new Set(t.length>0?t:[o])]}function f(e){let n=e.file.split(/[\\/]+/).filter(Boolean),o=n.slice(0,-1).map(i=>i.toLowerCase()),t=(n.at(-1)??e.name).replace(/\.[^.]+$/,""),r=`${t} ${e.name}`.split(/[^A-Za-z0-9]+/).filter(Boolean).map(i=>i.toLowerCase()),a=o.findIndex(i=>v.has(i)),m=a>=0&&o.slice(a+1).some(i=>h.has(i)),c=d(t)||d(e.name);return/(?:Page|Route|Screen|View)$/.test(t)||/(?:Page|Route|Screen|View)$/.test(e.name)||r.some(i=>k.has(i))||a>=0&&!m&&!c?"route-page":"component"}function d(e){let n=e.split(/[^A-Za-z0-9]+/).filter(Boolean).map(o=>o.toLowerCase());return n.at(-1)&&L.has(n.at(-1))?!0:[...L].some(o=>e.endsWith(T(o)))}function b(e,n,o){return e==="hook-behavior"?"behavior-extraction":o==="route-page"?"route-page-decomposition":n.includes("hook-behavior")?"behavior-extraction":n.includes("jsx-structure")?"jsx-decomposition":n.includes("file")?"file-decomposition":e==="jsx-structure"?"jsx-decomposition":e==="file"&&!n.includes("component")?"file-decomposition":"component-decomposition"}function R(e,n){switch(e){case"behavior-extraction":return"Extract independent state, effects, requests, or handlers into hooks, controllers, or feature modules.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"jsx-decomposition":return n==="route-page"?"Split page JSX into named layout sections before extracting behavior.":"Split repeated JSX sections into named presentational components.";case"file-decomposition":return"Review file-level decomposition; split colocated panels or helpers before changing behavior.";case"component-decomposition":return"Review component boundaries around props, state ownership, and independently changing UI sections."}}var h=new Set(["component","components","panel","panels","partial","partials"]),L=new Set(["banner","button","card","dialog","drawer","filter","form","grid","header","item","list","menu","modal","nav","panel","picker","rail","row","section","selector","shell","sidebar","table","toolbar"]),v=new Set(["landing","page","pages","route","routes","screen","screens","view","views"]),k=new Set(["landing","page","route","screen","view"]);function T(e){return e.charAt(0).toUpperCase()+e.slice(1)}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QPU7EXAW.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-C5CTSJ6X.js";import{a as B}from"./chunk-VUKC6F77.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-QYB5P7GL.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as k}from"./chunk-JCLDUKT6.js";import{e as g,g as R,h as M,i as C,o as D}from"./chunk-KDFONWTW.js";import{e as h}from"./chunk-OLTESY4K.js";import{g as S}from"./chunk-2KHTSEIL.js";import{d as y}from"./chunk-JM72FNGA.js";import{d as p,f as b}from"./chunk-72KY2ZFO.js";import{a as d}from"./chunk-HF25DFSC.js";import{a as m}from"./chunk-64MNV6AB.js";function L(e,n,t={}){let o=new Map;if(n&&n.length===0)return o;let r=m(e,{includeIgnored:!1}),a=C(e),i=n??S(e),l=new Set(i.map(c=>c.symbolId)),s=F(i);return I(e,o,r,a,l,s),w(e,o,i,l),_(e,o,r,a,l,s),t.semantic!==!1&&V(o,h(e,j(i))),o}function I(e,n,t,o,r,a){for(let i of t){if(!d(i))continue;let l=p(e,i);if(l)for(let s of l){if(a&&!a.has(s.calleeLeaf))continue;let c=R(i,o.get(s.calleeLeaf)??[]);if(!c||c.length===0)continue;let f=M(e,i,c,s.memberAccess);f&&r.has(f.symbolId)&&f.file!==i&&u(n,f.symbolId,i)}}}function w(e,n,t,o){let r=x(t);for(let a of v(e,o))e.isIgnored(a.relative_path)||A(a,r.get(a.symbol_id))||u(n,a.symbol_id,a.relative_path)}function v(e,n){return g(e,n?[...n]:void 0)}function x(e){let n=new Map;for(let t of e)n.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return n}function A(e,n){return!!n&&n.docId===e.document_id&&e.chunk_start>=n.startLine&&e.chunk_end<=n.endLine}function _(e,n,t,o,r,a){for(let i of t){if(d(i)!=="rust")continue;let l=b(e,i,{includeRustAttributeNames:!0});if(l.length!==0)for(let{name:s}of l){if(a&&!a.has(s))continue;let c=o.get(s);if(c)for(let f of c)r.has(f.symbolId)&&f.file!==i&&u(n,f.symbolId,i)}}}function u(e,n,t){let o=e.get(n);o||(o=new Set,e.set(n,o)),o.add(t)}function F(e){let n=new Set;for(let t of e){let o="leaf"in t&&typeof t.leaf=="string"?t.leaf:"symbol"in t&&typeof t.symbol=="string"?y(t.symbol):"";o&&n.add(o)}return n.size>0?n:null}function j(e){return e.filter(n=>"relativePath"in n&&"symbol"in n&&"leaf"in n)}function V(e,n){for(let[t,o]of n){let r=e.get(t);r||(r=new Set,e.set(t,r));for(let a of o)r.add(a)}}function W(e,n,t={}){return k(e,n,t)}function K(e,n,t={}){return L(e,n,t)}function G(e,n){return D(e,n)}function X(e,n,t={}){let o=K(e,n,{semantic:t.semantic});return t.sourceFallback===!1?o:E(o,G(e,n))}function E(e,n){let t=new Map;for(let[o,r]of e)t.set(o,new Set(r));for(let[o,r]of n){let a=t.get(o)??new Set;for(let i of r)a.add(i);t.set(o,a)}return t}export{W as a,K as b,G as c,X as d,E as e};
|
|
2
|
+
//# sourceMappingURL=chunk-RNM6LMCF.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p,b as H,c as d,d as u}from"./chunk-BZ53S4ZN.js";import{a as b}from"./chunk-3VD3JMK2.js";import{a as R,b as g}from"./chunk-YWOOQ4FF.js";import{e as v}from"./chunk-HF25DFSC.js";function F(e,r={}){let{minSimilarity:h=.45,minSharedBehaviors:c=6,limit:t=20,scope:n,scanLimit:a,filePattern:l,focusFiles:f}=r,i=v(e,{scope:n,minBehaviorTokens:Math.max(3,c),scanLimit:a}).map(s=>({file:s.file,component:s.name,tokens:s.behaviorTokens,profile:s}));return b({profiles:i,limit:t,filePattern:l,focusFiles:f,compare:(s,o)=>y(s,o,h,c),sort:(s,o)=>o.similarity-s.similarity||s.fileA.localeCompare(o.fileA)||s.componentA.localeCompare(o.componentA)||s.fileB.localeCompare(o.fileB)||s.componentB.localeCompare(o.componentB)})}function y(e,r,h,c){let t=R(e.tokens,r.tokens);if(t.size<c||!A(t))return null;let n=H(e.tokens,r.tokens);if(n<h)return null;let a=d(t,"hook:"),l=d(t,"react-hook:"),f=d(t,"effect:"),i=d(t,"state:"),s=d(t,"request:"),o=d(t,"handler:"),k=d(t,"handler-verb:"),m=B({sharedHooks:a,sharedReactHooks:l,sharedEffects:f,sharedState:i,sharedRequests:s,sharedHandlers:o,sharedHandlerVerbs:k});return{fileA:e.file,componentA:e.component,fileB:r.file,componentB:r.component,similarity:n,sharedTokens:u(t),sharedHooks:a,sharedReactHooks:l,sharedEffects:f,sharedState:i,sharedRequests:s,sharedHandlers:o,sharedHandlerVerbs:k,evidenceClass:m.evidenceClass,actionTier:m.actionTier,evidenceClassReasons:m.reasons,recommendation:m.recommendation,uniqueToA:u(g(e.tokens,r.tokens)).slice(0,25),uniqueToB:u(g(r.tokens,e.tokens)).slice(0,25),reason:E({sharedHooks:a,sharedReactHooks:l,sharedEffects:f,sharedState:i,sharedRequests:s,sharedHandlers:o,sharedHandlerVerbs:k}),locA:e.profile.loc,locB:r.profile.loc}}function B(e){return p({genericWords:P,stripPrefixes:S,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:C})}function C(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 A(e){let r=0,h=0,c=0,t=0,n=0,a=0,l=0;for(let s of e)s.startsWith("hook:")?r+=1:s.startsWith("react-hook:")?h+=1:s.startsWith("effect:")?c+=1:s.startsWith("request:")?t+=1:s.startsWith("handler:")||s.startsWith("handler-verb:")?n+=1:s.startsWith("state:")?a+=1:s.startsWith("state-hook:")&&(l+=1);let f=a+l,i=r+h+c+t+n+f;return t>=1&&i>=4||r>=1&&(t>=1||a>=1||n>=2)&&i>=5||a>=1&&n>=2&&(c>=1||h>=2)&&i>=5}function E(e){let r=[];return e.sharedHooks.length&&r.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&r.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&r.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&r.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&r.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&r.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&r.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),r.join("; ")||"shared React behavior profile"}var P=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"]),S=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RVWSAMTT.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as y,b as d,e as w,
|
|
1
|
+
import{a as y,b as d,e as w,n as f}from"./chunk-2KHTSEIL.js";import{b as D,c as $,d as Q,f as v,g as A,h as N}from"./chunk-JM72FNGA.js";function re(e,n){let t=Z(e,n.trim());if(t)return t;let i=q(e,n);if(i)return i;let o=F(e,n);return o||j(e,n)}function F(e,n){let t=x(n),i=I(t);if(!i)return null;let o=`%${i.path}%`,r=i.leaf,c=O(e,o,r,t)[0];return c?f(e,c):null}function O(e,n,t,i){let o=w([],[...z(e,n,t),...W(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>h(r,i)>1);return o.sort((r,a)=>h(a,i)-h(r,i)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),o}function z(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function W(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function j(e,n){let t=x(n),i=U(n),o=H(e,i),r=V(o,n,t);if(r&&!e.isIgnored(r.relative_path))return f(e,r);let a=null;for(let c of o){if(e.isIgnored(c.relative_path))continue;let l=J(c,n,t,i);l<=0||(!a||l>a.score)&&(a={row:c,score:l})}return a?f(e,a.row):null}function q(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return null;let[,i,o,r]=t,a=Math.max(0,parseInt(o,10)-1),c=Math.max(a,parseInt(r,10)-1),l=T(e,i,a,c)??X(e,i,a,c);return l&&!e.isIgnored(l.relative_path)?f(e,l):null}function T(e,n,t,i){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function X(e,n,t,i){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Z(e,n){let i=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line",limit:1})[0]??d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line",limit:1})[0];return!i||e.isIgnored(i.relative_path)?null:f(e,i)}function ae(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=G(e,n.symbolId)[0];return t?f(e,t):null}function G(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),i=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return w(t,i)}function H(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=n.flatMap(c=>{let l=`%${c}%`;return[l,l,l]}),o=t.join(`
|
|
2
2
|
AND `),r=y(e,{where:o,params:i,limit:200}),a=d(e,{where:o,params:i,limit:200});return w(r,a)}function J(e,n,t,i){let o=n.trim(),r=t,a=r.replace(/\(\)$/,""),c=n.toLowerCase(),l=t.toLowerCase(),S=l.replace(/\(\)$/,""),k=e.symbol,C=$(e.symbol),b=Q(e.symbol),E=e.display_name??"",g=e.symbol.toLowerCase(),u=C.toLowerCase(),m=b.toLowerCase(),R=E.toLowerCase(),p=e.relative_path.toLowerCase(),K=/[/:.]/.test(t),M=I(t),_=M?.leaf.toLowerCase(),s=0;return(k===o||k===r)&&(s+=1150),(C===o||C===r)&&(s+=1100),E===a&&(s+=1180),b===a&&(s+=1160),(`${b}()`===o||`${b}()`===r)&&(s+=955),(g===c||g===l)&&(s+=1e3),(u===c||u===l)&&(s+=950),(p===c||p===l)&&(s+=925),(p.endsWith(`/${l}`)||p.endsWith(`/${c}`))&&(s+=875),R===S&&(s+=850),m===S&&(s+=825),(`${m}()`===c||`${m}()`===l)&&(s+=820),(u.endsWith(`:${l}`)||u.endsWith(`:${S}`)||u.endsWith(`:${S}()`))&&(s+=800),g.includes(l)&&(s+=120),u.includes(l)&&(s+=140),p.includes(l)&&(s+=140),R.includes(l)&&(s+=110),i.every(B=>{let L=B.toLowerCase();return g.includes(L)||u.includes(L)||p.includes(L)||R.includes(L)})&&(s+=100+i.length*15),M&&p.includes(M.path.toLowerCase())&&(s+=360,_&&(m===_||`${m}()`===_||`${m}()`==`${_}()`)&&(s+=700),v(e.symbol)&&(s+=180)),A(e.symbol)&&m===S&&(s+=60),!K&&N(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function I(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let i=n.slice(t+1).replace(/\(\)$/,"");return!i||i.includes(".")?null:{path:n.slice(0,t),leaf:i}}function x(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function U(e){let n=x(e),t=n.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return t.length>0?[...new Set(t)]:[n]}function V(e,n,t){let i=n.trim(),o=e.filter(r=>{let a=$(r.symbol),c=(r.display_name??"").trim();return r.symbol===i||a===i||a===t||c===i||c===t||`${c}()`===i||h(r,t)>1||r.relative_path===i});return o.length===0?null:(o.sort((r,a)=>h(a,t)-h(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),o[0]??null)}function h(e,n){let t=I(n);if(!t)return 0;let i=e.relative_path.toLowerCase(),o=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return i.includes(r)?o!==a?1:v(e.symbol)?D(e.symbol)===null?5:4:D(e.symbol)===null?3:2:0}export{re as a,Z as b,ae as c};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-TK7O5ER5.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{appendFileSync as p,mkdirSync as u}from"fs";import{dirname as l}from"path";import{performance as i}from"perf_hooks";var E="SCIP_QUERY_PROFILE",M="SCIP_QUERY_PROFILE_OUT",P="SCIP_QUERY_PROFILE_COMMAND",s=new Set,a=!1;function c(){let e=process.env[E];return e==="1"||e==="true"}function m(){return process.env[M]}function O(){return process.env[P]}function g(e,n,o){if(!c())return n();let t=i.now();try{let r=n();return f({type:"span",name:e,durationMs:Math.round(i.now()-t),ok:!0,...d(o)??{}}),r}catch(r){throw f({type:"span",name:e,durationMs:Math.round(i.now()-t),ok:!1,error:r instanceof Error?r.message:String(r),...d(o)??{}}),r}}function f(e,n=m()){let o={timestamp:new Date().toISOString(),pid:process.pid,command:O(),...e},t=`${JSON.stringify(o)}
|
|
2
|
+
`;if(n)try{let r=l(n);s.has(r)||(u(r,{recursive:!0}),s.add(r)),p(n,t);return}catch(r){a||(a=!0,process.stderr.write(`[profile] failed to write ${n}: ${r instanceof Error?r.message:String(r)}
|
|
3
|
+
`));return}c()&&process.stderr.write(t)}function d(e){return typeof e=="function"?e():e}export{c as a,g as b};
|
|
4
|
+
//# sourceMappingURL=chunk-TQ5W2H3S.js.map
|