@omfalos/mokosh 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +47 -33
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +47 -33
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +97 -1
- package/dist/index.d.ts +97 -1
- package/dist/index.js +23 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -20
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +26 -23
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +26 -23
- package/dist/mcp.mjs.map +1 -1
- package/dist/parse-worker.js +2 -2
- package/dist/parse-worker.js.map +1 -1
- package/dist/parse-worker.mjs +2 -2
- package/dist/parse-worker.mjs.map +1 -1
- package/package.json +7 -7
- package/templates/skill/SKILL.md +4 -3
- package/templates/skill/mokosh.md +4 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`)}}});var pn=m(()=>{"use strict";l();ln()});import fn from"fs";import ia from"path";function Pt(t,e){let r=t.replace(/^\.\//,"");if(e.nodes.has(r))return r;let n=r.replace(/^dist\//,"src/").replace(/\.(js|mjs|cjs)$/,".ts");return e.nodes.has(n)?n:null}function mn(t,e){if(typeof t=="string")return Pt(t,e);if(t&&typeof t=="object"){let r=t;for(let n of["import","require","default"]){let s=mn(r[n],e);if(s)return s}}return null}function aa(t){if(!t)return"unknown";let e=t.trimStart();return e.startsWith("interface ")?"interface":e.startsWith("class ")?"class":e.startsWith("enum ")?"enum":e.startsWith("type ")?"type":e.startsWith("namespace ")?"namespace":e.startsWith("const ")||e.startsWith("let ")||e.startsWith("var ")||e.startsWith("readonly ")?"const":e.startsWith("(")||e.startsWith("async ")||e.startsWith("function ")||e.includes("=>")?"function":"unknown"}function ca(t,e){let r=new Set,n=new Set,s=[...e];for(;s.length;){let o=s.shift();if(n.has(o))continue;n.add(o);let i=t.nodes.get(o);if(i){for(let a of i.exports)r.add(a.name);for(let a of i.imports){if(a.type!=="re-export"||a.isExternal||!a.toPath)continue;if(!a.symbols?.length||a.symbols.includes("*")){let p=t.nodes.get(a.toPath);if(p)for(let g of p.exports)r.add(g.name);s.push(a.toPath)}else for(let p of a.symbols)r.add(p)}}}return r}function It(t,e){let r=[],n=ia.join(e,"package.json");if(fn.existsSync(n))try{let s=JSON.parse(fn.readFileSync(n,"utf8"));if(s.exports&&typeof s.exports=="object"&&!Array.isArray(s.exports))for(let o of Object.values(s.exports)){let i=mn(o,t);i&&!r.includes(i)&&r.push(i)}else if(typeof s.exports=="string"){let o=Pt(s.exports,t);o&&r.push(o)}if(r.length===0)for(let o of[s.main,s.module].filter(Boolean)){let i=Pt(o,t);i&&!r.includes(i)&&r.push(i)}}catch{}if(r.length===0){for(let s of["src/index.ts","src/index.js","index.ts","index.js"])if(t.nodes.has(s)){r.push(s);break}}return r}function la(t,e){let r=new Set(e);for(let n of e)t.traverse(n,s=>(r.add(s.path),!0),{direction:"outgoing"});return r}function pa(t,e,r){let n=new Map;for(let s of e){if(r.includes(s))continue;let o=t.nodes.get(s);if(!o)continue;let i=o.category==="barrel";for(let a of o.exports){let c=n.get(a.name),p=!!(a.signature||a.doc);(!c||p&&!i)&&n.set(a.name,{file:s,symbol:a})}}return n}function fa(t,e,r,n){let s=[];for(let o of t){let i=e.get(o),a=n.flatMap(h=>r.nodes.get(h)?.exports??[]).find(h=>h.name===o),c=i?.symbol??a,p=i?.file??n.find(h=>r.nodes.get(h)?.exports.some(y=>y.name===o))??n[0],g={name:o,definedIn:p,kind:aa(c?.signature)};c?.doc&&(g.doc=c.doc),c?.signature&&(g.signature=c.signature),s.push(g)}return s.sort((o,i)=>o.name.localeCompare(i.name)),s}function ma(t,e,r){let n=c=>t.nodes.get(c)?.category==="test",s=[...e].filter(c=>!r.includes(c)&&!n(c)),o=[...t.nodes.keys()].filter(c=>!e.has(c)),i=o.filter(c=>!n(c)),a=o.filter(c=>n(c));return{internalFiles:s,unreachableFromEntry:i,testFiles:a}}function Mt(t,e){if(e.length===0)throw new Error("buildApiSurface requires at least one entry point");for(let p of e)if(!t.nodes.has(p))throw new Error(`Entry point not found in graph: ${p}`);let r=la(t,e),n=pa(t,r,e),s=ca(t,e),o=fa(s,n,t,e),{internalFiles:i,unreachableFromEntry:a,testFiles:c}=ma(t,r,e);return{entryPoints:e,publicExports:o,internalFiles:i,unreachableFromEntry:a,testFiles:c}}var Dt=m(()=>{"use strict";l()});function At(t,e){let r=null,n=[];for(let o of t.nodes.values()){o.exports.some(i=>i.name===e)&&(r=o.path);for(let i of o.callEdges??[])i.to===e&&n.push({file:o.path,callerFunction:i.from})}let s=[];if(r){let o=t.nodes.get(r);for(let i of o?.callEdges??[])i.from===e&&s.push({file:i.toFile,calleeFunction:i.to})}return{functionName:e,definedIn:r,callers:n,callees:s}}var Rt=m(()=>{"use strict";l()});import $f from"fs";import Bf from"path";function un(t){let e=[...t.nodes.entries()].sort(([n],[s])=>n.localeCompare(s)).map(([n,s])=>`${n}:${s.mtime}:${s.size}`).join("|"),r=2166136261;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r,16777619)>>>0;return r.toString(16).padStart(8,"0")}function Lt(t){let e=new Map;for(let r of t.nodes.keys()){let n=[];t.traverse(r,s=>(s.path!==r&&n.push(s.path),!0),{direction:"incoming"}),e.set(r,n)}return{impact:e,graphHash:un(t)}}function Ot(t,e){return t.impact.get(e)??[]}var Gt=m(()=>{"use strict";l()});import We from"path";function ua(t){let e=new Map;for(let[r,n]of t){let s=n.imports.filter(o=>o.toPath&&!o.isExternal).length;s>0&&e.set(r,s)}return e}function ga(t,e,r){let n=new Map;for(let[s,o]of e){if(o<r)continue;let i=t.get(s);if(!i||i.category==="test"||i.category==="barrel")continue;let a=We.extname(s),c=We.basename(s,a),p=c==="index"?We.basename(We.dirname(s)):c;n.set(s,{path:s,outDegree:o,tag:`feature:${p}`})}return n}function $(t,e){let r=e?.minOutDegree??5;return ga(t,ua(t),r)}var ze=m(()=>{"use strict";l()});function ha(t,e){let r=new Map;for(let n of e.values()){let s=new Set;t.traverse(n.path,o=>(o.path!==n.path&&s.add(o.path),!0),{direction:"outgoing"}),r.set(n.path,s)}return r}function ya(t,e,r,n){let s=new Map;for(let[o]of t){if(e.has(o))continue;let i=null;for(let a of e.values())r.get(a.path)?.has(o)&&(!i||n(a,i)<0)&&(i=a);i&&s.set(o,i.path)}return s}function xa(t,e){let r=new Map;for(let n of t.values()){let s=n.tag.replace("feature:",""),o=[];for(let[i,a]of e)a===n.path&&o.push(i);r.set(s,{hub:n.path,outDegree:n.outDegree,files:o})}return r}function Sa(t,e,r){let n=[];for(let s of t.keys())!e.has(s)&&!r.has(s)&&n.push(s);return n}function me(t,e){let r=e?.detectFn??$,n=e?.hubComparator??da,s=r(t.nodes,e),o=ha(t,s),i=ya(t.nodes,s,o,n);return{features:xa(s,i),unassigned:Sa(t.nodes,s,i)}}var da,$e=m(()=>{"use strict";l();ze();da=(t,e)=>t.outDegree-e.outDegree});function jt(t){let e=new Map;for(let r of t.nodes.values())e.set(r.type,(e.get(r.type)??0)+1);return[...e.entries()].map(([r,n])=>({type:r,fileCount:n,exportsTracked:gn.has(r),importSymbolsTracked:dn.has(r),callEdgesTracked:Ue.has(r)})).sort((r,n)=>n.fileCount-r.fileCount)}var gn,dn,Ue,_t=m(()=>{"use strict";l();gn=new Set(["typescript","javascript","python","go","scss","less","lua","coffeescript"]),dn=new Set(["typescript","javascript","python"]),Ue=new Set(["typescript","javascript","go","python"])});var ue,hn=m(()=>{"use strict";l();ue=class{constructor(e){this.nodes=e}nodes;findUnusedFiles(e){let r=new Set(this.nodes.keys());return e.filter(n=>!r.has(n))}findHighExportUsage(e){let r=[];for(let n of this.nodes.values()){if(n.maxExportUsage===void 0||n.maxExportUsage<e)continue;let s=n.imports.reduce((o,i)=>(i.exportUsageRatio??0)>(o?.exportUsageRatio??0)?i:o,null);r.push({path:n.path,maxExportUsage:n.maxExportUsage,tightestDep:s?.toPath??""})}return r.sort((n,s)=>s.maxExportUsage-n.maxExportUsage)}findCycles(){let e=[],r=new Set,n=new Set,s=[],o=i=>{r.add(i),n.add(i),s.push(i);let a=this.nodes.get(i);if(a){for(let c of a.imports)if(!(!c.toPath||c.isExternal))if(n.has(c.toPath)){let p=s.indexOf(c.toPath);e.push([...s.slice(p),c.toPath])}else r.has(c.toPath)||o(c.toPath)}n.delete(i),s.pop()};for(let i of this.nodes.keys())r.has(i)||o(i);return e}}});var I,ge=m(()=>{"use strict";l();hn();I=class t{constructor(e){this.nodes=e}nodes;_incomingEdgesCache=null;_callIncomingCache=null;serialize(){return{nodes:Array.from(this.nodes.values())}}static deserialize(e){let r=new Map;for(let n of e.nodes)r.set(n.path,n);return new t(r)}getIncomingEdgesMap(){if(this._incomingEdgesCache)return this._incomingEdgesCache;let e=new Map;for(let r of this.nodes.values())for(let n of r.imports)if(n.toPath){let s=e.get(n.toPath)||[];s.push(r.path),e.set(n.toPath,s)}return this._incomingEdgesCache=e,e}dfs(e,r,n,s){let o=new Set,i=n.maxDepth??1/0,a=(c,p,g)=>{if(p>i||o.has(c))return;let h=this.nodes.get(c);if(h&&(o.add(c),r(h,p,g)!==!1))for(let y of s(c))a(y,p+1,c)};a(e,0,null)}traverse(e,r,n={}){let s=n.direction??"outgoing",o=s==="incoming"?this.getIncomingEdgesMap():null;this.dfs(e,r,n,i=>s==="outgoing"?this.nodes.get(i)?.imports.map(a=>a.toPath).filter(Boolean)??[]:o?.get(i)??[])}getCallIncomingCache(){if(this._callIncomingCache)return this._callIncomingCache;let e=new Map;for(let r of this.nodes.values())for(let n of r.callEdges??[]){let s=e.get(n.toFile)??[];s.push(r.path),e.set(n.toFile,s)}return this._callIncomingCache=e,e}traverseCalls(e,r,n={}){let s=n.direction??"outgoing",o=s==="incoming"?this.getCallIncomingCache():null;this.dfs(e,r,n,i=>s==="outgoing"?this.nodes.get(i)?.callEdges?.map(a=>a.toFile)??[]:o?.get(i)??[])}getCallers(e){let r=[];return this.traverseCalls(e,n=>(n.path!==e&&r.push(n.path),!0),{direction:"incoming",maxDepth:1}),r}getCallEdgesFor(e){return this.nodes.get(e)?.callEdges??[]}getNeighbors(e){let r=this.nodes.get(e);return r?r.imports.map(n=>this.nodes.get(n.toPath)).filter(n=>n!==void 0):[]}findUnusedFiles(e){return new ue(this.nodes).findUnusedFiles(e)}findCycles(){return new ue(this.nodes).findCycles()}}});var U,Be=m(()=>{"use strict";l();U=class{affectedSymbols=new Map;constructor(e,r){this.affectedSymbols.set(e,new Set(["default",...r]))}updateAffectedSymbols(e,r){let n=this.affectedSymbols.get(r)||new Set,s=e.imports.find(c=>c.toPath===r);if(!s)return!1;let o=s.symbols||["*"],i=new Set;for(let c of o)(c==="*"||n.has("*")||n.has(c))&&i.add("*");if(i.size===0)return!1;let a=this.affectedSymbols.get(e.path)||new Set;for(let c of i)a.add(c);return this.affectedSymbols.set(e.path,a),!0}}});function B(t,e){let r=t.nodes.get(e);if(r)return{category:r.category,exports:r.exports.map(n=>n.name)}}function Wt(t,e,r=1){let n=[];return t.traverse(e,(s,o,i)=>{if(s.path===e)return!0;let a=i?t.nodes.get(i)?.imports.find(c=>c.toPath===s.path):void 0;return n.push({path:s.path,...a?.symbols?{symbols:a.symbols}:{}}),!0},{direction:"outgoing",maxDepth:r}),n}function de(t,e){let r=[];return t.traverse(e,n=>{if(n.path===e)return!0;let s=n.imports.find(o=>o.toPath===e);return r.push({path:n.path,...s?.symbols?{symbols:s.symbols}:{}}),!0},{direction:"incoming",maxDepth:1}),r}function zt(t,e,r={}){let{testsOnly:n=!1,changedSymbols:s}=r,o=s?new U(e,s):null,i=[];return t.traverse(e,(a,c,p)=>{if(a.path===e)return!0;if(o&&p&&!o.updateAffectedSymbols(a,p))return!1;let g=a.category==="test"||a.tags.some(h=>h.name==="test");return(!n||g)&&i.push(a.path),!0},{direction:"incoming"}),i}function $t(t,e,r={}){let{depth:n=1,withEdgeDetail:s=!1}=r,o=[];return t.traverseCalls(e,i=>{if(i.path===e)return!0;let a={file:i.path};return s&&(a.edges=(i.callEdges??[]).filter(c=>c.toFile===e).map(c=>({from:c.from,to:c.to}))),o.push(a),!0},{direction:"incoming",maxDepth:n}),o}function Ut(t,e={}){let{metric:r="cognitiveComplexity",threshold:n=10,limit:s=20}=e;return[...t.nodes.values()].flatMap(o=>(o.functions??[]).filter(i=>i[r]>=n).map(i=>({file:o.path,name:i.name,line:i.line,complexity:i.complexity,cognitiveComplexity:i.cognitiveComplexity}))).sort((o,i)=>i[r]-o[r]).slice(0,s)}function Bt(t){return{nodes:t.nodes.map(r=>({path:r.path,type:r.type,category:r.category,exports:r.exports.map(n=>n.name),tags:r.tags.filter(n=>n.kind==="comment-marker"||n.kind==="import").map(n=>n.name),importsFiles:r.imports.filter(n=>!n.isExternal&&n.toPath).map(n=>n.toPath),...r.description!==void 0&&{description:r.description},...r.testedBy!==void 0&&{testedBy:r.testedBy},...r.coveragePct!==void 0&&{coveragePct:r.coveragePct},...r.avgExportUsage!==void 0&&{avgExportUsage:r.avgExportUsage},...r.maxExportUsage!==void 0&&{maxExportUsage:r.maxExportUsage}})),cycles:t.cycles}}function Jt(t){let e=t.getPackageDependencies(),r=Array.from(t.packages.values()).map(({graph:n,pkg:s})=>({name:s.name,relativeRoot:s.relativeRoot,nodeCount:n.nodes.size,dependsOn:e.get(s.name)??[]}));return{monorepoType:t.type,packageCount:r.length,packages:r}}function Kt(t){return[...t.nodes.values()].some(e=>e.coveragePct!==void 0)}var Ht=m(()=>{"use strict";l();Be()});function yn(t){if(t.category==="test")return"test";if(t.category==="config")return"config";if(t.category==="type-only")return"types";let e=t.path;return b(e,"component")||b(e,"components")?"component":b(e,"controller")||b(e,"controllers")?"controller":b(e,"middleware")?"middleware":b(e,"router")||b(e,"routes")||b(e,"route")?"router":b(e,"store")||b(e,"stores")?"store":b(e,"service")||b(e,"services")?"service":b(e,"handler")||b(e,"handlers")?"handler":b(e,"adapter")||b(e,"adapters")?"adapter":b(e,"plugin")||b(e,"plugins")?"plugin":b(e,"api")?"api":b(e,"cli")||b(e,"commands")||he(e)==="cli"?"cli":b(e,"util")||b(e,"utils")||b(e,"helper")||b(e,"helpers")?"util":b(e,"model")||b(e,"models")||he(e)==="model"?"model":b(e,"parser")||b(e,"parsers")||he(e)==="parser"?"parser":he(e)==="builder"?"builder":he(e)==="resolver"?"resolver":"other"}function b(t,e){return t.includes(`/${e}/`)||t.includes(`/${e}.`)}function he(t){let e=t.slice(t.lastIndexOf("/")+1);return e.slice(0,e.lastIndexOf("."))||e}var xn=m(()=>{"use strict";l()});function Vt(t,e){let r=me(t,e),n=new Map;for(let[o,i]of r.features){for(let a of i.files)n.set(a,o);n.set(i.hub,o)}let s=new Map;for(let o of t.nodes.values()){let i=n.get(o.path);s.set(o.path,{path:o.path,role:yn(o),...o.description?{description:o.description}:{},exports:o.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return s}var Qt=m(()=>{"use strict";l();$e();xn()});function Xt(t,e){let r=[];for(let n of t.nodes.values())if(n.exports.some(s=>s.name===e))if(Ue.has(n.type)){let s=[];for(let o of t.nodes.values())for(let i of o.callEdges??[])i.to===e&&s.push({file:o.path,callerFunction:i.from});r.push({path:n.path,category:n.category,precision:"call",callers:s})}else{let s=de(t,n.path).map(o=>({file:o.path,...o.symbols?{symbols:o.symbols}:{}}));r.push({path:n.path,category:n.category,precision:"file-level",importers:s})}return r}var Sn=m(()=>{"use strict";l();_t();Ht()});function ba(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function Ca(t,e){if(e==="type-only")return!0;let r=t.signature??"";return r.startsWith("interface ")||r.startsWith("class ")||r.startsWith("enum ")}function Yt(t){let e=new Map;for(let n of t.nodes.values())if(!(n.type!=="typescript"&&n.type!=="javascript"))for(let s of n.exports){if(!Ca(s,n.category))continue;let o=`${n.path}::${s.name}`;e.set(o,{name:s.name,file:n.path,kind:ba(s.signature),...s.doc?{doc:s.doc}:{}})}let r=[];for(let n of t.nodes.values())if(!(n.type!=="typescript"&&n.type!=="javascript")){for(let s of n.imports)if(!(!s.toPath||s.isExternal||!s.symbols?.length))for(let o of s.symbols)e.has(`${s.toPath}::${o}`)&&r.push({fromFile:n.path,toType:o,toFile:s.toPath})}return{types:e,edges:r}}function qt(t,e){let r=null;for(let o of t.types.values())if(o.name===e){r=o;break}if(!r)return{type:null,usedByFiles:[],uses:[]};let n=new Set,s=new Map;for(let o of t.edges)if(o.toType===e&&o.toFile===r.file&&n.add(o.fromFile),o.fromFile===r.file){let i=t.types.get(`${o.toFile}::${o.toType}`);i&&s.set(`${i.file}::${i.name}`,i)}return{type:r,usedByFiles:Array.from(n),uses:Array.from(s.values())}}var Zt=m(()=>{"use strict";l()});import bn from"fs";import wm from"path";function Cn(t){try{return bn.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function Je(t){try{return bn.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Ke=m(()=>{"use strict";l()});import ye from"fs";import M from"path";function er(t,e){let r=M.join(e,"package.json");if(!ye.existsSync(r))return null;let n={};try{n=JSON.parse(ye.readFileSync(r,"utf-8"))}catch{return null}let s=n.name;return s?{name:s,root:e,relativeRoot:M.relative(t,e),entryPoints:va(e,n)}:null}function va(t,e){let r=[];if(e.exports){let s=e.exports;if(typeof s=="string")r.push(M.join(t,s));else if(typeof s=="object"&&s!==null){let o=s["."];if(typeof o=="string")r.push(M.join(t,o));else if(typeof o=="object"&&o!==null){let i=o.import??o.require??o.default;typeof i=="string"&&r.push(M.join(t,i))}}}e.main&&r.push(M.join(t,e.main));for(let s of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])r.push(M.join(t,s));let n=r.filter(Je);return n.length>0?n.slice(0,1):r.slice(0,1)}function ee(t,e){let r=[],n=new Set;for(let s of e){let o=s.replace(/\/$/,"").replace(/^\.\//,"");ka(t,o,n,r)}return r}function ka(t,e,r,n){if(!e.includes("*")){Ea(t,e,r,n);return}let s=e.split("/");s.includes("**")?wa(t,s,r,n):Na(t,s,r,n)}function Ea(t,e,r,n){let s=M.join(t,e);if(r.has(s)||!Cn(s))return;r.add(s);let o=er(t,s);o&&n.push(o)}function wa(t,e,r,n){let s=M.join(t,e[0]==="**"?"":e[0]??"");vn(t,s,r,n)}function Na(t,e,r,n){let s=e.findIndex(a=>a.includes("*")),o=M.join(t,...e.slice(0,s)),i;try{i=ye.readdirSync(o,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let c=M.join(o,a.name);if(r.has(c))continue;r.add(c);let p=er(t,c);p&&n.push(p)}}function vn(t,e,r,n){let s;try{s=ye.readdirSync(e,{withFileTypes:!0})}catch{return}for(let o of s){if(!o.isDirectory()||o.name==="node_modules"||o.name.startsWith("."))continue;let i=M.join(e,o.name);if(ye.existsSync(M.join(i,"package.json"))&&!r.has(i)){r.add(i);let a=er(t,i);a&&n.push(a)}else vn(t,i,r,n)}}var He=m(()=>{"use strict";l();Ke();Ke()});import tr from"fs";import kn from"path";var En,wn=m(()=>{"use strict";l();He();En={type:"npm",detect(t){let e=kn.join(t,"package.json");if(!tr.existsSync(e))return null;let r;try{r=JSON.parse(tr.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r||tr.existsSync(kn.join(t,"yarn.lock")))return null;let n=Array.isArray(r)?r:r.packages??[];return n.length===0?null:ee(t,n)}}});import te from"fs";import N from"path";function Fn(t,e,r,n){if(n>4)return[];let s;try{s=te.readdirSync(e,{withFileTypes:!0})}catch{return[]}let o=[];for(let i of s){if(!i.isDirectory())continue;let a=i.name;if(a.startsWith(".")||a==="node_modules"||a==="dist"||a===".nx")continue;let c=N.join(e,a);te.existsSync(N.join(c,"project.json"))&&!r.has(c)?(r.add(c),o.push(c)):o.push(...Fn(t,c,r,n+1))}return o}function Fa(t,e,r){let n={};try{n=JSON.parse(te.readFileSync(r,"utf-8"))}catch{return null}let s=n.name,o,i,a=N.join(e,"package.json");if(te.existsSync(a))try{let c=JSON.parse(te.readFileSync(a,"utf-8"));s=c.name??s,o=c.main,i=c.exports}catch{}return s?{name:s,root:e,relativeRoot:N.relative(t,e),entryPoints:Ta(e,n,o,i)}:null}function Ta(t,e,r,n){let s=[],o=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(o){let a=N.resolve(t,"../..");s.push(N.resolve(a,o)),s.push(N.resolve(t,o))}if(n){let a=n;if(typeof a=="string")s.push(N.join(t,a));else if(typeof a=="object"&&a!==null){let c=a["."];typeof c=="string"&&s.push(N.join(t,c))}}if(r&&s.push(N.join(t,r)),e.sourceRoot){let a=N.resolve(t,"../.."),c=N.resolve(a,e.sourceRoot);s.push(N.join(c,"index.ts"),N.join(c,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])s.push(N.join(t,a));let i=s.filter(Je);return i.length>0?i.slice(0,1):s.slice(0,1)}var Nn,Tn=m(()=>{"use strict";l();Ke();Nn={type:"nx",detect(t){return te.existsSync(N.join(t,"nx.json"))?Fn(t,t,new Set,0).map(r=>Fa(t,r,N.join(r,"project.json"))).filter(r=>r!==null):null}}});import Pn from"fs";import Pa from"path";import{load as Ia}from"js-yaml";var In,Mn=m(()=>{"use strict";l();He();In={type:"pnpm",detect(t){let e=Pa.join(t,"pnpm-workspace.yaml");if(!Pn.existsSync(e))return null;let r=[];try{r=Ia(Pn.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return ee(t,r)}}});import Ma from"fs";import Da from"path";var Dn,An=m(()=>{"use strict";l();Dn={type:"turborepo",detect(t){return Ma.existsSync(Da.join(t,"turbo.json"))?[]:null}}});import rr from"fs";import Rn from"path";var Ln,On=m(()=>{"use strict";l();He();Ln={type:"yarn",detect(t){if(!rr.existsSync(Rn.join(t,"yarn.lock")))return null;let e=Rn.join(t,"package.json");if(!rr.existsSync(e))return null;let r;try{r=JSON.parse(rr.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r)return null;let n=Array.isArray(r)?r:r.packages??[];return n.length===0?null:ee(t,n)}}});function G(t){Gn.push(t)}function jn(){return Gn}var Gn,Ve=m(()=>{"use strict";l();Gn=[]});import Aa from"path";function nr(t,e=jn()){let r=Aa.resolve(t),n=new Map,s=[];for(let i of e){let a=i.detect(r);if(a!==null){s.push(i.type);for(let c of a)n.has(c.name)||n.set(c.name,c)}}if(s.length===0)return{root:r,type:"none",types:[],packages:[],packageMap:new Map};let o=Array.from(n.values());return{root:r,type:s[0],types:s,packages:o,packageMap:new Map(o.map(i=>[i.name,i]))}}var sr=m(()=>{"use strict";l();wn();Tn();Mn();An();On();Ve();Ve();G(Dn);G(Nn);G(In);G(Ln);G(En)});var xe,or=m(()=>{"use strict";l();ge();xe=class t{constructor(e,r){this.monorepoRoot=e;this.type=r}monorepoRoot;type;packages=new Map;addPackage(e,r){this.packages.set(e.name,{graph:r,pkg:e})}getPackageForFile(e){for(let{pkg:r}of this.packages.values())if(e===r.relativeRoot||e.startsWith(`${r.relativeRoot}/`))return r}getPackageDependencies(){let e=new Map;for(let{graph:r,pkg:n}of this.packages.values()){let s=new Set;for(let o of r.nodes.values())for(let i of o.imports)i.isWorkspace&&i.workspacePackage&&s.add(i.workspacePackage);e.set(n.name,[...s])}return e}getAffectedAcrossPackages(e){let r=this.getPackageForFile(e);if(!r)return[];let n=this.packages.get(r.name);if(!n)return[];let s=[];n.graph.traverse(e,o=>(o.path!==e&&s.push({file:o.path,package:r.name}),!0),{direction:"incoming"});for(let{graph:o,pkg:i}of this.packages.values())if(i.name!==r.name)for(let a of o.nodes.values())a.imports.some(p=>p.isWorkspace&&p.workspacePackage===r.name)&&s.push({file:a.path,package:i.name});return s}serialize(){return{monorepoRoot:this.monorepoRoot,type:this.type,packages:Array.from(this.packages.values()).map(({graph:e,pkg:r})=>({pkg:{name:r.name,relativeRoot:r.relativeRoot,entryPoints:r.entryPoints},nodes:Array.from(e.nodes.values())}))}}static deserialize(e){let r=new t(e.monorepoRoot,e.type);for(let{pkg:n,nodes:s}of e.packages){let o=new Map(s.map(a=>[a.path,a])),i=new I(o);r.packages.set(n.name,{graph:i,pkg:{...n,root:""}})}return r}}});function re(t,e){_n.set(t,e)}function Wn(t){return _n.get(t)}var _n,Se=m(()=>{"use strict";l();_n=new Map});function zn(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function Ra(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}function be(t,e,r){return cc.every(n=>n(t,e,r))}var La,Oa,Ga,ja,_a,Wa,za,$a,Ua,Ba,Ja,Ka,Ha,Va,Qa,Xa,Ya,qa,Za,ec,tc,rc,nc,sc,oc,ic,ac,cc,ir=m(()=>{"use strict";l();La=(t,e)=>!e.category||zn(t.category,e.category),Oa=(t,e)=>!e.type||zn(t.type,e.type),Ga=(t,e)=>e.lastAuthor?e.lastAuthor.startsWith("!")?t.lastAuthor!==e.lastAuthor.slice(1):t.lastAuthor!==void 0&&t.lastAuthor===e.lastAuthor:!0,ja=(t,e)=>!e.path||Ra(t.path,e.path),_a=(t,e)=>e.isExternal===void 0?!0:t.imports.some(n=>n.isExternal)===e.isExternal,Wa=(t,e)=>{if(!e.tags||e.tags.length===0)return!0;let r=e.tags.filter(s=>!s.startsWith("!")),n=e.tags.filter(s=>s.startsWith("!")).map(s=>s.slice(1));return!(r.length>0&&!r.some(s=>t.tags.some(o=>o.name===s))||n.some(s=>t.tags.some(o=>o.name===s)))},za=(t,e)=>!e.allTags?.length||e.allTags.every(r=>t.tags.some(n=>n.name===r)),$a=(t,e)=>!e.importsFile||t.imports.some(r=>r.toPath?.includes(e.importsFile)),Ua=(t,e,r)=>e.importedBy===void 0?!0:(r?.get(t.path)??[]).some(s=>s.includes(e.importedBy)),Ba=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,Ja=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,Ka=(t,e)=>e.minSize===void 0||t.size>=e.minSize,Ha=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,Va=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,Qa=(t,e)=>e.isDocumented===void 0||!!t.documentedBy?.length===e.isDocumented,Xa=(t,e)=>e.isStale===void 0||!!t.staleFor?.length===e.isStale,Ya=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,qa=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,Za=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,ec=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,tc=(t,e)=>e.minComplexity===void 0||(t.complexity??-1/0)>=e.minComplexity,rc=(t,e)=>e.maxComplexity===void 0||(t.complexity??0)<=e.maxComplexity,nc=(t,e)=>e.minCognitiveComplexity===void 0||(t.cognitiveComplexity??-1/0)>=e.minCognitiveComplexity,sc=(t,e)=>e.maxCognitiveComplexity===void 0||(t.cognitiveComplexity??0)<=e.maxCognitiveComplexity,oc=(t,e)=>e.minCommits===void 0||(t.commitCount90d??-1/0)>=e.minCommits,ic=(t,e)=>e.maxCommits===void 0||(t.commitCount90d??0)<=e.maxCommits,ac=(t,e,r)=>!e.any?.length||e.any.some(n=>be(t,n,r)),cc=[La,Oa,Ga,ja,_a,Wa,za,$a,Ua,Ba,Ja,Ka,Ha,Va,Qa,Xa,Ya,qa,Za,ec,tc,rc,nc,sc,oc,ic,ac]});function Qe(t,e){let r=new Map;if(e.importedBy!==void 0){for(let i of t.nodes)for(let a of i.imports)if(a.toPath){let c=r.get(a.toPath)??[];c.push(i.path),r.set(a.toPath,c)}}let n=t.nodes.filter(i=>be(i,e,r)),s=new Set(n.map(i=>i.path)),o=n.map(i=>({...i,imports:i.imports.filter(a=>!a.toPath||s.has(a.toPath))}));if(e.sort){let i=e.sortDir==="asc"?-1:1;o.sort((a,c)=>{let p=0;return e.sort==="size"?p=c.size-a.size:e.sort==="imports"?p=c.imports.length-a.imports.length:e.sort==="commitCount90d"?p=(c.commitCount90d??0)-(a.commitCount90d??0):e.sort==="exportUsage"?p=(c.avgExportUsage??0)-(a.avgExportUsage??0):e.sort==="complexity"?p=(c.complexity??0)-(a.complexity??0):e.sort==="cognitiveComplexity"&&(p=(c.cognitiveComplexity??0)-(a.cognitiveComplexity??0)),p*i})}return e.limit!==void 0&&o.splice(e.limit),{nodes:o,cycles:t.cycles?.filter(i=>i.every(a=>s.has(a)))??void 0}}var $n=m(()=>{"use strict";l();ir();ir()});function Un(t,e){let r=e.indexOf(":");if(r===-1)return;let n=e.slice(0,r).trim().toLowerCase(),s=e.slice(r+1).trim();if(!(!n||!s))switch(n){case"category":t.category=s;break;case"type":t.type=s;break;case"tag":case"tags":s.includes("+")?t.allTags=[...t.allTags??[],...s.split("+")]:t.tags=[...t.tags??[],s];break;case"path":t.path=s;break;case"external":t.isExternal=s.toLowerCase()==="true";break;case"importsfile":t.importsFile=s;break;case"importedby":t.importedBy=s;break;case"minimports":t.minImports=parseInt(s,10);break;case"maximports":t.maxImports=parseInt(s,10);break;case"minsize":t.minSize=parseInt(s,10);break;case"maxsize":t.maxSize=parseInt(s,10);break;case"sort":t.sort=s;break;case"sortdir":t.sortDir=s.toLowerCase()==="asc"?"asc":"desc";break;case"limit":t.limit=parseInt(s,10);break;case"hasdocstring":t.hasDocstring=s.toLowerCase()!=="false";break;case"mincoverage":t.minCoverage=parseInt(s,10);break;case"maxcoverage":t.maxCoverage=parseInt(s,10);break;case"minexportusage":t.minExportUsage=parseFloat(s);break;case"maxexportusage":t.maxExportUsage=parseFloat(s);break;case"mincomplexity":t.minComplexity=parseInt(s,10);break;case"maxcomplexity":t.maxComplexity=parseInt(s,10);break;case"mincognitivecomplexity":t.minCognitiveComplexity=parseInt(s,10);break;case"maxcognitivecomplexity":t.maxCognitiveComplexity=parseInt(s,10);break;case"mincommits":t.minCommits=parseInt(s,10);break;case"maxcommits":t.maxCommits=parseInt(s,10);break;case"isdocumented":t.isDocumented=s.toLowerCase()!=="false";break;case"isstale":t.isStale=s.toLowerCase()!=="false";break;case"lastauthor":t.lastAuthor=s;break}}function lc(t){let e=[];for(let r of t.split("|")){let n=r.trim();if(!n)continue;let s={};Un(s,n),Object.keys(s).length>0&&e.push(s)}return e}function Xe(t){let e={},r=t.split(",");for(let n of r){let s=n.trim();if(s.toLowerCase().startsWith("any(")&&s.endsWith(")")){let o=s.slice(4,-1),i=lc(o);i.length>0&&(e.any=[...e.any??[],...i]);continue}Un(e,n)}return e}var Bn=m(()=>{"use strict";l()});var Jn=m(()=>{"use strict";l();$n();Bn()});import F from"typescript";function ne(t){let e=[];for(let r of t.statements){if(!F.isExpressionStatement(r))continue;let n=r.expression;if(!F.isCallExpression(n))continue;let s=n.expression;F.isIdentifier(s)&&Kn.has(s.text)&&e.push(n),F.isPropertyAccessExpression(s)&&F.isIdentifier(s.expression)&&Kn.has(s.expression.text)&&e.push(n)}return e}function se(t,e,r){for(let n of t.arguments){if(!F.isObjectLiteralExpression(n))continue;let s=n.properties.find(o=>F.isPropertyAssignment(o)&&F.isIdentifier(o.name)&&o.name.text===e);if(!(!s||!F.isArrayLiteralExpression(s.initializer)))return s.initializer.elements.filter(F.isStringLiteral).map(o=>o.text)}return null}function oe(t,e,r,n){if(t.arguments.length===0)return null;for(let o=1;o<t.arguments.length;o++){let i=t.arguments[o];if(!F.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>F.isPropertyAssignment(p)&&F.isIdentifier(p.name)&&p.name.text===e);if(a)return{start:a.initializer.getStart(n),end:a.initializer.getEnd(),text:r};let c=i.getEnd()-1;return{start:c,end:c,text:`${i.properties.length>0?", ":""}${e}: ${r}`}}let s=t.arguments[t.arguments.length-1];return{start:s.getStart(n),end:s.getStart(n),text:`{ ${e}: ${r} }, `}}function ie(t,e,r){let n=t.arguments;for(let s=1;s<n.length;s++){let o=n[s];if(!F.isObjectLiteralExpression(o))continue;let i=o.properties.findIndex(c=>F.isPropertyAssignment(c)&&F.isIdentifier(c.name)&&c.name.text===e);if(i<0)continue;if(o.properties.length===1)return{start:n[s-1].getEnd(),end:o.getEnd(),text:""};let a=o.properties[i];return i===o.properties.length-1?{start:o.properties[i-1].getEnd(),end:a.getEnd(),text:""}:{start:a.getStart(r),end:o.properties[i+1].getStart(r),text:""}}return null}function ae(t,e){let r=[...e].sort((s,o)=>o.start-s.start),n=t;for(let s of r)n=n.slice(0,s.start)+s.text+n.slice(s.end);return n}function ce(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}var Kn,L,le=m(()=>{"use strict";l();Kn=new Set(["describe","test","it"]);L=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import Hn from"path";import Vn from"typescript";function pc(t){return ce(t.map(e=>`@${e}`))}function fc(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var Ye,Qn=m(()=>{"use strict";l();le();Ye=class{name="cypress";canHandle(e){return L.has(Hn.extname(e).toLowerCase())}apply(e,r,n){let s=Vn.createSourceFile(Hn.basename(e),r,Vn.ScriptTarget.Latest,!0),o=ne(s);if(o.length===0)return r;let i=se(o[0],"tags",s),a=[...n].sort();if(i!==null&&JSON.stringify(fc(i).sort())===JSON.stringify(a))return r;let c=o.flatMap(p=>{let g=n.length===0?ie(p,"tags",s):oe(p,"tags",pc(a),s);return g?[g]:[]});return c.length>0?ae(r,c):r}}});import mc from"path";function uc(t){return["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
|
|
4
|
-
`)
|
|
2
|
+
var Et=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var u=(t,e)=>()=>(t&&(e=t(t=0)),e);var va=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);import ka from"path";import{fileURLToPath as wa}from"url";var Ea,Fa,m,l=u(()=>{"use strict";Ea=()=>wa(import.meta.url),Fa=()=>ka.dirname(Ea()),m=Fa()});function Re(t){vn.push(t)}function kn(t){return[...Ta,...vn].some(e=>typeof e=="string"?t.includes(e):e instanceof RegExp?e.test(t):e(t))}function Le(t){wn.push(t)}function fe(){return[...Na,...wn]}function Oe(t){En.push(t)}function Ft(){return[...Pa,...En]}function Tt(t){Fn=t}function Nt(){return Fn}var Ta,vn,Na,wn,Pa,En,Fn,te=u(()=>{"use strict";l();Ta=[".config.","biome.json","tsconfig.json","package.json",".prettierrc",".eslintrc"],vn=[];Na=[".test.",".spec.","-test.","-spec."],wn=[];Pa=["jest","vitest","playwright","cypress","@testing-library/"],En=[];Fn=.8});import Pt from"fs";import Tn from"path";function re(t,{allowJs:e=!0,isExplicitPath:r=!1}={}){if(r){let n=Tn.resolve(t);return Pt.existsSync(n)?n.endsWith(".json")?Nn(n):e?Pn(n):{}:{}}for(let n of Ia){let o=Tn.resolve(t,n);if(Pt.existsSync(o)){if(n.endsWith(".json"))return Nn(o);if(e)return Pn(o)}}return{}}function Nn(t){return JSON.parse(Pt.readFileSync(t,"utf-8"))}function Pn(t){let e=Et(t);return e&&typeof e=="object"&&"default"in e&&(e=e.default),typeof e=="function"?e({}):e}function It(t){for(let e of t.configMatchers??[])Re(e);for(let e of t.testPatterns??[])Le(e);for(let e of t.testLibraries??[])Oe(e);t.barrelThreshold!==void 0&&Tt(t.barrelThreshold)}function N(t){return{gitStats:t?.gitStats??!1,parallelParsing:t?.parallelParsing,pathAliases:t?.pathAliases}}var Ia,Dt=u(()=>{"use strict";l();te();Ia=["mokosh.config.js","mokosh.config.cjs","mokosh.config.json"]});var J,Mt,Ge=u(()=>{"use strict";l();J=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"],Mt=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".go",".feature",".md",".mdx"]});import fm from"fs";import um from"path";var In=u(()=>{"use strict";l()});var _e,Dn=u(()=>{"use strict";l();_e={serialize(t){let e=["graph TD"],r=new Set;for(let n of t.nodes.values()){let o=`"${n.path}"`;for(let s of n.imports){if(!s.toPath)continue;let i=`"${s.toPath}"`,a=`${n.path} -> ${s.toPath}`;if(!r.has(a)){let c=s.isStyle?"-- styles -->":"-->";e.push(` ${o} ${c} ${i}`),r.add(a)}}}return e.join(`
|
|
3
|
+
`)}}});var Mn=u(()=>{"use strict";l();Dn()});import An from"fs";import Ma from"path";function At(t,e){let r=t.replace(/^\.\//,"");if(e.nodes.has(r))return r;let n=r.replace(/^dist\//,"src/").replace(/\.(js|mjs|cjs)$/,".ts");return e.nodes.has(n)?n:null}function Rn(t,e){if(typeof t=="string")return At(t,e);if(t&&typeof t=="object"){let r=t;for(let n of["import","require","default"]){let o=Rn(r[n],e);if(o)return o}}return null}function Aa(t){if(!t)return"unknown";let e=t.trimStart();return e.startsWith("interface ")?"interface":e.startsWith("class ")?"class":e.startsWith("enum ")?"enum":e.startsWith("type ")?"type":e.startsWith("namespace ")?"namespace":e.startsWith("const ")||e.startsWith("let ")||e.startsWith("var ")||e.startsWith("readonly ")?"const":e.startsWith("(")||e.startsWith("async ")||e.startsWith("function ")||e.includes("=>")?"function":"unknown"}function Ra(t,e){let r=new Set,n=new Set,o=[...e];for(;o.length;){let s=o.shift();if(n.has(s))continue;n.add(s);let i=t.nodes.get(s);if(i){for(let a of i.exports)r.add(a.name);for(let a of i.imports){if(a.type!=="re-export"||a.isExternal||!a.toPath)continue;if(!a.symbols?.length||a.symbols.includes("*")){let p=t.nodes.get(a.toPath);if(p)for(let f of p.exports)r.add(f.name);o.push(a.toPath)}else for(let p of a.symbols)r.add(p)}}}return r}function Rt(t,e){let r=[],n=Ma.join(e,"package.json");if(An.existsSync(n))try{let o=JSON.parse(An.readFileSync(n,"utf8"));if(o.exports&&typeof o.exports=="object"&&!Array.isArray(o.exports))for(let s of Object.values(o.exports)){let i=Rn(s,t);i&&!r.includes(i)&&r.push(i)}else if(typeof o.exports=="string"){let s=At(o.exports,t);s&&r.push(s)}if(r.length===0)for(let s of[o.main,o.module].filter(Boolean)){let i=At(s,t);i&&!r.includes(i)&&r.push(i)}}catch{}if(r.length===0){for(let o of["src/index.ts","src/index.js","index.ts","index.js"])if(t.nodes.has(o)){r.push(o);break}}return r}function La(t,e){let r=new Set(e);for(let n of e)t.traverse(n,o=>(r.add(o.path),!0),{direction:"outgoing"});return r}function Oa(t,e,r){let n=new Map;for(let o of e){if(r.includes(o))continue;let s=t.nodes.get(o);if(!s)continue;let i=s.category==="barrel";for(let a of s.exports){let c=n.get(a.name),p=!!(a.signature||a.doc);(!c||p&&!i)&&n.set(a.name,{file:o,symbol:a})}}return n}function Ga(t,e,r,n){let o=[];for(let s of t){let i=e.get(s),a=n.flatMap(d=>r.nodes.get(d)?.exports??[]).find(d=>d.name===s),c=i?.symbol??a,p=i?.file??n.find(d=>r.nodes.get(d)?.exports.some(x=>x.name===s))??n[0],f={name:s,definedIn:p,kind:Aa(c?.signature)};c?.doc&&(f.doc=c.doc),c?.signature&&(f.signature=c.signature),o.push(f)}return o.sort((s,i)=>s.name.localeCompare(i.name)),o}function _a(t,e,r){let n=c=>t.nodes.get(c)?.category==="test",o=[...e].filter(c=>!r.includes(c)&&!n(c)),s=[...t.nodes.keys()].filter(c=>!e.has(c)),i=s.filter(c=>!n(c)),a=s.filter(c=>n(c));return{internalFiles:o,unreachableFromEntry:i,testFiles:a}}function Lt(t,e){if(e.length===0)throw new Error("buildApiSurface requires at least one entry point");for(let p of e)if(!t.nodes.has(p))throw new Error(`Entry point not found in graph: ${p}`);let r=La(t,e),n=Oa(t,r,e),o=Ra(t,e),s=Ga(o,n,t,e),{internalFiles:i,unreachableFromEntry:a,testFiles:c}=_a(t,r,e);return{entryPoints:e,publicExports:s,internalFiles:i,unreachableFromEntry:a,testFiles:c}}var Ot=u(()=>{"use strict";l()});function Gt(t,e){let r=null,n=[];for(let s of t.nodes.values()){s.exports.some(i=>i.name===e)&&(r=s.path);for(let i of s.callEdges??[])i.to===e&&n.push({file:s.path,callerFunction:i.from})}let o=[];if(r){let s=t.nodes.get(r);for(let i of s?.callEdges??[])i.from===e&&o.push({file:i.toFile,calleeFunction:i.to})}return{functionName:e,definedIn:r,callers:n,callees:o}}var _t=u(()=>{"use strict";l()});import Nm from"fs";import Im from"path";function Ln(t){let e=[...t.nodes.entries()].sort(([n],[o])=>n.localeCompare(o)).map(([n,o])=>`${n}:${o.mtime}:${o.size}`).join("|"),r=2166136261;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r,16777619)>>>0;return r.toString(16).padStart(8,"0")}function jt(t){let e=new Map;for(let r of t.nodes.keys()){let n=[];t.traverse(r,o=>(o.path!==r&&n.push(o.path),!0),{direction:"incoming"}),e.set(r,n)}return{impact:e,graphHash:Ln(t)}}function Wt(t,e){return t.impact.get(e)??[]}var zt=u(()=>{"use strict";l()});import je from"fs";import ja from"path";import{load as On}from"js-yaml";function Gn(t){let e=t.lastIndexOf("@");return e>0?t.substring(0,e):t}function Wa(t){return t.replace(/:$/,"").split(",").map(e=>{let r=e.trim();return r.startsWith('"')&&(r=r.slice(1)),r.endsWith('"')&&(r=r.slice(0,-1)),Gn(r)}).filter(Boolean)}function za(t,e){let r=t.startsWith("/")?t.slice(1):t,n=r.lastIndexOf("@");return n>0?{name:r.substring(0,n),version:e||r.substring(n+1)}:{name:r,version:e}}function $a(t){try{let e=On(t),r={dependencies:{}};for(let[n,o]of Object.entries(e))if(!(n==="__metadata"||!o?.version))for(let s of n.split(", ")){let i=Gn(s);i&&(r.dependencies[i]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}return r}catch{return null}}function Ba(t){let e={dependencies:{}};for(let r of t.split(/\n\n+/)){let n=r.split(`
|
|
4
|
+
`).filter(c=>c.trim().length>0&&!c.trim().startsWith("#"));if(n.length<2)continue;let o=n[0];if(!o||o.startsWith(" "))continue;let s=Wa(o);if(s.length===0)continue;let a=n.find(c=>c.trim().startsWith('version "'))?.match(/version "(.*?)"/)?.[1]??"";for(let c of s)e.dependencies[c]={version:a}}return e}function Ua(t){let e=je.readFileSync(t,"utf-8"),r=JSON.parse(e),n={dependencies:{}};if(r.packages)for(let[o,s]of Object.entries(r.packages)){if(!o.startsWith("node_modules/"))continue;let i=o.replace("node_modules/","");i.includes("node_modules/")||(n.dependencies[i]={version:s.version,...s.dependencies!==void 0&&{dependencies:s.dependencies}})}else if(r.dependencies)for(let[o,s]of Object.entries(r.dependencies))n.dependencies[o]={version:s.version,...s.dependencies!==void 0&&{dependencies:s.dependencies}};return n}function Ja(t){let e=je.readFileSync(t,"utf-8");if(e.includes("__metadata:")){let r=$a(e);if(r!==null)return r}return Ba(e)}function Ka(t){let e=je.readFileSync(t,"utf-8"),r={dependencies:{}};try{let n=On(e);if(n.packages)for(let[o,s]of Object.entries(n.packages)){let{name:i,version:a}=za(o,s.version);i&&(r.dependencies[i]={version:a,...s.dependencies!==void 0&&{dependencies:s.dependencies}})}if(n.dependencies)for(let[o,s]of Object.entries(n.dependencies)){if(r.dependencies[o])continue;let i=typeof s=="string"?s:s.version;r.dependencies[o]={version:i||""}}}catch{}return r}function _n(t){let e={"package-lock.json":Ua,"yarn.lock":Ja,"pnpm-lock.yaml":Ka},r=$t.map(n=>[n,e[n]]);for(let[n,o]of r){let s=ja.join(t,n);if(je.existsSync(s))return o(s)}return null}var $t,Bt=u(()=>{"use strict";l();$t=["package-lock.json","yarn.lock","pnpm-lock.yaml"]});function jn(t){return Ha.has(t)?"style":"code"}var Ha,Wn=u(()=>{"use strict";l();Ha=new Set(["css","scss","less","stylus"])});function Va(t){let e=5381;for(let r=0;r<t.length;r++)e=e*33+t.charCodeAt(r)>>>0;return e.toString(36)}function Qa(t,e){let r=[];for(let n=0;n<=t.length-e;n++)r.push(Va(t.slice(n,n+e).map(o=>o.text).join(" ")));return r}function Ya(t,e,r){let n=t.get(e.file),o=t.get(r.file);if(!n||!o)return 0;let s=0;for(;e.windowIndex+s+1<n.length&&r.windowIndex+s+1<o.length&&n[e.windowIndex+s+1]===o[r.windowIndex+s+1];)s++;return s}function Xa(t,e,r){if(e.windowIndex===0||r.windowIndex===0)return!0;let n=t.get(e.file),o=t.get(r.file);return!n||!o?!0:n[e.windowIndex-1]!==o[r.windowIndex-1]}function We(t){return`${t.file}#${t.startLine}#${t.endLine}`}function Za(t,e,r){let n=0;for(let o=e;o<e+r;o++)qa.has(t[o].text)&&n++;return n/r}function zn(t,e,r,n=.5){let o=new Map,s=new Map,i=new Map;for(let{file:x,tokens:y}of t){if(y.length<e)continue;s.set(x,y);let S=Qa(y,e);o.set(x,S);for(let b=0;b<S.length;b++){let C={file:x,windowIndex:b},T=i.get(S[b]);T?T.push(C):i.set(S[b],[C])}}let a=[];for(let x of i.values())if(!(x.length<2))for(let y=0;y<x.length;y++)for(let S=y+1;S<x.length;S++){let b=x[y],C=x[S];if(b.file===C.file&&b.windowIndex===C.windowIndex||!Xa(o,b,C))continue;let T=Ya(o,b,C),R=e+T,G=s.get(b.file);if(Za(G,b.windowIndex,R)>n)continue;if(b.file===C.file){let[Sa,Ca]=b.windowIndex<C.windowIndex?[b,C]:[C,b];if(Sa.windowIndex+R>Ca.windowIndex)continue}let U=s.get(C.file),kt={file:b.file,startLine:G[b.windowIndex].line,endLine:G[b.windowIndex+R-1].line},wt={file:C.file,startLine:U[C.windowIndex].line,endLine:U[C.windowIndex+R-1].line},Cn=Math.min(kt.endLine-kt.startLine+1,wt.endLine-wt.startLine+1);Cn<r||a.push({occA:kt,occB:wt,lines:Cn,tokens:R})}let c=new Ut,p=new Map;for(let{occA:x,occB:y}of a){let S=We(x),b=We(y);p.set(S,x),p.set(b,y),c.union(S,b)}let f=new Map;for(let x of p.keys()){let y=c.root(x),S=f.get(y);S?S.add(x):f.set(y,new Set([x]))}let d=[];for(let x of f.values()){if(x.size<2)continue;let y=[...x].map(C=>p.get(C)),S=0,b=e;for(let C of a)!x.has(We(C.occA))||!x.has(We(C.occB))||C.lines>S&&(S=C.lines,b=C.tokens);d.push({occurrences:y,lines:S,tokens:b})}return d.sort((x,y)=>y.lines-x.lines)}var Ut,qa,$n=u(()=>{"use strict";l();Ut=class{parent=new Map;find(e){this.parent.has(e)||this.parent.set(e,e);let r=e;for(;this.parent.get(r)!==r;)r=this.parent.get(r);let n=e;for(;n!==r;){let o=this.parent.get(n);this.parent.set(n,r),n=o}return r}union(e,r){let n=this.find(e),o=this.find(r);n!==o&&this.parent.set(n,o)}root(e){return this.find(e)}};qa=new Set(["{","}",":",",","[","]"])});import Un from"postcss";import*as ec from"postcss-less";function Bn(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function rc(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function nc(t,e){let r=t.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(r){let s=r[1]?.trim()??"",i=r[2]??"";if(!i)return null;let a=Jn.has(s)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,...Bn(i)?{isExternal:!0}:{}}}let n=t.match(/^url\(['"]?([^'")]+)['"]?\)/),o=n?n[1]?.trim()??"":t.match(/^['"]([^'"]+)['"]/)?.[1]??"";return o?{fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static",...Bn(o)?{isExternal:!0}:{}}:null}function oc(t,e){let r=[],n=/url\(['"]?([^'")]+)['"]?\)/g,o=n.exec(t);for(;o!==null;){let s=o[1]?.trim()??"";rc(s)&&r.push({fromPath:e,toPath:"",rawSpecifier:s,isStyle:!0,type:"static"}),o=n.exec(t)}return r}function Kn(t,e){let r=[];return t.walk(n=>{if(n.type==="atrule"&&n.name==="import"){let o=nc(n.params,e);o&&r.push(o)}n.type==="decl"&&r.push(...oc(n.value,e))}),r}function sc(t){return t.replace(/(?<!:)\/\/.*/g,"")}function ic(t,e){let r=[],n=/@import\s+(?:\(([^)]+)\)\s+)?['"]([^'"]+)['"]/g,o=n.exec(t);for(;o!==null;){let s=o[1]?.trim()??"",i=o[2]??"";if(i){let a=Jn.has(s)?"side-effect":"static";r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}o=n.exec(t)}return r}function ze(t,e){let r=Un.parse(sc(t));return{imports:Kn(r,e),root:r}}function ac(t){let e=[],r=[];for(let n of t.nodes??[]){if(n.type!=="atrule")continue;let{value:o}=n;if(o===void 0)continue;let s=n.name;s&&(e.push({name:s}),r.push({name:s,kind:"variable"}))}return{exports:e,tags:r}}function $e(t,e){try{let r=tc.parse(t),{exports:n,tags:o}=ac(r);return{imports:Kn(r,e),root:r,exports:n,tags:o}}catch{return{imports:ic(t,e),root:Un.parse(""),exports:[],tags:[]}}}var tc,Jn,Jt=u(()=>{"use strict";l();tc=ec,Jn=new Set(["reference","inline"])});import{parse as cc}from"postcss-scss";function Hn(t){return t.startsWith("_")||t.startsWith("-")}function lc(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function pc(t){let e=t.match(/^['"]([^'"]+)['"]/);if(!e?.[1])return{specifier:""};let r=e[1],o=t.match(/\bas\s+(\S+)/)?.[1];return o!==void 0?{specifier:r,alias:o}:{specifier:r}}function fc(t){let e=[],r=[];for(let n of t.nodes??[]){if(n.type==="decl"&&n.prop.startsWith("$")){let o=n.prop.slice(1);if(!o||Hn(o))continue;e.push({name:o}),r.push({name:o,kind:"variable"});continue}if(n.type==="atrule"&&(n.name==="mixin"||n.name==="function")){let s=n.params.match(/^([\w-]+)/)?.[1];if(!s||Hn(s))continue;let i=n.params.trim();e.push(i.includes("(")?{name:s,signature:i}:{name:s}),r.push({name:s,kind:"function"})}}return{exports:e,tags:r}}function Be(t,e){let r=cc(t),n=[];r.walk(i=>{if(i.type!=="atrule")return;let{name:a,params:c}=i;if(a!=="import"&&a!=="use"&&a!=="forward")return;let{specifier:p,alias:f}=pc(c);if(!p)return;let d={fromPath:e,toPath:"",rawSpecifier:p,isStyle:!0,type:a==="forward"?"re-export":"static",...lc(p)?{isExternal:!0}:{}};f&&(d.symbols=[f]),n.push(d)});let{exports:o,tags:s}=fc(r);return{imports:n,root:r,exports:o,tags:s}}var Kt=u(()=>{"use strict";l()});function mc(t){return t.trim().replace(/\s+/g," ")}function uc(t){try{return t.fileType==="scss"?Be(t.source,t.file).root:t.fileType==="less"?$e(t.source,t.file).root:t.fileType==="css"?ze(t.source,t.file).root:void 0}catch{return}}function gc(t){let e=uc(t);if(!e)return[];let r=[];return e.walkRules(n=>{let o=n.nodes?.filter(f=>f.type==="decl")??[];if(o.length===0)return;let s=o[0],i=o[o.length-1],a=n.source?.start?.line??s?.source?.start?.line,c=i?.source?.end?.line??i?.source?.start?.line??a;if(a===void 0||c===void 0)return;let p=o.map(f=>`${f.prop.trim().toLowerCase()}:${mc(f.value)}`).join(";");r.push({file:t.file,startLine:a,endLine:c,lines:c-a+1,signature:p,declCount:o.length})}),r}function Vn(t,e,r=2){let n=new Map;for(let s of t)for(let i of gc(s)){if(i.declCount<r||i.lines<e)continue;let a=n.get(i.signature);a?a.push(i):n.set(i.signature,[i])}let o=[];for(let s of n.values())for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++){let c=s[i],p=s[a];if(c.file===p.file&&c.startLine===p.startLine&&c.endLine===p.endLine)continue;let f={file:c.file,startLine:c.startLine,endLine:c.endLine},d={file:p.file,startLine:p.startLine,endLine:p.endLine};o.push({occurrences:[f,d],lines:Math.min(c.lines,p.lines),tokens:c.declCount,family:"style"})}return o.sort((s,i)=>i.lines-s.lines)}var Qn=u(()=>{"use strict";l();Jt();Kt()});function Yn(t,e,r){let n=t.slice(e,r).replace(/[^\n]/g," ");return t.slice(0,e)+n+t.slice(r)}function hc(t,e){if(!e)return t;let r=t;for(let[n,o]of e.block??[]){let s=0;for(;;){let i=r.indexOf(n,s);if(i===-1)break;let a=r.indexOf(o,i+n.length),c=a===-1?r.length:a+o.length;r=Yn(r,i,c),s=c}}for(let n of e.line??[]){let o=0;for(;;){let s=r.indexOf(n,o);if(s===-1)break;let i=r.indexOf(`
|
|
5
|
+
`,s),a=i===-1?r.length:i;r=Yn(r,s,a),o=a}}return r}function qn(t,e,r=!0){let n=hc(t,dc[e]),o=[],s=1,i=0;Ht.lastIndex=0;let a=Ht.exec(n);for(;a!==null;){for(let f=i;f<a.index;f++)n[f]===`
|
|
6
|
+
`&&s++;i=a.index;let c=a[0],p=c;xc.test(c)&&!Sc.has(c)?p="ID":r&&(Xn.test(c)||bc.test(c))&&(p=Xn.test(c)?"NUM":"STR"),o.push({text:p,line:s});for(let f=i;f<a.index+c.length;f++)n[f]===`
|
|
7
|
+
`&&s++;i=a.index+c.length,a=Ht.exec(n)}return o}var dc,yc,Ht,xc,Xn,bc,Sc,Zn=u(()=>{"use strict";l();dc={typescript:{line:["//"],block:[["/*","*/"]]},javascript:{line:["//"],block:[["/*","*/"]]},go:{line:["//"],block:[["/*","*/"]]},css:{block:[["/*","*/"]]},scss:{line:["//"],block:[["/*","*/"]]},less:{line:["//"],block:[["/*","*/"]]},stylus:{line:["//"],block:[["/*","*/"]]},python:{line:["#"]},gherkin:{line:["#"]},coffeescript:{line:["#"],block:[["###","###"]]},livescript:{line:["#"],block:[["###","###"]]},lua:{line:["--"],block:[["--[[","]]"]]},markdown:{block:[["<!--","-->"]]}};yc=["===","!==","...","=>","==","!=","<=",">=","&&","||","::","->","..","+=","-=","*=","/="],Ht=new RegExp(`${yc.map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")}|[A-Za-z_$][A-Za-z0-9_$]*|\\d+(?:\\.\\d+)?|"(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`|\\S`,"g"),xc=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Xn=/^\d+(?:\.\d+)?$/,bc=/^(".*"|'.*'|`.*`)$/s,Sc=new Set(["if","else","elif","for","while","do","switch","case","default","break","continue","return","function","def","class","struct","interface","const","let","var","local","import","export","from","package","try","catch","except","finally","throw","raise","new","this","self","end","then","yield","async","await","nil","null","None","true","false","True","False","and","or","not","in","of","is"])});import{readFile as Cc}from"fs/promises";import Vt from"path";function kc(t){return $t.includes(Vt.basename(t))}function wc(t,e){if(e.length===0)return!1;let r=new Set(e);return t.split(Vt.sep).some(n=>r.has(n))}async function Qt(t,e,r={}){let{minLines:n=6,windowSize:o=15,ignoreLiterals:s=!0,maxPunctuationRatio:i=.5,limit:a=50,ignoreDirs:c=J}=r,p=[...t.nodes.values()].filter(y=>!kc(y.path)&&!wc(y.path,c)),f=[],d=new Map;await Promise.all(p.map(async y=>{let S;try{S=await Cc(Vt.join(e,y.path),"utf8")}catch{return}if(vc.has(y.type)){f.push({file:y.path,source:S,fileType:y.type});return}let b=jn(y.type),C={file:y.path,tokens:qn(S,y.type,s)},T=d.get(b);T?T.push(C):d.set(b,[C])}));let x=Vn(f,n);for(let[y,S]of d)for(let b of zn(S,o,n,i))x.push({...b,family:y});return x.sort((y,S)=>S.lines-y.lines).slice(0,a)}var vc,Yt=u(()=>{"use strict";l();Ge();Bt();Wn();$n();Qn();Zn();vc=new Set(["css","scss","less"])});import Ue from"path";function Ec(t){let e=new Map;for(let[r,n]of t){let o=n.imports.filter(s=>s.toPath&&!s.isExternal).length;o>0&&e.set(r,o)}return e}function Fc(t,e,r){let n=new Map;for(let[o,s]of e){if(s<r)continue;let i=t.get(o);if(!i||i.category==="test"||i.category==="barrel")continue;let a=Ue.extname(o),c=Ue.basename(o,a),p=c==="index"?Ue.basename(Ue.dirname(o)):c;n.set(o,{path:o,outDegree:s,tag:`feature:${p}`})}return n}function K(t,e){let r=e?.minOutDegree??5;return Fc(t,Ec(t),r)}var Je=u(()=>{"use strict";l()});function Nc(t,e){let r=new Map;for(let n of e.values()){let o=new Set;t.traverse(n.path,s=>(s.path!==n.path&&o.add(s.path),!0),{direction:"outgoing"}),r.set(n.path,o)}return r}function Pc(t,e,r,n){let o=new Map;for(let[s]of t){if(e.has(s))continue;let i=null;for(let a of e.values())r.get(a.path)?.has(s)&&(!i||n(a,i)<0)&&(i=a);i&&o.set(s,i.path)}return o}function Ic(t,e){let r=new Map;for(let n of t.values()){let o=n.tag.replace("feature:",""),s=[];for(let[i,a]of e)a===n.path&&s.push(i);r.set(o,{hub:n.path,outDegree:n.outDegree,files:s})}return r}function Dc(t,e,r){let n=[];for(let o of t.keys())!e.has(o)&&!r.has(o)&&n.push(o);return n}function me(t,e){let r=e?.detectFn??K,n=e?.hubComparator??Tc,o=r(t.nodes,e),s=Nc(t,o),i=Pc(t.nodes,o,s,n);return{features:Ic(o,i),unassigned:Dc(t.nodes,o,i)}}var Tc,Ke=u(()=>{"use strict";l();Je();Tc=(t,e)=>t.outDegree-e.outDegree});function Xt(t){let e=new Map;for(let r of t.nodes.values())e.set(r.type,(e.get(r.type)??0)+1);return[...e.entries()].map(([r,n])=>({type:r,fileCount:n,exportsTracked:eo.has(r),importSymbolsTracked:to.has(r),callEdgesTracked:He.has(r)})).sort((r,n)=>n.fileCount-r.fileCount)}var eo,to,He,qt=u(()=>{"use strict";l();eo=new Set(["typescript","javascript","python","go","scss","less","lua","coffeescript"]),to=new Set(["typescript","javascript","python"]),He=new Set(["typescript","javascript","go","python"])});var ue,ro=u(()=>{"use strict";l();ue=class{constructor(e){this.nodes=e}nodes;findUnusedFiles(e){let r=new Set(this.nodes.keys());return e.filter(n=>!r.has(n))}findHighExportUsage(e){let r=[];for(let n of this.nodes.values()){if(n.maxExportUsage===void 0||n.maxExportUsage<e)continue;let o=n.imports.reduce((s,i)=>(i.exportUsageRatio??0)>(s?.exportUsageRatio??0)?i:s,null);r.push({path:n.path,maxExportUsage:n.maxExportUsage,tightestDep:o?.toPath??""})}return r.sort((n,o)=>o.maxExportUsage-n.maxExportUsage)}findCycles(){let e=[],r=new Set,n=new Set,o=[],s=i=>{r.add(i),n.add(i),o.push(i);let a=this.nodes.get(i);if(a){for(let c of a.imports)if(!(!c.toPath||c.isExternal))if(n.has(c.toPath)){let p=o.indexOf(c.toPath);e.push([...o.slice(p),c.toPath])}else r.has(c.toPath)||s(c.toPath)}n.delete(i),o.pop()};for(let i of this.nodes.keys())r.has(i)||s(i);return e}}});var D,ge=u(()=>{"use strict";l();ro();D=class t{constructor(e){this.nodes=e}nodes;_incomingEdgesCache=null;_callIncomingCache=null;serialize(){return{nodes:Array.from(this.nodes.values())}}static deserialize(e){let r=new Map;for(let n of e.nodes)r.set(n.path,n);return new t(r)}getIncomingEdgesMap(){if(this._incomingEdgesCache)return this._incomingEdgesCache;let e=new Map;for(let r of this.nodes.values())for(let n of r.imports)if(n.toPath){let o=e.get(n.toPath)||[];o.push(r.path),e.set(n.toPath,o)}return this._incomingEdgesCache=e,e}dfs(e,r,n,o){let s=new Set,i=n.maxDepth??1/0,a=(c,p,f)=>{if(p>i||s.has(c))return;let d=this.nodes.get(c);if(d&&(s.add(c),r(d,p,f)!==!1))for(let x of o(c))a(x,p+1,c)};a(e,0,null)}traverse(e,r,n={}){let o=n.direction??"outgoing",s=o==="incoming"?this.getIncomingEdgesMap():null;this.dfs(e,r,n,i=>o==="outgoing"?this.nodes.get(i)?.imports.map(a=>a.toPath).filter(Boolean)??[]:s?.get(i)??[])}getCallIncomingCache(){if(this._callIncomingCache)return this._callIncomingCache;let e=new Map;for(let r of this.nodes.values())for(let n of r.callEdges??[]){let o=e.get(n.toFile)??[];o.push(r.path),e.set(n.toFile,o)}return this._callIncomingCache=e,e}traverseCalls(e,r,n={}){let o=n.direction??"outgoing",s=o==="incoming"?this.getCallIncomingCache():null;this.dfs(e,r,n,i=>o==="outgoing"?this.nodes.get(i)?.callEdges?.map(a=>a.toFile)??[]:s?.get(i)??[])}getCallers(e){let r=[];return this.traverseCalls(e,n=>(n.path!==e&&r.push(n.path),!0),{direction:"incoming",maxDepth:1}),r}getCallEdgesFor(e){return this.nodes.get(e)?.callEdges??[]}getNeighbors(e){let r=this.nodes.get(e);return r?r.imports.map(n=>this.nodes.get(n.toPath)).filter(n=>n!==void 0):[]}findUnusedFiles(e){return new ue(this.nodes).findUnusedFiles(e)}findCycles(){return new ue(this.nodes).findCycles()}}});var H,Ve=u(()=>{"use strict";l();H=class{affectedSymbols=new Map;constructor(e,r){this.affectedSymbols.set(e,new Set(["default",...r]))}updateAffectedSymbols(e,r){let n=this.affectedSymbols.get(r)||new Set,o=e.imports.find(c=>c.toPath===r);if(!o)return!1;let s=o.symbols||["*"],i=new Set;for(let c of s)(c==="*"||n.has("*")||n.has(c))&&i.add("*");if(i.size===0)return!1;let a=this.affectedSymbols.get(e.path)||new Set;for(let c of i)a.add(c);return this.affectedSymbols.set(e.path,a),!0}}});function V(t,e){let r=t.nodes.get(e);if(r)return{category:r.category,exports:r.exports.map(n=>n.name)}}function Zt(t,e,r=1){let n=[];return t.traverse(e,(o,s,i)=>{if(o.path===e)return!0;let a=i?t.nodes.get(i)?.imports.find(c=>c.toPath===o.path):void 0;return n.push({path:o.path,...a?.symbols?{symbols:a.symbols}:{}}),!0},{direction:"outgoing",maxDepth:r}),n}function de(t,e){let r=[];return t.traverse(e,n=>{if(n.path===e)return!0;let o=n.imports.find(s=>s.toPath===e);return r.push({path:n.path,...o?.symbols?{symbols:o.symbols}:{}}),!0},{direction:"incoming",maxDepth:1}),r}function er(t,e,r={}){let{testsOnly:n=!1,changedSymbols:o}=r,s=o?new H(e,o):null,i=[];return t.traverse(e,(a,c,p)=>{if(a.path===e)return!0;if(s&&p&&!s.updateAffectedSymbols(a,p))return!1;let f=a.category==="test"||a.tags.some(d=>d.name==="test");return(!n||f)&&i.push(a.path),!0},{direction:"incoming"}),i}function tr(t,e,r={}){let{depth:n=1,withEdgeDetail:o=!1}=r,s=[];return t.traverseCalls(e,i=>{if(i.path===e)return!0;let a={file:i.path};return o&&(a.edges=(i.callEdges??[]).filter(c=>c.toFile===e).map(c=>({from:c.from,to:c.to}))),s.push(a),!0},{direction:"incoming",maxDepth:n}),s}function rr(t,e={}){let{metric:r="cognitiveComplexity",threshold:n=10,limit:o=20}=e;return[...t.nodes.values()].flatMap(s=>(s.functions??[]).filter(i=>i[r]>=n).map(i=>({file:s.path,name:i.name,line:i.line,complexity:i.complexity,cognitiveComplexity:i.cognitiveComplexity}))).sort((s,i)=>i[r]-s[r]).slice(0,o)}function nr(t){return{nodes:t.nodes.map(r=>({path:r.path,type:r.type,category:r.category,exports:r.exports.map(n=>n.name),tags:r.tags.filter(n=>n.kind==="comment-marker"||n.kind==="import").map(n=>n.name),importsFiles:r.imports.filter(n=>!n.isExternal&&n.toPath).map(n=>n.toPath),...r.description!==void 0&&{description:r.description},...r.testedBy!==void 0&&{testedBy:r.testedBy},...r.coveragePct!==void 0&&{coveragePct:r.coveragePct},...r.avgExportUsage!==void 0&&{avgExportUsage:r.avgExportUsage},...r.maxExportUsage!==void 0&&{maxExportUsage:r.maxExportUsage}})),cycles:t.cycles}}function or(t){let e=t.getPackageDependencies(),r=Array.from(t.packages.values()).map(({graph:n,pkg:o})=>({name:o.name,relativeRoot:o.relativeRoot,nodeCount:n.nodes.size,dependsOn:e.get(o.name)??[]}));return{monorepoType:t.type,packageCount:r.length,packages:r}}function sr(t){return[...t.nodes.values()].some(e=>e.coveragePct!==void 0)}var ir=u(()=>{"use strict";l();Ve()});function no(t){if(t.category==="test")return"test";if(t.category==="config")return"config";if(t.category==="type-only")return"types";let e=t.path;return k(e,"component")||k(e,"components")?"component":k(e,"controller")||k(e,"controllers")?"controller":k(e,"middleware")?"middleware":k(e,"router")||k(e,"routes")||k(e,"route")?"router":k(e,"store")||k(e,"stores")?"store":k(e,"service")||k(e,"services")?"service":k(e,"handler")||k(e,"handlers")?"handler":k(e,"adapter")||k(e,"adapters")?"adapter":k(e,"plugin")||k(e,"plugins")?"plugin":k(e,"api")?"api":k(e,"cli")||k(e,"commands")||he(e)==="cli"?"cli":k(e,"util")||k(e,"utils")||k(e,"helper")||k(e,"helpers")?"util":k(e,"model")||k(e,"models")||he(e)==="model"?"model":k(e,"parser")||k(e,"parsers")||he(e)==="parser"?"parser":he(e)==="builder"?"builder":he(e)==="resolver"?"resolver":"other"}function k(t,e){return t.includes(`/${e}/`)||t.includes(`/${e}.`)}function he(t){let e=t.slice(t.lastIndexOf("/")+1);return e.slice(0,e.lastIndexOf("."))||e}var oo=u(()=>{"use strict";l()});function ar(t,e){let r=me(t,e),n=new Map;for(let[s,i]of r.features){for(let a of i.files)n.set(a,s);n.set(i.hub,s)}let o=new Map;for(let s of t.nodes.values()){let i=n.get(s.path);o.set(s.path,{path:s.path,role:no(s),...s.description?{description:s.description}:{},exports:s.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return o}var cr=u(()=>{"use strict";l();Ke();oo()});function lr(t,e){let r=[];for(let n of t.nodes.values())if(n.exports.some(o=>o.name===e))if(He.has(n.type)){let o=[];for(let s of t.nodes.values())for(let i of s.callEdges??[])i.to===e&&o.push({file:s.path,callerFunction:i.from});r.push({path:n.path,category:n.category,precision:"call",callers:o})}else{let o=de(t,n.path).map(s=>({file:s.path,...s.symbols?{symbols:s.symbols}:{}}));r.push({path:n.path,category:n.category,precision:"file-level",importers:o})}return r}var so=u(()=>{"use strict";l();qt();ir()});function Mc(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function Ac(t,e){if(e==="type-only")return!0;let r=t.signature??"";return r.startsWith("interface ")||r.startsWith("class ")||r.startsWith("enum ")}function pr(t){let e=new Map;for(let n of t.nodes.values())if(!(n.type!=="typescript"&&n.type!=="javascript"))for(let o of n.exports){if(!Ac(o,n.category))continue;let s=`${n.path}::${o.name}`;e.set(s,{name:o.name,file:n.path,kind:Mc(o.signature),...o.doc?{doc:o.doc}:{}})}let r=[];for(let n of t.nodes.values())if(!(n.type!=="typescript"&&n.type!=="javascript")){for(let o of n.imports)if(!(!o.toPath||o.isExternal||!o.symbols?.length))for(let s of o.symbols)e.has(`${o.toPath}::${s}`)&&r.push({fromFile:n.path,toType:s,toFile:o.toPath})}return{types:e,edges:r}}function fr(t,e){let r=null;for(let s of t.types.values())if(s.name===e){r=s;break}if(!r)return{type:null,usedByFiles:[],uses:[]};let n=new Set,o=new Map;for(let s of t.edges)if(s.toType===e&&s.toFile===r.file&&n.add(s.fromFile),s.fromFile===r.file){let i=t.types.get(`${s.toFile}::${s.toType}`);i&&o.set(`${i.file}::${i.name}`,i)}return{type:r,usedByFiles:Array.from(n),uses:Array.from(o.values())}}var mr=u(()=>{"use strict";l()});import io from"fs";import $u from"path";function ao(t){try{return io.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function Qe(t){try{return io.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Ye=u(()=>{"use strict";l()});import ye from"fs";import M from"path";function ur(t,e){let r=M.join(e,"package.json");if(!ye.existsSync(r))return null;let n={};try{n=JSON.parse(ye.readFileSync(r,"utf-8"))}catch{return null}let o=n.name;return o?{name:o,root:e,relativeRoot:M.relative(t,e),entryPoints:Rc(e,n)}:null}function Rc(t,e){let r=[];if(e.exports){let o=e.exports;if(typeof o=="string")r.push(M.join(t,o));else if(typeof o=="object"&&o!==null){let s=o["."];if(typeof s=="string")r.push(M.join(t,s));else if(typeof s=="object"&&s!==null){let i=s.import??s.require??s.default;typeof i=="string"&&r.push(M.join(t,i))}}}e.main&&r.push(M.join(t,e.main));for(let o of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])r.push(M.join(t,o));let n=r.filter(Qe);return n.length>0?n.slice(0,1):r.slice(0,1)}function ne(t,e){let r=[],n=new Set;for(let o of e){let s=o.replace(/\/$/,"").replace(/^\.\//,"");Lc(t,s,n,r)}return r}function Lc(t,e,r,n){if(!e.includes("*")){Oc(t,e,r,n);return}let o=e.split("/");o.includes("**")?Gc(t,o,r,n):_c(t,o,r,n)}function Oc(t,e,r,n){let o=M.join(t,e);if(r.has(o)||!ao(o))return;r.add(o);let s=ur(t,o);s&&n.push(s)}function Gc(t,e,r,n){let o=M.join(t,e[0]==="**"?"":e[0]??"");co(t,o,r,n)}function _c(t,e,r,n){let o=e.findIndex(a=>a.includes("*")),s=M.join(t,...e.slice(0,o)),i;try{i=ye.readdirSync(s,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let c=M.join(s,a.name);if(r.has(c))continue;r.add(c);let p=ur(t,c);p&&n.push(p)}}function co(t,e,r,n){let o;try{o=ye.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name==="node_modules"||s.name.startsWith("."))continue;let i=M.join(e,s.name);if(ye.existsSync(M.join(i,"package.json"))&&!r.has(i)){r.add(i);let a=ur(t,i);a&&n.push(a)}else co(t,i,r,n)}}var Xe=u(()=>{"use strict";l();Ye();Ye()});import gr from"fs";import lo from"path";var po,fo=u(()=>{"use strict";l();Xe();po={type:"npm",detect(t){let e=lo.join(t,"package.json");if(!gr.existsSync(e))return null;let r;try{r=JSON.parse(gr.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r||gr.existsSync(lo.join(t,"yarn.lock")))return null;let n=Array.isArray(r)?r:r.packages??[];return n.length===0?null:ne(t,n)}}});import oe from"fs";import P from"path";function uo(t,e,r,n){if(n>4)return[];let o;try{o=oe.readdirSync(e,{withFileTypes:!0})}catch{return[]}let s=[];for(let i of o){if(!i.isDirectory())continue;let a=i.name;if(a.startsWith(".")||a==="node_modules"||a==="dist"||a===".nx")continue;let c=P.join(e,a);oe.existsSync(P.join(c,"project.json"))&&!r.has(c)?(r.add(c),s.push(c)):s.push(...uo(t,c,r,n+1))}return s}function jc(t,e,r){let n={};try{n=JSON.parse(oe.readFileSync(r,"utf-8"))}catch{return null}let o=n.name,s,i,a=P.join(e,"package.json");if(oe.existsSync(a))try{let c=JSON.parse(oe.readFileSync(a,"utf-8"));o=c.name??o,s=c.main,i=c.exports}catch{}return o?{name:o,root:e,relativeRoot:P.relative(t,e),entryPoints:Wc(e,n,s,i)}:null}function Wc(t,e,r,n){let o=[],s=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(s){let a=P.resolve(t,"../..");o.push(P.resolve(a,s)),o.push(P.resolve(t,s))}if(n){let a=n;if(typeof a=="string")o.push(P.join(t,a));else if(typeof a=="object"&&a!==null){let c=a["."];typeof c=="string"&&o.push(P.join(t,c))}}if(r&&o.push(P.join(t,r)),e.sourceRoot){let a=P.resolve(t,"../.."),c=P.resolve(a,e.sourceRoot);o.push(P.join(c,"index.ts"),P.join(c,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])o.push(P.join(t,a));let i=o.filter(Qe);return i.length>0?i.slice(0,1):o.slice(0,1)}var mo,go=u(()=>{"use strict";l();Ye();mo={type:"nx",detect(t){return oe.existsSync(P.join(t,"nx.json"))?uo(t,t,new Set,0).map(r=>jc(t,r,P.join(r,"project.json"))).filter(r=>r!==null):null}}});import ho from"fs";import zc from"path";import{load as $c}from"js-yaml";var yo,xo=u(()=>{"use strict";l();Xe();yo={type:"pnpm",detect(t){let e=zc.join(t,"pnpm-workspace.yaml");if(!ho.existsSync(e))return null;let r=[];try{r=$c(ho.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return ne(t,r)}}});import Bc from"fs";import Uc from"path";var bo,So=u(()=>{"use strict";l();bo={type:"turborepo",detect(t){return Bc.existsSync(Uc.join(t,"turbo.json"))?[]:null}}});import dr from"fs";import Co from"path";var vo,ko=u(()=>{"use strict";l();Xe();vo={type:"yarn",detect(t){if(!dr.existsSync(Co.join(t,"yarn.lock")))return null;let e=Co.join(t,"package.json");if(!dr.existsSync(e))return null;let r;try{r=JSON.parse(dr.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r)return null;let n=Array.isArray(r)?r:r.packages??[];return n.length===0?null:ne(t,n)}}});function j(t){wo.push(t)}function Eo(){return wo}var wo,qe=u(()=>{"use strict";l();wo=[]});import Jc from"path";function hr(t,e=Eo()){let r=Jc.resolve(t),n=new Map,o=[];for(let i of e){let a=i.detect(r);if(a!==null){o.push(i.type);for(let c of a)n.has(c.name)||n.set(c.name,c)}}if(o.length===0)return{root:r,type:"none",types:[],packages:[],packageMap:new Map};let s=Array.from(n.values());return{root:r,type:o[0],types:o,packages:s,packageMap:new Map(s.map(i=>[i.name,i]))}}var yr=u(()=>{"use strict";l();fo();go();xo();So();ko();qe();qe();j(bo);j(mo);j(yo);j(vo);j(po)});var xe,xr=u(()=>{"use strict";l();ge();xe=class t{constructor(e,r){this.monorepoRoot=e;this.type=r}monorepoRoot;type;packages=new Map;addPackage(e,r){this.packages.set(e.name,{graph:r,pkg:e})}getPackageForFile(e){for(let{pkg:r}of this.packages.values())if(e===r.relativeRoot||e.startsWith(`${r.relativeRoot}/`))return r}getPackageDependencies(){let e=new Map;for(let{graph:r,pkg:n}of this.packages.values()){let o=new Set;for(let s of r.nodes.values())for(let i of s.imports)i.isWorkspace&&i.workspacePackage&&o.add(i.workspacePackage);e.set(n.name,[...o])}return e}getAffectedAcrossPackages(e){let r=this.getPackageForFile(e);if(!r)return[];let n=this.packages.get(r.name);if(!n)return[];let o=[];n.graph.traverse(e,s=>(s.path!==e&&o.push({file:s.path,package:r.name}),!0),{direction:"incoming"});for(let{graph:s,pkg:i}of this.packages.values())if(i.name!==r.name)for(let a of s.nodes.values())a.imports.some(p=>p.isWorkspace&&p.workspacePackage===r.name)&&o.push({file:a.path,package:i.name});return o}serialize(){return{monorepoRoot:this.monorepoRoot,type:this.type,packages:Array.from(this.packages.values()).map(({graph:e,pkg:r})=>({pkg:{name:r.name,relativeRoot:r.relativeRoot,entryPoints:r.entryPoints},nodes:Array.from(e.nodes.values())}))}}static deserialize(e){let r=new t(e.monorepoRoot,e.type);for(let{pkg:n,nodes:o}of e.packages){let s=new Map(o.map(a=>[a.path,a])),i=new D(s);r.packages.set(n.name,{graph:i,pkg:{...n,root:""}})}return r}}});function se(t,e){Fo.set(t,e)}function To(t){return Fo.get(t)}var Fo,be=u(()=>{"use strict";l();Fo=new Map});function No(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function Kc(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}function Se(t,e,r){return Sl.every(n=>n(t,e,r))}var Hc,Vc,Qc,Yc,Xc,qc,Zc,el,tl,rl,nl,ol,sl,il,al,cl,ll,pl,fl,ml,ul,gl,dl,hl,yl,xl,bl,Sl,br=u(()=>{"use strict";l();Hc=(t,e)=>!e.category||No(t.category,e.category),Vc=(t,e)=>!e.type||No(t.type,e.type),Qc=(t,e)=>e.lastAuthor?e.lastAuthor.startsWith("!")?t.lastAuthor!==e.lastAuthor.slice(1):t.lastAuthor!==void 0&&t.lastAuthor===e.lastAuthor:!0,Yc=(t,e)=>!e.path||Kc(t.path,e.path),Xc=(t,e)=>e.isExternal===void 0?!0:t.imports.some(n=>n.isExternal)===e.isExternal,qc=(t,e)=>{if(!e.tags||e.tags.length===0)return!0;let r=e.tags.filter(o=>!o.startsWith("!")),n=e.tags.filter(o=>o.startsWith("!")).map(o=>o.slice(1));return!(r.length>0&&!r.some(o=>t.tags.some(s=>s.name===o))||n.some(o=>t.tags.some(s=>s.name===o)))},Zc=(t,e)=>!e.allTags?.length||e.allTags.every(r=>t.tags.some(n=>n.name===r)),el=(t,e)=>!e.importsFile||t.imports.some(r=>r.toPath?.includes(e.importsFile)),tl=(t,e,r)=>e.importedBy===void 0?!0:(r?.get(t.path)??[]).some(o=>o.includes(e.importedBy)),rl=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,nl=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,ol=(t,e)=>e.minSize===void 0||t.size>=e.minSize,sl=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,il=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,al=(t,e)=>e.isDocumented===void 0||!!t.documentedBy?.length===e.isDocumented,cl=(t,e)=>e.isStale===void 0||!!t.staleFor?.length===e.isStale,ll=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,pl=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,fl=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,ml=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,ul=(t,e)=>e.minComplexity===void 0||(t.complexity??-1/0)>=e.minComplexity,gl=(t,e)=>e.maxComplexity===void 0||(t.complexity??0)<=e.maxComplexity,dl=(t,e)=>e.minCognitiveComplexity===void 0||(t.cognitiveComplexity??-1/0)>=e.minCognitiveComplexity,hl=(t,e)=>e.maxCognitiveComplexity===void 0||(t.cognitiveComplexity??0)<=e.maxCognitiveComplexity,yl=(t,e)=>e.minCommits===void 0||(t.commitCount90d??-1/0)>=e.minCommits,xl=(t,e)=>e.maxCommits===void 0||(t.commitCount90d??0)<=e.maxCommits,bl=(t,e,r)=>!e.any?.length||e.any.some(n=>Se(t,n,r)),Sl=[Hc,Vc,Qc,Yc,Xc,qc,Zc,el,tl,rl,nl,ol,sl,il,al,cl,ll,pl,fl,ml,ul,gl,dl,hl,yl,xl,bl]});function Ze(t,e){let r=new Map;if(e.importedBy!==void 0){for(let i of t.nodes)for(let a of i.imports)if(a.toPath){let c=r.get(a.toPath)??[];c.push(i.path),r.set(a.toPath,c)}}let n=t.nodes.filter(i=>Se(i,e,r)),o=new Set(n.map(i=>i.path)),s=n.map(i=>({...i,imports:i.imports.filter(a=>!a.toPath||o.has(a.toPath))}));if(e.sort){let i=e.sortDir==="asc"?-1:1;s.sort((a,c)=>{let p=0;return e.sort==="size"?p=c.size-a.size:e.sort==="imports"?p=c.imports.length-a.imports.length:e.sort==="commitCount90d"?p=(c.commitCount90d??0)-(a.commitCount90d??0):e.sort==="exportUsage"?p=(c.avgExportUsage??0)-(a.avgExportUsage??0):e.sort==="complexity"?p=(c.complexity??0)-(a.complexity??0):e.sort==="cognitiveComplexity"&&(p=(c.cognitiveComplexity??0)-(a.cognitiveComplexity??0)),p*i})}return e.limit!==void 0&&s.splice(e.limit),{nodes:s,cycles:t.cycles?.filter(i=>i.every(a=>o.has(a)))??void 0}}var Po=u(()=>{"use strict";l();br();br()});function Io(t,e){let r=e.indexOf(":");if(r===-1)return;let n=e.slice(0,r).trim().toLowerCase(),o=e.slice(r+1).trim();if(!(!n||!o))switch(n){case"category":t.category=o;break;case"type":t.type=o;break;case"tag":case"tags":o.includes("+")?t.allTags=[...t.allTags??[],...o.split("+")]:t.tags=[...t.tags??[],o];break;case"path":t.path=o;break;case"external":t.isExternal=o.toLowerCase()==="true";break;case"importsfile":t.importsFile=o;break;case"importedby":t.importedBy=o;break;case"minimports":t.minImports=parseInt(o,10);break;case"maximports":t.maxImports=parseInt(o,10);break;case"minsize":t.minSize=parseInt(o,10);break;case"maxsize":t.maxSize=parseInt(o,10);break;case"sort":t.sort=o;break;case"sortdir":t.sortDir=o.toLowerCase()==="asc"?"asc":"desc";break;case"limit":t.limit=parseInt(o,10);break;case"hasdocstring":t.hasDocstring=o.toLowerCase()!=="false";break;case"mincoverage":t.minCoverage=parseInt(o,10);break;case"maxcoverage":t.maxCoverage=parseInt(o,10);break;case"minexportusage":t.minExportUsage=parseFloat(o);break;case"maxexportusage":t.maxExportUsage=parseFloat(o);break;case"mincomplexity":t.minComplexity=parseInt(o,10);break;case"maxcomplexity":t.maxComplexity=parseInt(o,10);break;case"mincognitivecomplexity":t.minCognitiveComplexity=parseInt(o,10);break;case"maxcognitivecomplexity":t.maxCognitiveComplexity=parseInt(o,10);break;case"mincommits":t.minCommits=parseInt(o,10);break;case"maxcommits":t.maxCommits=parseInt(o,10);break;case"isdocumented":t.isDocumented=o.toLowerCase()!=="false";break;case"isstale":t.isStale=o.toLowerCase()!=="false";break;case"lastauthor":t.lastAuthor=o;break}}function Cl(t){let e=[];for(let r of t.split("|")){let n=r.trim();if(!n)continue;let o={};Io(o,n),Object.keys(o).length>0&&e.push(o)}return e}function et(t){let e={},r=t.split(",");for(let n of r){let o=n.trim();if(o.toLowerCase().startsWith("any(")&&o.endsWith(")")){let s=o.slice(4,-1),i=Cl(s);i.length>0&&(e.any=[...e.any??[],...i]);continue}Io(e,n)}return e}var Do=u(()=>{"use strict";l()});var Mo=u(()=>{"use strict";l();Po();Do()});import vl from"path";import F from"typescript";function Q(t,e){let r=t[e];if(r===void 0)throw new Error(`Index ${e} out of bounds (length ${t.length})`);return r}function Sr(t){let e=[];for(let r of t.statements){if(!F.isExpressionStatement(r))continue;let n=r.expression;if(!F.isCallExpression(n))continue;let o=n.expression;F.isIdentifier(o)&&Ao.has(o.text)&&e.push(n),F.isPropertyAccessExpression(o)&&F.isIdentifier(o.expression)&&Ao.has(o.expression.text)&&e.push(n)}return e}function Cr(t,e,r){for(let n of t.arguments){if(!F.isObjectLiteralExpression(n))continue;let o=n.properties.find(s=>F.isPropertyAssignment(s)&&F.isIdentifier(s.name)&&s.name.text===e);if(!(!o||!F.isArrayLiteralExpression(o.initializer)))return o.initializer.elements.filter(F.isStringLiteral).map(s=>s.text)}return null}function vr(t,e,r,n){if(t.arguments.length===0)return null;for(let s=1;s<t.arguments.length;s++){let i=Q(t.arguments,s);if(!F.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>F.isPropertyAssignment(p)&&F.isIdentifier(p.name)&&p.name.text===e);if(a)return{start:a.initializer.getStart(n),end:a.initializer.getEnd(),text:r};let c=i.getEnd()-1;return{start:c,end:c,text:`${i.properties.length>0?", ":""}${e}: ${r}`}}let o=Q(t.arguments,t.arguments.length-1);return{start:o.getStart(n),end:o.getStart(n),text:`{ ${e}: ${r} }, `}}function kr(t,e,r){let n=t.arguments;for(let o=1;o<n.length;o++){let s=Q(n,o);if(!F.isObjectLiteralExpression(s))continue;let i=s.properties.findIndex(c=>F.isPropertyAssignment(c)&&F.isIdentifier(c.name)&&c.name.text===e);if(i<0)continue;if(s.properties.length===1)return{start:Q(n,o-1).getEnd(),end:s.getEnd(),text:""};let a=Q(s.properties,i);return i===s.properties.length-1?{start:Q(s.properties,i-1).getEnd(),end:a.getEnd(),text:""}:{start:a.getStart(r),end:Q(s.properties,i+1).getStart(r),text:""}}return null}function wr(t,e){let r=[...e].sort((o,s)=>s.start-o.start),n=t;for(let o of r)n=n.slice(0,o.start)+o.text+n.slice(o.end);return n}function Er(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}function kl(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}function tt(t,e,r,n){let o=F.createSourceFile(vl.basename(t),e,F.ScriptTarget.Latest,!0),s=Sr(o),[i]=s;if(!i)return e;let a=Cr(i,n,o),c=[...r].sort();if(a!==null&&JSON.stringify(kl(a).sort())===JSON.stringify(c))return e;let p=Er(c.map(d=>`@${d}`)),f=s.flatMap(d=>{let x=r.length===0?kr(d,n,o):vr(d,n,p,o);return x?[x]:[]});return f.length>0?wr(e,f):e}var Ao,_,ie=u(()=>{"use strict";l();Ao=new Set(["describe","test","it"]);_=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import wl from"path";var rt,Ro=u(()=>{"use strict";l();ie();rt=class{name="cypress";canHandle(e){return _.has(wl.extname(e).toLowerCase())}apply(e,r,n){return tt(e,r,n,"tags")}}});import El from"path";function Fl(t){return`${["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
|
|
8
|
+
`)}
|
|
5
9
|
|
|
6
|
-
`}function
|
|
7
|
-
`}function
|
|
8
|
-
|
|
9
|
-
`)
|
|
10
|
+
`}function Tl(t){let e=new Set;Tr.lastIndex=0;let r=Tr.exec(t);for(;r!==null;)r[1]&&e.add(r[1]),r=Tr.exec(t);return e}var Fr,Tr,nt,Lo=u(()=>{"use strict";l();Fr=/# <mokosh-tags>[\s\S]*?# <\/mokosh-tags>\n*/,Tr=/^@([a-zA-Z0-9_-]+)/gm;nt=class{name="gherkin";canHandle(e){return El.extname(e).toLowerCase()===".feature"}apply(e,r,n){let o=r.replace(Fr,""),s=Tl(o),i=n.filter(c=>!s.has(c)),a=i.length>0?Fl(i):"";return Fr.test(r)?r.replace(Fr,a):a?r.replace(/^(Feature:)/m,`${a}$1`):r}}});function Oo(t,e){let r=t.replace(/\\/g,"/"),n=e.replace(/\\/g,"/"),o="";for(let s=0;s<r.length;s++){let i=r[s];i==="*"?r[s+1]==="*"?(o+=".*",s++):o+="[^/]*":i==="?"?o+="[^/]":i!==void 0&&(o+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&"))}return new RegExp(`^${o}$`).test(n)}var Go=u(()=>{"use strict";l()});import Nl from"path";function Il(t){return`//go:build ${t.map(r=>`mokosh_${r}`).join(" || ")}
|
|
11
|
+
`}function Dl(t){let e=Nr.exec(t);if(!e)return null;let r=e[0]??"",n=/mokosh_([a-zA-Z0-9_-]+)/g,o=[],s=n.exec(r);for(;s!==null;)s[1]&&o.push(s[1]),s=n.exec(r);return o}var Nr,Pl,ot,_o=u(()=>{"use strict";l();Nr=/^\/\/go:build mokosh_[^\n]+\n/m,Pl=/^package\s+\S+/m;ot=class{name="go";canHandle(e){return Nl.basename(e).endsWith("_test.go")}apply(e,r,n){let o=Dl(r),s=[...n].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(s))return r;if(n.length===0)return r.replace(Nr,"");let i=Il(s);if(o!==null)return r.replace(Nr,i);let a=Pl.exec(r);if(!a)return r;let c=a.index;return`${r.slice(0,c)+i}
|
|
12
|
+
${r.slice(c)}`}}});import Ml from"path";function Rl(t){return`${["/**",...t.map(e=>` * @group ${e}`)," */"].join(`
|
|
13
|
+
`)}
|
|
10
14
|
|
|
11
|
-
`}function
|
|
12
|
-
`),r=-1;
|
|
15
|
+
`}function Ll(t){let e=[];Pr.lastIndex=0;let r=Pr.exec(t);for(;r!==null;)r[1]&&e.push(r[1]),r=Pr.exec(t);return e}var Al,Pr,st,jo=u(()=>{"use strict";l();ie();Al=/^\/\*\*\n(?: \* @group .+\n)+ \*\/\n+/,Pr=/^ \* @group (.+)$/gm;st=class{name="jest";canHandle(e){return _.has(Ml.extname(e).toLowerCase())}apply(e,r,n){let o=Al.exec(r),s=o?Ll(o[0]):null,i=[...n].sort();if(s!==null&&JSON.stringify([...s].sort())===JSON.stringify(i))return r;let a=o?r.slice(o[0].length):r;return n.length===0?a:Rl(i)+a}}});import Ol from"path";var it,Wo=u(()=>{"use strict";l();ie();it=class{name="playwright";canHandle(e){return _.has(Ol.extname(e).toLowerCase())}apply(e,r,n){return tt(e,r,n,"tag")}}});import Gl from"path";function jl(t){let e=t.map(r=>`pytest.mark.${r}`).join(", ");return t.length===1?`pytestmark = pytest.mark.${t[0]}`:`pytestmark = [${e}]`}function Wl(t){let e=Ir.exec(t);if(!e)return null;let r=e[0],n=[],o=/pytest\.mark\.([a-zA-Z0-9_-]+)/g,s=o.exec(r);for(;s!==null;)s[1]&&n.push(s[1]),s=o.exec(r);return n}function zl(t){let e=t.split(`
|
|
16
|
+
`),r=-1;return e.forEach((o,s)=>{(o.trimStart().startsWith("import ")||o.trimStart().startsWith("from "))&&(r=s)}),r<0?0:e.slice(0,r+1).reduce((o,s)=>o+s.length+1,0)}var Ir,_l,at,zo=u(()=>{"use strict";l();Ir=/^pytestmark\s*=\s*.+$/m,_l=/^import pytest\s*$/m;at=class{name="pytest";canHandle(e){return Gl.extname(e).toLowerCase()===".py"}apply(e,r,n){let o=Wl(r),s=[...n].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(s))return r;if(n.length===0)return r.replace(Ir,"").replace(/\n{3,}/g,`
|
|
13
17
|
|
|
14
|
-
`);let i=
|
|
15
|
-
`,
|
|
18
|
+
`);let i=jl(s);if(o!==null)return r.replace(Ir,i);let a=_l.test(r),c=zl(r),p=r.slice(0,c),f=r.slice(c),d=a?"":`import pytest
|
|
19
|
+
`,x=p.endsWith(`
|
|
16
20
|
|
|
17
21
|
`)?"":`
|
|
18
|
-
`;return
|
|
19
|
-
|
|
20
|
-
`)){if(
|
|
21
|
-
`).map(
|
|
22
|
-
`).filter(c=>c.trim().length>0&&!c.trim().startsWith("#"));if(n.length<2)continue;let s=n[0];if(!s||s.startsWith(" "))continue;let o=_c(s);if(o.length===0)continue;let a=n.find(c=>c.trim().startsWith('version "'))?.match(/version "(.*?)"/)?.[1]??"";for(let c of o)e.dependencies[c]={version:a}}return e}function Uc(t){let e=at.readFileSync(t,"utf-8"),r=JSON.parse(e),n={dependencies:{}};if(r.packages)for(let[s,o]of Object.entries(r.packages)){if(!s.startsWith("node_modules/"))continue;let i=s.replace("node_modules/","");i.includes("node_modules/")||(n.dependencies[i]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}else if(r.dependencies)for(let[s,o]of Object.entries(r.dependencies))n.dependencies[s]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}};return n}function Bc(t){let e=at.readFileSync(t,"utf-8");if(e.includes("__metadata:")){let r=zc(e);if(r!==null)return r}return $c(e)}function Jc(t){let e=at.readFileSync(t,"utf-8"),r={dependencies:{}};try{let n=xs(e);if(n.packages)for(let[s,o]of Object.entries(n.packages)){let{name:i,version:a}=Wc(s,o.version);i&&(r.dependencies[i]={version:a,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}if(n.dependencies)for(let[s,o]of Object.entries(n.dependencies)){if(r.dependencies[s])continue;let i=typeof o=="string"?o:o.version;r.dependencies[s]={version:i||""}}}catch{}return r}function bs(t){let e=[["package-lock.json",Uc],["yarn.lock",Bc],["pnpm-lock.yaml",Jc]];for(let[r,n]of e){let s=jc.join(t,r);if(at.existsSync(s))return n(s)}return null}var Cs=m(()=>{"use strict";l()});import vs from"path";function j(t){switch(vs.extname(t).toLowerCase()){case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".ts":case".tsx":return"typescript";case".css":return"css";case".scss":case".sass":return"scss";case".less":return"less";case".styl":return"stylus";case".coffee":return"coffeescript";case".ls":return"livescript";case".lua":return"lua";case".py":return"python";case".go":return"go";case".java":case".cpp":case".cc":case".cxx":case".c":return"unknown";case".feature":return"gherkin";case".md":case".mdx":return"markdown";default:return"unknown"}}function D(t){let e=vs.extname(t).toLowerCase();return[".css",".scss",".sass",".less",".styl"].includes(e)}var _=m(()=>{"use strict";l()});function W(t){return t.startsWith("'")||t.startsWith('"')?t.slice(1,-1):t}var ct=m(()=>{"use strict";l()});import Kc from"coffeescript";function Es(t){if(t){if(typeof t.originalValue=="string")return t.originalValue;if(typeof t.value=="string")return W(t.value)}}function J(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function Hc(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,n=r.exec(t);for(;n!==null;)n[1]&&e.add(n[1]),n=r.exec(t);return e}function Vc(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Qc(t,e){let r=Es(e.source);return r?{fromPath:t,toPath:"",rawSpecifier:r,isStyle:D(r),type:"static"}:null}function Xc(t,e){let r=e.variable?.base?.value==="require",n=Es(e.args?.[0]?.base);return!r||!n?null:{fromPath:t,toPath:"",rawSpecifier:n,isStyle:D(n),type:"require"}}function ks(t,e){if(e)return[{name:e}];let r=t.value;if(r?.constructor?.name==="Class"){let s=J(r.variable);return s?[{name:s}]:[]}if(r?.base?.constructor?.name==="Obj"&&Array.isArray(r.base.properties))return r.base.properties.map(s=>J(s.variable)??J(s)).filter(s=>!!s).map(s=>({name:s}));let n=J(r);return n?[{name:n}]:[]}function Yc(t){if(Array.isArray(t.specifiers))return t.specifiers.map(r=>r.identifier??r.original?.value).filter(r=>!!r).map(r=>({name:r}));let e=J(t.variable)??J(t.variable?.base);return e?[{name:e}]:[]}function qc(t,e,r,n){let s=e.constructor?.name;if(s==="ImportDeclaration"){let o=Qc(t,e);o&&r.push(o)}else if(s==="Call"){let o=Xc(t,e);o&&r.push(o)}else if(s==="Assign"){let o=J(e.variable?.base),i=e.variable?.properties?.[0]?.name?.value;o==="module"&&i==="exports"?n.push(...ks(e,void 0)):o==="exports"&&typeof i=="string"&&n.push(...ks(e,i))}else s==="ExportNamedDeclaration"&&e.clause?n.push(...Yc(e.clause)):s==="ExportDefaultDeclaration"&&n.push({name:"default"})}function xr(t,e,r,n){if(!(!e||typeof e!="object")){qc(t,e,r,n);for(let s in e){if(s==="locationData")continue;let o=e[s];if(!(!o||typeof o!="object"))if(Array.isArray(o))for(let i of o)xr(t,i,r,n);else xr(t,o,r,n)}}}function ws(t,e){let r=Hc(e),n=Vc(t,r),s=[],o=[];try{xr(t,Kc.nodes(e),s,o)}catch{}let i=new Set,a=o.filter(c=>i.has(c.name)?!1:(i.add(c.name),!0));return{imports:s,exports:a,tags:Array.from(r).map(c=>({name:c,kind:"comment-marker"})),category:n}}var Ns=m(()=>{"use strict";l();_();ct()});import{AstBuilder as Zc,GherkinClassicTokenMatcher as el,Parser as tl}from"@cucumber/gherkin";import{IdGenerator as rl}from"@cucumber/messages";function Sr(t,e){let r=new Set;try{let n=new Zc(nl),s=new el,i=new tl(n,s).parse(e);i.feature&&(i.feature.tags.forEach(a=>{r.add(a.name.startsWith("@")?a.name.slice(1):a.name)}),i.feature.children.forEach(a=>{a.scenario&&(a.scenario.tags.forEach(c=>{r.add(c.name.startsWith("@")?c.name.slice(1):c.name)}),a.scenario.examples.forEach(c=>{c.tags.forEach(p=>{r.add(p.name.startsWith("@")?p.name.slice(1):p.name)})})),a.rule&&a.rule.children.forEach(c=>{c.scenario&&c.scenario.tags.forEach(p=>{r.add(p.name.startsWith("@")?p.name.slice(1):p.name)})})}))}catch(n){console.warn(`[GherkinParser] Failed to parse ${t}:`,n)}return{imports:[],exports:[],tags:Array.from(r).map(n=>({name:n,kind:"comment-marker"})),category:"test"}}var nl,Fs=m(()=>{"use strict";l();Se();nl=rl.uuid();re("gherkin",Sr)});function K(t){let e=[],r=t.firstChild;for(;r;)e.push(r),r=r.nextSibling;return e}function Ce(t,e){let r=1;for(let n=0;n<e&&n<t.length;n++)t[n]===`
|
|
23
|
-
`&&r++;return r}var br=m(()=>{"use strict";l()});function sl(t,e){let r=1;function n(s){switch(s.type.name){case"IfStatement":case"ForStatement":r++;break;case"Case":{s.firstChild?.type.name==="case"&&r++;break}case"LogicOp":{let i=e.slice(s.from,s.to);(i==="&&"||i==="||")&&r++;break}}let o=s.firstChild;for(;o;)n(o),o=o.nextSibling}return n(t),r}function ol(t,e){let r=0;function n(s,o,i){let a=s.type.name;if(a==="IfStatement"){r+=i?1:1+o;let g=K(s),h=i?o:o+1,y=g[1];y&&y.type.name!=="Block"&&n(y,h,!1);let x=g.find(C=>C.type.name==="Block");x&&n(x,h,!1);let E=g.findIndex(C=>C.type.name==="else");if(E>=0){let C=g[E+1];C?.type.name==="IfStatement"?n(C,o,!0):C&&(r+=1,n(C,o+1,!1))}return}if(a==="ForStatement"||a==="SwitchStatement"||a==="SelectStatement"){r+=1+o;let g=s.firstChild;for(;g;)n(g,o+1,!1),g=g.nextSibling;return}if(a==="LogicOp"){let g=e.slice(s.from,s.to);(g==="&&"||g==="||")&&(r+=1)}if(o>0&&a==="FunctionLiteral"){r+=1+o;let g=s.firstChild;for(;g;)n(g,o+1,!1),g=g.nextSibling;return}let p=s.firstChild;for(;p;)n(p,o,!1),p=p.nextSibling}return n(t,0,!1),r}function lt(t,e){return{complexity:sl(t,e),cognitiveComplexity:ol(t,e)}}function Cr(t,e){let n=t.getChild("Parameters")?.getChild("Parameter"),s=n?.getChild("TypeName")??n?.getChild("PointerType")?.getChild("TypeName");return s?e.slice(s.from,s.to):void 0}function Ts(t,e){let r=[],n=t.cursor();do if(n.name==="FunctionDecl"){let s=n.node.getChild("DefName");if(s){let o=e.slice(s.from,s.to),{complexity:i,cognitiveComplexity:a}=lt(n.node,e);r.push({name:o,line:Ce(e,n.from),complexity:i,cognitiveComplexity:a})}}else if(n.name==="MethodDecl"){let s=n.node.getChild("FieldName");if(s){let o=e.slice(s.from,s.to),i=Cr(n.node,e),a=i?`${i}.${o}`:o,{complexity:c,cognitiveComplexity:p}=lt(n.node,e);r.push({name:a,line:Ce(e,n.from),complexity:c,cognitiveComplexity:p})}}while(n.next());return r}var Ps=m(()=>{"use strict";l();br()});import il from"path";import{parser as al}from"@lezer/go";function Ms(t,e){let r=[],n=new Map,s=new Set,o=new Set,i=new Map,a=al.parse(e),c=a.cursor();do switch(c.name){case"LineComment":{let P=e.slice(c.from,c.to),O=P.match(cl);O?.[1]&&s.add(O[1]);let X=P.match(ll);X&&Is(X[1],o);let Y=P.match(pl);Y&&Is(Y[1],o);break}case"ImportSpec":{let P=c.node.getChild("String");if(P){let X=e.slice(P.from,P.to).slice(1,-1);r.push({fromPath:t,toPath:"",rawSpecifier:X,isExternal:!0,isStyle:!1,type:"static"});let Y=c.node.getChild("DefName"),Le=Y?e.slice(Y.from,Y.to):X.split("/").pop();Le&&Le!=="_"&&Le!=="."&&i.set(Le,X)}break}case"FunctionDecl":case"MethodDecl":case"TypeDecl":case"VarDecl":case"ConstDecl":{let P=c.node.getChild("DefName")??c.node.getChild("FieldName")??c.node.getChild("TypeSpec")?.getChild("DefName")??c.node.getChild("VarSpec")?.getChild("DefName")??c.node.getChild("ConstSpec")?.getChild("DefName");if(P){let O=e.slice(P.from,P.to);O!=="_"&&/^[A-Z]/.test(O)&&!n.has(O)&&n.set(O,{name:O})}break}}while(c.next());let p=r.some(P=>P.rawSpecifier==="testing"),g=il.basename(t).endsWith("_test.go")||s.has("test")||p?"test":"logic",h=new Set([...s,...o]),{complexity:y,cognitiveComplexity:x}=lt(a.topNode,e),E=Ts(a,e),C=g==="test"?[]:fl(a,e,i);return{imports:r,exports:Array.from(n.values()),tags:Array.from(h).map(P=>({name:P,kind:"comment-marker"})),category:g,rawCallEdges:C,complexity:y,cognitiveComplexity:x,...E.length>0?{functions:E}:{}}}function fl(t,e,r){let n=[];function s(i,a){if(i.type.name==="CallExpr"){let p=i.firstChild;if(p?.type.name==="SelectorExpr"){let g=p.firstChild,h=p.getChild("FieldName");if(g?.type.name==="VariableName"&&h){let y=e.slice(g.from,g.to),x=r.get(y);if(x){let E=e.slice(h.from,h.to);n.push({from:a,to:E,toSpecifier:x})}}}}let c=i.firstChild;for(;c;)s(c,a),c=c.nextSibling}let o=t.cursor();do if(o.name==="FunctionDecl"){let i=o.node.getChild("DefName"),a=o.node.getChild("Block");if(i&&a){let c=e.slice(i.from,i.to);/^[A-Z]/.test(c)&&s(a,c)}}else if(o.name==="MethodDecl"){let i=o.node.getChild("FieldName"),a=o.node.getChild("Block");if(i&&a){let c=e.slice(i.from,i.to),p=Cr(o.node,e);s(a,p?`${p}.${c}`:c)}}while(o.next());return n}function Is(t,e){for(let r of t.split(/[\s,&|!()]+/)){let n=r.trim();n&&n!=="ignore"&&e.add(n)}}var cl,ll,pl,Ds=m(()=>{"use strict";l();Ps();cl=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,ll=/^\/\/go:build\s+(.+)$/,pl=/^\/\/\s*\+build\s+(.+)$/});import ml from"livescript";function ul(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,n=r.exec(t);for(;n!==null;)n[1]&&e.add(n[1]),n=r.exec(t);return e}function gl(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function H(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function dl(t){if(!t)return[];if(t.constructor?.name==="Class"){let r=H(t.title);return r?[{name:r}]:[]}if(t.constructor?.name==="Obj"&&Array.isArray(t.items))return t.items.map(r=>H(r.key)??H(r.val)).filter(r=>!!r).map(r=>({name:r}));let e=H(t);return e?[{name:e}]:[]}function hl(t){let e=t.constructor?.name||t.type;if(e==="Assign"&&t.left?.constructor?.name==="Chain"){let r=t.left,n=H(r.head),o=r.tails?.[0]?.key?.name;if(n==="module"&&o==="exports")return dl(t.right);if(n==="exports"&&typeof o=="string")return[{name:o}];if(r.head?.verb==="out"&&typeof o=="string")return[{name:o}]}if(e==="Import"&&t.left?.verb==="out"){let r=t.right;if(r?.constructor?.name==="Obj"&&Array.isArray(r.items))return r.items.map(n=>H(n.val)??H(n.key)).filter(n=>!!n).map(n=>({name:n}))}return[]}function xl(t,e){let r=t.constructor?.name||t.type;if(r==="Import"){let n=t.right?.value;if(typeof n=="string"){let s=W(n);return{fromPath:e,toPath:"",rawSpecifier:s,isStyle:D(s),type:"static"}}}if(r==="Chain"&&t.head?.value==="require"){let n=t.tails?.[0];if(n?.constructor?.name==="Call"||n?.type==="Call"){let s=n.args?.[0]?.value;if(typeof s=="string"){let o=W(s);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:D(o),type:"require"}}}}return null}function vr(t,e,r){if(!t||typeof t!="object")return[];let n=[],s=xl(t,e);s&&n.push(s),r.push(...hl(t));for(let o in t){if(yl.has(o))continue;let i=t[o];if(!(!i||typeof i!="object"))if(Array.isArray(i))for(let a of i)n.push(...vr(a,e,r));else n.push(...vr(i,e,r))}return n}function As(t,e){let r=ul(e),n=gl(t,r),s=[],o=[];try{s=vr(ml.ast(e),t,o)}catch{}let i=new Set,a=o.filter(c=>i.has(c.name)?!1:(i.add(c.name),!0));return{imports:s,exports:a,tags:Array.from(r).map(c=>({name:c,kind:"comment-marker"})),category:n}}var yl,Rs=m(()=>{"use strict";l();_();ct();yl=new Set(["first_line","first_column","last_line","last_column","line","column"])});import Sl from"luaparse";function bl(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,n=r.exec(t);for(;n!==null;)n[1]&&e.add(n[1]),n=r.exec(t);return e}function Cl(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function vl(t,e){let r=[];function n(s){if(!(!s||typeof s!="object")){if((s.type==="CallExpression"||s.type==="StringCallExpression")&&s.base?.type==="Identifier"&&s.base?.name==="require"){let o;if(s.type==="CallExpression"){let i=s.arguments?.[0];i?.type==="StringLiteral"&&(o=W(i.raw))}else if(s.type==="StringCallExpression"){let i=s.argument;i?.type==="StringLiteral"&&(o=W(i.raw))}o&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:D(o),type:"require"})}for(let o in s){if(o==="loc")continue;let i=s[o];if(i&&typeof i=="object")if(Array.isArray(i))for(let a of i)n(a);else n(i)}}}return n(t),r}function kl(t){let e=new Set;for(let r of t)r.type==="LocalStatement"&&r.variables.forEach((n,s)=>{r.init[s]?.type==="TableConstructorExpression"&&e.add(n.name)});return e}function El(t){let e=t[t.length-1];if(e?.type!=="ReturnStatement")return[];let r=e.arguments[0];if(r?.type!=="TableConstructorExpression")return[];let n=[];for(let s of r.fields)s.type==="TableKeyString"&&n.push({name:s.key.name});return n}function wl(t){let e=t.body,r=kl(e),n=El(e);for(let o of e)if(o.type==="FunctionDeclaration")o.identifier?.type==="MemberExpression"?o.identifier.base.type==="Identifier"&&r.has(o.identifier.base.name)&&n.push({name:o.identifier.identifier.name}):o.identifier?.type==="Identifier"&&!o.isLocal&&n.push({name:o.identifier.name});else if(o.type==="AssignmentStatement")for(let i of o.variables)i.type==="MemberExpression"&&i.base.type==="Identifier"&&r.has(i.base.name)&&n.push({name:i.identifier.name});let s=new Set;return n.filter(o=>s.has(o.name)?!1:(s.add(o.name),!0))}function Ls(t,e){let r=bl(e),n=Cl(t,r),s=[],o=[];try{let i=Sl.parse(e);s=vl(i,t),o=wl(i)}catch{}return{imports:s,exports:o,tags:Array.from(r).map(i=>({name:i,kind:"comment-marker"})),category:n}}var Os=m(()=>{"use strict";l();_();ct()});async function Pl(){return Gs??=(async()=>{let{unified:t}=await import("unified"),e=(await import("remark-parse")).default;return t().use(e)})(),Gs}function Il(t){let e=t.trim();return e.length===0||e.startsWith("#")||Nl.some(r=>e.startsWith(r))}function Ml(t,e){let r=t.match(Tl);return r?r.map(n=>({fromPath:e,toPath:"",rawSpecifier:n,isStyle:!1,type:"static"})):[]}function js(t,e,r){if(t.type==="link"&&typeof t.url=="string"&&!Il(t.url)&&r.push({fromPath:e,toPath:"",rawSpecifier:t.url,isStyle:!1,type:"static"}),(t.type==="code"||t.type==="inlineCode")&&typeof t.value=="string"&&r.push(...Ml(t.value,e)),Array.isArray(t.children))for(let n of t.children)js(n,e,r)}async function _s(t,e){let n=(await Pl()).parse(e),s=[];js(n,t,s);let o=new Set;return{imports:s.filter(a=>o.has(a.rawSpecifier)?!1:(o.add(a.rawSpecifier),!0)),exports:[],tags:[],category:"other"}}var Nl,Fl,Tl,Gs,Ws=m(()=>{"use strict";l();Nl=["http://","https://","mailto:","//"],Fl="ts|tsx|js|jsx|mjs|cjs|py|go|lua|css|scss|less|styl|coffee|ls|feature|md|mdx|json",Tl=new RegExp(`(?:\\.{1,2}/)?[\\w.-]+(?:/[\\w.-]+)*\\.(?:${Fl})\\b`,"g")});function Dl(t){let e=1;function r(n){switch(n.type.name){case"IfStatement":{e+=K(n).filter(o=>o.type.name==="if"||o.type.name==="elif").length;break}case"TryStatement":{e+=K(n).filter(o=>o.type.name==="except").length;break}case"ForStatement":case"WhileStatement":case"ConditionalExpression":e++;break;case"and":case"or":e++;break}let s=n.firstChild;for(;s;)r(s),s=s.nextSibling}return r(t),e}function Al(t){let e=0;function r(n,s){let o=n.type.name;if(o==="IfStatement"){let c=K(n),p=0,g=0;for(;g<c.length;){let h=c[g];if(h?.type.name==="if"||h?.type.name==="elif"){let y=p>0;e+=y?1:1+s;let x=y?s:s+1,E=c[g+1],C=c[g+2];E&&r(E,x),C&&r(C,x),p++,g+=3}else if(h?.type.name==="else"){e+=1;let y=c[g+1];y&&r(y,s+1),g+=2}else g++}return}if(o==="TryStatement"){let c=K(n),p=0;for(;p<c.length;){let g=c[p];if(g?.type.name==="except"){for(e+=1+s,p++;p<c.length&&c[p]?.type.name!=="Body";)r(c[p],s),p++;p<c.length&&(r(c[p],s),p++)}else g?.type.name==="Body"&&r(g,s),p++}return}if(o==="ForStatement"||o==="WhileStatement"){e+=1+s;let c=n.firstChild;for(;c;)r(c,s+1),c=c.nextSibling;return}if((o==="ConditionalExpression"||o==="and"||o==="or")&&(e+=1),s>0&&(o==="FunctionDefinition"||o==="LambdaExpression")){e+=1+s;let c=n.firstChild;for(;c;)r(c,s+1),c=c.nextSibling;return}let a=n.firstChild;for(;a;)r(a,s),a=a.nextSibling}return r(t,0),e}function kr(t){return{complexity:Dl(t),cognitiveComplexity:Al(t)}}function zs(t,e){let r=[];function n(i,a){let{complexity:c,cognitiveComplexity:p}=kr(i);r.push({name:a,line:Ce(e,i.from),complexity:c,cognitiveComplexity:p})}function s(i){let a=i.firstChild;for(;a;)o(a),a=a.nextSibling}function o(i){if(i.type.name==="ClassDefinition"){let a=i.getChild("VariableName"),c=a?e.slice(a.from,a.to):void 0,p=i.getChild("Body");if(p){let g=p.firstChild;for(;g;){if(g.type.name==="FunctionDefinition"){let h=g.getChild("VariableName"),y=h?e.slice(h.from,h.to):void 0;y&&n(g,c?`${c}.${y}`:y),s(g)}else o(g);g=g.nextSibling}}return}if(i.type.name==="FunctionDefinition"){let a=i.getChild("VariableName");a&&n(i,e.slice(a.from,a.to)),s(i);return}s(i)}return o(t.topNode),r}var $s=m(()=>{"use strict";l();br()});import Rl from"path";import{parser as Ll}from"@lezer/python";function Us(t,e){let r=[],n=[],s=new Set,o=Rl.basename(t).toLowerCase(),i=Ll.parse(e),a=i.cursor();do switch(a.name){case"Comment":{let x=e.slice(a.from,a.to).match(/#\s*@tag\s+([a-zA-Z0-9_-]+)/);x?.[1]&&s.add(x[1]);break}case"ImportStatement":{for(let x of Gl(a.node,e,t))r.push(x);break}case"FunctionDefinition":case"ClassDefinition":{let x=a.node.parent;if(x?.name==="Script"||x?.name==="DecoratedStatement"&&x.parent?.name==="Script"){let C=a.node.getChild("VariableName");C&&n.push({name:e.slice(C.from,C.to)})}break}case"AssignStatement":{if(a.node.parent?.name==="Script"){let x=a.node.firstChild;x?.name==="VariableName"&&n.push({name:e.slice(x.from,x.to)})}break}}while(a.next());let c=Ul(o,r,s);c==="test"&&s.add("test");let{complexity:p,cognitiveComplexity:g}=kr(i.topNode),h=zs(i,e),y=c==="test"?[]:$l(i,e);return{imports:r,exports:n,tags:Array.from(s).map(x=>({name:x,kind:"comment-marker"})),category:c,rawCallEdges:y,complexity:p,cognitiveComplexity:g,...h.length>0?{functions:h}:{}}}function Gl(t,e,r){let n=t.firstChild;return n?n.name==="from"?jl(t,e,r):_l(t,e,r):[]}function jl(t,e,r){let n=t.firstChild;if(!n)return[];let s=n.nextSibling;for(;s&&s.name!=="import";)s=s.nextSibling;if(!s)return[];let o=e.slice(n.to,s.from).trim(),i=Wl(s.nextSibling,e);if(!i.length)return[];let a=0;for(;a<o.length&&o[a]===".";)a++;let c=o.slice(a);if(a===0)return[ve(r,o,i,!0)];let p=a===1?"./":"../".repeat(a-1);return c?[ve(r,p+c.replace(/\./g,"/"),i,!1)]:i[0]==="*"?[ve(r,p.slice(0,-1),["*"],!1)]:i.map(g=>ve(r,p+g,[g],!1))}function _l(t,e,r){let n=[],s=t.firstChild?.nextSibling??null;for(;s;){if(s.name==="VariableName"){let o=e.slice(s.from,s.to);for(;s.nextSibling?.name==="."&&s.nextSibling.nextSibling?.name==="VariableName";)s=s.nextSibling.nextSibling,o+=`.${e.slice(s.from,s.to)}`;s.nextSibling?.name==="as"&&(s=s.nextSibling.nextSibling??s.nextSibling),n.push(ve(r,o,["*"],!0))}s=s.nextSibling}return n}function Wl(t,e){let r=[],n=t;for(;n;)n.name==="*"?r.push("*"):n.name==="VariableName"&&(r.push(e.slice(n.from,n.to)),n.nextSibling?.name==="as"&&(n=n.nextSibling.nextSibling??n.nextSibling)),n=n.nextSibling;return r}function zl(t,e){let r=new Map,n=t.cursor();do{if(n.name!=="ImportStatement")continue;let o=n.node.firstChild;if(o?.type.name!=="from")continue;let i=o.nextSibling;for(;i&&i.type.name!=="import";)i=i.nextSibling;if(!i)continue;let a=e.slice(o.to,i.from).trim(),c=0;for(;c<a.length&&a[c]===".";)c++;let p=a.slice(c),g=c<=1?"./":"../".repeat(c-1),h=i.nextSibling;for(;h;){if(h.type.name==="VariableName"){let y=e.slice(h.from,h.to),x=y;if(h.nextSibling?.type.name==="as"){let C=h.nextSibling.nextSibling;C?.type.name==="VariableName"&&(x=e.slice(C.from,C.to),h=C)}let E=c===0?a:p?g+p.replace(/\./g,"/"):g+y;r.set(x,E)}h=h.nextSibling}}while(n.next());return r}function $l(t,e){let r=zl(t,e),n=[];function s(a,c){if(a.type.name==="CallExpression"&&a.firstChild?.type.name==="VariableName"){let g=a.firstChild,h=e.slice(g.from,g.to),y=r.get(h);y&&n.push({from:c,to:h,toSpecifier:y})}let p=a.firstChild;for(;p;)s(p,c),p=p.nextSibling}function o(a){let c=a.firstChild;for(;c;)i(c),c=c.nextSibling}function i(a){if(a.type.name==="ClassDefinition"){let c=a.getChild("VariableName"),p=c?e.slice(c.from,c.to):void 0,g=a.getChild("Body");if(g){let h=g.firstChild;for(;h;){if(h.type.name==="FunctionDefinition"){let y=h.getChild("VariableName"),x=y?e.slice(y.from,y.to):void 0;x&&s(h,p?`${p}.${x}`:x)}else i(h);h=h.nextSibling}}return}if(a.type.name==="FunctionDefinition"){let c=a.getChild("VariableName");c&&s(a,e.slice(c.from,c.to));return}o(a)}return i(t.topNode),n}function ve(t,e,r,n){return{fromPath:t,toPath:"",rawSpecifier:e,isStyle:!1,isExternal:n,type:"static",symbols:r.length>0?r:void 0}}function Ul(t,e,r){return t.startsWith("test_")||t.endsWith("_test.py")?"test":t==="conftest.py"||t==="setup.py"?"config":r.has("test")||e.some(n=>Ol.has(n.rawSpecifier))?"test":"logic"}var Ol,Bs=m(()=>{"use strict";l();$s();Ol=new Set(["pytest","unittest","nose","hypothesis"])});import S from"typescript";function Bl(t){let e=1;function r(n){switch(n.kind){case S.SyntaxKind.IfStatement:case S.SyntaxKind.ConditionalExpression:case S.SyntaxKind.ForStatement:case S.SyntaxKind.ForInStatement:case S.SyntaxKind.ForOfStatement:case S.SyntaxKind.WhileStatement:case S.SyntaxKind.DoStatement:case S.SyntaxKind.CatchClause:case S.SyntaxKind.CaseClause:e++;break;case S.SyntaxKind.BinaryExpression:{let s=n.operatorToken.kind;(s===S.SyntaxKind.AmpersandAmpersandToken||s===S.SyntaxKind.BarBarToken||s===S.SyntaxKind.QuestionQuestionToken)&&e++;break}}S.forEachChild(n,r)}return r(t),e}function Jl(t){let e=0;function r(n,s,o){if(S.isIfStatement(n)){e+=o?1:1+s;let a=o?s:s+1;r(n.expression,a,!1),r(n.thenStatement,a,!1),n.elseStatement&&(S.isIfStatement(n.elseStatement)?r(n.elseStatement,s,!0):(e+=1,r(n.elseStatement,s+1,!1)));return}if(S.isForStatement(n)||S.isForInStatement(n)||S.isForOfStatement(n)||S.isWhileStatement(n)||S.isDoStatement(n)||S.isSwitchStatement(n)){e+=1+s,S.forEachChild(n,a=>r(a,s+1,!1));return}if(S.isCatchClause(n)){e+=1+s,S.forEachChild(n,a=>r(a,s,!1));return}if(S.isConditionalExpression(n)&&(e+=1),S.isBinaryExpression(n)){let a=n.operatorToken.kind;(a===S.SyntaxKind.AmpersandAmpersandToken||a===S.SyntaxKind.BarBarToken||a===S.SyntaxKind.QuestionQuestionToken)&&(e+=1)}if(s>0&&(S.isFunctionDeclaration(n)||S.isFunctionExpression(n)||S.isArrowFunction(n))){e+=1+s,S.forEachChild(n,a=>r(a,s+1,!1));return}S.forEachChild(n,a=>r(a,s,!1))}return r(t,0,!1),e}function Er(t){return{complexity:Bl(t),cognitiveComplexity:Jl(t)}}var Js=m(()=>{"use strict";l()});import k from"typescript";function Ks(t,e){Kl(t,e),Vl(t,e),Ql(t,e),Xl(t,e)}function Kl(t,e){if((k.isFunctionDeclaration(t)||k.isVariableDeclaration(t))&&t.name&&k.isIdentifier(t.name)&&Hl(t)){let r;if(k.isFunctionDeclaration(t))r="function";else{let n=t.initializer;r=n&&(k.isArrowFunction(n)||k.isFunctionExpression(n))?"function":"variable"}e.tags.add({name:t.name.text,kind:r})}}function Hl(t){if(k.isFunctionDeclaration(t))return k.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&k.isSourceFile(e.parent)}function Vl(t,e){if(!k.isStringLiteral(t))return;let r=t.text.match(/@[\w-]+/g);if(r)for(let n of r)e.tags.add({name:n.substring(1),kind:"comment-marker"})}function Ql(t,e){if(!k.isSourceFile(t))return;let r=/@tag\s+([a-zA-Z0-9_-]+)/g,n=t.getFullText(),s=r.exec(n);for(;s!==null;)s[1]&&e.tags.add({name:s[1],kind:"comment-marker"}),s=r.exec(n)}function Xl(t,e){if(k.isCallExpression(t)&&Yl(t.expression))for(let r of t.arguments)k.isObjectLiteralExpression(r)&&ql(r,e)}function Yl(t){return k.isIdentifier(t)?wr.has(t.text):!!(k.isPropertyAccessExpression(t)&&(wr.has(t.name.text)||k.isIdentifier(t.expression)&&wr.has(t.expression.text)))}function ql(t,e){for(let r of t.properties){if(!k.isPropertyAssignment(r)||!k.isIdentifier(r.name)||r.name.text!=="tags"&&r.name.text!=="tag")continue;let{initializer:n}=r,s=k.isArrayLiteralExpression(n)?n.elements.filter(k.isStringLiteral):r.name.text==="tag"&&k.isStringLiteral(n)?[n]:[];for(let o of s)e.tags.add({name:o.text.replace(/^@/,""),kind:"comment-marker"})}}var wr,Hs=m(()=>{"use strict";l();wr=new Set(["test","describe","it"])});import Vs from"path";import d from"typescript";function Nr(t,e,r){let n=[],s=new Map,o=new Set,i=d.createSourceFile(t,e,d.ScriptTarget.Latest,!0,r==="typescript"?d.ScriptKind.TSX:d.ScriptKind.JSX),a={filePath:t,imports:n,exports:s,tags:o,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},c=C=>{rp(C,a),d.forEachChild(C,c)};c(i);let p=up(t,a);(p==="test"||p==="barrel")&&o.add({name:p,kind:"comment-marker"}),p!=="test"&&gp(a,i);let g=i.statements[0],h=g?Xs(g):void 0,{complexity:y,cognitiveComplexity:x}=Er(i),E=Zl(i);return{imports:n,exports:Array.from(s.values()),tags:Array.from(o),category:p,rawCallEdges:a.rawCallEdges??[],complexity:y,cognitiveComplexity:x,...E.length>0?{functions:E}:{},...h!==void 0?{description:h}:{}}}function Zl(t){let e=[],r=(s,o)=>{let{complexity:i,cognitiveComplexity:a}=Er(o),c=t.getLineAndCharacterOfPosition(o.getStart(t)).line+1;e.push({name:s,line:c,complexity:i,cognitiveComplexity:a})},n=(s,o)=>{if(d.isFunctionDeclaration(s)&&s.name&&s.body?r(s.name.text,s):d.isVariableDeclaration(s)&&d.isIdentifier(s.name)&&s.initializer&&(d.isArrowFunction(s.initializer)||d.isFunctionExpression(s.initializer))?r(s.name.text,s.initializer):o&&d.isMethodDeclaration(s)&&d.isIdentifier(s.name)&&s.body?r(`${o}.${s.name.text}`,s):o&&d.isConstructorDeclaration(s)&&s.body?r(`${o}.constructor`,s):o&&d.isGetAccessorDeclaration(s)&&d.isIdentifier(s.name)&&s.body?r(`${o}.get ${s.name.text}`,s):o&&d.isSetAccessorDeclaration(s)&&d.isIdentifier(s.name)&&s.body&&r(`${o}.set ${s.name.text}`,s),d.isClassDeclaration(s)&&s.name){let i=s.name.text;d.forEachChild(s,a=>n(a,i));return}d.forEachChild(s,i=>n(i,o))};return n(t,void 0),e}function Qs(t,e,r,n){let s={name:t},o=Xs(r);o!==void 0&&(s.doc=o);let i=ep(e);i!==void 0&&(s.flags=i);let a=tp(e,n);return a!==void 0&&(s.signature=a),s}function Xs(t){let e=d.getJSDocCommentsAndTags(t);for(let r of e)if(d.isJSDoc(r)&&r.comment)return d.getTextOfJSDocComment(r.comment)||void 0}function ep(t){let e=new Set(["deprecated","internal","public","alpha","beta"]),r=d.getJSDocTags(t).map(n=>n.tagName.text).filter(n=>e.has(n));return r.length>0?r:void 0}function tp(t,e){let r=d.createPrinter({removeComments:!0}),n=s=>r.printNode(d.EmitHint.Unspecified,s,e);if(d.isFunctionDeclaration(t)||d.isMethodDeclaration(t)){let s=t.parameters.map(n).join(", "),o=t.type?n(t.type):"void";return`${t.typeParameters?`<${t.typeParameters.map(a=>a.name.text).join(", ")}>`:""}(${s}) => ${o}`}if(d.isVariableDeclaration(t)){if(t.type)return n(t.type);if(t.initializer&&(d.isArrowFunction(t.initializer)||d.isFunctionExpression(t.initializer))){let s=t.initializer,o=s.parameters.map(n).join(", "),i=s.type?n(s.type):"unknown";return`(${o}) => ${i}`}return}if(d.isClassDeclaration(t)&&t.name)return`class ${t.name.text}`;if(d.isInterfaceDeclaration(t))return`interface ${t.name.text}`;if(d.isTypeAliasDeclaration(t))return n(t.type);if(d.isEnumDeclaration(t))return`enum ${t.name.text}`}function rp(t,e){np(t,e),sp(t,e),ip(t,e),ap(t,e),mp(t,e),Ks(t,e)}function np(t,e){if(!d.isSourceFile(t))return;let r=t.statements.filter(n=>!d.isEmptyStatement(n));e.totalStatements=r.length,e.exportStatements=r.filter(n=>d.isExportDeclaration(n)||d.isExportAssignment(n)||Fr(n)).length}function sp(t,e){if(d.isJsxElement(t)||d.isJsxSelfClosingElement(t)||d.isJsxFragment(t)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(d.isFunctionDeclaration(t)||d.isMethodDeclaration(t)||d.isArrowFunction(t)||d.isClassDeclaration(t)||d.isVariableStatement(t)||d.isEnumDeclaration(t)){e.hasTypesOnly=!1;return}d.isExportDeclaration(t)&&!op(t)&&(e.hasTypesOnly=!1)}function op(t){return t.isTypeOnly?!0:!t.exportClause||!d.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function ip(t,e){if(!d.isImportDeclaration(t)||!t.moduleSpecifier||!d.isStringLiteral(t.moduleSpecifier))return;let r=[];if(t.importClause&&(t.importClause.name&&r.push("default"),t.importClause.namedBindings))if(d.isNamedImports(t.importClause.namedBindings))for(let s of t.importClause.namedBindings.elements)r.push(s.name.text);else d.isNamespaceImport(t.importClause.namedBindings)&&r.push("*");let n=r.length>0?"static":"side-effect";e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:t.moduleSpecifier.text,isStyle:D(t.moduleSpecifier.text),type:n,symbols:r.length>0?r:void 0})}function ap(t,e){d.isExportDeclaration(t)?cp(t,e):d.isExportAssignment(t)?e.exports.set("default",{name:"default"}):Fr(t)&&fp(t,e)}function cp(t,e){if(t.moduleSpecifier&&d.isStringLiteral(t.moduleSpecifier))lp(t,t.moduleSpecifier.text,e);else if(t.exportClause&&d.isNamedExports(t.exportClause))for(let r of t.exportClause.elements){let n=r.name.text;e.exports.set(n,{name:n})}}function lp(t,e,r){let n=pp(t),s={fromPath:r.filePath,toPath:"",rawSpecifier:e,isStyle:D(e),type:"re-export"};n.length>0&&(s.symbols=n),r.imports.push(s)}function pp(t){return t.exportClause?d.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function fp(t,e){if((d.isFunctionDeclaration(t)||d.isClassDeclaration(t)||d.isInterfaceDeclaration(t)||d.isTypeAliasDeclaration(t)||d.isEnumDeclaration(t))&&t.name){let n=t.name.text;e.exports.set(n,Qs(n,t,t,e.sourceFile));return}if(d.isVariableStatement(t)){for(let n of t.declarationList.declarations)if(d.isIdentifier(n.name)){let s=n.name.text;e.exports.set(s,Qs(s,n,t,e.sourceFile))}}}function mp(t,e){if(!d.isCallExpression(t))return;let r=t.arguments[0];!r||!d.isStringLiteral(r)||(t.expression.kind===d.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:D(r.text),type:"dynamic"}):d.isIdentifier(t.expression)&&t.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:D(r.text),type:"require"}))}function up(t,e){let r=Vs.basename(t).toLowerCase(),n=Vs.extname(t).toLowerCase();return fe().some(o=>r.includes(o))?"test":en(r)?"config":e.imports.some(o=>bt().some(i=>o.rawSpecifier.includes(i)))?"test":n===".tsx"||n===".jsx"||e.hasUI?"ui":e.hasTypesOnly&&e.totalStatements>0?"type-only":e.totalStatements>0&&e.exportStatements/e.totalStatements>vt()?"barrel":"logic"}function Fr(t){return d.canHaveModifiers(t)&&d.getModifiers(t)?.some(e=>e.kind===d.SyntaxKind.ExportKeyword)===!0}function gp(t,e){let r=t.rawCallEdges??[];t.rawCallEdges=r;let n=new Map;for(let s of e.statements){if(!d.isImportDeclaration(s)||!d.isStringLiteral(s.moduleSpecifier))continue;let o=s.moduleSpecifier.text,i=s.importClause;if(i&&(i.name&&n.set(i.name.text,o),i.namedBindings&&d.isNamedImports(i.namedBindings)))for(let a of i.namedBindings.elements)n.set(a.name.text,o)}if(n.size!==0)for(let s of e.statements){let o=hp(s);if(o){let i=yp(s);i&&pt(i,o,n,r);continue}d.isClassDeclaration(s)&&s.name&&dp(s,n,r)}}function dp(t,e,r){let n=t.name.text;for(let s of t.members)d.isMethodDeclaration(s)&&s.body&&d.isIdentifier(s.name)?pt(s.body,`${n}.${s.name.text}`,e,r):d.isConstructorDeclaration(s)&&s.body&&pt(s.body,`${n}.constructor`,e,r)}function hp(t){if(Fr(t)){if(d.isFunctionDeclaration(t)&&t.name)return t.name.text;if(d.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(d.isIdentifier(e.name)&&e.initializer&&(d.isArrowFunction(e.initializer)||d.isFunctionExpression(e.initializer)))return e.name.text}}}function yp(t){if(d.isFunctionDeclaration(t))return t.body;if(d.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(e.initializer&&(d.isArrowFunction(e.initializer)||d.isFunctionExpression(e.initializer)))return e.initializer}}function pt(t,e,r,n){if(d.isCallExpression(t)&&d.isIdentifier(t.expression)){let s=t.expression.text,o=r.get(s);o&&!n.some(i=>i.from===e&&i.to===s&&i.toSpecifier===o)&&n.push({from:e,to:s,toSpecifier:o})}d.forEachChild(t,s=>pt(s,e,r,n))}var Ys=m(()=>{"use strict";l();q();Js();_();Hs()});function ft(t,e){if(e.length===0)return"ui";let r=!1;return t.walk(n=>{if(n.type==="rule")return r=!0,!1}),r?"ui":"barrel"}var qs=m(()=>{"use strict";l()});import eo from"postcss";import*as xp from"postcss-less";function Zs(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function bp(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function Cp(t,e){let r=t.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(r){let o=r[1]?.trim()??"",i=r[2]??"";if(!i)return null;let a=to.has(o)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,...Zs(i)?{isExternal:!0}:{}}}let n=t.match(/^url\(['"]?([^'")]+)['"]?\)/),s=n?n[1]?.trim()??"":t.match(/^['"]([^'"]+)['"]/)?.[1]??"";return s?{fromPath:e,toPath:"",rawSpecifier:s,isStyle:!0,type:"static",...Zs(s)?{isExternal:!0}:{}}:null}function vp(t,e){let r=[],n=/url\(['"]?([^'")]+)['"]?\)/g,s=n.exec(t);for(;s!==null;){let o=s[1]?.trim()??"";bp(o)&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static"}),s=n.exec(t)}return r}function ro(t,e){let r=[];return t.walk(n=>{if(n.type==="atrule"&&n.name==="import"){let s=Cp(n.params,e);s&&r.push(s)}n.type==="decl"&&r.push(...vp(n.value,e))}),r}function kp(t){return t.replace(/(?<!:)\/\/.*/g,"")}function Ep(t,e){let r=[],n=/@import\s+(?:\(([^)]+)\)\s+)?['"]([^'"]+)['"]/g,s=n.exec(t);for(;s!==null;){let o=s[1]?.trim()??"",i=s[2]??"";if(i){let a=to.has(o)?"side-effect":"static";r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}s=n.exec(t)}return r}function no(t,e){let r=eo.parse(kp(t));return{imports:ro(r,e),root:r}}function wp(t){let e=[],r=[];for(let n of t.nodes??[]){if(n.type!=="atrule")continue;let{value:s}=n;if(s===void 0)continue;let o=n.name;o&&(e.push({name:o}),r.push({name:o,kind:"variable"}))}return{exports:e,tags:r}}function so(t,e){try{let r=Sp.parse(t),{exports:n,tags:s}=wp(r);return{imports:ro(r,e),root:r,exports:n,tags:s}}catch{return{imports:Ep(t,e),root:eo.parse(""),exports:[],tags:[]}}}var Sp,to,oo=m(()=>{"use strict";l();Sp=xp,to=new Set(["reference","inline"])});import{parse as Np}from"postcss-scss";function io(t){return t.startsWith("_")||t.startsWith("-")}function Fp(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function Tp(t){let e=t.match(/^['"]([^'"]+)['"]/);if(!e?.[1])return{specifier:""};let r=e[1],s=t.match(/\bas\s+(\S+)/)?.[1];return s!==void 0?{specifier:r,alias:s}:{specifier:r}}function Pp(t){let e=[],r=[];for(let n of t.nodes??[]){if(n.type==="decl"&&n.prop.startsWith("$")){let s=n.prop.slice(1);if(!s||io(s))continue;e.push({name:s}),r.push({name:s,kind:"variable"});continue}if(n.type==="atrule"&&(n.name==="mixin"||n.name==="function")){let o=n.params.match(/^([\w-]+)/)?.[1];if(!o||io(o))continue;let i=n.params.trim();e.push(i.includes("(")?{name:o,signature:i}:{name:o}),r.push({name:o,kind:"function"})}}return{exports:e,tags:r}}function ao(t,e){let r=Np(t),n=[];r.walk(i=>{if(i.type!=="atrule")return;let{name:a,params:c}=i;if(a!=="import"&&a!=="use"&&a!=="forward")return;let{specifier:p,alias:g}=Tp(c);if(!p)return;let h={fromPath:e,toPath:"",rawSpecifier:p,isStyle:!0,type:a==="forward"?"re-export":"static",...Fp(p)?{isExternal:!0}:{}};g&&(h.symbols=[g]),n.push(h)});let{exports:s,tags:o}=Pp(r);return{imports:n,root:r,exports:s,tags:o}}var co=m(()=>{"use strict";l()});function lo(t,e){let r=[],n=/@require\s+['"]([^'"]+)['"]/g,s=n.exec(t);for(;s!==null;){let i=s[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"require"}),s=n.exec(t)}let o=/(?<!@)(?:import|require)\s*\(?\s*['"]([^'"]+)['"]/g;for(s=o.exec(t);s!==null;){let i=s[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"static"}),s=o.exec(t)}return r}function po(t,e){if(e.length===0)return"ui";try{let r=St("stylus");return new r.Parser(t).parse().nodes.some(o=>o.constructor.name!=="Import")?"ui":"barrel"}catch{return t.replace(/^\s*@?(?:require|import)\b.*/gm,"").trim().length>0?"ui":"barrel"}}var fo=m(()=>{"use strict";l()});function ke(t,e){let r=j(t);if(r==="stylus"){let o=lo(e,t);return{imports:o,exports:[],tags:[],category:po(e,o)}}if(r==="scss"){let{imports:o,root:i,exports:a,tags:c}=ao(e,t);return{imports:o,exports:a,tags:c,category:ft(i,o)}}if(r==="less"){let{imports:o,root:i,exports:a,tags:c}=so(e,t);return{imports:o,exports:a,tags:c,category:ft(i,o)}}let{imports:n,root:s}=no(e,t);return{imports:n,exports:[],tags:[],category:ft(s,n)}}var mo=m(()=>{"use strict";l();_();qs();oo();co();fo()});async function uo(t,e){let r=j(t),n=Wn(r);return n?n(t,e):{imports:[],exports:[],tags:[],category:"other"}}var go=m(()=>{"use strict";l();_();Ns();Fs();Ds();Rs();Os();Ws();Bs();Ys();Se();mo();q();_();Se();for(let[t,e]of[["javascript",(r,n)=>Nr(r,n,"javascript")],["typescript",(r,n)=>Nr(r,n,"typescript")],["css",ke],["scss",ke],["less",ke],["stylus",ke],["coffeescript",ws],["livescript",As],["lua",Ls],["python",Us],["go",Ms],["gherkin",Sr],["markdown",_s]])re(t,e)});import ho from"path";function xo(t,e){for(let r of t.values()){let n=e.get(r.path);n!==void 0&&(r.coveragePct=n)}}function So(t,e){for(let r of t)if(r.isExternal){let n=r.rawSpecifier.startsWith("@")?r.rawSpecifier.split("/").slice(0,2).join("/"):r.rawSpecifier.split("/")[0];n&&!e.some(s=>s.name===n)&&e.push({name:n,kind:"library"})}}function bo(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports){if(r.isExternal||!r.toPath)continue;let n=t.get(r.toPath);n&&(n.category!=="logic"&&n.category!=="barrel"||(n.testedBy??=[],n.testedBy.includes(e.path)||n.testedBy.push(e.path)))}}function Co(t){for(let e of t.values())if(e.type==="markdown")for(let r of e.imports){if(r.isExternal||!r.toPath)continue;let n=t.get(r.toPath);!n||n===e||(n.documentedBy??=[],n.documentedBy.includes(e.path)||n.documentedBy.push(e.path),n.category==="logic"&&(n.lastCommitAt??0)>(e.lastCommitAt??0)&&(e.staleFor??=[],e.staleFor.includes(n.path)||e.staleFor.push(n.path)))}}function yo(t){return Math.round(t*1e4)/1e4}function vo(t){for(let e of t.values()){let r=[];for(let n of e.imports){if(n.isExternal||!n.toPath)continue;let s=t.get(n.toPath);if(!s||s.exports.length===0)continue;let o;if(n.symbols===void 0){if(n.type==="side-effect")continue;o=1}else n.symbols.includes("*")?o=1:o=n.symbols.length/s.exports.length;n.exportUsageRatio=yo(Math.min(1,o)),r.push(n.exportUsageRatio)}r.length>0&&(e.avgExportUsage=yo(r.reduce((n,s)=>n+s,0)/r.length),e.maxExportUsage=Math.max(...r))}}function Tr(t,e,r){e&&(t.some(n=>n.name===e&&n.kind===r)||t.push({name:e,kind:r}))}function Ip(t,e){let r=e.toPath,n=ho.basename(r,ho.extname(r)).replace(/\.(test|spec)$/,"");Tr(t.tags,n,"import")}function Mp(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let r of e.symbols)Tr(t.tags,r,"import")}function Dp(t,e,r){let n=r.get(e.toPath);if(!(!n||n.category==="test"))for(let s of n.tags)s.kind==="comment-marker"&&Tr(t.tags,s.name,"comment-marker")}function ko(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports)!r.toPath||r.isExternal||(Ip(e,r),Mp(e,r),Dp(e,r,t))}var Eo=m(()=>{"use strict";l()});import Fo from"fs";import pe from"path";function Ap(t,e){let r=t.split(`
|
|
24
|
-
`),n=null,s=new Map,o=!1;for(let i of r){let a=i.trim();if(a.startsWith("module ")){n=a.slice(7).trim();continue}if(/^replace\s*\(/.test(a)){o=!0;continue}if(o&&a===")"){o=!1;continue}if(o&&a.includes("=>")){wo(a,e,s);continue}!o&&/^replace\s+/.test(a)&&a.includes("=>")&&wo(a.replace(/^replace\s+/,""),e,s)}return{mod:n,replaces:s}}function wo(t,e,r){let[n,s]=t.split("=>").map(a=>a.trim());if(!n||!s)return;let o=n.split(/\s+/)[0];if(!s.startsWith(".")&&!s.startsWith("/"))return;let i=pe.isAbsolute(s)?s:pe.resolve(e,s);r.set(o,i)}function No(t){let e;try{e=Fo.readdirSync(t,{withFileTypes:!0})}catch{return null}let r=e.filter(n=>n.isFile()&&n.name.endsWith(".go")&&!n.name.endsWith("_test.go")).map(n=>({path:pe.join(t,n.name),isExternal:!1})).sort((n,s)=>n.path.localeCompare(s.path));return r.length>0?r:null}var Ee,To=m(()=>{"use strict";l();Ee=class{extensions=[".go"];goModCache=new Map;resolve(e,r,n,s){let{mod:o,replaces:i}=this.readGoMod(n);if(!o)return null;let a=this.applyReplace(r,i,n);if(a!==void 0)return No(a);if(r!==o&&!r.startsWith(`${o}/`))return null;let c=r.slice(o.length).replace(/^\//,"");return c?No(pe.join(n,c)):null}readGoMod(e){let r=this.goModCache.get(e);if(r!==void 0)return r;let n={mod:null,replaces:new Map};try{let s=Fo.readFileSync(pe.join(e,"go.mod"),"utf-8"),o=Ap(s,e);return this.goModCache.set(e,o),o}catch{return this.goModCache.set(e,n),n}}applyReplace(e,r,n){for(let[s,o]of r){if(e===s)return o;if(e.startsWith(`${s}/`)){let i=e.slice(s.length+1);return pe.join(o,i)}}}}});import Rp from"fs";import Pr from"path";var we,Po=m(()=>{"use strict";l();we=class{extensions=[".lua"];resolve(e,r,n,s){let o=r.replace(/\./g,Pr.sep),i=[n,Pr.join(n,"lib")];for(let a of i){if(!Rp.existsSync(a))continue;let c=s(Pr.join(a,"_dummy.lua"),o);if(c)return[c]}return null}}});import Lp from"path";var Ne,Io=m(()=>{"use strict";l();Ne=class{extensions=[".md",".mdx"];resolve(e,r,n,s){let o=s(Lp.join(n,"_dummy"),`./${r}`);return o?[o]:null}}});import Op from"fs";import Ir from"path";function Mo(t){try{return Op.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Fe,Do=m(()=>{"use strict";l();Fe=class{extensions=[".py"];resolve(e,r,n,s){let o=r.replace(/\./g,Ir.sep),i=Ir.join(n,`${o}.py`);if(Mo(i))return[{path:i,isExternal:!1}];let a=Ir.join(n,o,"__init__.py");return Mo(a)?[{path:a,isExternal:!1}]:null}}});import Ao from"path";var Gp,Te,Ro=m(()=>{"use strict";l();Gp=["~","http://","https://","//","data:","sass:"],Te=class{extensions=[".css",".scss",".sass",".less",".styl"];resolve(e,r,n,s){if(Gp.some(g=>r.startsWith(g)))return null;let o=s(e,r);if(o)return[o];let i=Ao.dirname(r),a=Ao.basename(r),c=i==="."?`_${a}`:`${i}/_${a}`,p=s(e,c);return p?[p]:null}}});var Lo=m(()=>{"use strict";l();To();Po();Io();Do();Ro()});import mt from"fs";import z from"path";var V,Mr=m(()=>{"use strict";l();Lo();V=class{constructor(e,r={}){this.rootDir=e;this.workspaceMap=r.workspaceMap??new Map,this.tsconfigSearchPaths=r.tsconfigSearchPaths??[e],this.pathAliases=r.pathAliases,this.langResolvers=r.langResolvers??[new Fe,new we,new Ee,new Te,new Ne]}rootDir;workspaceMap;tsconfigSearchPaths;pathAliases;langResolvers;resolveAll(e,r){let n=this.resolvePathAlias(r);if(n)return[n];if(r.startsWith(".")||r.startsWith("/")){let i=this.resolveLocalPath(e,r);return i?[i]:[]}let s=(i,a)=>this.resolveLocalPath(i,a);for(let i of this.langResolvers)if(i.extensions.some(a=>e.endsWith(a))){let a=i.resolve(e,r,this.rootDir,s);if(a)return a}let o=this.resolveWorkspaceImport(r);return o?[o]:[{path:r,isExternal:!0}]}resolve(e,r){let n=this.resolvePathAlias(r);if(n)return n;if(r.startsWith(".")||r.startsWith("/"))return this.resolveLocalPath(e,r);let s=(i,a)=>this.resolveLocalPath(i,a);for(let i of this.langResolvers)if(i.extensions.some(a=>e.endsWith(a))){let a=i.resolve(e,r,this.rootDir,s);if(a)return a[0]??null}let o=this.resolveWorkspaceImport(r);return o||{path:r,isExternal:!0}}resolveLocalPath(e,r){let n=z.dirname(e),s=r.startsWith("/")?r:z.resolve(n,r),o=!s.startsWith(this.rootDir),i=["",".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".feature",".md",".mdx"],a=s.match(/\.(js|mjs|cjs)$/);if(a){let c=s.slice(0,-a[0].length);for(let p of[".ts",".tsx"]){let g=this.tryExtensions(c,p,o);if(g)return g}}for(let c of i){let p=this.tryExtensions(s,c,o);if(p)return p}return o?{path:s,isExternal:!0}:null}tryExtensions(e,r,n){let s=e+r;if(this.isFile(s))return{path:s,isExternal:n};let o=z.join(e,`index${r}`);if(this.isFile(o))return{path:o,isExternal:n};if(r===".py"){let i=z.join(e,"__init__.py");if(this.isFile(i))return{path:i,isExternal:n}}return null}isFile(e){try{return mt.statSync(e,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}resolvePathAlias(e){if(this.pathAliases)for(let r in this.pathAliases){let n=this.matchAliasPattern(r,e),s=this.pathAliases[r];if(n&&s){let o=this.tryAliasSubstitutions(s,n[1]||"");if(o)return o}}for(let r of this.tsconfigSearchPaths){let n=z.join(r,"tsconfig.json");if(mt.existsSync(n))try{let o=JSON.parse(mt.readFileSync(n,"utf-8")).compilerOptions?.paths;if(!o)continue;for(let i in o){let a=this.matchAliasPattern(i,e);if(a){let c=this.tryAliasSubstitutions(o[i],a[1]||"",r);if(c)return c}}}catch{}}return null}aliasRegexCache=new Map;matchAliasPattern(e,r){let n=this.aliasRegexCache.get(e);if(!n){let s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace("\\*","(.*)");n=new RegExp(`^${s}$`),this.aliasRegexCache.set(e,n)}return r.match(n)}tryAliasSubstitutions(e,r,n=this.rootDir){let s=["",".ts",".tsx",".js",".jsx",".coffee",".ls",".lua",".feature"];for(let o of e){let i=o.replace("*",r),a=z.resolve(n,i);for(let c of s){let p=this.tryExtensions(a,c,!1);if(p)return p}}return null}resolveWorkspaceImport(e){if(this.workspaceMap.size===0)return null;for(let[r,n]of this.workspaceMap){if(e!==r&&!e.startsWith(`${r}/`))continue;let s=e.slice(r.length),o={path:"",isExternal:!1,isWorkspace:!0,workspacePackage:r};if(!s){for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"]){let c=z.join(n,a);try{if(mt.statSync(c,{throwIfNoEntry:!1})?.isFile())return{...o,path:c}}catch{}}return{...o,path:n}}let i=this.resolveLocalPath(z.join(n,"_dummy"),s.slice(1));return i?{...o,path:i.path}:null}return null}}});import Pe from"fs";import T from"path";import jp from"piscina";function zp(t,e){if(t.length===0)return e;let r=t.map(i=>T.dirname(i).split(T.sep)),n=r[0];for(let i of r.slice(1)){let a=0;for(;a<n.length&&a<i.length&&n[a]===i[a];)a++;n=n.slice(0,a)}let s=n.join(T.sep)||T.sep,o=T.relative(e,s);return o.startsWith("..")||T.isAbsolute(o)?e:s}var _p,Oo,Wp,Ie,Go=m(()=>{"use strict";l();yr();q();Cs();go();Eo();ge();Mr();_p=["tests","test","__tests__","specs","spec"],Oo=new Set(["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"]),Wp=20;Ie=class{constructor(e,r=null,n,s,o=!1,i=new Map,a=!0){this.rootDir=e;this.enableGitStats=o;this.coverageMap=i;this.parallelParsing=a;this.previousGraph=r,this.resolver=n||new V(e),this.lockFile=bs(e),s&&(this.progressCallback=s)}rootDir;enableGitStats;coverageMap;parallelParsing;graph={nodes:new Map};visited=new Set;queue=[];previousGraph=null;resolver;lockFile=null;progressCallback;pool=null;gitStatsMap=null;async build(e){let r=e.map(n=>T.isAbsolute(n)?n:T.resolve(this.rootDir,n));await this.initPool(),this.enableGitStats&&(this.gitStatsMap=ys(this.rootDir));try{for(let n of r)this.enqueue(n);return await this.drain(),await this.processTestFiles(zp(r,this.rootDir)),await this.processDocFiles(),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
|
|
22
|
+
`;return`${p+x+d+i}
|
|
23
|
+
${f}`}}});import $o from"path";import Bo from"typescript";var $l,ct,Uo=u(()=>{"use strict";l();ie();$l=/\/\/ <mokosh-tags>[\s\S]*?\/\/ <\/mokosh-tags>\n*/,ct=class{name="vitest";canHandle(e){return _.has($o.extname(e).toLowerCase())}apply(e,r,n){let o=r.replace($l,""),s=Bo.createSourceFile($o.basename(e),o,Bo.ScriptTarget.Latest,!0),i=Sr(s),[a]=i;if(!a)return o;let c=Cr(a,"tags",s),p=[...n].sort();if(c!==null&&JSON.stringify([...c].sort())===JSON.stringify(p))return o;let f=i.flatMap(d=>{let x=n.length===0?kr(d,"tags",s):vr(d,"tags",Er(p),s);return x?[x]:[]});return f.length>0?wr(o,f):o}}});import Dr from"path";import lt from"typescript";function Ul(t){let e=lt.createSourceFile("detect.ts",t,lt.ScriptTarget.Latest,!0);for(let r of e.statements){if(!lt.isImportDeclaration(r)||!lt.isStringLiteral(r.moduleSpecifier))continue;let n=Bl[r.moduleSpecifier.text];if(n)return n}return null}function Ko(t="vitest",e={},r=process.cwd()){return[new nt,new at,new ot,new Mr(r,t,Object.entries(e))]}function Ho(t,e){return e.find(r=>r.canHandle(t))??null}var Jo,Bl,Mr,Vo=u(()=>{"use strict";l();Ro();Lo();Go();_o();jo();Wo();zo();ie();Uo();Jo={vitest:()=>new ct,playwright:()=>new it,cypress:()=>new rt,jest:()=>new st},Bl={"@playwright/test":"playwright",cypress:"cypress","@jest/globals":"jest",vitest:"vitest"};Mr=class{constructor(e,r,n){this.rootDir=e;this.defaultFramework=r;this.frameworkOverrides=n}rootDir;defaultFramework;frameworkOverrides;name="auto";canHandle(e){return _.has(Dr.extname(e).toLowerCase())}apply(e,r,n){let o=Ul(r)??this.matchOverride(e)??this.defaultFramework;return(Jo[o]??Jo.vitest)().apply(e,r,n)}matchOverride(e){let r=Dr.relative(this.rootDir,e).split(Dr.sep).join("/");for(let[n,o]of this.frameworkOverrides)if(Oo(n,r))return o;return null}}});import Qo from"fs/promises";import Jl from"path";async function Ql(t,e,r,n){let o;try{o=await Qo.readFile(t,"utf8")}catch(a){return{path:t,status:"error",error:String(a)}}let s=Ho(t,n);if(!s)return{path:t,status:"unchanged"};let i=s.apply(t,o,e);return i===o?{path:t,status:"unchanged"}:(r||await Qo.writeFile(t,i,"utf8"),{path:t,status:"updated"})}async function Ar(t,e,r){let n=re(e),o=n.tagApplier?.framework??"vitest",s=n.tagApplier?.frameworkOverrides??{},i=Ko(o,s,e),a={updated:0,unchanged:0,errors:0,files:[]};for(let c of t.nodes.values()){if(c.category!=="test")continue;let p=new Set,f=[];for(let y of c.tags)Hl.has(y.kind)&&Kl.test(y.name)&&(Vl.has(y.name.toLowerCase())||p.has(y.name)||(p.add(y.name),f.push(y.name)));f.sort();let d=Jl.resolve(e,c.path),x=await Ql(d,f,r.dryRun,i);x.path=c.path,a.files.push(x),x.status==="updated"?a.updated++:x.status==="unchanged"?a.unchanged++:a.errors++}return a}var Kl,Hl,Vl,Yo=u(()=>{"use strict";l();Dt();Vo();Kl=/^[a-zA-Z][a-zA-Z0-9_-]{1,}$/,Hl=new Set(["import"]),Vl=new Set(["common","fixture","fixtures","helper","helpers","index","main","mock","mocks","setup","shared","spec","test","tests","types","util","utils"])});var pt,Rr=u(()=>{"use strict";l();pt=class{isTestNode(e){return e.category==="test"||e.tags.some(r=>r.name==="test")}}});import{execFileSync as Lr}from"child_process";function Zo(t,e){let r="",n=0;for(let o of t.split(`
|
|
24
|
+
`)){if(o.startsWith("\0")){let[,c,p]=o.slice(1).split(" ");r=c??"",n=p?Number(p)*1e3:0;continue}if(o==="")continue;let s=o.split(" "),i=s[0];if(!i)continue;let a=i.startsWith("R")||i.startsWith("C")?s[2]:s[1];a&&e(a,r,n)}}function es(t){let e=new Map;try{let r=Lr("git",["-C",t,"log","--since=90 days ago","--name-status","-M",`--format=${Xo}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],maxBuffer:qo});Zo(r,(n,o,s)=>{let i=e.get(n);if(i){i.commitCount90d+=1;return}e.set(n,{commitCount90d:1,lastAuthor:o||void 0,lastCommitAt:s||void 0})})}catch{return e}try{let r=Lr("git",["-C",t,"log","--name-status","-M",`--format=${Xo}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],maxBuffer:qo});Zo(r,(n,o,s)=>{e.has(n)||e.set(n,{commitCount90d:0,lastAuthor:void 0,lastCommitAt:s||void 0})})}catch{}return e}var ft,Xo,qo,Or=u(()=>{"use strict";l();ft=class{getChangedFiles(){try{let r=[["diff","--name-only"],["diff","--cached","--name-only"],["ls-files","--others","--exclude-standard"]].flatMap(n=>{try{return Lr("git",n,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
|
|
25
|
+
`).map(s=>s.trim()).filter(s=>s!=="")}catch{return[]}});return Array.from(new Set(r))}catch(e){return console.error("Error getting git diff:",e),[]}}},Xo="%x00%H%x09%ae%x09%at",qo=256*1024*1024});import ts from"path";function W(t){switch(ts.extname(t).toLowerCase()){case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".ts":case".tsx":return"typescript";case".css":return"css";case".scss":case".sass":return"scss";case".less":return"less";case".styl":return"stylus";case".coffee":return"coffeescript";case".ls":return"livescript";case".lua":return"lua";case".py":return"python";case".go":return"go";case".java":case".cpp":case".cc":case".cxx":case".c":return"unknown";case".feature":return"gherkin";case".md":case".mdx":return"markdown";default:return"unknown"}}function A(t){let e=ts.extname(t).toLowerCase();return[".css",".scss",".sass",".less",".styl"].includes(e)}var z=u(()=>{"use strict";l()});function $(t){return t.startsWith("'")||t.startsWith('"')?t.slice(1,-1):t}function ae(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,n=r.exec(t);for(;n!==null;)n[1]&&e.add(n[1]),n=r.exec(t);return e}function ce(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}var mt=u(()=>{"use strict";l()});import Yl from"coffeescript";function ns(t){if(t){if(typeof t.originalValue=="string")return t.originalValue;if(typeof t.value=="string")return $(t.value)}}function Y(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function Xl(t,e){let r=ns(e.source);return r?{fromPath:t,toPath:"",rawSpecifier:r,isStyle:A(r),type:"static"}:null}function ql(t,e){let r=e.variable?.base?.value==="require",n=ns(e.args?.[0]?.base);return!r||!n?null:{fromPath:t,toPath:"",rawSpecifier:n,isStyle:A(n),type:"require"}}function rs(t,e){if(e)return[{name:e}];let r=t.value;if(r?.constructor?.name==="Class"){let o=Y(r.variable);return o?[{name:o}]:[]}if(r?.base?.constructor?.name==="Obj"&&Array.isArray(r.base.properties))return r.base.properties.map(o=>Y(o.variable)??Y(o)).filter(o=>!!o).map(o=>({name:o}));let n=Y(r);return n?[{name:n}]:[]}function Zl(t){if(Array.isArray(t.specifiers))return t.specifiers.map(r=>r.identifier??r.original?.value).filter(r=>!!r).map(r=>({name:r}));let e=Y(t.variable)??Y(t.variable?.base);return e?[{name:e}]:[]}function ep(t,e,r,n){let o=e.constructor?.name;if(o==="ImportDeclaration"){let s=Xl(t,e);s&&r.push(s)}else if(o==="Call"){let s=ql(t,e);s&&r.push(s)}else if(o==="Assign"){let s=Y(e.variable?.base),i=e.variable?.properties?.[0]?.name?.value;s==="module"&&i==="exports"?n.push(...rs(e,void 0)):s==="exports"&&typeof i=="string"&&n.push(...rs(e,i))}else o==="ExportNamedDeclaration"&&e.clause?n.push(...Zl(e.clause)):o==="ExportDefaultDeclaration"&&n.push({name:"default"})}function Gr(t,e,r,n){if(!(!e||typeof e!="object")){ep(t,e,r,n);for(let o in e){if(o==="locationData")continue;let s=e[o];if(!(!s||typeof s!="object"))if(Array.isArray(s))for(let i of s)Gr(t,i,r,n);else Gr(t,s,r,n)}}}function os(t,e){let r=ae(e),n=ce(t,r),o=[],s=[];try{Gr(t,Yl.nodes(e),o,s)}catch{}let i=new Set,a=s.filter(c=>i.has(c.name)?!1:(i.add(c.name),!0));return{imports:o,exports:a,tags:Array.from(r).map(c=>({name:c,kind:"comment-marker"})),category:n}}var ss=u(()=>{"use strict";l();z();mt()});import{AstBuilder as tp,GherkinClassicTokenMatcher as rp,Parser as np}from"@cucumber/gherkin";import{IdGenerator as op}from"@cucumber/messages";function _r(t,e){let r=new Set;try{let n=new tp(sp),o=new rp,i=new np(n,o).parse(e);i.feature&&(i.feature.tags.forEach(a=>{r.add(a.name.startsWith("@")?a.name.slice(1):a.name)}),i.feature.children.forEach(a=>{a.scenario&&(a.scenario.tags.forEach(c=>{r.add(c.name.startsWith("@")?c.name.slice(1):c.name)}),a.scenario.examples.forEach(c=>{c.tags.forEach(p=>{r.add(p.name.startsWith("@")?p.name.slice(1):p.name)})})),a.rule&&a.rule.children.forEach(c=>{c.scenario&&c.scenario.tags.forEach(p=>{r.add(p.name.startsWith("@")?p.name.slice(1):p.name)})})}))}catch(n){console.warn(`[GherkinParser] Failed to parse ${t}:`,n)}return{imports:[],exports:[],tags:Array.from(r).map(n=>({name:n,kind:"comment-marker"})),category:"test"}}var sp,is=u(()=>{"use strict";l();be();sp=op.uuid();se("gherkin",_r)});function X(t){let e=[],r=t.firstChild;for(;r;)e.push(r),r=r.nextSibling;return e}function Ce(t,e){let r=1;for(let n=0;n<e&&n<t.length;n++)t[n]===`
|
|
26
|
+
`&&r++;return r}var jr=u(()=>{"use strict";l()});function ip(t,e){let r=1;function n(o){switch(o.type.name){case"IfStatement":case"ForStatement":r++;break;case"Case":{o.firstChild?.type.name==="case"&&r++;break}case"LogicOp":{let i=e.slice(o.from,o.to);(i==="&&"||i==="||")&&r++;break}}let s=o.firstChild;for(;s;)n(s),s=s.nextSibling}return n(t),r}function ap(t,e){let r=0;function n(o,s,i){let a=o.type.name;if(a==="IfStatement"){r+=i?1:1+s;let f=X(o),d=i?s:s+1,x=f[1];x&&x.type.name!=="Block"&&n(x,d,!1);let y=f.find(b=>b.type.name==="Block");y&&n(y,d,!1);let S=f.findIndex(b=>b.type.name==="else");if(S>=0){let b=f[S+1];b?.type.name==="IfStatement"?n(b,s,!0):b&&(r+=1,n(b,s+1,!1))}return}if(a==="ForStatement"||a==="SwitchStatement"||a==="SelectStatement"){r+=1+s;let f=o.firstChild;for(;f;)n(f,s+1,!1),f=f.nextSibling;return}if(a==="LogicOp"){let f=e.slice(o.from,o.to);(f==="&&"||f==="||")&&(r+=1)}if(s>0&&a==="FunctionLiteral"){r+=1+s;let f=o.firstChild;for(;f;)n(f,s+1,!1),f=f.nextSibling;return}let p=o.firstChild;for(;p;)n(p,s,!1),p=p.nextSibling}return n(t,0,!1),r}function ut(t,e){return{complexity:ip(t,e),cognitiveComplexity:ap(t,e)}}function Wr(t,e){let n=t.getChild("Parameters")?.getChild("Parameter"),o=n?.getChild("TypeName")??n?.getChild("PointerType")?.getChild("TypeName");return o?e.slice(o.from,o.to):void 0}function as(t,e){let r=[],n=t.cursor();do if(n.name==="FunctionDecl"){let o=n.node.getChild("DefName");if(o){let s=e.slice(o.from,o.to),{complexity:i,cognitiveComplexity:a}=ut(n.node,e);r.push({name:s,line:Ce(e,n.from),complexity:i,cognitiveComplexity:a})}}else if(n.name==="MethodDecl"){let o=n.node.getChild("FieldName");if(o){let s=e.slice(o.from,o.to),i=Wr(n.node,e),a=i?`${i}.${s}`:s,{complexity:c,cognitiveComplexity:p}=ut(n.node,e);r.push({name:a,line:Ce(e,n.from),complexity:c,cognitiveComplexity:p})}}while(n.next());return r}var cs=u(()=>{"use strict";l();jr()});import cp from"path";import{parser as lp}from"@lezer/go";function ps(t,e){let r=[],n=new Map,o=new Set,s=new Set,i=new Map,a=lp.parse(e),c=a.cursor();do switch(c.name){case"LineComment":{let C=e.slice(c.from,c.to),T=C.match(pp);T?.[1]&&o.add(T[1]);let R=C.match(fp);R&&ls(R[1],s);let G=C.match(mp);G&&ls(G[1],s);break}case"ImportSpec":{let C=c.node.getChild("String");if(C){let R=e.slice(C.from,C.to).slice(1,-1);r.push({fromPath:t,toPath:"",rawSpecifier:R,isExternal:!0,isStyle:!1,type:"static"});let G=c.node.getChild("DefName"),U=G?e.slice(G.from,G.to):R.split("/").pop();U&&U!=="_"&&U!=="."&&i.set(U,R)}break}case"FunctionDecl":case"MethodDecl":case"TypeDecl":case"VarDecl":case"ConstDecl":{let C=c.node.getChild("DefName")??c.node.getChild("FieldName")??c.node.getChild("TypeSpec")?.getChild("DefName")??c.node.getChild("VarSpec")?.getChild("DefName")??c.node.getChild("ConstSpec")?.getChild("DefName");if(C){let T=e.slice(C.from,C.to);T!=="_"&&/^[A-Z]/.test(T)&&!n.has(T)&&n.set(T,{name:T})}break}}while(c.next());let p=r.some(C=>C.rawSpecifier==="testing"),f=cp.basename(t).endsWith("_test.go")||o.has("test")||p?"test":"logic",d=new Set([...o,...s]),{complexity:x,cognitiveComplexity:y}=ut(a.topNode,e),S=as(a,e),b=f==="test"?[]:up(a,e,i);return{imports:r,exports:Array.from(n.values()),tags:Array.from(d).map(C=>({name:C,kind:"comment-marker"})),category:f,rawCallEdges:b,complexity:x,cognitiveComplexity:y,...S.length>0?{functions:S}:{}}}function up(t,e,r){let n=[];function o(i,a){if(i.type.name==="CallExpr"){let p=i.firstChild;if(p?.type.name==="SelectorExpr"){let f=p.firstChild,d=p.getChild("FieldName");if(f?.type.name==="VariableName"&&d){let x=e.slice(f.from,f.to),y=r.get(x);if(y){let S=e.slice(d.from,d.to);n.push({from:a,to:S,toSpecifier:y})}}}}let c=i.firstChild;for(;c;)o(c,a),c=c.nextSibling}let s=t.cursor();do if(s.name==="FunctionDecl"){let i=s.node.getChild("DefName"),a=s.node.getChild("Block");if(i&&a){let c=e.slice(i.from,i.to);/^[A-Z]/.test(c)&&o(a,c)}}else if(s.name==="MethodDecl"){let i=s.node.getChild("FieldName"),a=s.node.getChild("Block");if(i&&a){let c=e.slice(i.from,i.to),p=Wr(s.node,e);o(a,p?`${p}.${c}`:c)}}while(s.next());return n}function ls(t,e){for(let r of t.split(/[\s,&|!()]+/)){let n=r.trim();n&&n!=="ignore"&&e.add(n)}}var pp,fp,mp,fs=u(()=>{"use strict";l();cs();pp=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,fp=/^\/\/go:build\s+(.+)$/,mp=/^\/\/\s*\+build\s+(.+)$/});import gp from"livescript";function q(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function dp(t){if(!t)return[];if(t.constructor?.name==="Class"){let r=q(t.title);return r?[{name:r}]:[]}if(t.constructor?.name==="Obj"&&Array.isArray(t.items))return t.items.map(r=>q(r.key)??q(r.val)).filter(r=>!!r).map(r=>({name:r}));let e=q(t);return e?[{name:e}]:[]}function hp(t){let e=t.constructor?.name||t.type;if(e==="Assign"&&t.left?.constructor?.name==="Chain"){let r=t.left,n=q(r.head),s=r.tails?.[0]?.key?.name;if(n==="module"&&s==="exports")return dp(t.right);if(n==="exports"&&typeof s=="string")return[{name:s}];if(r.head?.verb==="out"&&typeof s=="string")return[{name:s}]}if(e==="Import"&&t.left?.verb==="out"){let r=t.right;if(r?.constructor?.name==="Obj"&&Array.isArray(r.items))return r.items.map(n=>q(n.val)??q(n.key)).filter(n=>!!n).map(n=>({name:n}))}return[]}function xp(t,e){let r=t.constructor?.name||t.type;if(r==="Import"){let n=t.right?.value;if(typeof n=="string"){let o=$(n);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:A(o),type:"static"}}}if(r==="Chain"&&t.head?.value==="require"){let n=t.tails?.[0];if(n?.constructor?.name==="Call"||n?.type==="Call"){let o=n.args?.[0]?.value;if(typeof o=="string"){let s=$(o);return{fromPath:e,toPath:"",rawSpecifier:s,isStyle:A(s),type:"require"}}}}return null}function zr(t,e,r){if(!t||typeof t!="object")return[];let n=[],o=xp(t,e);o&&n.push(o),r.push(...hp(t));for(let s in t){if(yp.has(s))continue;let i=t[s];if(!(!i||typeof i!="object"))if(Array.isArray(i))for(let a of i)n.push(...zr(a,e,r));else n.push(...zr(i,e,r))}return n}function ms(t,e){let r=ae(e),n=ce(t,r),o=[],s=[];try{o=zr(gp.ast(e),t,s)}catch{}let i=new Set,a=s.filter(c=>i.has(c.name)?!1:(i.add(c.name),!0));return{imports:o,exports:a,tags:Array.from(r).map(c=>({name:c,kind:"comment-marker"})),category:n}}var yp,us=u(()=>{"use strict";l();z();mt();yp=new Set(["first_line","first_column","last_line","last_column","line","column"])});import bp from"luaparse";function Sp(t,e){let r=[];function n(o){if(!(!o||typeof o!="object")){if((o.type==="CallExpression"||o.type==="StringCallExpression")&&o.base?.type==="Identifier"&&o.base?.name==="require"){let s;if(o.type==="CallExpression"){let i=o.arguments?.[0];i?.type==="StringLiteral"&&(s=$(i.raw))}else if(o.type==="StringCallExpression"){let i=o.argument;i?.type==="StringLiteral"&&(s=$(i.raw))}s&&r.push({fromPath:e,toPath:"",rawSpecifier:s,isStyle:A(s),type:"require"})}for(let s in o){if(s==="loc")continue;let i=o[s];if(i&&typeof i=="object")if(Array.isArray(i))for(let a of i)n(a);else n(i)}}}return n(t),r}function Cp(t){let e=new Set;for(let r of t)r.type==="LocalStatement"&&r.variables.forEach((n,o)=>{r.init[o]?.type==="TableConstructorExpression"&&e.add(n.name)});return e}function vp(t){let e=t[t.length-1];if(e?.type!=="ReturnStatement")return[];let r=e.arguments[0];if(r?.type!=="TableConstructorExpression")return[];let n=[];for(let o of r.fields)o.type==="TableKeyString"&&n.push({name:o.key.name});return n}function kp(t){let e=t.body,r=Cp(e),n=vp(e);for(let s of e)if(s.type==="FunctionDeclaration")s.identifier?.type==="MemberExpression"?s.identifier.base.type==="Identifier"&&r.has(s.identifier.base.name)&&n.push({name:s.identifier.identifier.name}):s.identifier?.type==="Identifier"&&!s.isLocal&&n.push({name:s.identifier.name});else if(s.type==="AssignmentStatement")for(let i of s.variables)i.type==="MemberExpression"&&i.base.type==="Identifier"&&r.has(i.base.name)&&n.push({name:i.identifier.name});let o=new Set;return n.filter(s=>o.has(s.name)?!1:(o.add(s.name),!0))}function gs(t,e){let r=ae(e),n=ce(t,r),o=[],s=[];try{let i=bp.parse(e);o=Sp(i,t),s=kp(i)}catch{}return{imports:o,exports:s,tags:Array.from(r).map(i=>({name:i,kind:"comment-marker"})),category:n}}var ds=u(()=>{"use strict";l();z();mt()});async function Tp(){return hs??=(async()=>{let{unified:t}=await import("unified"),e=(await import("remark-parse")).default;return t().use(e)})(),hs}function Np(t){let e=t.trim();return e.length===0||e.startsWith("#")||wp.some(r=>e.startsWith(r))}function Pp(t,e){let r=t.match(Fp);return r?r.map(n=>({fromPath:e,toPath:"",rawSpecifier:n,isStyle:!1,type:"static"})):[]}function ys(t,e,r){if(t.type==="link"&&typeof t.url=="string"&&!Np(t.url)&&r.push({fromPath:e,toPath:"",rawSpecifier:t.url,isStyle:!1,type:"static"}),(t.type==="code"||t.type==="inlineCode")&&typeof t.value=="string"&&r.push(...Pp(t.value,e)),Array.isArray(t.children))for(let n of t.children)ys(n,e,r)}async function xs(t,e){let n=(await Tp()).parse(e),o=[];ys(n,t,o);let s=new Set;return{imports:o.filter(a=>s.has(a.rawSpecifier)?!1:(s.add(a.rawSpecifier),!0)),exports:[],tags:[],category:"other"}}var wp,Ep,Fp,hs,bs=u(()=>{"use strict";l();wp=["http://","https://","mailto:","//"],Ep="ts|tsx|js|jsx|mjs|cjs|py|go|lua|css|scss|less|styl|coffee|ls|feature|md|mdx|json",Fp=new RegExp(`(?:\\.{1,2}/)?[\\w.-]+(?:/[\\w.-]+)*\\.(?:${Ep})\\b`,"g")});function Ip(t){let e=1;function r(n){switch(n.type.name){case"IfStatement":{e+=X(n).filter(s=>s.type.name==="if"||s.type.name==="elif").length;break}case"TryStatement":{e+=X(n).filter(s=>s.type.name==="except").length;break}case"ForStatement":case"WhileStatement":case"ConditionalExpression":e++;break;case"and":case"or":e++;break}let o=n.firstChild;for(;o;)r(o),o=o.nextSibling}return r(t),e}function Dp(t){let e=0;function r(n,o){let s=n.type.name;if(s==="IfStatement"){let c=X(n),p=0,f=0;for(;f<c.length;){let d=c[f];if(d?.type.name==="if"||d?.type.name==="elif"){let x=p>0;e+=x?1:1+o;let y=x?o:o+1,S=c[f+1],b=c[f+2];S&&r(S,y),b&&r(b,y),p++,f+=3}else if(d?.type.name==="else"){e+=1;let x=c[f+1];x&&r(x,o+1),f+=2}else f++}return}if(s==="TryStatement"){let c=X(n),p=0;for(;p<c.length;){let f=c[p];if(f?.type.name==="except"){for(e+=1+o,p++;p<c.length&&c[p]?.type.name!=="Body";)r(c[p],o),p++;p<c.length&&(r(c[p],o),p++)}else f?.type.name==="Body"&&r(f,o),p++}return}if(s==="ForStatement"||s==="WhileStatement"){e+=1+o;let c=n.firstChild;for(;c;)r(c,o+1),c=c.nextSibling;return}if((s==="ConditionalExpression"||s==="and"||s==="or")&&(e+=1),o>0&&(s==="FunctionDefinition"||s==="LambdaExpression")){e+=1+o;let c=n.firstChild;for(;c;)r(c,o+1),c=c.nextSibling;return}let a=n.firstChild;for(;a;)r(a,o),a=a.nextSibling}return r(t,0),e}function $r(t){return{complexity:Ip(t),cognitiveComplexity:Dp(t)}}function Ss(t,e){let r=[];function n(i,a){let{complexity:c,cognitiveComplexity:p}=$r(i);r.push({name:a,line:Ce(e,i.from),complexity:c,cognitiveComplexity:p})}function o(i){let a=i.firstChild;for(;a;)s(a),a=a.nextSibling}function s(i){if(i.type.name==="ClassDefinition"){let a=i.getChild("VariableName"),c=a?e.slice(a.from,a.to):void 0,p=i.getChild("Body");if(p){let f=p.firstChild;for(;f;){if(f.type.name==="FunctionDefinition"){let d=f.getChild("VariableName"),x=d?e.slice(d.from,d.to):void 0;x&&n(f,c?`${c}.${x}`:x),o(f)}else s(f);f=f.nextSibling}}return}if(i.type.name==="FunctionDefinition"){let a=i.getChild("VariableName");a&&n(i,e.slice(a.from,a.to)),o(i);return}o(i)}return s(t.topNode),r}var Cs=u(()=>{"use strict";l();jr()});import Mp from"path";import{parser as Ap}from"@lezer/python";function vs(t,e){let r=[],n=[],o=new Set,s=Mp.basename(t).toLowerCase(),i=Ap.parse(e),a=i.cursor();do switch(a.name){case"Comment":{let y=e.slice(a.from,a.to).match(/#\s*@tag\s+([a-zA-Z0-9_-]+)/);y?.[1]&&o.add(y[1]);break}case"ImportStatement":{for(let y of Lp(a.node,e,t))r.push(y);break}case"FunctionDefinition":case"ClassDefinition":{let y=a.node.parent;if(y?.name==="Script"||y?.name==="DecoratedStatement"&&y.parent?.name==="Script"){let b=a.node.getChild("VariableName");b&&n.push({name:e.slice(b.from,b.to)})}break}case"AssignStatement":{if(a.node.parent?.name==="Script"){let y=a.node.firstChild;y?.name==="VariableName"&&n.push({name:e.slice(y.from,y.to)})}break}}while(a.next());let c=zp(s,r,o);c==="test"&&o.add("test");let{complexity:p,cognitiveComplexity:f}=$r(i.topNode),d=Ss(i,e),x=c==="test"?[]:Wp(i,e);return{imports:r,exports:n,tags:Array.from(o).map(y=>({name:y,kind:"comment-marker"})),category:c,rawCallEdges:x,complexity:p,cognitiveComplexity:f,...d.length>0?{functions:d}:{}}}function Lp(t,e,r){let n=t.firstChild;return n?n.name==="from"?Op(t,e,r):Gp(t,e,r):[]}function Op(t,e,r){let n=t.firstChild;if(!n)return[];let o=n.nextSibling;for(;o&&o.name!=="import";)o=o.nextSibling;if(!o)return[];let s=e.slice(n.to,o.from).trim(),i=_p(o.nextSibling,e);if(!i.length)return[];let a=0;for(;a<s.length&&s[a]===".";)a++;let c=s.slice(a);if(a===0)return[ve(r,s,i,!0)];let p=a===1?"./":"../".repeat(a-1);return c?[ve(r,p+c.replace(/\./g,"/"),i,!1)]:i[0]==="*"?[ve(r,p.slice(0,-1),["*"],!1)]:i.map(f=>ve(r,p+f,[f],!1))}function Gp(t,e,r){let n=[],o=t.firstChild?.nextSibling??null;for(;o;){if(o.name==="VariableName"){let s=e.slice(o.from,o.to);for(;o.nextSibling?.name==="."&&o.nextSibling.nextSibling?.name==="VariableName";)o=o.nextSibling.nextSibling,s+=`.${e.slice(o.from,o.to)}`;o.nextSibling?.name==="as"&&(o=o.nextSibling.nextSibling??o.nextSibling),n.push(ve(r,s,["*"],!0))}o=o.nextSibling}return n}function _p(t,e){let r=[],n=t;for(;n;)n.name==="*"?r.push("*"):n.name==="VariableName"&&(r.push(e.slice(n.from,n.to)),n.nextSibling?.name==="as"&&(n=n.nextSibling.nextSibling??n.nextSibling)),n=n.nextSibling;return r}function jp(t,e){let r=new Map,n=t.cursor();do{if(n.name!=="ImportStatement")continue;let s=n.node.firstChild;if(s?.type.name!=="from")continue;let i=s.nextSibling;for(;i&&i.type.name!=="import";)i=i.nextSibling;if(!i)continue;let a=e.slice(s.to,i.from).trim(),c=0;for(;c<a.length&&a[c]===".";)c++;let p=a.slice(c),f=c<=1?"./":"../".repeat(c-1),d=i.nextSibling;for(;d;){if(d.type.name==="VariableName"){let x=e.slice(d.from,d.to),y=x;if(d.nextSibling?.type.name==="as"){let b=d.nextSibling.nextSibling;b?.type.name==="VariableName"&&(y=e.slice(b.from,b.to),d=b)}let S=c===0?a:p?f+p.replace(/\./g,"/"):f+x;r.set(y,S)}d=d.nextSibling}}while(n.next());return r}function Wp(t,e){let r=jp(t,e),n=[];function o(a,c){if(a.type.name==="CallExpression"&&a.firstChild?.type.name==="VariableName"){let f=a.firstChild,d=e.slice(f.from,f.to),x=r.get(d);x&&n.push({from:c,to:d,toSpecifier:x})}let p=a.firstChild;for(;p;)o(p,c),p=p.nextSibling}function s(a){let c=a.firstChild;for(;c;)i(c),c=c.nextSibling}function i(a){if(a.type.name==="ClassDefinition"){let c=a.getChild("VariableName"),p=c?e.slice(c.from,c.to):void 0,f=a.getChild("Body");if(f){let d=f.firstChild;for(;d;){if(d.type.name==="FunctionDefinition"){let x=d.getChild("VariableName"),y=x?e.slice(x.from,x.to):void 0;y&&o(d,p?`${p}.${y}`:y)}else i(d);d=d.nextSibling}}return}if(a.type.name==="FunctionDefinition"){let c=a.getChild("VariableName");c&&o(a,e.slice(c.from,c.to));return}s(a)}return i(t.topNode),n}function ve(t,e,r,n){return{fromPath:t,toPath:"",rawSpecifier:e,isStyle:!1,isExternal:n,type:"static",symbols:r.length>0?r:void 0}}function zp(t,e,r){return t.startsWith("test_")||t.endsWith("_test.py")?"test":t==="conftest.py"||t==="setup.py"?"config":r.has("test")||e.some(n=>Rp.has(n.rawSpecifier))?"test":"logic"}var Rp,ks=u(()=>{"use strict";l();Cs();Rp=new Set(["pytest","unittest","nose","hypothesis"])});import v from"typescript";function $p(t){let e=1;function r(n){switch(n.kind){case v.SyntaxKind.IfStatement:case v.SyntaxKind.ConditionalExpression:case v.SyntaxKind.ForStatement:case v.SyntaxKind.ForInStatement:case v.SyntaxKind.ForOfStatement:case v.SyntaxKind.WhileStatement:case v.SyntaxKind.DoStatement:case v.SyntaxKind.CatchClause:case v.SyntaxKind.CaseClause:e++;break;case v.SyntaxKind.BinaryExpression:{let o=n.operatorToken.kind;(o===v.SyntaxKind.AmpersandAmpersandToken||o===v.SyntaxKind.BarBarToken||o===v.SyntaxKind.QuestionQuestionToken)&&e++;break}}v.forEachChild(n,r)}return r(t),e}function Bp(t){let e=0;function r(n,o,s){if(v.isIfStatement(n)){e+=s?1:1+o;let a=s?o:o+1;r(n.expression,a,!1),r(n.thenStatement,a,!1),n.elseStatement&&(v.isIfStatement(n.elseStatement)?r(n.elseStatement,o,!0):(e+=1,r(n.elseStatement,o+1,!1)));return}if(v.isForStatement(n)||v.isForInStatement(n)||v.isForOfStatement(n)||v.isWhileStatement(n)||v.isDoStatement(n)||v.isSwitchStatement(n)){e+=1+o,v.forEachChild(n,a=>r(a,o+1,!1));return}if(v.isCatchClause(n)){e+=1+o,v.forEachChild(n,a=>r(a,o,!1));return}if(v.isConditionalExpression(n)&&(e+=1),v.isBinaryExpression(n)){let a=n.operatorToken.kind;(a===v.SyntaxKind.AmpersandAmpersandToken||a===v.SyntaxKind.BarBarToken||a===v.SyntaxKind.QuestionQuestionToken)&&(e+=1)}if(o>0&&(v.isFunctionDeclaration(n)||v.isFunctionExpression(n)||v.isArrowFunction(n))){e+=1+o,v.forEachChild(n,a=>r(a,o+1,!1));return}v.forEachChild(n,a=>r(a,o,!1))}return r(t,0,!1),e}function Br(t){return{complexity:$p(t),cognitiveComplexity:Bp(t)}}var ws=u(()=>{"use strict";l()});import E from"typescript";function Es(t,e){Up(t,e),Kp(t,e),Hp(t,e),Vp(t,e)}function Up(t,e){if((E.isFunctionDeclaration(t)||E.isVariableDeclaration(t))&&t.name&&E.isIdentifier(t.name)&&Jp(t)){let r;if(E.isFunctionDeclaration(t))r="function";else{let n=t.initializer;r=n&&(E.isArrowFunction(n)||E.isFunctionExpression(n))?"function":"variable"}e.tags.add({name:t.name.text,kind:r})}}function Jp(t){if(E.isFunctionDeclaration(t))return E.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&E.isSourceFile(e.parent)}function Kp(t,e){if(!E.isStringLiteral(t))return;let r=t.text.match(/@[\w-]+/g);if(r)for(let n of r)e.tags.add({name:n.substring(1),kind:"comment-marker"})}function Hp(t,e){if(!E.isSourceFile(t))return;let r=/@tag\s+([a-zA-Z0-9_-]+)/g,n=t.getFullText(),o=r.exec(n);for(;o!==null;)o[1]&&e.tags.add({name:o[1],kind:"comment-marker"}),o=r.exec(n)}function Vp(t,e){if(E.isCallExpression(t)&&Qp(t.expression))for(let r of t.arguments)E.isObjectLiteralExpression(r)&&Yp(r,e)}function Qp(t){return E.isIdentifier(t)?Ur.has(t.text):!!(E.isPropertyAccessExpression(t)&&(Ur.has(t.name.text)||E.isIdentifier(t.expression)&&Ur.has(t.expression.text)))}function Yp(t,e){for(let r of t.properties){if(!E.isPropertyAssignment(r)||!E.isIdentifier(r.name)||r.name.text!=="tags"&&r.name.text!=="tag")continue;let{initializer:n}=r,o=E.isArrayLiteralExpression(n)?n.elements.filter(E.isStringLiteral):r.name.text==="tag"&&E.isStringLiteral(n)?[n]:[];for(let s of o)e.tags.add({name:s.text.replace(/^@/,""),kind:"comment-marker"})}}var Ur,Fs=u(()=>{"use strict";l();Ur=new Set(["test","describe","it"])});import Ts from"path";import h from"typescript";function Jr(t,e,r){let n=[],o=new Map,s=new Set,i=h.createSourceFile(t,e,h.ScriptTarget.Latest,!0,r==="typescript"?h.ScriptKind.TSX:h.ScriptKind.JSX),a={filePath:t,imports:n,exports:o,tags:s,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},c=b=>{ef(b,a),h.forEachChild(b,c)};c(i);let p=mf(t,a);(p==="test"||p==="barrel")&&s.add({name:p,kind:"comment-marker"}),p!=="test"&&uf(a,i);let f=i.statements[0],d=f?Ps(f):void 0,{complexity:x,cognitiveComplexity:y}=Br(i),S=Xp(i);return{imports:n,exports:Array.from(o.values()),tags:Array.from(s),category:p,rawCallEdges:a.rawCallEdges??[],complexity:x,cognitiveComplexity:y,...S.length>0?{functions:S}:{},...d!==void 0?{description:d}:{}}}function Xp(t){let e=[],r=(o,s)=>{let{complexity:i,cognitiveComplexity:a}=Br(s),c=t.getLineAndCharacterOfPosition(s.getStart(t)).line+1;e.push({name:o,line:c,complexity:i,cognitiveComplexity:a})},n=(o,s)=>{if(h.isFunctionDeclaration(o)&&o.name&&o.body?r(o.name.text,o):h.isVariableDeclaration(o)&&h.isIdentifier(o.name)&&o.initializer&&(h.isArrowFunction(o.initializer)||h.isFunctionExpression(o.initializer))?r(o.name.text,o.initializer):s&&h.isMethodDeclaration(o)&&h.isIdentifier(o.name)&&o.body?r(`${s}.${o.name.text}`,o):s&&h.isConstructorDeclaration(o)&&o.body?r(`${s}.constructor`,o):s&&h.isGetAccessorDeclaration(o)&&h.isIdentifier(o.name)&&o.body?r(`${s}.get ${o.name.text}`,o):s&&h.isSetAccessorDeclaration(o)&&h.isIdentifier(o.name)&&o.body&&r(`${s}.set ${o.name.text}`,o),h.isClassDeclaration(o)&&o.name){let i=o.name.text;h.forEachChild(o,a=>n(a,i));return}h.forEachChild(o,i=>n(i,s))};return n(t,void 0),e}function Ns(t,e,r,n){let o={name:t},s=Ps(r);s!==void 0&&(o.doc=s);let i=qp(e);i!==void 0&&(o.flags=i);let a=Zp(e,n);return a!==void 0&&(o.signature=a),o}function Ps(t){let e=h.getJSDocCommentsAndTags(t);for(let r of e)if(h.isJSDoc(r)&&r.comment)return h.getTextOfJSDocComment(r.comment)||void 0}function qp(t){let e=new Set(["deprecated","internal","public","alpha","beta"]),r=h.getJSDocTags(t).map(n=>n.tagName.text).filter(n=>e.has(n));return r.length>0?r:void 0}function Zp(t,e){let r=h.createPrinter({removeComments:!0}),n=o=>r.printNode(h.EmitHint.Unspecified,o,e);if(h.isFunctionDeclaration(t)||h.isMethodDeclaration(t)){let o=t.parameters.map(n).join(", "),s=t.type?n(t.type):"void";return`${t.typeParameters?`<${t.typeParameters.map(a=>a.name.text).join(", ")}>`:""}(${o}) => ${s}`}if(h.isVariableDeclaration(t)){if(t.type)return n(t.type);if(t.initializer&&(h.isArrowFunction(t.initializer)||h.isFunctionExpression(t.initializer))){let o=t.initializer,s=o.parameters.map(n).join(", "),i=o.type?n(o.type):"unknown";return`(${s}) => ${i}`}return}if(h.isClassDeclaration(t)&&t.name)return`class ${t.name.text}`;if(h.isInterfaceDeclaration(t))return`interface ${t.name.text}`;if(h.isTypeAliasDeclaration(t))return n(t.type);if(h.isEnumDeclaration(t))return`enum ${t.name.text}`}function ef(t,e){tf(t,e),rf(t,e),of(t,e),sf(t,e),ff(t,e),Es(t,e)}function tf(t,e){if(!h.isSourceFile(t))return;let r=t.statements.filter(n=>!h.isEmptyStatement(n));e.totalStatements=r.length,e.exportStatements=r.filter(n=>h.isExportDeclaration(n)||h.isExportAssignment(n)||Kr(n)).length}function rf(t,e){if(h.isJsxElement(t)||h.isJsxSelfClosingElement(t)||h.isJsxFragment(t)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(h.isFunctionDeclaration(t)||h.isMethodDeclaration(t)||h.isArrowFunction(t)||h.isClassDeclaration(t)||h.isVariableStatement(t)||h.isEnumDeclaration(t)){e.hasTypesOnly=!1;return}h.isExportDeclaration(t)&&!nf(t)&&(e.hasTypesOnly=!1)}function nf(t){return t.isTypeOnly?!0:!t.exportClause||!h.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function of(t,e){if(!h.isImportDeclaration(t)||!t.moduleSpecifier||!h.isStringLiteral(t.moduleSpecifier))return;let r=[];if(t.importClause&&(t.importClause.name&&r.push("default"),t.importClause.namedBindings))if(h.isNamedImports(t.importClause.namedBindings))for(let o of t.importClause.namedBindings.elements)r.push(o.name.text);else h.isNamespaceImport(t.importClause.namedBindings)&&r.push("*");let n=r.length>0?"static":"side-effect";e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:t.moduleSpecifier.text,isStyle:A(t.moduleSpecifier.text),type:n,symbols:r.length>0?r:void 0})}function sf(t,e){h.isExportDeclaration(t)?af(t,e):h.isExportAssignment(t)?e.exports.set("default",{name:"default"}):Kr(t)&&pf(t,e)}function af(t,e){if(t.moduleSpecifier&&h.isStringLiteral(t.moduleSpecifier))cf(t,t.moduleSpecifier.text,e);else if(t.exportClause&&h.isNamedExports(t.exportClause))for(let r of t.exportClause.elements){let n=r.name.text;e.exports.set(n,{name:n})}}function cf(t,e,r){let n=lf(t),o={fromPath:r.filePath,toPath:"",rawSpecifier:e,isStyle:A(e),type:"re-export"};n.length>0&&(o.symbols=n),r.imports.push(o)}function lf(t){return t.exportClause?h.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function pf(t,e){if((h.isFunctionDeclaration(t)||h.isClassDeclaration(t)||h.isInterfaceDeclaration(t)||h.isTypeAliasDeclaration(t)||h.isEnumDeclaration(t))&&t.name){let n=t.name.text;e.exports.set(n,Ns(n,t,t,e.sourceFile));return}if(h.isVariableStatement(t)){for(let n of t.declarationList.declarations)if(h.isIdentifier(n.name)){let o=n.name.text;e.exports.set(o,Ns(o,n,t,e.sourceFile))}}}function ff(t,e){if(!h.isCallExpression(t))return;let r=t.arguments[0];!r||!h.isStringLiteral(r)||(t.expression.kind===h.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:A(r.text),type:"dynamic"}):h.isIdentifier(t.expression)&&t.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:A(r.text),type:"require"}))}function mf(t,e){let r=Ts.basename(t).toLowerCase(),n=Ts.extname(t).toLowerCase();return fe().some(s=>r.includes(s))?"test":kn(r)?"config":e.imports.some(s=>Ft().some(i=>s.rawSpecifier.includes(i)))?"test":n===".tsx"||n===".jsx"||e.hasUI?"ui":e.hasTypesOnly&&e.totalStatements>0?"type-only":e.totalStatements>0&&e.exportStatements/e.totalStatements>Nt()?"barrel":"logic"}function Kr(t){return h.canHaveModifiers(t)&&h.getModifiers(t)?.some(e=>e.kind===h.SyntaxKind.ExportKeyword)===!0}function uf(t,e){let r=t.rawCallEdges??[];t.rawCallEdges=r;let n=new Map;for(let o of e.statements){if(!h.isImportDeclaration(o)||!h.isStringLiteral(o.moduleSpecifier))continue;let s=o.moduleSpecifier.text,i=o.importClause;if(i&&(i.name&&n.set(i.name.text,s),i.namedBindings&&h.isNamedImports(i.namedBindings)))for(let a of i.namedBindings.elements)n.set(a.name.text,s)}if(n.size!==0)for(let o of e.statements){let s=df(o);if(s){let i=hf(o);i&>(i,s,n,r);continue}h.isClassDeclaration(o)&&o.name&&gf(o,o.name.text,n,r)}}function gf(t,e,r,n){for(let o of t.members)h.isMethodDeclaration(o)&&o.body&&h.isIdentifier(o.name)?gt(o.body,`${e}.${o.name.text}`,r,n):h.isConstructorDeclaration(o)&&o.body&>(o.body,`${e}.constructor`,r,n)}function df(t){if(Kr(t)){if(h.isFunctionDeclaration(t)&&t.name)return t.name.text;if(h.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(h.isIdentifier(e.name)&&e.initializer&&(h.isArrowFunction(e.initializer)||h.isFunctionExpression(e.initializer)))return e.name.text}}}function hf(t){if(h.isFunctionDeclaration(t))return t.body;if(h.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(e.initializer&&(h.isArrowFunction(e.initializer)||h.isFunctionExpression(e.initializer)))return e.initializer}}function gt(t,e,r,n){if(h.isCallExpression(t)&&h.isIdentifier(t.expression)){let o=t.expression.text,s=r.get(o);s&&!n.some(i=>i.from===e&&i.to===o&&i.toSpecifier===s)&&n.push({from:e,to:o,toSpecifier:s})}h.forEachChild(t,o=>gt(o,e,r,n))}var Is=u(()=>{"use strict";l();te();ws();z();Fs()});function dt(t,e){if(e.length===0)return"ui";let r=!1;return t.walk(n=>{if(n.type==="rule")return r=!0,!1}),r?"ui":"barrel"}var Ds=u(()=>{"use strict";l()});function Ms(t,e){let r=[],n=/@require\s+['"]([^'"]+)['"]/g,o=n.exec(t);for(;o!==null;){let i=o[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"require"}),o=n.exec(t)}let s=/(?<!@)(?:import|require)\s*\(?\s*['"]([^'"]+)['"]/g;for(o=s.exec(t);o!==null;){let i=o[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"static"}),o=s.exec(t)}return r}function As(t,e){if(e.length===0)return"ui";try{let r=Et("stylus");return new r.Parser(t).parse().nodes.some(s=>s.constructor.name!=="Import")?"ui":"barrel"}catch{return t.replace(/^\s*@?(?:require|import)\b.*/gm,"").trim().length>0?"ui":"barrel"}}var Rs=u(()=>{"use strict";l()});function ke(t,e){let r=W(t);if(r==="stylus"){let s=Ms(e,t);return{imports:s,exports:[],tags:[],category:As(e,s)}}if(r==="scss"){let{imports:s,root:i,exports:a,tags:c}=Be(e,t);return{imports:s,exports:a,tags:c,category:dt(i,s)}}if(r==="less"){let{imports:s,root:i,exports:a,tags:c}=$e(e,t);return{imports:s,exports:a,tags:c,category:dt(i,s)}}let{imports:n,root:o}=ze(e,t);return{imports:n,exports:[],tags:[],category:dt(o,n)}}var Ls=u(()=>{"use strict";l();z();Ds();Jt();Kt();Rs()});async function Os(t,e){let r=W(t),n=To(r);return n?n(t,e):{imports:[],exports:[],tags:[],category:"other"}}var Gs=u(()=>{"use strict";l();z();ss();is();fs();us();ds();bs();ks();Is();be();Ls();te();z();be();for(let[t,e]of[["javascript",(r,n)=>Jr(r,n,"javascript")],["typescript",(r,n)=>Jr(r,n,"typescript")],["css",ke],["scss",ke],["less",ke],["stylus",ke],["coffeescript",os],["livescript",ms],["lua",gs],["python",vs],["go",ps],["gherkin",_r],["markdown",xs]])se(t,e)});import _s from"path";function Ws(t,e){for(let r of t.values()){let n=e.get(r.path);n!==void 0&&(r.coveragePct=n)}}function zs(t,e){for(let r of t)if(r.isExternal){let n=r.rawSpecifier.startsWith("@")?r.rawSpecifier.split("/").slice(0,2).join("/"):r.rawSpecifier.split("/")[0];n&&!e.some(o=>o.name===n)&&e.push({name:n,kind:"library"})}}function $s(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports){if(r.isExternal||!r.toPath)continue;let n=t.get(r.toPath);n&&(n.category!=="logic"&&n.category!=="barrel"||(n.testedBy??=[],n.testedBy.includes(e.path)||n.testedBy.push(e.path)))}}function Bs(t){for(let e of t.values())if(e.type==="markdown")for(let r of e.imports){if(r.isExternal||!r.toPath)continue;let n=t.get(r.toPath);!n||n===e||(n.documentedBy??=[],n.documentedBy.includes(e.path)||n.documentedBy.push(e.path),n.category==="logic"&&(n.lastCommitAt??0)>(e.lastCommitAt??0)&&(e.staleFor??=[],e.staleFor.includes(n.path)||e.staleFor.push(n.path)))}}function js(t){return Math.round(t*1e4)/1e4}function Us(t){for(let e of t.values()){let r=[];for(let n of e.imports){if(n.isExternal||!n.toPath)continue;let o=t.get(n.toPath);if(!o||o.exports.length===0)continue;let s;if(n.symbols===void 0){if(n.type==="side-effect")continue;s=1}else n.symbols.includes("*")?s=1:s=n.symbols.length/o.exports.length;n.exportUsageRatio=js(Math.min(1,s)),r.push(n.exportUsageRatio)}r.length>0&&(e.avgExportUsage=js(r.reduce((n,o)=>n+o,0)/r.length),e.maxExportUsage=Math.max(...r))}}function Hr(t,e,r){e&&(t.some(n=>n.name===e&&n.kind===r)||t.push({name:e,kind:r}))}function yf(t,e){let r=e.toPath,n=_s.basename(r,_s.extname(r)).replace(/\.(test|spec)$/,"");Hr(t.tags,n,"import")}function xf(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let r of e.symbols)Hr(t.tags,r,"import")}function bf(t,e,r){let n=r.get(e.toPath);if(!(!n||n.category==="test"))for(let o of n.tags)o.kind==="comment-marker"&&Hr(t.tags,o.name,"comment-marker")}function Js(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports)!r.toPath||r.isExternal||(yf(e,r),xf(e,r),bf(e,r,t))}var Ks=u(()=>{"use strict";l()});import Qs from"fs";import le from"path";function Sf(t,e){let r=t.split(`
|
|
27
|
+
`),n=null,o=new Map,s=!1;for(let i of r){let a=i.trim();if(a.startsWith("module ")){n=a.slice(7).trim();continue}if(/^replace\s*\(/.test(a)){s=!0;continue}if(s&&a===")"){s=!1;continue}if(s&&a.includes("=>")){Hs(a,e,o);continue}!s&&/^replace\s+/.test(a)&&a.includes("=>")&&Hs(a.replace(/^replace\s+/,""),e,o)}return{mod:n,replaces:o}}function Hs(t,e,r){let[n,o]=t.split("=>").map(a=>a.trim());if(!n||!o)return;let s=n.split(/\s+/)[0];if(!o.startsWith(".")&&!o.startsWith("/"))return;let i=le.isAbsolute(o)?o:le.resolve(e,o);r.set(s,i)}function Vs(t){let e;try{e=Qs.readdirSync(t,{withFileTypes:!0})}catch{return null}let r=e.filter(n=>n.isFile()&&n.name.endsWith(".go")&&!n.name.endsWith("_test.go")).map(n=>({path:le.join(t,n.name),isExternal:!1})).sort((n,o)=>n.path.localeCompare(o.path));return r.length>0?r:null}var we,Ys=u(()=>{"use strict";l();we=class{extensions=[".go"];goModCache=new Map;resolve(e,r,n,o){let{mod:s,replaces:i}=this.readGoMod(n);if(!s)return null;let a=this.applyReplace(r,i,n);if(a!==void 0)return Vs(a);if(r!==s&&!r.startsWith(`${s}/`))return null;let c=r.slice(s.length).replace(/^\//,"");return c?Vs(le.join(n,c)):null}readGoMod(e){let r=this.goModCache.get(e);if(r!==void 0)return r;let n={mod:null,replaces:new Map};try{let o=Qs.readFileSync(le.join(e,"go.mod"),"utf-8"),s=Sf(o,e);return this.goModCache.set(e,s),s}catch{return this.goModCache.set(e,n),n}}applyReplace(e,r,n){for(let[o,s]of r){if(e===o)return s;if(e.startsWith(`${o}/`)){let i=e.slice(o.length+1);return le.join(s,i)}}}}});import Cf from"fs";import Vr from"path";var Ee,Xs=u(()=>{"use strict";l();Ee=class{extensions=[".lua"];resolve(e,r,n,o){let s=r.replace(/\./g,Vr.sep),i=[n,Vr.join(n,"lib")];for(let a of i){if(!Cf.existsSync(a))continue;let c=o(Vr.join(a,"_dummy.lua"),s);if(c)return[c]}return null}}});import vf from"path";var Fe,qs=u(()=>{"use strict";l();Fe=class{extensions=[".md",".mdx"];resolve(e,r,n,o){let s=o(vf.join(n,"_dummy"),`./${r}`);return s?[s]:null}}});import kf from"fs";import Qr from"path";function Zs(t){try{return kf.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Te,ei=u(()=>{"use strict";l();Te=class{extensions=[".py"];resolve(e,r,n,o){let s=r.replace(/\./g,Qr.sep),i=Qr.join(n,`${s}.py`);if(Zs(i))return[{path:i,isExternal:!1}];let a=Qr.join(n,s,"__init__.py");return Zs(a)?[{path:a,isExternal:!1}]:null}}});import ti from"path";var wf,Ne,ri=u(()=>{"use strict";l();wf=["~","http://","https://","//","data:","sass:"],Ne=class{extensions=[".css",".scss",".sass",".less",".styl"];resolve(e,r,n,o){if(wf.some(f=>r.startsWith(f)))return null;let s=o(e,r);if(s)return[s];let i=ti.dirname(r),a=ti.basename(r),c=i==="."?`_${a}`:`${i}/_${a}`,p=o(e,c);return p?[p]:null}}});var ni=u(()=>{"use strict";l();Ys();Xs();qs();ei();ri()});import ht from"fs";import B from"path";var Z,Yr=u(()=>{"use strict";l();ni();Z=class{constructor(e,r={}){this.rootDir=e;this.workspaceMap=r.workspaceMap??new Map,this.tsconfigSearchPaths=r.tsconfigSearchPaths??[e],this.pathAliases=r.pathAliases,this.langResolvers=r.langResolvers??[new Te,new Ee,new we,new Ne,new Fe]}rootDir;workspaceMap;tsconfigSearchPaths;pathAliases;langResolvers;resolveAll(e,r){let n=this.resolvePathAlias(r);if(n)return[n];if(r.startsWith(".")||r.startsWith("/")){let i=this.resolveLocalPath(e,r);return i?[i]:[]}let o=(i,a)=>this.resolveLocalPath(i,a);for(let i of this.langResolvers)if(i.extensions.some(a=>e.endsWith(a))){let a=i.resolve(e,r,this.rootDir,o);if(a)return a}let s=this.resolveWorkspaceImport(r);return s?[s]:[{path:r,isExternal:!0}]}resolve(e,r){let n=this.resolvePathAlias(r);if(n)return n;if(r.startsWith(".")||r.startsWith("/"))return this.resolveLocalPath(e,r);let o=(i,a)=>this.resolveLocalPath(i,a);for(let i of this.langResolvers)if(i.extensions.some(a=>e.endsWith(a))){let a=i.resolve(e,r,this.rootDir,o);if(a)return a[0]??null}let s=this.resolveWorkspaceImport(r);return s||{path:r,isExternal:!0}}resolveLocalPath(e,r){let n=B.dirname(e),o=r.startsWith("/")?r:B.resolve(n,r),s=!o.startsWith(this.rootDir),i=["",".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".feature",".md",".mdx"],a=o.match(/\.(js|mjs|cjs)$/);if(a){let c=o.slice(0,-a[0].length);for(let p of[".ts",".tsx"]){let f=this.tryExtensions(c,p,s);if(f)return f}}for(let c of i){let p=this.tryExtensions(o,c,s);if(p)return p}return s?{path:o,isExternal:!0}:null}tryExtensions(e,r,n){let o=e+r;if(this.isFile(o))return{path:o,isExternal:n};let s=B.join(e,`index${r}`);if(this.isFile(s))return{path:s,isExternal:n};if(r===".py"){let i=B.join(e,"__init__.py");if(this.isFile(i))return{path:i,isExternal:n}}return null}isFile(e){try{return ht.statSync(e,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}resolvePathAlias(e){if(this.pathAliases)for(let r in this.pathAliases){let n=this.matchAliasPattern(r,e),o=this.pathAliases[r];if(n&&o){let s=this.tryAliasSubstitutions(o,n[1]||"");if(s)return s}}for(let r of this.tsconfigSearchPaths){let n=B.join(r,"tsconfig.json");if(ht.existsSync(n))try{let s=JSON.parse(ht.readFileSync(n,"utf-8")).compilerOptions?.paths;if(!s)continue;for(let i in s){let a=this.matchAliasPattern(i,e);if(a){let c=this.tryAliasSubstitutions(s[i],a[1]||"",r);if(c)return c}}}catch{}}return null}aliasRegexCache=new Map;matchAliasPattern(e,r){let n=this.aliasRegexCache.get(e);if(!n){let o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace("\\*","(.*)");n=new RegExp(`^${o}$`),this.aliasRegexCache.set(e,n)}return r.match(n)}tryAliasSubstitutions(e,r,n=this.rootDir){let o=["",".ts",".tsx",".js",".jsx",".coffee",".ls",".lua",".feature"];for(let s of e){let i=s.replace("*",r),a=B.resolve(n,i);for(let c of o){let p=this.tryExtensions(a,c,!1);if(p)return p}}return null}resolveWorkspaceImport(e){if(this.workspaceMap.size===0)return null;for(let[r,n]of this.workspaceMap){if(e!==r&&!e.startsWith(`${r}/`))continue;let o=e.slice(r.length),s={path:"",isExternal:!1,isWorkspace:!0,workspacePackage:r};if(!o){for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"]){let c=B.join(n,a);try{if(ht.statSync(c,{throwIfNoEntry:!1})?.isFile())return{...s,path:c}}catch{}}return{...s,path:n}}let i=this.resolveLocalPath(B.join(n,"_dummy"),o.slice(1));return i?{...s,path:i.path}:null}return null}}});import Pe from"fs";import I from"path";import Ef from"piscina";function Nf(t,e){if(t.length===0)return e;let r=t.map(i=>I.dirname(i).split(I.sep)),n=r[0]??[];for(let i of r.slice(1)){let a=0;for(;a<n.length&&a<i.length&&n[a]===i[a];)a++;n=n.slice(0,a)}let o=n.join(I.sep)||I.sep,s=I.relative(e,o);return s.startsWith("..")||I.isAbsolute(s)?e:o}var Ff,oi,Tf,Ie,si=u(()=>{"use strict";l();Or();te();Bt();Gs();Ks();ge();Yr();Ff=["tests","test","__tests__","specs","spec"],oi=new Set(["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"]),Tf=20;Ie=class{constructor(e,r=null,n,o,s=!1,i=new Map,a=!0){this.rootDir=e;this.enableGitStats=s;this.coverageMap=i;this.parallelParsing=a;this.previousGraph=r,this.resolver=n||new Z(e),this.lockFile=_n(e),o&&(this.progressCallback=o)}rootDir;enableGitStats;coverageMap;parallelParsing;graph={nodes:new Map};visited=new Set;queue=[];previousGraph=null;resolver;lockFile=null;progressCallback;pool=null;gitStatsMap=null;async build(e){let r=e.map(n=>I.isAbsolute(n)?n:I.resolve(this.rootDir,n));await this.initPool(),this.enableGitStats&&(this.gitStatsMap=es(this.rootDir));try{for(let n of r)this.enqueue(n);return await this.drain(),await this.processTestFiles(Nf(r,this.rootDir)),await this.processDocFiles(),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
|
|
25
28
|
Done. Total processed: ${this.visited.size} nodes.
|
|
26
|
-
`),
|
|
29
|
+
`),Js(this.graph.nodes),$s(this.graph.nodes),Us(this.graph.nodes),Bs(this.graph.nodes),this.coverageMap.size>0&&Ws(this.graph.nodes,this.coverageMap),new D(this.graph.nodes)}finally{this.pool&&(await this.pool.destroy(),this.pool=null)}}async initPool(){if(this.parallelParsing===!1)return;let e=typeof this.parallelParsing=="object"?this.parallelParsing:{},r=e.minFiles??Tf;if(!(r>0&&!this.hasAtLeastFiles(this.rootDir,r)))try{let n=I.join(m,"parse-worker.js");this.pool=new Ef({filename:n,...e.maxThreads!==void 0?{maxThreads:e.maxThreads}:{}})}catch(n){process.stderr.write(`
|
|
27
30
|
Warning: failed to start parse worker pool, falling back to synchronous parsing: ${n}
|
|
28
|
-
`),this.pool=null}}hasAtLeastFiles(e,r){let n=0,
|
|
29
|
-
Warning: failed to parse ${r}: ${
|
|
30
|
-
`),null}}parseContent(e,r){return this.pool?this.pool.run({filePath:e,content:r}):
|
|
31
|
-
`))}var
|
|
32
|
-
`):JSON.stringify({file:r,callers:i,count:i.length},null,2))}var
|
|
31
|
+
`),this.pool=null}}hasAtLeastFiles(e,r){let n=0,o=[e];for(;o.length>0;){let s=o.pop();if(s===void 0)continue;let i;try{i=Pe.readdirSync(s,{withFileTypes:!0})}catch{continue}for(let a of i)if(a.isDirectory())oi.has(a.name)||o.push(I.join(s,a.name));else if(a.isFile()&&(n++,n>=r))return!0}return n>=r}async processTestFiles(e){let r=fe(),n=s=>r.some(i=>s.name.includes(i));this.walkProject(e,n);let o=e;for(;o!==this.rootDir;){let s=I.dirname(o);if(s===o)break;for(let i of Ff){let a=I.join(s,i);try{Pe.statSync(a).isDirectory()&&this.walkProject(a,n)}catch{}}o=s}await this.drain()}async processDocFiles(){this.walkProject(this.rootDir,e=>e.name.endsWith(".md")||e.name.endsWith(".mdx")),await this.drain()}walkProject(e,r){let n;try{n=Pe.readdirSync(e,{withFileTypes:!0})}catch{return}for(let o of n){let s=I.join(e,o.name);o.isDirectory()?oi.has(o.name)||this.walkProject(s,r):o.isFile()&&r(o)&&this.enqueue(s)}}enqueue(e){this.visited.has(e)||(this.visited.add(e),this.showProgress(),this.queue.push(e))}async drain(){for(;this.queue.length>0;){let e=this.queue;this.queue=[],await Promise.all(e.map(r=>this.finishFile(r)))}}async finishFile(e){let r=Pe.statSync(e,{throwIfNoEntry:!1});if(!r?.isFile())return;let n=I.relative(this.rootDir,e),o=await this.getNode(e,n,r);o.imports=await this.resolveImports(e,o.imports),zs(o.imports,o.tags),this.graph.nodes.set(o.path,o)}async getNode(e,r,n){let o=this.previousGraph?.nodes.get(r);if(o&&o.mtime===n.mtimeMs&&o.size===n.size)return{...o};let s=await this.tryParse(e,r);if(!s)return this.makeStubNode(e,r,n);let i=this.resolveCallEdges(e,s.rawCallEdges),a=this.buildNode(e,r,n,s,i);return this.attachGitStats(a,r),a}async tryParse(e,r){let n=Pe.readFileSync(e,"utf-8");try{return await this.parseContent(e,n)}catch(o){return process.stderr.write(`
|
|
32
|
+
Warning: failed to parse ${r}: ${o}
|
|
33
|
+
`),null}}parseContent(e,r){return this.pool?this.pool.run({filePath:e,content:r}):Os(e,r)}makeStubNode(e,r,n){return{path:r,type:W(e),category:"other",imports:[],exports:[],tags:[],mtime:n.mtimeMs,size:n.size}}resolveCallEdges(e,r){let n=[];for(let o of r??[])try{let s=this.resolver.resolve(e,o.toSpecifier);s&&!s.isExternal&&n.push({from:o.from,to:o.to,toFile:I.relative(this.rootDir,s.path)})}catch{}return n}buildNode(e,r,n,o,s){let{imports:i,exports:a,tags:c,category:p,description:f,complexity:d,cognitiveComplexity:x,functions:y}=o;return{path:r,type:W(e),category:p,imports:i,exports:a,tags:c,mtime:n.mtimeMs,size:n.size,...f!==void 0?{description:f}:{},...s.length>0?{callEdges:s}:{},...d!==void 0?{complexity:d}:{},...x!==void 0?{cognitiveComplexity:x}:{},...y!==void 0?{functions:y}:{}}}attachGitStats(e,r){let n=this.gitStatsMap?.get(r);n&&(e.commitCount90d=n.commitCount90d,n.lastAuthor!==void 0&&(e.lastAuthor=n.lastAuthor),n.lastCommitAt!==void 0&&(e.lastCommitAt=n.lastCommitAt))}async resolveImports(e,r){let n=[];for(let o of r){let s=this.resolver.resolveAll(e,o.rawSpecifier);if(s.length!==0)for(let i of s){let a={...o,toPath:i.isExternal?i.path:I.relative(this.rootDir,i.path),isExternal:i.isExternal};i.isWorkspace&&(a.isWorkspace=!0,a.workspacePackage=i.workspacePackage),i.isExternal?this.attachLockfileVersion(a):this.enqueue(i.path),n.push(a)}}return n}attachLockfileVersion(e){if(!this.lockFile)return;let r=e.rawSpecifier.startsWith("@")?e.rawSpecifier.split("/").slice(0,2).join("/"):e.rawSpecifier.split("/")[0],n=r?this.lockFile.dependencies[r]:void 0;n&&(e.version=n.version)}showProgress(){this.progressCallback&&this.visited.size%100===0&&this.progressCallback(this.visited.size)}}});var ii=u(()=>{"use strict";l();Ot();si();_t();zt();Yt();Je();Ke();ge();Yr();cr();Ve();mr();yr();xr()});var Xr=u(()=>{"use strict";l();ii()});function ai(t,e){return{identifier:e?.identifier??new pt,featureMap:e?.featureDetection===!1?new Map:K(t.nodes,e?.featureDetection??void 0)}}function ci(t,e,r,n,o){for(let s of e){let i=t.nodes.get(s);if(!i)continue;let a=new H(s,["*",...i.exports.map(c=>c.name)]);t.traverse(s,(c,p,f)=>{if(!f)return!0;if(!a.updateAffectedSymbols(c,f))return!1;if(p>0){let d=r.get(c.path);if(d)return n(d),!1}return o(c),!0},{direction:"incoming"})}}function qr(t,e,r){let{identifier:n,featureMap:o}=ai(t,r),s=new Set;for(let i of e){let a=o.get(i);a&&s.add(a.tag)}return ci(t,e,o,i=>s.add(i.tag),i=>{if(n.isTestNode(i))for(let a of i.tags)s.add(a.name)}),Array.from(s)}function Zr(t,e,r){let{identifier:n,featureMap:o}=ai(t,r),s=new Set;return ci(t,e,o,()=>{},i=>{n.isTestNode(i)&&s.add(i.path)}),Array.from(s)}var li=u(()=>{"use strict";l();Xr();Rr()});var pi=u(()=>{"use strict";l();Yo();Rr();li()});import Pf from"fs";import De from"path";async function L(t,e,r=null,n={}){let o=n.silent?void 0:a=>{process.stderr.write(`Processed ${a} files...\r`)},s=De.resolve(t);return await new Ie(s,r,n.pathAliases?new Z(s,{pathAliases:n.pathAliases}):void 0,o,n.gitStats??!1,n.coverageMap??new Map,n.parallelParsing??!0).build(e)}async function fi(t,e={}){let r=De.resolve(t),n=hr(r),o=e.packages?n.packages.filter(a=>e.packages?.includes(a.name)||e.packages?.includes(a.relativeRoot)):n.packages,s=new Map(n.packages.map(a=>[a.name,a.root])),i=new xe(r,n.type);for(let a of o){let c=e.silent?void 0:d=>{process.stderr.write(`[${a.name}] Processed ${d} files...\r`)},f=await new Ie(r,null,new Z(r,{workspaceMap:s,tsconfigSearchPaths:[a.root,r],pathAliases:e.pathAliases}),c,e.gitStats??!1,new Map,e.parallelParsing??!0).build(a.entryPoints);i.addPackage(a,f)}return i}function O(t,e={}){let r=[],n=new Set([...e.ignoreDirs??J,...e.additionalIgnoreDirs??[]]),o=new Set([...e.extensions??Mt,...e.additionalExtensions??[]]);function s(i){try{let a=Pf.readdirSync(i,{withFileTypes:!0});for(let c of a){let p=De.join(i,c.name);c.isDirectory()?n.has(c.name)||s(p):c.isFile()&&o.has(De.extname(c.name).toLowerCase())&&r.push(De.relative(t,p))}}catch{}}return s(t),r}var w=u(()=>{"use strict";l();Dt();Ge();In();Mn();Ot();_t();zt();Yt();Je();Ke();qt();ge();ir();cr();so();Ve();mr();yr();qe();xr();te();be();Mo();pi();Ge();Xr()});var yt,xt,en=u(()=>{"use strict";l();yt="mokosh-cache",xt="graph.json"});import Me from"path";import{parseArgs as If}from"util";function Df(t){for(let e=0;e<t.length;e++)if(t[e]==="--root"&&t[e+1])return Me.resolve(t[e+1]);return process.cwd()}function pe(t){return t?parseInt(t,10):void 0}function mi(t){return t?t.split(",").map(e=>e.trim()):void 0}function Af(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(n!==void 0)if(!n.startsWith("--"))e.push(n);else if(Mf.has(n)){let o=t[r+1];o!==void 0&&!o.startsWith("--")&&(e.push(n,o),r++)}else n.slice(2)in tn&&e.push(n)}return e}function ui(t){let e=Df(t),r=Me.join(Me.resolve(e,yt),xt),{values:n,positionals:o}=If({args:Af(t),allowPositionals:!0,options:tn}),s=n.cache,i=n.config,a=n.metric;return{rootDir:e,cachePath:s?Me.resolve(e,s):r,configPath:i?Me.resolve(e,i):void 0,query:n.query,file:n.file,typeFilter:n.type,functionName:n.function,filterPaths:mi(n.paths),featureThreshold:pe(n["feature-threshold"]),minOutDegree:pe(n["min-out-degree"]),mermaid:n.mermaid??!1,proposeTags:n["propose-tags"]??!1,plain:n.plain??!1,affectedTests:n["affected-tests"]??!1,detectFeatures:n["detect-features"]??!1,findUnused:n["find-unused"]??!1,excludeTests:n["exclude-tests"]??!1,checkCycles:n["check-cycles"]??!1,checkDocDrift:n["check-doc-drift"]??!1,findUncovered:n["find-uncovered"]??!1,listTags:n["list-tags"]??!1,callers:n.callers??!1,silent:n.silent??!1,queryHelp:n["query-help"]??!1,help:t.length===0||(n.help??!1),typeGraph:n["type-graph"]??!1,moduleResponsibility:n["module-responsibility"]??!1,featureGraph:n["feature-graph"]??!1,callGraph:n["call-graph"]??!1,findSymbol:n["find-symbol"]??!1,apiSurface:n["api-surface"]??!1,applyTags:n["apply-tags"]??!1,dryRun:n["dry-run"]??!1,initSkill:n["init-skill"]??!1,initConfig:n["init-config"]??!1,force:n.force??!1,dependencies:n.dependencies??!1,dependents:n.dependents??!1,affected:n.affected??!1,testsOnly:n["tests-only"]??!1,changedSymbols:mi(n["changed-symbols"]),cached:n.cached??!1,depth:pe(n.depth),withMeta:n["with-meta"]??!1,withEdgeDetail:n["with-edge-detail"]??!1,findComplexFunctions:n["find-complex-functions"]??!1,metric:a==="complexity"||a==="cognitiveComplexity"?a:void 0,complexityThreshold:pe(n["complexity-threshold"]),limit:pe(n.limit),findDuplicates:n["find-duplicates"]??!1,minDuplicateLines:pe(n["min-duplicate-lines"]),workspacePackages:n["workspace-packages"]??!1,workspaceAffected:n["workspace-affected"]??!1,clearCache:n["clear-cache"]??!1,slim:n.slim??!1,watch:n.watch??!1,entryPoints:o}}var tn,Mf,gi=u(()=>{"use strict";l();en();tn={root:{type:"string"},cache:{type:"string"},config:{type:"string"},query:{type:"string"},file:{type:"string"},type:{type:"string"},paths:{type:"string"},function:{type:"string"},"feature-threshold":{type:"string"},"min-out-degree":{type:"string"},mermaid:{type:"boolean"},"propose-tags":{type:"boolean"},plain:{type:"boolean"},"affected-tests":{type:"boolean"},"detect-features":{type:"boolean"},"find-unused":{type:"boolean"},"exclude-tests":{type:"boolean"},"check-cycles":{type:"boolean"},"check-doc-drift":{type:"boolean"},"find-uncovered":{type:"boolean"},"list-tags":{type:"boolean"},callers:{type:"boolean"},silent:{type:"boolean"},"query-help":{type:"boolean"},help:{type:"boolean"},"type-graph":{type:"boolean"},"module-responsibility":{type:"boolean"},"feature-graph":{type:"boolean"},"call-graph":{type:"boolean"},"find-symbol":{type:"boolean"},"api-surface":{type:"boolean"},"apply-tags":{type:"boolean"},"dry-run":{type:"boolean"},"init-skill":{type:"boolean"},"init-config":{type:"boolean"},force:{type:"boolean"},dependencies:{type:"boolean"},dependents:{type:"boolean"},affected:{type:"boolean"},"tests-only":{type:"boolean"},"changed-symbols":{type:"string"},cached:{type:"boolean"},depth:{type:"string"},"with-meta":{type:"boolean"},"with-edge-detail":{type:"boolean"},"find-complex-functions":{type:"boolean"},metric:{type:"string"},"complexity-threshold":{type:"string"},limit:{type:"string"},"find-duplicates":{type:"boolean"},"min-duplicate-lines":{type:"string"},"workspace-packages":{type:"boolean"},"workspace-affected":{type:"boolean"},"clear-cache":{type:"boolean"},slim:{type:"boolean"},watch:{type:"boolean"}},Mf=new Set(Object.entries(tn).filter(([,t])=>t.type==="string").map(([t])=>`--${t}`))});async function rn(t){let{graph:e,file:r,testsOnly:n,changedSymbols:o,cached:s,withMeta:i}=t;r||(console.error("Error: --affected requires --file <path>"),process.exit(1));let a=f=>i?f.map(d=>({path:d,...V(e,d)})):f;if(s){let f=jt(e),d=Wt(f,r),x=n?d.filter(S=>e.nodes.get(S)?.category==="test"):d,y=a(x);console.log(JSON.stringify({file:r,affected:y,count:y.length},null,2));return}let c=er(e,r,{testsOnly:n,changedSymbols:o}),p=a(c);console.log(JSON.stringify({file:r,affected:p,count:p.length},null,2))}var di=u(()=>{"use strict";l();w()});import nn from"path";function ee(t){return t.filter(e=>{let r=nn.basename(e).toLowerCase();return Rf.some(n=>r.includes(n))})}function bt(t){return new ft().getChangedFiles().map(e=>nn.relative(t,nn.resolve(t,e)))}var Rf,St=u(()=>{"use strict";l();Or();Rf=[".test.",".spec.","-test.","-spec."]});async function hi(t){let{graph:e}=t,{rootDir:r,scanOptions:n,featureThreshold:o,rawConfig:s}=t,i=bt(r);if(![...e.nodes.values()].some(p=>ee([p.path]).length>0)){let p=O(r,n);e=await L(r,ee(p),e,N(s))}let c=Zr(e,i,{...o!==void 0&&{featureDetection:{minOutDegree:o}}});console.log(c.join(`
|
|
34
|
+
`))}var yi=u(()=>{"use strict";l();w();St()});async function xi(t){let{graph:e,rootDir:r,entryPoints:n}=t,o=n.length?n:Rt(e,r);o.length===0&&(console.error("Error: No entry points found. Pass entry points as positional args or ensure package.json has a main/exports field."),process.exit(1));let s=Lt(e,o);console.log(JSON.stringify(s,null,2))}var bi=u(()=>{"use strict";l();w()});async function Si(t){let{graph:e}=t,{rootDir:r,scanOptions:n,dryRun:o,plain:s,rawConfig:i}=t;if(s||console.log(o?"Dry run: computing tag changes...":"Applying tags to test files..."),e.nodes.size===0){let c=O(r,n);e=await L(r,ee(c),e,N(i))}let a=await Ar(e,r,{dryRun:o});console.log(JSON.stringify(a,null,2))}var Ci=u(()=>{"use strict";l();w();St()});async function vi(t){let{graph:e,functionName:r}=t;r||(console.error("Error: --call-graph requires --function <name>"),process.exit(1));let n=Gt(e,r);console.log(JSON.stringify(n,null,2))}var ki=u(()=>{"use strict";l();w()});async function on(t){let{graph:e,file:r,plain:n,depth:o,withEdgeDetail:s}=t;r||(console.error("Error: --callers requires --file <path>"),process.exit(1));let i=tr(e,r,{depth:o??1,withEdgeDetail:s});console.log(n?i.map(a=>a.file).join(`
|
|
35
|
+
`):JSON.stringify({file:r,callers:i,count:i.length},null,2))}var wi=u(()=>{"use strict";l();w()});async function sn(t){let{graph:e}=t,r=e.findCycles();if(r.length>0){process.stderr.write(`Found ${r.length} cycle(s):
|
|
33
36
|
`);for(let n of r)process.stderr.write(` ${n.join(" \u2192 ")}
|
|
34
|
-
`);process.exit(1)}console.log("No cycles detected.")}var
|
|
35
|
-
`);for(let{doc:n,staleFor:
|
|
36
|
-
`);process.exit(1)}console.log("No doc drift detected.")}var
|
|
37
|
-
`):JSON.stringify({name:r,matches:
|
|
38
|
-
`):JSON.stringify({threshold:
|
|
37
|
+
`);process.exit(1)}console.log("No cycles detected.")}var Ei=u(()=>{"use strict";l()});async function an(t){let{graph:e}=t,r=[...e.nodes.values()].filter(n=>n.type==="markdown"&&n.staleFor&&n.staleFor.length>0).map(n=>({doc:n.path,staleFor:n.staleFor}));if(r.length>0){process.stderr.write(`Found ${r.length} doc(s) that may be out of date:
|
|
38
|
+
`);for(let{doc:n,staleFor:o}of r)process.stderr.write(` ${n} \u2014 references changed more recently: ${o.join(", ")}
|
|
39
|
+
`);process.exit(1)}console.log("No doc drift detected.")}var Fi=u(()=>{"use strict";l()});import Ti from"fs";function Ni(t){Ti.existsSync(t)?(Ti.unlinkSync(t),console.log(`Cache cleared: ${t}`)):console.log(`No cache file present at ${t}`)}var Pi=u(()=>{"use strict";l()});async function cn(t){let{graph:e,file:r,depth:n,withMeta:o}=t;r||(console.error("Error: --dependencies requires --file <path>"),process.exit(1));let s=Zt(e,r,n??1),i=o?s.map(a=>({...a,...V(e,a.path)})):s;console.log(JSON.stringify({file:r,dependencies:i},null,2))}var Ii=u(()=>{"use strict";l();w()});async function ln(t){let{graph:e,file:r,withMeta:n}=t;r||(console.error("Error: --dependents requires --file <path>"),process.exit(1));let o=de(e,r),s=n?o.map(i=>({...i,...V(e,i.path)})):o;console.log(JSON.stringify({file:r,dependents:s},null,2))}var Di=u(()=>{"use strict";l();w()});async function Mi(t){let{graph:e}=t,{rootDir:r,scanOptions:n,featureThreshold:o,rawConfig:s}=t;if(e.nodes.size===0){let c=O(r,n);e=await L(r,c,e,N(s))}let i=K(e.nodes,o!==void 0?{minOutDegree:o}:void 0),a=Array.from(i.values()).sort((c,p)=>p.outDegree-c.outDegree);console.log(JSON.stringify({features:a},null,2))}var Ai=u(()=>{"use strict";l();w()});async function Ri(t){let{graph:e}=t,{rootDir:r,scanOptions:n,minOutDegree:o,rawConfig:s}=t;if(e.nodes.size===0){let c=O(r,n);e=await L(r,c,e,N(s))}let i=me(e,o!==void 0?{minOutDegree:o}:void 0),a=Object.fromEntries(i.features);console.log(JSON.stringify({features:a,unassigned:i.unassigned},null,2))}var Li=u(()=>{"use strict";l();w()});async function pn(t){let{graph:e,metric:r,complexityThreshold:n,limit:o}=t,s=n??10,i=rr(e,{metric:r,threshold:s,limit:o});console.log(JSON.stringify({metric:r??"cognitiveComplexity",threshold:s,functions:i,count:i.length},null,2))}var Oi=u(()=>{"use strict";l();w()});async function fn(t){let{graph:e,rootDir:r,scanOptions:n,minDuplicateLines:o,limit:s}=t,i=o??6,a=[...n.ignoreDirs??J,...n.additionalIgnoreDirs??[]],c=await Qt(e,r,{minLines:i,limit:s,ignoreDirs:a});console.log(JSON.stringify({minLines:i,groups:c,count:c.length},null,2))}var Gi=u(()=>{"use strict";l();w()});async function _i(t){let{graph:e,functionName:r,plain:n}=t;r||(console.error("Error: --find-symbol requires --function <name>"),process.exit(1));let o=lr(e,r);console.log(n?o.map(s=>s.path).join(`
|
|
40
|
+
`):JSON.stringify({name:r,matches:o,count:o.length},null,2))}var ji=u(()=>{"use strict";l();w()});async function mn(t){let{graph:e,featureThreshold:r,rawConfig:n,plain:o}=t,s=r??n.coverageThreshold??80;if(!sr(e)){console.log(JSON.stringify({error:"No coverage data available. Set coverageReportPath in mokosh.config and rebuild the graph."},null,2));return}let i=[...e.nodes.values()].filter(a=>a.category!=="test"&&a.category!=="config").filter(a=>a.coveragePct!==void 0&&a.coveragePct<s).map(a=>({file:a.path,coveragePct:a.coveragePct}));console.log(o?i.map(a=>a.file).join(`
|
|
41
|
+
`):JSON.stringify({threshold:s,uncovered:i,count:i.length},null,2))}var Wi=u(()=>{"use strict";l();w()});import Lf from"path";function Gf(t){let e=Lf.basename(t).toLowerCase();return Of.some(r=>e.includes(r))}async function zi(t){let{graph:e,rootDir:r,scanOptions:n,excludeTests:o}=t,s=O(r,n),i=e.findUnusedFiles(s);o&&(i=i.filter(a=>!Gf(a))),console.log(JSON.stringify({unusedFiles:i},null,2))}var Of,$i=u(()=>{"use strict";l();w();Of=[".test.",".spec.","-test.","-spec.",".stories."]});async function un(t){let{graph:e,queryStr:r,mermaidOutput:n,slim:o}=t,s=e.serialize();if(r){let c=et(r);s=Ze(s,c)}if(n){let c=D.deserialize(s);console.log(_e.serialize(c));return}let i=e.findCycles();i.length>0&&(s.cycles=i);let a=Xt(e);console.log(JSON.stringify(o?{...nr(s),languageCoverage:a}:{...s,languageCoverage:a},null,2))}var Bi=u(()=>{"use strict";l();w()});import _f from"fs";import gn from"path";function Ct(t,e,r){let n=t;for(let o=0;o<6;o++){let s=gn.join(n,"templates",...e);if(_f.existsSync(gn.join(s,r)))return s;let i=gn.dirname(n);if(i===n)break;n=i}throw new Error(`Could not locate mokosh templates/${e.join("/")}`)}var dn=u(()=>{"use strict";l()});import Ui from"fs";import Ji from"path";function Ki(t,e=process.cwd()){let r=Ct(m,["config"],"mokosh.config.js"),n=Ji.join(r,"mokosh.config.js"),o=Ji.join(e,"mokosh.config.js");if(Ui.existsSync(o)&&!t){console.log("skipped mokosh.config.js (already exists, use --force to overwrite)");return}Ui.copyFileSync(n,o),console.log("wrote mokosh.config.js")}var Hi=u(()=>{"use strict";l();dn()});import hn from"fs";import vt from"path";function Vi(t,e=process.cwd()){let r=Ct(m,["skill"],"SKILL.md");for(let n of jf){let o=vt.join(r,n.templateFile),s=vt.join(e,...n.destPath),i=vt.join(...n.destPath);if(hn.existsSync(s)&&!t){console.log(`skipped ${i} (already exists, use --force to overwrite)`);continue}hn.mkdirSync(vt.dirname(s),{recursive:!0}),hn.copyFileSync(o,s),console.log(`wrote ${i}`)}}var jf,Qi=u(()=>{"use strict";l();dn();jf=[{templateFile:"SKILL.md",destPath:[".claude","skills","mokosh","SKILL.md"]},{templateFile:"mokosh.md",destPath:[".claude","commands","mokosh.md"]}]});async function yn(t){let{graph:e,plain:r}=t,n=new Map;for(let s of e.nodes.values())for(let i of s.tags)n.set(i.name,(n.get(i.name)??0)+1);let o=[...n.entries()].map(([s,i])=>({name:s,count:i})).sort((s,i)=>i.count-s.count);console.log(r?o.map(s=>s.name).join(`
|
|
42
|
+
`):JSON.stringify({tags:o,count:o.length},null,2))}var Yi=u(()=>{"use strict";l()});async function Xi(t){let{graph:e,filterPaths:r,minOutDegree:n}=t,o=ar(e,n!==void 0?{minOutDegree:n}:void 0);if(r?.length){let s=r.map(i=>o.get(i)).filter(Boolean);console.log(JSON.stringify({count:s.length,modules:s},null,2))}else{let s=Array.from(o.values());console.log(JSON.stringify({count:s.length,modules:s},null,2))}}var qi=u(()=>{"use strict";l();w()});async function Zi(t){let{graph:e}=t,{rootDir:r,scanOptions:n,featureThreshold:o,plain:s,rawConfig:i}=t;s||console.log("Proposing test tags based on git diff...");let a=bt(r);if(e.nodes.size===0){let p=O(r,n);e=await L(r,ee(p),e,N(i))}let c=qr(e,a,{...o!==void 0&&{featureDetection:{minOutDegree:o}}});console.log(s?c.join(" "):JSON.stringify({proposedTags:c},null,2))}var ea=u(()=>{"use strict";l();w();St()});async function ta(t){let{graph:e,typeFilter:r}=t,n=pr(e);if(r){let o=fr(n,r);console.log(JSON.stringify(o,null,2))}else{let o=Array.from(n.types.values());console.log(JSON.stringify({count:o.length,types:o},null,2))}}var ra=u(()=>{"use strict";l();w()});function na(t,e){let r=t.getAffectedAcrossPackages(e);console.log(JSON.stringify({file:e,affected:r,count:r.length},null,2))}var oa=u(()=>{"use strict";l()});function sa(t){console.log(JSON.stringify(or(t),null,2))}var ia=u(()=>{"use strict";l();w()});import xn from"path";function Wf(t,e,r,n){return t!==e?t:r?xn.resolve(n,r):e}function aa(t){let{rootDir:e,entryPoints:r,cachePath:n,configPath:o}=t,s=o?re(o,{isExplicitPath:!0}):re(e),i=xn.join(xn.resolve(e,yt),xt),a=r.length>0?r:s.entryPoints??[],c=Wf(n,i,s.cachePath,e),p={...s.ignoreDirs!==void 0&&{additionalIgnoreDirs:s.ignoreDirs},...s.extensions!==void 0&&{additionalExtensions:s.extensions}};return{rootDir:e,resolvedEntryPoints:a,resolvedCachePath:c,scanOptions:p,rawConfig:s}}var ca=u(()=>{"use strict";l();w();en()});import Ae from"fs";import zf from"path";function la(t){if(!Ae.existsSync(t))return null;let e=Ae.readFileSync(t,"utf-8");return D.deserialize(JSON.parse(e))}function bn(t,e){let r=zf.dirname(e);Ae.existsSync(r)||Ae.mkdirSync(r,{recursive:!0}),Ae.writeFileSync(e,JSON.stringify(t.serialize(),null,2))}async function Sn(t,e,r,n={silent:!1,...N(void 0)}){return L(t,e,r,n)}var pa=u(()=>{"use strict";l();w()});var fa,ma,ua=u(()=>{"use strict";l();fa=`
|
|
39
43
|
Usage: mokosh [options] <entry-point1> <entry-point2> ...
|
|
40
44
|
|
|
41
45
|
Options:
|
|
@@ -52,6 +56,8 @@ Options:
|
|
|
52
56
|
--find-unused Find files that are not reachable from entry points
|
|
53
57
|
--exclude-tests Exclude test files from --find-unused output
|
|
54
58
|
--find-uncovered List non-test files whose coverage is below the threshold (requires coverageReportPath in config)
|
|
59
|
+
--list-tags List every distinct tag in the graph with its per-node count, sorted
|
|
60
|
+
by count descending (use with --plain for a bare name list)
|
|
55
61
|
--callers List files whose exported functions call into --file
|
|
56
62
|
--file <path> Target file for --callers/--dependencies/--dependents/--affected/--workspace-affected
|
|
57
63
|
--check-cycles Check for circular dependencies; exits non-zero if found (CI gate)
|
|
@@ -93,7 +99,13 @@ MCP parity (mirrors the MCP server's tools for use when MCP is unavailable):
|
|
|
93
99
|
--find-complex-functions List functions/methods at or above a complexity threshold, worst-first
|
|
94
100
|
--metric <name> cognitiveComplexity (default) | complexity \u2014 used by --find-complex-functions
|
|
95
101
|
--complexity-threshold <N> Minimum score to include (default: 10, use with --find-complex-functions)
|
|
96
|
-
--limit <N> Max results for --find-complex-functions
|
|
102
|
+
--limit <N> Max results for --find-complex-functions/--find-duplicates
|
|
103
|
+
--find-duplicates Find duplicated code blocks (token-based, works for every parsed
|
|
104
|
+
language), largest-first. Lock files and files under an ignored
|
|
105
|
+
directory (--config's ignoreDirs, merged with the defaults) are
|
|
106
|
+
always excluded
|
|
107
|
+
--min-duplicate-lines <N> Minimum duplicated block size in lines to report (default: 6,
|
|
108
|
+
use with --find-duplicates)
|
|
97
109
|
--workspace-packages List monorepo packages and their cross-package dependencies
|
|
98
110
|
--workspace-affected Cross-package blast-radius for --file in a monorepo
|
|
99
111
|
--find-symbol Find every file that exports --function <name> by exact name, with
|
|
@@ -101,7 +113,9 @@ MCP parity (mirrors the MCP server's tools for use when MCP is unavailable):
|
|
|
101
113
|
precision for TS/JS, named-import for Python, file-level otherwise)
|
|
102
114
|
--watch Re-run on file changes. Supported with the default output, --query,
|
|
103
115
|
--callers, --dependencies, --dependents, --affected, --find-uncovered,
|
|
104
|
-
--find-complex-functions, --
|
|
116
|
+
--find-complex-functions, --find-duplicates, --check-cycles,
|
|
117
|
+
--check-doc-drift, and
|
|
118
|
+
--list-tags only.
|
|
105
119
|
|
|
106
120
|
Notes:
|
|
107
121
|
Add mokosh-cache/ to your .gitignore to avoid committing the cache directory.
|
|
@@ -112,7 +126,7 @@ Notes:
|
|
|
112
126
|
server only loads JSON config (allowJs: false) for security. This is intentional.
|
|
113
127
|
--workspace-packages/--workspace-affected require explicit opt-in (unlike MCP's analyze tool,
|
|
114
128
|
which auto-detects a monorepo when entryPoints is empty); other commands remain single-package.
|
|
115
|
-
|
|
129
|
+
`,ma=`
|
|
116
130
|
Query filter reference (--query "key:value,key:value,...")
|
|
117
131
|
All keys are case-insensitive. Multiple keys are AND'd together.
|
|
118
132
|
|
|
@@ -235,5 +249,5 @@ COMMON PATTERNS
|
|
|
235
249
|
|
|
236
250
|
Large TypeScript logic files:
|
|
237
251
|
--query "type:typescript,category:logic,sort:size,limit:5"
|
|
238
|
-
`});var
|
|
252
|
+
`});var ga,da=u(()=>{"use strict";l();ga=/(?:^|[/\\])(?:node_modules|\.git|dist|build|coverage)(?:[/\\]|$)/});import $f from"fs";function ha(t,e,r){let n=null,o=!1,s=!1,i=async()=>{if(o){s=!0;return}o=!0;try{await r()}finally{o=!1,s&&(s=!1,i())}};i();let a=null;try{a=$f.watch(t,{recursive:!0},(c,p)=>{!p||ga.test(p)||(n&&clearTimeout(n),n=setTimeout(()=>{i()},e))})}catch(c){console.error(`Warning: unable to watch ${t}: ${c.message}`)}process.on("SIGINT",()=>{n&&clearTimeout(n),a?.close(),process.exit(0)})}var ya=u(()=>{"use strict";l();da()});function Uf(t){t.help&&(console.log(fa),process.exit(0)),t.queryHelp&&(console.log(ma),process.exit(0)),t.initSkill&&(Vi(t.force),process.exit(0)),t.initConfig&&(Ki(t.force),process.exit(0)),t.clearCache&&(Ni(t.cachePath),process.exit(0))}async function Jf(t,e,r){if(!t.workspacePackages&&!t.workspaceAffected)return!1;t.watch&&(console.error("Error: --watch is not supported with --workspace-packages/--workspace-affected"),process.exit(1));let n=await fi(r,N(e.rawConfig));return t.workspacePackages?sa(n):(t.file||(console.error("Error: --workspace-affected requires --file <path>"),process.exit(1)),na(n,t.file)),!0}function Kf(t){return t.proposeTags||t.affectedTests||t.applyTags||t.callers||t.dependencies||t.dependents||t.affected||t.findUncovered||t.listTags||t.findComplexFunctions||t.findDuplicates||t.typeGraph||t.moduleResponsibility||t.callGraph||t.findSymbol||t.apiSurface}function Hf(t){let r=[{name:"--propose-tags",flag:t.proposeTags,handler:Zi},{name:"--apply-tags",flag:t.applyTags,handler:Si},{name:"--affected-tests",flag:t.affectedTests,handler:hi},{name:"--detect-features",flag:t.detectFeatures,handler:Mi},{name:"--find-unused",flag:t.findUnused,handler:zi},{name:"--check-cycles",flag:t.checkCycles,handler:sn},{name:"--check-doc-drift",flag:t.checkDocDrift,handler:an},{name:"--find-uncovered",flag:t.findUncovered,handler:mn},{name:"--list-tags",flag:t.listTags,handler:yn},{name:"--callers",flag:t.callers,handler:on},{name:"--dependencies",flag:t.dependencies,handler:cn},{name:"--dependents",flag:t.dependents,handler:ln},{name:"--affected",flag:t.affected,handler:rn},{name:"--find-complex-functions",flag:t.findComplexFunctions,handler:pn},{name:"--find-duplicates",flag:t.findDuplicates,handler:fn},{name:"--type-graph",flag:t.typeGraph,handler:ta},{name:"--module-responsibility",flag:t.moduleResponsibility,handler:Xi},{name:"--feature-graph",flag:t.featureGraph,handler:Ri},{name:"--call-graph",flag:t.callGraph,handler:vi},{name:"--find-symbol",flag:t.findSymbol,handler:_i},{name:"--api-surface",flag:t.apiSurface,handler:xi}].filter(n=>n.flag);return r.length>1&&(console.error(`Error: conflicting flags: ${r.map(n=>n.name).join(", ")} (pass only one command flag)`),process.exit(1)),r[0]?.handler??un}async function Vf(t,e,r,n,o,s,i){Bf.has(t)||(console.error("Error: --watch is only supported with the default output, --query, --callers, --dependencies, --dependents, --affected, --find-uncovered, --find-complex-functions, --find-duplicates, --check-cycles, --check-doc-drift, and --list-tags"),process.exit(1)),ha(r,300,async()=>{let a=await Sn(r,n,e.graph,{silent:s,...N(i)});bn(a,o),console.log(`--- rebuilt at ${new Date().toISOString()} ---`),await t({...e,graph:a})})}async function xa(){let t=process.argv.slice(2),e=ui(t);Uf(e);let r=aa(e);It(r.rawConfig);let{rootDir:n,resolvedEntryPoints:o,resolvedCachePath:s,scanOptions:i}=r;if(await Jf(e,r,n))return;let a=Kf(e),c=la(s)??new D(new Map);(o.length>0||!a)&&(o.length===0&&!a&&!e.findUnused&&!e.detectFeatures&&!e.checkCycles&&!e.checkDocDrift&&(console.error("Error: No entry points provided"),process.exit(1)),c=await Sn(n,o,c,{silent:e.silent,...N(r.rawConfig)}),bn(c,s));let p={graph:c,rootDir:n,entryPoints:o.map(d=>d.replace(`${n}/`,"")),scanOptions:i,rawConfig:r.rawConfig,featureThreshold:e.featureThreshold,queryStr:e.query,mermaidOutput:e.mermaid,plain:e.plain,excludeTests:e.excludeTests,file:e.file,typeFilter:e.typeFilter,filterPaths:e.filterPaths,minOutDegree:e.minOutDegree,functionName:e.functionName,dryRun:e.dryRun,depth:e.depth,cached:e.cached,changedSymbols:e.changedSymbols,withMeta:e.withMeta,withEdgeDetail:e.withEdgeDetail,metric:e.metric,complexityThreshold:e.complexityThreshold,limit:e.limit,slim:e.slim,testsOnly:e.testsOnly,minDuplicateLines:e.minDuplicateLines},f=Hf(e);if(e.watch){await Vf(f,p,n,o,s,e.silent,r.rawConfig);return}await f(p)}var Bf,ba=u(()=>{"use strict";l();w();gi();di();yi();bi();Ci();ki();wi();Ei();Fi();Pi();Ii();Di();Ai();Li();Oi();Gi();ji();Wi();$i();Bi();Hi();Qi();Yi();qi();ea();ra();oa();ia();ca();pa();ua();ya();Bf=new Set([un,on,cn,ln,rn,mn,pn,fn,sn,an,yn])});var Qf=va(()=>{l();ba();xa().catch(t=>{console.error(t),process.exit(1)})});export default Qf();
|
|
239
253
|
//# sourceMappingURL=cli.mjs.map
|