@omfalos/mokosh 0.2.0 → 0.3.1

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.mjs CHANGED
@@ -1,40 +1,45 @@
1
1
  #!/usr/bin/env node
2
- var pt=(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 m=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ri=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);import Oi from"path";import{fileURLToPath as Li}from"url";var Gi,ji,f,c=m(()=>{"use strict";Gi=()=>Li(import.meta.url),ji=()=>Oi.dirname(Gi()),f=ji()});function Pe(t){$r.push(t)}function Ur(t){return[..._i,...$r].some(e=>typeof e=="string"?t.includes(e):e instanceof RegExp?e.test(t):e(t))}function Te(t){Br.push(t)}function se(){return[...Wi,...Br]}function Ne(t){Jr.push(t)}function ft(){return[...zi,...Jr]}function mt(t){Kr=t}function ut(){return Kr}var _i,$r,Wi,Br,zi,Jr,Kr,J=m(()=>{"use strict";c();_i=[".config.","biome.json","tsconfig.json","package.json",".prettierrc",".eslintrc"],$r=[];Wi=[".test.",".spec.","-test.","-spec."],Br=[];zi=["jest","vitest","playwright","cypress","@testing-library/"],Jr=[];Kr=.8});import gt from"fs";import Hr from"path";function K(t,{allowJs:e=!0,isExplicitPath:r=!1}={}){if(r){let n=Hr.resolve(t);return gt.existsSync(n)?n.endsWith(".json")?Vr(n):e?Qr(n):{}:{}}for(let n of $i){let s=Hr.resolve(t,n);if(gt.existsSync(s)){if(n.endsWith(".json"))return Vr(s);if(e)return Qr(s)}}return{}}function Vr(t){return JSON.parse(gt.readFileSync(t,"utf-8"))}function Qr(t){let e=pt(t);return e&&typeof e=="object"&&"default"in e&&(e=e.default),typeof e=="function"?e({}):e}function dt(t){for(let e of t.configMatchers??[])Pe(e);for(let e of t.testPatterns??[])Te(e);for(let e of t.testLibraries??[])Ne(e);t.barrelThreshold!==void 0&&mt(t.barrelThreshold)}function k(t){return{gitStats:t?.gitStats??!1,parallelParsing:t?.parallelParsing,pathAliases:t?.pathAliases}}var $i,ht=m(()=>{"use strict";c();J();$i=["mokosh.config.js","mokosh.config.cjs","mokosh.config.json"]});var yt,xt,bt=m(()=>{"use strict";c();yt=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"],xt=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".go",".feature",".md",".mdx"]});import Zp from"fs";import tf from"path";var Xr=m(()=>{"use strict";c()});var Ie,Yr=m(()=>{"use strict";c();Ie={serialize(t){let e=["graph TD"],r=new Set;for(let n of t.nodes.values()){let s=`"${n.path}"`;for(let o of n.imports){if(!o.toPath)continue;let i=`"${o.toPath}"`,a=`${n.path} -> ${o.toPath}`;if(!r.has(a)){let l=o.isStyle?"-- styles -->":"-->";e.push(` ${s} ${l} ${i}`),r.add(a)}}}return e.join(`
3
- `)}}});var qr=m(()=>{"use strict";c();Yr()});import Zr from"fs";import Bi from"path";function St(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 en(t,e){if(typeof t=="string")return St(t,e);if(t&&typeof t=="object"){let r=t;for(let n of["import","require","default"]){let s=en(r[n],e);if(s)return s}}return null}function Ji(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 Ki(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 h of p.exports)r.add(h.name);s.push(a.toPath)}else for(let p of a.symbols)r.add(p)}}}return r}function Ct(t,e){let r=[],n=Bi.join(e,"package.json");if(Zr.existsSync(n))try{let s=JSON.parse(Zr.readFileSync(n,"utf8"));if(s.exports&&typeof s.exports=="object"&&!Array.isArray(s.exports))for(let o of Object.values(s.exports)){let i=en(o,t);i&&!r.includes(i)&&r.push(i)}else if(typeof s.exports=="string"){let o=St(s.exports,t);o&&r.push(o)}if(r.length===0)for(let o of[s.main,s.module].filter(Boolean)){let i=St(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 Hi(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 Vi(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 l=n.get(a.name),p=!!(a.signature||a.doc);(!l||p&&!i)&&n.set(a.name,{file:s,symbol:a})}}return n}function Qi(t,e,r,n){let s=[];for(let o of t){let i=e.get(o),a=n.flatMap(d=>r.nodes.get(d)?.exports??[]).find(d=>d.name===o),l=i?.symbol??a,p=i?.file??n.find(d=>r.nodes.get(d)?.exports.some(b=>b.name===o))??n[0],h={name:o,definedIn:p,kind:Ji(l?.signature)};l?.doc&&(h.doc=l.doc),l?.signature&&(h.signature=l.signature),s.push(h)}return s.sort((o,i)=>o.name.localeCompare(i.name)),s}function Xi(t,e,r){let n=l=>t.nodes.get(l)?.category==="test",s=[...e].filter(l=>!r.includes(l)&&!n(l)),o=[...t.nodes.keys()].filter(l=>!e.has(l)),i=o.filter(l=>!n(l)),a=o.filter(l=>n(l));return{internalFiles:s,unreachableFromEntry:i,testFiles:a}}function vt(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=Hi(t,e),n=Vi(t,r,e),s=Ki(t,e),o=Qi(s,n,t,e),{internalFiles:i,unreachableFromEntry:a,testFiles:l}=Xi(t,r,e);return{entryPoints:e,publicExports:o,internalFiles:i,unreachableFromEntry:a,testFiles:l}}var kt=m(()=>{"use strict";c()});function Et(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 wt=m(()=>{"use strict";c()});import yf from"fs";import bf from"path";function tn(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 Ft(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:tn(t)}}function Pt(t,e){return t.impact.get(e)??[]}var Tt=m(()=>{"use strict";c()});import Me from"path";function Yi(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 qi(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=Me.extname(s),l=Me.basename(s,a),p=l==="index"?Me.basename(Me.dirname(s)):l;n.set(s,{path:s,outDegree:o,tag:`feature:${p}`})}return n}function _(t,e){let r=e?.minOutDegree??5;return qi(t,Yi(t),r)}var Ae=m(()=>{"use strict";c()});function ea(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 ta(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 ra(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 na(t,e,r){let n=[];for(let s of t.keys())!e.has(s)&&!r.has(s)&&n.push(s);return n}function oe(t,e){let r=e?.detectFn??_,n=e?.hubComparator??Zi,s=r(t.nodes,e),o=ea(t,s),i=ta(t.nodes,s,o,n);return{features:ra(s,i),unassigned:na(t.nodes,s,i)}}var Zi,De=m(()=>{"use strict";c();Ae();Zi=(t,e)=>t.outDegree-e.outDegree});function Nt(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:rn.has(r),importSymbolsTracked:Re.has(r),callEdgesTracked:Oe.has(r)})).sort((r,n)=>n.fileCount-r.fileCount)}var rn,Re,Oe,It=m(()=>{"use strict";c();rn=new Set(["typescript","javascript","python","go","scss","less","lua","coffeescript"]),Re=new Set(["typescript","javascript","python"]),Oe=new Set(["typescript","javascript"])});var ie,nn=m(()=>{"use strict";c();ie=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 l of a.imports)if(!(!l.toPath||l.isExternal))if(n.has(l.toPath)){let p=s.indexOf(l.toPath);e.push([...s.slice(p),l.toPath])}else r.has(l.toPath)||o(l.toPath)}n.delete(i),s.pop()};for(let i of this.nodes.keys())r.has(i)||o(i);return e}}});var P,ae=m(()=>{"use strict";c();nn();P=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=(l,p,h)=>{if(p>i||o.has(l))return;let d=this.nodes.get(l);if(d&&(o.add(l),r(d,p,h)!==!1))for(let b of s(l))a(b,p+1,l)};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 ie(this.nodes).findUnusedFiles(e)}findCycles(){return new ie(this.nodes).findCycles()}}});var W,Le=m(()=>{"use strict";c();W=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(l=>l.toPath===r);if(!s)return!1;let o=s.symbols||["*"],i=new Set;for(let l of o)(l==="*"||n.has("*")||n.has(l))&&i.add("*");if(i.size===0)return!1;let a=this.affectedSymbols.get(e.path)||new Set;for(let l of i)a.add(l);return this.affectedSymbols.set(e.path,a),!0}}});function z(t,e){let r=t.nodes.get(e);if(r)return{category:r.category,exports:r.exports.map(n=>n.name)}}function Mt(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(l=>l.toPath===s.path):void 0;return n.push({path:s.path,...a?.symbols?{symbols:a.symbols}:{}}),!0},{direction:"outgoing",maxDepth:r}),n}function ce(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 At(t,e,r={}){let{testsOnly:n=!1,changedSymbols:s}=r,o=s?new W(e,s):null,i=[];return t.traverse(e,(a,l,p)=>{if(a.path===e)return!0;if(o&&p&&!o.updateAffectedSymbols(a,p))return!1;let h=a.category==="test"||a.tags.some(d=>d.name==="test");return(!n||h)&&i.push(a.path),!0},{direction:"incoming"}),i}function Dt(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(l=>l.toFile===e).map(l=>({from:l.from,to:l.to}))),o.push(a),!0},{direction:"incoming",maxDepth:n}),o}function Rt(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 Ot(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 Lt(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 Gt(t){return[...t.nodes.values()].some(e=>e.coveragePct!==void 0)}var jt=m(()=>{"use strict";c();Le()});function sn(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 x(e,"component")||x(e,"components")?"component":x(e,"controller")||x(e,"controllers")?"controller":x(e,"middleware")?"middleware":x(e,"router")||x(e,"routes")||x(e,"route")?"router":x(e,"store")||x(e,"stores")?"store":x(e,"service")||x(e,"services")?"service":x(e,"handler")||x(e,"handlers")?"handler":x(e,"adapter")||x(e,"adapters")?"adapter":x(e,"plugin")||x(e,"plugins")?"plugin":x(e,"api")?"api":x(e,"cli")||x(e,"commands")||le(e)==="cli"?"cli":x(e,"util")||x(e,"utils")||x(e,"helper")||x(e,"helpers")?"util":x(e,"model")||x(e,"models")||le(e)==="model"?"model":x(e,"parser")||x(e,"parsers")||le(e)==="parser"?"parser":le(e)==="builder"?"builder":le(e)==="resolver"?"resolver":"other"}function x(t,e){return t.includes(`/${e}/`)||t.includes(`/${e}.`)}function le(t){let e=t.slice(t.lastIndexOf("/")+1);return e.slice(0,e.lastIndexOf("."))||e}var on=m(()=>{"use strict";c()});function _t(t,e){let r=oe(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:sn(o),...o.description?{description:o.description}:{},exports:o.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return s}var Wt=m(()=>{"use strict";c();De();on()});function zt(t,e){let r=[];for(let n of t.nodes.values())if(n.exports.some(s=>s.name===e))if(Oe.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 if(Re.has(n.type)){let s=[];for(let o of t.nodes.values())for(let i of o.imports)i.toPath===n.path&&i.symbols?.includes(e)&&s.push({file:o.path,symbols:i.symbols});r.push({path:n.path,category:n.category,precision:"import-symbol",importers:s})}else{let s=ce(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 an=m(()=>{"use strict";c();It();jt()});function sa(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function oa(t,e){if(e==="type-only")return!0;let r=t.signature??"";return r.startsWith("interface ")||r.startsWith("class ")||r.startsWith("enum ")}function $t(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(!oa(s,n.category))continue;let o=`${n.path}::${s.name}`;e.set(o,{name:s.name,file:n.path,kind:sa(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 Ut(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 Bt=m(()=>{"use strict";c()});import cn from"fs";import em from"path";function ln(t){try{return cn.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function Ge(t){try{return cn.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var je=m(()=>{"use strict";c()});import pe from"fs";import T from"path";function Jt(t,e){let r=T.join(e,"package.json");if(!pe.existsSync(r))return null;let n={};try{n=JSON.parse(pe.readFileSync(r,"utf-8"))}catch{return null}let s=n.name;return s?{name:s,root:e,relativeRoot:T.relative(t,e),entryPoints:ia(e,n)}:null}function ia(t,e){let r=[];if(e.exports){let s=e.exports;if(typeof s=="string")r.push(T.join(t,s));else if(typeof s=="object"&&s!==null){let o=s["."];if(typeof o=="string")r.push(T.join(t,o));else if(typeof o=="object"&&o!==null){let i=o.import??o.require??o.default;typeof i=="string"&&r.push(T.join(t,i))}}}e.main&&r.push(T.join(t,e.main));for(let s of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])r.push(T.join(t,s));let n=r.filter(Ge);return n.length>0?n.slice(0,1):r.slice(0,1)}function H(t,e){let r=[],n=new Set;for(let s of e){let o=s.replace(/\/$/,"").replace(/^\.\//,"");aa(t,o,n,r)}return r}function aa(t,e,r,n){if(!e.includes("*")){ca(t,e,r,n);return}let s=e.split("/");s.includes("**")?la(t,s,r,n):pa(t,s,r,n)}function ca(t,e,r,n){let s=T.join(t,e);if(r.has(s)||!ln(s))return;r.add(s);let o=Jt(t,s);o&&n.push(o)}function la(t,e,r,n){let s=T.join(t,e[0]==="**"?"":e[0]??"");pn(t,s,r,n)}function pa(t,e,r,n){let s=e.findIndex(a=>a.includes("*")),o=T.join(t,...e.slice(0,s)),i;try{i=pe.readdirSync(o,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let l=T.join(o,a.name);if(r.has(l))continue;r.add(l);let p=Jt(t,l);p&&n.push(p)}}function pn(t,e,r,n){let s;try{s=pe.readdirSync(e,{withFileTypes:!0})}catch{return}for(let o of s){if(!o.isDirectory()||o.name==="node_modules"||o.name.startsWith("."))continue;let i=T.join(e,o.name);if(pe.existsSync(T.join(i,"package.json"))&&!r.has(i)){r.add(i);let a=Jt(t,i);a&&n.push(a)}else pn(t,i,r,n)}}var _e=m(()=>{"use strict";c();je();je()});import Kt from"fs";import fn from"path";var mn,un=m(()=>{"use strict";c();_e();mn={type:"npm",detect(t){let e=fn.join(t,"package.json");if(!Kt.existsSync(e))return null;let r;try{r=JSON.parse(Kt.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r||Kt.existsSync(fn.join(t,"yarn.lock")))return null;let n=Array.isArray(r)?r:r.packages??[];return n.length===0?null:H(t,n)}}});import V from"fs";import E from"path";function dn(t,e,r,n){if(n>4)return[];let s;try{s=V.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 l=E.join(e,a);V.existsSync(E.join(l,"project.json"))&&!r.has(l)?(r.add(l),o.push(l)):o.push(...dn(t,l,r,n+1))}return o}function fa(t,e,r){let n={};try{n=JSON.parse(V.readFileSync(r,"utf-8"))}catch{return null}let s=n.name,o,i,a=E.join(e,"package.json");if(V.existsSync(a))try{let l=JSON.parse(V.readFileSync(a,"utf-8"));s=l.name??s,o=l.main,i=l.exports}catch{}return s?{name:s,root:e,relativeRoot:E.relative(t,e),entryPoints:ma(e,n,o,i)}:null}function ma(t,e,r,n){let s=[],o=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(o){let a=E.resolve(t,"../..");s.push(E.resolve(a,o)),s.push(E.resolve(t,o))}if(n){let a=n;if(typeof a=="string")s.push(E.join(t,a));else if(typeof a=="object"&&a!==null){let l=a["."];typeof l=="string"&&s.push(E.join(t,l))}}if(r&&s.push(E.join(t,r)),e.sourceRoot){let a=E.resolve(t,"../.."),l=E.resolve(a,e.sourceRoot);s.push(E.join(l,"index.ts"),E.join(l,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])s.push(E.join(t,a));let i=s.filter(Ge);return i.length>0?i.slice(0,1):s.slice(0,1)}var gn,hn=m(()=>{"use strict";c();je();gn={type:"nx",detect(t){return V.existsSync(E.join(t,"nx.json"))?dn(t,t,new Set,0).map(r=>fa(t,r,E.join(r,"project.json"))).filter(r=>r!==null):null}}});import yn from"fs";import ua from"path";import{load as ga}from"js-yaml";var xn,bn=m(()=>{"use strict";c();_e();xn={type:"pnpm",detect(t){let e=ua.join(t,"pnpm-workspace.yaml");if(!yn.existsSync(e))return null;let r=[];try{r=ga(yn.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return H(t,r)}}});import da from"fs";import ha from"path";var Sn,Cn=m(()=>{"use strict";c();Sn={type:"turborepo",detect(t){return da.existsSync(ha.join(t,"turbo.json"))?[]:null}}});import Ht from"fs";import vn from"path";var kn,En=m(()=>{"use strict";c();_e();kn={type:"yarn",detect(t){if(!Ht.existsSync(vn.join(t,"yarn.lock")))return null;let e=vn.join(t,"package.json");if(!Ht.existsSync(e))return null;let r;try{r=JSON.parse(Ht.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:H(t,n)}}});function D(t){wn.push(t)}function Fn(){return wn}var wn,We=m(()=>{"use strict";c();wn=[]});import ya from"path";function Vt(t,e=Fn()){let r=ya.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 l of a)n.has(l.name)||n.set(l.name,l)}}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 Qt=m(()=>{"use strict";c();un();hn();bn();Cn();En();We();We();D(Sn);D(gn);D(xn);D(kn);D(mn)});var fe,Xt=m(()=>{"use strict";c();ae();fe=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 P(o);r.packages.set(n.name,{graph:i,pkg:{...n,root:""}})}return r}}});function Q(t,e){Pn.set(t,e)}function Tn(t){return Pn.get(t)}var Pn,me=m(()=>{"use strict";c();Pn=new Map});function Nn(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function xa(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}function ue(t,e,r){return Ka.every(n=>n(t,e,r))}var ba,Sa,Ca,va,ka,Ea,wa,Fa,Pa,Ta,Na,Ia,Ma,Aa,Da,Ra,Oa,La,Ga,ja,_a,Wa,za,$a,Ua,Ba,Ja,Ka,Yt=m(()=>{"use strict";c();ba=(t,e)=>!e.category||Nn(t.category,e.category),Sa=(t,e)=>!e.type||Nn(t.type,e.type),Ca=(t,e)=>e.lastAuthor?e.lastAuthor.startsWith("!")?t.lastAuthor!==e.lastAuthor.slice(1):t.lastAuthor!==void 0&&t.lastAuthor===e.lastAuthor:!0,va=(t,e)=>!e.path||xa(t.path,e.path),ka=(t,e)=>e.isExternal===void 0?!0:t.imports.some(n=>n.isExternal)===e.isExternal,Ea=(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)))},wa=(t,e)=>!e.allTags?.length||e.allTags.every(r=>t.tags.some(n=>n.name===r)),Fa=(t,e)=>!e.importsFile||t.imports.some(r=>r.toPath?.includes(e.importsFile)),Pa=(t,e,r)=>e.importedBy===void 0?!0:(r?.get(t.path)??[]).some(s=>s.includes(e.importedBy)),Ta=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,Na=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,Ia=(t,e)=>e.minSize===void 0||t.size>=e.minSize,Ma=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,Aa=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,Da=(t,e)=>e.isDocumented===void 0||!!t.documentedBy?.length===e.isDocumented,Ra=(t,e)=>e.isStale===void 0||!!t.staleFor?.length===e.isStale,Oa=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,La=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,Ga=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,ja=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,_a=(t,e)=>e.minComplexity===void 0||(t.complexity??-1/0)>=e.minComplexity,Wa=(t,e)=>e.maxComplexity===void 0||(t.complexity??0)<=e.maxComplexity,za=(t,e)=>e.minCognitiveComplexity===void 0||(t.cognitiveComplexity??-1/0)>=e.minCognitiveComplexity,$a=(t,e)=>e.maxCognitiveComplexity===void 0||(t.cognitiveComplexity??0)<=e.maxCognitiveComplexity,Ua=(t,e)=>e.minCommits===void 0||(t.commitCount90d??-1/0)>=e.minCommits,Ba=(t,e)=>e.maxCommits===void 0||(t.commitCount90d??0)<=e.maxCommits,Ja=(t,e,r)=>!e.any?.length||e.any.some(n=>ue(t,n,r)),Ka=[ba,Sa,Ca,va,ka,Ea,wa,Fa,Pa,Ta,Na,Ia,Ma,Aa,Da,Ra,Oa,La,Ga,ja,_a,Wa,za,$a,Ua,Ba,Ja]});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 l=r.get(a.toPath)??[];l.push(i.path),r.set(a.toPath,l)}}let n=t.nodes.filter(i=>ue(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,l)=>{let p=0;return e.sort==="size"?p=l.size-a.size:e.sort==="imports"?p=l.imports.length-a.imports.length:e.sort==="commitCount90d"?p=(l.commitCount90d??0)-(a.commitCount90d??0):e.sort==="exportUsage"?p=(l.avgExportUsage??0)-(a.avgExportUsage??0):e.sort==="complexity"?p=(l.complexity??0)-(a.complexity??0):e.sort==="cognitiveComplexity"&&(p=(l.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 In=m(()=>{"use strict";c();Yt();Yt()});function Mn(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 Ha(t){let e=[];for(let r of t.split("|")){let n=r.trim();if(!n)continue;let s={};Mn(s,n),Object.keys(s).length>0&&e.push(s)}return e}function $e(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=Ha(o);i.length>0&&(e.any=[...e.any??[],...i]);continue}Mn(e,n)}return e}var An=m(()=>{"use strict";c()});var Dn=m(()=>{"use strict";c();In();An()});import w from"typescript";function X(t){let e=[];for(let r of t.statements){if(!w.isExpressionStatement(r))continue;let n=r.expression;if(!w.isCallExpression(n))continue;let s=n.expression;w.isIdentifier(s)&&Rn.has(s.text)&&e.push(n),w.isPropertyAccessExpression(s)&&w.isIdentifier(s.expression)&&Rn.has(s.expression.text)&&e.push(n)}return e}function Y(t,e,r){for(let n of t.arguments){if(!w.isObjectLiteralExpression(n))continue;let s=n.properties.find(o=>w.isPropertyAssignment(o)&&w.isIdentifier(o.name)&&o.name.text===e);if(!(!s||!w.isArrayLiteralExpression(s.initializer)))return s.initializer.elements.filter(w.isStringLiteral).map(o=>o.text)}return null}function q(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(!w.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>w.isPropertyAssignment(p)&&w.isIdentifier(p.name)&&p.name.text===e);if(a)return{start:a.initializer.getStart(n),end:a.initializer.getEnd(),text:r};let l=i.getEnd()-1;return{start:l,end:l,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 Z(t,e,r){let n=t.arguments;for(let s=1;s<n.length;s++){let o=n[s];if(!w.isObjectLiteralExpression(o))continue;let i=o.properties.findIndex(l=>w.isPropertyAssignment(l)&&w.isIdentifier(l.name)&&l.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 ee(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 te(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}var Rn,A,re=m(()=>{"use strict";c();Rn=new Set(["describe","test","it"]);A=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import On from"path";import Ln from"typescript";function Va(t){return te(t.map(e=>`@${e}`))}function Qa(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var Ue,Gn=m(()=>{"use strict";c();re();Ue=class{name="cypress";canHandle(e){return A.has(On.extname(e).toLowerCase())}apply(e,r,n){let s=Ln.createSourceFile(On.basename(e),r,Ln.ScriptTarget.Latest,!0),o=X(s);if(o.length===0)return r;let i=Y(o[0],"tags",s),a=[...n].sort();if(i!==null&&JSON.stringify(Qa(i).sort())===JSON.stringify(a))return r;let l=o.flatMap(p=>{let h=n.length===0?Z(p,"tags",s):q(p,"tags",Va(a),s);return h?[h]:[]});return l.length>0?ee(r,l):r}}});import Xa from"path";function Ya(t){return["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
4
- `)+`
2
+ var bt=(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 fa=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);import ma from"path";import{fileURLToPath as ua}from"url";var ga,da,m,l=u(()=>{"use strict";ga=()=>ua(import.meta.url),da=()=>ma.dirname(ga()),m=da()});function Re(t){mn.push(t)}function un(t){return[...ha,...mn].some(e=>typeof e=="string"?t.includes(e):e instanceof RegExp?e.test(t):e(t))}function Le(t){gn.push(t)}function fe(){return[...ya,...gn]}function Oe(t){dn.push(t)}function St(){return[...xa,...dn]}function Ct(t){hn=t}function vt(){return hn}var ha,mn,ya,gn,xa,dn,hn,te=u(()=>{"use strict";l();ha=[".config.","biome.json","tsconfig.json","package.json",".prettierrc",".eslintrc"],mn=[];ya=[".test.",".spec.","-test.","-spec."],gn=[];xa=["jest","vitest","playwright","cypress","@testing-library/"],dn=[];hn=.8});import kt from"fs";import yn from"path";function re(t,{allowJs:e=!0,isExplicitPath:r=!1}={}){if(r){let n=yn.resolve(t);return kt.existsSync(n)?n.endsWith(".json")?xn(n):e?bn(n):{}:{}}for(let n of ba){let o=yn.resolve(t,n);if(kt.existsSync(o)){if(n.endsWith(".json"))return xn(o);if(e)return bn(o)}}return{}}function xn(t){return JSON.parse(kt.readFileSync(t,"utf-8"))}function bn(t){let e=bt(t);return e&&typeof e=="object"&&"default"in e&&(e=e.default),typeof e=="function"?e({}):e}function wt(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&&Ct(t.barrelThreshold)}function F(t){return{gitStats:t?.gitStats??!1,parallelParsing:t?.parallelParsing,pathAliases:t?.pathAliases}}var ba,Et=u(()=>{"use strict";l();te();ba=["mokosh.config.js","mokosh.config.cjs","mokosh.config.json"]});var B,Nt,Ge=u(()=>{"use strict";l();B=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"],Nt=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".go",".feature",".md",".mdx"]});import Hf from"fs";import Qf from"path";var Sn=u(()=>{"use strict";l()});var je,Cn=u(()=>{"use strict";l();je={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 vn=u(()=>{"use strict";l();Cn()});import kn from"fs";import Ca from"path";function Ft(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 wn(t,e){if(typeof t=="string")return Ft(t,e);if(t&&typeof t=="object"){let r=t;for(let n of["import","require","default"]){let o=wn(r[n],e);if(o)return o}}return null}function va(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 ka(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 Tt(t,e){let r=[],n=Ca.join(e,"package.json");if(kn.existsSync(n))try{let o=JSON.parse(kn.readFileSync(n,"utf8"));if(o.exports&&typeof o.exports=="object"&&!Array.isArray(o.exports))for(let s of Object.values(o.exports)){let i=wn(s,t);i&&!r.includes(i)&&r.push(i)}else if(typeof o.exports=="string"){let s=Ft(o.exports,t);s&&r.push(s)}if(r.length===0)for(let s of[o.main,o.module].filter(Boolean)){let i=Ft(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 wa(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 Ea(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 Na(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(y=>y.name===s))??n[0],f={name:s,definedIn:p,kind:va(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 Fa(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 Pt(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=wa(t,e),n=Ea(t,r,e),o=ka(t,e),s=Na(o,n,t,e),{internalFiles:i,unreachableFromEntry:a,testFiles:c}=Fa(t,r,e);return{entryPoints:e,publicExports:s,internalFiles:i,unreachableFromEntry:a,testFiles:c}}var It=u(()=>{"use strict";l()});function Dt(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 Mt=u(()=>{"use strict";l()});import pm from"fs";import mm from"path";function En(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 At(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:En(t)}}function Rt(t,e){return t.impact.get(e)??[]}var Lt=u(()=>{"use strict";l()});import _e from"fs";import Ta from"path";import{load as Nn}from"js-yaml";function Fn(t){let e=t.lastIndexOf("@");return e>0?t.substring(0,e):t}function Pa(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)),Fn(r)}).filter(Boolean)}function Ia(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 Da(t){try{let e=Nn(t),r={dependencies:{}};for(let[n,o]of Object.entries(e))if(!(n==="__metadata"||!o?.version))for(let s of n.split(", ")){let i=Fn(s);i&&(r.dependencies[i]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}return r}catch{return null}}function Ma(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=Pa(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 Aa(t){let e=_e.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 Ra(t){let e=_e.readFileSync(t,"utf-8");if(e.includes("__metadata:")){let r=Da(e);if(r!==null)return r}return Ma(e)}function La(t){let e=_e.readFileSync(t,"utf-8"),r={dependencies:{}};try{let n=Nn(e);if(n.packages)for(let[o,s]of Object.entries(n.packages)){let{name:i,version:a}=Ia(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 Tn(t){let e={"package-lock.json":Aa,"yarn.lock":Ra,"pnpm-lock.yaml":La},r=Ot.map(n=>[n,e[n]]);for(let[n,o]of r){let s=Ta.join(t,n);if(_e.existsSync(s))return o(s)}return null}var Ot,Gt=u(()=>{"use strict";l();Ot=["package-lock.json","yarn.lock","pnpm-lock.yaml"]});function Oa(t){let e=5381;for(let r=0;r<t.length;r++)e=e*33+t.charCodeAt(r)>>>0;return e.toString(36)}function Ga(t,e){let r=[];for(let n=0;n<=t.length-e;n++)r.push(Oa(t.slice(n,n+e).map(o=>o.text).join(" ")));return r}function ja(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 _a(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 Pn(t,e,r){let n=new Map,o=new Map,s=new Map;for(let{file:a,tokens:c}of t){if(c.length<e)continue;o.set(a,c);let p=Ga(c,e);n.set(a,p);for(let f=0;f<p.length;f++){let d={file:a,windowIndex:f},y=s.get(p[f]);y?y.push(d):s.set(p[f],[d])}}let i=[];for(let a of s.values())if(!(a.length<2))for(let c=0;c<a.length;c++)for(let p=c+1;p<a.length;p++){let f=a[c],d=a[p];if(f.file===d.file&&f.windowIndex===d.windowIndex||!_a(n,f,d))continue;let y=ja(n,f,d),x=e+y;if(f.file===d.file){let[j,ee]=f.windowIndex<d.windowIndex?[f,d]:[d,f];if(j.windowIndex+x>ee.windowIndex)continue}let k=o.get(f.file),C=o.get(d.file),E={file:f.file,startLine:k[f.windowIndex].line,endLine:k[f.windowIndex+x-1].line},I={file:d.file,startLine:C[d.windowIndex].line,endLine:C[d.windowIndex+x-1].line},G=Math.min(E.endLine-E.startLine+1,I.endLine-I.startLine+1);G<r||i.push({occurrences:[E,I],lines:G,tokens:x})}return i.sort((a,c)=>c.lines-a.lines)}var In=u(()=>{"use strict";l()});function Dn(t,e,r){let n=t.slice(e,r).replace(/[^\n]/g," ");return t.slice(0,e)+n+t.slice(r)}function za(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=Dn(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=Dn(r,s,a),o=a}}return r}function An(t,e,r=!0){let n=za(t,Wa[e]),o=[],s=1,i=0;jt.lastIndex=0;let a=jt.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;Ua.test(c)&&!Ja.has(c)?p="ID":r&&(Mn.test(c)||Ba.test(c))&&(p=Mn.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=jt.exec(n)}return o}var Wa,$a,jt,Ua,Mn,Ba,Ja,Rn=u(()=>{"use strict";l();Wa={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:[["<!--","-->"]]}};$a=["===","!==","...","=>","==","!=","<=",">=","&&","||","::","->","..","+=","-=","*=","/="],jt=new RegExp(`${$a.map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")}|[A-Za-z_$][A-Za-z0-9_$]*|\\d+(?:\\.\\d+)?|"(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`|\\S`,"g"),Ua=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Mn=/^\d+(?:\.\d+)?$/,Ba=/^(".*"|'.*'|`.*`)$/s,Ja=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 Ka}from"fs/promises";import _t from"path";function Ha(t){return Ot.includes(_t.basename(t))}function Va(t,e){if(e.length===0)return!1;let r=new Set(e);return t.split(_t.sep).some(n=>r.has(n))}async function Wt(t,e,r={}){let{minLines:n=6,windowSize:o=15,ignoreLiterals:s=!0,limit:i=50,ignoreDirs:a=B}=r,c=[...t.nodes.values()].filter(f=>!Ha(f.path)&&!Va(f.path,a)),p=(await Promise.all(c.map(async f=>{try{let d=await Ka(_t.join(e,f.path),"utf8");return{file:f.path,tokens:An(d,f.type,s)}}catch{return}}))).filter(f=>f!==void 0);return Pn(p,o,n).slice(0,i)}var zt=u(()=>{"use strict";l();Ge();Gt();In();Rn()});import We from"path";function Qa(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 Xa(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=We.extname(o),c=We.basename(o,a),p=c==="index"?We.basename(We.dirname(o)):c;n.set(o,{path:o,outDegree:s,tag:`feature:${p}`})}return n}function J(t,e){let r=e?.minOutDegree??5;return Xa(t,Qa(t),r)}var ze=u(()=>{"use strict";l()});function qa(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 Za(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 ec(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 tc(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??J,n=e?.hubComparator??Ya,o=r(t.nodes,e),s=qa(t,o),i=Za(t.nodes,o,s,n);return{features:ec(o,i),unassigned:tc(t.nodes,o,i)}}var Ya,$e=u(()=>{"use strict";l();ze();Ya=(t,e)=>t.outDegree-e.outDegree});function $t(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:Ln.has(r),importSymbolsTracked:On.has(r),callEdgesTracked:Ue.has(r)})).sort((r,n)=>n.fileCount-r.fileCount)}var Ln,On,Ue,Ut=u(()=>{"use strict";l();Ln=new Set(["typescript","javascript","python","go","scss","less","lua","coffeescript"]),On=new Set(["typescript","javascript","python"]),Ue=new Set(["typescript","javascript","go","python"])});var ue,Gn=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();Gn();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 y of o(c))a(y,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 K,Be=u(()=>{"use strict";l();K=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 H(t,e){let r=t.nodes.get(e);if(r)return{category:r.category,exports:r.exports.map(n=>n.name)}}function Bt(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 Jt(t,e,r={}){let{testsOnly:n=!1,changedSymbols:o}=r,s=o?new K(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 Kt(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 Ht(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 Vt(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 Qt(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 Xt(t){return[...t.nodes.values()].some(e=>e.coveragePct!==void 0)}var Yt=u(()=>{"use strict";l();Be()});function jn(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 S(e,"component")||S(e,"components")?"component":S(e,"controller")||S(e,"controllers")?"controller":S(e,"middleware")?"middleware":S(e,"router")||S(e,"routes")||S(e,"route")?"router":S(e,"store")||S(e,"stores")?"store":S(e,"service")||S(e,"services")?"service":S(e,"handler")||S(e,"handlers")?"handler":S(e,"adapter")||S(e,"adapters")?"adapter":S(e,"plugin")||S(e,"plugins")?"plugin":S(e,"api")?"api":S(e,"cli")||S(e,"commands")||he(e)==="cli"?"cli":S(e,"util")||S(e,"utils")||S(e,"helper")||S(e,"helpers")?"util":S(e,"model")||S(e,"models")||he(e)==="model"?"model":S(e,"parser")||S(e,"parsers")||he(e)==="parser"?"parser":he(e)==="builder"?"builder":he(e)==="resolver"?"resolver":"other"}function S(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 _n=u(()=>{"use strict";l()});function qt(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:jn(s),...s.description?{description:s.description}:{},exports:s.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return o}var Zt=u(()=>{"use strict";l();$e();_n()});function er(t,e){let r=[];for(let n of t.nodes.values())if(n.exports.some(o=>o.name===e))if(Ue.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 Wn=u(()=>{"use strict";l();Ut();Yt()});function rc(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function nc(t,e){if(e==="type-only")return!0;let r=t.signature??"";return r.startsWith("interface ")||r.startsWith("class ")||r.startsWith("enum ")}function tr(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(!nc(o,n.category))continue;let s=`${n.path}::${o.name}`;e.set(s,{name:o.name,file:n.path,kind:rc(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 rr(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 nr=u(()=>{"use strict";l()});import zn from"fs";import pu from"path";function $n(t){try{return zn.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function Je(t){try{return zn.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Ke=u(()=>{"use strict";l()});import ye from"fs";import M from"path";function or(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:oc(e,n)}:null}function oc(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(Je);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(/^\.\//,"");sc(t,s,n,r)}return r}function sc(t,e,r,n){if(!e.includes("*")){ic(t,e,r,n);return}let o=e.split("/");o.includes("**")?ac(t,o,r,n):cc(t,o,r,n)}function ic(t,e,r,n){let o=M.join(t,e);if(r.has(o)||!$n(o))return;r.add(o);let s=or(t,o);s&&n.push(s)}function ac(t,e,r,n){let o=M.join(t,e[0]==="**"?"":e[0]??"");Un(t,o,r,n)}function cc(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=or(t,c);p&&n.push(p)}}function Un(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=or(t,i);a&&n.push(a)}else Un(t,i,r,n)}}var He=u(()=>{"use strict";l();Ke();Ke()});import sr from"fs";import Bn from"path";var Jn,Kn=u(()=>{"use strict";l();He();Jn={type:"npm",detect(t){let e=Bn.join(t,"package.json");if(!sr.existsSync(e))return null;let r;try{r=JSON.parse(sr.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r||sr.existsSync(Bn.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 T from"path";function Vn(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=T.join(e,a);oe.existsSync(T.join(c,"project.json"))&&!r.has(c)?(r.add(c),s.push(c)):s.push(...Vn(t,c,r,n+1))}return s}function lc(t,e,r){let n={};try{n=JSON.parse(oe.readFileSync(r,"utf-8"))}catch{return null}let o=n.name,s,i,a=T.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:T.relative(t,e),entryPoints:pc(e,n,s,i)}:null}function pc(t,e,r,n){let o=[],s=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(s){let a=T.resolve(t,"../..");o.push(T.resolve(a,s)),o.push(T.resolve(t,s))}if(n){let a=n;if(typeof a=="string")o.push(T.join(t,a));else if(typeof a=="object"&&a!==null){let c=a["."];typeof c=="string"&&o.push(T.join(t,c))}}if(r&&o.push(T.join(t,r)),e.sourceRoot){let a=T.resolve(t,"../.."),c=T.resolve(a,e.sourceRoot);o.push(T.join(c,"index.ts"),T.join(c,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])o.push(T.join(t,a));let i=o.filter(Je);return i.length>0?i.slice(0,1):o.slice(0,1)}var Hn,Qn=u(()=>{"use strict";l();Ke();Hn={type:"nx",detect(t){return oe.existsSync(T.join(t,"nx.json"))?Vn(t,t,new Set,0).map(r=>lc(t,r,T.join(r,"project.json"))).filter(r=>r!==null):null}}});import Xn from"fs";import fc from"path";import{load as mc}from"js-yaml";var Yn,qn=u(()=>{"use strict";l();He();Yn={type:"pnpm",detect(t){let e=fc.join(t,"pnpm-workspace.yaml");if(!Xn.existsSync(e))return null;let r=[];try{r=mc(Xn.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return ne(t,r)}}});import uc from"fs";import gc from"path";var Zn,eo=u(()=>{"use strict";l();Zn={type:"turborepo",detect(t){return uc.existsSync(gc.join(t,"turbo.json"))?[]:null}}});import ir from"fs";import to from"path";var ro,no=u(()=>{"use strict";l();He();ro={type:"yarn",detect(t){if(!ir.existsSync(to.join(t,"yarn.lock")))return null;let e=to.join(t,"package.json");if(!ir.existsSync(e))return null;let r;try{r=JSON.parse(ir.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 _(t){oo.push(t)}function so(){return oo}var oo,Ve=u(()=>{"use strict";l();oo=[]});import dc from"path";function ar(t,e=so()){let r=dc.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 cr=u(()=>{"use strict";l();Kn();Qn();qn();eo();no();Ve();Ve();_(Zn);_(Hn);_(Yn);_(ro);_(Jn)});var xe,lr=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){io.set(t,e)}function ao(t){return io.get(t)}var io,be=u(()=>{"use strict";l();io=new Map});function co(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function hc(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}function Se(t,e,r){return Bc.every(n=>n(t,e,r))}var yc,xc,bc,Sc,Cc,vc,kc,wc,Ec,Nc,Fc,Tc,Pc,Ic,Dc,Mc,Ac,Rc,Lc,Oc,Gc,jc,_c,Wc,zc,$c,Uc,Bc,pr=u(()=>{"use strict";l();yc=(t,e)=>!e.category||co(t.category,e.category),xc=(t,e)=>!e.type||co(t.type,e.type),bc=(t,e)=>e.lastAuthor?e.lastAuthor.startsWith("!")?t.lastAuthor!==e.lastAuthor.slice(1):t.lastAuthor!==void 0&&t.lastAuthor===e.lastAuthor:!0,Sc=(t,e)=>!e.path||hc(t.path,e.path),Cc=(t,e)=>e.isExternal===void 0?!0:t.imports.some(n=>n.isExternal)===e.isExternal,vc=(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)))},kc=(t,e)=>!e.allTags?.length||e.allTags.every(r=>t.tags.some(n=>n.name===r)),wc=(t,e)=>!e.importsFile||t.imports.some(r=>r.toPath?.includes(e.importsFile)),Ec=(t,e,r)=>e.importedBy===void 0?!0:(r?.get(t.path)??[]).some(o=>o.includes(e.importedBy)),Nc=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,Fc=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,Tc=(t,e)=>e.minSize===void 0||t.size>=e.minSize,Pc=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,Ic=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,Dc=(t,e)=>e.isDocumented===void 0||!!t.documentedBy?.length===e.isDocumented,Mc=(t,e)=>e.isStale===void 0||!!t.staleFor?.length===e.isStale,Ac=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,Rc=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,Lc=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,Oc=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,Gc=(t,e)=>e.minComplexity===void 0||(t.complexity??-1/0)>=e.minComplexity,jc=(t,e)=>e.maxComplexity===void 0||(t.complexity??0)<=e.maxComplexity,_c=(t,e)=>e.minCognitiveComplexity===void 0||(t.cognitiveComplexity??-1/0)>=e.minCognitiveComplexity,Wc=(t,e)=>e.maxCognitiveComplexity===void 0||(t.cognitiveComplexity??0)<=e.maxCognitiveComplexity,zc=(t,e)=>e.minCommits===void 0||(t.commitCount90d??-1/0)>=e.minCommits,$c=(t,e)=>e.maxCommits===void 0||(t.commitCount90d??0)<=e.maxCommits,Uc=(t,e,r)=>!e.any?.length||e.any.some(n=>Se(t,n,r)),Bc=[yc,xc,bc,Sc,Cc,vc,kc,wc,Ec,Nc,Fc,Tc,Pc,Ic,Dc,Mc,Ac,Rc,Lc,Oc,Gc,jc,_c,Wc,zc,$c,Uc]});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=>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 lo=u(()=>{"use strict";l();pr();pr()});function po(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 Jc(t){let e=[];for(let r of t.split("|")){let n=r.trim();if(!n)continue;let o={};po(o,n),Object.keys(o).length>0&&e.push(o)}return e}function Xe(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=Jc(s);i.length>0&&(e.any=[...e.any??[],...i]);continue}po(e,n)}return e}var fo=u(()=>{"use strict";l()});var mo=u(()=>{"use strict";l();lo();fo()});import Kc from"path";import N from"typescript";function V(t,e){let r=t[e];if(r===void 0)throw new Error(`Index ${e} out of bounds (length ${t.length})`);return r}function fr(t){let e=[];for(let r of t.statements){if(!N.isExpressionStatement(r))continue;let n=r.expression;if(!N.isCallExpression(n))continue;let o=n.expression;N.isIdentifier(o)&&uo.has(o.text)&&e.push(n),N.isPropertyAccessExpression(o)&&N.isIdentifier(o.expression)&&uo.has(o.expression.text)&&e.push(n)}return e}function mr(t,e,r){for(let n of t.arguments){if(!N.isObjectLiteralExpression(n))continue;let o=n.properties.find(s=>N.isPropertyAssignment(s)&&N.isIdentifier(s.name)&&s.name.text===e);if(!(!o||!N.isArrayLiteralExpression(o.initializer)))return o.initializer.elements.filter(N.isStringLiteral).map(s=>s.text)}return null}function ur(t,e,r,n){if(t.arguments.length===0)return null;for(let s=1;s<t.arguments.length;s++){let i=V(t.arguments,s);if(!N.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>N.isPropertyAssignment(p)&&N.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=V(t.arguments,t.arguments.length-1);return{start:o.getStart(n),end:o.getStart(n),text:`{ ${e}: ${r} }, `}}function gr(t,e,r){let n=t.arguments;for(let o=1;o<n.length;o++){let s=V(n,o);if(!N.isObjectLiteralExpression(s))continue;let i=s.properties.findIndex(c=>N.isPropertyAssignment(c)&&N.isIdentifier(c.name)&&c.name.text===e);if(i<0)continue;if(s.properties.length===1)return{start:V(n,o-1).getEnd(),end:s.getEnd(),text:""};let a=V(s.properties,i);return i===s.properties.length-1?{start:V(s.properties,i-1).getEnd(),end:a.getEnd(),text:""}:{start:a.getStart(r),end:V(s.properties,i+1).getStart(r),text:""}}return null}function dr(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 hr(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}function Hc(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}function Ye(t,e,r,n){let o=N.createSourceFile(Kc.basename(t),e,N.ScriptTarget.Latest,!0),s=fr(o),[i]=s;if(!i)return e;let a=mr(i,n,o),c=[...r].sort();if(a!==null&&JSON.stringify(Hc(a).sort())===JSON.stringify(c))return e;let p=hr(c.map(d=>`@${d}`)),f=s.flatMap(d=>{let y=r.length===0?gr(d,n,o):ur(d,n,p,o);return y?[y]:[]});return f.length>0?dr(e,f):e}var uo,O,ie=u(()=>{"use strict";l();uo=new Set(["describe","test","it"]);O=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import Vc from"path";var qe,go=u(()=>{"use strict";l();ie();qe=class{name="cypress";canHandle(e){return O.has(Vc.extname(e).toLowerCase())}apply(e,r,n){return Ye(e,r,n,"tags")}}});import Qc from"path";function Xc(t){return`${["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
8
+ `)}
5
9
 
6
- `}function qa(t){let e=new Set;Zt.lastIndex=0;let r=Zt.exec(t);for(;r!==null;)r[1]&&e.add(r[1]),r=Zt.exec(t);return e}var qt,Zt,Be,jn=m(()=>{"use strict";c();qt=/# <mokosh-tags>[\s\S]*?# <\/mokosh-tags>\n*/,Zt=/^@([a-zA-Z0-9_-]+)/gm;Be=class{name="gherkin";canHandle(e){return Xa.extname(e).toLowerCase()===".feature"}apply(e,r,n){let s=r.replace(qt,""),o=qa(s),i=n.filter(l=>!o.has(l)),a=i.length>0?Ya(i):"";return qt.test(r)?r.replace(qt,a):a?r.replace(/^(Feature:)/m,`${a}$1`):r}}});function _n(t,e){let r=t.replace(/\\/g,"/"),n=e.replace(/\\/g,"/"),s="";for(let o=0;o<r.length;o++){let i=r[o];i==="*"?r[o+1]==="*"?(s+=".*",o++):s+="[^/]*":i==="?"?s+="[^/]":i!==void 0&&(s+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&"))}return new RegExp(`^${s}$`).test(n)}var Wn=m(()=>{"use strict";c()});import Za from"path";function tc(t){return`//go:build ${t.map(r=>`mokosh_${r}`).join(" || ")}
7
- `}function rc(t){let e=er.exec(t);if(!e)return null;let r=e[0],n=/mokosh_([a-zA-Z0-9_-]+)/g,s=[],o=n.exec(r);for(;o!==null;)o[1]&&s.push(o[1]),o=n.exec(r);return s}var er,ec,Je,zn=m(()=>{"use strict";c();er=/^\/\/go:build mokosh_[^\n]+\n/m,ec=/^package\s+\S+/m;Je=class{name="go";canHandle(e){return Za.basename(e).endsWith("_test.go")}apply(e,r,n){let s=rc(r),o=[...n].sort();if(s!==null&&JSON.stringify([...s].sort())===JSON.stringify(o))return r;if(n.length===0)return r.replace(er,"");let i=tc(o);if(s!==null)return r.replace(er,i);let a=ec.exec(r);if(!a)return r;let l=a.index;return r.slice(0,l)+i+`
8
- `+r.slice(l)}}});import nc from"path";function oc(t){return["/**",...t.map(e=>` * @group ${e}`)," */"].join(`
9
- `)+`
10
+ `}function Yc(t){let e=new Set;xr.lastIndex=0;let r=xr.exec(t);for(;r!==null;)r[1]&&e.add(r[1]),r=xr.exec(t);return e}var yr,xr,Ze,ho=u(()=>{"use strict";l();yr=/# <mokosh-tags>[\s\S]*?# <\/mokosh-tags>\n*/,xr=/^@([a-zA-Z0-9_-]+)/gm;Ze=class{name="gherkin";canHandle(e){return Qc.extname(e).toLowerCase()===".feature"}apply(e,r,n){let o=r.replace(yr,""),s=Yc(o),i=n.filter(c=>!s.has(c)),a=i.length>0?Xc(i):"";return yr.test(r)?r.replace(yr,a):a?r.replace(/^(Feature:)/m,`${a}$1`):r}}});function yo(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 xo=u(()=>{"use strict";l()});import qc from"path";function el(t){return`//go:build ${t.map(r=>`mokosh_${r}`).join(" || ")}
11
+ `}function tl(t){let e=br.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 br,Zc,et,bo=u(()=>{"use strict";l();br=/^\/\/go:build mokosh_[^\n]+\n/m,Zc=/^package\s+\S+/m;et=class{name="go";canHandle(e){return qc.basename(e).endsWith("_test.go")}apply(e,r,n){let o=tl(r),s=[...n].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(s))return r;if(n.length===0)return r.replace(br,"");let i=el(s);if(o!==null)return r.replace(br,i);let a=Zc.exec(r);if(!a)return r;let c=a.index;return`${r.slice(0,c)+i}
12
+ ${r.slice(c)}`}}});import rl from"path";function ol(t){return`${["/**",...t.map(e=>` * @group ${e}`)," */"].join(`
13
+ `)}
10
14
 
11
- `}function ic(t){let e=[];tr.lastIndex=0;let r=tr.exec(t);for(;r!==null;)r[1]&&e.push(r[1]),r=tr.exec(t);return e}var sc,tr,Ke,$n=m(()=>{"use strict";c();re();sc=/^\/\*\*\n(?: \* @group .+\n)+ \*\/\n+/,tr=/^ \* @group (.+)$/gm;Ke=class{name="jest";canHandle(e){return A.has(nc.extname(e).toLowerCase())}apply(e,r,n){let s=sc.exec(r),o=s?ic(s[0]):null,i=[...n].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(i))return r;let a=s?r.slice(s[0].length):r;return n.length===0?a:oc(i)+a}}});import Un from"path";import Bn from"typescript";function ac(t){return te(t.map(e=>`@${e}`))}function cc(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var He,Jn=m(()=>{"use strict";c();re();He=class{name="playwright";canHandle(e){return A.has(Un.extname(e).toLowerCase())}apply(e,r,n){let s=Bn.createSourceFile(Un.basename(e),r,Bn.ScriptTarget.Latest,!0),o=X(s);if(o.length===0)return r;let i=Y(o[0],"tag",s),a=[...n].sort();if(i!==null&&JSON.stringify(cc(i).sort())===JSON.stringify(a))return r;let l=o.flatMap(p=>{let h=n.length===0?Z(p,"tag",s):q(p,"tag",ac(a),s);return h?[h]:[]});return l.length>0?ee(r,l):r}}});import lc from"path";function fc(t){let e=t.map(r=>`pytest.mark.${r}`).join(", ");return t.length===1?`pytestmark = pytest.mark.${t[0]}`:`pytestmark = [${e}]`}function mc(t){let e=rr.exec(t);if(!e)return null;let r=e[0],n=[],s=/pytest\.mark\.([a-zA-Z0-9_-]+)/g,o=s.exec(r);for(;o!==null;)o[1]&&n.push(o[1]),o=s.exec(r);return n}function uc(t){let e=t.split(`
12
- `),r=-1;for(let s=0;s<e.length;s++){let o=e[s].trimStart();(o.startsWith("import ")||o.startsWith("from "))&&(r=s)}if(r<0)return 0;let n=0;for(let s=0;s<=r;s++)n+=e[s].length+1;return n}var rr,pc,Ve,Kn=m(()=>{"use strict";c();rr=/^pytestmark\s*=\s*.+$/m,pc=/^import pytest\s*$/m;Ve=class{name="pytest";canHandle(e){return lc.extname(e).toLowerCase()===".py"}apply(e,r,n){let s=mc(r),o=[...n].sort();if(s!==null&&JSON.stringify([...s].sort())===JSON.stringify(o))return r;if(n.length===0)return r.replace(rr,"").replace(/\n{3,}/g,`
15
+ `}function sl(t){let e=[];Sr.lastIndex=0;let r=Sr.exec(t);for(;r!==null;)r[1]&&e.push(r[1]),r=Sr.exec(t);return e}var nl,Sr,tt,So=u(()=>{"use strict";l();ie();nl=/^\/\*\*\n(?: \* @group .+\n)+ \*\/\n+/,Sr=/^ \* @group (.+)$/gm;tt=class{name="jest";canHandle(e){return O.has(rl.extname(e).toLowerCase())}apply(e,r,n){let o=nl.exec(r),s=o?sl(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:ol(i)+a}}});import il from"path";var rt,Co=u(()=>{"use strict";l();ie();rt=class{name="playwright";canHandle(e){return O.has(il.extname(e).toLowerCase())}apply(e,r,n){return Ye(e,r,n,"tag")}}});import al from"path";function ll(t){let e=t.map(r=>`pytest.mark.${r}`).join(", ");return t.length===1?`pytestmark = pytest.mark.${t[0]}`:`pytestmark = [${e}]`}function pl(t){let e=Cr.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 fl(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 Cr,cl,nt,vo=u(()=>{"use strict";l();Cr=/^pytestmark\s*=\s*.+$/m,cl=/^import pytest\s*$/m;nt=class{name="pytest";canHandle(e){return al.extname(e).toLowerCase()===".py"}apply(e,r,n){let o=pl(r),s=[...n].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(s))return r;if(n.length===0)return r.replace(Cr,"").replace(/\n{3,}/g,`
13
17
 
14
- `);let i=fc(o);if(s!==null)return r.replace(rr,i);let a=pc.test(r),l=uc(r),p=r.slice(0,l),h=r.slice(l),d=a?"":`import pytest
15
- `,b=p.endsWith(`
18
+ `);let i=ll(s);if(o!==null)return r.replace(Cr,i);let a=cl.test(r),c=fl(r),p=r.slice(0,c),f=r.slice(c),d=a?"":`import pytest
19
+ `,y=p.endsWith(`
16
20
 
17
21
  `)?"":`
18
- `;return p+b+d+i+`
19
- `+h}}});import Hn from"path";import Vn from"typescript";var gc,Qe,Qn=m(()=>{"use strict";c();re();gc=/\/\/ <mokosh-tags>[\s\S]*?\/\/ <\/mokosh-tags>\n*/,Qe=class{name="vitest";canHandle(e){return A.has(Hn.extname(e).toLowerCase())}apply(e,r,n){let s=r.replace(gc,""),o=Vn.createSourceFile(Hn.basename(e),s,Vn.ScriptTarget.Latest,!0),i=X(o);if(i.length===0)return s;let a=Y(i[0],"tags",o),l=[...n].sort();if(a!==null&&JSON.stringify([...a].sort())===JSON.stringify(l))return s;let p=i.flatMap(h=>{let d=n.length===0?Z(h,"tags",o):q(h,"tags",te(l),o);return d?[d]:[]});return p.length>0?ee(s,p):s}}});import nr from"path";import Xe from"typescript";function hc(t){let e=Xe.createSourceFile("detect.ts",t,Xe.ScriptTarget.Latest,!0);for(let r of e.statements){if(!Xe.isImportDeclaration(r)||!Xe.isStringLiteral(r.moduleSpecifier))continue;let n=dc[r.moduleSpecifier.text];if(n)return n}return null}function Yn(t="vitest",e={},r=process.cwd()){return[new Be,new Ve,new Je,new sr(r,t,Object.entries(e))]}function qn(t,e){return e.find(r=>r.canHandle(t))??null}var Xn,dc,sr,Zn=m(()=>{"use strict";c();Gn();jn();Wn();zn();$n();Jn();Kn();re();Qn();Xn={vitest:()=>new Qe,playwright:()=>new He,cypress:()=>new Ue,jest:()=>new Ke},dc={"@playwright/test":"playwright",cypress:"cypress","@jest/globals":"jest",vitest:"vitest"};sr=class{constructor(e,r,n){this.rootDir=e;this.defaultFramework=r;this.frameworkOverrides=n}rootDir;defaultFramework;frameworkOverrides;name="auto";canHandle(e){return A.has(nr.extname(e).toLowerCase())}apply(e,r,n){let s=hc(r)??this.matchOverride(e)??this.defaultFramework;return(Xn[s]??Xn.vitest)().apply(e,r,n)}matchOverride(e){let r=nr.relative(this.rootDir,e).split(nr.sep).join("/");for(let[n,s]of this.frameworkOverrides)if(_n(n,r))return s;return null}}});import es from"fs/promises";import yc from"path";async function Cc(t,e,r,n){let s;try{s=await es.readFile(t,"utf8")}catch(a){return{path:t,status:"error",error:String(a)}}let o=qn(t,n);if(!o)return{path:t,status:"unchanged"};let i=o.apply(t,s,e);return i===s?{path:t,status:"unchanged"}:(r||await es.writeFile(t,i,"utf8"),{path:t,status:"updated"})}async function or(t,e,r){let n=K(e),s=n.tagApplier?.framework??"vitest",o=n.tagApplier?.frameworkOverrides??{},i=Yn(s,o,e),a={updated:0,unchanged:0,errors:0,files:[]};for(let l of t.nodes.values()){if(l.category!=="test")continue;let p=new Set,h=[];for(let v of l.tags)bc.has(v.kind)&&xc.test(v.name)&&(Sc.has(v.name.toLowerCase())||p.has(v.name)||(p.add(v.name),h.push(v.name)));h.sort();let d=yc.resolve(e,l.path),b=await Cc(d,h,r.dryRun,i);b.path=l.path,a.files.push(b),b.status==="updated"?a.updated++:b.status==="unchanged"?a.unchanged++:a.errors++}return a}var xc,bc,Sc,ts=m(()=>{"use strict";c();ht();Zn();xc=/^[a-zA-Z][a-zA-Z0-9_-]{1,}$/,bc=new Set(["import"]),Sc=new Set(["common","fixture","fixtures","helper","helpers","index","main","mock","mocks","setup","shared","spec","test","tests","types","util","utils"])});var Ye,ir=m(()=>{"use strict";c();Ye=class{isTestNode(e){return e.category==="test"||e.tags.some(r=>r.name==="test")}}});import{execFileSync as ar}from"child_process";function ss(t,e){let r="",n=0;for(let s of t.split(`
20
- `)){if(s.startsWith("\0")){let[,l,p]=s.slice(1).split(" ");r=l??"",n=p?Number(p)*1e3:0;continue}if(s==="")continue;let o=s.split(" "),i=o[0];if(!i)continue;let a=i.startsWith("R")||i.startsWith("C")?o[2]:o[1];a&&e(a,r,n)}}function os(t){let e=new Map;try{let r=ar("git",["-C",t,"log","--since=90 days ago","--name-status","-M",`--format=${rs}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],maxBuffer:ns});ss(r,(n,s,o)=>{let i=e.get(n);if(i){i.commitCount90d+=1;return}e.set(n,{commitCount90d:1,lastAuthor:s||void 0,lastCommitAt:o||void 0})})}catch{return e}try{let r=ar("git",["-C",t,"log","--name-status","-M",`--format=${rs}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],maxBuffer:ns});ss(r,(n,s,o)=>{e.has(n)||e.set(n,{commitCount90d:0,lastAuthor:void 0,lastCommitAt:o||void 0})})}catch{}return e}var qe,rs,ns,cr=m(()=>{"use strict";c();qe=class{getChangedFiles(){try{let r=[["diff","--name-only"],["diff","--cached","--name-only"],["ls-files","--others","--exclude-standard"]].flatMap(n=>{try{return ar("git",n,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
21
- `).map(o=>o.trim()).filter(o=>o!=="")}catch{return[]}});return Array.from(new Set(r))}catch(e){return console.error("Error getting git diff:",e),[]}}},rs="%x00%H%x09%ae%x09%at",ns=256*1024*1024});import Ze from"fs";import vc from"path";import{load as is}from"js-yaml";function as(t){let e=t.lastIndexOf("@");return e>0?t.substring(0,e):t}function kc(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)),as(r)}).filter(Boolean)}function Ec(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 wc(t){try{let e=is(t),r={dependencies:{}};for(let[n,s]of Object.entries(e))if(!(n==="__metadata"||!s?.version))for(let o of n.split(", ")){let i=as(o);i&&(r.dependencies[i]={version:s.version,...s.dependencies!==void 0&&{dependencies:s.dependencies}})}return r}catch{return null}}function Fc(t){let e={dependencies:{}};for(let r of t.split(/\n\n+/)){let n=r.split(`
22
- `).filter(l=>l.trim().length>0&&!l.trim().startsWith("#"));if(n.length<2)continue;let s=n[0];if(!s||s.startsWith(" "))continue;let o=kc(s);if(o.length===0)continue;let a=n.find(l=>l.trim().startsWith('version "'))?.match(/version "(.*?)"/)?.[1]??"";for(let l of o)e.dependencies[l]={version:a}}return e}function Pc(t){let e=Ze.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 Tc(t){let e=Ze.readFileSync(t,"utf-8");if(e.includes("__metadata:")){let r=wc(e);if(r!==null)return r}return Fc(e)}function Nc(t){let e=Ze.readFileSync(t,"utf-8"),r={dependencies:{}};try{let n=is(e);if(n.packages)for(let[s,o]of Object.entries(n.packages)){let{name:i,version:a}=Ec(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 cs(t){let e=[["package-lock.json",Pc],["yarn.lock",Tc],["pnpm-lock.yaml",Nc]];for(let[r,n]of e){let s=vc.join(t,r);if(Ze.existsSync(s))return n(s)}return null}var ls=m(()=>{"use strict";c()});import ps from"path";function R(t){switch(ps.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 N(t){let e=ps.extname(t).toLowerCase();return[".css",".scss",".sass",".less",".styl"].includes(e)}var O=m(()=>{"use strict";c()});function L(t){return t.startsWith("'")||t.startsWith('"')?t.slice(1,-1):t}var et=m(()=>{"use strict";c()});import Ic from"coffeescript";function ms(t){if(t){if(typeof t.originalValue=="string")return t.originalValue;if(typeof t.value=="string")return L(t.value)}}function $(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function Mc(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 Ac(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Dc(t,e){let r=ms(e.source);return r?{fromPath:t,toPath:"",rawSpecifier:r,isStyle:N(r),type:"static"}:null}function Rc(t,e){let r=e.variable?.base?.value==="require",n=ms(e.args?.[0]?.base);return!r||!n?null:{fromPath:t,toPath:"",rawSpecifier:n,isStyle:N(n),type:"require"}}function fs(t,e){if(e)return[{name:e}];let r=t.value;if(r?.constructor?.name==="Class"){let s=$(r.variable);return s?[{name:s}]:[]}if(r?.base?.constructor?.name==="Obj"&&Array.isArray(r.base.properties))return r.base.properties.map(s=>$(s.variable)??$(s)).filter(s=>!!s).map(s=>({name:s}));let n=$(r);return n?[{name:n}]:[]}function Oc(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=$(t.variable)??$(t.variable?.base);return e?[{name:e}]:[]}function Lc(t,e,r,n){let s=e.constructor?.name;if(s==="ImportDeclaration"){let o=Dc(t,e);o&&r.push(o)}else if(s==="Call"){let o=Rc(t,e);o&&r.push(o)}else if(s==="Assign"){let o=$(e.variable?.base),i=e.variable?.properties?.[0]?.name?.value;o==="module"&&i==="exports"?n.push(...fs(e,void 0)):o==="exports"&&typeof i=="string"&&n.push(...fs(e,i))}else s==="ExportNamedDeclaration"&&e.clause?n.push(...Oc(e.clause)):s==="ExportDefaultDeclaration"&&n.push({name:"default"})}function lr(t,e,r,n){if(!(!e||typeof e!="object")){Lc(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)lr(t,i,r,n);else lr(t,o,r,n)}}}function us(t,e){let r=Mc(e),n=Ac(t,r),s=[],o=[];try{lr(t,Ic.nodes(e),s,o)}catch{}let i=new Set,a=o.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0));return{imports:s,exports:a,tags:Array.from(r).map(l=>({name:l,kind:"comment-marker"})),category:n}}var gs=m(()=>{"use strict";c();O();et()});import{AstBuilder as Gc,GherkinClassicTokenMatcher as jc,Parser as _c}from"@cucumber/gherkin";import{IdGenerator as Wc}from"@cucumber/messages";function pr(t,e){let r=new Set;try{let n=new Gc(zc),s=new jc,i=new _c(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(l=>{r.add(l.name.startsWith("@")?l.name.slice(1):l.name)}),a.scenario.examples.forEach(l=>{l.tags.forEach(p=>{r.add(p.name.startsWith("@")?p.name.slice(1):p.name)})})),a.rule&&a.rule.children.forEach(l=>{l.scenario&&l.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 zc,ds=m(()=>{"use strict";c();me();zc=Wc.uuid();Q("gherkin",pr)});import $c from"path";import{parser as Uc}from"@lezer/go";function ys(t,e){let r=[],n=new Map,s=new Set,o=new Set,a=Uc.parse(e).cursor();do switch(a.name){case"LineComment":{let d=e.slice(a.from,a.to),b=d.match(Bc);b?.[1]&&s.add(b[1]);let v=d.match(Jc);v&&hs(v[1],o);let j=d.match(Kc);j&&hs(j[1],o);break}case"ImportSpec":{let d=a.node.getChild("String");if(d){let v=e.slice(d.from,d.to).slice(1,-1);r.push({fromPath:t,toPath:"",rawSpecifier:v,isExternal:!0,isStyle:!1,type:"static"})}break}case"FunctionDecl":case"TypeDecl":case"VarDecl":case"ConstDecl":{let d=a.node.getChild("DefName")??a.node.getChild("TypeSpec")?.getChild("DefName")??a.node.getChild("VarSpec")?.getChild("DefName")??a.node.getChild("ConstSpec")?.getChild("DefName");if(d){let b=e.slice(d.from,d.to);b!=="_"&&/^[A-Z]/.test(b)&&!n.has(b)&&n.set(b,{name:b})}break}}while(a.next());let l=r.some(d=>d.rawSpecifier==="testing"),p=$c.basename(t).endsWith("_test.go")||s.has("test")||l?"test":"logic",h=new Set([...s,...o]);return{imports:r,exports:Array.from(n.values()),tags:Array.from(h).map(d=>({name:d,kind:"comment-marker"})),category:p}}function hs(t,e){for(let r of t.split(/[\s,&|!()]+/)){let n=r.trim();n&&n!=="ignore"&&e.add(n)}}var Bc,Jc,Kc,xs=m(()=>{"use strict";c();Bc=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,Jc=/^\/\/go:build\s+(.+)$/,Kc=/^\/\/\s*\+build\s+(.+)$/});import Hc from"livescript";function Vc(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 Qc(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Yc(t,e){let r=t.constructor?.name||t.type;if(r==="Import"){let n=t.right?.value;if(typeof n=="string"){let s=L(n);return{fromPath:e,toPath:"",rawSpecifier:s,isStyle:N(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=L(s);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:N(o),type:"require"}}}}return null}function fr(t,e){if(!t||typeof t!="object")return[];let r=[],n=Yc(t,e);n&&r.push(n);for(let s in t){if(Xc.has(s))continue;let o=t[s];if(!(!o||typeof o!="object"))if(Array.isArray(o))for(let i of o)r.push(...fr(i,e));else r.push(...fr(o,e))}return r}function bs(t,e){let r=Vc(e),n=Qc(t,r),s=[];try{s=fr(Hc.ast(e),t)}catch{}return{imports:s,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:n}}var Xc,Ss=m(()=>{"use strict";c();O();et();Xc=new Set(["first_line","first_column","last_line","last_column","line","column"])});import qc from"luaparse";function Zc(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 el(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function tl(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=L(i.raw))}else if(s.type==="StringCallExpression"){let i=s.argument;i?.type==="StringLiteral"&&(o=L(i.raw))}o&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:N(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 rl(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 nl(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 sl(t){let e=t.body,r=rl(e),n=nl(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 Cs(t,e){let r=Zc(e),n=el(t,r),s=[],o=[];try{let i=qc.parse(e);s=tl(i,t),o=sl(i)}catch{}return{imports:s,exports:o,tags:Array.from(r).map(i=>({name:i,kind:"comment-marker"})),category:n}}var vs=m(()=>{"use strict";c();O();et()});async function cl(){return ks??=(async()=>{let{unified:t}=await import("unified"),e=(await import("remark-parse")).default;return t().use(e)})(),ks}function ll(t){let e=t.trim();return e.length===0||e.startsWith("#")||ol.some(r=>e.startsWith(r))}function pl(t,e){let r=t.match(al);return r?r.map(n=>({fromPath:e,toPath:"",rawSpecifier:n,isStyle:!1,type:"static"})):[]}function Es(t,e,r){if(t.type==="link"&&typeof t.url=="string"&&!ll(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(...pl(t.value,e)),Array.isArray(t.children))for(let n of t.children)Es(n,e,r)}async function ws(t,e){let n=(await cl()).parse(e),s=[];Es(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 ol,il,al,ks,Fs=m(()=>{"use strict";c();ol=["http://","https://","mailto:","//"],il="ts|tsx|js|jsx|mjs|cjs|py|go|lua|css|scss|less|styl|coffee|ls|feature|md|mdx|json",al=new RegExp(`(?:\\.{1,2}/)?[\\w.-]+(?:/[\\w.-]+)*\\.(?:${il})\\b`,"g")});import fl from"path";import{parser as ml}from"@lezer/python";function Ps(t,e){let r=[],n=[],s=new Set,o=fl.basename(t).toLowerCase(),a=ml.parse(e).cursor();do switch(a.name){case"Comment":{let p=e.slice(a.from,a.to).match(/#\s*@tag\s+([a-zA-Z0-9_-]+)/);p?.[1]&&s.add(p[1]);break}case"ImportStatement":{for(let p of gl(a.node,e,t))r.push(p);break}case"FunctionDefinition":case"ClassDefinition":{let p=a.node.parent;if(p?.name==="Script"||p?.name==="DecoratedStatement"&&p.parent?.name==="Script"){let d=a.node.getChild("VariableName");d&&n.push({name:e.slice(d.from,d.to)})}break}case"AssignStatement":{if(a.node.parent?.name==="Script"){let p=a.node.firstChild;p?.name==="VariableName"&&n.push({name:e.slice(p.from,p.to)})}break}}while(a.next());let l=xl(o,r,s);return l==="test"&&s.add("test"),{imports:r,exports:n,tags:Array.from(s).map(p=>({name:p,kind:"comment-marker"})),category:l}}function gl(t,e,r){let n=t.firstChild;return n?n.name==="from"?dl(t,e,r):hl(t,e,r):[]}function dl(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=yl(s.nextSibling,e);if(!i.length)return[];let a=0;for(;a<o.length&&o[a]===".";)a++;let l=o.slice(a);if(a===0)return[ge(r,o,i,!0)];let p=a===1?"./":"../".repeat(a-1);return l?[ge(r,p+l.replace(/\./g,"/"),i,!1)]:i[0]==="*"?[ge(r,p.slice(0,-1),["*"],!1)]:i.map(h=>ge(r,p+h,[h],!1))}function hl(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(ge(r,o,["*"],!0))}s=s.nextSibling}return n}function yl(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 ge(t,e,r,n){return{fromPath:t,toPath:"",rawSpecifier:e,isStyle:!1,isExternal:n,type:"static",symbols:r.length>0?r:void 0}}function xl(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=>ul.has(n.rawSpecifier))?"test":"logic"}var ul,Ts=m(()=>{"use strict";c();ul=new Set(["pytest","unittest","nose","hypothesis"])});import y from"typescript";function bl(t){let e=1;function r(n){switch(n.kind){case y.SyntaxKind.IfStatement:case y.SyntaxKind.ConditionalExpression:case y.SyntaxKind.ForStatement:case y.SyntaxKind.ForInStatement:case y.SyntaxKind.ForOfStatement:case y.SyntaxKind.WhileStatement:case y.SyntaxKind.DoStatement:case y.SyntaxKind.CatchClause:case y.SyntaxKind.CaseClause:e++;break;case y.SyntaxKind.BinaryExpression:{let s=n.operatorToken.kind;(s===y.SyntaxKind.AmpersandAmpersandToken||s===y.SyntaxKind.BarBarToken||s===y.SyntaxKind.QuestionQuestionToken)&&e++;break}}y.forEachChild(n,r)}return r(t),e}function Sl(t){let e=0;function r(n,s,o){if(y.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&&(y.isIfStatement(n.elseStatement)?r(n.elseStatement,s,!0):(e+=1,r(n.elseStatement,s+1,!1)));return}if(y.isForStatement(n)||y.isForInStatement(n)||y.isForOfStatement(n)||y.isWhileStatement(n)||y.isDoStatement(n)||y.isSwitchStatement(n)){e+=1+s,y.forEachChild(n,a=>r(a,s+1,!1));return}if(y.isCatchClause(n)){e+=1+s,y.forEachChild(n,a=>r(a,s,!1));return}if(y.isConditionalExpression(n)&&(e+=1),y.isBinaryExpression(n)){let a=n.operatorToken.kind;(a===y.SyntaxKind.AmpersandAmpersandToken||a===y.SyntaxKind.BarBarToken||a===y.SyntaxKind.QuestionQuestionToken)&&(e+=1)}if(s>0&&(y.isFunctionDeclaration(n)||y.isFunctionExpression(n)||y.isArrowFunction(n))){e+=1+s,y.forEachChild(n,a=>r(a,s+1,!1));return}y.forEachChild(n,a=>r(a,s,!1))}return r(t,0,!1),e}function mr(t){return{complexity:bl(t),cognitiveComplexity:Sl(t)}}var Ns=m(()=>{"use strict";c()});import C from"typescript";function Is(t,e){Cl(t,e),kl(t,e),El(t,e),wl(t,e)}function Cl(t,e){if((C.isFunctionDeclaration(t)||C.isVariableDeclaration(t))&&t.name&&C.isIdentifier(t.name)&&vl(t)){let r;if(C.isFunctionDeclaration(t))r="function";else{let n=t.initializer;r=n&&(C.isArrowFunction(n)||C.isFunctionExpression(n))?"function":"variable"}e.tags.add({name:t.name.text,kind:r})}}function vl(t){if(C.isFunctionDeclaration(t))return C.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&C.isSourceFile(e.parent)}function kl(t,e){if(!C.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 El(t,e){if(!C.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 wl(t,e){if(C.isCallExpression(t)&&Fl(t.expression))for(let r of t.arguments)C.isObjectLiteralExpression(r)&&Pl(r,e)}function Fl(t){return C.isIdentifier(t)?ur.has(t.text):!!(C.isPropertyAccessExpression(t)&&(ur.has(t.name.text)||C.isIdentifier(t.expression)&&ur.has(t.expression.text)))}function Pl(t,e){for(let r of t.properties){if(!C.isPropertyAssignment(r)||!C.isIdentifier(r.name)||r.name.text!=="tags"&&r.name.text!=="tag")continue;let{initializer:n}=r,s=C.isArrayLiteralExpression(n)?n.elements.filter(C.isStringLiteral):r.name.text==="tag"&&C.isStringLiteral(n)?[n]:[];for(let o of s)e.tags.add({name:o.text.replace(/^@/,""),kind:"comment-marker"})}}var ur,Ms=m(()=>{"use strict";c();ur=new Set(["test","describe","it"])});import As from"path";import g from"typescript";function gr(t,e,r){let n=[],s=new Map,o=new Set,i=g.createSourceFile(t,e,g.ScriptTarget.Latest,!0,r==="typescript"?g.ScriptKind.TSX:g.ScriptKind.JSX),a={filePath:t,imports:n,exports:s,tags:o,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},l=zr=>{Ml(zr,a),g.forEachChild(zr,l)};l(i);let p=$l(t,a);(p==="test"||p==="barrel")&&o.add({name:p,kind:"comment-marker"}),p!=="test"&&Ul(a,i);let h=i.statements[0],d=h?Rs(h):void 0,{complexity:b,cognitiveComplexity:v}=mr(i),j=Tl(i);return{imports:n,exports:Array.from(s.values()),tags:Array.from(o),category:p,rawCallEdges:a.rawCallEdges??[],complexity:b,cognitiveComplexity:v,...j.length>0?{functions:j}:{},...d!==void 0?{description:d}:{}}}function Tl(t){let e=[],r=(s,o)=>{let{complexity:i,cognitiveComplexity:a}=mr(o),l=t.getLineAndCharacterOfPosition(o.getStart(t)).line+1;e.push({name:s,line:l,complexity:i,cognitiveComplexity:a})},n=(s,o)=>{if(g.isFunctionDeclaration(s)&&s.name&&s.body?r(s.name.text,s):g.isVariableDeclaration(s)&&g.isIdentifier(s.name)&&s.initializer&&(g.isArrowFunction(s.initializer)||g.isFunctionExpression(s.initializer))?r(s.name.text,s.initializer):o&&g.isMethodDeclaration(s)&&g.isIdentifier(s.name)&&s.body?r(`${o}.${s.name.text}`,s):o&&g.isConstructorDeclaration(s)&&s.body?r(`${o}.constructor`,s):o&&g.isGetAccessorDeclaration(s)&&g.isIdentifier(s.name)&&s.body?r(`${o}.get ${s.name.text}`,s):o&&g.isSetAccessorDeclaration(s)&&g.isIdentifier(s.name)&&s.body&&r(`${o}.set ${s.name.text}`,s),g.isClassDeclaration(s)&&s.name){let i=s.name.text;g.forEachChild(s,a=>n(a,i));return}g.forEachChild(s,i=>n(i,o))};return n(t,void 0),e}function Ds(t,e,r,n){let s={name:t},o=Rs(r);o!==void 0&&(s.doc=o);let i=Nl(e);i!==void 0&&(s.flags=i);let a=Il(e,n);return a!==void 0&&(s.signature=a),s}function Rs(t){let e=g.getJSDocCommentsAndTags(t);for(let r of e)if(g.isJSDoc(r)&&r.comment)return g.getTextOfJSDocComment(r.comment)||void 0}function Nl(t){let e=new Set(["deprecated","internal","public","alpha","beta"]),r=g.getJSDocTags(t).map(n=>n.tagName.text).filter(n=>e.has(n));return r.length>0?r:void 0}function Il(t,e){let r=g.createPrinter({removeComments:!0}),n=s=>r.printNode(g.EmitHint.Unspecified,s,e);if(g.isFunctionDeclaration(t)||g.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(g.isVariableDeclaration(t)){if(t.type)return n(t.type);if(t.initializer&&(g.isArrowFunction(t.initializer)||g.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(g.isClassDeclaration(t)&&t.name)return`class ${t.name.text}`;if(g.isInterfaceDeclaration(t))return`interface ${t.name.text}`;if(g.isTypeAliasDeclaration(t))return n(t.type);if(g.isEnumDeclaration(t))return`enum ${t.name.text}`}function Ml(t,e){Al(t,e),Dl(t,e),Ol(t,e),Ll(t,e),zl(t,e),Is(t,e)}function Al(t,e){if(!g.isSourceFile(t))return;let r=t.statements.filter(n=>!g.isEmptyStatement(n));e.totalStatements=r.length,e.exportStatements=r.filter(n=>g.isExportDeclaration(n)||g.isExportAssignment(n)||dr(n)).length}function Dl(t,e){if(g.isJsxElement(t)||g.isJsxSelfClosingElement(t)||g.isJsxFragment(t)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(g.isFunctionDeclaration(t)||g.isMethodDeclaration(t)||g.isArrowFunction(t)||g.isClassDeclaration(t)||g.isVariableStatement(t)||g.isEnumDeclaration(t)){e.hasTypesOnly=!1;return}g.isExportDeclaration(t)&&!Rl(t)&&(e.hasTypesOnly=!1)}function Rl(t){return t.isTypeOnly?!0:!t.exportClause||!g.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function Ol(t,e){if(!g.isImportDeclaration(t)||!t.moduleSpecifier||!g.isStringLiteral(t.moduleSpecifier))return;let r=[];if(t.importClause&&(t.importClause.name&&r.push("default"),t.importClause.namedBindings))if(g.isNamedImports(t.importClause.namedBindings))for(let s of t.importClause.namedBindings.elements)r.push(s.name.text);else g.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:N(t.moduleSpecifier.text),type:n,symbols:r.length>0?r:void 0})}function Ll(t,e){g.isExportDeclaration(t)?Gl(t,e):g.isExportAssignment(t)?e.exports.set("default",{name:"default"}):dr(t)&&Wl(t,e)}function Gl(t,e){if(t.moduleSpecifier&&g.isStringLiteral(t.moduleSpecifier))jl(t,t.moduleSpecifier.text,e);else if(t.exportClause&&g.isNamedExports(t.exportClause))for(let r of t.exportClause.elements){let n=r.name.text;e.exports.set(n,{name:n})}}function jl(t,e,r){let n=_l(t),s={fromPath:r.filePath,toPath:"",rawSpecifier:e,isStyle:N(e),type:"re-export"};n.length>0&&(s.symbols=n),r.imports.push(s)}function _l(t){return t.exportClause?g.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function Wl(t,e){if((g.isFunctionDeclaration(t)||g.isClassDeclaration(t)||g.isInterfaceDeclaration(t)||g.isTypeAliasDeclaration(t)||g.isEnumDeclaration(t))&&t.name){let n=t.name.text;e.exports.set(n,Ds(n,t,t,e.sourceFile));return}if(g.isVariableStatement(t)){for(let n of t.declarationList.declarations)if(g.isIdentifier(n.name)){let s=n.name.text;e.exports.set(s,Ds(s,n,t,e.sourceFile))}}}function zl(t,e){if(!g.isCallExpression(t))return;let r=t.arguments[0];!r||!g.isStringLiteral(r)||(t.expression.kind===g.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:N(r.text),type:"dynamic"}):g.isIdentifier(t.expression)&&t.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:N(r.text),type:"require"}))}function $l(t,e){let r=As.basename(t).toLowerCase(),n=As.extname(t).toLowerCase();return se().some(o=>r.includes(o))?"test":Ur(r)?"config":e.imports.some(o=>ft().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>ut()?"barrel":"logic"}function dr(t){return g.canHaveModifiers(t)&&g.getModifiers(t)?.some(e=>e.kind===g.SyntaxKind.ExportKeyword)===!0}function Ul(t,e){let r=t.rawCallEdges??[];t.rawCallEdges=r;let n=new Map;for(let s of e.statements){if(!g.isImportDeclaration(s)||!g.isStringLiteral(s.moduleSpecifier))continue;let o=s.moduleSpecifier.text,i=s.importClause;if(i&&(i.name&&n.set(i.name.text,o),i.namedBindings&&g.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=Jl(s);if(o){let i=Kl(s);i&&tt(i,o,n,r);continue}g.isClassDeclaration(s)&&s.name&&Bl(s,n,r)}}function Bl(t,e,r){let n=t.name.text;for(let s of t.members)g.isMethodDeclaration(s)&&s.body&&g.isIdentifier(s.name)?tt(s.body,`${n}.${s.name.text}`,e,r):g.isConstructorDeclaration(s)&&s.body&&tt(s.body,`${n}.constructor`,e,r)}function Jl(t){if(dr(t)){if(g.isFunctionDeclaration(t)&&t.name)return t.name.text;if(g.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(g.isIdentifier(e.name)&&e.initializer&&(g.isArrowFunction(e.initializer)||g.isFunctionExpression(e.initializer)))return e.name.text}}}function Kl(t){if(g.isFunctionDeclaration(t))return t.body;if(g.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(e.initializer&&(g.isArrowFunction(e.initializer)||g.isFunctionExpression(e.initializer)))return e.initializer}}function tt(t,e,r,n){if(g.isCallExpression(t)&&g.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})}g.forEachChild(t,s=>tt(s,e,r,n))}var Os=m(()=>{"use strict";c();J();Ns();O();Ms()});function rt(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 Ls=m(()=>{"use strict";c()});import js from"postcss";import*as Hl from"postcss-less";function Gs(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function Ql(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function Xl(t,e){let r=t.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(r){let o=r[1]?.trim()??"",i=r[2]??"";if(!i)return null;let a=_s.has(o)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,...Gs(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",...Gs(s)?{isExternal:!0}:{}}:null}function Yl(t,e){let r=[],n=/url\(['"]?([^'")]+)['"]?\)/g,s=n.exec(t);for(;s!==null;){let o=s[1]?.trim()??"";Ql(o)&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static"}),s=n.exec(t)}return r}function Ws(t,e){let r=[];return t.walk(n=>{if(n.type==="atrule"&&n.name==="import"){let s=Xl(n.params,e);s&&r.push(s)}n.type==="decl"&&r.push(...Yl(n.value,e))}),r}function ql(t){return t.replace(/(?<!:)\/\/.*/g,"")}function Zl(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=_s.has(o)?"side-effect":"static";r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}s=n.exec(t)}return r}function zs(t,e){let r=js.parse(ql(t));return{imports:Ws(r,e),root:r}}function ep(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 $s(t,e){try{let r=Vl.parse(t),{exports:n,tags:s}=ep(r);return{imports:Ws(r,e),root:r,exports:n,tags:s}}catch{return{imports:Zl(t,e),root:js.parse(""),exports:[],tags:[]}}}var Vl,_s,Us=m(()=>{"use strict";c();Vl=Hl,_s=new Set(["reference","inline"])});import{parse as tp}from"postcss-scss";function Bs(t){return t.startsWith("_")||t.startsWith("-")}function rp(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function np(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 sp(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||Bs(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||Bs(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 Js(t,e){let r=tp(t),n=[];r.walk(i=>{if(i.type!=="atrule")return;let{name:a,params:l}=i;if(a!=="import"&&a!=="use"&&a!=="forward")return;let{specifier:p,alias:h}=np(l);if(!p)return;let d={fromPath:e,toPath:"",rawSpecifier:p,isStyle:!0,type:a==="forward"?"re-export":"static",...rp(p)?{isExternal:!0}:{}};h&&(d.symbols=[h]),n.push(d)});let{exports:s,tags:o}=sp(r);return{imports:n,root:r,exports:s,tags:o}}var Ks=m(()=>{"use strict";c()});function Hs(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 Vs(t,e){if(e.length===0)return"ui";try{let r=pt("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 Qs=m(()=>{"use strict";c()});function de(t,e){let r=R(t);if(r==="stylus"){let o=Hs(e,t);return{imports:o,exports:[],tags:[],category:Vs(e,o)}}if(r==="scss"){let{imports:o,root:i,exports:a,tags:l}=Js(e,t);return{imports:o,exports:a,tags:l,category:rt(i,o)}}if(r==="less"){let{imports:o,root:i,exports:a,tags:l}=$s(e,t);return{imports:o,exports:a,tags:l,category:rt(i,o)}}let{imports:n,root:s}=zs(e,t);return{imports:n,exports:[],tags:[],category:rt(s,n)}}var Xs=m(()=>{"use strict";c();O();Ls();Us();Ks();Qs()});async function Ys(t,e){let r=R(t),n=Tn(r);return n?n(t,e):{imports:[],exports:[],tags:[],category:"other"}}var qs=m(()=>{"use strict";c();O();gs();ds();xs();Ss();vs();Fs();Ts();Os();me();Xs();J();O();me();for(let[t,e]of[["javascript",(r,n)=>gr(r,n,"javascript")],["typescript",(r,n)=>gr(r,n,"typescript")],["css",de],["scss",de],["less",de],["stylus",de],["coffeescript",us],["livescript",bs],["lua",Cs],["python",Ps],["go",ys],["gherkin",pr],["markdown",ws]])Q(t,e)});import Zs from"path";function to(t,e){for(let r of t.values()){let n=e.get(r.path);n!==void 0&&(r.coveragePct=n)}}function ro(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 no(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 so(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 eo(t){return Math.round(t*1e4)/1e4}function oo(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=eo(Math.min(1,o)),r.push(n.exportUsageRatio)}r.length>0&&(e.avgExportUsage=eo(r.reduce((n,s)=>n+s,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 op(t,e){let r=e.toPath,n=Zs.basename(r,Zs.extname(r)).replace(/\.(test|spec)$/,"");hr(t.tags,n,"import")}function ip(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let r of e.symbols)hr(t.tags,r,"import")}function ap(t,e,r){let n=r.get(e.toPath);if(!(!n||n.category==="test"))for(let s of n.tags)s.kind==="comment-marker"&&hr(t.tags,s.name,"comment-marker")}function io(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports)!r.toPath||r.isExternal||(op(e,r),ip(e,r),ap(e,r,t))}var ao=m(()=>{"use strict";c()});import po from"fs";import ne from"path";function cp(t,e){let r=t.split(`
23
- `),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("=>")){co(a,e,s);continue}!o&&/^replace\s+/.test(a)&&a.includes("=>")&&co(a.replace(/^replace\s+/,""),e,s)}return{mod:n,replaces:s}}function co(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=ne.isAbsolute(s)?s:ne.resolve(e,s);r.set(o,i)}function lo(t){let e;try{e=po.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:ne.join(t,n.name),isExternal:!1})).sort((n,s)=>n.path.localeCompare(s.path));return r.length>0?r:null}var he,fo=m(()=>{"use strict";c();he=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 lo(a);if(r!==o&&!r.startsWith(`${o}/`))return null;let l=r.slice(o.length).replace(/^\//,"");return l?lo(ne.join(n,l)):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=po.readFileSync(ne.join(e,"go.mod"),"utf-8"),o=cp(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 ne.join(o,i)}}}}});import lp from"fs";import yr from"path";var ye,mo=m(()=>{"use strict";c();ye=class{extensions=[".lua"];resolve(e,r,n,s){let o=r.replace(/\./g,yr.sep),i=[n,yr.join(n,"lib")];for(let a of i){if(!lp.existsSync(a))continue;let l=s(yr.join(a,"_dummy.lua"),o);if(l)return[l]}return null}}});import pp from"path";var xe,uo=m(()=>{"use strict";c();xe=class{extensions=[".md",".mdx"];resolve(e,r,n,s){let o=s(pp.join(n,"_dummy"),`./${r}`);return o?[o]:null}}});import fp from"fs";import xr from"path";function go(t){try{return fp.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var be,ho=m(()=>{"use strict";c();be=class{extensions=[".py"];resolve(e,r,n,s){let o=r.replace(/\./g,xr.sep),i=xr.join(n,`${o}.py`);if(go(i))return[{path:i,isExternal:!1}];let a=xr.join(n,o,"__init__.py");return go(a)?[{path:a,isExternal:!1}]:null}}});import yo from"path";var mp,Se,xo=m(()=>{"use strict";c();mp=["~","http://","https://","//","data:","sass:"],Se=class{extensions=[".css",".scss",".sass",".less",".styl"];resolve(e,r,n,s){if(mp.some(h=>r.startsWith(h)))return null;let o=s(e,r);if(o)return[o];let i=yo.dirname(r),a=yo.basename(r),l=i==="."?`_${a}`:`${i}/_${a}`,p=s(e,l);return p?[p]:null}}});var bo=m(()=>{"use strict";c();fo();mo();uo();ho();xo()});import nt from"fs";import G from"path";var U,br=m(()=>{"use strict";c();bo();U=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 be,new ye,new he,new Se,new xe]}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=G.dirname(e),s=r.startsWith("/")?r:G.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 l=s.slice(0,-a[0].length);for(let p of[".ts",".tsx"]){let h=this.tryExtensions(l,p,o);if(h)return h}}for(let l of i){let p=this.tryExtensions(s,l,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=G.join(e,`index${r}`);if(this.isFile(o))return{path:o,isExternal:n};if(r===".py"){let i=G.join(e,"__init__.py");if(this.isFile(i))return{path:i,isExternal:n}}return null}isFile(e){try{return nt.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=G.join(r,"tsconfig.json");if(nt.existsSync(n))try{let o=JSON.parse(nt.readFileSync(n,"utf-8")).compilerOptions?.paths;if(!o)continue;for(let i in o){let a=this.matchAliasPattern(i,e);if(a){let l=this.tryAliasSubstitutions(o[i],a[1]||"",r);if(l)return l}}}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=G.resolve(n,i);for(let l of s){let p=this.tryExtensions(a,l,!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 l=G.join(n,a);try{if(nt.statSync(l,{throwIfNoEntry:!1})?.isFile())return{...o,path:l}}catch{}}return{...o,path:n}}let i=this.resolveLocalPath(G.join(n,"_dummy"),s.slice(1));return i?{...o,path:i.path}:null}return null}}});import Ce from"fs";import F from"path";import up from"piscina";function hp(t,e){if(t.length===0)return e;let r=t.map(i=>F.dirname(i).split(F.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(F.sep)||F.sep,o=F.relative(e,s);return o.startsWith("..")||F.isAbsolute(o)?e:s}var gp,So,dp,ve,Co=m(()=>{"use strict";c();cr();J();ls();qs();ao();ae();br();gp=["tests","test","__tests__","specs","spec"],So=new Set(["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"]),dp=20;ve=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 U(e),this.lockFile=cs(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=>F.isAbsolute(n)?n:F.resolve(this.rootDir,n));await this.initPool(),this.enableGitStats&&(this.gitStatsMap=os(this.rootDir));try{for(let n of r)this.enqueue(n);return await this.drain(),await this.processTestFiles(hp(r,this.rootDir)),await this.processDocFiles(),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
22
+ `;return`${p+y+d+i}
23
+ ${f}`}}});import ko from"path";import wo from"typescript";var ml,ot,Eo=u(()=>{"use strict";l();ie();ml=/\/\/ <mokosh-tags>[\s\S]*?\/\/ <\/mokosh-tags>\n*/,ot=class{name="vitest";canHandle(e){return O.has(ko.extname(e).toLowerCase())}apply(e,r,n){let o=r.replace(ml,""),s=wo.createSourceFile(ko.basename(e),o,wo.ScriptTarget.Latest,!0),i=fr(s),[a]=i;if(!a)return o;let c=mr(a,"tags",s),p=[...n].sort();if(c!==null&&JSON.stringify([...c].sort())===JSON.stringify(p))return o;let f=i.flatMap(d=>{let y=n.length===0?gr(d,"tags",s):ur(d,"tags",hr(p),s);return y?[y]:[]});return f.length>0?dr(o,f):o}}});import vr from"path";import st from"typescript";function gl(t){let e=st.createSourceFile("detect.ts",t,st.ScriptTarget.Latest,!0);for(let r of e.statements){if(!st.isImportDeclaration(r)||!st.isStringLiteral(r.moduleSpecifier))continue;let n=ul[r.moduleSpecifier.text];if(n)return n}return null}function Fo(t="vitest",e={},r=process.cwd()){return[new Ze,new nt,new et,new kr(r,t,Object.entries(e))]}function To(t,e){return e.find(r=>r.canHandle(t))??null}var No,ul,kr,Po=u(()=>{"use strict";l();go();ho();xo();bo();So();Co();vo();ie();Eo();No={vitest:()=>new ot,playwright:()=>new rt,cypress:()=>new qe,jest:()=>new tt},ul={"@playwright/test":"playwright",cypress:"cypress","@jest/globals":"jest",vitest:"vitest"};kr=class{constructor(e,r,n){this.rootDir=e;this.defaultFramework=r;this.frameworkOverrides=n}rootDir;defaultFramework;frameworkOverrides;name="auto";canHandle(e){return O.has(vr.extname(e).toLowerCase())}apply(e,r,n){let o=gl(r)??this.matchOverride(e)??this.defaultFramework;return(No[o]??No.vitest)().apply(e,r,n)}matchOverride(e){let r=vr.relative(this.rootDir,e).split(vr.sep).join("/");for(let[n,o]of this.frameworkOverrides)if(yo(n,r))return o;return null}}});import Io from"fs/promises";import dl from"path";async function bl(t,e,r,n){let o;try{o=await Io.readFile(t,"utf8")}catch(a){return{path:t,status:"error",error:String(a)}}let s=To(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 Io.writeFile(t,i,"utf8"),{path:t,status:"updated"})}async function wr(t,e,r){let n=re(e),o=n.tagApplier?.framework??"vitest",s=n.tagApplier?.frameworkOverrides??{},i=Fo(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 x of c.tags)yl.has(x.kind)&&hl.test(x.name)&&(xl.has(x.name.toLowerCase())||p.has(x.name)||(p.add(x.name),f.push(x.name)));f.sort();let d=dl.resolve(e,c.path),y=await bl(d,f,r.dryRun,i);y.path=c.path,a.files.push(y),y.status==="updated"?a.updated++:y.status==="unchanged"?a.unchanged++:a.errors++}return a}var hl,yl,xl,Do=u(()=>{"use strict";l();Et();Po();hl=/^[a-zA-Z][a-zA-Z0-9_-]{1,}$/,yl=new Set(["import"]),xl=new Set(["common","fixture","fixtures","helper","helpers","index","main","mock","mocks","setup","shared","spec","test","tests","types","util","utils"])});var it,Er=u(()=>{"use strict";l();it=class{isTestNode(e){return e.category==="test"||e.tags.some(r=>r.name==="test")}}});import{execFileSync as Nr}from"child_process";function Ro(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 Lo(t){let e=new Map;try{let r=Nr("git",["-C",t,"log","--since=90 days ago","--name-status","-M",`--format=${Mo}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],maxBuffer:Ao});Ro(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=Nr("git",["-C",t,"log","--name-status","-M",`--format=${Mo}`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],maxBuffer:Ao});Ro(r,(n,o,s)=>{e.has(n)||e.set(n,{commitCount90d:0,lastAuthor:void 0,lastCommitAt:s||void 0})})}catch{}return e}var at,Mo,Ao,Fr=u(()=>{"use strict";l();at=class{getChangedFiles(){try{let r=[["diff","--name-only"],["diff","--cached","--name-only"],["ls-files","--others","--exclude-standard"]].flatMap(n=>{try{return Nr("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),[]}}},Mo="%x00%H%x09%ae%x09%at",Ao=256*1024*1024});import Oo from"path";function W(t){switch(Oo.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=Oo.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 ct=u(()=>{"use strict";l()});import Sl from"coffeescript";function jo(t){if(t){if(typeof t.originalValue=="string")return t.originalValue;if(typeof t.value=="string")return $(t.value)}}function Q(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function Cl(t,e){let r=jo(e.source);return r?{fromPath:t,toPath:"",rawSpecifier:r,isStyle:A(r),type:"static"}:null}function vl(t,e){let r=e.variable?.base?.value==="require",n=jo(e.args?.[0]?.base);return!r||!n?null:{fromPath:t,toPath:"",rawSpecifier:n,isStyle:A(n),type:"require"}}function Go(t,e){if(e)return[{name:e}];let r=t.value;if(r?.constructor?.name==="Class"){let o=Q(r.variable);return o?[{name:o}]:[]}if(r?.base?.constructor?.name==="Obj"&&Array.isArray(r.base.properties))return r.base.properties.map(o=>Q(o.variable)??Q(o)).filter(o=>!!o).map(o=>({name:o}));let n=Q(r);return n?[{name:n}]:[]}function kl(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=Q(t.variable)??Q(t.variable?.base);return e?[{name:e}]:[]}function wl(t,e,r,n){let o=e.constructor?.name;if(o==="ImportDeclaration"){let s=Cl(t,e);s&&r.push(s)}else if(o==="Call"){let s=vl(t,e);s&&r.push(s)}else if(o==="Assign"){let s=Q(e.variable?.base),i=e.variable?.properties?.[0]?.name?.value;s==="module"&&i==="exports"?n.push(...Go(e,void 0)):s==="exports"&&typeof i=="string"&&n.push(...Go(e,i))}else o==="ExportNamedDeclaration"&&e.clause?n.push(...kl(e.clause)):o==="ExportDefaultDeclaration"&&n.push({name:"default"})}function Tr(t,e,r,n){if(!(!e||typeof e!="object")){wl(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)Tr(t,i,r,n);else Tr(t,s,r,n)}}}function _o(t,e){let r=ae(e),n=ce(t,r),o=[],s=[];try{Tr(t,Sl.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 Wo=u(()=>{"use strict";l();z();ct()});import{AstBuilder as El,GherkinClassicTokenMatcher as Nl,Parser as Fl}from"@cucumber/gherkin";import{IdGenerator as Tl}from"@cucumber/messages";function Pr(t,e){let r=new Set;try{let n=new El(Pl),o=new Nl,i=new Fl(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 Pl,zo=u(()=>{"use strict";l();be();Pl=Tl.uuid();se("gherkin",Pr)});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 Ir=u(()=>{"use strict";l()});function Il(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 Dl(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,y=f[1];y&&y.type.name!=="Block"&&n(y,d,!1);let x=f.find(C=>C.type.name==="Block");x&&n(x,d,!1);let k=f.findIndex(C=>C.type.name==="else");if(k>=0){let C=f[k+1];C?.type.name==="IfStatement"?n(C,s,!0):C&&(r+=1,n(C,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 lt(t,e){return{complexity:Il(t,e),cognitiveComplexity:Dl(t,e)}}function Dr(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 $o(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}=lt(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=Dr(n.node,e),a=i?`${i}.${s}`:s,{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 Uo=u(()=>{"use strict";l();Ir()});import Ml from"path";import{parser as Al}from"@lezer/go";function Jo(t,e){let r=[],n=new Map,o=new Set,s=new Set,i=new Map,a=Al.parse(e),c=a.cursor();do switch(c.name){case"LineComment":{let E=e.slice(c.from,c.to),I=E.match(Rl);I?.[1]&&o.add(I[1]);let G=E.match(Ll);G&&Bo(G[1],s);let j=E.match(Ol);j&&Bo(j[1],s);break}case"ImportSpec":{let E=c.node.getChild("String");if(E){let G=e.slice(E.from,E.to).slice(1,-1);r.push({fromPath:t,toPath:"",rawSpecifier:G,isExternal:!0,isStyle:!1,type:"static"});let j=c.node.getChild("DefName"),ee=j?e.slice(j.from,j.to):G.split("/").pop();ee&&ee!=="_"&&ee!=="."&&i.set(ee,G)}break}case"FunctionDecl":case"MethodDecl":case"TypeDecl":case"VarDecl":case"ConstDecl":{let E=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(E){let I=e.slice(E.from,E.to);I!=="_"&&/^[A-Z]/.test(I)&&!n.has(I)&&n.set(I,{name:I})}break}}while(c.next());let p=r.some(E=>E.rawSpecifier==="testing"),f=Ml.basename(t).endsWith("_test.go")||o.has("test")||p?"test":"logic",d=new Set([...o,...s]),{complexity:y,cognitiveComplexity:x}=lt(a.topNode,e),k=$o(a,e),C=f==="test"?[]:Gl(a,e,i);return{imports:r,exports:Array.from(n.values()),tags:Array.from(d).map(E=>({name:E,kind:"comment-marker"})),category:f,rawCallEdges:C,complexity:y,cognitiveComplexity:x,...k.length>0?{functions:k}:{}}}function Gl(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 y=e.slice(f.from,f.to),x=r.get(y);if(x){let k=e.slice(d.from,d.to);n.push({from:a,to:k,toSpecifier:x})}}}}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=Dr(s.node,e);o(a,p?`${p}.${c}`:c)}}while(s.next());return n}function Bo(t,e){for(let r of t.split(/[\s,&|!()]+/)){let n=r.trim();n&&n!=="ignore"&&e.add(n)}}var Rl,Ll,Ol,Ko=u(()=>{"use strict";l();Uo();Rl=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,Ll=/^\/\/go:build\s+(.+)$/,Ol=/^\/\/\s*\+build\s+(.+)$/});import jl from"livescript";function Y(t){if(t){if(typeof t.value=="string")return t.value;if(typeof t.base?.value=="string")return t.base.value}}function _l(t){if(!t)return[];if(t.constructor?.name==="Class"){let r=Y(t.title);return r?[{name:r}]:[]}if(t.constructor?.name==="Obj"&&Array.isArray(t.items))return t.items.map(r=>Y(r.key)??Y(r.val)).filter(r=>!!r).map(r=>({name:r}));let e=Y(t);return e?[{name:e}]:[]}function Wl(t){let e=t.constructor?.name||t.type;if(e==="Assign"&&t.left?.constructor?.name==="Chain"){let r=t.left,n=Y(r.head),s=r.tails?.[0]?.key?.name;if(n==="module"&&s==="exports")return _l(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=>Y(n.val)??Y(n.key)).filter(n=>!!n).map(n=>({name:n}))}return[]}function $l(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 Mr(t,e,r){if(!t||typeof t!="object")return[];let n=[],o=$l(t,e);o&&n.push(o),r.push(...Wl(t));for(let s in t){if(zl.has(s))continue;let i=t[s];if(!(!i||typeof i!="object"))if(Array.isArray(i))for(let a of i)n.push(...Mr(a,e,r));else n.push(...Mr(i,e,r))}return n}function Ho(t,e){let r=ae(e),n=ce(t,r),o=[],s=[];try{o=Mr(jl.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 zl,Vo=u(()=>{"use strict";l();z();ct();zl=new Set(["first_line","first_column","last_line","last_column","line","column"])});import Ul from"luaparse";function Bl(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 Jl(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 Kl(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 Hl(t){let e=t.body,r=Jl(e),n=Kl(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 Qo(t,e){let r=ae(e),n=ce(t,r),o=[],s=[];try{let i=Ul.parse(e);o=Bl(i,t),s=Hl(i)}catch{}return{imports:o,exports:s,tags:Array.from(r).map(i=>({name:i,kind:"comment-marker"})),category:n}}var Xo=u(()=>{"use strict";l();z();ct()});async function Yl(){return Yo??=(async()=>{let{unified:t}=await import("unified"),e=(await import("remark-parse")).default;return t().use(e)})(),Yo}function ql(t){let e=t.trim();return e.length===0||e.startsWith("#")||Vl.some(r=>e.startsWith(r))}function Zl(t,e){let r=t.match(Xl);return r?r.map(n=>({fromPath:e,toPath:"",rawSpecifier:n,isStyle:!1,type:"static"})):[]}function qo(t,e,r){if(t.type==="link"&&typeof t.url=="string"&&!ql(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(...Zl(t.value,e)),Array.isArray(t.children))for(let n of t.children)qo(n,e,r)}async function Zo(t,e){let n=(await Yl()).parse(e),o=[];qo(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 Vl,Ql,Xl,Yo,es=u(()=>{"use strict";l();Vl=["http://","https://","mailto:","//"],Ql="ts|tsx|js|jsx|mjs|cjs|py|go|lua|css|scss|less|styl|coffee|ls|feature|md|mdx|json",Xl=new RegExp(`(?:\\.{1,2}/)?[\\w.-]+(?:/[\\w.-]+)*\\.(?:${Ql})\\b`,"g")});function ep(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 tp(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 y=p>0;e+=y?1:1+o;let x=y?o:o+1,k=c[f+1],C=c[f+2];k&&r(k,x),C&&r(C,x),p++,f+=3}else if(d?.type.name==="else"){e+=1;let y=c[f+1];y&&r(y,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 Ar(t){return{complexity:ep(t),cognitiveComplexity:tp(t)}}function ts(t,e){let r=[];function n(i,a){let{complexity:c,cognitiveComplexity:p}=Ar(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"),y=d?e.slice(d.from,d.to):void 0;y&&n(f,c?`${c}.${y}`:y),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 rs=u(()=>{"use strict";l();Ir()});import rp from"path";import{parser as np}from"@lezer/python";function ns(t,e){let r=[],n=[],o=new Set,s=rp.basename(t).toLowerCase(),i=np.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]&&o.add(x[1]);break}case"ImportStatement":{for(let x of sp(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=fp(s,r,o);c==="test"&&o.add("test");let{complexity:p,cognitiveComplexity:f}=Ar(i.topNode),d=ts(i,e),y=c==="test"?[]:pp(i,e);return{imports:r,exports:n,tags:Array.from(o).map(x=>({name:x,kind:"comment-marker"})),category:c,rawCallEdges:y,complexity:p,cognitiveComplexity:f,...d.length>0?{functions:d}:{}}}function sp(t,e,r){let n=t.firstChild;return n?n.name==="from"?ip(t,e,r):ap(t,e,r):[]}function ip(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=cp(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 ap(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 cp(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 lp(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 y=e.slice(d.from,d.to),x=y;if(d.nextSibling?.type.name==="as"){let C=d.nextSibling.nextSibling;C?.type.name==="VariableName"&&(x=e.slice(C.from,C.to),d=C)}let k=c===0?a:p?f+p.replace(/\./g,"/"):f+y;r.set(x,k)}d=d.nextSibling}}while(n.next());return r}function pp(t,e){let r=lp(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),y=r.get(d);y&&n.push({from:c,to:d,toSpecifier:y})}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 y=d.getChild("VariableName"),x=y?e.slice(y.from,y.to):void 0;x&&o(d,p?`${p}.${x}`:x)}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 fp(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=>op.has(n.rawSpecifier))?"test":"logic"}var op,os=u(()=>{"use strict";l();rs();op=new Set(["pytest","unittest","nose","hypothesis"])});import b from"typescript";function mp(t){let e=1;function r(n){switch(n.kind){case b.SyntaxKind.IfStatement:case b.SyntaxKind.ConditionalExpression:case b.SyntaxKind.ForStatement:case b.SyntaxKind.ForInStatement:case b.SyntaxKind.ForOfStatement:case b.SyntaxKind.WhileStatement:case b.SyntaxKind.DoStatement:case b.SyntaxKind.CatchClause:case b.SyntaxKind.CaseClause:e++;break;case b.SyntaxKind.BinaryExpression:{let o=n.operatorToken.kind;(o===b.SyntaxKind.AmpersandAmpersandToken||o===b.SyntaxKind.BarBarToken||o===b.SyntaxKind.QuestionQuestionToken)&&e++;break}}b.forEachChild(n,r)}return r(t),e}function up(t){let e=0;function r(n,o,s){if(b.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&&(b.isIfStatement(n.elseStatement)?r(n.elseStatement,o,!0):(e+=1,r(n.elseStatement,o+1,!1)));return}if(b.isForStatement(n)||b.isForInStatement(n)||b.isForOfStatement(n)||b.isWhileStatement(n)||b.isDoStatement(n)||b.isSwitchStatement(n)){e+=1+o,b.forEachChild(n,a=>r(a,o+1,!1));return}if(b.isCatchClause(n)){e+=1+o,b.forEachChild(n,a=>r(a,o,!1));return}if(b.isConditionalExpression(n)&&(e+=1),b.isBinaryExpression(n)){let a=n.operatorToken.kind;(a===b.SyntaxKind.AmpersandAmpersandToken||a===b.SyntaxKind.BarBarToken||a===b.SyntaxKind.QuestionQuestionToken)&&(e+=1)}if(o>0&&(b.isFunctionDeclaration(n)||b.isFunctionExpression(n)||b.isArrowFunction(n))){e+=1+o,b.forEachChild(n,a=>r(a,o+1,!1));return}b.forEachChild(n,a=>r(a,o,!1))}return r(t,0,!1),e}function Rr(t){return{complexity:mp(t),cognitiveComplexity:up(t)}}var ss=u(()=>{"use strict";l()});import w from"typescript";function is(t,e){gp(t,e),hp(t,e),yp(t,e),xp(t,e)}function gp(t,e){if((w.isFunctionDeclaration(t)||w.isVariableDeclaration(t))&&t.name&&w.isIdentifier(t.name)&&dp(t)){let r;if(w.isFunctionDeclaration(t))r="function";else{let n=t.initializer;r=n&&(w.isArrowFunction(n)||w.isFunctionExpression(n))?"function":"variable"}e.tags.add({name:t.name.text,kind:r})}}function dp(t){if(w.isFunctionDeclaration(t))return w.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&w.isSourceFile(e.parent)}function hp(t,e){if(!w.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 yp(t,e){if(!w.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 xp(t,e){if(w.isCallExpression(t)&&bp(t.expression))for(let r of t.arguments)w.isObjectLiteralExpression(r)&&Sp(r,e)}function bp(t){return w.isIdentifier(t)?Lr.has(t.text):!!(w.isPropertyAccessExpression(t)&&(Lr.has(t.name.text)||w.isIdentifier(t.expression)&&Lr.has(t.expression.text)))}function Sp(t,e){for(let r of t.properties){if(!w.isPropertyAssignment(r)||!w.isIdentifier(r.name)||r.name.text!=="tags"&&r.name.text!=="tag")continue;let{initializer:n}=r,o=w.isArrayLiteralExpression(n)?n.elements.filter(w.isStringLiteral):r.name.text==="tag"&&w.isStringLiteral(n)?[n]:[];for(let s of o)e.tags.add({name:s.text.replace(/^@/,""),kind:"comment-marker"})}}var Lr,as=u(()=>{"use strict";l();Lr=new Set(["test","describe","it"])});import cs from"path";import h from"typescript";function Or(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=C=>{wp(C,a),h.forEachChild(C,c)};c(i);let p=Lp(t,a);(p==="test"||p==="barrel")&&s.add({name:p,kind:"comment-marker"}),p!=="test"&&Op(a,i);let f=i.statements[0],d=f?ps(f):void 0,{complexity:y,cognitiveComplexity:x}=Rr(i),k=Cp(i);return{imports:n,exports:Array.from(o.values()),tags:Array.from(s),category:p,rawCallEdges:a.rawCallEdges??[],complexity:y,cognitiveComplexity:x,...k.length>0?{functions:k}:{},...d!==void 0?{description:d}:{}}}function Cp(t){let e=[],r=(o,s)=>{let{complexity:i,cognitiveComplexity:a}=Rr(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 ls(t,e,r,n){let o={name:t},s=ps(r);s!==void 0&&(o.doc=s);let i=vp(e);i!==void 0&&(o.flags=i);let a=kp(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 vp(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 kp(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 wp(t,e){Ep(t,e),Np(t,e),Tp(t,e),Pp(t,e),Rp(t,e),is(t,e)}function Ep(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)||Gr(n)).length}function Np(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)&&!Fp(t)&&(e.hasTypesOnly=!1)}function Fp(t){return t.isTypeOnly?!0:!t.exportClause||!h.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function Tp(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 Pp(t,e){h.isExportDeclaration(t)?Ip(t,e):h.isExportAssignment(t)?e.exports.set("default",{name:"default"}):Gr(t)&&Ap(t,e)}function Ip(t,e){if(t.moduleSpecifier&&h.isStringLiteral(t.moduleSpecifier))Dp(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 Dp(t,e,r){let n=Mp(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 Mp(t){return t.exportClause?h.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function Ap(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,ls(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,ls(o,n,t,e.sourceFile))}}}function Rp(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 Lp(t,e){let r=cs.basename(t).toLowerCase(),n=cs.extname(t).toLowerCase();return fe().some(s=>r.includes(s))?"test":un(r)?"config":e.imports.some(s=>St().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>vt()?"barrel":"logic"}function Gr(t){return h.canHaveModifiers(t)&&h.getModifiers(t)?.some(e=>e.kind===h.SyntaxKind.ExportKeyword)===!0}function Op(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=jp(o);if(s){let i=_p(o);i&&pt(i,s,n,r);continue}h.isClassDeclaration(o)&&o.name&&Gp(o,o.name.text,n,r)}}function Gp(t,e,r,n){for(let o of t.members)h.isMethodDeclaration(o)&&o.body&&h.isIdentifier(o.name)?pt(o.body,`${e}.${o.name.text}`,r,n):h.isConstructorDeclaration(o)&&o.body&&pt(o.body,`${e}.constructor`,r,n)}function jp(t){if(Gr(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 _p(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 pt(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=>pt(o,e,r,n))}var fs=u(()=>{"use strict";l();te();ss();z();as()});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 ms=u(()=>{"use strict";l()});import gs from"postcss";import*as Wp from"postcss-less";function us(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function $p(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function Up(t,e){let r=t.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(r){let s=r[1]?.trim()??"",i=r[2]??"";if(!i)return null;let a=ds.has(s)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,...us(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",...us(o)?{isExternal:!0}:{}}:null}function Bp(t,e){let r=[],n=/url\(['"]?([^'")]+)['"]?\)/g,o=n.exec(t);for(;o!==null;){let s=o[1]?.trim()??"";$p(s)&&r.push({fromPath:e,toPath:"",rawSpecifier:s,isStyle:!0,type:"static"}),o=n.exec(t)}return r}function hs(t,e){let r=[];return t.walk(n=>{if(n.type==="atrule"&&n.name==="import"){let o=Up(n.params,e);o&&r.push(o)}n.type==="decl"&&r.push(...Bp(n.value,e))}),r}function Jp(t){return t.replace(/(?<!:)\/\/.*/g,"")}function Kp(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=ds.has(s)?"side-effect":"static";r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}o=n.exec(t)}return r}function ys(t,e){let r=gs.parse(Jp(t));return{imports:hs(r,e),root:r}}function Hp(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 xs(t,e){try{let r=zp.parse(t),{exports:n,tags:o}=Hp(r);return{imports:hs(r,e),root:r,exports:n,tags:o}}catch{return{imports:Kp(t,e),root:gs.parse(""),exports:[],tags:[]}}}var zp,ds,bs=u(()=>{"use strict";l();zp=Wp,ds=new Set(["reference","inline"])});import{parse as Vp}from"postcss-scss";function Ss(t){return t.startsWith("_")||t.startsWith("-")}function Qp(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function Xp(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 Yp(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||Ss(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||Ss(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 Cs(t,e){let r=Vp(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}=Xp(c);if(!p)return;let d={fromPath:e,toPath:"",rawSpecifier:p,isStyle:!0,type:a==="forward"?"re-export":"static",...Qp(p)?{isExternal:!0}:{}};f&&(d.symbols=[f]),n.push(d)});let{exports:o,tags:s}=Yp(r);return{imports:n,root:r,exports:o,tags:s}}var vs=u(()=>{"use strict";l()});function ks(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 ws(t,e){if(e.length===0)return"ui";try{let r=bt("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 Es=u(()=>{"use strict";l()});function ke(t,e){let r=W(t);if(r==="stylus"){let s=ks(e,t);return{imports:s,exports:[],tags:[],category:ws(e,s)}}if(r==="scss"){let{imports:s,root:i,exports:a,tags:c}=Cs(e,t);return{imports:s,exports:a,tags:c,category:ft(i,s)}}if(r==="less"){let{imports:s,root:i,exports:a,tags:c}=xs(e,t);return{imports:s,exports:a,tags:c,category:ft(i,s)}}let{imports:n,root:o}=ys(e,t);return{imports:n,exports:[],tags:[],category:ft(o,n)}}var Ns=u(()=>{"use strict";l();z();ms();bs();vs();Es()});async function Fs(t,e){let r=W(t),n=ao(r);return n?n(t,e):{imports:[],exports:[],tags:[],category:"other"}}var Ts=u(()=>{"use strict";l();z();Wo();zo();Ko();Vo();Xo();es();os();fs();be();Ns();te();z();be();for(let[t,e]of[["javascript",(r,n)=>Or(r,n,"javascript")],["typescript",(r,n)=>Or(r,n,"typescript")],["css",ke],["scss",ke],["less",ke],["stylus",ke],["coffeescript",_o],["livescript",Ho],["lua",Qo],["python",ns],["go",Jo],["gherkin",Pr],["markdown",Zo]])se(t,e)});import Ps from"path";function Ds(t,e){for(let r of t.values()){let n=e.get(r.path);n!==void 0&&(r.coveragePct=n)}}function Ms(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 As(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 Rs(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 Is(t){return Math.round(t*1e4)/1e4}function Ls(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=Is(Math.min(1,s)),r.push(n.exportUsageRatio)}r.length>0&&(e.avgExportUsage=Is(r.reduce((n,o)=>n+o,0)/r.length),e.maxExportUsage=Math.max(...r))}}function jr(t,e,r){e&&(t.some(n=>n.name===e&&n.kind===r)||t.push({name:e,kind:r}))}function qp(t,e){let r=e.toPath,n=Ps.basename(r,Ps.extname(r)).replace(/\.(test|spec)$/,"");jr(t.tags,n,"import")}function Zp(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let r of e.symbols)jr(t.tags,r,"import")}function ef(t,e,r){let n=r.get(e.toPath);if(!(!n||n.category==="test"))for(let o of n.tags)o.kind==="comment-marker"&&jr(t.tags,o.name,"comment-marker")}function Os(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports)!r.toPath||r.isExternal||(qp(e,r),Zp(e,r),ef(e,r,t))}var Gs=u(()=>{"use strict";l()});import Ws from"fs";import le from"path";function tf(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("=>")){js(a,e,o);continue}!s&&/^replace\s+/.test(a)&&a.includes("=>")&&js(a.replace(/^replace\s+/,""),e,o)}return{mod:n,replaces:o}}function js(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 _s(t){let e;try{e=Ws.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,zs=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 _s(a);if(r!==s&&!r.startsWith(`${s}/`))return null;let c=r.slice(s.length).replace(/^\//,"");return c?_s(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=Ws.readFileSync(le.join(e,"go.mod"),"utf-8"),s=tf(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 rf from"fs";import _r from"path";var Ee,$s=u(()=>{"use strict";l();Ee=class{extensions=[".lua"];resolve(e,r,n,o){let s=r.replace(/\./g,_r.sep),i=[n,_r.join(n,"lib")];for(let a of i){if(!rf.existsSync(a))continue;let c=o(_r.join(a,"_dummy.lua"),s);if(c)return[c]}return null}}});import nf from"path";var Ne,Us=u(()=>{"use strict";l();Ne=class{extensions=[".md",".mdx"];resolve(e,r,n,o){let s=o(nf.join(n,"_dummy"),`./${r}`);return s?[s]:null}}});import of from"fs";import Wr from"path";function Bs(t){try{return of.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Fe,Js=u(()=>{"use strict";l();Fe=class{extensions=[".py"];resolve(e,r,n,o){let s=r.replace(/\./g,Wr.sep),i=Wr.join(n,`${s}.py`);if(Bs(i))return[{path:i,isExternal:!1}];let a=Wr.join(n,s,"__init__.py");return Bs(a)?[{path:a,isExternal:!1}]:null}}});import Ks from"path";var sf,Te,Hs=u(()=>{"use strict";l();sf=["~","http://","https://","//","data:","sass:"],Te=class{extensions=[".css",".scss",".sass",".less",".styl"];resolve(e,r,n,o){if(sf.some(f=>r.startsWith(f)))return null;let s=o(e,r);if(s)return[s];let i=Ks.dirname(r),a=Ks.basename(r),c=i==="."?`_${a}`:`${i}/_${a}`,p=o(e,c);return p?[p]:null}}});var Vs=u(()=>{"use strict";l();zs();$s();Us();Js();Hs()});import mt from"fs";import U from"path";var q,zr=u(()=>{"use strict";l();Vs();q=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 Ee,new we,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 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=U.dirname(e),o=r.startsWith("/")?r:U.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=U.join(e,`index${r}`);if(this.isFile(s))return{path:s,isExternal:n};if(r===".py"){let i=U.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),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=U.join(r,"tsconfig.json");if(mt.existsSync(n))try{let s=JSON.parse(mt.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=U.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=U.join(n,a);try{if(mt.statSync(c,{throwIfNoEntry:!1})?.isFile())return{...s,path:c}}catch{}}return{...s,path:n}}let i=this.resolveLocalPath(U.join(n,"_dummy"),o.slice(1));return i?{...s,path:i.path}:null}return null}}});import Pe from"fs";import P from"path";import af from"piscina";function pf(t,e){if(t.length===0)return e;let r=t.map(i=>P.dirname(i).split(P.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(P.sep)||P.sep,s=P.relative(e,o);return s.startsWith("..")||P.isAbsolute(s)?e:o}var cf,Qs,lf,Ie,Xs=u(()=>{"use strict";l();Fr();te();Gt();Ts();Gs();ge();zr();cf=["tests","test","__tests__","specs","spec"],Qs=new Set(["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"]),lf=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 q(e),this.lockFile=Tn(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=>P.isAbsolute(n)?n:P.resolve(this.rootDir,n));await this.initPool(),this.enableGitStats&&(this.gitStatsMap=Lo(this.rootDir));try{for(let n of r)this.enqueue(n);return await this.drain(),await this.processTestFiles(pf(r,this.rootDir)),await this.processDocFiles(),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
24
28
  Done. Total processed: ${this.visited.size} nodes.
25
- `),io(this.graph.nodes),no(this.graph.nodes),oo(this.graph.nodes),so(this.graph.nodes),this.coverageMap.size>0&&to(this.graph.nodes,this.coverageMap),new P(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??dp;if(!(r>0&&!this.hasAtLeastFiles(this.rootDir,r)))try{let n=F.join(f,"parse-worker.js");this.pool=new up({filename:n,...e.maxThreads!==void 0?{maxThreads:e.maxThreads}:{}})}catch(n){process.stderr.write(`
29
+ `),Os(this.graph.nodes),As(this.graph.nodes),Ls(this.graph.nodes),Rs(this.graph.nodes),this.coverageMap.size>0&&Ds(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??lf;if(!(r>0&&!this.hasAtLeastFiles(this.rootDir,r)))try{let n=P.join(m,"parse-worker.js");this.pool=new af({filename:n,...e.maxThreads!==void 0?{maxThreads:e.maxThreads}:{}})}catch(n){process.stderr.write(`
26
30
  Warning: failed to start parse worker pool, falling back to synchronous parsing: ${n}
27
- `),this.pool=null}}hasAtLeastFiles(e,r){let n=0,s=[e];for(;s.length>0;){let o=s.pop(),i;try{i=Ce.readdirSync(o,{withFileTypes:!0})}catch{continue}for(let a of i)if(a.isDirectory())So.has(a.name)||s.push(F.join(o,a.name));else if(a.isFile()&&(n++,n>=r))return!0}return n>=r}async processTestFiles(e){let r=se(),n=o=>r.some(i=>o.name.includes(i));this.walkProject(e,n);let s=e;for(;s!==this.rootDir;){let o=F.dirname(s);if(o===s)break;for(let i of gp){let a=F.join(o,i);try{Ce.statSync(a).isDirectory()&&this.walkProject(a,n)}catch{}}s=o}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=Ce.readdirSync(e,{withFileTypes:!0})}catch{return}for(let s of n){let o=F.join(e,s.name);s.isDirectory()?So.has(s.name)||this.walkProject(o,r):s.isFile()&&r(s)&&this.enqueue(o)}}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=Ce.statSync(e,{throwIfNoEntry:!1});if(!r?.isFile())return;let n=F.relative(this.rootDir,e),s=await this.getNode(e,n,r);s.imports=await this.resolveImports(e,s.imports),ro(s.imports,s.tags),this.graph.nodes.set(s.path,s)}async getNode(e,r,n){let s=this.previousGraph?.nodes.get(r);if(s&&s.mtime===n.mtimeMs&&s.size===n.size)return{...s};let o=await this.tryParse(e,r);if(!o)return this.makeStubNode(e,r,n);let i=this.resolveCallEdges(e,o.rawCallEdges),a=this.buildNode(e,r,n,o,i);return this.attachGitStats(a,r),a}async tryParse(e,r){let n=Ce.readFileSync(e,"utf-8");try{return await this.parseContent(e,n)}catch(s){return process.stderr.write(`
28
- Warning: failed to parse ${r}: ${s}
29
- `),null}}parseContent(e,r){return this.pool?this.pool.run({filePath:e,content:r}):Ys(e,r)}makeStubNode(e,r,n){return{path:r,type:R(e),category:"other",imports:[],exports:[],tags:[],mtime:n.mtimeMs,size:n.size}}resolveCallEdges(e,r){let n=[];for(let s of r??[])try{let o=this.resolver.resolve(e,s.toSpecifier);o&&!o.isExternal&&n.push({from:s.from,to:s.to,toFile:F.relative(this.rootDir,o.path)})}catch{}return n}buildNode(e,r,n,s,o){let{imports:i,exports:a,tags:l,category:p,description:h,complexity:d,cognitiveComplexity:b,functions:v}=s;return{path:r,type:R(e),category:p,imports:i,exports:a,tags:l,mtime:n.mtimeMs,size:n.size,...h!==void 0?{description:h}:{},...o.length>0?{callEdges:o}:{},...d!==void 0?{complexity:d}:{},...b!==void 0?{cognitiveComplexity:b}:{},...v!==void 0?{functions:v}:{}}}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 s of r){let o=this.resolver.resolveAll(e,s.rawSpecifier);if(o.length!==0)for(let i of o){let a={...s,toPath:i.isExternal?i.path:F.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 vo=m(()=>{"use strict";c();kt();Co();wt();Tt();Ae();De();ae();br();Wt();Le();Bt();Qt();Xt()});var Sr=m(()=>{"use strict";c();vo()});function ko(t,e){return{identifier:e?.identifier??new Ye,featureMap:e?.featureDetection===!1?new Map:_(t.nodes,e?.featureDetection??void 0)}}function Eo(t,e,r,n,s){for(let o of e){let i=t.nodes.get(o);if(!i)continue;let a=new W(o,["*",...i.exports.map(l=>l.name)]);t.traverse(o,(l,p,h)=>{if(!h)return!0;if(!a.updateAffectedSymbols(l,h))return!1;if(p>0){let d=r.get(l.path);if(d)return n(d),!1}return s(l),!0},{direction:"incoming"})}}function Cr(t,e,r){let{identifier:n,featureMap:s}=ko(t,r),o=new Set;for(let i of e){let a=s.get(i);a&&o.add(a.tag)}return Eo(t,e,s,i=>o.add(i.tag),i=>{if(n.isTestNode(i))for(let a of i.tags)o.add(a.name)}),Array.from(o)}function vr(t,e,r){let{identifier:n,featureMap:s}=ko(t,r),o=new Set;return Eo(t,e,s,()=>{},i=>{n.isTestNode(i)&&o.add(i.path)}),Array.from(o)}var wo=m(()=>{"use strict";c();Sr();ir()});var Fo=m(()=>{"use strict";c();ts();ir();wo()});import yp from"fs";import ke from"path";async function I(t,e,r=null,n={}){let s=n.silent?void 0:a=>{process.stderr.write(`Processed ${a} files...\r`)},o=ke.resolve(t);return await new ve(o,r,n.pathAliases?new U(o,{pathAliases:n.pathAliases}):void 0,s,n.gitStats??!1,n.coverageMap??new Map,n.parallelParsing??!0).build(e)}async function Po(t,e={}){let r=ke.resolve(t),n=Vt(r),s=e.packages?n.packages.filter(a=>e.packages?.includes(a.name)||e.packages?.includes(a.relativeRoot)):n.packages,o=new Map(n.packages.map(a=>[a.name,a.root])),i=new fe(r,n.type);for(let a of s){let l=e.silent?void 0:d=>{process.stderr.write(`[${a.name}] Processed ${d} files...\r`)},h=await new ve(r,null,new U(r,{workspaceMap:o,tsconfigSearchPaths:[a.root,r],pathAliases:e.pathAliases}),l,e.gitStats??!1,new Map,e.parallelParsing??!0).build(a.entryPoints);i.addPackage(a,h)}return i}function M(t,e={}){let r=[],n=new Set([...e.ignoreDirs??yt,...e.additionalIgnoreDirs??[]]),s=new Set([...e.extensions??xt,...e.additionalExtensions??[]]);function o(i){try{let a=yp.readdirSync(i,{withFileTypes:!0});for(let l of a){let p=ke.join(i,l.name);l.isDirectory()?n.has(l.name)||o(p):l.isFile()&&s.has(ke.extname(l.name).toLowerCase())&&r.push(ke.relative(t,p))}}catch{}}return o(t),r}var S=m(()=>{"use strict";c();ht();bt();Xr();qr();kt();wt();Tt();Ae();De();It();ae();jt();Wt();an();Le();Bt();Qt();We();Xt();J();me();Dn();Fo();bt();Sr()});var st,ot,kr=m(()=>{"use strict";c();st="mokosh-cache",ot="graph.json"});import we from"path";import{parseArgs as xp}from"util";function bp(t){for(let e=0;e<t.length;e++)if(t[e]==="--root"&&t[e+1])return we.resolve(t[e+1]);return process.cwd()}function Ee(t){return t?parseInt(t,10):void 0}function To(t){return t?t.split(",").map(e=>e.trim()):void 0}function Cp(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(!n.startsWith("--"))e.push(n);else if(Sp.has(n)){let s=t[r+1];s!==void 0&&!s.startsWith("--")&&(e.push(n,s),r++)}else n.slice(2)in Er&&e.push(n)}return e}function No(t){let e=bp(t),r=we.join(we.resolve(e,st),ot),{values:n,positionals:s}=xp({args:Cp(t),allowPositionals:!0,options:Er}),o=n.cache,i=n.config,a=n.metric;return{rootDir:e,cachePath:o?we.resolve(e,o):r,configPath:i?we.resolve(e,i):void 0,query:n.query,file:n.file,typeFilter:n.type,functionName:n.function,filterPaths:To(n.paths),featureThreshold:Ee(n["feature-threshold"]),minOutDegree:Ee(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,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:To(n["changed-symbols"]),cached:n.cached??!1,depth:Ee(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:Ee(n["complexity-threshold"]),limit:Ee(n.limit),workspacePackages:n["workspace-packages"]??!1,workspaceAffected:n["workspace-affected"]??!1,clearCache:n["clear-cache"]??!1,slim:n.slim??!1,watch:n.watch??!1,entryPoints:s}}var Er,Sp,Io=m(()=>{"use strict";c();kr();Er={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"},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"},"workspace-packages":{type:"boolean"},"workspace-affected":{type:"boolean"},"clear-cache":{type:"boolean"},slim:{type:"boolean"},watch:{type:"boolean"}},Sp=new Set(Object.entries(Er).filter(([,t])=>t.type==="string").map(([t])=>`--${t}`))});async function wr(t){let{graph:e,file:r,testsOnly:n,changedSymbols:s,cached:o,withMeta:i}=t;r||(console.error("Error: --affected requires --file <path>"),process.exit(1));let a=h=>i?h.map(d=>({path:d,...z(e,d)})):h;if(o){let h=Ft(e),d=Pt(h,r),b=n?d.filter(j=>e.nodes.get(j)?.category==="test"):d,v=a(b);console.log(JSON.stringify({file:r,affected:v,count:v.length},null,2));return}let l=At(e,r,{testsOnly:n,changedSymbols:s}),p=a(l);console.log(JSON.stringify({file:r,affected:p,count:p.length},null,2))}var Mo=m(()=>{"use strict";c();S()});import Fr from"path";function B(t){return t.filter(e=>{let r=Fr.basename(e).toLowerCase();return vp.some(n=>r.includes(n))})}function it(t){return new qe().getChangedFiles().map(e=>Fr.relative(t,Fr.resolve(t,e)))}var vp,at=m(()=>{"use strict";c();cr();vp=[".test.",".spec.","-test.","-spec."]});async function Ao(t){let{graph:e}=t,{rootDir:r,scanOptions:n,featureThreshold:s,rawConfig:o}=t,i=it(r);if(![...e.nodes.values()].some(p=>B([p.path]).length>0)){let p=M(r,n);e=await I(r,B(p),e,k(o))}let l=vr(e,i,{...s!==void 0&&{featureDetection:{minOutDegree:s}}});console.log(l.join(`
30
- `))}var Do=m(()=>{"use strict";c();S();at()});async function Ro(t){let{graph:e,rootDir:r,entryPoints:n}=t,s=n.length?n:Ct(e,r);s.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 o=vt(e,s);console.log(JSON.stringify(o,null,2))}var Oo=m(()=>{"use strict";c();S()});async function Lo(t){let{graph:e}=t,{rootDir:r,scanOptions:n,dryRun:s,plain:o,rawConfig:i}=t;if(o||console.log(s?"Dry run: computing tag changes...":"Applying tags to test files..."),e.nodes.size===0){let l=M(r,n);e=await I(r,B(l),e,k(i))}let a=await or(e,r,{dryRun:s});console.log(JSON.stringify(a,null,2))}var Go=m(()=>{"use strict";c();S();at()});async function jo(t){let{graph:e,functionName:r}=t;r||(console.error("Error: --call-graph requires --function <name>"),process.exit(1));let n=Et(e,r);console.log(JSON.stringify(n,null,2))}var _o=m(()=>{"use strict";c();S()});async function Pr(t){let{graph:e,file:r,plain:n,depth:s,withEdgeDetail:o}=t;r||(console.error("Error: --callers requires --file <path>"),process.exit(1));let i=Dt(e,r,{depth:s??1,withEdgeDetail:o});console.log(n?i.map(a=>a.file).join(`
31
- `):JSON.stringify({file:r,callers:i,count:i.length},null,2))}var Wo=m(()=>{"use strict";c();S()});async function Tr(t){let{graph:e}=t,r=e.findCycles();if(r.length>0){process.stderr.write(`Found ${r.length} cycle(s):
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())Qs.has(a.name)||o.push(P.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=P.dirname(o);if(s===o)break;for(let i of cf){let a=P.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=P.join(e,o.name);o.isDirectory()?Qs.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=P.relative(this.rootDir,e),o=await this.getNode(e,n,r);o.imports=await this.resolveImports(e,o.imports),Ms(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}):Fs(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:P.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:y,functions:x}=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}:{},...y!==void 0?{cognitiveComplexity:y}:{},...x!==void 0?{functions:x}:{}}}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:P.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 Ys=u(()=>{"use strict";l();It();Xs();Mt();Lt();zt();ze();$e();ge();zr();Zt();Be();nr();cr();lr()});var $r=u(()=>{"use strict";l();Ys()});function qs(t,e){return{identifier:e?.identifier??new it,featureMap:e?.featureDetection===!1?new Map:J(t.nodes,e?.featureDetection??void 0)}}function Zs(t,e,r,n,o){for(let s of e){let i=t.nodes.get(s);if(!i)continue;let a=new K(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 Ur(t,e,r){let{identifier:n,featureMap:o}=qs(t,r),s=new Set;for(let i of e){let a=o.get(i);a&&s.add(a.tag)}return Zs(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 Br(t,e,r){let{identifier:n,featureMap:o}=qs(t,r),s=new Set;return Zs(t,e,o,()=>{},i=>{n.isTestNode(i)&&s.add(i.path)}),Array.from(s)}var ei=u(()=>{"use strict";l();$r();Er()});var ti=u(()=>{"use strict";l();Do();Er();ei()});import ff from"fs";import De from"path";async function R(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 q(s,{pathAliases:n.pathAliases}):void 0,o,n.gitStats??!1,n.coverageMap??new Map,n.parallelParsing??!0).build(e)}async function ri(t,e={}){let r=De.resolve(t),n=ar(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 q(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 L(t,e={}){let r=[],n=new Set([...e.ignoreDirs??B,...e.additionalIgnoreDirs??[]]),o=new Set([...e.extensions??Nt,...e.additionalExtensions??[]]);function s(i){try{let a=ff.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 v=u(()=>{"use strict";l();Et();Ge();Sn();vn();It();Mt();Lt();zt();ze();$e();Ut();ge();Yt();Zt();Wn();Be();nr();cr();Ve();lr();te();be();mo();ti();Ge();$r()});var ut,gt,Jr=u(()=>{"use strict";l();ut="mokosh-cache",gt="graph.json"});import Me from"path";import{parseArgs as mf}from"util";function uf(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 ni(t){return t?t.split(",").map(e=>e.trim()):void 0}function df(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(gf.has(n)){let o=t[r+1];o!==void 0&&!o.startsWith("--")&&(e.push(n,o),r++)}else n.slice(2)in Kr&&e.push(n)}return e}function oi(t){let e=uf(t),r=Me.join(Me.resolve(e,ut),gt),{values:n,positionals:o}=mf({args:df(t),allowPositionals:!0,options:Kr}),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:ni(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:ni(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 Kr,gf,si=u(()=>{"use strict";l();Jr();Kr={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"}},gf=new Set(Object.entries(Kr).filter(([,t])=>t.type==="string").map(([t])=>`--${t}`))});async function Hr(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,...H(e,d)})):f;if(s){let f=At(e),d=Rt(f,r),y=n?d.filter(k=>e.nodes.get(k)?.category==="test"):d,x=a(y);console.log(JSON.stringify({file:r,affected:x,count:x.length},null,2));return}let c=Jt(e,r,{testsOnly:n,changedSymbols:o}),p=a(c);console.log(JSON.stringify({file:r,affected:p,count:p.length},null,2))}var ii=u(()=>{"use strict";l();v()});import Vr from"path";function Z(t){return t.filter(e=>{let r=Vr.basename(e).toLowerCase();return hf.some(n=>r.includes(n))})}function dt(t){return new at().getChangedFiles().map(e=>Vr.relative(t,Vr.resolve(t,e)))}var hf,ht=u(()=>{"use strict";l();Fr();hf=[".test.",".spec.","-test.","-spec."]});async function ai(t){let{graph:e}=t,{rootDir:r,scanOptions:n,featureThreshold:o,rawConfig:s}=t,i=dt(r);if(![...e.nodes.values()].some(p=>Z([p.path]).length>0)){let p=L(r,n);e=await R(r,Z(p),e,F(s))}let c=Br(e,i,{...o!==void 0&&{featureDetection:{minOutDegree:o}}});console.log(c.join(`
34
+ `))}var ci=u(()=>{"use strict";l();v();ht()});async function li(t){let{graph:e,rootDir:r,entryPoints:n}=t,o=n.length?n:Tt(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=Pt(e,o);console.log(JSON.stringify(s,null,2))}var pi=u(()=>{"use strict";l();v()});async function fi(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=L(r,n);e=await R(r,Z(c),e,F(i))}let a=await wr(e,r,{dryRun:o});console.log(JSON.stringify(a,null,2))}var mi=u(()=>{"use strict";l();v();ht()});async function ui(t){let{graph:e,functionName:r}=t;r||(console.error("Error: --call-graph requires --function <name>"),process.exit(1));let n=Dt(e,r);console.log(JSON.stringify(n,null,2))}var gi=u(()=>{"use strict";l();v()});async function Qr(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=Kt(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 di=u(()=>{"use strict";l();v()});async function Xr(t){let{graph:e}=t,r=e.findCycles();if(r.length>0){process.stderr.write(`Found ${r.length} cycle(s):
32
36
  `);for(let n of r)process.stderr.write(` ${n.join(" \u2192 ")}
33
- `);process.exit(1)}console.log("No cycles detected.")}var zo=m(()=>{"use strict";c()});async function Nr(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:
34
- `);for(let{doc:n,staleFor:s}of r)process.stderr.write(` ${n} \u2014 references changed more recently: ${s.join(", ")}
35
- `);process.exit(1)}console.log("No doc drift detected.")}var $o=m(()=>{"use strict";c()});import Uo from"fs";function Bo(t){Uo.existsSync(t)?(Uo.unlinkSync(t),console.log(`Cache cleared: ${t}`)):console.log(`No cache file present at ${t}`)}var Jo=m(()=>{"use strict";c()});async function Ir(t){let{graph:e,file:r,depth:n,withMeta:s}=t;r||(console.error("Error: --dependencies requires --file <path>"),process.exit(1));let o=Mt(e,r,n??1),i=s?o.map(a=>({...a,...z(e,a.path)})):o;console.log(JSON.stringify({file:r,dependencies:i},null,2))}var Ko=m(()=>{"use strict";c();S()});async function Mr(t){let{graph:e,file:r,withMeta:n}=t;r||(console.error("Error: --dependents requires --file <path>"),process.exit(1));let s=ce(e,r),o=n?s.map(i=>({...i,...z(e,i.path)})):s;console.log(JSON.stringify({file:r,dependents:o},null,2))}var Ho=m(()=>{"use strict";c();S()});async function Vo(t){let{graph:e}=t,{rootDir:r,scanOptions:n,featureThreshold:s,rawConfig:o}=t;if(e.nodes.size===0){let l=M(r,n);e=await I(r,l,e,k(o))}let i=_(e.nodes,s!==void 0?{minOutDegree:s}:void 0),a=Array.from(i.values()).sort((l,p)=>p.outDegree-l.outDegree);console.log(JSON.stringify({features:a},null,2))}var Qo=m(()=>{"use strict";c();S()});async function Xo(t){let{graph:e}=t,{rootDir:r,scanOptions:n,minOutDegree:s,rawConfig:o}=t;if(e.nodes.size===0){let l=M(r,n);e=await I(r,l,e,k(o))}let i=oe(e,s!==void 0?{minOutDegree:s}:void 0),a=Object.fromEntries(i.features);console.log(JSON.stringify({features:a,unassigned:i.unassigned},null,2))}var Yo=m(()=>{"use strict";c();S()});async function Ar(t){let{graph:e,metric:r,complexityThreshold:n,limit:s}=t,o=n??10,i=Rt(e,{metric:r,threshold:o,limit:s});console.log(JSON.stringify({metric:r??"cognitiveComplexity",threshold:o,functions:i,count:i.length},null,2))}var qo=m(()=>{"use strict";c();S()});async function Zo(t){let{graph:e,functionName:r,plain:n}=t;r||(console.error("Error: --find-symbol requires --function <name>"),process.exit(1));let s=zt(e,r);console.log(n?s.map(o=>o.path).join(`
36
- `):JSON.stringify({name:r,matches:s,count:s.length},null,2))}var ei=m(()=>{"use strict";c();S()});async function Dr(t){let{graph:e,featureThreshold:r,rawConfig:n,plain:s}=t,o=r??n.coverageThreshold??80;if(!Gt(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<o).map(a=>({file:a.path,coveragePct:a.coveragePct}));console.log(s?i.map(a=>a.file).join(`
37
- `):JSON.stringify({threshold:o,uncovered:i,count:i.length},null,2))}var ti=m(()=>{"use strict";c();S()});import kp from"path";function wp(t){let e=kp.basename(t).toLowerCase();return Ep.some(r=>e.includes(r))}async function ri(t){let{graph:e,rootDir:r,scanOptions:n,excludeTests:s}=t,o=M(r,n),i=e.findUnusedFiles(o);s&&(i=i.filter(a=>!wp(a))),console.log(JSON.stringify({unusedFiles:i},null,2))}var Ep,ni=m(()=>{"use strict";c();S();Ep=[".test.",".spec.","-test.","-spec.",".stories."]});async function Rr(t){let{graph:e,queryStr:r,mermaidOutput:n,slim:s}=t,o=e.serialize();if(r){let l=$e(r);o=ze(o,l)}if(n){let l=P.deserialize(o);console.log(Ie.serialize(l));return}let i=e.findCycles();i.length>0&&(o.cycles=i);let a=Nt(e);console.log(JSON.stringify(s?{...Ot(o),languageCoverage:a}:{...o,languageCoverage:a},null,2))}var si=m(()=>{"use strict";c();S()});import Fp from"fs";import Or from"path";function ct(t,e,r){let n=t;for(let s=0;s<6;s++){let o=Or.join(n,"templates",...e);if(Fp.existsSync(Or.join(o,r)))return o;let i=Or.dirname(n);if(i===n)break;n=i}throw new Error(`Could not locate mokosh templates/${e.join("/")}`)}var Lr=m(()=>{"use strict";c()});import oi from"fs";import ii from"path";function ai(t,e=process.cwd()){let r=ct(f,["config"],"mokosh.config.js"),n=ii.join(r,"mokosh.config.js"),s=ii.join(e,"mokosh.config.js");if(oi.existsSync(s)&&!t){console.log("skipped mokosh.config.js (already exists, use --force to overwrite)");return}oi.copyFileSync(n,s),console.log("wrote mokosh.config.js")}var ci=m(()=>{"use strict";c();Lr()});import Gr from"fs";import lt from"path";function li(t,e=process.cwd()){let r=ct(f,["skill"],"SKILL.md");for(let n of Pp){let s=lt.join(r,n.templateFile),o=lt.join(e,...n.destPath),i=lt.join(...n.destPath);if(Gr.existsSync(o)&&!t){console.log(`skipped ${i} (already exists, use --force to overwrite)`);continue}Gr.mkdirSync(lt.dirname(o),{recursive:!0}),Gr.copyFileSync(s,o),console.log(`wrote ${i}`)}}var Pp,pi=m(()=>{"use strict";c();Lr();Pp=[{templateFile:"SKILL.md",destPath:[".claude","skills","mokosh","SKILL.md"]},{templateFile:"mokosh.md",destPath:[".claude","commands","mokosh.md"]}]});async function fi(t){let{graph:e,filterPaths:r,minOutDegree:n}=t,s=_t(e,n!==void 0?{minOutDegree:n}:void 0);if(r?.length){let o=r.map(i=>s.get(i)).filter(Boolean);console.log(JSON.stringify({count:o.length,modules:o},null,2))}else{let o=Array.from(s.values());console.log(JSON.stringify({count:o.length,modules:o},null,2))}}var mi=m(()=>{"use strict";c();S()});async function ui(t){let{graph:e}=t,{rootDir:r,scanOptions:n,featureThreshold:s,plain:o,rawConfig:i}=t;o||console.log("Proposing test tags based on git diff...");let a=it(r);if(e.nodes.size===0){let p=M(r,n);e=await I(r,B(p),e,k(i))}let l=Cr(e,a,{...s!==void 0&&{featureDetection:{minOutDegree:s}}});console.log(o?l.join(" "):JSON.stringify({proposedTags:l},null,2))}var gi=m(()=>{"use strict";c();S();at()});async function di(t){let{graph:e,typeFilter:r}=t,n=$t(e);if(r){let s=Ut(n,r);console.log(JSON.stringify(s,null,2))}else{let s=Array.from(n.types.values());console.log(JSON.stringify({count:s.length,types:s},null,2))}}var hi=m(()=>{"use strict";c();S()});function yi(t,e){let r=t.getAffectedAcrossPackages(e);console.log(JSON.stringify({file:e,affected:r,count:r.length},null,2))}var xi=m(()=>{"use strict";c()});function bi(t){console.log(JSON.stringify(Lt(t),null,2))}var Si=m(()=>{"use strict";c();S()});import jr from"path";function Tp(t,e,r,n){return t!==e?t:r?jr.resolve(n,r):e}function Ci(t){let{rootDir:e,entryPoints:r,cachePath:n,configPath:s}=t,o=s?K(s,{isExplicitPath:!0}):K(e),i=jr.join(jr.resolve(e,st),ot),a=r.length>0?r:o.entryPoints??[],l=Tp(n,i,o.cachePath,e),p={...o.ignoreDirs!==void 0&&{additionalIgnoreDirs:o.ignoreDirs},...o.extensions!==void 0&&{additionalExtensions:o.extensions}};return{rootDir:e,resolvedEntryPoints:a,resolvedCachePath:l,scanOptions:p,rawConfig:o}}var vi=m(()=>{"use strict";c();S();kr()});import Fe from"fs";import Np from"path";function ki(t){if(!Fe.existsSync(t))return null;let e=Fe.readFileSync(t,"utf-8");return P.deserialize(JSON.parse(e))}function _r(t,e){let r=Np.dirname(e);Fe.existsSync(r)||Fe.mkdirSync(r,{recursive:!0}),Fe.writeFileSync(e,JSON.stringify(t.serialize(),null,2))}async function Wr(t,e,r,n={silent:!1,...k(void 0)}){return I(t,e,r,n)}var Ei=m(()=>{"use strict";c();S()});var wi,Fi,Pi=m(()=>{"use strict";c();wi=`
37
+ `);process.exit(1)}console.log("No cycles detected.")}var hi=u(()=>{"use strict";l()});async function Yr(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 yi=u(()=>{"use strict";l()});import xi from"fs";function bi(t){xi.existsSync(t)?(xi.unlinkSync(t),console.log(`Cache cleared: ${t}`)):console.log(`No cache file present at ${t}`)}var Si=u(()=>{"use strict";l()});async function qr(t){let{graph:e,file:r,depth:n,withMeta:o}=t;r||(console.error("Error: --dependencies requires --file <path>"),process.exit(1));let s=Bt(e,r,n??1),i=o?s.map(a=>({...a,...H(e,a.path)})):s;console.log(JSON.stringify({file:r,dependencies:i},null,2))}var Ci=u(()=>{"use strict";l();v()});async function Zr(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,...H(e,i.path)})):o;console.log(JSON.stringify({file:r,dependents:s},null,2))}var vi=u(()=>{"use strict";l();v()});async function ki(t){let{graph:e}=t,{rootDir:r,scanOptions:n,featureThreshold:o,rawConfig:s}=t;if(e.nodes.size===0){let c=L(r,n);e=await R(r,c,e,F(s))}let i=J(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 wi=u(()=>{"use strict";l();v()});async function Ei(t){let{graph:e}=t,{rootDir:r,scanOptions:n,minOutDegree:o,rawConfig:s}=t;if(e.nodes.size===0){let c=L(r,n);e=await R(r,c,e,F(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 Ni=u(()=>{"use strict";l();v()});async function en(t){let{graph:e,metric:r,complexityThreshold:n,limit:o}=t,s=n??10,i=Ht(e,{metric:r,threshold:s,limit:o});console.log(JSON.stringify({metric:r??"cognitiveComplexity",threshold:s,functions:i,count:i.length},null,2))}var Fi=u(()=>{"use strict";l();v()});async function tn(t){let{graph:e,rootDir:r,scanOptions:n,minDuplicateLines:o,limit:s}=t,i=o??6,a=[...n.ignoreDirs??B,...n.additionalIgnoreDirs??[]],c=await Wt(e,r,{minLines:i,limit:s,ignoreDirs:a});console.log(JSON.stringify({minLines:i,groups:c,count:c.length},null,2))}var Ti=u(()=>{"use strict";l();v()});async function Pi(t){let{graph:e,functionName:r,plain:n}=t;r||(console.error("Error: --find-symbol requires --function <name>"),process.exit(1));let o=er(e,r);console.log(n?o.map(s=>s.path).join(`
40
+ `):JSON.stringify({name:r,matches:o,count:o.length},null,2))}var Ii=u(()=>{"use strict";l();v()});async function rn(t){let{graph:e,featureThreshold:r,rawConfig:n,plain:o}=t,s=r??n.coverageThreshold??80;if(!Xt(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 Di=u(()=>{"use strict";l();v()});import yf from"path";function bf(t){let e=yf.basename(t).toLowerCase();return xf.some(r=>e.includes(r))}async function Mi(t){let{graph:e,rootDir:r,scanOptions:n,excludeTests:o}=t,s=L(r,n),i=e.findUnusedFiles(s);o&&(i=i.filter(a=>!bf(a))),console.log(JSON.stringify({unusedFiles:i},null,2))}var xf,Ai=u(()=>{"use strict";l();v();xf=[".test.",".spec.","-test.","-spec.",".stories."]});async function nn(t){let{graph:e,queryStr:r,mermaidOutput:n,slim:o}=t,s=e.serialize();if(r){let c=Xe(r);s=Qe(s,c)}if(n){let c=D.deserialize(s);console.log(je.serialize(c));return}let i=e.findCycles();i.length>0&&(s.cycles=i);let a=$t(e);console.log(JSON.stringify(o?{...Vt(s),languageCoverage:a}:{...s,languageCoverage:a},null,2))}var Ri=u(()=>{"use strict";l();v()});import Sf from"fs";import on from"path";function yt(t,e,r){let n=t;for(let o=0;o<6;o++){let s=on.join(n,"templates",...e);if(Sf.existsSync(on.join(s,r)))return s;let i=on.dirname(n);if(i===n)break;n=i}throw new Error(`Could not locate mokosh templates/${e.join("/")}`)}var sn=u(()=>{"use strict";l()});import Li from"fs";import Oi from"path";function Gi(t,e=process.cwd()){let r=yt(m,["config"],"mokosh.config.js"),n=Oi.join(r,"mokosh.config.js"),o=Oi.join(e,"mokosh.config.js");if(Li.existsSync(o)&&!t){console.log("skipped mokosh.config.js (already exists, use --force to overwrite)");return}Li.copyFileSync(n,o),console.log("wrote mokosh.config.js")}var ji=u(()=>{"use strict";l();sn()});import an from"fs";import xt from"path";function _i(t,e=process.cwd()){let r=yt(m,["skill"],"SKILL.md");for(let n of Cf){let o=xt.join(r,n.templateFile),s=xt.join(e,...n.destPath),i=xt.join(...n.destPath);if(an.existsSync(s)&&!t){console.log(`skipped ${i} (already exists, use --force to overwrite)`);continue}an.mkdirSync(xt.dirname(s),{recursive:!0}),an.copyFileSync(o,s),console.log(`wrote ${i}`)}}var Cf,Wi=u(()=>{"use strict";l();sn();Cf=[{templateFile:"SKILL.md",destPath:[".claude","skills","mokosh","SKILL.md"]},{templateFile:"mokosh.md",destPath:[".claude","commands","mokosh.md"]}]});async function cn(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 zi=u(()=>{"use strict";l()});async function $i(t){let{graph:e,filterPaths:r,minOutDegree:n}=t,o=qt(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 Ui=u(()=>{"use strict";l();v()});async function Bi(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=dt(r);if(e.nodes.size===0){let p=L(r,n);e=await R(r,Z(p),e,F(i))}let c=Ur(e,a,{...o!==void 0&&{featureDetection:{minOutDegree:o}}});console.log(s?c.join(" "):JSON.stringify({proposedTags:c},null,2))}var Ji=u(()=>{"use strict";l();v();ht()});async function Ki(t){let{graph:e,typeFilter:r}=t,n=tr(e);if(r){let o=rr(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 Hi=u(()=>{"use strict";l();v()});function Vi(t,e){let r=t.getAffectedAcrossPackages(e);console.log(JSON.stringify({file:e,affected:r,count:r.length},null,2))}var Qi=u(()=>{"use strict";l()});function Xi(t){console.log(JSON.stringify(Qt(t),null,2))}var Yi=u(()=>{"use strict";l();v()});import ln from"path";function vf(t,e,r,n){return t!==e?t:r?ln.resolve(n,r):e}function qi(t){let{rootDir:e,entryPoints:r,cachePath:n,configPath:o}=t,s=o?re(o,{isExplicitPath:!0}):re(e),i=ln.join(ln.resolve(e,ut),gt),a=r.length>0?r:s.entryPoints??[],c=vf(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 Zi=u(()=>{"use strict";l();v();Jr()});import Ae from"fs";import kf from"path";function ea(t){if(!Ae.existsSync(t))return null;let e=Ae.readFileSync(t,"utf-8");return D.deserialize(JSON.parse(e))}function pn(t,e){let r=kf.dirname(e);Ae.existsSync(r)||Ae.mkdirSync(r,{recursive:!0}),Ae.writeFileSync(e,JSON.stringify(t.serialize(),null,2))}async function fn(t,e,r,n={silent:!1,...F(void 0)}){return R(t,e,r,n)}var ta=u(()=>{"use strict";l();v()});var ra,na,oa=u(()=>{"use strict";l();ra=`
38
43
  Usage: mokosh [options] <entry-point1> <entry-point2> ...
39
44
 
40
45
  Options:
@@ -51,6 +56,8 @@ Options:
51
56
  --find-unused Find files that are not reachable from entry points
52
57
  --exclude-tests Exclude test files from --find-unused output
53
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)
54
61
  --callers List files whose exported functions call into --file
55
62
  --file <path> Target file for --callers/--dependencies/--dependents/--affected/--workspace-affected
56
63
  --check-cycles Check for circular dependencies; exits non-zero if found (CI gate)
@@ -92,7 +99,13 @@ MCP parity (mirrors the MCP server's tools for use when MCP is unavailable):
92
99
  --find-complex-functions List functions/methods at or above a complexity threshold, worst-first
93
100
  --metric <name> cognitiveComplexity (default) | complexity \u2014 used by --find-complex-functions
94
101
  --complexity-threshold <N> Minimum score to include (default: 10, use with --find-complex-functions)
95
- --limit <N> Max results for --find-complex-functions (default: 20)
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)
96
109
  --workspace-packages List monorepo packages and their cross-package dependencies
97
110
  --workspace-affected Cross-package blast-radius for --file in a monorepo
98
111
  --find-symbol Find every file that exports --function <name> by exact name, with
@@ -100,7 +113,9 @@ MCP parity (mirrors the MCP server's tools for use when MCP is unavailable):
100
113
  precision for TS/JS, named-import for Python, file-level otherwise)
101
114
  --watch Re-run on file changes. Supported with the default output, --query,
102
115
  --callers, --dependencies, --dependents, --affected, --find-uncovered,
103
- --find-complex-functions, --check-cycles, and --check-doc-drift only.
116
+ --find-complex-functions, --find-duplicates, --check-cycles,
117
+ --check-doc-drift, and
118
+ --list-tags only.
104
119
 
105
120
  Notes:
106
121
  Add mokosh-cache/ to your .gitignore to avoid committing the cache directory.
@@ -111,7 +126,7 @@ Notes:
111
126
  server only loads JSON config (allowJs: false) for security. This is intentional.
112
127
  --workspace-packages/--workspace-affected require explicit opt-in (unlike MCP's analyze tool,
113
128
  which auto-detects a monorepo when entryPoints is empty); other commands remain single-package.
114
- `,Fi=`
129
+ `,na=`
115
130
  Query filter reference (--query "key:value,key:value,...")
116
131
  All keys are case-insensitive. Multiple keys are AND'd together.
117
132
 
@@ -234,5 +249,5 @@ COMMON PATTERNS
234
249
 
235
250
  Large TypeScript logic files:
236
251
  --query "type:typescript,category:logic,sort:size,limit:5"
237
- `});var Ti,Ni=m(()=>{"use strict";c();Ti=/(?:^|[/\\])(?:node_modules|\.git|dist|build|coverage)(?:[/\\]|$)/});import Ip from"fs";function Ii(t,e,r){let n=null,s=!1,o=!1,i=async()=>{if(s){o=!0;return}s=!0;try{await r()}finally{s=!1,o&&(o=!1,i())}};i();let a=null;try{a=Ip.watch(t,{recursive:!0},(l,p)=>{!p||Ti.test(p)||(n&&clearTimeout(n),n=setTimeout(()=>{i()},e))})}catch(l){console.error(`Warning: unable to watch ${t}: ${l.message}`)}process.on("SIGINT",()=>{n&&clearTimeout(n),a?.close(),process.exit(0)})}var Mi=m(()=>{"use strict";c();Ni()});function Ap(t){t.help&&(console.log(wi),process.exit(0)),t.queryHelp&&(console.log(Fi),process.exit(0)),t.initSkill&&(li(t.force),process.exit(0)),t.initConfig&&(ai(t.force),process.exit(0)),t.clearCache&&(Bo(t.cachePath),process.exit(0))}async function Dp(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 Po(r,k(e.rawConfig));return t.workspacePackages?bi(n):(t.file||(console.error("Error: --workspace-affected requires --file <path>"),process.exit(1)),yi(n,t.file)),!0}function Rp(t){return t.proposeTags||t.affectedTests||t.applyTags||t.callers||t.dependencies||t.dependents||t.affected||t.findUncovered||t.findComplexFunctions||t.typeGraph||t.moduleResponsibility||t.callGraph||t.findSymbol||t.apiSurface}function Op(t){let r=[{name:"--propose-tags",flag:t.proposeTags,handler:ui},{name:"--apply-tags",flag:t.applyTags,handler:Lo},{name:"--affected-tests",flag:t.affectedTests,handler:Ao},{name:"--detect-features",flag:t.detectFeatures,handler:Vo},{name:"--find-unused",flag:t.findUnused,handler:ri},{name:"--check-cycles",flag:t.checkCycles,handler:Tr},{name:"--check-doc-drift",flag:t.checkDocDrift,handler:Nr},{name:"--find-uncovered",flag:t.findUncovered,handler:Dr},{name:"--callers",flag:t.callers,handler:Pr},{name:"--dependencies",flag:t.dependencies,handler:Ir},{name:"--dependents",flag:t.dependents,handler:Mr},{name:"--affected",flag:t.affected,handler:wr},{name:"--find-complex-functions",flag:t.findComplexFunctions,handler:Ar},{name:"--type-graph",flag:t.typeGraph,handler:di},{name:"--module-responsibility",flag:t.moduleResponsibility,handler:fi},{name:"--feature-graph",flag:t.featureGraph,handler:Xo},{name:"--call-graph",flag:t.callGraph,handler:jo},{name:"--find-symbol",flag:t.findSymbol,handler:Zo},{name:"--api-surface",flag:t.apiSurface,handler:Ro}].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??Rr}async function Lp(t,e,r,n,s,o,i){Mp.has(t)||(console.error("Error: --watch is only supported with the default output, --query, --callers, --dependencies, --dependents, --affected, --find-uncovered, --find-complex-functions, --check-cycles, and --check-doc-drift"),process.exit(1)),Ii(r,300,async()=>{let a=await Wr(r,n,e.graph,{silent:o,...k(i)});_r(a,s),console.log(`--- rebuilt at ${new Date().toISOString()} ---`),await t({...e,graph:a})})}async function Ai(){let t=process.argv.slice(2),e=No(t);Ap(e);let r=Ci(e);dt(r.rawConfig);let{rootDir:n,resolvedEntryPoints:s,resolvedCachePath:o,scanOptions:i}=r;if(await Dp(e,r,n))return;let a=Rp(e),l=ki(o)??new P(new Map);(s.length>0||!a)&&(s.length===0&&!a&&!e.findUnused&&!e.detectFeatures&&!e.checkCycles&&!e.checkDocDrift&&(console.error("Error: No entry points provided"),process.exit(1)),l=await Wr(n,s,l,{silent:e.silent,...k(r.rawConfig)}),_r(l,o));let p={graph:l,rootDir:n,entryPoints:s.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},h=Op(e);if(e.watch){await Lp(h,p,n,s,o,e.silent,r.rawConfig);return}await h(p)}var Mp,Di=m(()=>{"use strict";c();S();Io();Mo();Do();Oo();Go();_o();Wo();zo();$o();Jo();Ko();Ho();Qo();Yo();qo();ei();ti();ni();si();ci();pi();mi();gi();hi();xi();Si();vi();Ei();Pi();Mi();Mp=new Set([Rr,Pr,Ir,Mr,wr,Dr,Ar,Tr,Nr])});var Gp=Ri(()=>{c();Di();Ai().catch(t=>{console.error(t),process.exit(1)})});export default Gp();
252
+ `});var sa,ia=u(()=>{"use strict";l();sa=/(?:^|[/\\])(?:node_modules|\.git|dist|build|coverage)(?:[/\\]|$)/});import wf from"fs";function aa(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=wf.watch(t,{recursive:!0},(c,p)=>{!p||sa.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 ca=u(()=>{"use strict";l();ia()});function Nf(t){t.help&&(console.log(ra),process.exit(0)),t.queryHelp&&(console.log(na),process.exit(0)),t.initSkill&&(_i(t.force),process.exit(0)),t.initConfig&&(Gi(t.force),process.exit(0)),t.clearCache&&(bi(t.cachePath),process.exit(0))}async function Ff(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 ri(r,F(e.rawConfig));return t.workspacePackages?Xi(n):(t.file||(console.error("Error: --workspace-affected requires --file <path>"),process.exit(1)),Vi(n,t.file)),!0}function Tf(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 Pf(t){let r=[{name:"--propose-tags",flag:t.proposeTags,handler:Bi},{name:"--apply-tags",flag:t.applyTags,handler:fi},{name:"--affected-tests",flag:t.affectedTests,handler:ai},{name:"--detect-features",flag:t.detectFeatures,handler:ki},{name:"--find-unused",flag:t.findUnused,handler:Mi},{name:"--check-cycles",flag:t.checkCycles,handler:Xr},{name:"--check-doc-drift",flag:t.checkDocDrift,handler:Yr},{name:"--find-uncovered",flag:t.findUncovered,handler:rn},{name:"--list-tags",flag:t.listTags,handler:cn},{name:"--callers",flag:t.callers,handler:Qr},{name:"--dependencies",flag:t.dependencies,handler:qr},{name:"--dependents",flag:t.dependents,handler:Zr},{name:"--affected",flag:t.affected,handler:Hr},{name:"--find-complex-functions",flag:t.findComplexFunctions,handler:en},{name:"--find-duplicates",flag:t.findDuplicates,handler:tn},{name:"--type-graph",flag:t.typeGraph,handler:Ki},{name:"--module-responsibility",flag:t.moduleResponsibility,handler:$i},{name:"--feature-graph",flag:t.featureGraph,handler:Ei},{name:"--call-graph",flag:t.callGraph,handler:ui},{name:"--find-symbol",flag:t.findSymbol,handler:Pi},{name:"--api-surface",flag:t.apiSurface,handler:li}].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??nn}async function If(t,e,r,n,o,s,i){Ef.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)),aa(r,300,async()=>{let a=await fn(r,n,e.graph,{silent:s,...F(i)});pn(a,o),console.log(`--- rebuilt at ${new Date().toISOString()} ---`),await t({...e,graph:a})})}async function la(){let t=process.argv.slice(2),e=oi(t);Nf(e);let r=qi(e);wt(r.rawConfig);let{rootDir:n,resolvedEntryPoints:o,resolvedCachePath:s,scanOptions:i}=r;if(await Ff(e,r,n))return;let a=Tf(e),c=ea(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 fn(n,o,c,{silent:e.silent,...F(r.rawConfig)}),pn(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=Pf(e);if(e.watch){await If(f,p,n,o,s,e.silent,r.rawConfig);return}await f(p)}var Ef,pa=u(()=>{"use strict";l();v();si();ii();ci();pi();mi();gi();di();hi();yi();Si();Ci();vi();wi();Ni();Fi();Ti();Ii();Di();Ai();Ri();ji();Wi();zi();Ui();Ji();Hi();Qi();Yi();Zi();ta();oa();ca();Ef=new Set([nn,Qr,qr,Zr,Hr,rn,en,tn,Xr,Yr,cn])});var Df=fa(()=>{l();pa();la().catch(t=>{console.error(t),process.exit(1)})});export default Df();
238
253
  //# sourceMappingURL=cli.mjs.map