@omfalos/mokosh 0.1.4 → 0.1.6

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,35 +1,39 @@
1
1
  #!/usr/bin/env node
2
- var qe=(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 l=(t,e)=>()=>(t&&(e=t(t=0)),e);var Po=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);function de(t){sr.push(t)}function nr(t){return[...Io,...sr].some(e=>typeof e=="string"?t.includes(e):e instanceof RegExp?e.test(t):e(t))}function he(t){or.push(t)}function X(){return[...No,...or]}function ye(t){ir.push(t)}function Ve(){return[...Mo,...ir]}function Qe(t){ar=t}function Xe(){return ar}var Io,sr,No,or,Mo,ir,ar,G=l(()=>{"use strict";Io=[".config.","biome.json","tsconfig.json","package.json",".prettierrc",".eslintrc"],sr=[];No=[".test.",".spec.","-test.","-spec."],or=[];Mo=["jest","vitest","playwright","cypress","@testing-library/"],ir=[];ar=.8});import Ze from"fs";import cr from"path";function O(t,{allowJs:e=!0,isExplicitPath:r=!1}={}){if(r){let s=cr.resolve(t);return Ze.existsSync(s)?s.endsWith(".json")?pr(s):e?lr(s):{}:{}}for(let s of Do){let n=cr.resolve(t,s);if(Ze.existsSync(n)){if(s.endsWith(".json"))return pr(n);if(e)return lr(n)}}return{}}function pr(t){return JSON.parse(Ze.readFileSync(t,"utf-8"))}function lr(t){let e=qe(t);return e&&typeof e=="object"&&"default"in e&&(e=e.default),typeof e=="function"?e({}):e}function Ye(t){for(let e of t.configMatchers??[])de(e);for(let e of t.testPatterns??[])he(e);for(let e of t.testLibraries??[])ye(e);t.barrelThreshold!==void 0&&Qe(t.barrelThreshold)}var Do,et=l(()=>{"use strict";G();Do=["mokosh.config.js","mokosh.config.cjs","mokosh.config.json"]});var tt,rt,st=l(()=>{"use strict";tt=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"],rt=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".go",".feature"]});import np from"fs";import ip from"path";var fr=l(()=>{"use strict"});var xe,ur=l(()=>{"use strict";xe={serialize(t){let e=["graph TD"],r=new Set;for(let s of t.nodes.values()){let n=`"${s.path}"`;for(let o of s.imports){if(!o.toPath)continue;let i=`"${o.toPath}"`,a=`${s.path} -> ${o.toPath}`;if(!r.has(a)){let c=o.isStyle?"-- styles -->":"-->";e.push(` ${n} ${c} ${i}`),r.add(a)}}}return e.join(`
3
- `)}}});var mr=l(()=>{"use strict";ur()});import gr from"fs";import Ao from"path";function nt(t,e){let r=t.replace(/^\.\//,"");if(e.nodes.has(r))return r;let s=r.replace(/^dist\//,"src/").replace(/\.(js|mjs|cjs)$/,".ts");return e.nodes.has(s)?s:null}function dr(t,e){if(typeof t=="string")return nt(t,e);if(t&&typeof t=="object"){let r=t;for(let s of["import","require","default"]){let n=dr(r[s],e);if(n)return n}}return null}function Lo(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 Go(t,e){let r=new Set,s=new Set,n=[...e];for(;n.length;){let o=n.shift();if(s.has(o))continue;s.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 u of p.exports)r.add(u.name);n.push(a.toPath)}else for(let p of a.symbols)r.add(p)}}}return r}function ot(t,e){let r=[],s=Ao.join(e,"package.json");if(gr.existsSync(s))try{let n=JSON.parse(gr.readFileSync(s,"utf8"));if(n.exports&&typeof n.exports=="object"&&!Array.isArray(n.exports))for(let o of Object.values(n.exports)){let i=dr(o,t);i&&!r.includes(i)&&r.push(i)}else if(typeof n.exports=="string"){let o=nt(n.exports,t);o&&r.push(o)}if(r.length===0)for(let o of[n.main,n.module].filter(Boolean)){let i=nt(o,t);i&&!r.includes(i)&&r.push(i)}}catch{}if(r.length===0){for(let n of["src/index.ts","src/index.js","index.ts","index.js"])if(t.nodes.has(n)){r.push(n);break}}return r}function Oo(t,e){let r=new Set(e);for(let s of e)t.traverse(s,n=>(r.add(n.path),!0),{direction:"outgoing"});return r}function jo(t,e,r){let s=new Map;for(let n of e){if(r.includes(n))continue;let o=t.nodes.get(n);if(!o)continue;let i=o.category==="barrel";for(let a of o.exports){let c=s.get(a.name),p=!!(a.signature||a.doc);(!c||p&&!i)&&s.set(a.name,{file:n,symbol:a})}}return s}function _o(t,e,r,s){let n=[];for(let o of t){let i=e.get(o),a=s.flatMap(m=>r.nodes.get(m)?.exports??[]).find(m=>m.name===o),c=i?.symbol??a,p=i?.file??s.find(m=>r.nodes.get(m)?.exports.some(h=>h.name===o))??s[0],u={name:o,definedIn:p,kind:Lo(c?.signature)};c?.doc&&(u.doc=c.doc),c?.signature&&(u.signature=c.signature),n.push(u)}return n.sort((o,i)=>o.name.localeCompare(i.name)),n}function Wo(t,e,r){let s=c=>t.nodes.get(c)?.category==="test",n=[...e].filter(c=>!r.includes(c)&&!s(c)),o=[...t.nodes.keys()].filter(c=>!e.has(c)),i=o.filter(c=>!s(c)),a=o.filter(c=>s(c));return{internalFiles:n,unreachableFromEntry:i,testFiles:a}}function it(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=Oo(t,e),s=jo(t,r,e),n=Go(t,e),o=_o(n,s,t,e),{internalFiles:i,unreachableFromEntry:a,testFiles:c}=Wo(t,r,e);return{entryPoints:e,publicExports:o,internalFiles:i,unreachableFromEntry:a,testFiles:c}}var at=l(()=>{"use strict"});function ct(t,e){let r=null,s=[];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&&s.push({file:o.path,callerFunction:i.from})}let n=[];if(r){let o=t.nodes.get(r);for(let i of o?.callEdges??[])i.from===e&&n.push({file:i.toFile,calleeFunction:i.to})}return{functionName:e,definedIn:r,callers:s,callees:n}}var pt=l(()=>{"use strict"});import hp from"fs";import xp from"path";var lt=l(()=>{"use strict"});import Se from"path";function zo(t){let e=new Map;for(let[r,s]of t){let n=s.imports.filter(o=>o.toPath&&!o.isExternal).length;n>0&&e.set(r,n)}return e}function $o(t,e,r){let s=new Map;for(let[n,o]of e){if(o<r)continue;let i=t.get(n);if(!i||i.category==="test"||i.category==="barrel")continue;let a=Se.extname(n),c=Se.basename(n,a),p=c==="index"?Se.basename(Se.dirname(n)):c;s.set(n,{path:n,outDegree:o,tag:`feature:${p}`})}return s}function A(t,e){let r=e?.minOutDegree??5;return $o(t,zo(t),r)}var be=l(()=>{"use strict"});function Bo(t,e){let r=new Map;for(let s of e.values()){let n=new Set;t.traverse(s.path,o=>(o.path!==s.path&&n.add(o.path),!0),{direction:"outgoing"}),r.set(s.path,n)}return r}function Jo(t,e,r,s){let n=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||s(a,i)<0)&&(i=a);i&&n.set(o,i.path)}return n}function Ko(t,e){let r=new Map;for(let s of t.values()){let n=s.tag.replace("feature:",""),o=[];for(let[i,a]of e)a===s.path&&o.push(i);r.set(n,{hub:s.path,outDegree:s.outDegree,files:o})}return r}function Ho(t,e,r){let s=[];for(let n of t.keys())!e.has(n)&&!r.has(n)&&s.push(n);return s}function Z(t,e){let r=e?.detectFn??A,s=e?.hubComparator??Uo,n=r(t.nodes,e),o=Bo(t,n),i=Jo(t.nodes,n,o,s);return{features:Ko(n,i),unassigned:Ho(t.nodes,n,i)}}var Uo,ve=l(()=>{"use strict";be();Uo=(t,e)=>t.outDegree-e.outDegree});var Y,hr=l(()=>{"use strict";Y=class{constructor(e){this.nodes=e}nodes;findUnusedFiles(e){let r=new Set(this.nodes.keys());return e.filter(s=>!r.has(s))}findHighExportUsage(e){let r=[];for(let s of this.nodes.values()){if(s.maxExportUsage===void 0||s.maxExportUsage<e)continue;let n=s.imports.reduce((o,i)=>(i.exportUsageRatio??0)>(o?.exportUsageRatio??0)?i:o,null);r.push({path:s.path,maxExportUsage:s.maxExportUsage,tightestDep:n?.toPath??""})}return r.sort((s,n)=>n.maxExportUsage-s.maxExportUsage)}findCycles(){let e=[],r=new Set,s=new Set,n=[],o=i=>{r.add(i),s.add(i),n.push(i);let a=this.nodes.get(i);if(a){for(let c of a.imports)if(!(!c.toPath||c.isExternal))if(s.has(c.toPath)){let p=n.indexOf(c.toPath);e.push([...n.slice(p),c.toPath])}else r.has(c.toPath)||o(c.toPath)}s.delete(i),n.pop()};for(let i of this.nodes.keys())r.has(i)||o(i);return e}}});var F,ee=l(()=>{"use strict";hr();F=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 s of e.nodes)r.set(s.path,s);return new t(r)}getIncomingEdgesMap(){if(this._incomingEdgesCache)return this._incomingEdgesCache;let e=new Map;for(let r of this.nodes.values())for(let s of r.imports)if(s.toPath){let n=e.get(s.toPath)||[];n.push(r.path),e.set(s.toPath,n)}return this._incomingEdgesCache=e,e}dfs(e,r,s,n){let o=new Set,i=s.maxDepth??1/0,a=(c,p,u)=>{if(p>i||o.has(c))return;let m=this.nodes.get(c);if(m&&(o.add(c),r(m,p,u)!==!1))for(let h of n(c))a(h,p+1,c)};a(e,0,null)}traverse(e,r,s={}){let n=s.direction??"outgoing",o=n==="incoming"?this.getIncomingEdgesMap():null;this.dfs(e,r,s,i=>n==="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 s of r.callEdges??[]){let n=e.get(s.toFile)??[];n.push(r.path),e.set(s.toFile,n)}return this._callIncomingCache=e,e}traverseCalls(e,r,s={}){let n=s.direction??"outgoing",o=n==="incoming"?this.getCallIncomingCache():null;this.dfs(e,r,s,i=>n==="outgoing"?this.nodes.get(i)?.callEdges?.map(a=>a.toFile)??[]:o?.get(i)??[])}getCallers(e){let r=[];return this.traverseCalls(e,s=>(s.path!==e&&r.push(s.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(s=>this.nodes.get(s.toPath)).filter(s=>s!==void 0):[]}findUnusedFiles(e){return new Y(this.nodes).findUnusedFiles(e)}findCycles(){return new Y(this.nodes).findCycles()}}});function yr(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 d(e,"component")||d(e,"components")?"component":d(e,"controller")||d(e,"controllers")?"controller":d(e,"middleware")?"middleware":d(e,"router")||d(e,"routes")||d(e,"route")?"router":d(e,"store")||d(e,"stores")?"store":d(e,"service")||d(e,"services")?"service":d(e,"handler")||d(e,"handlers")?"handler":d(e,"adapter")||d(e,"adapters")?"adapter":d(e,"plugin")||d(e,"plugins")?"plugin":d(e,"api")?"api":d(e,"cli")||d(e,"commands")||te(e)==="cli"?"cli":d(e,"util")||d(e,"utils")||d(e,"helper")||d(e,"helpers")?"util":d(e,"model")||d(e,"models")||te(e)==="model"?"model":d(e,"parser")||d(e,"parsers")||te(e)==="parser"?"parser":te(e)==="builder"?"builder":te(e)==="resolver"?"resolver":"other"}function d(t,e){return t.includes(`/${e}/`)||t.includes(`/${e}.`)}function te(t){let e=t.slice(t.lastIndexOf("/")+1);return e.slice(0,e.lastIndexOf("."))||e}var xr=l(()=>{"use strict"});function ft(t,e){let r=Z(t,e),s=new Map;for(let[o,i]of r.features){for(let a of i.files)s.set(a,o);s.set(i.hub,o)}let n=new Map;for(let o of t.nodes.values()){let i=s.get(o.path);n.set(o.path,{path:o.path,role:yr(o),...o.description?{description:o.description}:{},exports:o.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return n}var ut=l(()=>{"use strict";ve();xr()});var re,mt=l(()=>{"use strict";re=class{affectedSymbols=new Map;constructor(e,r){this.affectedSymbols.set(e,new Set(["default",...r]))}updateAffectedSymbols(e,r){let s=this.affectedSymbols.get(r)||new Set,n=e.imports.find(c=>c.toPath===r);if(!n)return!1;let o=n.symbols||["*"],i=new Set;for(let c of o)(c==="*"||s.has("*")||s.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 qo(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function Vo(t,e){if(e==="type-only")return!0;let r=t.signature??"";return r.startsWith("interface ")||r.startsWith("class ")||r.startsWith("enum ")}function gt(t){let e=new Map;for(let s of t.nodes.values())if(!(s.type!=="typescript"&&s.type!=="javascript"))for(let n of s.exports){if(!Vo(n,s.category))continue;let o=`${s.path}::${n.name}`;e.set(o,{name:n.name,file:s.path,kind:qo(n.signature),...n.doc?{doc:n.doc}:{}})}let r=[];for(let s of t.nodes.values())if(!(s.type!=="typescript"&&s.type!=="javascript")){for(let n of s.imports)if(!(!n.toPath||n.isExternal||!n.symbols?.length))for(let o of n.symbols)e.has(`${n.toPath}::${o}`)&&r.push({fromFile:s.path,toType:o,toFile:n.toPath})}return{types:e,edges:r}}function dt(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 s=new Set,n=new Map;for(let o of t.edges)if(o.toType===e&&o.toFile===r.file&&s.add(o.fromFile),o.fromFile===r.file){let i=t.types.get(`${o.toFile}::${o.toType}`);i&&n.set(`${i.file}::${i.name}`,i)}return{type:r,usedByFiles:Array.from(s),uses:Array.from(n.values())}}var ht=l(()=>{"use strict"});import Sr from"fs";import Lp from"path";function br(t){try{return Sr.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function Ce(t){try{return Sr.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Ee=l(()=>{"use strict"});import se from"fs";import E from"path";function yt(t,e){let r=E.join(e,"package.json");if(!se.existsSync(r))return null;let s={};try{s=JSON.parse(se.readFileSync(r,"utf-8"))}catch{return null}let n=s.name;return n?{name:n,root:e,relativeRoot:E.relative(t,e),entryPoints:Qo(e,s)}:null}function Qo(t,e){let r=[];if(e.exports){let n=e.exports;if(typeof n=="string")r.push(E.join(t,n));else if(typeof n=="object"&&n!==null){let o=n["."];if(typeof o=="string")r.push(E.join(t,o));else if(typeof o=="object"&&o!==null){let i=o.import??o.require??o.default;typeof i=="string"&&r.push(E.join(t,i))}}}e.main&&r.push(E.join(t,e.main));for(let n of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])r.push(E.join(t,n));let s=r.filter(Ce);return s.length>0?s.slice(0,1):r.slice(0,1)}function j(t,e){let r=[],s=new Set;for(let n of e){let o=n.replace(/\/$/,"").replace(/^\.\//,"");Xo(t,o,s,r)}return r}function Xo(t,e,r,s){if(!e.includes("*")){Zo(t,e,r,s);return}let n=e.split("/");n.includes("**")?Yo(t,n,r,s):ei(t,n,r,s)}function Zo(t,e,r,s){let n=E.join(t,e);if(r.has(n)||!br(n))return;r.add(n);let o=yt(t,n);o&&s.push(o)}function Yo(t,e,r,s){let n=E.join(t,e[0]==="**"?"":e[0]??"");vr(t,n,r,s)}function ei(t,e,r,s){let n=e.findIndex(a=>a.includes("*")),o=E.join(t,...e.slice(0,n)),i;try{i=se.readdirSync(o,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let c=E.join(o,a.name);if(r.has(c))continue;r.add(c);let p=yt(t,c);p&&s.push(p)}}function vr(t,e,r,s){let n;try{n=se.readdirSync(e,{withFileTypes:!0})}catch{return}for(let o of n){if(!o.isDirectory()||o.name==="node_modules"||o.name.startsWith("."))continue;let i=E.join(e,o.name);if(se.existsSync(E.join(i,"package.json"))&&!r.has(i)){r.add(i);let a=yt(t,i);a&&s.push(a)}else vr(t,i,r,s)}}var ke=l(()=>{"use strict";Ee();Ee()});import xt from"fs";import Cr from"path";var Er,kr=l(()=>{"use strict";ke();Er={type:"npm",detect(t){let e=Cr.join(t,"package.json");if(!xt.existsSync(e))return null;let r;try{r=JSON.parse(xt.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r||xt.existsSync(Cr.join(t,"yarn.lock")))return null;let s=Array.isArray(r)?r:r.packages??[];return s.length===0?null:j(t,s)}}});import _ from"fs";import S from"path";function wr(t,e,r,s){if(s>4)return[];let n;try{n=_.readdirSync(e,{withFileTypes:!0})}catch{return[]}let o=[];for(let i of n){if(!i.isDirectory())continue;let a=i.name;if(a.startsWith(".")||a==="node_modules"||a==="dist"||a===".nx")continue;let c=S.join(e,a);_.existsSync(S.join(c,"project.json"))&&!r.has(c)?(r.add(c),o.push(c)):o.push(...wr(t,c,r,s+1))}return o}function ti(t,e,r){let s={};try{s=JSON.parse(_.readFileSync(r,"utf-8"))}catch{return null}let n=s.name,o,i,a=S.join(e,"package.json");if(_.existsSync(a))try{let c=JSON.parse(_.readFileSync(a,"utf-8"));n=c.name??n,o=c.main,i=c.exports}catch{}return n?{name:n,root:e,relativeRoot:S.relative(t,e),entryPoints:ri(e,s,o,i)}:null}function ri(t,e,r,s){let n=[],o=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(o){let a=S.resolve(t,"../..");n.push(S.resolve(a,o)),n.push(S.resolve(t,o))}if(s){let a=s;if(typeof a=="string")n.push(S.join(t,a));else if(typeof a=="object"&&a!==null){let c=a["."];typeof c=="string"&&n.push(S.join(t,c))}}if(r&&n.push(S.join(t,r)),e.sourceRoot){let a=S.resolve(t,"../.."),c=S.resolve(a,e.sourceRoot);n.push(S.join(c,"index.ts"),S.join(c,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])n.push(S.join(t,a));let i=n.filter(Ce);return i.length>0?i.slice(0,1):n.slice(0,1)}var Fr,Tr=l(()=>{"use strict";Ee();Fr={type:"nx",detect(t){return _.existsSync(S.join(t,"nx.json"))?wr(t,t,new Set,0).map(r=>ti(t,r,S.join(r,"project.json"))).filter(r=>r!==null):null}}});import Pr from"fs";import si from"path";import ni from"js-yaml";var Ir,Nr=l(()=>{"use strict";ke();Ir={type:"pnpm",detect(t){let e=si.join(t,"pnpm-workspace.yaml");if(!Pr.existsSync(e))return null;let r=[];try{r=ni.load(Pr.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return j(t,r)}}});import oi from"fs";import ii from"path";var Mr,Dr=l(()=>{"use strict";Mr={type:"turborepo",detect(t){return oi.existsSync(ii.join(t,"turbo.json"))?[]:null}}});import St from"fs";import Rr from"path";var Ar,Lr=l(()=>{"use strict";ke();Ar={type:"yarn",detect(t){if(!St.existsSync(Rr.join(t,"yarn.lock")))return null;let e=Rr.join(t,"package.json");if(!St.existsSync(e))return null;let r;try{r=JSON.parse(St.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r)return null;let s=Array.isArray(r)?r:r.packages??[];return s.length===0?null:j(t,s)}}});function N(t){ai.push(t)}var ai,Fe=l(()=>{"use strict";ai=[]});import ul from"path";var bt=l(()=>{"use strict";kr();Tr();Nr();Dr();Lr();Fe();Fe();N(Mr);N(Fr);N(Ir);N(Ar);N(Er)});var vt=l(()=>{"use strict";ee()});function W(t,e){Gr.set(t,e)}function Or(t){return Gr.get(t)}var Gr,ne=l(()=>{"use strict";Gr=new Map});function jr(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function ci(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}var pi,li,fi,ui,mi,gi,di,hi,yi,xi,Si,bi,vi,Ci,Ei,ki,Fi,_r,Wr=l(()=>{"use strict";pi=(t,e)=>!e.category||jr(t.category,e.category),li=(t,e)=>!e.type||jr(t.type,e.type),fi=(t,e)=>!e.path||ci(t.path,e.path),ui=(t,e)=>e.isExternal===void 0?!0:t.imports.some(s=>s.isExternal)===e.isExternal,mi=(t,e)=>{if(!e.tags||e.tags.length===0)return!0;let r=e.tags.filter(n=>!n.startsWith("!")),s=e.tags.filter(n=>n.startsWith("!")).map(n=>n.slice(1));return!(r.length>0&&!r.some(n=>t.tags.some(o=>o.name===n))||s.some(n=>t.tags.some(o=>o.name===n)))},gi=(t,e)=>!e.allTags?.length||e.allTags.every(r=>t.tags.some(s=>s.name===r)),di=(t,e)=>!e.importsFile||t.imports.some(r=>r.toPath?.includes(e.importsFile)),hi=(t,e,r)=>e.importedBy===void 0?!0:(r?.get(t.path)??[]).some(n=>n.includes(e.importedBy)),yi=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,xi=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,Si=(t,e)=>e.minSize===void 0||t.size>=e.minSize,bi=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,vi=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,Ci=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,Ei=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,ki=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,Fi=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,_r=[pi,li,fi,ui,mi,gi,di,hi,yi,xi,Si,bi,vi,Ci,Ei,ki,Fi]});function zr(t,e,r){return _r.every(s=>s(t,e,r))}function we(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 s=t.nodes.filter(i=>zr(i,e,r)),n=new Set(s.map(i=>i.path)),o=s.map(i=>({...i,imports:i.imports.filter(a=>!a.toPath||n.has(a.toPath))}));return e.sort&&o.sort((i,a)=>e.sort==="size"?a.size-i.size:e.sort==="imports"?a.imports.length-i.imports.length:e.sort==="commitCount90d"?(a.commitCount90d??0)-(i.commitCount90d??0):e.sort==="exportUsage"?(a.avgExportUsage??0)-(i.avgExportUsage??0):0),e.limit!==void 0&&o.splice(e.limit),{nodes:o,cycles:t.cycles?.filter(i=>i.every(a=>n.has(a)))??void 0}}var $r=l(()=>{"use strict";Wr()});function Te(t){let e={},r=t.split(",");for(let s of r){let n=s.indexOf(":");if(n===-1)continue;let o=s.slice(0,n).trim().toLowerCase(),i=s.slice(n+1).trim();if(!(!o||!i))switch(o){case"category":e.category=i;break;case"type":e.type=i;break;case"tag":case"tags":i.includes("+")?e.allTags=[...e.allTags??[],...i.split("+")]:e.tags=[...e.tags??[],i];break;case"path":e.path=i;break;case"external":e.isExternal=i.toLowerCase()==="true";break;case"importsfile":e.importsFile=i;break;case"importedby":e.importedBy=i;break;case"minimports":e.minImports=parseInt(i,10);break;case"maximports":e.maxImports=parseInt(i,10);break;case"minsize":e.minSize=parseInt(i,10);break;case"maxsize":e.maxSize=parseInt(i,10);break;case"sort":e.sort=i;break;case"limit":e.limit=parseInt(i,10);break;case"hasdocstring":e.hasDocstring=i.toLowerCase()!=="false";break;case"mincoverage":e.minCoverage=parseInt(i,10);break;case"maxcoverage":e.maxCoverage=parseInt(i,10);break;case"minexportusage":e.minExportUsage=parseFloat(i);break;case"maxexportusage":e.maxExportUsage=parseFloat(i);break}}return e}var Ur=l(()=>{"use strict"});var Br=l(()=>{"use strict";$r();Ur()});import b from"typescript";function z(t){let e=[];for(let r of t.statements){if(!b.isExpressionStatement(r))continue;let s=r.expression;if(!b.isCallExpression(s))continue;let n=s.expression;b.isIdentifier(n)&&Jr.has(n.text)&&e.push(s),b.isPropertyAccessExpression(n)&&b.isIdentifier(n.expression)&&Jr.has(n.expression.text)&&e.push(s)}return e}function $(t,e,r){for(let s of t.arguments){if(!b.isObjectLiteralExpression(s))continue;let n=s.properties.find(o=>b.isPropertyAssignment(o)&&b.isIdentifier(o.name)&&o.name.text===e);if(!(!n||!b.isArrayLiteralExpression(n.initializer)))return n.initializer.elements.filter(b.isStringLiteral).map(o=>o.text)}return null}function U(t,e,r,s){if(t.arguments.length===0)return null;for(let o=1;o<t.arguments.length;o++){let i=t.arguments[o];if(!b.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>b.isPropertyAssignment(p)&&b.isIdentifier(p.name)&&p.name.text===e);if(a)return{start:a.initializer.getStart(s),end:a.initializer.getEnd(),text:r};let c=i.getEnd()-1;return{start:c,end:c,text:`${i.properties.length>0?", ":""}${e}: ${r}`}}let n=t.arguments[t.arguments.length-1];return{start:n.getStart(s),end:n.getStart(s),text:`{ ${e}: ${r} }, `}}function B(t,e,r){let s=t.arguments;for(let n=1;n<s.length;n++){let o=s[n];if(!b.isObjectLiteralExpression(o))continue;let i=o.properties.findIndex(c=>b.isPropertyAssignment(c)&&b.isIdentifier(c.name)&&c.name.text===e);if(i<0)continue;if(o.properties.length===1)return{start:s[n-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 J(t,e){let r=[...e].sort((n,o)=>o.start-n.start),s=t;for(let n of r)s=s.slice(0,n.start)+n.text+s.slice(n.end);return s}function K(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}var Jr,P,H=l(()=>{"use strict";Jr=new Set(["describe","test","it"]);P=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import Kr from"path";import Hr from"typescript";function wi(t){return K(t.map(e=>`@${e}`))}function Ti(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var Pe,qr=l(()=>{"use strict";H();Pe=class{name="cypress";canHandle(e){return P.has(Kr.extname(e).toLowerCase())}apply(e,r,s){let n=Hr.createSourceFile(Kr.basename(e),r,Hr.ScriptTarget.Latest,!0),o=z(n);if(o.length===0)return r;let i=$(o[0],"tags",n),a=[...s].sort();if(i!==null&&JSON.stringify(Ti(i).sort())===JSON.stringify(a))return r;let c=o.flatMap(p=>{let u=s.length===0?B(p,"tags",n):U(p,"tags",wi(a),n);return u?[u]:[]});return c.length>0?J(r,c):r}}});import Pi from"path";function Ii(t){return["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
2
+ var ot=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var u=(r,e)=>()=>(r&&(e=r(r=0)),e);var Zi=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);import Yi from"path";import{fileURLToPath as ea}from"url";var ta,ra,f,c=u(()=>{"use strict";ta=()=>ea(import.meta.url),ra=()=>Yi.dirname(ta()),f=ra()});function we(r){qr.push(r)}function Kr(r){return[...sa,...qr].some(e=>typeof e=="string"?r.includes(e):e instanceof RegExp?e.test(r):e(r))}function Ee(r){Hr.push(r)}function se(){return[...na,...Hr]}function Fe(r){Vr.push(r)}function it(){return[...oa,...Vr]}function at(r){Qr=r}function ct(){return Qr}var sa,qr,na,Hr,oa,Vr,Qr,$=u(()=>{"use strict";c();sa=[".config.","biome.json","tsconfig.json","package.json",".prettierrc",".eslintrc"],qr=[];na=[".test.",".spec.","-test.","-spec."],Hr=[];oa=["jest","vitest","playwright","cypress","@testing-library/"],Vr=[];Qr=.8});import pt from"fs";import Xr from"path";function U(r,{allowJs:e=!0,isExplicitPath:t=!1}={}){if(t){let s=Xr.resolve(r);return pt.existsSync(s)?s.endsWith(".json")?Zr(s):e?Yr(s):{}:{}}for(let s of ia){let n=Xr.resolve(r,s);if(pt.existsSync(n)){if(s.endsWith(".json"))return Zr(n);if(e)return Yr(n)}}return{}}function Zr(r){return JSON.parse(pt.readFileSync(r,"utf-8"))}function Yr(r){let e=ot(r);return e&&typeof e=="object"&&"default"in e&&(e=e.default),typeof e=="function"?e({}):e}function lt(r){for(let e of r.configMatchers??[])we(e);for(let e of r.testPatterns??[])Ee(e);for(let e of r.testLibraries??[])Fe(e);r.barrelThreshold!==void 0&&at(r.barrelThreshold)}var ia,ft=u(()=>{"use strict";c();$();ia=["mokosh.config.js","mokosh.config.cjs","mokosh.config.json"]});var ut,mt,gt=u(()=>{"use strict";c();ut=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"],mt=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".go",".feature",".md",".mdx"]});import Hl from"fs";import Ql from"path";var es=u(()=>{"use strict";c()});var Pe,ts=u(()=>{"use strict";c();Pe={serialize(r){let e=["graph TD"],t=new Set;for(let s of r.nodes.values()){let n=`"${s.path}"`;for(let o of s.imports){if(!o.toPath)continue;let i=`"${o.toPath}"`,a=`${s.path} -> ${o.toPath}`;if(!t.has(a)){let p=o.isStyle?"-- styles -->":"-->";e.push(` ${n} ${p} ${i}`),t.add(a)}}}return e.join(`
3
+ `)}}});var rs=u(()=>{"use strict";c();ts()});import ss from"fs";import ca from"path";function dt(r,e){let t=r.replace(/^\.\//,"");if(e.nodes.has(t))return t;let s=t.replace(/^dist\//,"src/").replace(/\.(js|mjs|cjs)$/,".ts");return e.nodes.has(s)?s:null}function ns(r,e){if(typeof r=="string")return dt(r,e);if(r&&typeof r=="object"){let t=r;for(let s of["import","require","default"]){let n=ns(t[s],e);if(n)return n}}return null}function pa(r){if(!r)return"unknown";let e=r.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 la(r,e){let t=new Set,s=new Set,n=[...e];for(;n.length;){let o=n.shift();if(s.has(o))continue;s.add(o);let i=r.nodes.get(o);if(i){for(let a of i.exports)t.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 l=r.nodes.get(a.toPath);if(l)for(let d of l.exports)t.add(d.name);n.push(a.toPath)}else for(let l of a.symbols)t.add(l)}}}return t}function ht(r,e){let t=[],s=ca.join(e,"package.json");if(ss.existsSync(s))try{let n=JSON.parse(ss.readFileSync(s,"utf8"));if(n.exports&&typeof n.exports=="object"&&!Array.isArray(n.exports))for(let o of Object.values(n.exports)){let i=ns(o,r);i&&!t.includes(i)&&t.push(i)}else if(typeof n.exports=="string"){let o=dt(n.exports,r);o&&t.push(o)}if(t.length===0)for(let o of[n.main,n.module].filter(Boolean)){let i=dt(o,r);i&&!t.includes(i)&&t.push(i)}}catch{}if(t.length===0){for(let n of["src/index.ts","src/index.js","index.ts","index.js"])if(r.nodes.has(n)){t.push(n);break}}return t}function fa(r,e){let t=new Set(e);for(let s of e)r.traverse(s,n=>(t.add(n.path),!0),{direction:"outgoing"});return t}function ua(r,e,t){let s=new Map;for(let n of e){if(t.includes(n))continue;let o=r.nodes.get(n);if(!o)continue;let i=o.category==="barrel";for(let a of o.exports){let p=s.get(a.name),l=!!(a.signature||a.doc);(!p||l&&!i)&&s.set(a.name,{file:n,symbol:a})}}return s}function ma(r,e,t,s){let n=[];for(let o of r){let i=e.get(o),a=s.flatMap(h=>t.nodes.get(h)?.exports??[]).find(h=>h.name===o),p=i?.symbol??a,l=i?.file??s.find(h=>t.nodes.get(h)?.exports.some(x=>x.name===o))??s[0],d={name:o,definedIn:l,kind:pa(p?.signature)};p?.doc&&(d.doc=p.doc),p?.signature&&(d.signature=p.signature),n.push(d)}return n.sort((o,i)=>o.name.localeCompare(i.name)),n}function ga(r,e,t){let s=p=>r.nodes.get(p)?.category==="test",n=[...e].filter(p=>!t.includes(p)&&!s(p)),o=[...r.nodes.keys()].filter(p=>!e.has(p)),i=o.filter(p=>!s(p)),a=o.filter(p=>s(p));return{internalFiles:n,unreachableFromEntry:i,testFiles:a}}function yt(r,e){if(e.length===0)throw new Error("buildApiSurface requires at least one entry point");for(let l of e)if(!r.nodes.has(l))throw new Error(`Entry point not found in graph: ${l}`);let t=fa(r,e),s=ua(r,t,e),n=la(r,e),o=ma(n,s,r,e),{internalFiles:i,unreachableFromEntry:a,testFiles:p}=ga(r,t,e);return{entryPoints:e,publicExports:o,internalFiles:i,unreachableFromEntry:a,testFiles:p}}var xt=u(()=>{"use strict";c()});function St(r,e){let t=null,s=[];for(let o of r.nodes.values()){o.exports.some(i=>i.name===e)&&(t=o.path);for(let i of o.callEdges??[])i.to===e&&s.push({file:o.path,callerFunction:i.from})}let n=[];if(t){let o=r.nodes.get(t);for(let i of o?.callEdges??[])i.from===e&&n.push({file:i.toFile,calleeFunction:i.to})}return{functionName:e,definedIn:t,callers:s,callees:n}}var bt=u(()=>{"use strict";c()});import uf from"fs";import gf from"path";function os(r){let e=[...r.nodes.entries()].sort(([s],[n])=>s.localeCompare(n)).map(([s,n])=>`${s}:${n.mtime}:${n.size}`).join("|"),t=2166136261;for(let s=0;s<e.length;s++)t^=e.charCodeAt(s),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function vt(r){let e=new Map;for(let t of r.nodes.keys()){let s=[];r.traverse(t,n=>(n.path!==t&&s.push(n.path),!0),{direction:"incoming"}),e.set(t,s)}return{impact:e,graphHash:os(r)}}function Ct(r,e){return r.impact.get(e)??[]}var kt=u(()=>{"use strict";c()});import Te from"path";function da(r){let e=new Map;for(let[t,s]of r){let n=s.imports.filter(o=>o.toPath&&!o.isExternal).length;n>0&&e.set(t,n)}return e}function ha(r,e,t){let s=new Map;for(let[n,o]of e){if(o<t)continue;let i=r.get(n);if(!i||i.category==="test"||i.category==="barrel")continue;let a=Te.extname(n),p=Te.basename(n,a),l=p==="index"?Te.basename(Te.dirname(n)):p;s.set(n,{path:n,outDegree:o,tag:`feature:${l}`})}return s}function _(r,e){let t=e?.minOutDegree??5;return ha(r,da(r),t)}var Ne=u(()=>{"use strict";c()});function xa(r,e){let t=new Map;for(let s of e.values()){let n=new Set;r.traverse(s.path,o=>(o.path!==s.path&&n.add(o.path),!0),{direction:"outgoing"}),t.set(s.path,n)}return t}function Sa(r,e,t,s){let n=new Map;for(let[o]of r){if(e.has(o))continue;let i=null;for(let a of e.values())t.get(a.path)?.has(o)&&(!i||s(a,i)<0)&&(i=a);i&&n.set(o,i.path)}return n}function ba(r,e){let t=new Map;for(let s of r.values()){let n=s.tag.replace("feature:",""),o=[];for(let[i,a]of e)a===s.path&&o.push(i);t.set(n,{hub:s.path,outDegree:s.outDegree,files:o})}return t}function va(r,e,t){let s=[];for(let n of r.keys())!e.has(n)&&!t.has(n)&&s.push(n);return s}function ne(r,e){let t=e?.detectFn??_,s=e?.hubComparator??ya,n=t(r.nodes,e),o=xa(r,n),i=Sa(r.nodes,n,o,s);return{features:ba(n,i),unassigned:va(r.nodes,n,i)}}var ya,Ie=u(()=>{"use strict";c();Ne();ya=(r,e)=>r.outDegree-e.outDegree});var oe,is=u(()=>{"use strict";c();oe=class{constructor(e){this.nodes=e}nodes;findUnusedFiles(e){let t=new Set(this.nodes.keys());return e.filter(s=>!t.has(s))}findHighExportUsage(e){let t=[];for(let s of this.nodes.values()){if(s.maxExportUsage===void 0||s.maxExportUsage<e)continue;let n=s.imports.reduce((o,i)=>(i.exportUsageRatio??0)>(o?.exportUsageRatio??0)?i:o,null);t.push({path:s.path,maxExportUsage:s.maxExportUsage,tightestDep:n?.toPath??""})}return t.sort((s,n)=>n.maxExportUsage-s.maxExportUsage)}findCycles(){let e=[],t=new Set,s=new Set,n=[],o=i=>{t.add(i),s.add(i),n.push(i);let a=this.nodes.get(i);if(a){for(let p of a.imports)if(!(!p.toPath||p.isExternal))if(s.has(p.toPath)){let l=n.indexOf(p.toPath);e.push([...n.slice(l),p.toPath])}else t.has(p.toPath)||o(p.toPath)}s.delete(i),n.pop()};for(let i of this.nodes.keys())t.has(i)||o(i);return e}}});var F,ie=u(()=>{"use strict";c();is();F=class r{constructor(e){this.nodes=e}nodes;_incomingEdgesCache=null;_callIncomingCache=null;serialize(){return{nodes:Array.from(this.nodes.values())}}static deserialize(e){let t=new Map;for(let s of e.nodes)t.set(s.path,s);return new r(t)}getIncomingEdgesMap(){if(this._incomingEdgesCache)return this._incomingEdgesCache;let e=new Map;for(let t of this.nodes.values())for(let s of t.imports)if(s.toPath){let n=e.get(s.toPath)||[];n.push(t.path),e.set(s.toPath,n)}return this._incomingEdgesCache=e,e}dfs(e,t,s,n){let o=new Set,i=s.maxDepth??1/0,a=(p,l,d)=>{if(l>i||o.has(p))return;let h=this.nodes.get(p);if(h&&(o.add(p),t(h,l,d)!==!1))for(let x of n(p))a(x,l+1,p)};a(e,0,null)}traverse(e,t,s={}){let n=s.direction??"outgoing",o=n==="incoming"?this.getIncomingEdgesMap():null;this.dfs(e,t,s,i=>n==="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 t of this.nodes.values())for(let s of t.callEdges??[]){let n=e.get(s.toFile)??[];n.push(t.path),e.set(s.toFile,n)}return this._callIncomingCache=e,e}traverseCalls(e,t,s={}){let n=s.direction??"outgoing",o=n==="incoming"?this.getCallIncomingCache():null;this.dfs(e,t,s,i=>n==="outgoing"?this.nodes.get(i)?.callEdges?.map(a=>a.toFile)??[]:o?.get(i)??[])}getCallers(e){let t=[];return this.traverseCalls(e,s=>(s.path!==e&&t.push(s.path),!0),{direction:"incoming",maxDepth:1}),t}getCallEdgesFor(e){return this.nodes.get(e)?.callEdges??[]}getNeighbors(e){let t=this.nodes.get(e);return t?t.imports.map(s=>this.nodes.get(s.toPath)).filter(s=>s!==void 0):[]}findUnusedFiles(e){return new oe(this.nodes).findUnusedFiles(e)}findCycles(){return new oe(this.nodes).findCycles()}}});var W,Me=u(()=>{"use strict";c();W=class{affectedSymbols=new Map;constructor(e,t){this.affectedSymbols.set(e,new Set(["default",...t]))}updateAffectedSymbols(e,t){let s=this.affectedSymbols.get(t)||new Set,n=e.imports.find(p=>p.toPath===t);if(!n)return!1;let o=n.symbols||["*"],i=new Set;for(let p of o)(p==="*"||s.has("*")||s.has(p))&&i.add("*");if(i.size===0)return!1;let a=this.affectedSymbols.get(e.path)||new Set;for(let p of i)a.add(p);return this.affectedSymbols.set(e.path,a),!0}}});function wt(r,e,t=1){let s=[];return r.traverse(e,(n,o,i)=>{if(n.path===e)return!0;let a=i?r.nodes.get(i)?.imports.find(p=>p.toPath===n.path):void 0;return s.push({path:n.path,...a?.symbols?{symbols:a.symbols}:{}}),!0},{direction:"outgoing",maxDepth:t}),s}function Et(r,e){let t=[];return r.traverse(e,s=>{if(s.path===e)return!0;let n=s.imports.find(o=>o.toPath===e);return t.push({path:s.path,...n?.symbols?{symbols:n.symbols}:{}}),!0},{direction:"incoming",maxDepth:1}),t}function Ft(r,e,t={}){let{testsOnly:s=!1,changedSymbols:n}=t,o=n?new W(e,n):null,i=[];return r.traverse(e,(a,p,l)=>{if(a.path===e)return!0;if(o&&l&&!o.updateAffectedSymbols(a,l))return!1;let d=a.category==="test"||a.tags.some(h=>h.name==="test");return(!s||d)&&i.push(a.path),!0},{direction:"incoming"}),i}function Pt(r,e,t={}){let{depth:s=1,withEdgeDetail:n=!1}=t,o=[];return r.traverseCalls(e,i=>{if(i.path===e)return!0;let a={file:i.path};return n&&(a.edges=(i.callEdges??[]).filter(p=>p.toFile===e).map(p=>({from:p.from,to:p.to}))),o.push(a),!0},{direction:"incoming",maxDepth:s}),o}function Tt(r,e={}){let{metric:t="cognitiveComplexity",threshold:s=10,limit:n=20}=e;return[...r.nodes.values()].flatMap(o=>(o.functions??[]).filter(i=>i[t]>=s).map(i=>({file:o.path,name:i.name,line:i.line,complexity:i.complexity,cognitiveComplexity:i.cognitiveComplexity}))).sort((o,i)=>i[t]-o[t]).slice(0,n)}function Nt(r){return{nodes:r.nodes.map(t=>({path:t.path,type:t.type,category:t.category,exports:t.exports.map(s=>s.name),tags:t.tags.filter(s=>s.kind==="comment-marker"||s.kind==="import").map(s=>s.name),importsFiles:t.imports.filter(s=>!s.isExternal&&s.toPath).map(s=>s.toPath),...t.description!==void 0&&{description:t.description},...t.testedBy!==void 0&&{testedBy:t.testedBy},...t.coveragePct!==void 0&&{coveragePct:t.coveragePct},...t.avgExportUsage!==void 0&&{avgExportUsage:t.avgExportUsage},...t.maxExportUsage!==void 0&&{maxExportUsage:t.maxExportUsage}})),cycles:r.cycles}}function It(r){let e=r.getPackageDependencies(),t=Array.from(r.packages.values()).map(({graph:s,pkg:n})=>({name:n.name,relativeRoot:n.relativeRoot,nodeCount:s.nodes.size,dependsOn:e.get(n.name)??[]}));return{monorepoType:r.type,packageCount:t.length,packages:t}}function Mt(r){return[...r.nodes.values()].some(e=>e.coveragePct!==void 0)}var as=u(()=>{"use strict";c();Me()});function cs(r){if(r.category==="test")return"test";if(r.category==="config")return"config";if(r.category==="type-only")return"types";let e=r.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")||ae(e)==="cli"?"cli":S(e,"util")||S(e,"utils")||S(e,"helper")||S(e,"helpers")?"util":S(e,"model")||S(e,"models")||ae(e)==="model"?"model":S(e,"parser")||S(e,"parsers")||ae(e)==="parser"?"parser":ae(e)==="builder"?"builder":ae(e)==="resolver"?"resolver":"other"}function S(r,e){return r.includes(`/${e}/`)||r.includes(`/${e}.`)}function ae(r){let e=r.slice(r.lastIndexOf("/")+1);return e.slice(0,e.lastIndexOf("."))||e}var ps=u(()=>{"use strict";c()});function Dt(r,e){let t=ne(r,e),s=new Map;for(let[o,i]of t.features){for(let a of i.files)s.set(a,o);s.set(i.hub,o)}let n=new Map;for(let o of r.nodes.values()){let i=s.get(o.path);n.set(o.path,{path:o.path,role:cs(o),...o.description?{description:o.description}:{},exports:o.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return n}var Rt=u(()=>{"use strict";c();Ie();ps()});function Ca(r){return r?r.startsWith("interface ")?"interface":r.startsWith("class ")?"class":r.startsWith("enum ")?"enum":"type":"type"}function ka(r,e){if(e==="type-only")return!0;let t=r.signature??"";return t.startsWith("interface ")||t.startsWith("class ")||t.startsWith("enum ")}function At(r){let e=new Map;for(let s of r.nodes.values())if(!(s.type!=="typescript"&&s.type!=="javascript"))for(let n of s.exports){if(!ka(n,s.category))continue;let o=`${s.path}::${n.name}`;e.set(o,{name:n.name,file:s.path,kind:Ca(n.signature),...n.doc?{doc:n.doc}:{}})}let t=[];for(let s of r.nodes.values())if(!(s.type!=="typescript"&&s.type!=="javascript")){for(let n of s.imports)if(!(!n.toPath||n.isExternal||!n.symbols?.length))for(let o of n.symbols)e.has(`${n.toPath}::${o}`)&&t.push({fromFile:s.path,toType:o,toFile:n.toPath})}return{types:e,edges:t}}function Ot(r,e){let t=null;for(let o of r.types.values())if(o.name===e){t=o;break}if(!t)return{type:null,usedByFiles:[],uses:[]};let s=new Set,n=new Map;for(let o of r.edges)if(o.toType===e&&o.toFile===t.file&&s.add(o.fromFile),o.fromFile===t.file){let i=r.types.get(`${o.toFile}::${o.toType}`);i&&n.set(`${i.file}::${i.name}`,i)}return{type:t,usedByFiles:Array.from(s),uses:Array.from(n.values())}}var Lt=u(()=>{"use strict";c()});import ls from"fs";import Uf from"path";function fs(r){try{return ls.statSync(r,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function De(r){try{return ls.statSync(r,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var Re=u(()=>{"use strict";c()});import ce from"fs";import P from"path";function Gt(r,e){let t=P.join(e,"package.json");if(!ce.existsSync(t))return null;let s={};try{s=JSON.parse(ce.readFileSync(t,"utf-8"))}catch{return null}let n=s.name;return n?{name:n,root:e,relativeRoot:P.relative(r,e),entryPoints:wa(e,s)}:null}function wa(r,e){let t=[];if(e.exports){let n=e.exports;if(typeof n=="string")t.push(P.join(r,n));else if(typeof n=="object"&&n!==null){let o=n["."];if(typeof o=="string")t.push(P.join(r,o));else if(typeof o=="object"&&o!==null){let i=o.import??o.require??o.default;typeof i=="string"&&t.push(P.join(r,i))}}}e.main&&t.push(P.join(r,e.main));for(let n of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])t.push(P.join(r,n));let s=t.filter(De);return s.length>0?s.slice(0,1):t.slice(0,1)}function B(r,e){let t=[],s=new Set;for(let n of e){let o=n.replace(/\/$/,"").replace(/^\.\//,"");Ea(r,o,s,t)}return t}function Ea(r,e,t,s){if(!e.includes("*")){Fa(r,e,t,s);return}let n=e.split("/");n.includes("**")?Pa(r,n,t,s):Ta(r,n,t,s)}function Fa(r,e,t,s){let n=P.join(r,e);if(t.has(n)||!fs(n))return;t.add(n);let o=Gt(r,n);o&&s.push(o)}function Pa(r,e,t,s){let n=P.join(r,e[0]==="**"?"":e[0]??"");us(r,n,t,s)}function Ta(r,e,t,s){let n=e.findIndex(a=>a.includes("*")),o=P.join(r,...e.slice(0,n)),i;try{i=ce.readdirSync(o,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let p=P.join(o,a.name);if(t.has(p))continue;t.add(p);let l=Gt(r,p);l&&s.push(l)}}function us(r,e,t,s){let n;try{n=ce.readdirSync(e,{withFileTypes:!0})}catch{return}for(let o of n){if(!o.isDirectory()||o.name==="node_modules"||o.name.startsWith("."))continue;let i=P.join(e,o.name);if(ce.existsSync(P.join(i,"package.json"))&&!t.has(i)){t.add(i);let a=Gt(r,i);a&&s.push(a)}else us(r,i,t,s)}}var Ae=u(()=>{"use strict";c();Re();Re()});import jt from"fs";import ms from"path";var gs,ds=u(()=>{"use strict";c();Ae();gs={type:"npm",detect(r){let e=ms.join(r,"package.json");if(!jt.existsSync(e))return null;let t;try{t=JSON.parse(jt.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!t||jt.existsSync(ms.join(r,"yarn.lock")))return null;let s=Array.isArray(t)?t:t.packages??[];return s.length===0?null:B(r,s)}}});import J from"fs";import k from"path";function ys(r,e,t,s){if(s>4)return[];let n;try{n=J.readdirSync(e,{withFileTypes:!0})}catch{return[]}let o=[];for(let i of n){if(!i.isDirectory())continue;let a=i.name;if(a.startsWith(".")||a==="node_modules"||a==="dist"||a===".nx")continue;let p=k.join(e,a);J.existsSync(k.join(p,"project.json"))&&!t.has(p)?(t.add(p),o.push(p)):o.push(...ys(r,p,t,s+1))}return o}function Na(r,e,t){let s={};try{s=JSON.parse(J.readFileSync(t,"utf-8"))}catch{return null}let n=s.name,o,i,a=k.join(e,"package.json");if(J.existsSync(a))try{let p=JSON.parse(J.readFileSync(a,"utf-8"));n=p.name??n,o=p.main,i=p.exports}catch{}return n?{name:n,root:e,relativeRoot:k.relative(r,e),entryPoints:Ia(e,s,o,i)}:null}function Ia(r,e,t,s){let n=[],o=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(o){let a=k.resolve(r,"../..");n.push(k.resolve(a,o)),n.push(k.resolve(r,o))}if(s){let a=s;if(typeof a=="string")n.push(k.join(r,a));else if(typeof a=="object"&&a!==null){let p=a["."];typeof p=="string"&&n.push(k.join(r,p))}}if(t&&n.push(k.join(r,t)),e.sourceRoot){let a=k.resolve(r,"../.."),p=k.resolve(a,e.sourceRoot);n.push(k.join(p,"index.ts"),k.join(p,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])n.push(k.join(r,a));let i=n.filter(De);return i.length>0?i.slice(0,1):n.slice(0,1)}var hs,xs=u(()=>{"use strict";c();Re();hs={type:"nx",detect(r){return J.existsSync(k.join(r,"nx.json"))?ys(r,r,new Set,0).map(t=>Na(r,t,k.join(t,"project.json"))).filter(t=>t!==null):null}}});import Ss from"fs";import Ma from"path";import Da from"js-yaml";var bs,vs=u(()=>{"use strict";c();Ae();bs={type:"pnpm",detect(r){let e=Ma.join(r,"pnpm-workspace.yaml");if(!Ss.existsSync(e))return null;let t=[];try{t=Da.load(Ss.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return B(r,t)}}});import Ra from"fs";import Aa from"path";var Cs,ks=u(()=>{"use strict";c();Cs={type:"turborepo",detect(r){return Ra.existsSync(Aa.join(r,"turbo.json"))?[]:null}}});import _t from"fs";import ws from"path";var Es,Fs=u(()=>{"use strict";c();Ae();Es={type:"yarn",detect(r){if(!_t.existsSync(ws.join(r,"yarn.lock")))return null;let e=ws.join(r,"package.json");if(!_t.existsSync(e))return null;let t;try{t=JSON.parse(_t.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!t)return null;let s=Array.isArray(t)?t:t.packages??[];return s.length===0?null:B(r,s)}}});function O(r){Ps.push(r)}function Ts(){return Ps}var Ps,Oe=u(()=>{"use strict";c();Ps=[]});import Oa from"path";function Wt(r,e=Ts()){let t=Oa.resolve(r),s=new Map,n=[];for(let i of e){let a=i.detect(t);if(a!==null){n.push(i.type);for(let p of a)s.has(p.name)||s.set(p.name,p)}}if(n.length===0)return{root:t,type:"none",types:[],packages:[],packageMap:new Map};let o=Array.from(s.values());return{root:t,type:n[0],types:n,packages:o,packageMap:new Map(o.map(i=>[i.name,i]))}}var zt=u(()=>{"use strict";c();ds();xs();vs();ks();Fs();Oe();Oe();O(Cs);O(hs);O(bs);O(Es);O(gs)});var pe,$t=u(()=>{"use strict";c();ie();pe=class r{constructor(e,t){this.monorepoRoot=e;this.type=t}monorepoRoot;type;packages=new Map;addPackage(e,t){this.packages.set(e.name,{graph:t,pkg:e})}getPackageForFile(e){for(let{pkg:t}of this.packages.values())if(e===t.relativeRoot||e.startsWith(`${t.relativeRoot}/`))return t}getPackageDependencies(){let e=new Map;for(let{graph:t,pkg:s}of this.packages.values()){let n=new Set;for(let o of t.nodes.values())for(let i of o.imports)i.isWorkspace&&i.workspacePackage&&n.add(i.workspacePackage);e.set(s.name,[...n])}return e}getAffectedAcrossPackages(e){let t=this.getPackageForFile(e);if(!t)return[];let s=this.packages.get(t.name);if(!s)return[];let n=[];s.graph.traverse(e,o=>(o.path!==e&&n.push({file:o.path,package:t.name}),!0),{direction:"incoming"});for(let{graph:o,pkg:i}of this.packages.values())if(i.name!==t.name)for(let a of o.nodes.values())a.imports.some(l=>l.isWorkspace&&l.workspacePackage===t.name)&&n.push({file:a.path,package:i.name});return n}serialize(){return{monorepoRoot:this.monorepoRoot,type:this.type,packages:Array.from(this.packages.values()).map(({graph:e,pkg:t})=>({pkg:{name:t.name,relativeRoot:t.relativeRoot,entryPoints:t.entryPoints},nodes:Array.from(e.nodes.values())}))}}static deserialize(e){let t=new r(e.monorepoRoot,e.type);for(let{pkg:s,nodes:n}of e.packages){let o=new Map(n.map(a=>[a.path,a])),i=new F(o);t.packages.set(s.name,{graph:i,pkg:{...s,root:""}})}return t}}});function q(r,e){Ns.set(r,e)}function Is(r){return Ns.get(r)}var Ns,le=u(()=>{"use strict";c();Ns=new Map});function Ms(r,e){return e.startsWith("!")?r!==e.slice(1):r===e}function La(r,e){return e.startsWith("!")?!r.includes(e.slice(1)):r.includes(e)}var Ga,ja,_a,Wa,za,$a,Ua,Ba,Ja,qa,Ka,Ha,Va,Qa,Xa,Za,Ya,Ds,Rs=u(()=>{"use strict";c();Ga=(r,e)=>!e.category||Ms(r.category,e.category),ja=(r,e)=>!e.type||Ms(r.type,e.type),_a=(r,e)=>!e.path||La(r.path,e.path),Wa=(r,e)=>e.isExternal===void 0?!0:r.imports.some(s=>s.isExternal)===e.isExternal,za=(r,e)=>{if(!e.tags||e.tags.length===0)return!0;let t=e.tags.filter(n=>!n.startsWith("!")),s=e.tags.filter(n=>n.startsWith("!")).map(n=>n.slice(1));return!(t.length>0&&!t.some(n=>r.tags.some(o=>o.name===n))||s.some(n=>r.tags.some(o=>o.name===n)))},$a=(r,e)=>!e.allTags?.length||e.allTags.every(t=>r.tags.some(s=>s.name===t)),Ua=(r,e)=>!e.importsFile||r.imports.some(t=>t.toPath?.includes(e.importsFile)),Ba=(r,e,t)=>e.importedBy===void 0?!0:(t?.get(r.path)??[]).some(n=>n.includes(e.importedBy)),Ja=(r,e)=>e.minImports===void 0||r.imports.length>=e.minImports,qa=(r,e)=>e.maxImports===void 0||r.imports.length<=e.maxImports,Ka=(r,e)=>e.minSize===void 0||r.size>=e.minSize,Ha=(r,e)=>e.maxSize===void 0||r.size<=e.maxSize,Va=(r,e)=>e.hasDocstring===void 0||!!r.description===e.hasDocstring,Qa=(r,e)=>e.minCoverage===void 0||(r.coveragePct??101)>=e.minCoverage,Xa=(r,e)=>e.maxCoverage===void 0||(r.coveragePct??0)<=e.maxCoverage,Za=(r,e)=>e.minExportUsage===void 0||(r.avgExportUsage??-1)>=e.minExportUsage,Ya=(r,e)=>e.maxExportUsage===void 0||(r.avgExportUsage??0)<=e.maxExportUsage,Ds=[Ga,ja,_a,Wa,za,$a,Ua,Ba,Ja,qa,Ka,Ha,Va,Qa,Xa,Za,Ya]});function As(r,e,t){return Ds.every(s=>s(r,e,t))}function Le(r,e){let t=new Map;if(e.importedBy!==void 0){for(let i of r.nodes)for(let a of i.imports)if(a.toPath){let p=t.get(a.toPath)??[];p.push(i.path),t.set(a.toPath,p)}}let s=r.nodes.filter(i=>As(i,e,t)),n=new Set(s.map(i=>i.path)),o=s.map(i=>({...i,imports:i.imports.filter(a=>!a.toPath||n.has(a.toPath))}));return e.sort&&o.sort((i,a)=>e.sort==="size"?a.size-i.size:e.sort==="imports"?a.imports.length-i.imports.length:e.sort==="commitCount90d"?(a.commitCount90d??0)-(i.commitCount90d??0):e.sort==="exportUsage"?(a.avgExportUsage??0)-(i.avgExportUsage??0):0),e.limit!==void 0&&o.splice(e.limit),{nodes:o,cycles:r.cycles?.filter(i=>i.every(a=>n.has(a)))??void 0}}var Os=u(()=>{"use strict";c();Rs()});function Ge(r){let e={},t=r.split(",");for(let s of t){let n=s.indexOf(":");if(n===-1)continue;let o=s.slice(0,n).trim().toLowerCase(),i=s.slice(n+1).trim();if(!(!o||!i))switch(o){case"category":e.category=i;break;case"type":e.type=i;break;case"tag":case"tags":i.includes("+")?e.allTags=[...e.allTags??[],...i.split("+")]:e.tags=[...e.tags??[],i];break;case"path":e.path=i;break;case"external":e.isExternal=i.toLowerCase()==="true";break;case"importsfile":e.importsFile=i;break;case"importedby":e.importedBy=i;break;case"minimports":e.minImports=parseInt(i,10);break;case"maximports":e.maxImports=parseInt(i,10);break;case"minsize":e.minSize=parseInt(i,10);break;case"maxsize":e.maxSize=parseInt(i,10);break;case"sort":e.sort=i;break;case"limit":e.limit=parseInt(i,10);break;case"hasdocstring":e.hasDocstring=i.toLowerCase()!=="false";break;case"mincoverage":e.minCoverage=parseInt(i,10);break;case"maxcoverage":e.maxCoverage=parseInt(i,10);break;case"minexportusage":e.minExportUsage=parseFloat(i);break;case"maxexportusage":e.maxExportUsage=parseFloat(i);break}}return e}var Ls=u(()=>{"use strict";c()});var Gs=u(()=>{"use strict";c();Os();Ls()});import w from"typescript";function K(r){let e=[];for(let t of r.statements){if(!w.isExpressionStatement(t))continue;let s=t.expression;if(!w.isCallExpression(s))continue;let n=s.expression;w.isIdentifier(n)&&js.has(n.text)&&e.push(s),w.isPropertyAccessExpression(n)&&w.isIdentifier(n.expression)&&js.has(n.expression.text)&&e.push(s)}return e}function H(r,e,t){for(let s of r.arguments){if(!w.isObjectLiteralExpression(s))continue;let n=s.properties.find(o=>w.isPropertyAssignment(o)&&w.isIdentifier(o.name)&&o.name.text===e);if(!(!n||!w.isArrayLiteralExpression(n.initializer)))return n.initializer.elements.filter(w.isStringLiteral).map(o=>o.text)}return null}function V(r,e,t,s){if(r.arguments.length===0)return null;for(let o=1;o<r.arguments.length;o++){let i=r.arguments[o];if(!w.isObjectLiteralExpression(i))continue;let a=i.properties.find(l=>w.isPropertyAssignment(l)&&w.isIdentifier(l.name)&&l.name.text===e);if(a)return{start:a.initializer.getStart(s),end:a.initializer.getEnd(),text:t};let p=i.getEnd()-1;return{start:p,end:p,text:`${i.properties.length>0?", ":""}${e}: ${t}`}}let n=r.arguments[r.arguments.length-1];return{start:n.getStart(s),end:n.getStart(s),text:`{ ${e}: ${t} }, `}}function Q(r,e,t){let s=r.arguments;for(let n=1;n<s.length;n++){let o=s[n];if(!w.isObjectLiteralExpression(o))continue;let i=o.properties.findIndex(p=>w.isPropertyAssignment(p)&&w.isIdentifier(p.name)&&p.name.text===e);if(i<0)continue;if(o.properties.length===1)return{start:s[n-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(t),end:o.properties[i+1].getStart(t),text:""}}return null}function X(r,e){let t=[...e].sort((n,o)=>o.start-n.start),s=r;for(let n of t)s=s.slice(0,n.start)+n.text+s.slice(n.end);return s}function Z(r){return`[${r.map(e=>JSON.stringify(e)).join(", ")}]`}var js,D,Y=u(()=>{"use strict";c();js=new Set(["describe","test","it"]);D=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"])});import _s from"path";import Ws from"typescript";function ec(r){return Z(r.map(e=>`@${e}`))}function tc(r){return r.map(e=>e.startsWith("@")?e.slice(1):e)}var je,zs=u(()=>{"use strict";c();Y();je=class{name="cypress";canHandle(e){return D.has(_s.extname(e).toLowerCase())}apply(e,t,s){let n=Ws.createSourceFile(_s.basename(e),t,Ws.ScriptTarget.Latest,!0),o=K(n);if(o.length===0)return t;let i=H(o[0],"tags",n),a=[...s].sort();if(i!==null&&JSON.stringify(tc(i).sort())===JSON.stringify(a))return t;let p=o.flatMap(l=>{let d=s.length===0?Q(l,"tags",n):V(l,"tags",ec(a),n);return d?[d]:[]});return p.length>0?X(t,p):t}}});import rc from"path";function sc(r){return["# <mokosh-tags>",...r.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
4
4
  `)+`
5
5
 
6
- `}function Ni(t){let e=new Set;Et.lastIndex=0;let r=Et.exec(t);for(;r!==null;)r[1]&&e.add(r[1]),r=Et.exec(t);return e}var Ct,Et,Ie,Vr=l(()=>{"use strict";Ct=/# <mokosh-tags>[\s\S]*?# <\/mokosh-tags>\n*/,Et=/^@([a-zA-Z0-9_-]+)/gm;Ie=class{name="gherkin";canHandle(e){return Pi.extname(e).toLowerCase()===".feature"}apply(e,r,s){let n=r.replace(Ct,""),o=Ni(n),i=s.filter(c=>!o.has(c)),a=i.length>0?Ii(i):"";return Ct.test(r)?r.replace(Ct,a):a?r.replace(/^(Feature:)/m,`${a}$1`):r}}});function Qr(t,e){let r=t.replace(/\\/g,"/"),s=e.replace(/\\/g,"/"),n="";for(let o=0;o<r.length;o++){let i=r[o];i==="*"?r[o+1]==="*"?(n+=".*",o++):n+="[^/]*":i==="?"?n+="[^/]":i!==void 0&&(n+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&"))}return new RegExp(`^${n}$`).test(s)}var Xr=l(()=>{"use strict"});import Mi from"path";function Ri(t){return`//go:build ${t.map(r=>`mokosh_${r}`).join(" || ")}
7
- `}function Ai(t){let e=kt.exec(t);if(!e)return null;let r=e[0],s=/mokosh_([a-zA-Z0-9_-]+)/g,n=[],o=s.exec(r);for(;o!==null;)o[1]&&n.push(o[1]),o=s.exec(r);return n}var kt,Di,Ne,Zr=l(()=>{"use strict";kt=/^\/\/go:build mokosh_[^\n]+\n/m,Di=/^package\s+\S+/m;Ne=class{name="go";canHandle(e){return Mi.basename(e).endsWith("_test.go")}apply(e,r,s){let n=Ai(r),o=[...s].sort();if(n!==null&&JSON.stringify([...n].sort())===JSON.stringify(o))return r;if(s.length===0)return r.replace(kt,"");let i=Ri(o);if(n!==null)return r.replace(kt,i);let a=Di.exec(r);if(!a)return r;let c=a.index;return r.slice(0,c)+i+`
8
- `+r.slice(c)}}});import Li from"path";function Oi(t){return["/**",...t.map(e=>` * @group ${e}`)," */"].join(`
6
+ `}function nc(r){let e=new Set;Bt.lastIndex=0;let t=Bt.exec(r);for(;t!==null;)t[1]&&e.add(t[1]),t=Bt.exec(r);return e}var Ut,Bt,_e,$s=u(()=>{"use strict";c();Ut=/# <mokosh-tags>[\s\S]*?# <\/mokosh-tags>\n*/,Bt=/^@([a-zA-Z0-9_-]+)/gm;_e=class{name="gherkin";canHandle(e){return rc.extname(e).toLowerCase()===".feature"}apply(e,t,s){let n=t.replace(Ut,""),o=nc(n),i=s.filter(p=>!o.has(p)),a=i.length>0?sc(i):"";return Ut.test(t)?t.replace(Ut,a):a?t.replace(/^(Feature:)/m,`${a}$1`):t}}});function Us(r,e){let t=r.replace(/\\/g,"/"),s=e.replace(/\\/g,"/"),n="";for(let o=0;o<t.length;o++){let i=t[o];i==="*"?t[o+1]==="*"?(n+=".*",o++):n+="[^/]*":i==="?"?n+="[^/]":i!==void 0&&(n+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&"))}return new RegExp(`^${n}$`).test(s)}var Bs=u(()=>{"use strict";c()});import oc from"path";function ac(r){return`//go:build ${r.map(t=>`mokosh_${t}`).join(" || ")}
7
+ `}function cc(r){let e=Jt.exec(r);if(!e)return null;let t=e[0],s=/mokosh_([a-zA-Z0-9_-]+)/g,n=[],o=s.exec(t);for(;o!==null;)o[1]&&n.push(o[1]),o=s.exec(t);return n}var Jt,ic,We,Js=u(()=>{"use strict";c();Jt=/^\/\/go:build mokosh_[^\n]+\n/m,ic=/^package\s+\S+/m;We=class{name="go";canHandle(e){return oc.basename(e).endsWith("_test.go")}apply(e,t,s){let n=cc(t),o=[...s].sort();if(n!==null&&JSON.stringify([...n].sort())===JSON.stringify(o))return t;if(s.length===0)return t.replace(Jt,"");let i=ac(o);if(n!==null)return t.replace(Jt,i);let a=ic.exec(t);if(!a)return t;let p=a.index;return t.slice(0,p)+i+`
8
+ `+t.slice(p)}}});import pc from"path";function fc(r){return["/**",...r.map(e=>` * @group ${e}`)," */"].join(`
9
9
  `)+`
10
10
 
11
- `}function ji(t){let e=[];Ft.lastIndex=0;let r=Ft.exec(t);for(;r!==null;)r[1]&&e.push(r[1]),r=Ft.exec(t);return e}var Gi,Ft,Me,Yr=l(()=>{"use strict";H();Gi=/^\/\*\*\n(?: \* @group .+\n)+ \*\/\n+/,Ft=/^ \* @group (.+)$/gm;Me=class{name="jest";canHandle(e){return P.has(Li.extname(e).toLowerCase())}apply(e,r,s){let n=Gi.exec(r),o=n?ji(n[0]):null,i=[...s].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(i))return r;let a=n?r.slice(n[0].length):r;return s.length===0?a:Oi(i)+a}}});import es from"path";import ts from"typescript";function _i(t){return K(t.map(e=>`@${e}`))}function Wi(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var De,rs=l(()=>{"use strict";H();De=class{name="playwright";canHandle(e){return P.has(es.extname(e).toLowerCase())}apply(e,r,s){let n=ts.createSourceFile(es.basename(e),r,ts.ScriptTarget.Latest,!0),o=z(n);if(o.length===0)return r;let i=$(o[0],"tag",n),a=[...s].sort();if(i!==null&&JSON.stringify(Wi(i).sort())===JSON.stringify(a))return r;let c=o.flatMap(p=>{let u=s.length===0?B(p,"tag",n):U(p,"tag",_i(a),n);return u?[u]:[]});return c.length>0?J(r,c):r}}});import zi from"path";function Ui(t){let e=t.map(r=>`pytest.mark.${r}`).join(", ");return t.length===1?`pytestmark = pytest.mark.${t[0]}`:`pytestmark = [${e}]`}function Bi(t){let e=wt.exec(t);if(!e)return null;let r=e[0],s=[],n=/pytest\.mark\.([a-zA-Z0-9_-]+)/g,o=n.exec(r);for(;o!==null;)o[1]&&s.push(o[1]),o=n.exec(r);return s}function Ji(t){let e=t.split(`
12
- `),r=-1;for(let n=0;n<e.length;n++){let o=e[n].trimStart();(o.startsWith("import ")||o.startsWith("from "))&&(r=n)}if(r<0)return 0;let s=0;for(let n=0;n<=r;n++)s+=e[n].length+1;return s}var wt,$i,Re,ss=l(()=>{"use strict";wt=/^pytestmark\s*=\s*.+$/m,$i=/^import pytest\s*$/m;Re=class{name="pytest";canHandle(e){return zi.extname(e).toLowerCase()===".py"}apply(e,r,s){let n=Bi(r),o=[...s].sort();if(n!==null&&JSON.stringify([...n].sort())===JSON.stringify(o))return r;if(s.length===0)return r.replace(wt,"").replace(/\n{3,}/g,`
11
+ `}function uc(r){let e=[];qt.lastIndex=0;let t=qt.exec(r);for(;t!==null;)t[1]&&e.push(t[1]),t=qt.exec(r);return e}var lc,qt,ze,qs=u(()=>{"use strict";c();Y();lc=/^\/\*\*\n(?: \* @group .+\n)+ \*\/\n+/,qt=/^ \* @group (.+)$/gm;ze=class{name="jest";canHandle(e){return D.has(pc.extname(e).toLowerCase())}apply(e,t,s){let n=lc.exec(t),o=n?uc(n[0]):null,i=[...s].sort();if(o!==null&&JSON.stringify([...o].sort())===JSON.stringify(i))return t;let a=n?t.slice(n[0].length):t;return s.length===0?a:fc(i)+a}}});import Ks from"path";import Hs from"typescript";function mc(r){return Z(r.map(e=>`@${e}`))}function gc(r){return r.map(e=>e.startsWith("@")?e.slice(1):e)}var $e,Vs=u(()=>{"use strict";c();Y();$e=class{name="playwright";canHandle(e){return D.has(Ks.extname(e).toLowerCase())}apply(e,t,s){let n=Hs.createSourceFile(Ks.basename(e),t,Hs.ScriptTarget.Latest,!0),o=K(n);if(o.length===0)return t;let i=H(o[0],"tag",n),a=[...s].sort();if(i!==null&&JSON.stringify(gc(i).sort())===JSON.stringify(a))return t;let p=o.flatMap(l=>{let d=s.length===0?Q(l,"tag",n):V(l,"tag",mc(a),n);return d?[d]:[]});return p.length>0?X(t,p):t}}});import dc from"path";function yc(r){let e=r.map(t=>`pytest.mark.${t}`).join(", ");return r.length===1?`pytestmark = pytest.mark.${r[0]}`:`pytestmark = [${e}]`}function xc(r){let e=Kt.exec(r);if(!e)return null;let t=e[0],s=[],n=/pytest\.mark\.([a-zA-Z0-9_-]+)/g,o=n.exec(t);for(;o!==null;)o[1]&&s.push(o[1]),o=n.exec(t);return s}function Sc(r){let e=r.split(`
12
+ `),t=-1;for(let n=0;n<e.length;n++){let o=e[n].trimStart();(o.startsWith("import ")||o.startsWith("from "))&&(t=n)}if(t<0)return 0;let s=0;for(let n=0;n<=t;n++)s+=e[n].length+1;return s}var Kt,hc,Ue,Qs=u(()=>{"use strict";c();Kt=/^pytestmark\s*=\s*.+$/m,hc=/^import pytest\s*$/m;Ue=class{name="pytest";canHandle(e){return dc.extname(e).toLowerCase()===".py"}apply(e,t,s){let n=xc(t),o=[...s].sort();if(n!==null&&JSON.stringify([...n].sort())===JSON.stringify(o))return t;if(s.length===0)return t.replace(Kt,"").replace(/\n{3,}/g,`
13
13
 
14
- `);let i=Ui(o);if(n!==null)return r.replace(wt,i);let a=$i.test(r),c=Ji(r),p=r.slice(0,c),u=r.slice(c),m=a?"":`import pytest
15
- `,h=p.endsWith(`
14
+ `);let i=yc(o);if(n!==null)return t.replace(Kt,i);let a=hc.test(t),p=Sc(t),l=t.slice(0,p),d=t.slice(p),h=a?"":`import pytest
15
+ `,x=l.endsWith(`
16
16
 
17
17
  `)?"":`
18
- `;return p+h+m+i+`
19
- `+u}}});import ns from"path";import os from"typescript";var Ki,Ae,is=l(()=>{"use strict";H();Ki=/\/\/ <mokosh-tags>[\s\S]*?\/\/ <\/mokosh-tags>\n*/,Ae=class{name="vitest";canHandle(e){return P.has(ns.extname(e).toLowerCase())}apply(e,r,s){let n=r.replace(Ki,""),o=os.createSourceFile(ns.basename(e),n,os.ScriptTarget.Latest,!0),i=z(o);if(i.length===0)return n;let a=$(i[0],"tags",o),c=[...s].sort();if(a!==null&&JSON.stringify([...a].sort())===JSON.stringify(c))return n;let p=i.flatMap(u=>{let m=s.length===0?B(u,"tags",o):U(u,"tags",K(c),o);return m?[m]:[]});return p.length>0?J(n,p):n}}});import Tt from"path";import Le from"typescript";function qi(t){let e=Le.createSourceFile("detect.ts",t,Le.ScriptTarget.Latest,!0);for(let r of e.statements){if(!Le.isImportDeclaration(r)||!Le.isStringLiteral(r.moduleSpecifier))continue;let s=Hi[r.moduleSpecifier.text];if(s)return s}return null}function cs(t="vitest",e={},r=process.cwd()){return[new Ie,new Re,new Ne,new Pt(r,t,Object.entries(e))]}function ps(t,e){return e.find(r=>r.canHandle(t))??null}var as,Hi,Pt,ls=l(()=>{"use strict";qr();Vr();Xr();Zr();Yr();rs();ss();H();is();as={vitest:()=>new Ae,playwright:()=>new De,cypress:()=>new Pe,jest:()=>new Me},Hi={"@playwright/test":"playwright",cypress:"cypress","@jest/globals":"jest",vitest:"vitest"};Pt=class{constructor(e,r,s){this.rootDir=e;this.defaultFramework=r;this.frameworkOverrides=s}rootDir;defaultFramework;frameworkOverrides;name="auto";canHandle(e){return P.has(Tt.extname(e).toLowerCase())}apply(e,r,s){let n=qi(r)??this.matchOverride(e)??this.defaultFramework;return(as[n]??as.vitest)().apply(e,r,s)}matchOverride(e){let r=Tt.relative(this.rootDir,e).split(Tt.sep).join("/");for(let[s,n]of this.frameworkOverrides)if(Qr(s,r))return n;return null}}});import fs from"fs/promises";import Vi from"path";async function Yi(t,e,r,s){let n;try{n=await fs.readFile(t,"utf8")}catch(a){return{path:t,status:"error",error:String(a)}}let o=ps(t,s);if(!o)return{path:t,status:"unchanged"};let i=o.apply(t,n,e);return i===n?{path:t,status:"unchanged"}:(r||await fs.writeFile(t,i,"utf8"),{path:t,status:"updated"})}async function It(t,e,r){let s=O(e),n=s.tagApplier?.framework??"vitest",o=s.tagApplier?.frameworkOverrides??{},i=cs(n,o,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,u=[];for(let x of c.tags)Xi.has(x.kind)&&Qi.test(x.name)&&(Zi.has(x.name.toLowerCase())||p.has(x.name)||(p.add(x.name),u.push(x.name)));u.sort();let m=Vi.resolve(e,c.path),h=await Yi(m,u,r.dryRun,i);h.path=c.path,a.files.push(h),h.status==="updated"?a.updated++:h.status==="unchanged"?a.unchanged++:a.errors++}return a}var Qi,Xi,Zi,us=l(()=>{"use strict";et();ls();Qi=/^[a-zA-Z][a-zA-Z0-9_-]{1,}$/,Xi=new Set(["import"]),Zi=new Set(["common","fixture","fixtures","helper","helpers","index","main","mock","mocks","setup","shared","spec","test","tests","types","util","utils"])});var Ge,Nt=l(()=>{"use strict";Ge=class{isTestNode(e){return e.category==="test"||e.tags.some(r=>r.name==="test")}}});import{execSync as ms}from"child_process";function gs(t,e){let s=ms(`git -C "${t}" log --follow --format="%ae" --since="90 days ago" -- "${e}"`,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
20
- `).filter(Boolean);return{commitCount90d:s.length,lastAuthor:s[0]}}var Oe,Mt=l(()=>{"use strict";Oe=class{getChangedFiles(){try{let r=["git diff --name-only","git diff --cached --name-only","git ls-files --others --exclude-standard"].flatMap(s=>{try{return ms(s,{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),[]}}}});import je from"fs";import ea from"path";import ds from"js-yaml";function hs(t){let e=t.lastIndexOf("@");return e>0?t.substring(0,e):t}function ta(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)),hs(r)}).filter(Boolean)}function ra(t,e){let r=t.startsWith("/")?t.slice(1):t,s=r.lastIndexOf("@");return s>0?{name:r.substring(0,s),version:e||r.substring(s+1)}:{name:r,version:e}}function sa(t){try{let e=ds.load(t),r={dependencies:{}};for(let[s,n]of Object.entries(e))if(!(s==="__metadata"||!n?.version))for(let o of s.split(", ")){let i=hs(o);i&&(r.dependencies[i]={version:n.version,...n.dependencies!==void 0&&{dependencies:n.dependencies}})}return r}catch{return null}}function na(t){let e={dependencies:{}};for(let r of t.split(/\n\n+/)){let s=r.split(`
22
- `).filter(c=>c.trim().length>0&&!c.trim().startsWith("#"));if(s.length<2)continue;let n=s[0];if(!n||n.startsWith(" "))continue;let o=ta(n);if(o.length===0)continue;let a=s.find(c=>c.trim().startsWith('version "'))?.match(/version "(.*?)"/)?.[1]??"";for(let c of o)e.dependencies[c]={version:a}}return e}function oa(t){let e=je.readFileSync(t,"utf-8"),r=JSON.parse(e),s={dependencies:{}};if(r.packages)for(let[n,o]of Object.entries(r.packages)){if(!n.startsWith("node_modules/"))continue;let i=n.replace("node_modules/","");i.includes("node_modules/")||(s.dependencies[i]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}else if(r.dependencies)for(let[n,o]of Object.entries(r.dependencies))s.dependencies[n]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}};return s}function ia(t){let e=je.readFileSync(t,"utf-8");if(e.includes("__metadata:")){let r=sa(e);if(r!==null)return r}return na(e)}function aa(t){let e=je.readFileSync(t,"utf-8"),r={dependencies:{}};try{let s=ds.load(e);if(s.packages)for(let[n,o]of Object.entries(s.packages)){let{name:i,version:a}=ra(n,o.version);i&&(r.dependencies[i]={version:a,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}if(s.dependencies)for(let[n,o]of Object.entries(s.dependencies)){if(r.dependencies[n])continue;let i=typeof o=="string"?o:o.version;r.dependencies[n]={version:i||""}}}catch{}return r}function ys(t){let e=[["package-lock.json",oa],["yarn.lock",ia],["pnpm-lock.yaml",aa]];for(let[r,s]of e){let n=ea.join(t,r);if(je.existsSync(n))return s(n)}return null}var xs=l(()=>{"use strict"});import Ss from"path";function M(t){switch(Ss.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";default:return"unknown"}}function k(t){let e=Ss.extname(t).toLowerCase();return[".css",".scss",".sass",".less",".styl"].includes(e)}var D=l(()=>{"use strict"});import ca from"coffeescript";function pa(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.exec(t);for(;s!==null;)s[1]&&e.add(s[1]),s=r.exec(t);return e}function la(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function fa(t,e){let r=e.source?.value;return r?{fromPath:t,toPath:"",rawSpecifier:r,isStyle:k(r),type:"static"}:null}function ua(t,e){let r=e.variable?.base?.value==="require",s=e.args?.[0]?.base?.value;return!r||!s?null:{fromPath:t,toPath:"",rawSpecifier:s,isStyle:k(s),type:"require"}}function ma(t,e,r){let s=e.constructor?.name;if(s==="ImportDeclaration"){let n=fa(t,e);n&&r.push(n)}else if(s==="Call"){let n=ua(t,e);n&&r.push(n)}}function Dt(t,e,r){if(!(!e||typeof e!="object")){ma(t,e,r);for(let s in e){if(s==="locationData")continue;let n=e[s];if(!(!n||typeof n!="object"))if(Array.isArray(n))for(let o of n)Dt(t,o,r);else Dt(t,n,r)}}}function bs(t,e){let r=pa(e),s=la(t,r),n=[];try{Dt(t,ca.nodes(e),n)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var vs=l(()=>{"use strict";D()});import{AstBuilder as ga,GherkinClassicTokenMatcher as da,Parser as ha}from"@cucumber/gherkin";import{IdGenerator as ya}from"@cucumber/messages";function Rt(t,e){let r=new Set;try{let s=new ga(xa),n=new da,i=new ha(s,n).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(s){console.warn(`[GherkinParser] Failed to parse ${t}:`,s)}return{imports:[],exports:[],tags:Array.from(r).map(s=>({name:s,kind:"comment-marker"})),category:"test"}}var xa,Cs=l(()=>{"use strict";ne();xa=ya.uuid();W("gherkin",Rt)});import Sa from"path";import{parser as ba}from"@lezer/go";function ks(t,e){let r=[],s=new Map,n=new Set,o=new Set,a=ba.parse(e).cursor();do switch(a.name){case"LineComment":{let m=e.slice(a.from,a.to),h=m.match(va);h?.[1]&&n.add(h[1]);let x=m.match(Ca);x&&Es(x[1],o);let I=m.match(Ea);I&&Es(I[1],o);break}case"ImportSpec":{let m=a.node.getChild("String");if(m){let x=e.slice(m.from,m.to).slice(1,-1);r.push({fromPath:t,toPath:"",rawSpecifier:x,isExternal:!0,isStyle:!1,type:"static"})}break}case"FunctionDecl":case"TypeDecl":case"VarDecl":case"ConstDecl":{let m=a.node.getChild("DefName")??a.node.getChild("TypeSpec")?.getChild("DefName")??a.node.getChild("VarSpec")?.getChild("DefName")??a.node.getChild("ConstSpec")?.getChild("DefName");if(m){let h=e.slice(m.from,m.to);h!=="_"&&/^[A-Z]/.test(h)&&!s.has(h)&&s.set(h,{name:h})}break}}while(a.next());let c=r.some(m=>m.rawSpecifier==="testing"),p=Sa.basename(t).endsWith("_test.go")||n.has("test")||c?"test":"logic",u=new Set([...n,...o]);return{imports:r,exports:Array.from(s.values()),tags:Array.from(u).map(m=>({name:m,kind:"comment-marker"})),category:p}}function Es(t,e){for(let r of t.split(/[\s,&|!()]+/)){let s=r.trim();s&&s!=="ignore"&&e.add(s)}}var va,Ca,Ea,Fs=l(()=>{"use strict";va=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,Ca=/^\/\/go:build\s+(.+)$/,Ea=/^\/\/\s*\+build\s+(.+)$/});function q(t){return t.startsWith("'")||t.startsWith('"')?t.slice(1,-1):t}var At=l(()=>{"use strict"});import ka from"livescript";function Fa(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.exec(t);for(;s!==null;)s[1]&&e.add(s[1]),s=r.exec(t);return e}function wa(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Pa(t,e){let r=t.constructor?.name||t.type;if(r==="Import"){let s=t.right?.value;if(typeof s=="string"){let n=q(s);return{fromPath:e,toPath:"",rawSpecifier:n,isStyle:k(n),type:"static"}}}if(r==="Chain"&&t.head?.value==="require"){let s=t.tails?.[0];if(s?.constructor?.name==="Call"||s?.type==="Call"){let n=s.args?.[0]?.value;if(typeof n=="string"){let o=q(n);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:k(o),type:"require"}}}}return null}function Lt(t,e){if(!t||typeof t!="object")return[];let r=[],s=Pa(t,e);s&&r.push(s);for(let n in t){if(Ta.has(n))continue;let o=t[n];if(!(!o||typeof o!="object"))if(Array.isArray(o))for(let i of o)r.push(...Lt(i,e));else r.push(...Lt(o,e))}return r}function ws(t,e){let r=Fa(e),s=wa(t,r),n=[];try{n=Lt(ka.ast(e),t)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var Ta,Ts=l(()=>{"use strict";D();At();Ta=new Set(["first_line","first_column","last_line","last_column","line","column"])});import Ia from"luaparse";function Na(t){let e=new Set,r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.exec(t);for(;s!==null;)s[1]&&e.add(s[1]),s=r.exec(t);return e}function Ma(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Da(t,e){let r=[];function s(n){if(!(!n||typeof n!="object")){if((n.type==="CallExpression"||n.type==="StringCallExpression")&&n.base?.type==="Identifier"&&n.base?.name==="require"){let o;if(n.type==="CallExpression"){let i=n.arguments?.[0];i?.type==="StringLiteral"&&(o=q(i.raw))}else if(n.type==="StringCallExpression"){let i=n.argument;i?.type==="StringLiteral"&&(o=q(i.raw))}o&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:k(o),type:"require"})}for(let o in n){if(o==="loc")continue;let i=n[o];if(i&&typeof i=="object")if(Array.isArray(i))for(let a of i)s(a);else s(i)}}}return s(t),r}function Ps(t,e){let r=Na(e),s=Ma(t,r),n=[];try{let o=Ia.parse(e);n=Da(o,t)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var Is=l(()=>{"use strict";D();At()});import Ra from"path";import{parser as Aa}from"@lezer/python";function Ns(t,e){let r=[],s=[],n=new Set,o=Ra.basename(t).toLowerCase(),a=Aa.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]&&n.add(p[1]);break}case"ImportStatement":{for(let p of Ga(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 m=a.node.getChild("VariableName");m&&s.push({name:e.slice(m.from,m.to)})}break}case"AssignStatement":{if(a.node.parent?.name==="Script"){let p=a.node.firstChild;p?.name==="VariableName"&&s.push({name:e.slice(p.from,p.to)})}break}}while(a.next());let c=Wa(o,r,n);return c==="test"&&n.add("test"),{imports:r,exports:s,tags:Array.from(n).map(p=>({name:p,kind:"comment-marker"})),category:c}}function Ga(t,e,r){let s=t.firstChild;return s?s.name==="from"?Oa(t,e,r):ja(t,e,r):[]}function Oa(t,e,r){let s=t.firstChild;if(!s)return[];let n=s.nextSibling;for(;n&&n.name!=="import";)n=n.nextSibling;if(!n)return[];let o=e.slice(s.to,n.from).trim(),i=_a(n.nextSibling,e);if(!i.length)return[];let a=0;for(;a<o.length&&o[a]===".";)a++;let c=o.slice(a);if(a===0)return[oe(r,o,i,!0)];let p=a===1?"./":"../".repeat(a-1);return c?[oe(r,p+c.replace(/\./g,"/"),i,!1)]:i[0]==="*"?[oe(r,p.slice(0,-1),["*"],!1)]:i.map(u=>oe(r,p+u,[u],!1))}function ja(t,e,r){let s=[],n=t.firstChild?.nextSibling??null;for(;n;){if(n.name==="VariableName"){let o=e.slice(n.from,n.to);for(;n.nextSibling?.name==="."&&n.nextSibling.nextSibling?.name==="VariableName";)n=n.nextSibling.nextSibling,o+=`.${e.slice(n.from,n.to)}`;n.nextSibling?.name==="as"&&(n=n.nextSibling.nextSibling??n.nextSibling),s.push(oe(r,o,["*"],!0))}n=n.nextSibling}return s}function _a(t,e){let r=[],s=t;for(;s;)s.name==="*"?r.push("*"):s.name==="VariableName"&&(r.push(e.slice(s.from,s.to)),s.nextSibling?.name==="as"&&(s=s.nextSibling.nextSibling??s.nextSibling)),s=s.nextSibling;return r}function oe(t,e,r,s){return{fromPath:t,toPath:"",rawSpecifier:e,isStyle:!1,isExternal:s,type:"static",symbols:r.length>0?r:void 0}}function Wa(t,e,r){return t.startsWith("test_")||t.endsWith("_test.py")?"test":t==="conftest.py"||t==="setup.py"?"config":r.has("test")||e.some(s=>La.has(s.rawSpecifier))?"test":"logic"}var La,Ms=l(()=>{"use strict";La=new Set(["pytest","unittest","nose","hypothesis"])});import g from"typescript";function za(t){let e=1;function r(s){switch(s.kind){case g.SyntaxKind.IfStatement:case g.SyntaxKind.ConditionalExpression:case g.SyntaxKind.ForStatement:case g.SyntaxKind.ForInStatement:case g.SyntaxKind.ForOfStatement:case g.SyntaxKind.WhileStatement:case g.SyntaxKind.DoStatement:case g.SyntaxKind.CatchClause:case g.SyntaxKind.CaseClause:e++;break;case g.SyntaxKind.BinaryExpression:{let n=s.operatorToken.kind;(n===g.SyntaxKind.AmpersandAmpersandToken||n===g.SyntaxKind.BarBarToken||n===g.SyntaxKind.QuestionQuestionToken)&&e++;break}}g.forEachChild(s,r)}return r(t),e}function $a(t){let e=0;function r(s,n,o){if(g.isIfStatement(s)){e+=o?1:1+n;let a=o?n:n+1;r(s.expression,a,!1),r(s.thenStatement,a,!1),s.elseStatement&&(g.isIfStatement(s.elseStatement)?r(s.elseStatement,n,!0):(e+=1,r(s.elseStatement,n+1,!1)));return}if(g.isForStatement(s)||g.isForInStatement(s)||g.isForOfStatement(s)||g.isWhileStatement(s)||g.isDoStatement(s)||g.isSwitchStatement(s)){e+=1+n,g.forEachChild(s,a=>r(a,n+1,!1));return}if(g.isCatchClause(s)){e+=1+n,g.forEachChild(s,a=>r(a,n,!1));return}if(g.isConditionalExpression(s)&&(e+=1),g.isBinaryExpression(s)){let a=s.operatorToken.kind;(a===g.SyntaxKind.AmpersandAmpersandToken||a===g.SyntaxKind.BarBarToken||a===g.SyntaxKind.QuestionQuestionToken)&&(e+=1)}if(n>0&&(g.isFunctionDeclaration(s)||g.isFunctionExpression(s)||g.isArrowFunction(s))){e+=1+n,g.forEachChild(s,a=>r(a,n+1,!1));return}g.forEachChild(s,a=>r(a,n,!1))}return r(t,0,!1),e}function Gt(t){return{complexity:za(t),cognitiveComplexity:$a(t)}}var Ds=l(()=>{"use strict"});import y from"typescript";function Rs(t,e){Ua(t,e),Ja(t,e),Ka(t,e),Ha(t,e)}function Ua(t,e){if((y.isFunctionDeclaration(t)||y.isVariableDeclaration(t))&&t.name&&y.isIdentifier(t.name)&&Ba(t)){let r;if(y.isFunctionDeclaration(t))r="function";else{let s=t.initializer;r=s&&(y.isArrowFunction(s)||y.isFunctionExpression(s))?"function":"variable"}e.tags.add({name:t.name.text,kind:r})}}function Ba(t){if(y.isFunctionDeclaration(t))return y.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&y.isSourceFile(e.parent)}function Ja(t,e){if(!y.isStringLiteral(t))return;let r=t.text.match(/@[\w-]+/g);if(r)for(let s of r)e.tags.add({name:s.substring(1),kind:"comment-marker"})}function Ka(t,e){if(!y.isSourceFile(t))return;let r=/@tag\s+([a-zA-Z0-9_-]+)/g,s=t.getFullText(),n=r.exec(s);for(;n!==null;)n[1]&&e.tags.add({name:n[1],kind:"comment-marker"}),n=r.exec(s)}function Ha(t,e){if(y.isCallExpression(t)&&qa(t.expression))for(let r of t.arguments)y.isObjectLiteralExpression(r)&&Va(r,e)}function qa(t){return y.isIdentifier(t)?Ot.has(t.text):!!(y.isPropertyAccessExpression(t)&&(Ot.has(t.name.text)||y.isIdentifier(t.expression)&&Ot.has(t.expression.text)))}function Va(t,e){for(let r of t.properties){if(!y.isPropertyAssignment(r)||!y.isIdentifier(r.name)||r.name.text!=="tags"&&r.name.text!=="tag")continue;let{initializer:s}=r,n=y.isArrayLiteralExpression(s)?s.elements.filter(y.isStringLiteral):r.name.text==="tag"&&y.isStringLiteral(s)?[s]:[];for(let o of n)e.tags.add({name:o.text.replace(/^@/,""),kind:"comment-marker"})}}var Ot,As=l(()=>{"use strict";Ot=new Set(["test","describe","it"])});import Ls from"path";import f from"typescript";function jt(t,e,r){let s=[],n=new Map,o=new Set,i=f.createSourceFile(t,e,f.ScriptTarget.Latest,!0,r==="typescript"?f.ScriptKind.TSX:f.ScriptKind.JSX),a={filePath:t,imports:s,exports:n,tags:o,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},c=Q=>{Ya(Q,a),f.forEachChild(Q,c)};c(i);let p=lc(t,a);(p==="test"||p==="barrel")&&o.add({name:p,kind:"comment-marker"}),p!=="test"&&fc(a,i);let u=i.statements[0],m=u?Os(u):void 0,{complexity:h,cognitiveComplexity:x}=Gt(i),I=Qa(i);return{imports:s,exports:Array.from(n.values()),tags:Array.from(o),category:p,rawCallEdges:a.rawCallEdges??[],complexity:h,cognitiveComplexity:x,...I.length>0?{functions:I}:{},...m!==void 0?{description:m}:{}}}function Qa(t){let e=[],r=(n,o)=>{let{complexity:i,cognitiveComplexity:a}=Gt(o),c=t.getLineAndCharacterOfPosition(o.getStart(t)).line+1;e.push({name:n,line:c,complexity:i,cognitiveComplexity:a})},s=(n,o)=>{if(f.isFunctionDeclaration(n)&&n.name&&n.body?r(n.name.text,n):f.isVariableDeclaration(n)&&f.isIdentifier(n.name)&&n.initializer&&(f.isArrowFunction(n.initializer)||f.isFunctionExpression(n.initializer))?r(n.name.text,n.initializer):o&&f.isMethodDeclaration(n)&&f.isIdentifier(n.name)&&n.body?r(`${o}.${n.name.text}`,n):o&&f.isConstructorDeclaration(n)&&n.body?r(`${o}.constructor`,n):o&&f.isGetAccessorDeclaration(n)&&f.isIdentifier(n.name)&&n.body?r(`${o}.get ${n.name.text}`,n):o&&f.isSetAccessorDeclaration(n)&&f.isIdentifier(n.name)&&n.body&&r(`${o}.set ${n.name.text}`,n),f.isClassDeclaration(n)&&n.name){let i=n.name.text;f.forEachChild(n,a=>s(a,i));return}f.forEachChild(n,i=>s(i,o))};return s(t,void 0),e}function Gs(t,e,r,s){let n={name:t},o=Os(r);o!==void 0&&(n.doc=o);let i=Xa(e);i!==void 0&&(n.flags=i);let a=Za(e,s);return a!==void 0&&(n.signature=a),n}function Os(t){let e=f.getJSDocCommentsAndTags(t);for(let r of e)if(f.isJSDoc(r)&&r.comment)return f.getTextOfJSDocComment(r.comment)||void 0}function Xa(t){let e=new Set(["deprecated","internal","public","alpha","beta"]),r=f.getJSDocTags(t).map(s=>s.tagName.text).filter(s=>e.has(s));return r.length>0?r:void 0}function Za(t,e){let r=f.createPrinter({removeComments:!0}),s=n=>r.printNode(f.EmitHint.Unspecified,n,e);if(f.isFunctionDeclaration(t)||f.isMethodDeclaration(t)){let n=t.parameters.map(s).join(", "),o=t.type?s(t.type):"void";return`${t.typeParameters?`<${t.typeParameters.map(a=>a.name.text).join(", ")}>`:""}(${n}) => ${o}`}if(f.isVariableDeclaration(t)){if(t.type)return s(t.type);if(t.initializer&&(f.isArrowFunction(t.initializer)||f.isFunctionExpression(t.initializer))){let n=t.initializer,o=n.parameters.map(s).join(", "),i=n.type?s(n.type):"unknown";return`(${o}) => ${i}`}return}if(f.isClassDeclaration(t)&&t.name)return`class ${t.name.text}`;if(f.isInterfaceDeclaration(t))return`interface ${t.name.text}`;if(f.isTypeAliasDeclaration(t))return s(t.type);if(f.isEnumDeclaration(t))return`enum ${t.name.text}`}function Ya(t,e){ec(t,e),tc(t,e),sc(t,e),nc(t,e),pc(t,e),Rs(t,e)}function ec(t,e){if(!f.isSourceFile(t))return;let r=t.statements.filter(s=>!f.isEmptyStatement(s));e.totalStatements=r.length,e.exportStatements=r.filter(s=>f.isExportDeclaration(s)||f.isExportAssignment(s)||_t(s)).length}function tc(t,e){if(f.isJsxElement(t)||f.isJsxSelfClosingElement(t)||f.isJsxFragment(t)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(f.isFunctionDeclaration(t)||f.isMethodDeclaration(t)||f.isArrowFunction(t)||f.isClassDeclaration(t)||f.isVariableStatement(t)||f.isEnumDeclaration(t)){e.hasTypesOnly=!1;return}f.isExportDeclaration(t)&&!rc(t)&&(e.hasTypesOnly=!1)}function rc(t){return t.isTypeOnly?!0:!t.exportClause||!f.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function sc(t,e){if(!f.isImportDeclaration(t)||!t.moduleSpecifier||!f.isStringLiteral(t.moduleSpecifier))return;let r=[];if(t.importClause&&(t.importClause.name&&r.push("default"),t.importClause.namedBindings))if(f.isNamedImports(t.importClause.namedBindings))for(let n of t.importClause.namedBindings.elements)r.push(n.name.text);else f.isNamespaceImport(t.importClause.namedBindings)&&r.push("*");let s=r.length>0?"static":"side-effect";e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:t.moduleSpecifier.text,isStyle:k(t.moduleSpecifier.text),type:s,symbols:r.length>0?r:void 0})}function nc(t,e){f.isExportDeclaration(t)?oc(t,e):f.isExportAssignment(t)?e.exports.set("default",{name:"default"}):_t(t)&&cc(t,e)}function oc(t,e){if(t.moduleSpecifier&&f.isStringLiteral(t.moduleSpecifier))ic(t,t.moduleSpecifier.text,e);else if(t.exportClause&&f.isNamedExports(t.exportClause))for(let r of t.exportClause.elements){let s=r.name.text;e.exports.set(s,{name:s})}}function ic(t,e,r){let s=ac(t),n={fromPath:r.filePath,toPath:"",rawSpecifier:e,isStyle:k(e),type:"re-export"};s.length>0&&(n.symbols=s),r.imports.push(n)}function ac(t){return t.exportClause?f.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function cc(t,e){if((f.isFunctionDeclaration(t)||f.isClassDeclaration(t)||f.isInterfaceDeclaration(t)||f.isTypeAliasDeclaration(t)||f.isEnumDeclaration(t))&&t.name){let s=t.name.text;e.exports.set(s,Gs(s,t,t,e.sourceFile));return}if(f.isVariableStatement(t)){for(let s of t.declarationList.declarations)if(f.isIdentifier(s.name)){let n=s.name.text;e.exports.set(n,Gs(n,s,t,e.sourceFile))}}}function pc(t,e){if(!f.isCallExpression(t))return;let r=t.arguments[0];!r||!f.isStringLiteral(r)||(t.expression.kind===f.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:k(r.text),type:"dynamic"}):f.isIdentifier(t.expression)&&t.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:k(r.text),type:"require"}))}function lc(t,e){let r=Ls.basename(t).toLowerCase(),s=Ls.extname(t).toLowerCase();return X().some(o=>r.includes(o))?"test":nr(r)?"config":e.imports.some(o=>Ve().some(i=>o.rawSpecifier.includes(i)))?"test":s===".tsx"||s===".jsx"||e.hasUI?"ui":e.hasTypesOnly&&e.totalStatements>0?"type-only":e.totalStatements>0&&e.exportStatements/e.totalStatements>Xe()?"barrel":"logic"}function _t(t){return f.canHaveModifiers(t)&&f.getModifiers(t)?.some(e=>e.kind===f.SyntaxKind.ExportKeyword)===!0}function fc(t,e){let r=t.rawCallEdges??[];t.rawCallEdges=r;let s=new Map;for(let n of e.statements){if(!f.isImportDeclaration(n)||!f.isStringLiteral(n.moduleSpecifier))continue;let o=n.moduleSpecifier.text,i=n.importClause;if(i&&(i.name&&s.set(i.name.text,o),i.namedBindings&&f.isNamedImports(i.namedBindings)))for(let a of i.namedBindings.elements)s.set(a.name.text,o)}if(s.size!==0)for(let n of e.statements){let o=mc(n);if(o){let i=gc(n);i&&_e(i,o,s,r);continue}f.isClassDeclaration(n)&&n.name&&uc(n,s,r)}}function uc(t,e,r){let s=t.name.text;for(let n of t.members)f.isMethodDeclaration(n)&&n.body&&f.isIdentifier(n.name)?_e(n.body,`${s}.${n.name.text}`,e,r):f.isConstructorDeclaration(n)&&n.body&&_e(n.body,`${s}.constructor`,e,r)}function mc(t){if(_t(t)){if(f.isFunctionDeclaration(t)&&t.name)return t.name.text;if(f.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(f.isIdentifier(e.name)&&e.initializer&&(f.isArrowFunction(e.initializer)||f.isFunctionExpression(e.initializer)))return e.name.text}}}function gc(t){if(f.isFunctionDeclaration(t))return t.body;if(f.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(e.initializer&&(f.isArrowFunction(e.initializer)||f.isFunctionExpression(e.initializer)))return e.initializer}}function _e(t,e,r,s){if(f.isCallExpression(t)&&f.isIdentifier(t.expression)){let n=t.expression.text,o=r.get(n);o&&!s.some(i=>i.from===e&&i.to===n&&i.toSpecifier===o)&&s.push({from:e,to:n,toSpecifier:o})}f.forEachChild(t,n=>_e(n,e,r,s))}var js=l(()=>{"use strict";G();Ds();D();As()});function We(t,e){if(e.length===0)return"ui";let r=!1;return t.walk(s=>{if(s.type==="rule")return r=!0,!1}),r?"ui":"barrel"}var _s=l(()=>{"use strict"});import zs from"postcss";import*as dc from"postcss-less";function Ws(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function yc(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function xc(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,...Ws(i)?{isExternal:!0}:{}}}let s=t.match(/^url\(['"]?([^'")]+)['"]?\)/),n=s?s[1]?.trim()??"":t.match(/^['"]([^'"]+)['"]/)?.[1]??"";return n?{fromPath:e,toPath:"",rawSpecifier:n,isStyle:!0,type:"static",...Ws(n)?{isExternal:!0}:{}}:null}function Sc(t,e){let r=[],s=/url\(['"]?([^'")]+)['"]?\)/g,n=s.exec(t);for(;n!==null;){let o=n[1]?.trim()??"";yc(o)&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static"}),n=s.exec(t)}return r}function Us(t,e){let r=[];return t.walk(s=>{if(s.type==="atrule"&&s.name==="import"){let n=xc(s.params,e);n&&r.push(n)}s.type==="decl"&&r.push(...Sc(s.value,e))}),r}function bc(t){return t.replace(/(?<!:)\/\/.*/g,"")}function vc(t,e){let r=[],s=/@import\s+(?:\(([^)]+)\)\s+)?['"]([^'"]+)['"]/g,n=s.exec(t);for(;n!==null;){let o=n[1]?.trim()??"",i=n[2]??"";if(i){let a=$s.has(o)?"side-effect":"static";r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}n=s.exec(t)}return r}function Bs(t,e){let r=zs.parse(bc(t));return{imports:Us(r,e),root:r}}function Js(t,e){try{let r=hc.parse(t);return{imports:Us(r,e),root:r}}catch{return{imports:vc(t,e),root:zs.parse("")}}}var hc,$s,Ks=l(()=>{"use strict";hc=dc,$s=new Set(["reference","inline"])});import{parse as Cc}from"postcss-scss";function Ec(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function kc(t){let e=t.match(/^['"]([^'"]+)['"]/);if(!e?.[1])return{specifier:""};let r=e[1],n=t.match(/\bas\s+(\S+)/)?.[1];return n!==void 0?{specifier:r,alias:n}:{specifier:r}}function Hs(t,e){let r=Cc(t),s=[];return r.walk(n=>{if(n.type!=="atrule")return;let{name:o,params:i}=n;if(o!=="import"&&o!=="use"&&o!=="forward")return;let{specifier:a,alias:c}=kc(i);if(!a)return;let p={fromPath:e,toPath:"",rawSpecifier:a,isStyle:!0,type:o==="forward"?"re-export":"static",...Ec(a)?{isExternal:!0}:{}};c&&(p.symbols=[c]),s.push(p)}),{imports:s,root:r}}var qs=l(()=>{"use strict"});function Vs(t,e){let r=[],s=/@require\s+['"]([^'"]+)['"]/g,n=s.exec(t);for(;n!==null;){let i=n[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"require"}),n=s.exec(t)}let o=/(?<!@)(?:import|require)\s*\(?\s*['"]([^'"]+)['"]/g;for(n=o.exec(t);n!==null;){let i=n[1];i&&r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"static"}),n=o.exec(t)}return r}function Qs(t,e){if(e.length===0)return"ui";try{let r=qe("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 Xs=l(()=>{"use strict"});function ie(t,e){let r=M(t);if(r==="stylus"){let o=Vs(e,t);return{imports:o,exports:[],tags:[],category:Qs(e,o)}}if(r==="scss"){let{imports:o,root:i}=Hs(e,t);return{imports:o,exports:[],tags:[],category:We(i,o)}}if(r==="less"){let{imports:o,root:i}=Js(e,t);return{imports:o,exports:[],tags:[],category:We(i,o)}}let{imports:s,root:n}=Bs(e,t);return{imports:s,exports:[],tags:[],category:We(n,s)}}var Zs=l(()=>{"use strict";D();_s();Ks();qs();Xs()});async function Ys(t,e){let r=M(t),s=Or(r);return s?s(t,e):{imports:[],exports:[],tags:[],category:"other"}}var en=l(()=>{"use strict";D();vs();Cs();Fs();Ts();Is();Ms();js();ne();Zs();G();D();ne();for(let[t,e]of[["javascript",(r,s)=>jt(r,s,"javascript")],["typescript",(r,s)=>jt(r,s,"typescript")],["css",ie],["scss",ie],["less",ie],["stylus",ie],["coffeescript",bs],["livescript",ws],["lua",Ps],["python",Ns],["go",ks],["gherkin",Rt]])W(t,e)});import Wt from"path";function rn(t,e){for(let r of t.values()){let s=e.get(r.path);s!==void 0&&(r.coveragePct=s)}}function sn(t,e){for(let r of t)if(!r.rawSpecifier.startsWith(".")&&!Wt.isAbsolute(r.rawSpecifier)){let s=r.rawSpecifier.startsWith("@")?r.rawSpecifier.split("/").slice(0,2).join("/"):r.rawSpecifier.split("/")[0];s&&!e.some(n=>n.name===s)&&e.push({name:s,kind:"library"})}}function nn(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports){if(r.isExternal||!r.toPath)continue;let s=t.get(r.toPath);s&&(s.category!=="logic"&&s.category!=="barrel"||(s.testedBy??=[],s.testedBy.includes(e.path)||s.testedBy.push(e.path)))}}function tn(t){return Math.round(t*1e4)/1e4}function on(t){for(let e of t.values()){let r=[];for(let s of e.imports){if(s.isExternal||!s.toPath)continue;let n=t.get(s.toPath);if(!n||n.exports.length===0)continue;let o;if(s.symbols===void 0){if(s.type==="side-effect")continue;o=1}else s.symbols.includes("*")?o=1:o=s.symbols.length/n.exports.length;s.exportUsageRatio=tn(Math.min(1,o)),r.push(s.exportUsageRatio)}r.length>0&&(e.avgExportUsage=tn(r.reduce((s,n)=>s+n,0)/r.length),e.maxExportUsage=Math.max(...r))}}function zt(t,e,r){e&&(t.some(s=>s.name===e&&s.kind===r)||t.push({name:e,kind:r}))}function Fc(t,e){let r=e.toPath,s=Wt.basename(r,Wt.extname(r)).replace(/\.(test|spec)$/,"");zt(t.tags,s,"import")}function wc(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let r of e.symbols)zt(t.tags,r,"import")}function Tc(t,e,r){let s=r.get(e.toPath);if(!(!s||s.category==="test"))for(let n of s.tags)n.kind==="comment-marker"&&zt(t.tags,n.name,"comment-marker")}function an(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports)!r.toPath||r.isExternal||(Fc(e,r),wc(e,r),Tc(e,r,t))}var cn=l(()=>{"use strict"});import fn from"fs";import V from"path";function Pc(t,e){let r=t.split(`
23
- `),s=null,n=new Map,o=!1;for(let i of r){let a=i.trim();if(a.startsWith("module ")){s=a.slice(7).trim();continue}if(/^replace\s*\(/.test(a)){o=!0;continue}if(o&&a===")"){o=!1;continue}if(o&&a.includes("=>")){pn(a,e,n);continue}!o&&/^replace\s+/.test(a)&&a.includes("=>")&&pn(a.replace(/^replace\s+/,""),e,n)}return{mod:s,replaces:n}}function pn(t,e,r){let[s,n]=t.split("=>").map(a=>a.trim());if(!s||!n)return;let o=s.split(/\s+/)[0];if(!n.startsWith(".")&&!n.startsWith("/"))return;let i=V.isAbsolute(n)?n:V.resolve(e,n);r.set(o,i)}function ln(t){let e;try{e=fn.readdirSync(t,{withFileTypes:!0})}catch{return null}let r=e.filter(s=>s.isFile()&&s.name.endsWith(".go")&&!s.name.endsWith("_test.go")).map(s=>({path:V.join(t,s.name),isExternal:!1})).sort((s,n)=>s.path.localeCompare(n.path));return r.length>0?r:null}var ae,un=l(()=>{"use strict";ae=class{extensions=[".go"];goModCache=new Map;resolve(e,r,s,n){let{mod:o,replaces:i}=this.readGoMod(s);if(!o)return null;let a=this.applyReplace(r,i,s);if(a!==void 0)return ln(a);if(r!==o&&!r.startsWith(`${o}/`))return null;let c=r.slice(o.length).replace(/^\//,"");return c?ln(V.join(s,c)):null}readGoMod(e){let r=this.goModCache.get(e);if(r!==void 0)return r;let s={mod:null,replaces:new Map};try{let n=fn.readFileSync(V.join(e,"go.mod"),"utf-8"),o=Pc(n,e);return this.goModCache.set(e,o),o}catch{return this.goModCache.set(e,s),s}}applyReplace(e,r,s){for(let[n,o]of r){if(e===n)return o;if(e.startsWith(`${n}/`)){let i=e.slice(n.length+1);return V.join(o,i)}}}}});import Ic from"fs";import $t from"path";var ce,mn=l(()=>{"use strict";ce=class{extensions=[".lua"];resolve(e,r,s,n){let o=r.replace(/\./g,$t.sep),i=[s,$t.join(s,"lib")];for(let a of i){if(!Ic.existsSync(a))continue;let c=n($t.join(a,"_dummy.lua"),o);if(c)return[c]}return null}}});import Nc from"fs";import Ut from"path";function gn(t){try{return Nc.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var pe,dn=l(()=>{"use strict";pe=class{extensions=[".py"];resolve(e,r,s,n){let o=r.replace(/\./g,Ut.sep),i=Ut.join(s,`${o}.py`);if(gn(i))return[{path:i,isExternal:!1}];let a=Ut.join(s,o,"__init__.py");return gn(a)?[{path:a,isExternal:!1}]:null}}});import hn from"path";var Mc,le,yn=l(()=>{"use strict";Mc=["~","http://","https://","//","data:","sass:"],le=class{extensions=[".css",".scss",".sass",".less",".styl"];resolve(e,r,s,n){if(Mc.some(u=>r.startsWith(u)))return null;let o=n(e,r);if(o)return[o];let i=hn.dirname(r),a=hn.basename(r),c=i==="."?`_${a}`:`${i}/_${a}`,p=n(e,c);return p?[p]:null}}});var xn=l(()=>{"use strict";un();mn();dn();yn()});import ze from"fs";import R from"path";var fe,Bt=l(()=>{"use strict";xn();fe=class{constructor(e,r={}){this.rootDir=e;this.workspaceMap=r.workspaceMap??new Map,this.tsconfigSearchPaths=r.tsconfigSearchPaths??[e],this.langResolvers=r.langResolvers??[new pe,new ce,new ae,new le]}rootDir;workspaceMap;tsconfigSearchPaths;langResolvers;resolveAll(e,r){let s=this.resolvePathAlias(r);if(s)return[s];if(r.startsWith(".")||r.startsWith("/")){let i=this.resolveLocalPath(e,r);return i?[i]:[]}let n=(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,n);if(a)return a}let o=this.resolveWorkspaceImport(r);return o?[o]:[{path:r,isExternal:!0}]}resolve(e,r){let s=this.resolvePathAlias(r);if(s)return s;if(r.startsWith(".")||r.startsWith("/"))return this.resolveLocalPath(e,r);let n=(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,n);if(a)return a[0]??null}let o=this.resolveWorkspaceImport(r);return o||{path:r,isExternal:!0}}resolveLocalPath(e,r){let s=R.dirname(e),n=r.startsWith("/")?r:R.resolve(s,r),o=!n.startsWith(this.rootDir),i=["",".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".feature"],a=n.match(/\.(js|mjs|cjs)$/);if(a){let c=n.slice(0,-a[0].length);for(let p of[".ts",".tsx"]){let u=this.tryExtensions(c,p,o);if(u)return u}}for(let c of i){let p=this.tryExtensions(n,c,o);if(p)return p}return o?{path:n,isExternal:!0}:null}tryExtensions(e,r,s){let n=e+r;if(this.isFile(n))return{path:n,isExternal:s};let o=R.join(e,`index${r}`);if(this.isFile(o))return{path:o,isExternal:s};if(r===".py"){let i=R.join(e,"__init__.py");if(this.isFile(i))return{path:i,isExternal:s}}return null}isFile(e){try{return ze.statSync(e,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}resolvePathAlias(e){for(let r of this.tsconfigSearchPaths){let s=R.join(r,"tsconfig.json");if(ze.existsSync(s))try{let o=JSON.parse(ze.readFileSync(s,"utf-8")).compilerOptions?.paths;if(!o)continue;for(let i in o){let a=this.matchAliasPattern(i,e);if(a){let c=this.tryAliasSubstitutions(o[i],a[1]||"",r);if(c)return c}}}catch{}}return null}aliasRegexCache=new Map;matchAliasPattern(e,r){let s=this.aliasRegexCache.get(e);if(!s){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace("\\*","(.*)");s=new RegExp(`^${n}$`),this.aliasRegexCache.set(e,s)}return r.match(s)}tryAliasSubstitutions(e,r,s=this.rootDir){let n=["",".ts",".tsx",".js",".jsx",".coffee",".ls",".lua",".feature"];for(let o of e){let i=o.replace("*",r),a=R.resolve(s,i);for(let c of n){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,s]of this.workspaceMap){if(e!==r&&!e.startsWith(`${r}/`))continue;let n=e.slice(r.length),o={path:"",isExternal:!1,isWorkspace:!0,workspacePackage:r};if(!n){for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"]){let c=R.join(s,a);try{if(ze.statSync(c,{throwIfNoEntry:!1})?.isFile())return{...o,path:c}}catch{}}return{...o,path:s}}let i=this.resolveLocalPath(R.join(s,"_dummy"),n.slice(1));return i?{...o,path:i.path}:null}return null}}});import $e from"fs";import C from"path";function Rc(t,e){if(t.length===0)return e;let r=t.map(i=>C.dirname(i).split(C.sep)),s=r[0];for(let i of r.slice(1)){let a=0;for(;a<s.length&&a<i.length&&s[a]===i[a];)a++;s=s.slice(0,a)}let n=s.join(C.sep)||C.sep,o=C.relative(e,n);return o.startsWith("..")||C.isAbsolute(o)?e:n}var Dc,Ue,Sn=l(()=>{"use strict";Mt();G();xs();en();cn();ee();Bt();Dc=["tests","test","__tests__","specs","spec"];Ue=class{constructor(e,r=null,s,n,o=!1,i=new Map){this.rootDir=e;this.enableGitStats=o;this.coverageMap=i;this.previousGraph=r,this.resolver=s||new fe(e),this.lockFile=ys(e),n&&(this.progressCallback=n)}rootDir;enableGitStats;coverageMap;graph={nodes:new Map};visited=new Set;previousGraph=null;resolver;lockFile=null;progressCallback;async build(e){let r=e.map(s=>C.isAbsolute(s)?s:C.resolve(this.rootDir,s));for(let s of r)await this.processFile(s);return await this.processTestFiles(Rc(r,this.rootDir)),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
18
+ `;return l+x+h+i+`
19
+ `+d}}});import Xs from"path";import Zs from"typescript";var bc,Be,Ys=u(()=>{"use strict";c();Y();bc=/\/\/ <mokosh-tags>[\s\S]*?\/\/ <\/mokosh-tags>\n*/,Be=class{name="vitest";canHandle(e){return D.has(Xs.extname(e).toLowerCase())}apply(e,t,s){let n=t.replace(bc,""),o=Zs.createSourceFile(Xs.basename(e),n,Zs.ScriptTarget.Latest,!0),i=K(o);if(i.length===0)return n;let a=H(i[0],"tags",o),p=[...s].sort();if(a!==null&&JSON.stringify([...a].sort())===JSON.stringify(p))return n;let l=i.flatMap(d=>{let h=s.length===0?Q(d,"tags",o):V(d,"tags",Z(p),o);return h?[h]:[]});return l.length>0?X(n,l):n}}});import Ht from"path";import Je from"typescript";function Cc(r){let e=Je.createSourceFile("detect.ts",r,Je.ScriptTarget.Latest,!0);for(let t of e.statements){if(!Je.isImportDeclaration(t)||!Je.isStringLiteral(t.moduleSpecifier))continue;let s=vc[t.moduleSpecifier.text];if(s)return s}return null}function tn(r="vitest",e={},t=process.cwd()){return[new _e,new Ue,new We,new Vt(t,r,Object.entries(e))]}function rn(r,e){return e.find(t=>t.canHandle(r))??null}var en,vc,Vt,sn=u(()=>{"use strict";c();zs();$s();Bs();Js();qs();Vs();Qs();Y();Ys();en={vitest:()=>new Be,playwright:()=>new $e,cypress:()=>new je,jest:()=>new ze},vc={"@playwright/test":"playwright",cypress:"cypress","@jest/globals":"jest",vitest:"vitest"};Vt=class{constructor(e,t,s){this.rootDir=e;this.defaultFramework=t;this.frameworkOverrides=s}rootDir;defaultFramework;frameworkOverrides;name="auto";canHandle(e){return D.has(Ht.extname(e).toLowerCase())}apply(e,t,s){let n=Cc(t)??this.matchOverride(e)??this.defaultFramework;return(en[n]??en.vitest)().apply(e,t,s)}matchOverride(e){let t=Ht.relative(this.rootDir,e).split(Ht.sep).join("/");for(let[s,n]of this.frameworkOverrides)if(Us(s,t))return n;return null}}});import nn from"fs/promises";import kc from"path";async function Pc(r,e,t,s){let n;try{n=await nn.readFile(r,"utf8")}catch(a){return{path:r,status:"error",error:String(a)}}let o=rn(r,s);if(!o)return{path:r,status:"unchanged"};let i=o.apply(r,n,e);return i===n?{path:r,status:"unchanged"}:(t||await nn.writeFile(r,i,"utf8"),{path:r,status:"updated"})}async function Qt(r,e,t){let s=U(e),n=s.tagApplier?.framework??"vitest",o=s.tagApplier?.frameworkOverrides??{},i=tn(n,o,e),a={updated:0,unchanged:0,errors:0,files:[]};for(let p of r.nodes.values()){if(p.category!=="test")continue;let l=new Set,d=[];for(let v of p.tags)Ec.has(v.kind)&&wc.test(v.name)&&(Fc.has(v.name.toLowerCase())||l.has(v.name)||(l.add(v.name),d.push(v.name)));d.sort();let h=kc.resolve(e,p.path),x=await Pc(h,d,t.dryRun,i);x.path=p.path,a.files.push(x),x.status==="updated"?a.updated++:x.status==="unchanged"?a.unchanged++:a.errors++}return a}var wc,Ec,Fc,on=u(()=>{"use strict";c();ft();sn();wc=/^[a-zA-Z][a-zA-Z0-9_-]{1,}$/,Ec=new Set(["import"]),Fc=new Set(["common","fixture","fixtures","helper","helpers","index","main","mock","mocks","setup","shared","spec","test","tests","types","util","utils"])});var qe,Xt=u(()=>{"use strict";c();qe=class{isTestNode(e){return e.category==="test"||e.tags.some(t=>t.name==="test")}}});import{execSync as Zt}from"child_process";function an(r,e){let s=Zt(`git -C "${r}" log --follow --format="%ae" --since="90 days ago" -- "${e}"`,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
20
+ `).filter(Boolean),n=Zt(`git -C "${r}" log -1 --format="%at" -- "${e}"`,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();return{commitCount90d:s.length,lastAuthor:s[0],lastCommitAt:n?Number(n)*1e3:void 0}}var Ke,Yt=u(()=>{"use strict";c();Ke=class{getChangedFiles(){try{let t=["git diff --name-only","git diff --cached --name-only","git ls-files --others --exclude-standard"].flatMap(s=>{try{return Zt(s,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
21
+ `).map(o=>o.trim()).filter(o=>o!=="")}catch{return[]}});return Array.from(new Set(t))}catch(e){return console.error("Error getting git diff:",e),[]}}}});import He from"fs";import Tc from"path";import cn from"js-yaml";function pn(r){let e=r.lastIndexOf("@");return e>0?r.substring(0,e):r}function Nc(r){return r.replace(/:$/,"").split(",").map(e=>{let t=e.trim();return t.startsWith('"')&&(t=t.slice(1)),t.endsWith('"')&&(t=t.slice(0,-1)),pn(t)}).filter(Boolean)}function Ic(r,e){let t=r.startsWith("/")?r.slice(1):r,s=t.lastIndexOf("@");return s>0?{name:t.substring(0,s),version:e||t.substring(s+1)}:{name:t,version:e}}function Mc(r){try{let e=cn.load(r),t={dependencies:{}};for(let[s,n]of Object.entries(e))if(!(s==="__metadata"||!n?.version))for(let o of s.split(", ")){let i=pn(o);i&&(t.dependencies[i]={version:n.version,...n.dependencies!==void 0&&{dependencies:n.dependencies}})}return t}catch{return null}}function Dc(r){let e={dependencies:{}};for(let t of r.split(/\n\n+/)){let s=t.split(`
22
+ `).filter(p=>p.trim().length>0&&!p.trim().startsWith("#"));if(s.length<2)continue;let n=s[0];if(!n||n.startsWith(" "))continue;let o=Nc(n);if(o.length===0)continue;let a=s.find(p=>p.trim().startsWith('version "'))?.match(/version "(.*?)"/)?.[1]??"";for(let p of o)e.dependencies[p]={version:a}}return e}function Rc(r){let e=He.readFileSync(r,"utf-8"),t=JSON.parse(e),s={dependencies:{}};if(t.packages)for(let[n,o]of Object.entries(t.packages)){if(!n.startsWith("node_modules/"))continue;let i=n.replace("node_modules/","");i.includes("node_modules/")||(s.dependencies[i]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}else if(t.dependencies)for(let[n,o]of Object.entries(t.dependencies))s.dependencies[n]={version:o.version,...o.dependencies!==void 0&&{dependencies:o.dependencies}};return s}function Ac(r){let e=He.readFileSync(r,"utf-8");if(e.includes("__metadata:")){let t=Mc(e);if(t!==null)return t}return Dc(e)}function Oc(r){let e=He.readFileSync(r,"utf-8"),t={dependencies:{}};try{let s=cn.load(e);if(s.packages)for(let[n,o]of Object.entries(s.packages)){let{name:i,version:a}=Ic(n,o.version);i&&(t.dependencies[i]={version:a,...o.dependencies!==void 0&&{dependencies:o.dependencies}})}if(s.dependencies)for(let[n,o]of Object.entries(s.dependencies)){if(t.dependencies[n])continue;let i=typeof o=="string"?o:o.version;t.dependencies[n]={version:i||""}}}catch{}return t}function ln(r){let e=[["package-lock.json",Rc],["yarn.lock",Ac],["pnpm-lock.yaml",Oc]];for(let[t,s]of e){let n=Tc.join(r,t);if(He.existsSync(n))return s(n)}return null}var fn=u(()=>{"use strict";c()});import un from"path";function L(r){switch(un.extname(r).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 T(r){let e=un.extname(r).toLowerCase();return[".css",".scss",".sass",".less",".styl"].includes(e)}var G=u(()=>{"use strict";c()});import Lc from"coffeescript";function Gc(r){let e=new Set,t=/@tag\s+([a-zA-Z0-9_-]+)/g,s=t.exec(r);for(;s!==null;)s[1]&&e.add(s[1]),s=t.exec(r);return e}function jc(r,e){let t=r.toLowerCase();return t.includes(".test.")||t.includes(".spec.")||e.has("test")?"test":"logic"}function _c(r,e){let t=e.source?.value;return t?{fromPath:r,toPath:"",rawSpecifier:t,isStyle:T(t),type:"static"}:null}function Wc(r,e){let t=e.variable?.base?.value==="require",s=e.args?.[0]?.base?.value;return!t||!s?null:{fromPath:r,toPath:"",rawSpecifier:s,isStyle:T(s),type:"require"}}function zc(r,e,t){let s=e.constructor?.name;if(s==="ImportDeclaration"){let n=_c(r,e);n&&t.push(n)}else if(s==="Call"){let n=Wc(r,e);n&&t.push(n)}}function er(r,e,t){if(!(!e||typeof e!="object")){zc(r,e,t);for(let s in e){if(s==="locationData")continue;let n=e[s];if(!(!n||typeof n!="object"))if(Array.isArray(n))for(let o of n)er(r,o,t);else er(r,n,t)}}}function mn(r,e){let t=Gc(e),s=jc(r,t),n=[];try{er(r,Lc.nodes(e),n)}catch{}return{imports:n,exports:[],tags:Array.from(t).map(o=>({name:o,kind:"comment-marker"})),category:s}}var gn=u(()=>{"use strict";c();G()});import{AstBuilder as $c,GherkinClassicTokenMatcher as Uc,Parser as Bc}from"@cucumber/gherkin";import{IdGenerator as Jc}from"@cucumber/messages";function tr(r,e){let t=new Set;try{let s=new $c(qc),n=new Uc,i=new Bc(s,n).parse(e);i.feature&&(i.feature.tags.forEach(a=>{t.add(a.name.startsWith("@")?a.name.slice(1):a.name)}),i.feature.children.forEach(a=>{a.scenario&&(a.scenario.tags.forEach(p=>{t.add(p.name.startsWith("@")?p.name.slice(1):p.name)}),a.scenario.examples.forEach(p=>{p.tags.forEach(l=>{t.add(l.name.startsWith("@")?l.name.slice(1):l.name)})})),a.rule&&a.rule.children.forEach(p=>{p.scenario&&p.scenario.tags.forEach(l=>{t.add(l.name.startsWith("@")?l.name.slice(1):l.name)})})}))}catch(s){console.warn(`[GherkinParser] Failed to parse ${r}:`,s)}return{imports:[],exports:[],tags:Array.from(t).map(s=>({name:s,kind:"comment-marker"})),category:"test"}}var qc,dn=u(()=>{"use strict";c();le();qc=Jc.uuid();q("gherkin",tr)});import Kc from"path";import{parser as Hc}from"@lezer/go";function yn(r,e){let t=[],s=new Map,n=new Set,o=new Set,a=Hc.parse(e).cursor();do switch(a.name){case"LineComment":{let h=e.slice(a.from,a.to),x=h.match(Vc);x?.[1]&&n.add(x[1]);let v=h.match(Qc);v&&hn(v[1],o);let N=h.match(Xc);N&&hn(N[1],o);break}case"ImportSpec":{let h=a.node.getChild("String");if(h){let v=e.slice(h.from,h.to).slice(1,-1);t.push({fromPath:r,toPath:"",rawSpecifier:v,isExternal:!0,isStyle:!1,type:"static"})}break}case"FunctionDecl":case"TypeDecl":case"VarDecl":case"ConstDecl":{let h=a.node.getChild("DefName")??a.node.getChild("TypeSpec")?.getChild("DefName")??a.node.getChild("VarSpec")?.getChild("DefName")??a.node.getChild("ConstSpec")?.getChild("DefName");if(h){let x=e.slice(h.from,h.to);x!=="_"&&/^[A-Z]/.test(x)&&!s.has(x)&&s.set(x,{name:x})}break}}while(a.next());let p=t.some(h=>h.rawSpecifier==="testing"),l=Kc.basename(r).endsWith("_test.go")||n.has("test")||p?"test":"logic",d=new Set([...n,...o]);return{imports:t,exports:Array.from(s.values()),tags:Array.from(d).map(h=>({name:h,kind:"comment-marker"})),category:l}}function hn(r,e){for(let t of r.split(/[\s,&|!()]+/)){let s=t.trim();s&&s!=="ignore"&&e.add(s)}}var Vc,Qc,Xc,xn=u(()=>{"use strict";c();Vc=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,Qc=/^\/\/go:build\s+(.+)$/,Xc=/^\/\/\s*\+build\s+(.+)$/});function ee(r){return r.startsWith("'")||r.startsWith('"')?r.slice(1,-1):r}var rr=u(()=>{"use strict";c()});import Zc from"livescript";function Yc(r){let e=new Set,t=/@tag\s+([a-zA-Z0-9_-]+)/g,s=t.exec(r);for(;s!==null;)s[1]&&e.add(s[1]),s=t.exec(r);return e}function ep(r,e){let t=r.toLowerCase();return t.includes(".test.")||t.includes(".spec.")||e.has("test")?"test":"logic"}function rp(r,e){let t=r.constructor?.name||r.type;if(t==="Import"){let s=r.right?.value;if(typeof s=="string"){let n=ee(s);return{fromPath:e,toPath:"",rawSpecifier:n,isStyle:T(n),type:"static"}}}if(t==="Chain"&&r.head?.value==="require"){let s=r.tails?.[0];if(s?.constructor?.name==="Call"||s?.type==="Call"){let n=s.args?.[0]?.value;if(typeof n=="string"){let o=ee(n);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:T(o),type:"require"}}}}return null}function sr(r,e){if(!r||typeof r!="object")return[];let t=[],s=rp(r,e);s&&t.push(s);for(let n in r){if(tp.has(n))continue;let o=r[n];if(!(!o||typeof o!="object"))if(Array.isArray(o))for(let i of o)t.push(...sr(i,e));else t.push(...sr(o,e))}return t}function Sn(r,e){let t=Yc(e),s=ep(r,t),n=[];try{n=sr(Zc.ast(e),r)}catch{}return{imports:n,exports:[],tags:Array.from(t).map(o=>({name:o,kind:"comment-marker"})),category:s}}var tp,bn=u(()=>{"use strict";c();G();rr();tp=new Set(["first_line","first_column","last_line","last_column","line","column"])});import sp from"luaparse";function np(r){let e=new Set,t=/@tag\s+([a-zA-Z0-9_-]+)/g,s=t.exec(r);for(;s!==null;)s[1]&&e.add(s[1]),s=t.exec(r);return e}function op(r,e){let t=r.toLowerCase();return t.includes(".test.")||t.includes(".spec.")||e.has("test")?"test":"logic"}function ip(r,e){let t=[];function s(n){if(!(!n||typeof n!="object")){if((n.type==="CallExpression"||n.type==="StringCallExpression")&&n.base?.type==="Identifier"&&n.base?.name==="require"){let o;if(n.type==="CallExpression"){let i=n.arguments?.[0];i?.type==="StringLiteral"&&(o=ee(i.raw))}else if(n.type==="StringCallExpression"){let i=n.argument;i?.type==="StringLiteral"&&(o=ee(i.raw))}o&&t.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:T(o),type:"require"})}for(let o in n){if(o==="loc")continue;let i=n[o];if(i&&typeof i=="object")if(Array.isArray(i))for(let a of i)s(a);else s(i)}}}return s(r),t}function vn(r,e){let t=np(e),s=op(r,t),n=[];try{let o=sp.parse(e);n=ip(o,r)}catch{}return{imports:n,exports:[],tags:Array.from(t).map(o=>({name:o,kind:"comment-marker"})),category:s}}var Cn=u(()=>{"use strict";c();G();rr()});async function lp(){return kn??=(async()=>{let{unified:r}=await import("unified"),e=(await import("remark-parse")).default;return r().use(e)})(),kn}function fp(r){let e=r.trim();return e.length===0||e.startsWith("#")||ap.some(t=>e.startsWith(t))}function up(r,e){let t=r.match(pp);return t?t.map(s=>({fromPath:e,toPath:"",rawSpecifier:s,isStyle:!1,type:"static"})):[]}function wn(r,e,t){if(r.type==="link"&&typeof r.url=="string"&&!fp(r.url)&&t.push({fromPath:e,toPath:"",rawSpecifier:r.url,isStyle:!1,type:"static"}),(r.type==="code"||r.type==="inlineCode")&&typeof r.value=="string"&&t.push(...up(r.value,e)),Array.isArray(r.children))for(let s of r.children)wn(s,e,t)}async function En(r,e){let s=(await lp()).parse(e),n=[];wn(s,r,n);let o=new Set;return{imports:n.filter(a=>o.has(a.rawSpecifier)?!1:(o.add(a.rawSpecifier),!0)),exports:[],tags:[],category:"other"}}var ap,cp,pp,kn,Fn=u(()=>{"use strict";c();ap=["http://","https://","mailto:","//"],cp="ts|tsx|js|jsx|mjs|cjs|py|go|lua|css|scss|less|styl|coffee|ls|feature|md|mdx|json",pp=new RegExp(`(?:\\.{1,2}/)?[\\w.-]+(?:/[\\w.-]+)*\\.(?:${cp})\\b`,"g")});import mp from"path";import{parser as gp}from"@lezer/python";function Pn(r,e){let t=[],s=[],n=new Set,o=mp.basename(r).toLowerCase(),a=gp.parse(e).cursor();do switch(a.name){case"Comment":{let l=e.slice(a.from,a.to).match(/#\s*@tag\s+([a-zA-Z0-9_-]+)/);l?.[1]&&n.add(l[1]);break}case"ImportStatement":{for(let l of hp(a.node,e,r))t.push(l);break}case"FunctionDefinition":case"ClassDefinition":{let l=a.node.parent;if(l?.name==="Script"||l?.name==="DecoratedStatement"&&l.parent?.name==="Script"){let h=a.node.getChild("VariableName");h&&s.push({name:e.slice(h.from,h.to)})}break}case"AssignStatement":{if(a.node.parent?.name==="Script"){let l=a.node.firstChild;l?.name==="VariableName"&&s.push({name:e.slice(l.from,l.to)})}break}}while(a.next());let p=bp(o,t,n);return p==="test"&&n.add("test"),{imports:t,exports:s,tags:Array.from(n).map(l=>({name:l,kind:"comment-marker"})),category:p}}function hp(r,e,t){let s=r.firstChild;return s?s.name==="from"?yp(r,e,t):xp(r,e,t):[]}function yp(r,e,t){let s=r.firstChild;if(!s)return[];let n=s.nextSibling;for(;n&&n.name!=="import";)n=n.nextSibling;if(!n)return[];let o=e.slice(s.to,n.from).trim(),i=Sp(n.nextSibling,e);if(!i.length)return[];let a=0;for(;a<o.length&&o[a]===".";)a++;let p=o.slice(a);if(a===0)return[fe(t,o,i,!0)];let l=a===1?"./":"../".repeat(a-1);return p?[fe(t,l+p.replace(/\./g,"/"),i,!1)]:i[0]==="*"?[fe(t,l.slice(0,-1),["*"],!1)]:i.map(d=>fe(t,l+d,[d],!1))}function xp(r,e,t){let s=[],n=r.firstChild?.nextSibling??null;for(;n;){if(n.name==="VariableName"){let o=e.slice(n.from,n.to);for(;n.nextSibling?.name==="."&&n.nextSibling.nextSibling?.name==="VariableName";)n=n.nextSibling.nextSibling,o+=`.${e.slice(n.from,n.to)}`;n.nextSibling?.name==="as"&&(n=n.nextSibling.nextSibling??n.nextSibling),s.push(fe(t,o,["*"],!0))}n=n.nextSibling}return s}function Sp(r,e){let t=[],s=r;for(;s;)s.name==="*"?t.push("*"):s.name==="VariableName"&&(t.push(e.slice(s.from,s.to)),s.nextSibling?.name==="as"&&(s=s.nextSibling.nextSibling??s.nextSibling)),s=s.nextSibling;return t}function fe(r,e,t,s){return{fromPath:r,toPath:"",rawSpecifier:e,isStyle:!1,isExternal:s,type:"static",symbols:t.length>0?t:void 0}}function bp(r,e,t){return r.startsWith("test_")||r.endsWith("_test.py")?"test":r==="conftest.py"||r==="setup.py"?"config":t.has("test")||e.some(s=>dp.has(s.rawSpecifier))?"test":"logic"}var dp,Tn=u(()=>{"use strict";c();dp=new Set(["pytest","unittest","nose","hypothesis"])});import y from"typescript";function vp(r){let e=1;function t(s){switch(s.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 n=s.operatorToken.kind;(n===y.SyntaxKind.AmpersandAmpersandToken||n===y.SyntaxKind.BarBarToken||n===y.SyntaxKind.QuestionQuestionToken)&&e++;break}}y.forEachChild(s,t)}return t(r),e}function Cp(r){let e=0;function t(s,n,o){if(y.isIfStatement(s)){e+=o?1:1+n;let a=o?n:n+1;t(s.expression,a,!1),t(s.thenStatement,a,!1),s.elseStatement&&(y.isIfStatement(s.elseStatement)?t(s.elseStatement,n,!0):(e+=1,t(s.elseStatement,n+1,!1)));return}if(y.isForStatement(s)||y.isForInStatement(s)||y.isForOfStatement(s)||y.isWhileStatement(s)||y.isDoStatement(s)||y.isSwitchStatement(s)){e+=1+n,y.forEachChild(s,a=>t(a,n+1,!1));return}if(y.isCatchClause(s)){e+=1+n,y.forEachChild(s,a=>t(a,n,!1));return}if(y.isConditionalExpression(s)&&(e+=1),y.isBinaryExpression(s)){let a=s.operatorToken.kind;(a===y.SyntaxKind.AmpersandAmpersandToken||a===y.SyntaxKind.BarBarToken||a===y.SyntaxKind.QuestionQuestionToken)&&(e+=1)}if(n>0&&(y.isFunctionDeclaration(s)||y.isFunctionExpression(s)||y.isArrowFunction(s))){e+=1+n,y.forEachChild(s,a=>t(a,n+1,!1));return}y.forEachChild(s,a=>t(a,n,!1))}return t(r,0,!1),e}function nr(r){return{complexity:vp(r),cognitiveComplexity:Cp(r)}}var Nn=u(()=>{"use strict";c()});import C from"typescript";function In(r,e){kp(r,e),Ep(r,e),Fp(r,e),Pp(r,e)}function kp(r,e){if((C.isFunctionDeclaration(r)||C.isVariableDeclaration(r))&&r.name&&C.isIdentifier(r.name)&&wp(r)){let t;if(C.isFunctionDeclaration(r))t="function";else{let s=r.initializer;t=s&&(C.isArrowFunction(s)||C.isFunctionExpression(s))?"function":"variable"}e.tags.add({name:r.name.text,kind:t})}}function wp(r){if(C.isFunctionDeclaration(r))return C.isSourceFile(r.parent);let e=r.parent?.parent;return!!e&&C.isSourceFile(e.parent)}function Ep(r,e){if(!C.isStringLiteral(r))return;let t=r.text.match(/@[\w-]+/g);if(t)for(let s of t)e.tags.add({name:s.substring(1),kind:"comment-marker"})}function Fp(r,e){if(!C.isSourceFile(r))return;let t=/@tag\s+([a-zA-Z0-9_-]+)/g,s=r.getFullText(),n=t.exec(s);for(;n!==null;)n[1]&&e.tags.add({name:n[1],kind:"comment-marker"}),n=t.exec(s)}function Pp(r,e){if(C.isCallExpression(r)&&Tp(r.expression))for(let t of r.arguments)C.isObjectLiteralExpression(t)&&Np(t,e)}function Tp(r){return C.isIdentifier(r)?or.has(r.text):!!(C.isPropertyAccessExpression(r)&&(or.has(r.name.text)||C.isIdentifier(r.expression)&&or.has(r.expression.text)))}function Np(r,e){for(let t of r.properties){if(!C.isPropertyAssignment(t)||!C.isIdentifier(t.name)||t.name.text!=="tags"&&t.name.text!=="tag")continue;let{initializer:s}=t,n=C.isArrayLiteralExpression(s)?s.elements.filter(C.isStringLiteral):t.name.text==="tag"&&C.isStringLiteral(s)?[s]:[];for(let o of n)e.tags.add({name:o.text.replace(/^@/,""),kind:"comment-marker"})}}var or,Mn=u(()=>{"use strict";c();or=new Set(["test","describe","it"])});import Dn from"path";import g from"typescript";function ir(r,e,t){let s=[],n=new Map,o=new Set,i=g.createSourceFile(r,e,g.ScriptTarget.Latest,!0,t==="typescript"?g.ScriptKind.TSX:g.ScriptKind.JSX),a={filePath:r,imports:s,exports:n,tags:o,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},p=R=>{Rp(R,a),g.forEachChild(R,p)};p(i);let l=Bp(r,a);(l==="test"||l==="barrel")&&o.add({name:l,kind:"comment-marker"}),l!=="test"&&Jp(a,i);let d=i.statements[0],h=d?An(d):void 0,{complexity:x,cognitiveComplexity:v}=nr(i),N=Ip(i);return{imports:s,exports:Array.from(n.values()),tags:Array.from(o),category:l,rawCallEdges:a.rawCallEdges??[],complexity:x,cognitiveComplexity:v,...N.length>0?{functions:N}:{},...h!==void 0?{description:h}:{}}}function Ip(r){let e=[],t=(n,o)=>{let{complexity:i,cognitiveComplexity:a}=nr(o),p=r.getLineAndCharacterOfPosition(o.getStart(r)).line+1;e.push({name:n,line:p,complexity:i,cognitiveComplexity:a})},s=(n,o)=>{if(g.isFunctionDeclaration(n)&&n.name&&n.body?t(n.name.text,n):g.isVariableDeclaration(n)&&g.isIdentifier(n.name)&&n.initializer&&(g.isArrowFunction(n.initializer)||g.isFunctionExpression(n.initializer))?t(n.name.text,n.initializer):o&&g.isMethodDeclaration(n)&&g.isIdentifier(n.name)&&n.body?t(`${o}.${n.name.text}`,n):o&&g.isConstructorDeclaration(n)&&n.body?t(`${o}.constructor`,n):o&&g.isGetAccessorDeclaration(n)&&g.isIdentifier(n.name)&&n.body?t(`${o}.get ${n.name.text}`,n):o&&g.isSetAccessorDeclaration(n)&&g.isIdentifier(n.name)&&n.body&&t(`${o}.set ${n.name.text}`,n),g.isClassDeclaration(n)&&n.name){let i=n.name.text;g.forEachChild(n,a=>s(a,i));return}g.forEachChild(n,i=>s(i,o))};return s(r,void 0),e}function Rn(r,e,t,s){let n={name:r},o=An(t);o!==void 0&&(n.doc=o);let i=Mp(e);i!==void 0&&(n.flags=i);let a=Dp(e,s);return a!==void 0&&(n.signature=a),n}function An(r){let e=g.getJSDocCommentsAndTags(r);for(let t of e)if(g.isJSDoc(t)&&t.comment)return g.getTextOfJSDocComment(t.comment)||void 0}function Mp(r){let e=new Set(["deprecated","internal","public","alpha","beta"]),t=g.getJSDocTags(r).map(s=>s.tagName.text).filter(s=>e.has(s));return t.length>0?t:void 0}function Dp(r,e){let t=g.createPrinter({removeComments:!0}),s=n=>t.printNode(g.EmitHint.Unspecified,n,e);if(g.isFunctionDeclaration(r)||g.isMethodDeclaration(r)){let n=r.parameters.map(s).join(", "),o=r.type?s(r.type):"void";return`${r.typeParameters?`<${r.typeParameters.map(a=>a.name.text).join(", ")}>`:""}(${n}) => ${o}`}if(g.isVariableDeclaration(r)){if(r.type)return s(r.type);if(r.initializer&&(g.isArrowFunction(r.initializer)||g.isFunctionExpression(r.initializer))){let n=r.initializer,o=n.parameters.map(s).join(", "),i=n.type?s(n.type):"unknown";return`(${o}) => ${i}`}return}if(g.isClassDeclaration(r)&&r.name)return`class ${r.name.text}`;if(g.isInterfaceDeclaration(r))return`interface ${r.name.text}`;if(g.isTypeAliasDeclaration(r))return s(r.type);if(g.isEnumDeclaration(r))return`enum ${r.name.text}`}function Rp(r,e){Ap(r,e),Op(r,e),Gp(r,e),jp(r,e),Up(r,e),In(r,e)}function Ap(r,e){if(!g.isSourceFile(r))return;let t=r.statements.filter(s=>!g.isEmptyStatement(s));e.totalStatements=t.length,e.exportStatements=t.filter(s=>g.isExportDeclaration(s)||g.isExportAssignment(s)||ar(s)).length}function Op(r,e){if(g.isJsxElement(r)||g.isJsxSelfClosingElement(r)||g.isJsxFragment(r)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(g.isFunctionDeclaration(r)||g.isMethodDeclaration(r)||g.isArrowFunction(r)||g.isClassDeclaration(r)||g.isVariableStatement(r)||g.isEnumDeclaration(r)){e.hasTypesOnly=!1;return}g.isExportDeclaration(r)&&!Lp(r)&&(e.hasTypesOnly=!1)}function Lp(r){return r.isTypeOnly?!0:!r.exportClause||!g.isNamedExports(r.exportClause)?!1:r.exportClause.elements.every(e=>e.isTypeOnly)}function Gp(r,e){if(!g.isImportDeclaration(r)||!r.moduleSpecifier||!g.isStringLiteral(r.moduleSpecifier))return;let t=[];if(r.importClause&&(r.importClause.name&&t.push("default"),r.importClause.namedBindings))if(g.isNamedImports(r.importClause.namedBindings))for(let n of r.importClause.namedBindings.elements)t.push(n.name.text);else g.isNamespaceImport(r.importClause.namedBindings)&&t.push("*");let s=t.length>0?"static":"side-effect";e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.moduleSpecifier.text,isStyle:T(r.moduleSpecifier.text),type:s,symbols:t.length>0?t:void 0})}function jp(r,e){g.isExportDeclaration(r)?_p(r,e):g.isExportAssignment(r)?e.exports.set("default",{name:"default"}):ar(r)&&$p(r,e)}function _p(r,e){if(r.moduleSpecifier&&g.isStringLiteral(r.moduleSpecifier))Wp(r,r.moduleSpecifier.text,e);else if(r.exportClause&&g.isNamedExports(r.exportClause))for(let t of r.exportClause.elements){let s=t.name.text;e.exports.set(s,{name:s})}}function Wp(r,e,t){let s=zp(r),n={fromPath:t.filePath,toPath:"",rawSpecifier:e,isStyle:T(e),type:"re-export"};s.length>0&&(n.symbols=s),t.imports.push(n)}function zp(r){return r.exportClause?g.isNamedExports(r.exportClause)?r.exportClause.elements.map(e=>e.name.text):[]:["*"]}function $p(r,e){if((g.isFunctionDeclaration(r)||g.isClassDeclaration(r)||g.isInterfaceDeclaration(r)||g.isTypeAliasDeclaration(r)||g.isEnumDeclaration(r))&&r.name){let s=r.name.text;e.exports.set(s,Rn(s,r,r,e.sourceFile));return}if(g.isVariableStatement(r)){for(let s of r.declarationList.declarations)if(g.isIdentifier(s.name)){let n=s.name.text;e.exports.set(n,Rn(n,s,r,e.sourceFile))}}}function Up(r,e){if(!g.isCallExpression(r))return;let t=r.arguments[0];!t||!g.isStringLiteral(t)||(r.expression.kind===g.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:t.text,isStyle:T(t.text),type:"dynamic"}):g.isIdentifier(r.expression)&&r.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:t.text,isStyle:T(t.text),type:"require"}))}function Bp(r,e){let t=Dn.basename(r).toLowerCase(),s=Dn.extname(r).toLowerCase();return se().some(o=>t.includes(o))?"test":Kr(t)?"config":e.imports.some(o=>it().some(i=>o.rawSpecifier.includes(i)))?"test":s===".tsx"||s===".jsx"||e.hasUI?"ui":e.hasTypesOnly&&e.totalStatements>0?"type-only":e.totalStatements>0&&e.exportStatements/e.totalStatements>ct()?"barrel":"logic"}function ar(r){return g.canHaveModifiers(r)&&g.getModifiers(r)?.some(e=>e.kind===g.SyntaxKind.ExportKeyword)===!0}function Jp(r,e){let t=r.rawCallEdges??[];r.rawCallEdges=t;let s=new Map;for(let n of e.statements){if(!g.isImportDeclaration(n)||!g.isStringLiteral(n.moduleSpecifier))continue;let o=n.moduleSpecifier.text,i=n.importClause;if(i&&(i.name&&s.set(i.name.text,o),i.namedBindings&&g.isNamedImports(i.namedBindings)))for(let a of i.namedBindings.elements)s.set(a.name.text,o)}if(s.size!==0)for(let n of e.statements){let o=Kp(n);if(o){let i=Hp(n);i&&Ve(i,o,s,t);continue}g.isClassDeclaration(n)&&n.name&&qp(n,s,t)}}function qp(r,e,t){let s=r.name.text;for(let n of r.members)g.isMethodDeclaration(n)&&n.body&&g.isIdentifier(n.name)?Ve(n.body,`${s}.${n.name.text}`,e,t):g.isConstructorDeclaration(n)&&n.body&&Ve(n.body,`${s}.constructor`,e,t)}function Kp(r){if(ar(r)){if(g.isFunctionDeclaration(r)&&r.name)return r.name.text;if(g.isVariableStatement(r)){for(let e of r.declarationList.declarations)if(g.isIdentifier(e.name)&&e.initializer&&(g.isArrowFunction(e.initializer)||g.isFunctionExpression(e.initializer)))return e.name.text}}}function Hp(r){if(g.isFunctionDeclaration(r))return r.body;if(g.isVariableStatement(r)){for(let e of r.declarationList.declarations)if(e.initializer&&(g.isArrowFunction(e.initializer)||g.isFunctionExpression(e.initializer)))return e.initializer}}function Ve(r,e,t,s){if(g.isCallExpression(r)&&g.isIdentifier(r.expression)){let n=r.expression.text,o=t.get(n);o&&!s.some(i=>i.from===e&&i.to===n&&i.toSpecifier===o)&&s.push({from:e,to:n,toSpecifier:o})}g.forEachChild(r,n=>Ve(n,e,t,s))}var On=u(()=>{"use strict";c();$();Nn();G();Mn()});function Qe(r,e){if(e.length===0)return"ui";let t=!1;return r.walk(s=>{if(s.type==="rule")return t=!0,!1}),t?"ui":"barrel"}var Ln=u(()=>{"use strict";c()});import jn from"postcss";import*as Vp from"postcss-less";function Gn(r){return r.startsWith("~")||r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("data:")}function Xp(r){let e=r.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function Zp(r,e){let t=r.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(t){let o=t[1]?.trim()??"",i=t[2]??"";if(!i)return null;let a=_n.has(o)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,...Gn(i)?{isExternal:!0}:{}}}let s=r.match(/^url\(['"]?([^'")]+)['"]?\)/),n=s?s[1]?.trim()??"":r.match(/^['"]([^'"]+)['"]/)?.[1]??"";return n?{fromPath:e,toPath:"",rawSpecifier:n,isStyle:!0,type:"static",...Gn(n)?{isExternal:!0}:{}}:null}function Yp(r,e){let t=[],s=/url\(['"]?([^'")]+)['"]?\)/g,n=s.exec(r);for(;n!==null;){let o=n[1]?.trim()??"";Xp(o)&&t.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static"}),n=s.exec(r)}return t}function Wn(r,e){let t=[];return r.walk(s=>{if(s.type==="atrule"&&s.name==="import"){let n=Zp(s.params,e);n&&t.push(n)}s.type==="decl"&&t.push(...Yp(s.value,e))}),t}function el(r){return r.replace(/(?<!:)\/\/.*/g,"")}function tl(r,e){let t=[],s=/@import\s+(?:\(([^)]+)\)\s+)?['"]([^'"]+)['"]/g,n=s.exec(r);for(;n!==null;){let o=n[1]?.trim()??"",i=n[2]??"";if(i){let a=_n.has(o)?"side-effect":"static";t.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}n=s.exec(r)}return t}function zn(r,e){let t=jn.parse(el(r));return{imports:Wn(t,e),root:t}}function $n(r,e){try{let t=Qp.parse(r);return{imports:Wn(t,e),root:t}}catch{return{imports:tl(r,e),root:jn.parse("")}}}var Qp,_n,Un=u(()=>{"use strict";c();Qp=Vp,_n=new Set(["reference","inline"])});import{parse as rl}from"postcss-scss";function sl(r){return!!(r.startsWith("sass:")||r.startsWith("~")||r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||!r.startsWith(".")&&!r.startsWith("/")&&!r.startsWith("_"))}function nl(r){let e=r.match(/^['"]([^'"]+)['"]/);if(!e?.[1])return{specifier:""};let t=e[1],n=r.match(/\bas\s+(\S+)/)?.[1];return n!==void 0?{specifier:t,alias:n}:{specifier:t}}function Bn(r,e){let t=rl(r),s=[];return t.walk(n=>{if(n.type!=="atrule")return;let{name:o,params:i}=n;if(o!=="import"&&o!=="use"&&o!=="forward")return;let{specifier:a,alias:p}=nl(i);if(!a)return;let l={fromPath:e,toPath:"",rawSpecifier:a,isStyle:!0,type:o==="forward"?"re-export":"static",...sl(a)?{isExternal:!0}:{}};p&&(l.symbols=[p]),s.push(l)}),{imports:s,root:t}}var Jn=u(()=>{"use strict";c()});function qn(r,e){let t=[],s=/@require\s+['"]([^'"]+)['"]/g,n=s.exec(r);for(;n!==null;){let i=n[1];i&&t.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"require"}),n=s.exec(r)}let o=/(?<!@)(?:import|require)\s*\(?\s*['"]([^'"]+)['"]/g;for(n=o.exec(r);n!==null;){let i=n[1];i&&t.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:"static"}),n=o.exec(r)}return t}function Kn(r,e){if(e.length===0)return"ui";try{let t=ot("stylus");return new t.Parser(r).parse().nodes.some(o=>o.constructor.name!=="Import")?"ui":"barrel"}catch{return r.replace(/^\s*@?(?:require|import)\b.*/gm,"").trim().length>0?"ui":"barrel"}}var Hn=u(()=>{"use strict";c()});function ue(r,e){let t=L(r);if(t==="stylus"){let o=qn(e,r);return{imports:o,exports:[],tags:[],category:Kn(e,o)}}if(t==="scss"){let{imports:o,root:i}=Bn(e,r);return{imports:o,exports:[],tags:[],category:Qe(i,o)}}if(t==="less"){let{imports:o,root:i}=$n(e,r);return{imports:o,exports:[],tags:[],category:Qe(i,o)}}let{imports:s,root:n}=zn(e,r);return{imports:s,exports:[],tags:[],category:Qe(n,s)}}var Vn=u(()=>{"use strict";c();G();Ln();Un();Jn();Hn()});async function Qn(r,e){let t=L(r),s=Is(t);return s?s(r,e):{imports:[],exports:[],tags:[],category:"other"}}var Xn=u(()=>{"use strict";c();G();gn();dn();xn();bn();Cn();Fn();Tn();On();le();Vn();$();G();le();for(let[r,e]of[["javascript",(t,s)=>ir(t,s,"javascript")],["typescript",(t,s)=>ir(t,s,"typescript")],["css",ue],["scss",ue],["less",ue],["stylus",ue],["coffeescript",mn],["livescript",Sn],["lua",vn],["python",Pn],["go",yn],["gherkin",tr],["markdown",En]])q(r,e)});import Zn from"path";function eo(r,e){for(let t of r.values()){let s=e.get(t.path);s!==void 0&&(t.coveragePct=s)}}function to(r,e){for(let t of r)if(t.isExternal){let s=t.rawSpecifier.startsWith("@")?t.rawSpecifier.split("/").slice(0,2).join("/"):t.rawSpecifier.split("/")[0];s&&!e.some(n=>n.name===s)&&e.push({name:s,kind:"library"})}}function ro(r){for(let e of r.values())if(e.category==="test")for(let t of e.imports){if(t.isExternal||!t.toPath)continue;let s=r.get(t.toPath);s&&(s.category!=="logic"&&s.category!=="barrel"||(s.testedBy??=[],s.testedBy.includes(e.path)||s.testedBy.push(e.path)))}}function so(r){for(let e of r.values())if(e.type==="markdown")for(let t of e.imports){if(t.isExternal||!t.toPath)continue;let s=r.get(t.toPath);!s||s===e||(s.documentedBy??=[],s.documentedBy.includes(e.path)||s.documentedBy.push(e.path),s.category==="logic"&&(s.lastCommitAt??0)>(e.lastCommitAt??0)&&(e.staleFor??=[],e.staleFor.includes(s.path)||e.staleFor.push(s.path)))}}function Yn(r){return Math.round(r*1e4)/1e4}function no(r){for(let e of r.values()){let t=[];for(let s of e.imports){if(s.isExternal||!s.toPath)continue;let n=r.get(s.toPath);if(!n||n.exports.length===0)continue;let o;if(s.symbols===void 0){if(s.type==="side-effect")continue;o=1}else s.symbols.includes("*")?o=1:o=s.symbols.length/n.exports.length;s.exportUsageRatio=Yn(Math.min(1,o)),t.push(s.exportUsageRatio)}t.length>0&&(e.avgExportUsage=Yn(t.reduce((s,n)=>s+n,0)/t.length),e.maxExportUsage=Math.max(...t))}}function cr(r,e,t){e&&(r.some(s=>s.name===e&&s.kind===t)||r.push({name:e,kind:t}))}function ol(r,e){let t=e.toPath,s=Zn.basename(t,Zn.extname(t)).replace(/\.(test|spec)$/,"");cr(r.tags,s,"import")}function il(r,e){if(!(!e.symbols||e.symbols.includes("*")))for(let t of e.symbols)cr(r.tags,t,"import")}function al(r,e,t){let s=t.get(e.toPath);if(!(!s||s.category==="test"))for(let n of s.tags)n.kind==="comment-marker"&&cr(r.tags,n.name,"comment-marker")}function oo(r){for(let e of r.values())if(e.category==="test")for(let t of e.imports)!t.toPath||t.isExternal||(ol(e,t),il(e,t),al(e,t,r))}var io=u(()=>{"use strict";c()});import po from"fs";import te from"path";function cl(r,e){let t=r.split(`
23
+ `),s=null,n=new Map,o=!1;for(let i of t){let a=i.trim();if(a.startsWith("module ")){s=a.slice(7).trim();continue}if(/^replace\s*\(/.test(a)){o=!0;continue}if(o&&a===")"){o=!1;continue}if(o&&a.includes("=>")){ao(a,e,n);continue}!o&&/^replace\s+/.test(a)&&a.includes("=>")&&ao(a.replace(/^replace\s+/,""),e,n)}return{mod:s,replaces:n}}function ao(r,e,t){let[s,n]=r.split("=>").map(a=>a.trim());if(!s||!n)return;let o=s.split(/\s+/)[0];if(!n.startsWith(".")&&!n.startsWith("/"))return;let i=te.isAbsolute(n)?n:te.resolve(e,n);t.set(o,i)}function co(r){let e;try{e=po.readdirSync(r,{withFileTypes:!0})}catch{return null}let t=e.filter(s=>s.isFile()&&s.name.endsWith(".go")&&!s.name.endsWith("_test.go")).map(s=>({path:te.join(r,s.name),isExternal:!1})).sort((s,n)=>s.path.localeCompare(n.path));return t.length>0?t:null}var me,lo=u(()=>{"use strict";c();me=class{extensions=[".go"];goModCache=new Map;resolve(e,t,s,n){let{mod:o,replaces:i}=this.readGoMod(s);if(!o)return null;let a=this.applyReplace(t,i,s);if(a!==void 0)return co(a);if(t!==o&&!t.startsWith(`${o}/`))return null;let p=t.slice(o.length).replace(/^\//,"");return p?co(te.join(s,p)):null}readGoMod(e){let t=this.goModCache.get(e);if(t!==void 0)return t;let s={mod:null,replaces:new Map};try{let n=po.readFileSync(te.join(e,"go.mod"),"utf-8"),o=cl(n,e);return this.goModCache.set(e,o),o}catch{return this.goModCache.set(e,s),s}}applyReplace(e,t,s){for(let[n,o]of t){if(e===n)return o;if(e.startsWith(`${n}/`)){let i=e.slice(n.length+1);return te.join(o,i)}}}}});import pl from"fs";import pr from"path";var ge,fo=u(()=>{"use strict";c();ge=class{extensions=[".lua"];resolve(e,t,s,n){let o=t.replace(/\./g,pr.sep),i=[s,pr.join(s,"lib")];for(let a of i){if(!pl.existsSync(a))continue;let p=n(pr.join(a,"_dummy.lua"),o);if(p)return[p]}return null}}});import ll from"path";var de,uo=u(()=>{"use strict";c();de=class{extensions=[".md",".mdx"];resolve(e,t,s,n){let o=n(ll.join(s,"_dummy"),`./${t}`);return o?[o]:null}}});import fl from"fs";import lr from"path";function mo(r){try{return fl.statSync(r,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var he,go=u(()=>{"use strict";c();he=class{extensions=[".py"];resolve(e,t,s,n){let o=t.replace(/\./g,lr.sep),i=lr.join(s,`${o}.py`);if(mo(i))return[{path:i,isExternal:!1}];let a=lr.join(s,o,"__init__.py");return mo(a)?[{path:a,isExternal:!1}]:null}}});import ho from"path";var ul,ye,yo=u(()=>{"use strict";c();ul=["~","http://","https://","//","data:","sass:"],ye=class{extensions=[".css",".scss",".sass",".less",".styl"];resolve(e,t,s,n){if(ul.some(d=>t.startsWith(d)))return null;let o=n(e,t);if(o)return[o];let i=ho.dirname(t),a=ho.basename(t),p=i==="."?`_${a}`:`${i}/_${a}`,l=n(e,p);return l?[l]:null}}});var xo=u(()=>{"use strict";c();lo();fo();uo();go();yo()});import Xe from"fs";import j from"path";var re,fr=u(()=>{"use strict";c();xo();re=class{constructor(e,t={}){this.rootDir=e;this.workspaceMap=t.workspaceMap??new Map,this.tsconfigSearchPaths=t.tsconfigSearchPaths??[e],this.langResolvers=t.langResolvers??[new he,new ge,new me,new ye,new de]}rootDir;workspaceMap;tsconfigSearchPaths;langResolvers;resolveAll(e,t){let s=this.resolvePathAlias(t);if(s)return[s];if(t.startsWith(".")||t.startsWith("/")){let i=this.resolveLocalPath(e,t);return i?[i]:[]}let n=(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,t,this.rootDir,n);if(a)return a}let o=this.resolveWorkspaceImport(t);return o?[o]:[{path:t,isExternal:!0}]}resolve(e,t){let s=this.resolvePathAlias(t);if(s)return s;if(t.startsWith(".")||t.startsWith("/"))return this.resolveLocalPath(e,t);let n=(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,t,this.rootDir,n);if(a)return a[0]??null}let o=this.resolveWorkspaceImport(t);return o||{path:t,isExternal:!0}}resolveLocalPath(e,t){let s=j.dirname(e),n=t.startsWith("/")?t:j.resolve(s,t),o=!n.startsWith(this.rootDir),i=["",".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".feature",".md",".mdx"],a=n.match(/\.(js|mjs|cjs)$/);if(a){let p=n.slice(0,-a[0].length);for(let l of[".ts",".tsx"]){let d=this.tryExtensions(p,l,o);if(d)return d}}for(let p of i){let l=this.tryExtensions(n,p,o);if(l)return l}return o?{path:n,isExternal:!0}:null}tryExtensions(e,t,s){let n=e+t;if(this.isFile(n))return{path:n,isExternal:s};let o=j.join(e,`index${t}`);if(this.isFile(o))return{path:o,isExternal:s};if(t===".py"){let i=j.join(e,"__init__.py");if(this.isFile(i))return{path:i,isExternal:s}}return null}isFile(e){try{return Xe.statSync(e,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}resolvePathAlias(e){for(let t of this.tsconfigSearchPaths){let s=j.join(t,"tsconfig.json");if(Xe.existsSync(s))try{let o=JSON.parse(Xe.readFileSync(s,"utf-8")).compilerOptions?.paths;if(!o)continue;for(let i in o){let a=this.matchAliasPattern(i,e);if(a){let p=this.tryAliasSubstitutions(o[i],a[1]||"",t);if(p)return p}}}catch{}}return null}aliasRegexCache=new Map;matchAliasPattern(e,t){let s=this.aliasRegexCache.get(e);if(!s){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace("\\*","(.*)");s=new RegExp(`^${n}$`),this.aliasRegexCache.set(e,s)}return t.match(s)}tryAliasSubstitutions(e,t,s=this.rootDir){let n=["",".ts",".tsx",".js",".jsx",".coffee",".ls",".lua",".feature"];for(let o of e){let i=o.replace("*",t),a=j.resolve(s,i);for(let p of n){let l=this.tryExtensions(a,p,!1);if(l)return l}}return null}resolveWorkspaceImport(e){if(this.workspaceMap.size===0)return null;for(let[t,s]of this.workspaceMap){if(e!==t&&!e.startsWith(`${t}/`))continue;let n=e.slice(t.length),o={path:"",isExternal:!1,isWorkspace:!0,workspacePackage:t};if(!n){for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"]){let p=j.join(s,a);try{if(Xe.statSync(p,{throwIfNoEntry:!1})?.isFile())return{...o,path:p}}catch{}}return{...o,path:s}}let i=this.resolveLocalPath(j.join(s,"_dummy"),n.slice(1));return i?{...o,path:i.path}:null}return null}}});import xe from"fs";import E from"path";import ml from"piscina";function hl(r,e){if(r.length===0)return e;let t=r.map(i=>E.dirname(i).split(E.sep)),s=t[0];for(let i of t.slice(1)){let a=0;for(;a<s.length&&a<i.length&&s[a]===i[a];)a++;s=s.slice(0,a)}let n=s.join(E.sep)||E.sep,o=E.relative(e,n);return o.startsWith("..")||E.isAbsolute(o)?e:n}var gl,So,dl,Se,bo=u(()=>{"use strict";c();Yt();$();fn();Xn();io();ie();fr();gl=["tests","test","__tests__","specs","spec"],So=new Set(["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"]),dl=20;Se=class{constructor(e,t=null,s,n,o=!1,i=new Map,a=!0){this.rootDir=e;this.enableGitStats=o;this.coverageMap=i;this.parallelParsing=a;this.previousGraph=t,this.resolver=s||new re(e),this.lockFile=ln(e),n&&(this.progressCallback=n)}rootDir;enableGitStats;coverageMap;parallelParsing;graph={nodes:new Map};visited=new Set;queue=[];previousGraph=null;resolver;lockFile=null;progressCallback;pool=null;async build(e){let t=e.map(s=>E.isAbsolute(s)?s:E.resolve(this.rootDir,s));await this.initPool();try{for(let s of t)this.enqueue(s);return await this.drain(),await this.processTestFiles(hl(t,this.rootDir)),await this.processDocFiles(),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
24
24
  Done. Total processed: ${this.visited.size} nodes.
25
- `),an(this.graph.nodes),nn(this.graph.nodes),on(this.graph.nodes),this.coverageMap.size>0&&rn(this.graph.nodes,this.coverageMap),new F(this.graph.nodes)}async processTestFiles(e){let r=X(),s=new Set(["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"]),n=async i=>{let a;try{a=$e.readdirSync(i,{withFileTypes:!0})}catch{return}for(let c of a){let p=C.join(i,c.name);c.isDirectory()?s.has(c.name)||await n(p):c.isFile()&&r.some(u=>c.name.includes(u))&&await this.processFile(p)}};await n(e);let o=e;for(;o!==this.rootDir;){let i=C.dirname(o);if(i===o)break;for(let a of Dc){let c=C.join(i,a);try{$e.statSync(c).isDirectory()&&await n(c)}catch{}}o=i}}async processFile(e){if(this.visited.has(e))return;this.visited.add(e),this.showProgress();let r=$e.statSync(e,{throwIfNoEntry:!1});if(!r?.isFile())return;let s=C.relative(this.rootDir,e),n=await this.getNode(e,s,r);n.imports=await this.resolveImports(e,n.imports),this.graph.nodes.set(n.path,n)}async getNode(e,r,s){let n=this.previousGraph?.nodes.get(r);if(n&&n.mtime===s.mtimeMs&&n.size===s.size)return{...n};let o=await this.tryParse(e,r);if(!o)return this.makeStubNode(e,r,s);sn(o.imports,o.tags);let i=this.resolveCallEdges(e,o.rawCallEdges),a=this.buildNode(e,r,s,o,i);return this.attachGitStats(a,r),a}async tryParse(e,r){let s=$e.readFileSync(e,"utf-8");try{return await Ys(e,s)}catch(n){return process.stderr.write(`
26
- Warning: failed to parse ${r}: ${n}
27
- `),null}}makeStubNode(e,r,s){return{path:r,type:M(e),category:"other",imports:[],exports:[],tags:[],mtime:s.mtimeMs,size:s.size}}resolveCallEdges(e,r){let s=[];for(let n of r??[])try{let o=this.resolver.resolve(e,n.toSpecifier);o&&!o.isExternal&&s.push({from:n.from,to:n.to,toFile:C.relative(this.rootDir,o.path)})}catch{}return s}buildNode(e,r,s,n,o){let{imports:i,exports:a,tags:c,category:p,description:u,complexity:m,cognitiveComplexity:h,functions:x}=n;return{path:r,type:M(e),category:p,imports:i,exports:a,tags:c,mtime:s.mtimeMs,size:s.size,...u!==void 0?{description:u}:{},...o.length>0?{callEdges:o}:{},...m!==void 0?{complexity:m}:{},...h!==void 0?{cognitiveComplexity:h}:{},...x!==void 0?{functions:x}:{}}}attachGitStats(e,r){if(this.enableGitStats)try{let s=gs(this.rootDir,r);e.commitCount90d=s.commitCount90d,s.lastAuthor!==void 0&&(e.lastAuthor=s.lastAuthor)}catch{}}async resolveImports(e,r){let s=[];for(let n of r){let o=this.resolver.resolveAll(e,n.rawSpecifier);if(o.length!==0)for(let i of o){let a={...n,toPath:i.isExternal?i.path:C.relative(this.rootDir,i.path),isExternal:i.isExternal};i.isWorkspace&&(a.isWorkspace=!0,a.workspacePackage=i.workspacePackage),i.isExternal?this.attachLockfileVersion(a):await this.processFile(i.path),s.push(a)}}return s}attachLockfileVersion(e){if(!this.lockFile)return;let r=e.rawSpecifier.startsWith("@")?e.rawSpecifier.split("/").slice(0,2).join("/"):e.rawSpecifier.split("/")[0],s=r?this.lockFile.dependencies[r]:void 0;s&&(e.version=s.version)}showProgress(){this.progressCallback&&this.visited.size%100===0&&this.progressCallback(this.visited.size)}}});var bn=l(()=>{"use strict";at();Sn();pt();lt();be();ve();ee();Bt();ut();mt();ht();bt();vt()});var Jt=l(()=>{"use strict";bn()});function vn(t,e){return{identifier:e?.identifier??new Ge,featureMap:e?.featureDetection===!1?new Map:A(t.nodes,e?.featureDetection??void 0)}}function Cn(t,e,r,s,n){for(let o of e){let i=t.nodes.get(o);if(!i)continue;let a=new re(o,["*",...i.exports.map(c=>c.name)]);t.traverse(o,(c,p,u)=>{if(!u)return!0;if(!a.updateAffectedSymbols(c,u))return!1;if(p>0){let m=r.get(c.path);if(m)return s(m),!1}return n(c),!0},{direction:"incoming"})}}function Kt(t,e,r){let{identifier:s,featureMap:n}=vn(t,r),o=new Set;for(let i of e){let a=n.get(i);a&&o.add(a.tag)}return Cn(t,e,n,i=>o.add(i.tag),i=>{if(s.isTestNode(i))for(let a of i.tags)o.add(a.name)}),Array.from(o)}function Ht(t,e,r){let{identifier:s,featureMap:n}=vn(t,r),o=new Set;return Cn(t,e,n,()=>{},i=>{s.isTestNode(i)&&o.add(i.path)}),Array.from(o)}var En=l(()=>{"use strict";Jt();Nt()});var kn=l(()=>{"use strict";us();Nt();En()});import Gc from"fs";import Be from"path";async function w(t,e,r=null,s={}){let n=s.silent?void 0:i=>{process.stderr.write(`Processed ${i} files...\r`)};return await new Ue(Be.resolve(t),r,void 0,n,s.gitStats??!1,s.coverageMap??new Map).build(e)}function T(t,e={}){let r=[],s=new Set([...e.ignoreDirs??tt,...e.additionalIgnoreDirs??[]]),n=new Set([...e.extensions??rt,...e.additionalExtensions??[]]);function o(i){try{let a=Gc.readdirSync(i,{withFileTypes:!0});for(let c of a){let p=Be.join(i,c.name);c.isDirectory()?s.has(c.name)||o(p):c.isFile()&&n.has(Be.extname(c.name).toLowerCase())&&r.push(Be.relative(t,p))}}catch{}}return o(t),r}var v=l(()=>{"use strict";et();st();fr();mr();at();pt();lt();be();ve();ee();ut();mt();ht();bt();Fe();vt();G();ne();Br();kn();st();Jt()});var Fn,wn,Tn=l(()=>{"use strict";Fn="mokosh-cache",wn="graph.json"});import ue from"path";import{parseArgs as Oc}from"util";function jc(t){for(let e=0;e<t.length;e++)if(t[e]==="--root"&&t[e+1])return ue.resolve(t[e+1]);return process.cwd()}function Wc(t){let e=[];for(let r=0;r<t.length;r++){let s=t[r];if(!s.startsWith("--"))e.push(s);else if(_c.has(s)){let n=t[r+1];n!==void 0&&!n.startsWith("--")&&(e.push(s,n),r++)}else s.slice(2)in qt&&e.push(s)}return e}function Pn(t){let e=jc(t),r=ue.join(ue.resolve(e,Fn),wn),{values:s,positionals:n}=Oc({args:Wc(t),allowPositionals:!0,options:qt}),o=s["feature-threshold"],i=s["min-out-degree"],a=s.paths,c=s.cache,p=s.config;return{rootDir:e,cachePath:c?ue.resolve(e,c):r,configPath:p?ue.resolve(e,p):void 0,query:s.query,file:s.file,typeFilter:s.type,functionName:s.function,filterPaths:a?a.split(",").map(u=>u.trim()):void 0,featureThreshold:o?parseInt(o,10):void 0,minOutDegree:i?parseInt(i,10):void 0,mermaid:s.mermaid??!1,proposeTags:s["propose-tags"]??!1,plain:s.plain??!1,affectedTests:s["affected-tests"]??!1,detectFeatures:s["detect-features"]??!1,findUnused:s["find-unused"]??!1,excludeTests:s["exclude-tests"]??!1,checkCycles:s["check-cycles"]??!1,findUncovered:s["find-uncovered"]??!1,callers:s.callers??!1,silent:s.silent??!1,queryHelp:s["query-help"]??!1,help:t.length===0||(s.help??!1),typeGraph:s["type-graph"]??!1,moduleResponsibility:s["module-responsibility"]??!1,featureGraph:s["feature-graph"]??!1,callGraph:s["call-graph"]??!1,apiSurface:s["api-surface"]??!1,applyTags:s["apply-tags"]??!1,dryRun:s["dry-run"]??!1,entryPoints:n}}var qt,_c,In=l(()=>{"use strict";Tn();qt={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"},"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"},"api-surface":{type:"boolean"},"apply-tags":{type:"boolean"},"dry-run":{type:"boolean"}},_c=new Set(Object.entries(qt).filter(([,t])=>t.type==="string").map(([t])=>`--${t}`))});import Vt from"path";function L(t){return t.filter(e=>{let r=Vt.basename(e).toLowerCase();return zc.some(s=>r.includes(s))})}function Je(t){return new Oe().getChangedFiles().map(e=>Vt.relative(t,Vt.resolve(t,e)))}var zc,Ke=l(()=>{"use strict";Mt();zc=[".test.",".spec.","-test.","-spec."]});async function Nn(t){let{graph:e}=t,{rootDir:r,scanOptions:s,featureThreshold:n}=t,o=Je(r);if(![...e.nodes.values()].some(c=>L([c.path]).length>0)){let c=T(r,s);e=await w(r,L(c),e)}let a=Ht(e,o,{...n!==void 0&&{featureDetection:{minOutDegree:n}}});console.log(a.join(`
28
- `))}var Mn=l(()=>{"use strict";v();Ke()});async function Dn(t){let{graph:e,rootDir:r,entryPoints:s}=t,n=s.length?s:ot(e,r);n.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=it(e,n);console.log(JSON.stringify(o,null,2))}var Rn=l(()=>{"use strict";v()});async function An(t){let{graph:e}=t,{rootDir:r,scanOptions:s,dryRun:n,plain:o}=t;if(o||console.log(n?"Dry run: computing tag changes...":"Applying tags to test files..."),e.nodes.size===0){let a=T(r,s);e=await w(r,L(a),e)}let i=await It(e,r,{dryRun:n});console.log(JSON.stringify(i,null,2))}var Ln=l(()=>{"use strict";v();Ke()});async function Gn(t){let{graph:e,functionName:r}=t;r||(console.error("Error: --call-graph requires --function <name>"),process.exit(1));let s=ct(e,r);console.log(JSON.stringify(s,null,2))}var On=l(()=>{"use strict";v()});async function jn(t){let{graph:e,file:r,plain:s}=t;r||(console.error("Error: --callers requires --file <path>"),process.exit(1));let n=e.getCallers(r);console.log(s?n.join(`
29
- `):JSON.stringify({file:r,callers:n,count:n.length},null,2))}var _n=l(()=>{"use strict"});async function Wn(t){let{graph:e}=t,r=e.findCycles();if(r.length>0){process.stderr.write(`Found ${r.length} cycle(s):
30
- `);for(let s of r)process.stderr.write(` ${s.join(" \u2192 ")}
31
- `);process.exit(1)}console.log("No cycles detected.")}var zn=l(()=>{"use strict"});async function $n(t){let{graph:e}=t,{rootDir:r,scanOptions:s,featureThreshold:n}=t;if(e.nodes.size===0){let a=T(r,s);e=await w(r,a,e)}let o=A(e.nodes,n!==void 0?{minOutDegree:n}:void 0),i=Array.from(o.values()).sort((a,c)=>c.outDegree-a.outDegree);console.log(JSON.stringify({features:i},null,2))}var Un=l(()=>{"use strict";v()});async function Bn(t){let{graph:e}=t,{rootDir:r,scanOptions:s,minOutDegree:n}=t;if(e.nodes.size===0){let a=T(r,s);e=await w(r,a,e)}let o=Z(e,n!==void 0?{minOutDegree:n}:void 0),i=Object.fromEntries(o.features);console.log(JSON.stringify({features:i,unassigned:o.unassigned},null,2))}var Jn=l(()=>{"use strict";v()});async function Kn(t){let{graph:e,featureThreshold:r,rawConfig:s,plain:n}=t,o=r??s.coverageThreshold??80,i=[...e.nodes.values()].filter(a=>a.category!=="test"&&a.category!=="config").filter(a=>(a.coveragePct??0)<o).map(a=>({file:a.path,coveragePct:a.coveragePct??null}));console.log(n?i.map(a=>a.file).join(`
32
- `):JSON.stringify({threshold:o,uncovered:i,count:i.length},null,2))}var Hn=l(()=>{"use strict"});import $c from"path";function Bc(t){let e=$c.basename(t).toLowerCase();return Uc.some(r=>e.includes(r))}async function qn(t){let{graph:e,rootDir:r,scanOptions:s,excludeTests:n}=t,o=T(r,s),i=e.findUnusedFiles(o);n&&(i=i.filter(a=>!Bc(a))),console.log(JSON.stringify({unusedFiles:i},null,2))}var Uc,Vn=l(()=>{"use strict";v();Uc=[".test.",".spec.","-test.","-spec.",".stories."]});async function Qn(t){let{graph:e,queryStr:r,mermaidOutput:s}=t,n=e.serialize();if(r){let o=Te(r);n=we(n,o)}if(s){let o=F.deserialize(n);console.log(xe.serialize(o))}else{let o=e.findCycles();o.length>0&&(n.cycles=o),console.log(JSON.stringify(n,null,2))}}var Xn=l(()=>{"use strict";v()});async function Zn(t){let{graph:e,filterPaths:r,minOutDegree:s}=t,n=ft(e,s!==void 0?{minOutDegree:s}:void 0);if(r?.length){let o=r.map(i=>n.get(i)).filter(Boolean);console.log(JSON.stringify({count:o.length,modules:o},null,2))}else{let o=Array.from(n.values());console.log(JSON.stringify({count:o.length,modules:o},null,2))}}var Yn=l(()=>{"use strict";v()});async function eo(t){let{graph:e}=t,{rootDir:r,scanOptions:s,featureThreshold:n,plain:o}=t;o||console.log("Proposing test tags based on git diff...");let i=Je(r);if(e.nodes.size===0){let c=T(r,s);e=await w(r,L(c),e)}let a=Kt(e,i,{...n!==void 0&&{featureDetection:{minOutDegree:n}}});console.log(o?a.join(" "):JSON.stringify({proposedTags:a},null,2))}var to=l(()=>{"use strict";v();Ke()});async function ro(t){let{graph:e,typeFilter:r}=t,s=gt(e);if(r){let n=dt(s,r);console.log(JSON.stringify(n,null,2))}else{let n=Array.from(s.types.values());console.log(JSON.stringify({count:n.length,types:n},null,2))}}var so=l(()=>{"use strict";v()});import Qt from"path";function no(t){let{rootDir:e,entryPoints:r,cachePath:s,configPath:n}=t,o=n?O(n,{isExplicitPath:!0}):O(e),i=Qt.join(Qt.resolve(e,"mokosh-cache"),"graph.json"),a=r.length>0?r:o.entryPoints??[],c=s!==i?s??i:o.cachePath?Qt.resolve(e,o.cachePath):s??i,p={...o.ignoreDirs!==void 0&&{additionalIgnoreDirs:o.ignoreDirs},...o.extensions!==void 0&&{additionalExtensions:o.extensions}};return{rootDir:e,resolvedEntryPoints:a,resolvedCachePath:c,scanOptions:p,rawConfig:o}}var oo=l(()=>{"use strict";v()});import me from"fs";import Jc from"path";function io(t){if(!me.existsSync(t))return null;let e=me.readFileSync(t,"utf-8");return F.deserialize(JSON.parse(e))}function ao(t,e){let r=Jc.dirname(e);me.existsSync(r)||me.mkdirSync(r,{recursive:!0}),me.writeFileSync(e,JSON.stringify(t.serialize(),null,2))}async function co(t,e,r,s=!1,n=!1){return w(t,e,r,{silent:s,gitStats:n})}var po=l(()=>{"use strict";v()});var lo,fo,uo=l(()=>{"use strict";lo=`
25
+ `),oo(this.graph.nodes),ro(this.graph.nodes),no(this.graph.nodes),so(this.graph.nodes),this.coverageMap.size>0&&eo(this.graph.nodes,this.coverageMap),new F(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:{},t=e.minFiles??dl;if(!(t>0&&!this.hasAtLeastFiles(this.rootDir,t)))try{let s=E.join(f,"parse-worker.js");this.pool=new ml({filename:s,...e.maxThreads!==void 0?{maxThreads:e.maxThreads}:{}})}catch(s){process.stderr.write(`
26
+ Warning: failed to start parse worker pool, falling back to synchronous parsing: ${s}
27
+ `),this.pool=null}}hasAtLeastFiles(e,t){let s=0,n=[e];for(;n.length>0;){let o=n.pop(),i;try{i=xe.readdirSync(o,{withFileTypes:!0})}catch{continue}for(let a of i)if(a.isDirectory())So.has(a.name)||n.push(E.join(o,a.name));else if(a.isFile()&&(s++,s>=t))return!0}return s>=t}async processTestFiles(e){let t=se(),s=o=>t.some(i=>o.name.includes(i));this.walkProject(e,s);let n=e;for(;n!==this.rootDir;){let o=E.dirname(n);if(o===n)break;for(let i of gl){let a=E.join(o,i);try{xe.statSync(a).isDirectory()&&this.walkProject(a,s)}catch{}}n=o}await this.drain()}async processDocFiles(){this.walkProject(this.rootDir,e=>e.name.endsWith(".md")||e.name.endsWith(".mdx")),await this.drain()}walkProject(e,t){let s;try{s=xe.readdirSync(e,{withFileTypes:!0})}catch{return}for(let n of s){let o=E.join(e,n.name);n.isDirectory()?So.has(n.name)||this.walkProject(o,t):n.isFile()&&t(n)&&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(t=>this.finishFile(t)))}}async finishFile(e){let t=xe.statSync(e,{throwIfNoEntry:!1});if(!t?.isFile())return;let s=E.relative(this.rootDir,e),n=await this.getNode(e,s,t);n.imports=await this.resolveImports(e,n.imports),to(n.imports,n.tags),this.graph.nodes.set(n.path,n)}async getNode(e,t,s){let n=this.previousGraph?.nodes.get(t);if(n&&n.mtime===s.mtimeMs&&n.size===s.size)return{...n};let o=await this.tryParse(e,t);if(!o)return this.makeStubNode(e,t,s);let i=this.resolveCallEdges(e,o.rawCallEdges),a=this.buildNode(e,t,s,o,i);return this.attachGitStats(a,t),a}async tryParse(e,t){let s=xe.readFileSync(e,"utf-8");try{return await this.parseContent(e,s)}catch(n){return process.stderr.write(`
28
+ Warning: failed to parse ${t}: ${n}
29
+ `),null}}parseContent(e,t){return this.pool?this.pool.run({filePath:e,content:t}):Qn(e,t)}makeStubNode(e,t,s){return{path:t,type:L(e),category:"other",imports:[],exports:[],tags:[],mtime:s.mtimeMs,size:s.size}}resolveCallEdges(e,t){let s=[];for(let n of t??[])try{let o=this.resolver.resolve(e,n.toSpecifier);o&&!o.isExternal&&s.push({from:n.from,to:n.to,toFile:E.relative(this.rootDir,o.path)})}catch{}return s}buildNode(e,t,s,n,o){let{imports:i,exports:a,tags:p,category:l,description:d,complexity:h,cognitiveComplexity:x,functions:v}=n;return{path:t,type:L(e),category:l,imports:i,exports:a,tags:p,mtime:s.mtimeMs,size:s.size,...d!==void 0?{description:d}:{},...o.length>0?{callEdges:o}:{},...h!==void 0?{complexity:h}:{},...x!==void 0?{cognitiveComplexity:x}:{},...v!==void 0?{functions:v}:{}}}attachGitStats(e,t){if(this.enableGitStats)try{let s=an(this.rootDir,t);e.commitCount90d=s.commitCount90d,s.lastAuthor!==void 0&&(e.lastAuthor=s.lastAuthor),s.lastCommitAt!==void 0&&(e.lastCommitAt=s.lastCommitAt)}catch{}}async resolveImports(e,t){let s=[];for(let n of t){let o=this.resolver.resolveAll(e,n.rawSpecifier);if(o.length!==0)for(let i of o){let a={...n,toPath:i.isExternal?i.path:E.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),s.push(a)}}return s}attachLockfileVersion(e){if(!this.lockFile)return;let t=e.rawSpecifier.startsWith("@")?e.rawSpecifier.split("/").slice(0,2).join("/"):e.rawSpecifier.split("/")[0],s=t?this.lockFile.dependencies[t]:void 0;s&&(e.version=s.version)}showProgress(){this.progressCallback&&this.visited.size%100===0&&this.progressCallback(this.visited.size)}}});var vo=u(()=>{"use strict";c();xt();bo();bt();kt();Ne();Ie();ie();fr();Rt();Me();Lt();zt();$t()});var ur=u(()=>{"use strict";c();vo()});function Co(r,e){return{identifier:e?.identifier??new qe,featureMap:e?.featureDetection===!1?new Map:_(r.nodes,e?.featureDetection??void 0)}}function ko(r,e,t,s,n){for(let o of e){let i=r.nodes.get(o);if(!i)continue;let a=new W(o,["*",...i.exports.map(p=>p.name)]);r.traverse(o,(p,l,d)=>{if(!d)return!0;if(!a.updateAffectedSymbols(p,d))return!1;if(l>0){let h=t.get(p.path);if(h)return s(h),!1}return n(p),!0},{direction:"incoming"})}}function mr(r,e,t){let{identifier:s,featureMap:n}=Co(r,t),o=new Set;for(let i of e){let a=n.get(i);a&&o.add(a.tag)}return ko(r,e,n,i=>o.add(i.tag),i=>{if(s.isTestNode(i))for(let a of i.tags)o.add(a.name)}),Array.from(o)}function gr(r,e,t){let{identifier:s,featureMap:n}=Co(r,t),o=new Set;return ko(r,e,n,()=>{},i=>{s.isTestNode(i)&&o.add(i.path)}),Array.from(o)}var wo=u(()=>{"use strict";c();ur();Xt()});var Eo=u(()=>{"use strict";c();on();Xt();wo()});import yl from"fs";import be from"path";async function I(r,e,t=null,s={}){let n=s.silent?void 0:i=>{process.stderr.write(`Processed ${i} files...\r`)};return await new Se(be.resolve(r),t,void 0,n,s.gitStats??!1,s.coverageMap??new Map,s.parallelParsing??!0).build(e)}async function Fo(r,e={}){let t=be.resolve(r),s=Wt(t),n=e.packages?s.packages.filter(a=>e.packages?.includes(a.name)||e.packages?.includes(a.relativeRoot)):s.packages,o=new Map(s.packages.map(a=>[a.name,a.root])),i=new pe(t,s.type);for(let a of n){let p=e.silent?void 0:h=>{process.stderr.write(`[${a.name}] Processed ${h} files...\r`)},d=await new Se(t,null,new re(t,{workspaceMap:o,tsconfigSearchPaths:[a.root,t]}),p,e.gitStats??!1,new Map,e.parallelParsing??!0).build(a.entryPoints);i.addPackage(a,d)}return i}function M(r,e={}){let t=[],s=new Set([...e.ignoreDirs??ut,...e.additionalIgnoreDirs??[]]),n=new Set([...e.extensions??mt,...e.additionalExtensions??[]]);function o(i){try{let a=yl.readdirSync(i,{withFileTypes:!0});for(let p of a){let l=be.join(i,p.name);p.isDirectory()?s.has(p.name)||o(l):p.isFile()&&n.has(be.extname(p.name).toLowerCase())&&t.push(be.relative(r,l))}}catch{}}return o(r),t}var b=u(()=>{"use strict";c();ft();gt();es();rs();xt();bt();kt();Ne();Ie();ie();as();Rt();Me();Lt();zt();Oe();$t();$();le();Gs();Eo();gt();ur()});var Po,To,No=u(()=>{"use strict";c();Po="mokosh-cache",To="graph.json"});import ve from"path";import{parseArgs as xl}from"util";function Sl(r){for(let e=0;e<r.length;e++)if(r[e]==="--root"&&r[e+1])return ve.resolve(r[e+1]);return process.cwd()}function vl(r){let e=[];for(let t=0;t<r.length;t++){let s=r[t];if(!s.startsWith("--"))e.push(s);else if(bl.has(s)){let n=r[t+1];n!==void 0&&!n.startsWith("--")&&(e.push(s,n),t++)}else s.slice(2)in dr&&e.push(s)}return e}function Io(r){let e=Sl(r),t=ve.join(ve.resolve(e,Po),To),{values:s,positionals:n}=xl({args:vl(r),allowPositionals:!0,options:dr}),o=s["feature-threshold"],i=s["min-out-degree"],a=s.paths,p=s.cache,l=s.config,d=s["changed-symbols"],h=s.depth,x=s["complexity-threshold"],v=s.limit,N=s.metric;return{rootDir:e,cachePath:p?ve.resolve(e,p):t,configPath:l?ve.resolve(e,l):void 0,query:s.query,file:s.file,typeFilter:s.type,functionName:s.function,filterPaths:a?a.split(",").map(R=>R.trim()):void 0,featureThreshold:o?parseInt(o,10):void 0,minOutDegree:i?parseInt(i,10):void 0,mermaid:s.mermaid??!1,proposeTags:s["propose-tags"]??!1,plain:s.plain??!1,affectedTests:s["affected-tests"]??!1,detectFeatures:s["detect-features"]??!1,findUnused:s["find-unused"]??!1,excludeTests:s["exclude-tests"]??!1,checkCycles:s["check-cycles"]??!1,checkDocDrift:s["check-doc-drift"]??!1,findUncovered:s["find-uncovered"]??!1,callers:s.callers??!1,silent:s.silent??!1,queryHelp:s["query-help"]??!1,help:r.length===0||(s.help??!1),typeGraph:s["type-graph"]??!1,moduleResponsibility:s["module-responsibility"]??!1,featureGraph:s["feature-graph"]??!1,callGraph:s["call-graph"]??!1,apiSurface:s["api-surface"]??!1,applyTags:s["apply-tags"]??!1,dryRun:s["dry-run"]??!1,initSkill:s["init-skill"]??!1,initConfig:s["init-config"]??!1,force:s.force??!1,dependencies:s.dependencies??!1,dependents:s.dependents??!1,affected:s.affected??!1,testsOnly:s["tests-only"]??!1,changedSymbols:d?d.split(",").map(R=>R.trim()):void 0,cached:s.cached??!1,depth:h?parseInt(h,10):void 0,withEdgeDetail:s["with-edge-detail"]??!1,findComplexFunctions:s["find-complex-functions"]??!1,metric:N==="complexity"||N==="cognitiveComplexity"?N:void 0,complexityThreshold:x?parseInt(x,10):void 0,limit:v?parseInt(v,10):void 0,workspacePackages:s["workspace-packages"]??!1,workspaceAffected:s["workspace-affected"]??!1,clearCache:s["clear-cache"]??!1,slim:s.slim??!1,watch:s.watch??!1,entryPoints:n}}var dr,bl,Mo=u(()=>{"use strict";c();No();dr={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"},"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-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"}},bl=new Set(Object.entries(dr).filter(([,r])=>r.type==="string").map(([r])=>`--${r}`))});async function hr(r){let{graph:e,file:t,testsOnly:s,changedSymbols:n,cached:o}=r;if(t||(console.error("Error: --affected requires --file <path>"),process.exit(1)),o){let a=vt(e),p=Ct(a,t),l=s?p.filter(d=>e.nodes.get(d)?.category==="test"):p;console.log(JSON.stringify({file:t,affected:l,count:l.length},null,2));return}let i=Ft(e,t,{testsOnly:s,changedSymbols:n});console.log(JSON.stringify({file:t,affected:i,count:i.length},null,2))}var Do=u(()=>{"use strict";c();b()});import yr from"path";function z(r){return r.filter(e=>{let t=yr.basename(e).toLowerCase();return Cl.some(s=>t.includes(s))})}function Ze(r){return new Ke().getChangedFiles().map(e=>yr.relative(r,yr.resolve(r,e)))}var Cl,Ye=u(()=>{"use strict";c();Yt();Cl=[".test.",".spec.","-test.","-spec."]});async function Ro(r){let{graph:e}=r,{rootDir:t,scanOptions:s,featureThreshold:n}=r,o=Ze(t);if(![...e.nodes.values()].some(p=>z([p.path]).length>0)){let p=M(t,s);e=await I(t,z(p),e)}let a=gr(e,o,{...n!==void 0&&{featureDetection:{minOutDegree:n}}});console.log(a.join(`
30
+ `))}var Ao=u(()=>{"use strict";c();b();Ye()});async function Oo(r){let{graph:e,rootDir:t,entryPoints:s}=r,n=s.length?s:ht(e,t);n.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=yt(e,n);console.log(JSON.stringify(o,null,2))}var Lo=u(()=>{"use strict";c();b()});async function Go(r){let{graph:e}=r,{rootDir:t,scanOptions:s,dryRun:n,plain:o}=r;if(o||console.log(n?"Dry run: computing tag changes...":"Applying tags to test files..."),e.nodes.size===0){let a=M(t,s);e=await I(t,z(a),e)}let i=await Qt(e,t,{dryRun:n});console.log(JSON.stringify(i,null,2))}var jo=u(()=>{"use strict";c();b();Ye()});async function _o(r){let{graph:e,functionName:t}=r;t||(console.error("Error: --call-graph requires --function <name>"),process.exit(1));let s=St(e,t);console.log(JSON.stringify(s,null,2))}var Wo=u(()=>{"use strict";c();b()});async function xr(r){let{graph:e,file:t,plain:s,depth:n,withEdgeDetail:o}=r;t||(console.error("Error: --callers requires --file <path>"),process.exit(1));let i=Pt(e,t,{depth:n??1,withEdgeDetail:o});console.log(s?i.map(a=>a.file).join(`
31
+ `):JSON.stringify({file:t,callers:i,count:i.length},null,2))}var zo=u(()=>{"use strict";c();b()});async function Sr(r){let{graph:e}=r,t=e.findCycles();if(t.length>0){process.stderr.write(`Found ${t.length} cycle(s):
32
+ `);for(let s of t)process.stderr.write(` ${s.join(" \u2192 ")}
33
+ `);process.exit(1)}console.log("No cycles detected.")}var $o=u(()=>{"use strict";c()});async function br(r){let{graph:e}=r,t=[...e.nodes.values()].filter(s=>s.type==="markdown"&&s.staleFor&&s.staleFor.length>0).map(s=>({doc:s.path,staleFor:s.staleFor}));if(t.length>0){process.stderr.write(`Found ${t.length} doc(s) that may be out of date:
34
+ `);for(let{doc:s,staleFor:n}of t)process.stderr.write(` ${s} \u2014 references changed more recently: ${n.join(", ")}
35
+ `);process.exit(1)}console.log("No doc drift detected.")}var Uo=u(()=>{"use strict";c()});import Bo from"fs";function Jo(r){Bo.existsSync(r)?(Bo.unlinkSync(r),console.log(`Cache cleared: ${r}`)):console.log(`No cache file present at ${r}`)}var qo=u(()=>{"use strict";c()});async function vr(r){let{graph:e,file:t,depth:s}=r;t||(console.error("Error: --dependencies requires --file <path>"),process.exit(1));let n=wt(e,t,s??1);console.log(JSON.stringify({file:t,dependencies:n},null,2))}var Ko=u(()=>{"use strict";c();b()});async function Cr(r){let{graph:e,file:t}=r;t||(console.error("Error: --dependents requires --file <path>"),process.exit(1));let s=Et(e,t);console.log(JSON.stringify({file:t,dependents:s},null,2))}var Ho=u(()=>{"use strict";c();b()});async function Vo(r){let{graph:e}=r,{rootDir:t,scanOptions:s,featureThreshold:n}=r;if(e.nodes.size===0){let a=M(t,s);e=await I(t,a,e)}let o=_(e.nodes,n!==void 0?{minOutDegree:n}:void 0),i=Array.from(o.values()).sort((a,p)=>p.outDegree-a.outDegree);console.log(JSON.stringify({features:i},null,2))}var Qo=u(()=>{"use strict";c();b()});async function Xo(r){let{graph:e}=r,{rootDir:t,scanOptions:s,minOutDegree:n}=r;if(e.nodes.size===0){let a=M(t,s);e=await I(t,a,e)}let o=ne(e,n!==void 0?{minOutDegree:n}:void 0),i=Object.fromEntries(o.features);console.log(JSON.stringify({features:i,unassigned:o.unassigned},null,2))}var Zo=u(()=>{"use strict";c();b()});async function kr(r){let{graph:e,metric:t,complexityThreshold:s,limit:n}=r,o=s??10,i=Tt(e,{metric:t,threshold:o,limit:n});console.log(JSON.stringify({metric:t??"cognitiveComplexity",threshold:o,functions:i,count:i.length},null,2))}var Yo=u(()=>{"use strict";c();b()});async function wr(r){let{graph:e,featureThreshold:t,rawConfig:s,plain:n}=r,o=t??s.coverageThreshold??80;if(!Mt(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(n?i.map(a=>a.file).join(`
36
+ `):JSON.stringify({threshold:o,uncovered:i,count:i.length},null,2))}var ei=u(()=>{"use strict";c();b()});import kl from"path";function El(r){let e=kl.basename(r).toLowerCase();return wl.some(t=>e.includes(t))}async function ti(r){let{graph:e,rootDir:t,scanOptions:s,excludeTests:n}=r,o=M(t,s),i=e.findUnusedFiles(o);n&&(i=i.filter(a=>!El(a))),console.log(JSON.stringify({unusedFiles:i},null,2))}var wl,ri=u(()=>{"use strict";c();b();wl=[".test.",".spec.","-test.","-spec.",".stories."]});async function Er(r){let{graph:e,queryStr:t,mermaidOutput:s,slim:n}=r,o=e.serialize();if(t){let a=Ge(t);o=Le(o,a)}if(s){let a=F.deserialize(o);console.log(Pe.serialize(a));return}let i=e.findCycles();i.length>0&&(o.cycles=i),console.log(JSON.stringify(n?Nt(o):o,null,2))}var si=u(()=>{"use strict";c();b()});import Fl from"fs";import Fr from"path";function et(r,e,t){let s=r;for(let n=0;n<6;n++){let o=Fr.join(s,"templates",...e);if(Fl.existsSync(Fr.join(o,t)))return o;let i=Fr.dirname(s);if(i===s)break;s=i}throw new Error(`Could not locate mokosh templates/${e.join("/")}`)}var Pr=u(()=>{"use strict";c()});import ni from"fs";import oi from"path";function ii(r,e=process.cwd()){let t=et(f,["config"],"mokosh.config.js"),s=oi.join(t,"mokosh.config.js"),n=oi.join(e,"mokosh.config.js");if(ni.existsSync(n)&&!r){console.log("skipped mokosh.config.js (already exists, use --force to overwrite)");return}ni.copyFileSync(s,n),console.log("wrote mokosh.config.js")}var ai=u(()=>{"use strict";c();Pr()});import Tr from"fs";import tt from"path";function ci(r,e=process.cwd()){let t=et(f,["skill"],"SKILL.md");for(let s of Pl){let n=tt.join(t,s.templateFile),o=tt.join(e,...s.destPath),i=tt.join(...s.destPath);if(Tr.existsSync(o)&&!r){console.log(`skipped ${i} (already exists, use --force to overwrite)`);continue}Tr.mkdirSync(tt.dirname(o),{recursive:!0}),Tr.copyFileSync(n,o),console.log(`wrote ${i}`)}}var Pl,pi=u(()=>{"use strict";c();Pr();Pl=[{templateFile:"SKILL.md",destPath:[".claude","skills","mokosh","SKILL.md"]},{templateFile:"mokosh.md",destPath:[".claude","commands","mokosh.md"]}]});async function li(r){let{graph:e,filterPaths:t,minOutDegree:s}=r,n=Dt(e,s!==void 0?{minOutDegree:s}:void 0);if(t?.length){let o=t.map(i=>n.get(i)).filter(Boolean);console.log(JSON.stringify({count:o.length,modules:o},null,2))}else{let o=Array.from(n.values());console.log(JSON.stringify({count:o.length,modules:o},null,2))}}var fi=u(()=>{"use strict";c();b()});async function ui(r){let{graph:e}=r,{rootDir:t,scanOptions:s,featureThreshold:n,plain:o}=r;o||console.log("Proposing test tags based on git diff...");let i=Ze(t);if(e.nodes.size===0){let p=M(t,s);e=await I(t,z(p),e)}let a=mr(e,i,{...n!==void 0&&{featureDetection:{minOutDegree:n}}});console.log(o?a.join(" "):JSON.stringify({proposedTags:a},null,2))}var mi=u(()=>{"use strict";c();b();Ye()});async function gi(r){let{graph:e,typeFilter:t}=r,s=At(e);if(t){let n=Ot(s,t);console.log(JSON.stringify(n,null,2))}else{let n=Array.from(s.types.values());console.log(JSON.stringify({count:n.length,types:n},null,2))}}var di=u(()=>{"use strict";c();b()});function hi(r,e){let t=r.getAffectedAcrossPackages(e);console.log(JSON.stringify({file:e,affected:t,count:t.length},null,2))}var yi=u(()=>{"use strict";c()});function xi(r){console.log(JSON.stringify(It(r),null,2))}var Si=u(()=>{"use strict";c();b()});import Nr from"path";function bi(r){let{rootDir:e,entryPoints:t,cachePath:s,configPath:n}=r,o=n?U(n,{isExplicitPath:!0}):U(e),i=Nr.join(Nr.resolve(e,"mokosh-cache"),"graph.json"),a=t.length>0?t:o.entryPoints??[],p=s!==i?s??i:o.cachePath?Nr.resolve(e,o.cachePath):s??i,l={...o.ignoreDirs!==void 0&&{additionalIgnoreDirs:o.ignoreDirs},...o.extensions!==void 0&&{additionalExtensions:o.extensions}};return{rootDir:e,resolvedEntryPoints:a,resolvedCachePath:p,scanOptions:l,rawConfig:o}}var vi=u(()=>{"use strict";c();b()});import Ce from"fs";import Tl from"path";function Ci(r){if(!Ce.existsSync(r))return null;let e=Ce.readFileSync(r,"utf-8");return F.deserialize(JSON.parse(e))}function Ir(r,e){let t=Tl.dirname(e);Ce.existsSync(t)||Ce.mkdirSync(t,{recursive:!0}),Ce.writeFileSync(e,JSON.stringify(r.serialize(),null,2))}async function Mr(r,e,t,s=!1,n=!1,o){return I(r,e,t,{silent:s,gitStats:n,parallelParsing:o})}var ki=u(()=>{"use strict";c();b()});var wi,Ei,Fi=u(()=>{"use strict";c();wi=`
33
37
  Usage: mokosh [options] <entry-point1> <entry-point2> ...
34
38
 
35
39
  Options:
@@ -45,7 +49,13 @@ Options:
45
49
  --feature-threshold <N> Min internal imports to be a feature hub (default: 5)
46
50
  --find-unused Find files that are not reachable from entry points
47
51
  --exclude-tests Exclude test files from --find-unused output
52
+ --find-uncovered List non-test files whose coverage is below the threshold (requires coverageReportPath in config)
53
+ --callers List files whose exported functions call into --file
54
+ --file <path> Target file for --callers/--dependencies/--dependents/--affected/--workspace-affected
48
55
  --check-cycles Check for circular dependencies; exits non-zero if found (CI gate)
56
+ --check-doc-drift Flag markdown docs whose referenced files changed more recently
57
+ than the doc itself; exits non-zero if found (CI gate; requires
58
+ gitStats: true, see docs/adr-009-markdown-parsing.md)
49
59
  --type-graph Output type-level graph (interfaces, classes, enums, type aliases)
50
60
  --type <name> Filter --type-graph to a single type name
51
61
  --module-responsibility Output each file's semantic role, description, and exports
@@ -58,12 +68,45 @@ Options:
58
68
  --silent Suppress progress output on stderr
59
69
  --query <query> Filter output using a query (e.g., category:logic,tag:auth)
60
70
  --query-help Show all supported query filter keys and examples
71
+ --slim Compact node output for default/--query JSON: export names, meaningful
72
+ tags, and a flat importsFiles list instead of full edge metadata
73
+ (default: false \u2014 opt-in, unlike the MCP query tool which defaults slim to true)
61
74
  --root <dir> Project root directory (default: current directory)
75
+ --init-skill Scaffold the mokosh Claude Code skill/command into .claude/
76
+ --init-config Scaffold a starter mokosh.config.js in the project root
77
+ --force Overwrite existing files (use with --init-skill/--init-config)
78
+ --clear-cache Delete the cache file at --cache and exit
62
79
  --help Show help
63
80
 
81
+ MCP parity (mirrors the MCP server's tools for use when MCP is unavailable):
82
+ --dependencies List all files that --file imports (transitive; use with --depth)
83
+ --dependents List files that directly import --file (one hop)
84
+ --depth <N> Max traversal depth for --dependencies/--callers (default: 1)
85
+ --affected List all files transitively affected if --file changes
86
+ --tests-only Restrict --affected to test/spec files
87
+ --changed-symbols <a,b,...> Restrict --affected to files that import these specific symbols
88
+ --cached Use a precomputed impact cache for --affected instead of a fresh traversal
89
+ --with-edge-detail Include from/to function names per edge (use with --callers)
90
+ --find-complex-functions List functions/methods at or above a complexity threshold, worst-first
91
+ --metric <name> cognitiveComplexity (default) | complexity \u2014 used by --find-complex-functions
92
+ --complexity-threshold <N> Minimum score to include (default: 10, use with --find-complex-functions)
93
+ --limit <N> Max results for --find-complex-functions (default: 20)
94
+ --workspace-packages List monorepo packages and their cross-package dependencies
95
+ --workspace-affected Cross-package blast-radius for --file in a monorepo
96
+ --watch Re-run on file changes. Supported with the default output, --query,
97
+ --callers, --dependencies, --dependents, --affected, --find-uncovered,
98
+ --find-complex-functions, --check-cycles, and --check-doc-drift only.
99
+
64
100
  Notes:
65
101
  Add mokosh-cache/ to your .gitignore to avoid committing the cache directory.
66
- `,fo=`
102
+ --check-cycles is CLI-only (CI gate via exit code); it has no MCP equivalent by design.
103
+ --check-doc-drift has an MCP equivalent (check_doc_drift) since its result list, not just a
104
+ pass/fail exit code, is useful to an AI assistant deciding which docs to fix.
105
+ --config files may be .js/.cjs and are executed for CLI convenience (allowJs: true); the MCP
106
+ server only loads JSON config (allowJs: false) for security. This is intentional.
107
+ --workspace-packages/--workspace-affected require explicit opt-in (unlike MCP's analyze tool,
108
+ which auto-detects a monorepo when entryPoints is empty); other commands remain single-package.
109
+ `,Ei=`
67
110
  Query filter reference (--query "key:value,key:value,...")
68
111
  All keys are case-insensitive. Multiple keys are AND'd together.
69
112
 
@@ -73,8 +116,8 @@ FILTERING
73
116
  Examples: category:logic category:!test
74
117
 
75
118
  type:<value> Exact match on language. Negate with !.
76
- Values: typescript | javascript | css | scss | less | stylus |
77
- coffeescript | livescript | lua | gherkin
119
+ Values: typescript | javascript | python | go | css | scss | less |
120
+ stylus | coffeescript | livescript | lua | gherkin
78
121
  Example: type:typescript
79
122
 
80
123
  tag:<value> File has this tag (OR across multiple tag: entries).
@@ -117,6 +160,12 @@ SORTING & LIMITING (applied after all filters)
117
160
  limit:<N> Return at most N results.
118
161
  Example: limit:20
119
162
 
163
+ OUTPUT SHAPE
164
+ --slim Pass alongside --query (or the default output) for a compact response:
165
+ export names, meaningful tags, and a flat importsFiles path list \u2014 no
166
+ edge objects, no mtime/size. Off by default on the CLI; the MCP query
167
+ tool defaults this on.
168
+
120
169
  COMMON PATTERNS
121
170
  Token-efficient context (logic only):
122
171
  --query "category:logic"
@@ -135,5 +184,5 @@ COMMON PATTERNS
135
184
 
136
185
  Large TypeScript logic files:
137
186
  --query "type:typescript,category:logic,sort:size,limit:5"
138
- `});async function mo(){let t=process.argv.slice(2),e=Pn(t);e.help&&(console.log(lo),process.exit(0)),e.queryHelp&&(console.log(fo),process.exit(0));let r=no(e);Ye(r.rawConfig);let{rootDir:s,resolvedEntryPoints:n,resolvedCachePath:o,scanOptions:i}=r,{proposeTags:a,plain:c,affectedTests:p,detectFeatures:u,findUnused:m,findUncovered:h,excludeTests:x,checkCycles:I,callers:Q,file:ho,silent:yo,featureThreshold:xo,query:So,mermaid:bo,typeGraph:Xt,typeFilter:vo,moduleResponsibility:Zt,filterPaths:Co,minOutDegree:Eo,featureGraph:ko,callGraph:Yt,functionName:Fo,apiSurface:er,applyTags:tr,dryRun:wo}=e,rr=a||p||tr||Q||h||Xt||Zt||Yt||er,ge=io(o)??new F(new Map);(n.length>0||!rr)&&(n.length===0&&!rr&&!m&&!u&&!I&&(console.error("Error: No entry points provided"),process.exit(1)),ge=await co(s,n,ge,yo,r.rawConfig.gitStats??!1),ao(ge,o));let To={graph:ge,rootDir:s,entryPoints:n.map(He=>He.replace(s+"/","")),scanOptions:i,rawConfig:r.rawConfig,featureThreshold:xo,queryStr:So,mermaidOutput:bo,plain:c,excludeTests:x,file:ho,typeFilter:vo,filterPaths:Co,minOutDegree:Eo,functionName:Fo,dryRun:wo};await([[a,eo],[tr,An],[p,Nn],[u,$n],[m,qn],[I,Wn],[h,Kn],[Q,jn],[Xt,ro],[Zt,Zn],[ko,Bn],[Yt,Gn],[er,Dn]].find(([He])=>He)?.[1]??Qn)(To)}var go=l(()=>{"use strict";v();In();Mn();Rn();Ln();On();_n();zn();Un();Jn();Hn();Vn();Xn();Yn();to();so();oo();po();uo()});var Kc=Po(()=>{go();mo().catch(t=>{console.error(t),process.exit(1)})});export default Kc();
187
+ `});var Pi,Ti=u(()=>{"use strict";c();Pi=/(?:^|[/\\])(?:node_modules|\.git|dist|build|coverage)(?:[/\\]|$)/});import Nl from"fs";function Ni(r,e,t){let s=null,n=!1,o=!1,i=async()=>{if(n){o=!0;return}n=!0;try{await t()}finally{n=!1,o&&(o=!1,i())}};i();let a=null;try{a=Nl.watch(r,{recursive:!0},(p,l)=>{!l||Pi.test(l)||(s&&clearTimeout(s),s=setTimeout(()=>{i()},e))})}catch(p){console.error(`Warning: unable to watch ${r}: ${p.message}`)}process.on("SIGINT",()=>{s&&clearTimeout(s),a?.close(),process.exit(0)})}var Ii=u(()=>{"use strict";c();Ti()});async function Mi(){let r=process.argv.slice(2),e=Io(r);e.help&&(console.log(wi),process.exit(0)),e.queryHelp&&(console.log(Ei),process.exit(0)),e.initSkill&&(ci(e.force),process.exit(0)),e.initConfig&&(ii(e.force),process.exit(0)),e.clearCache&&(Jo(e.cachePath),process.exit(0));let t=bi(e);lt(t.rawConfig);let{rootDir:s,resolvedEntryPoints:n,resolvedCachePath:o,scanOptions:i}=t,{proposeTags:a,plain:p,affectedTests:l,detectFeatures:d,findUnused:h,findUncovered:x,excludeTests:v,checkCycles:N,checkDocDrift:R,callers:Dr,dependencies:Rr,dependents:Ar,affected:Or,file:rt,silent:Lr,featureThreshold:Ri,query:Ai,mermaid:Oi,typeGraph:Gr,typeFilter:Li,moduleResponsibility:jr,filterPaths:Gi,minOutDegree:ji,featureGraph:_i,callGraph:_r,functionName:Wi,apiSurface:Wr,applyTags:zr,dryRun:zi,depth:$i,cached:Ui,changedSymbols:Bi,withEdgeDetail:Ji,findComplexFunctions:$r,metric:qi,complexityThreshold:Ki,limit:Hi,workspacePackages:Ur,workspaceAffected:Vi,slim:Qi,testsOnly:Xi,watch:Br}=e;if(Ur||Vi){Br&&(console.error("Error: --watch is not supported with --workspace-packages/--workspace-affected"),process.exit(1));let A=await Fo(s,{gitStats:t.rawConfig.gitStats??!1,parallelParsing:t.rawConfig.parallelParsing});Ur?xi(A):(rt||(console.error("Error: --workspace-affected requires --file <path>"),process.exit(1)),hi(A,rt));return}let Jr=a||l||zr||Dr||Rr||Ar||Or||x||$r||Gr||jr||_r||Wr,ke=Ci(o)??new F(new Map);(n.length>0||!Jr)&&(n.length===0&&!Jr&&!h&&!d&&!N&&!R&&(console.error("Error: No entry points provided"),process.exit(1)),ke=await Mr(s,n,ke,Lr,t.rawConfig.gitStats??!1,t.rawConfig.parallelParsing),Ir(ke,o));let st={graph:ke,rootDir:s,entryPoints:n.map(A=>A.replace(s+"/","")),scanOptions:i,rawConfig:t.rawConfig,featureThreshold:Ri,queryStr:Ai,mermaidOutput:Oi,plain:p,excludeTests:v,file:rt,typeFilter:Li,filterPaths:Gi,minOutDegree:ji,functionName:Wi,dryRun:zi,depth:$i,cached:Ui,changedSymbols:Bi,withEdgeDetail:Ji,metric:qi,complexityThreshold:Ki,limit:Hi,slim:Qi,testsOnly:Xi},nt=[[a,ui],[zr,Go],[l,Ro],[d,Vo],[h,ti],[N,Sr],[R,br],[x,wr],[Dr,xr],[Rr,vr],[Ar,Cr],[Or,hr],[$r,kr],[Gr,gi],[jr,li],[_i,Xo],[_r,_o],[Wr,Oo]].find(([A])=>A)?.[1]??Er;if(Br){Il.has(nt)||(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)),Ni(s,300,async()=>{let A=await Mr(s,n,st.graph,Lr,t.rawConfig.gitStats??!1,t.rawConfig.parallelParsing);Ir(A,o),console.log(`--- rebuilt at ${new Date().toISOString()} ---`),await nt({...st,graph:A})});return}await nt(st)}var Il,Di=u(()=>{"use strict";c();b();Mo();Do();Ao();Lo();jo();Wo();zo();$o();Uo();qo();Ko();Ho();Qo();Zo();Yo();ei();ri();si();ai();pi();fi();mi();di();yi();Si();vi();ki();Fi();Ii();Il=new Set([Er,xr,vr,Cr,hr,wr,kr,Sr,br])});var Ml=Zi(()=>{c();Di();Mi().catch(r=>{console.error(r),process.exit(1)})});export default Ml();
139
188
  //# sourceMappingURL=cli.mjs.map