@omfalos/mokosh 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Omfalos
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,192 @@
1
+ # Mokosh 🌊
2
+
3
+ > **Not yet published to npm.** This package is under active development. Install directly from the repository for now.
4
+
5
+ Mokosh is a lightweight, AST-powered dependency graph generator for modern web and script projects. It extracts import maps from JavaScript, TypeScript, Python, Go, CSS, SCSS, Less, Stylus, CoffeeScript, LiveScript, Lua, and Gherkin files to help AI models and developers understand code relationships efficiently.
6
+
7
+ Designed for performance and RAG (Retrieval-Augmented Generation) workflows, Mokosh enables you to visualize your project structure, traverse dependencies, and even propose test tags based on code changes.
8
+
9
+ ## Why Mokosh?
10
+
11
+ - **Runs entirely on your machine.** No accounts, no servers, no data sent anywhere. Your source code stays local at all times.
12
+ - **Works offline.** The graph is built from your filesystem — no network required during analysis.
13
+ - **Integrates in minutes via MCP.** Drop it into any AI assistant that supports the Model Context Protocol and start querying your codebase immediately.
14
+ - **Spans 10+ languages in one graph.** TypeScript, Python, Go, CSS, SCSS, Lua, Gherkin, and more — all in a single traversable dependency graph.
15
+ - **AI-ready output.** Slim query mode, token-efficient responses, and structured tags are designed to fit naturally into LLM context windows.
16
+ - **No vendor lock-in.** Open tool, open format. Run it in CI, in a local script, or as an MCP server — your choice.
17
+
18
+ ## Features
19
+
20
+ - **Multi-Language Support**: Robust extraction from:
21
+ - **JavaScript/TypeScript**: static `import`, dynamic `import()`, `require()`, and re-exports.
22
+ - **Python**: all import forms (`import X`, `from X import Y`, relative `.`/`..` imports, star imports) via `@lezer/python` AST. Test files (`test_*.py`, `*_test.py`) and test frameworks (`pytest`, `unittest`) auto-detected.
23
+ - **Go**: top-level declarations and `// @tag` markers via `@lezer/go` AST. All imports are treated as external (local package resolution requires `go.mod` context).
24
+ - **CSS/SCSS/Less/Stylus**: tracks `@import` relationships.
25
+ - **CoffeeScript/LiveScript/Lua/Gherkin**: AST-based parsing for dependencies and tags.
26
+ - **Graph Traversal**: Programmatically explore dependencies from any entry point with depth control.
27
+ - **Visual Diagrams**: Export your dependency graph to Mermaid.js format.
28
+ - **Lock File Integration**: Automatically extract dependency versions and tags from `package-lock.json`, `yarn.lock`, and `pnpm-lock.yaml`.
29
+ - **Unused File Detection**: Identify files in your project that are not imported by any entry point.
30
+ - **Cycle Detection**: Check for circular dependencies and use as a CI gate (`--check-cycles` exits non-zero if cycles are found).
31
+ - **Caching**: Serialize and deserialize the graph to save computation time.
32
+ - **Filtering & Token Saving**: Use `--query` to filter nodes and dependencies, significantly reducing the size of the output for AI models.
33
+ - **Test Tag Proposal**: Automatically identify affected Playwright/Cucumber test tags based on `git diff`.
34
+ - **Feature Hub Detection**: Identify architectural hub files (files with high out-degree — orchestrators and aggregators that import many internal modules) and surface them as `feature:<name>` tags. Prevents tag explosion when a widely-used utility changes.
35
+ - **Enriched Exports**: Named exports carry their JSDoc description, type signature, and lifecycle flags (`deprecated`, `internal`, `public`, `alpha`, `beta`) — giving AI models precise symbol-level context.
36
+ - **Call Edges**: Beyond imports, Mokosh traces cross-file function/method calls and stores them as `callEdges` on each node.
37
+ - **Tested-By Index**: Every logic/barrel file records which test files import it (`testedBy`), enabling instant "what tests cover this module?" queries.
38
+ - **Git Stats**: Optionally enrich each node with `commitCount90d` and `lastAuthor` (enabled via `gitStats: true` in config), enabling sorting by commit activity.
39
+
40
+ ## Token Saving with Queries
41
+
42
+ When working with large codebases, providing the entire dependency graph to an AI model can exceed context limits or waste tokens. Use the `--query` flag to filter the output to only what's relevant:
43
+
44
+ - **Filter by language**: `--query "type:typescript"`
45
+ - **Filter by category**: `--query "category:ui"`
46
+ - **Filter by tag**: `--query "tag:core"`
47
+ - **Filter by documentation**: `--query "hasDocstring:false"` — find files missing a JSDoc description
48
+ - **Combine filters**: `--query "category:logic,tag:api"`
49
+
50
+ Example of a focused query:
51
+ ```bash
52
+ npx mokosh --query "type:typescript,category:logic" src/index.ts
53
+ ```
54
+
55
+ ## Supported Languages & Tags
56
+
57
+ Mokosh automatically detects file types and uses the appropriate parser. You can also group files using `@tag <name>` in comments:
58
+
59
+ | Language | Extension | Tag Example |
60
+ | --- | --- | --- |
61
+ | JavaScript | `.js`, `.jsx` | `// @tag core` |
62
+ | TypeScript | `.ts`, `.tsx` | `// @tag models` |
63
+ | Python | `.py` | `# @tag auth` |
64
+ | Go | `.go` | `// @tag service` |
65
+ | CSS/SCSS/Less | `.css`, `.scss`, `.less` | N/A |
66
+ | Stylus | `.styl` | N/A |
67
+ | CoffeeScript | `.coffee` | `# @tag script` |
68
+ | LiveScript | `.ls` | `# @tag app` |
69
+ | Lua | `.lua` | `-- @tag config` |
70
+ | Gherkin | `.feature` | `@smoke` |
71
+
72
+ ## Installation
73
+
74
+ > **This package is not yet published to npm.** To use it, clone the repository and build locally:
75
+ >
76
+ > ```bash
77
+ > git clone https://github.com/Omfalos/mokosh.git
78
+ > cd mokosh
79
+ > npm install
80
+ > npm run build
81
+ > ```
82
+ >
83
+ > Once published, installation will be:
84
+ > ```bash
85
+ > npm install mokosh
86
+ > ```
87
+
88
+ ## Quick Start
89
+
90
+ ### CLI Usage
91
+
92
+ Generate a dependency graph as JSON:
93
+ ```bash
94
+ npx mokosh src/index.ts
95
+ ```
96
+
97
+ Generate a Mermaid diagram:
98
+ ```bash
99
+ npx mokosh --mermaid src/index.ts > graph.mmd
100
+ ```
101
+
102
+ Propose test tags for changed files:
103
+ ```bash
104
+ npx mokosh --propose-tags src/index.ts
105
+ ```
106
+
107
+ Detect feature hub files (high out-degree orchestrators):
108
+ ```bash
109
+ npx mokosh --detect-features src/index.ts
110
+ ```
111
+
112
+ Find unused files:
113
+ ```bash
114
+ npx mokosh --find-unused src/index.ts
115
+ ```
116
+
117
+ Use caching to speed up subsequent runs:
118
+ ```bash
119
+ npx mokosh --cache mokosh-cache/graph.json src/index.ts
120
+ ```
121
+
122
+ > **Note:** Add `mokosh-cache/` to your `.gitignore` to avoid committing the cache directory.
123
+
124
+ Filter graph by category and tag:
125
+ ```bash
126
+ npx mokosh --query "category:logic,tag:auth" src/index.ts
127
+ ```
128
+
129
+ ### Options
130
+
131
+ - `--cache [file]`: Path to cache file. If no file is provided, it defaults to `mokosh-cache/graph.json` in the project root.
132
+ - `--config <file>`: Path to a `mokosh.config.js` / `mokosh.config.json` file (overrides auto-discovery).
133
+ - `--root <dir>`: Set the project root directory (default: current directory).
134
+ - `--mermaid`: Output a Mermaid chart (`graph TD`) instead of JSON.
135
+ - `--propose-tags`: Use `git diff` to identify changed files and propose relevant test tags by traversing the dependency graph.
136
+ - `--plain`: Output tags as plain text (one per line) instead of JSON. Use with `--propose-tags`.
137
+ - `--affected-tests`: Like `--propose-tags` but outputs test file paths instead of tags — pipe directly into a test runner: `vitest $(mokosh --affected-tests)`.
138
+ - `--detect-features`: Output files with high out-degree (feature hubs — orchestrators/aggregators that import many internal modules), sorted by out-degree descending.
139
+ - `--feature-threshold <N>`: Minimum internal imports (out-degree) for a file to be a feature hub (default: `5`). Applies to `--detect-features`, `--propose-tags`, and `--affected-tests`.
140
+ - `--find-unused`: Scan the project for files that are not reachable from the specified entry points.
141
+ - `--exclude-tests`: Exclude test files from `--find-unused` output.
142
+ - `--check-cycles`: Check for circular dependencies; exits non-zero if any are found (CI gate).
143
+ - `--find-uncovered`: List non-test files whose line coverage is below the configured threshold (requires `coverageReportPath` in `mokosh.config.*`). Use `--feature-threshold` to override the default 80 % threshold.
144
+ - `--callers`: List files whose exported functions call into a given file. Requires `--file <path>`. More precise than `--find-unused` because it uses call edges rather than import edges.
145
+ - `--file <path>`: Target file for `--callers`.
146
+ - `--query <query>`: Filter the output graph using a query string. Supported keys: `path`, `type`, `category`, `tag`, `external`, `importsFile`, `importedBy`, `minImports`, `maxImports`, `minSize`, `maxSize`, `hasDocstring`, `sort`, `limit`. Example: `category:logic,hasDocstring:false`.
147
+ - `--query-help`: Print the full query filter reference and examples.
148
+ - `--silent`: Suppress progress output on stderr.
149
+ - `--help`: Show usage information.
150
+
151
+ ### Programmatic API
152
+
153
+ ```typescript
154
+ import { createImportMap } from 'mokosh';
155
+
156
+ const rootDir = process.cwd();
157
+ const entryPoints = ['src/main.ts'];
158
+
159
+ const graph = createImportMap(rootDir, entryPoints);
160
+
161
+ // Traverse the graph
162
+ graph.traverse('src/main.ts', (node, depth) => {
163
+ console.log(`${' '.repeat(depth)} ${node.path}`);
164
+ });
165
+
166
+ // Export to Mermaid
167
+ console.log(graph.toMermaid());
168
+ ```
169
+
170
+ ## Documentation
171
+
172
+ For detailed information on each process, check the following guides:
173
+
174
+ ### Guides
175
+ - [Architecture Overview](./docs/architecture.md)
176
+ - [Product Requirements Document (PRD)](./docs/prd.md)
177
+ - [Usage Guide](./docs/usage.md)
178
+ - [Query Language Guide](./docs/query.md)
179
+ - [Graph Traversal](./docs/traversal.md)
180
+ - [Test Tag Proposal](./docs/test-tags.md)
181
+ - [Lock File Analysis](./docs/lock-files.md)
182
+ - [MCP Server](./docs/mcp.md)
183
+ - [Monorepo Support](./docs/monorepo.md)
184
+ - [Roadmap](./docs/roadmap.md)
185
+
186
+ ### Architecture Decision Records
187
+ - [ADR-001: AST Libraries for Style Parsers](./docs/adr-001-styles-parsing.md)
188
+ - [ADR-002: Python Parsing with @lezer/python](./docs/adr-002-python-parsing.md)
189
+ - [ADR-003: Call-Edge Graph — Function-Level Dependency Layer](./docs/adr-003-call-edge-graph.md)
190
+ - [ADR-004: Type Graph — Type-Level Dependency Layer](./docs/adr-004-type-graph.md)
191
+ - [ADR-005: Feature Graph — Domain Clustering by Hub Detection](./docs/adr-005-feature-graph.md)
192
+ - [ADR-006: Responsibility Graph — Semantic Role Assignment](./docs/adr-006-responsibility-graph.md)
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.js ADDED
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env node
2
+ "use strict";var pn=Object.create;var qt=Object.defineProperty;var ln=Object.getOwnPropertyDescriptor;var fn=Object.getOwnPropertyNames;var un=Object.getPrototypeOf,mn=Object.prototype.hasOwnProperty;var gn=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of fn(e))!mn.call(t,n)&&n!==r&&qt(t,n,{get:()=>e[n],enumerable:!(s=ln(e,n))||s.enumerable});return t};var f=(t,e,r)=>(r=t!=null?pn(un(t)):{},gn(e||!t||!t.__esModule?qt(r,"default",{value:t,enumerable:!0}):r,t));var xe=f(require("fs")),qe=f(require("path"));var dn=[".config.","biome.json","tsconfig.json","package.json",".prettierrc",".eslintrc"],Vt=[];function de(t){Vt.push(t)}function Qt(t){return[...dn,...Vt].some(e=>typeof e=="string"?t.includes(e):e instanceof RegExp?e.test(t):e(t))}var hn=[".test.",".spec.","-test.","-spec."],Xt=[];function he(t){Xt.push(t)}function X(){return[...hn,...Xt]}var yn=["jest","vitest","playwright","cypress","@testing-library/"],Zt=[];function ye(t){Zt.push(t)}function Je(){return[...yn,...Zt]}var Yt=.8;function Ke(t){Yt=t}function He(){return Yt}var xn=["mokosh.config.js","mokosh.config.cjs","mokosh.config.json"];function G(t,{allowJs:e=!0,isExplicitPath:r=!1}={}){if(r){let s=qe.default.resolve(t);return xe.default.existsSync(s)?s.endsWith(".json")?er(s):e?tr(s):{}:{}}for(let s of xn){let n=qe.default.resolve(t,s);if(xe.default.existsSync(n)){if(s.endsWith(".json"))return er(n);if(e)return tr(n)}}return{}}function er(t){return JSON.parse(xe.default.readFileSync(t,"utf-8"))}function tr(t){let e=require(t);return e&&typeof e=="object"&&"default"in e&&(e=e.default),typeof e=="function"?e({}):e}function Ve(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&&Ke(t.barrelThreshold)}var Qe=["node_modules",".git","dist","build",".next",".cache","mokosh-cache","coverage"],Xe=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".css",".scss",".sass",".less",".styl",".coffee",".ls",".lua",".py",".go",".feature"];var Sn=f(require("fs")),bn=f(require("path"));var Se={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 Ze=f(require("fs")),rr=f(require("path"));function Ye(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 sr(t,e){if(typeof t=="string")return Ye(t,e);if(t&&typeof t=="object"){let r=t;for(let s of["import","require","default"]){let n=sr(r[s],e);if(n)return n}}return null}function Cn(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 En(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 et(t,e){let r=[],s=rr.default.join(e,"package.json");if(Ze.default.existsSync(s))try{let n=JSON.parse(Ze.default.readFileSync(s,"utf8"));if(n.exports&&typeof n.exports=="object"&&!Array.isArray(n.exports))for(let o of Object.values(n.exports)){let i=sr(o,t);i&&!r.includes(i)&&r.push(i)}else if(typeof n.exports=="string"){let o=Ye(n.exports,t);o&&r.push(o)}if(r.length===0)for(let o of[n.main,n.module].filter(Boolean)){let i=Ye(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 kn(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 Fn(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 wn(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:Cn(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 Tn(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 tt(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=kn(t,e),s=Fn(t,r,e),n=En(t,e),o=wn(n,s,t,e),{internalFiles:i,unreachableFromEntry:a,testFiles:c}=Tn(t,r,e);return{entryPoints:e,publicExports:o,internalFiles:i,unreachableFromEntry:a,testFiles:c}}function rt(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 Pn=f(require("fs")),Nn=f(require("path"));var Z=f(require("path"));function In(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 Mn(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=Z.default.extname(n),c=Z.default.basename(n,a),p=c==="index"?Z.default.basename(Z.default.dirname(n)):c;s.set(n,{path:n,outDegree:o,tag:`feature:${p}`})}return s}function D(t,e){let r=e?.minOutDegree??5;return Mn(t,In(t),r)}var Dn=(t,e)=>t.outDegree-e.outDegree;function Rn(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 An(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 Ln(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 Gn(t,e,r){let s=[];for(let n of t.keys())!e.has(n)&&!r.has(n)&&s.push(n);return s}function Y(t,e){let r=e?.detectFn??D,s=e?.hubComparator??Dn,n=r(t.nodes,e),o=Rn(t,n),i=An(t.nodes,n,o,s);return{features:Ln(n,i),unassigned:Gn(t.nodes,n,i)}}var ee=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 k=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 ee(this.nodes).findUnusedFiles(e)}findCycles(){return new ee(this.nodes).findCycles()}};function nr(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}function st(t,e){let r=Y(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:nr(o),...o.description?{description:o.description}:{},exports:o.exports.map(a=>a.name),...i?{featureHub:i}:{}})}return n}var 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 On(t){return t?t.startsWith("interface ")?"interface":t.startsWith("class ")?"class":t.startsWith("enum ")?"enum":"type":"type"}function jn(t,e){if(e==="type-only")return!0;let r=t.signature??"";return r.startsWith("interface ")||r.startsWith("class ")||r.startsWith("enum ")}function nt(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(!jn(n,s.category))continue;let o=`${s.path}::${n.name}`;e.set(o,{name:n.name,file:s.path,kind:On(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 ot(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 qn=f(require("path"));var ve=f(require("fs")),ct=f(require("path"));var O=f(require("fs")),C=f(require("path"));var it=f(require("fs")),_n=f(require("path"));function or(t){try{return it.default.statSync(t,{throwIfNoEntry:!1})?.isDirectory()===!0}catch{return!1}}function be(t){try{return it.default.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}function at(t,e){let r=C.default.join(e,"package.json");if(!O.default.existsSync(r))return null;let s={};try{s=JSON.parse(O.default.readFileSync(r,"utf-8"))}catch{return null}let n=s.name;return n?{name:n,root:e,relativeRoot:C.default.relative(t,e),entryPoints:Wn(e,s)}:null}function Wn(t,e){let r=[];if(e.exports){let n=e.exports;if(typeof n=="string")r.push(C.default.join(t,n));else if(typeof n=="object"&&n!==null){let o=n["."];if(typeof o=="string")r.push(C.default.join(t,o));else if(typeof o=="object"&&o!==null){let i=o.import??o.require??o.default;typeof i=="string"&&r.push(C.default.join(t,i))}}}e.main&&r.push(C.default.join(t,e.main));for(let n of["src/index.ts","src/index.tsx","index.ts","index.tsx","index.js"])r.push(C.default.join(t,n));let s=r.filter(be);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(/^\.\//,"");zn(t,o,s,r)}return r}function zn(t,e,r,s){if(!e.includes("*")){$n(t,e,r,s);return}let n=e.split("/");n.includes("**")?Un(t,n,r,s):Bn(t,n,r,s)}function $n(t,e,r,s){let n=C.default.join(t,e);if(r.has(n)||!or(n))return;r.add(n);let o=at(t,n);o&&s.push(o)}function Un(t,e,r,s){let n=C.default.join(t,e[0]==="**"?"":e[0]??"");ir(t,n,r,s)}function Bn(t,e,r,s){let n=e.findIndex(a=>a.includes("*")),o=C.default.join(t,...e.slice(0,n)),i;try{i=O.default.readdirSync(o,{withFileTypes:!0})}catch{return}for(let a of i){if(!a.isDirectory())continue;let c=C.default.join(o,a.name);if(r.has(c))continue;r.add(c);let p=at(t,c);p&&s.push(p)}}function ir(t,e,r,s){let n;try{n=O.default.readdirSync(e,{withFileTypes:!0})}catch{return}for(let o of n){if(!o.isDirectory()||o.name==="node_modules"||o.name.startsWith("."))continue;let i=C.default.join(e,o.name);if(O.default.existsSync(C.default.join(i,"package.json"))&&!r.has(i)){r.add(i);let a=at(t,i);a&&s.push(a)}else ir(t,i,r,s)}}var ar={type:"npm",detect(t){let e=ct.default.join(t,"package.json");if(!ve.default.existsSync(e))return null;let r;try{r=JSON.parse(ve.default.readFileSync(e,"utf-8")).workspaces}catch{return null}if(!r||ve.default.existsSync(ct.default.join(t,"yarn.lock")))return null;let s=Array.isArray(r)?r:r.packages??[];return s.length===0?null:j(t,s)}};var R=f(require("fs")),S=f(require("path"));var cr={type:"nx",detect(t){return R.default.existsSync(S.default.join(t,"nx.json"))?pr(t,t,new Set,0).map(r=>Jn(t,r,S.default.join(r,"project.json"))).filter(r=>r!==null):null}};function pr(t,e,r,s){if(s>4)return[];let n;try{n=R.default.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.default.join(e,a);R.default.existsSync(S.default.join(c,"project.json"))&&!r.has(c)?(r.add(c),o.push(c)):o.push(...pr(t,c,r,s+1))}return o}function Jn(t,e,r){let s={};try{s=JSON.parse(R.default.readFileSync(r,"utf-8"))}catch{return null}let n=s.name,o,i,a=S.default.join(e,"package.json");if(R.default.existsSync(a))try{let c=JSON.parse(R.default.readFileSync(a,"utf-8"));n=c.name??n,o=c.main,i=c.exports}catch{}return n?{name:n,root:e,relativeRoot:S.default.relative(t,e),entryPoints:Kn(e,s,o,i)}:null}function Kn(t,e,r,s){let n=[],o=e.targets?.build?.options?.main??e.targets?.build?.options?.entryFile;if(o){let a=S.default.resolve(t,"../..");n.push(S.default.resolve(a,o)),n.push(S.default.resolve(t,o))}if(s){let a=s;if(typeof a=="string")n.push(S.default.join(t,a));else if(typeof a=="object"&&a!==null){let c=a["."];typeof c=="string"&&n.push(S.default.join(t,c))}}if(r&&n.push(S.default.join(t,r)),e.sourceRoot){let a=S.default.resolve(t,"../.."),c=S.default.resolve(a,e.sourceRoot);n.push(S.default.join(c,"index.ts"),S.default.join(c,"index.tsx"))}for(let a of["src/index.ts","src/index.tsx","index.ts","index.tsx"])n.push(S.default.join(t,a));let i=n.filter(be);return i.length>0?i.slice(0,1):n.slice(0,1)}var pt=f(require("fs")),lr=f(require("path")),fr=f(require("js-yaml"));var ur={type:"pnpm",detect(t){let e=lr.default.join(t,"pnpm-workspace.yaml");if(!pt.default.existsSync(e))return null;let r=[];try{r=fr.default.load(pt.default.readFileSync(e,"utf-8"))?.packages??[]}catch{return null}return j(t,r)}};var mr=f(require("fs")),gr=f(require("path")),dr={type:"turborepo",detect(t){return mr.default.existsSync(gr.default.join(t,"turbo.json"))?[]:null}};var Ce=f(require("fs")),lt=f(require("path"));var hr={type:"yarn",detect(t){if(!Ce.default.existsSync(lt.default.join(t,"yarn.lock")))return null;let e=lt.default.join(t,"package.json");if(!Ce.default.existsSync(e))return null;let r;try{r=JSON.parse(Ce.default.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)}};var Hn=[];function I(t){Hn.push(t)}I(dr);I(cr);I(ur);I(hr);I(ar);var yr=new Map;function _(t,e){yr.set(t,e)}function xr(t){return yr.get(t)}function Sr(t,e){return e.startsWith("!")?t!==e.slice(1):t===e}function Vn(t,e){return e.startsWith("!")?!t.includes(e.slice(1)):t.includes(e)}var Qn=(t,e)=>!e.category||Sr(t.category,e.category),Xn=(t,e)=>!e.type||Sr(t.type,e.type),Zn=(t,e)=>!e.path||Vn(t.path,e.path),Yn=(t,e)=>e.isExternal===void 0?!0:t.imports.some(s=>s.isExternal)===e.isExternal,eo=(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)))},to=(t,e)=>!e.allTags?.length||e.allTags.every(r=>t.tags.some(s=>s.name===r)),ro=(t,e)=>!e.importsFile||t.imports.some(r=>r.toPath?.includes(e.importsFile)),so=(t,e,r)=>e.importedBy===void 0?!0:(r?.get(t.path)??[]).some(n=>n.includes(e.importedBy)),no=(t,e)=>e.minImports===void 0||t.imports.length>=e.minImports,oo=(t,e)=>e.maxImports===void 0||t.imports.length<=e.maxImports,io=(t,e)=>e.minSize===void 0||t.size>=e.minSize,ao=(t,e)=>e.maxSize===void 0||t.size<=e.maxSize,co=(t,e)=>e.hasDocstring===void 0||!!t.description===e.hasDocstring,po=(t,e)=>e.minCoverage===void 0||(t.coveragePct??101)>=e.minCoverage,lo=(t,e)=>e.maxCoverage===void 0||(t.coveragePct??0)<=e.maxCoverage,fo=(t,e)=>e.minExportUsage===void 0||(t.avgExportUsage??-1)>=e.minExportUsage,uo=(t,e)=>e.maxExportUsage===void 0||(t.avgExportUsage??0)<=e.maxExportUsage,br=[Qn,Xn,Zn,Yn,eo,to,ro,so,no,oo,io,ao,co,po,lo,fo,uo];function vr(t,e,r){return br.every(s=>s(t,e,r))}function Ee(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=>vr(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}}function ke(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 Et=f(require("fs/promises")),Mr=f(require("path"));var De=f(require("path")),se=f(require("typescript"));var ft=f(require("path")),ut=f(require("typescript"));var b=f(require("typescript")),Cr=new Set(["describe","test","it"]);function W(t){let e=[];for(let r of t.statements){if(!b.default.isExpressionStatement(r))continue;let s=r.expression;if(!b.default.isCallExpression(s))continue;let n=s.expression;b.default.isIdentifier(n)&&Cr.has(n.text)&&e.push(s),b.default.isPropertyAccessExpression(n)&&b.default.isIdentifier(n.expression)&&Cr.has(n.expression.text)&&e.push(s)}return e}function z(t,e,r){for(let s of t.arguments){if(!b.default.isObjectLiteralExpression(s))continue;let n=s.properties.find(o=>b.default.isPropertyAssignment(o)&&b.default.isIdentifier(o.name)&&o.name.text===e);if(!(!n||!b.default.isArrayLiteralExpression(n.initializer)))return n.initializer.elements.filter(b.default.isStringLiteral).map(o=>o.text)}return null}function $(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.default.isObjectLiteralExpression(i))continue;let a=i.properties.find(p=>b.default.isPropertyAssignment(p)&&b.default.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 U(t,e,r){let s=t.arguments;for(let n=1;n<s.length;n++){let o=s[n];if(!b.default.isObjectLiteralExpression(o))continue;let i=o.properties.findIndex(c=>b.default.isPropertyAssignment(c)&&b.default.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 B(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 J(t){return`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}var T=new Set([".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"]);function mo(t){return J(t.map(e=>`@${e}`))}function go(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var Fe=class{name="cypress";canHandle(e){return T.has(ft.default.extname(e).toLowerCase())}apply(e,r,s){let n=ut.default.createSourceFile(ft.default.basename(e),r,ut.default.ScriptTarget.Latest,!0),o=W(n);if(o.length===0)return r;let i=z(o[0],"tags",n),a=[...s].sort();if(i!==null&&JSON.stringify(go(i).sort())===JSON.stringify(a))return r;let c=o.flatMap(p=>{let u=s.length===0?U(p,"tags",n):$(p,"tags",mo(a),n);return u?[u]:[]});return c.length>0?B(r,c):r}};var Er=f(require("path")),mt=/# <mokosh-tags>[\s\S]*?# <\/mokosh-tags>\n*/,gt=/^@([a-zA-Z0-9_-]+)/gm;function ho(t){return["# <mokosh-tags>",...t.map(e=>`@${e}`),"# </mokosh-tags>"].join(`
4
+ `)+`
5
+
6
+ `}function yo(t){let e=new Set;gt.lastIndex=0;let r=gt.exec(t);for(;r!==null;)r[1]&&e.add(r[1]),r=gt.exec(t);return e}var we=class{name="gherkin";canHandle(e){return Er.default.extname(e).toLowerCase()===".feature"}apply(e,r,s){let n=r.replace(mt,""),o=yo(n),i=s.filter(c=>!o.has(c)),a=i.length>0?ho(i):"";return mt.test(r)?r.replace(mt,a):a?r.replace(/^(Feature:)/m,`${a}$1`):r}};function kr(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 Fr=f(require("path")),dt=/^\/\/go:build mokosh_[^\n]+\n/m,xo=/^package\s+\S+/m;function So(t){return`//go:build ${t.map(r=>`mokosh_${r}`).join(" || ")}
7
+ `}function bo(t){let e=dt.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 Te=class{name="go";canHandle(e){return Fr.default.basename(e).endsWith("_test.go")}apply(e,r,s){let n=bo(r),o=[...s].sort();if(n!==null&&JSON.stringify([...n].sort())===JSON.stringify(o))return r;if(s.length===0)return r.replace(dt,"");let i=So(o);if(n!==null)return r.replace(dt,i);let a=xo.exec(r);if(!a)return r;let c=a.index;return r.slice(0,c)+i+`
8
+ `+r.slice(c)}};var wr=f(require("path"));var vo=/^\/\*\*\n(?: \* @group .+\n)+ \*\/\n+/,ht=/^ \* @group (.+)$/gm;function Co(t){return["/**",...t.map(e=>` * @group ${e}`)," */"].join(`
9
+ `)+`
10
+
11
+ `}function Eo(t){let e=[];ht.lastIndex=0;let r=ht.exec(t);for(;r!==null;)r[1]&&e.push(r[1]),r=ht.exec(t);return e}var Pe=class{name="jest";canHandle(e){return T.has(wr.default.extname(e).toLowerCase())}apply(e,r,s){let n=vo.exec(r),o=n?Eo(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:Co(i)+a}};var yt=f(require("path")),xt=f(require("typescript"));function ko(t){return J(t.map(e=>`@${e}`))}function Fo(t){return t.map(e=>e.startsWith("@")?e.slice(1):e)}var Ne=class{name="playwright";canHandle(e){return T.has(yt.default.extname(e).toLowerCase())}apply(e,r,s){let n=xt.default.createSourceFile(yt.default.basename(e),r,xt.default.ScriptTarget.Latest,!0),o=W(n);if(o.length===0)return r;let i=z(o[0],"tag",n),a=[...s].sort();if(i!==null&&JSON.stringify(Fo(i).sort())===JSON.stringify(a))return r;let c=o.flatMap(p=>{let u=s.length===0?U(p,"tag",n):$(p,"tag",ko(a),n);return u?[u]:[]});return c.length>0?B(r,c):r}};var Tr=f(require("path")),St=/^pytestmark\s*=\s*.+$/m,wo=/^import pytest\s*$/m;function To(t){let e=t.map(r=>`pytest.mark.${r}`).join(", ");return t.length===1?`pytestmark = pytest.mark.${t[0]}`:`pytestmark = [${e}]`}function Po(t){let e=St.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}var Ie=class{name="pytest";canHandle(e){return Tr.default.extname(e).toLowerCase()===".py"}apply(e,r,s){let n=Po(r),o=[...s].sort();if(n!==null&&JSON.stringify([...n].sort())===JSON.stringify(o))return r;if(s.length===0)return r.replace(St,"").replace(/\n{3,}/g,`
12
+
13
+ `);let i=To(o);if(n!==null)return r.replace(St,i);let a=wo.test(r),c=No(r),p=r.slice(0,c),u=r.slice(c),m=a?"":`import pytest
14
+ `,h=p.endsWith(`
15
+
16
+ `)?"":`
17
+ `;return p+h+m+i+`
18
+ `+u}};function No(t){let e=t.split(`
19
+ `),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 bt=f(require("path")),vt=f(require("typescript"));var Io=/\/\/ <mokosh-tags>[\s\S]*?\/\/ <\/mokosh-tags>\n*/,Me=class{name="vitest";canHandle(e){return T.has(bt.default.extname(e).toLowerCase())}apply(e,r,s){let n=r.replace(Io,""),o=vt.default.createSourceFile(bt.default.basename(e),n,vt.default.ScriptTarget.Latest,!0),i=W(o);if(i.length===0)return n;let a=z(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?U(u,"tags",o):$(u,"tags",J(c),o);return m?[m]:[]});return p.length>0?B(n,p):n}};var Pr={vitest:()=>new Me,playwright:()=>new Ne,cypress:()=>new Fe,jest:()=>new Pe},Mo={"@playwright/test":"playwright",cypress:"cypress","@jest/globals":"jest",vitest:"vitest"};function Do(t){let e=se.default.createSourceFile("detect.ts",t,se.default.ScriptTarget.Latest,!0);for(let r of e.statements){if(!se.default.isImportDeclaration(r)||!se.default.isStringLiteral(r.moduleSpecifier))continue;let s=Mo[r.moduleSpecifier.text];if(s)return s}return null}var Ct=class{constructor(e,r,s){this.rootDir=e;this.defaultFramework=r;this.frameworkOverrides=s}rootDir;defaultFramework;frameworkOverrides;name="auto";canHandle(e){return T.has(De.default.extname(e).toLowerCase())}apply(e,r,s){let n=Do(r)??this.matchOverride(e)??this.defaultFramework;return(Pr[n]??Pr.vitest)().apply(e,r,s)}matchOverride(e){let r=De.default.relative(this.rootDir,e).split(De.default.sep).join("/");for(let[s,n]of this.frameworkOverrides)if(kr(s,r))return n;return null}};function Nr(t="vitest",e={},r=process.cwd()){return[new we,new Ie,new Te,new Ct(r,t,Object.entries(e))]}function Ir(t,e){return e.find(r=>r.canHandle(t))??null}var Ro=/^[a-zA-Z][a-zA-Z0-9_-]{1,}$/,Ao=new Set(["import"]),Lo=new Set(["common","fixture","fixtures","helper","helpers","index","main","mock","mocks","setup","shared","spec","test","tests","types","util","utils"]);async function Go(t,e,r,s){let n;try{n=await Et.default.readFile(t,"utf8")}catch(a){return{path:t,status:"error",error:String(a)}}let o=Ir(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 Et.default.writeFile(t,i,"utf8"),{path:t,status:"updated"})}async function kt(t,e,r){let s=G(e),n=s.tagApplier?.framework??"vitest",o=s.tagApplier?.frameworkOverrides??{},i=Nr(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)Ao.has(x.kind)&&Ro.test(x.name)&&(Lo.has(x.name.toLowerCase())||p.has(x.name)||(p.add(x.name),u.push(x.name)));u.sort();let m=Mr.default.resolve(e,c.path),h=await Go(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 Re=class{isTestNode(e){return e.category==="test"||e.tags.some(r=>r.name==="test")}};var ue=f(require("fs")),v=f(require("path"));var Ft=require("child_process"),Ae=class{getChangedFiles(){try{let r=["git diff --name-only","git diff --cached --name-only","git ls-files --others --exclude-standard"].flatMap(s=>{try{return(0,Ft.execSync)(s,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
20
+ `).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),[]}}};function Dr(t,e){let s=(0,Ft.execSync)(`git -C "${t}" log --follow --format="%ae" --since="90 days ago" -- "${e}"`,{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).split(`
21
+ `).filter(Boolean);return{commitCount90d:s.length,lastAuthor:s[0]}}var ne=f(require("fs")),Rr=f(require("path")),wt=f(require("js-yaml"));function Ar(t){let e=t.lastIndexOf("@");return e>0?t.substring(0,e):t}function Oo(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)),Ar(r)}).filter(Boolean)}function jo(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 _o(t){try{let e=wt.default.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=Ar(o);i&&(r.dependencies[i]={version:n.version,...n.dependencies!==void 0&&{dependencies:n.dependencies}})}return r}catch{return null}}function Wo(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=Oo(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 zo(t){let e=ne.default.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 $o(t){let e=ne.default.readFileSync(t,"utf-8");if(e.includes("__metadata:")){let r=_o(e);if(r!==null)return r}return Wo(e)}function Uo(t){let e=ne.default.readFileSync(t,"utf-8"),r={dependencies:{}};try{let s=wt.default.load(e);if(s.packages)for(let[n,o]of Object.entries(s.packages)){let{name:i,version:a}=jo(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 Lr(t){let e=[["package-lock.json",zo],["yarn.lock",$o],["pnpm-lock.yaml",Uo]];for(let[r,s]of e){let n=Rr.default.join(t,r);if(ne.default.existsSync(n))return s(n)}return null}var Tt=f(require("path"));function M(t){switch(Tt.default.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 E(t){let e=Tt.default.extname(t).toLowerCase();return[".css",".scss",".sass",".less",".styl"].includes(e)}var Gr=f(require("coffeescript"));function Bo(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 Jo(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function Ko(t,e){let r=e.source?.value;return r?{fromPath:t,toPath:"",rawSpecifier:r,isStyle:E(r),type:"static"}:null}function Ho(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:E(s),type:"require"}}function qo(t,e,r){let s=e.constructor?.name;if(s==="ImportDeclaration"){let n=Ko(t,e);n&&r.push(n)}else if(s==="Call"){let n=Ho(t,e);n&&r.push(n)}}function Pt(t,e,r){if(!(!e||typeof e!="object")){qo(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)Pt(t,o,r);else Pt(t,n,r)}}}function Or(t,e){let r=Bo(e),s=Jo(t,r),n=[];try{Pt(t,Gr.default.nodes(e),n)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var K=require("@cucumber/gherkin"),jr=require("@cucumber/messages");var Vo=jr.IdGenerator.uuid();function Nt(t,e){let r=new Set;try{let s=new K.AstBuilder(Vo),n=new K.GherkinClassicTokenMatcher,i=new K.Parser(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"}}_("gherkin",Nt);var Wr=f(require("path")),zr=require("@lezer/go"),Qo=/\/\/\s*@tag\s+([a-zA-Z0-9_-]+)/,Xo=/^\/\/go:build\s+(.+)$/,Zo=/^\/\/\s*\+build\s+(.+)$/;function $r(t,e){let r=[],s=new Map,n=new Set,o=new Set,a=zr.parser.parse(e).cursor();do switch(a.name){case"LineComment":{let m=e.slice(a.from,a.to),h=m.match(Qo);h?.[1]&&n.add(h[1]);let x=m.match(Xo);x&&_r(x[1],o);let N=m.match(Zo);N&&_r(N[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=Wr.default.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 _r(t,e){for(let r of t.split(/[\s,&|!()]+/)){let s=r.trim();s&&s!=="ignore"&&e.add(s)}}var Ur=f(require("livescript"));function H(t){return t.startsWith("'")||t.startsWith('"')?t.slice(1,-1):t}function Yo(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 ei(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}var ti=new Set(["first_line","first_column","last_line","last_column","line","column"]);function ri(t,e){let r=t.constructor?.name||t.type;if(r==="Import"){let s=t.right?.value;if(typeof s=="string"){let n=H(s);return{fromPath:e,toPath:"",rawSpecifier:n,isStyle:E(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=H(n);return{fromPath:e,toPath:"",rawSpecifier:o,isStyle:E(o),type:"require"}}}}return null}function It(t,e){if(!t||typeof t!="object")return[];let r=[],s=ri(t,e);s&&r.push(s);for(let n in t){if(ti.has(n))continue;let o=t[n];if(!(!o||typeof o!="object"))if(Array.isArray(o))for(let i of o)r.push(...It(i,e));else r.push(...It(o,e))}return r}function Br(t,e){let r=Yo(e),s=ei(t,r),n=[];try{n=It(Ur.default.ast(e),t)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var Jr=f(require("luaparse"));function si(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 ni(t,e){let r=t.toLowerCase();return r.includes(".test.")||r.includes(".spec.")||e.has("test")?"test":"logic"}function oi(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=H(i.raw))}else if(n.type==="StringCallExpression"){let i=n.argument;i?.type==="StringLiteral"&&(o=H(i.raw))}o&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:E(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 Kr(t,e){let r=si(e),s=ni(t,r),n=[];try{let o=Jr.default.parse(e);n=oi(o,t)}catch{}return{imports:n,exports:[],tags:Array.from(r).map(o=>({name:o,kind:"comment-marker"})),category:s}}var Hr=f(require("path")),qr=require("@lezer/python"),ii=new Set(["pytest","unittest","nose","hypothesis"]);function Vr(t,e){let r=[],s=[],n=new Set,o=Hr.default.basename(t).toLowerCase(),a=qr.parser.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 ai(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=fi(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 ai(t,e,r){let s=t.firstChild;return s?s.name==="from"?ci(t,e,r):pi(t,e,r):[]}function ci(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=li(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 pi(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 li(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 fi(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=>ii.has(s.rawSpecifier))?"test":"logic"}var Rt=f(require("path")),l=f(require("typescript"));var g=f(require("typescript"));function ui(t){let e=1;function r(s){switch(s.kind){case g.default.SyntaxKind.IfStatement:case g.default.SyntaxKind.ConditionalExpression:case g.default.SyntaxKind.ForStatement:case g.default.SyntaxKind.ForInStatement:case g.default.SyntaxKind.ForOfStatement:case g.default.SyntaxKind.WhileStatement:case g.default.SyntaxKind.DoStatement:case g.default.SyntaxKind.CatchClause:case g.default.SyntaxKind.CaseClause:e++;break;case g.default.SyntaxKind.BinaryExpression:{let n=s.operatorToken.kind;(n===g.default.SyntaxKind.AmpersandAmpersandToken||n===g.default.SyntaxKind.BarBarToken||n===g.default.SyntaxKind.QuestionQuestionToken)&&e++;break}}g.default.forEachChild(s,r)}return r(t),e}function mi(t){let e=0;function r(s,n,o){if(g.default.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.default.isIfStatement(s.elseStatement)?r(s.elseStatement,n,!0):(e+=1,r(s.elseStatement,n+1,!1)));return}if(g.default.isForStatement(s)||g.default.isForInStatement(s)||g.default.isForOfStatement(s)||g.default.isWhileStatement(s)||g.default.isDoStatement(s)||g.default.isSwitchStatement(s)){e+=1+n,g.default.forEachChild(s,a=>r(a,n+1,!1));return}if(g.default.isCatchClause(s)){e+=1+n,g.default.forEachChild(s,a=>r(a,n,!1));return}if(g.default.isConditionalExpression(s)&&(e+=1),g.default.isBinaryExpression(s)){let a=s.operatorToken.kind;(a===g.default.SyntaxKind.AmpersandAmpersandToken||a===g.default.SyntaxKind.BarBarToken||a===g.default.SyntaxKind.QuestionQuestionToken)&&(e+=1)}if(n>0&&(g.default.isFunctionDeclaration(s)||g.default.isFunctionExpression(s)||g.default.isArrowFunction(s))){e+=1+n,g.default.forEachChild(s,a=>r(a,n+1,!1));return}g.default.forEachChild(s,a=>r(a,n,!1))}return r(t,0,!1),e}function Mt(t){return{complexity:ui(t),cognitiveComplexity:mi(t)}}var y=f(require("typescript")),Dt=new Set(["test","describe","it"]);function Qr(t,e){gi(t,e),hi(t,e),yi(t,e),xi(t,e)}function gi(t,e){if((y.default.isFunctionDeclaration(t)||y.default.isVariableDeclaration(t))&&t.name&&y.default.isIdentifier(t.name)&&di(t)){let r;if(y.default.isFunctionDeclaration(t))r="function";else{let s=t.initializer;r=s&&(y.default.isArrowFunction(s)||y.default.isFunctionExpression(s))?"function":"variable"}e.tags.add({name:t.name.text,kind:r})}}function di(t){if(y.default.isFunctionDeclaration(t))return y.default.isSourceFile(t.parent);let e=t.parent?.parent;return!!e&&y.default.isSourceFile(e.parent)}function hi(t,e){if(!y.default.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 yi(t,e){if(!y.default.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 xi(t,e){if(y.default.isCallExpression(t)&&Si(t.expression))for(let r of t.arguments)y.default.isObjectLiteralExpression(r)&&bi(r,e)}function Si(t){return y.default.isIdentifier(t)?Dt.has(t.text):!!(y.default.isPropertyAccessExpression(t)&&(Dt.has(t.name.text)||y.default.isIdentifier(t.expression)&&Dt.has(t.expression.text)))}function bi(t,e){for(let r of t.properties){if(!y.default.isPropertyAssignment(r)||!y.default.isIdentifier(r.name)||r.name.text!=="tags"&&r.name.text!=="tag")continue;let{initializer:s}=r,n=y.default.isArrayLiteralExpression(s)?s.elements.filter(y.default.isStringLiteral):r.name.text==="tag"&&y.default.isStringLiteral(s)?[s]:[];for(let o of n)e.tags.add({name:o.text.replace(/^@/,""),kind:"comment-marker"})}}function At(t,e,r){let s=[],n=new Map,o=new Set,i=l.default.createSourceFile(t,e,l.default.ScriptTarget.Latest,!0,r==="typescript"?l.default.ScriptKind.TSX:l.default.ScriptKind.JSX),a={filePath:t,imports:s,exports:n,tags:o,rawCallEdges:[],sourceFile:i,hasUI:!1,hasTypesOnly:!0,totalStatements:0,exportStatements:0},c=Q=>{ki(Q,a),l.default.forEachChild(Q,c)};c(i);let p=Li(t,a);(p==="test"||p==="barrel")&&o.add({name:p,kind:"comment-marker"}),p!=="test"&&Gi(a,i);let u=i.statements[0],m=u?Zr(u):void 0,{complexity:h,cognitiveComplexity:x}=Mt(i),N=vi(i);return{imports:s,exports:Array.from(n.values()),tags:Array.from(o),category:p,rawCallEdges:a.rawCallEdges??[],complexity:h,cognitiveComplexity:x,...N.length>0?{functions:N}:{},...m!==void 0?{description:m}:{}}}function vi(t){let e=[],r=(n,o)=>{let{complexity:i,cognitiveComplexity:a}=Mt(o),c=t.getLineAndCharacterOfPosition(o.getStart(t)).line+1;e.push({name:n,line:c,complexity:i,cognitiveComplexity:a})},s=(n,o)=>{if(l.default.isFunctionDeclaration(n)&&n.name&&n.body?r(n.name.text,n):l.default.isVariableDeclaration(n)&&l.default.isIdentifier(n.name)&&n.initializer&&(l.default.isArrowFunction(n.initializer)||l.default.isFunctionExpression(n.initializer))?r(n.name.text,n.initializer):o&&l.default.isMethodDeclaration(n)&&l.default.isIdentifier(n.name)&&n.body?r(`${o}.${n.name.text}`,n):o&&l.default.isConstructorDeclaration(n)&&n.body?r(`${o}.constructor`,n):o&&l.default.isGetAccessorDeclaration(n)&&l.default.isIdentifier(n.name)&&n.body?r(`${o}.get ${n.name.text}`,n):o&&l.default.isSetAccessorDeclaration(n)&&l.default.isIdentifier(n.name)&&n.body&&r(`${o}.set ${n.name.text}`,n),l.default.isClassDeclaration(n)&&n.name){let i=n.name.text;l.default.forEachChild(n,a=>s(a,i));return}l.default.forEachChild(n,i=>s(i,o))};return s(t,void 0),e}function Xr(t,e,r,s){let n={name:t},o=Zr(r);o!==void 0&&(n.doc=o);let i=Ci(e);i!==void 0&&(n.flags=i);let a=Ei(e,s);return a!==void 0&&(n.signature=a),n}function Zr(t){let e=l.default.getJSDocCommentsAndTags(t);for(let r of e)if(l.default.isJSDoc(r)&&r.comment)return l.default.getTextOfJSDocComment(r.comment)||void 0}function Ci(t){let e=new Set(["deprecated","internal","public","alpha","beta"]),r=l.default.getJSDocTags(t).map(s=>s.tagName.text).filter(s=>e.has(s));return r.length>0?r:void 0}function Ei(t,e){let r=l.default.createPrinter({removeComments:!0}),s=n=>r.printNode(l.default.EmitHint.Unspecified,n,e);if(l.default.isFunctionDeclaration(t)||l.default.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(l.default.isVariableDeclaration(t)){if(t.type)return s(t.type);if(t.initializer&&(l.default.isArrowFunction(t.initializer)||l.default.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(l.default.isClassDeclaration(t)&&t.name)return`class ${t.name.text}`;if(l.default.isInterfaceDeclaration(t))return`interface ${t.name.text}`;if(l.default.isTypeAliasDeclaration(t))return s(t.type);if(l.default.isEnumDeclaration(t))return`enum ${t.name.text}`}function ki(t,e){Fi(t,e),wi(t,e),Pi(t,e),Ni(t,e),Ai(t,e),Qr(t,e)}function Fi(t,e){if(!l.default.isSourceFile(t))return;let r=t.statements.filter(s=>!l.default.isEmptyStatement(s));e.totalStatements=r.length,e.exportStatements=r.filter(s=>l.default.isExportDeclaration(s)||l.default.isExportAssignment(s)||Lt(s)).length}function wi(t,e){if(l.default.isJsxElement(t)||l.default.isJsxSelfClosingElement(t)||l.default.isJsxFragment(t)){e.hasUI=!0,e.hasTypesOnly=!1;return}if(l.default.isFunctionDeclaration(t)||l.default.isMethodDeclaration(t)||l.default.isArrowFunction(t)||l.default.isClassDeclaration(t)||l.default.isVariableStatement(t)||l.default.isEnumDeclaration(t)){e.hasTypesOnly=!1;return}l.default.isExportDeclaration(t)&&!Ti(t)&&(e.hasTypesOnly=!1)}function Ti(t){return t.isTypeOnly?!0:!t.exportClause||!l.default.isNamedExports(t.exportClause)?!1:t.exportClause.elements.every(e=>e.isTypeOnly)}function Pi(t,e){if(!l.default.isImportDeclaration(t)||!t.moduleSpecifier||!l.default.isStringLiteral(t.moduleSpecifier))return;let r=[];if(t.importClause&&(t.importClause.name&&r.push("default"),t.importClause.namedBindings))if(l.default.isNamedImports(t.importClause.namedBindings))for(let n of t.importClause.namedBindings.elements)r.push(n.name.text);else l.default.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:E(t.moduleSpecifier.text),type:s,symbols:r.length>0?r:void 0})}function Ni(t,e){l.default.isExportDeclaration(t)?Ii(t,e):l.default.isExportAssignment(t)?e.exports.set("default",{name:"default"}):Lt(t)&&Ri(t,e)}function Ii(t,e){if(t.moduleSpecifier&&l.default.isStringLiteral(t.moduleSpecifier))Mi(t,t.moduleSpecifier.text,e);else if(t.exportClause&&l.default.isNamedExports(t.exportClause))for(let r of t.exportClause.elements){let s=r.name.text;e.exports.set(s,{name:s})}}function Mi(t,e,r){let s=Di(t),n={fromPath:r.filePath,toPath:"",rawSpecifier:e,isStyle:E(e),type:"re-export"};s.length>0&&(n.symbols=s),r.imports.push(n)}function Di(t){return t.exportClause?l.default.isNamedExports(t.exportClause)?t.exportClause.elements.map(e=>e.name.text):[]:["*"]}function Ri(t,e){if((l.default.isFunctionDeclaration(t)||l.default.isClassDeclaration(t)||l.default.isInterfaceDeclaration(t)||l.default.isTypeAliasDeclaration(t)||l.default.isEnumDeclaration(t))&&t.name){let s=t.name.text;e.exports.set(s,Xr(s,t,t,e.sourceFile));return}if(l.default.isVariableStatement(t)){for(let s of t.declarationList.declarations)if(l.default.isIdentifier(s.name)){let n=s.name.text;e.exports.set(n,Xr(n,s,t,e.sourceFile))}}}function Ai(t,e){if(!l.default.isCallExpression(t))return;let r=t.arguments[0];!r||!l.default.isStringLiteral(r)||(t.expression.kind===l.default.SyntaxKind.ImportKeyword?e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:E(r.text),type:"dynamic"}):l.default.isIdentifier(t.expression)&&t.expression.text==="require"&&e.imports.push({fromPath:e.filePath,toPath:"",rawSpecifier:r.text,isStyle:E(r.text),type:"require"}))}function Li(t,e){let r=Rt.default.basename(t).toLowerCase(),s=Rt.default.extname(t).toLowerCase();return X().some(o=>r.includes(o))?"test":Qt(r)?"config":e.imports.some(o=>Je().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>He()?"barrel":"logic"}function Lt(t){return l.default.canHaveModifiers(t)&&l.default.getModifiers(t)?.some(e=>e.kind===l.default.SyntaxKind.ExportKeyword)===!0}function Gi(t,e){let r=t.rawCallEdges??[];t.rawCallEdges=r;let s=new Map;for(let n of e.statements){if(!l.default.isImportDeclaration(n)||!l.default.isStringLiteral(n.moduleSpecifier))continue;let o=n.moduleSpecifier.text,i=n.importClause;if(i&&(i.name&&s.set(i.name.text,o),i.namedBindings&&l.default.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=ji(n);if(o){let i=_i(n);i&&Le(i,o,s,r);continue}l.default.isClassDeclaration(n)&&n.name&&Oi(n,s,r)}}function Oi(t,e,r){let s=t.name.text;for(let n of t.members)l.default.isMethodDeclaration(n)&&n.body&&l.default.isIdentifier(n.name)?Le(n.body,`${s}.${n.name.text}`,e,r):l.default.isConstructorDeclaration(n)&&n.body&&Le(n.body,`${s}.constructor`,e,r)}function ji(t){if(Lt(t)){if(l.default.isFunctionDeclaration(t)&&t.name)return t.name.text;if(l.default.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(l.default.isIdentifier(e.name)&&e.initializer&&(l.default.isArrowFunction(e.initializer)||l.default.isFunctionExpression(e.initializer)))return e.name.text}}}function _i(t){if(l.default.isFunctionDeclaration(t))return t.body;if(l.default.isVariableStatement(t)){for(let e of t.declarationList.declarations)if(e.initializer&&(l.default.isArrowFunction(e.initializer)||l.default.isFunctionExpression(e.initializer)))return e.initializer}}function Le(t,e,r,s){if(l.default.isCallExpression(t)&&l.default.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})}l.default.forEachChild(t,n=>Le(n,e,r,s))}function Ge(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 Gt=f(require("postcss")),Wi=require("postcss-less"),es=new Set(["reference","inline"]);function Yr(t){return t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("data:")}function zi(t){let e=t.trim();return e.length>0&&!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("//")&&!e.startsWith("data:")&&!e.startsWith("#")}function $i(t,e){let r=t.match(/^\(([^)]+)\)\s+['"]([^'"]+)['"]/);if(r){let o=r[1]?.trim()??"",i=r[2]??"";if(!i)return null;let a=es.has(o)?"side-effect":"static";return{fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a,...Yr(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",...Yr(n)?{isExternal:!0}:{}}:null}function Ui(t,e){let r=[],s=/url\(['"]?([^'")]+)['"]?\)/g,n=s.exec(t);for(;n!==null;){let o=n[1]?.trim()??"";zi(o)&&r.push({fromPath:e,toPath:"",rawSpecifier:o,isStyle:!0,type:"static"}),n=s.exec(t)}return r}function ts(t,e){let r=[];return t.walk(s=>{if(s.type==="atrule"&&s.name==="import"){let n=$i(s.params,e);n&&r.push(n)}s.type==="decl"&&r.push(...Ui(s.value,e))}),r}function Bi(t){return t.replace(/(?<!:)\/\/.*/g,"")}function Ji(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=es.has(o)?"side-effect":"static";r.push({fromPath:e,toPath:"",rawSpecifier:i,isStyle:!0,type:a})}n=s.exec(t)}return r}function rs(t,e){let r=Gt.default.parse(Bi(t));return{imports:ts(r,e),root:r}}function ss(t,e){try{let r=Wi.parse(t);return{imports:ts(r,e),root:r}}catch{return{imports:Ji(t,e),root:Gt.default.parse("")}}}var ns=require("postcss-scss");function Ki(t){return!!(t.startsWith("sass:")||t.startsWith("~")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||!t.startsWith(".")&&!t.startsWith("/")&&!t.startsWith("_"))}function Hi(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 os(t,e){let r=(0,ns.parse)(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}=Hi(i);if(!a)return;let p={fromPath:e,toPath:"",rawSpecifier:a,isStyle:!0,type:o==="forward"?"re-export":"static",...Ki(a)?{isExternal:!0}:{}};c&&(p.symbols=[c]),s.push(p)}),{imports:s,root:r}}function is(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 as(t,e){if(e.length===0)return"ui";try{let r=require("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"}}function ie(t,e){let r=M(t);if(r==="stylus"){let o=is(e,t);return{imports:o,exports:[],tags:[],category:as(e,o)}}if(r==="scss"){let{imports:o,root:i}=os(e,t);return{imports:o,exports:[],tags:[],category:Ge(i,o)}}if(r==="less"){let{imports:o,root:i}=ss(e,t);return{imports:o,exports:[],tags:[],category:Ge(i,o)}}let{imports:s,root:n}=rs(e,t);return{imports:s,exports:[],tags:[],category:Ge(n,s)}}for(let[t,e]of[["javascript",(r,s)=>At(r,s,"javascript")],["typescript",(r,s)=>At(r,s,"typescript")],["css",ie],["scss",ie],["less",ie],["stylus",ie],["coffeescript",Or],["livescript",Br],["lua",Kr],["python",Vr],["go",$r],["gherkin",Nt]])_(t,e);async function cs(t,e){let r=M(t),s=xr(r);return s?s(t,e):{imports:[],exports:[],tags:[],category:"other"}}var Oe=f(require("path"));function ls(t,e){for(let r of t.values()){let s=e.get(r.path);s!==void 0&&(r.coveragePct=s)}}function fs(t,e){for(let r of t)if(!r.rawSpecifier.startsWith(".")&&!Oe.default.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 us(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 ps(t){return Math.round(t*1e4)/1e4}function ms(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=ps(Math.min(1,o)),r.push(s.exportUsageRatio)}r.length>0&&(e.avgExportUsage=ps(r.reduce((s,n)=>s+n,0)/r.length),e.maxExportUsage=Math.max(...r))}}function Ot(t,e,r){e&&(t.some(s=>s.name===e&&s.kind===r)||t.push({name:e,kind:r}))}function qi(t,e){let r=e.toPath,s=Oe.default.basename(r,Oe.default.extname(r)).replace(/\.(test|spec)$/,"");Ot(t.tags,s,"import")}function Vi(t,e){if(!(!e.symbols||e.symbols.includes("*")))for(let r of e.symbols)Ot(t.tags,r,"import")}function Qi(t,e,r){let s=r.get(e.toPath);if(!(!s||s.category==="test"))for(let n of s.tags)n.kind==="comment-marker"&&Ot(t.tags,n.name,"comment-marker")}function gs(t){for(let e of t.values())if(e.category==="test")for(let r of e.imports)!r.toPath||r.isExternal||(qi(e,r),Vi(e,r),Qi(e,r,t))}var le=f(require("fs")),P=f(require("path"));var jt=f(require("fs")),A=f(require("path")),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 hs(a);if(r!==o&&!r.startsWith(`${o}/`))return null;let c=r.slice(o.length).replace(/^\//,"");return c?hs(A.default.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=jt.default.readFileSync(A.default.join(e,"go.mod"),"utf-8"),o=Xi(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 A.default.join(o,i)}}}};function Xi(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("=>")){ds(a,e,n);continue}!o&&/^replace\s+/.test(a)&&a.includes("=>")&&ds(a.replace(/^replace\s+/,""),e,n)}return{mod:s,replaces:n}}function ds(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=A.default.isAbsolute(n)?n:A.default.resolve(e,n);r.set(o,i)}function hs(t){let e;try{e=jt.default.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:A.default.join(t,s.name),isExternal:!1})).sort((s,n)=>s.path.localeCompare(n.path));return r.length>0?r:null}var ys=f(require("fs")),je=f(require("path")),ce=class{extensions=[".lua"];resolve(e,r,s,n){let o=r.replace(/\./g,je.default.sep),i=[s,je.default.join(s,"lib")];for(let a of i){if(!ys.default.existsSync(a))continue;let c=n(je.default.join(a,"_dummy.lua"),o);if(c)return[c]}return null}};var Ss=f(require("fs")),_e=f(require("path")),pe=class{extensions=[".py"];resolve(e,r,s,n){let o=r.replace(/\./g,_e.default.sep),i=_e.default.join(s,`${o}.py`);if(xs(i))return[{path:i,isExternal:!1}];let a=_e.default.join(s,o,"__init__.py");return xs(a)?[{path:a,isExternal:!1}]:null}};function xs(t){try{return Ss.default.statSync(t,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}var 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]}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=P.default.dirname(e),n=r.startsWith("/")?r:P.default.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=P.default.join(e,`index${r}`);if(this.isFile(o))return{path:o,isExternal:s};if(r===".py"){let i=P.default.join(e,"__init__.py");if(this.isFile(i))return{path:i,isExternal:s}}return null}isFile(e){try{return le.default.statSync(e,{throwIfNoEntry:!1})?.isFile()===!0}catch{return!1}}resolvePathAlias(e){for(let r of this.tsconfigSearchPaths){let s=P.default.join(r,"tsconfig.json");if(le.default.existsSync(s))try{let o=JSON.parse(le.default.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=P.default.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=P.default.join(s,a);try{if(le.default.statSync(c,{throwIfNoEntry:!1})?.isFile())return{...o,path:c}}catch{}}return{...o,path:s}}let i=this.resolveLocalPath(P.default.join(s,"_dummy"),n.slice(1));return i?{...o,path:i.path}:null}return null}};var Zi=["tests","test","__tests__","specs","spec"];function Yi(t,e){if(t.length===0)return e;let r=t.map(i=>v.default.dirname(i).split(v.default.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(v.default.sep)||v.default.sep,o=v.default.relative(e,n);return o.startsWith("..")||v.default.isAbsolute(o)?e:n}var We=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=Lr(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=>v.default.isAbsolute(s)?s:v.default.resolve(this.rootDir,s));for(let s of r)await this.processFile(s);return await this.processTestFiles(Yi(r,this.rootDir)),this.progressCallback&&this.visited.size>=100&&process.stderr.write(`
24
+ Done. Total processed: ${this.visited.size} nodes.
25
+ `),gs(this.graph.nodes),us(this.graph.nodes),ms(this.graph.nodes),this.coverageMap.size>0&&ls(this.graph.nodes,this.coverageMap),new k(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=ue.default.readdirSync(i,{withFileTypes:!0})}catch{return}for(let c of a){let p=v.default.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=v.default.dirname(o);if(i===o)break;for(let a of Zi){let c=v.default.join(i,a);try{ue.default.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=ue.default.statSync(e,{throwIfNoEntry:!1});if(!r?.isFile())return;let s=v.default.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);fs(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=ue.default.readFileSync(e,"utf-8");try{return await cs(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:v.default.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=Dr(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:v.default.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)}};function bs(t,e){return{identifier:e?.identifier??new Re,featureMap:e?.featureDetection===!1?new Map:D(t.nodes,e?.featureDetection??void 0)}}function vs(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 _t(t,e,r){let{identifier:s,featureMap:n}=bs(t,r),o=new Set;for(let i of e){let a=n.get(i);a&&o.add(a.tag)}return vs(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 Wt(t,e,r){let{identifier:s,featureMap:n}=bs(t,r),o=new Set;return vs(t,e,n,()=>{},i=>{s.isTestNode(i)&&o.add(i.path)}),Array.from(o)}var Cs=f(require("fs")),me=f(require("path"));async function F(t,e,r=null,s={}){let n=s.silent?void 0:i=>{process.stderr.write(`Processed ${i} files...\r`)};return await new We(me.default.resolve(t),r,void 0,n,s.gitStats??!1,s.coverageMap??new Map).build(e)}function w(t,e={}){let r=[],s=new Set([...e.ignoreDirs??Qe,...e.additionalIgnoreDirs??[]]),n=new Set([...e.extensions??Xe,...e.additionalExtensions??[]]);function o(i){try{let a=Cs.default.readdirSync(i,{withFileTypes:!0});for(let c of a){let p=me.default.join(i,c.name);c.isDirectory()?s.has(c.name)||o(p):c.isFile()&&n.has(me.default.extname(c.name).toLowerCase())&&r.push(me.default.relative(t,p))}}catch{}}return o(t),r}var q=f(require("path")),Fs=require("util");var Es="mokosh-cache",ks="graph.json";function ra(t){for(let e=0;e<t.length;e++)if(t[e]==="--root"&&t[e+1])return q.default.resolve(t[e+1]);return process.cwd()}var zt={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"}},sa=new Set(Object.entries(zt).filter(([,t])=>t.type==="string").map(([t])=>`--${t}`));function na(t){let e=[];for(let r=0;r<t.length;r++){let s=t[r];if(!s.startsWith("--"))e.push(s);else if(sa.has(s)){let n=t[r+1];n!==void 0&&!n.startsWith("--")&&(e.push(s,n),r++)}else s.slice(2)in zt&&e.push(s)}return e}function ws(t){let e=ra(t),r=q.default.join(q.default.resolve(e,Es),ks),{values:s,positionals:n}=(0,Fs.parseArgs)({args:na(t),allowPositionals:!0,options:zt}),o=s["feature-threshold"],i=s["min-out-degree"],a=s.paths,c=s.cache,p=s.config;return{rootDir:e,cachePath:c?q.default.resolve(e,c):r,configPath:p?q.default.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 ze=f(require("path"));var oa=[".test.",".spec.","-test.","-spec."];function L(t){return t.filter(e=>{let r=ze.default.basename(e).toLowerCase();return oa.some(s=>r.includes(s))})}function $e(t){return new Ae().getChangedFiles().map(e=>ze.default.relative(t,ze.default.resolve(t,e)))}async function Ts(t){let{graph:e}=t,{rootDir:r,scanOptions:s,featureThreshold:n}=t,o=$e(r);if(![...e.nodes.values()].some(c=>L([c.path]).length>0)){let c=w(r,s);e=await F(r,L(c),e)}let a=Wt(e,o,{...n!==void 0&&{featureDetection:{minOutDegree:n}}});console.log(a.join(`
28
+ `))}async function Ps(t){let{graph:e,rootDir:r,entryPoints:s}=t,n=s.length?s:et(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=tt(e,n);console.log(JSON.stringify(o,null,2))}async function Ns(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=w(r,s);e=await F(r,L(a),e)}let i=await kt(e,r,{dryRun:n});console.log(JSON.stringify(i,null,2))}async function Is(t){let{graph:e,functionName:r}=t;r||(console.error("Error: --call-graph requires --function <name>"),process.exit(1));let s=rt(e,r);console.log(JSON.stringify(s,null,2))}async function Ms(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))}async function Ds(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.")}async function Rs(t){let{graph:e}=t,{rootDir:r,scanOptions:s,featureThreshold:n}=t;if(e.nodes.size===0){let a=w(r,s);e=await F(r,a,e)}let o=D(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))}async function As(t){let{graph:e}=t,{rootDir:r,scanOptions:s,minOutDegree:n}=t;if(e.nodes.size===0){let a=w(r,s);e=await F(r,a,e)}let o=Y(e,n!==void 0?{minOutDegree:n}:void 0),i=Object.fromEntries(o.features);console.log(JSON.stringify({features:i,unassigned:o.unassigned},null,2))}async function Ls(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 Gs=f(require("path"));var ia=[".test.",".spec.","-test.","-spec.",".stories."];function aa(t){let e=Gs.default.basename(t).toLowerCase();return ia.some(r=>e.includes(r))}async function Os(t){let{graph:e,rootDir:r,scanOptions:s,excludeTests:n}=t,o=w(r,s),i=e.findUnusedFiles(o);n&&(i=i.filter(a=>!aa(a))),console.log(JSON.stringify({unusedFiles:i},null,2))}async function js(t){let{graph:e,queryStr:r,mermaidOutput:s}=t,n=e.serialize();if(r){let o=ke(r);n=Ee(n,o)}if(s){let o=k.deserialize(n);console.log(Se.serialize(o))}else{let o=e.findCycles();o.length>0&&(n.cycles=o),console.log(JSON.stringify(n,null,2))}}async function _s(t){let{graph:e,filterPaths:r,minOutDegree:s}=t,n=st(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))}}async function Ws(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=$e(r);if(e.nodes.size===0){let c=w(r,s);e=await F(r,L(c),e)}let a=_t(e,i,{...n!==void 0&&{featureDetection:{minOutDegree:n}}});console.log(o?a.join(" "):JSON.stringify({proposedTags:a},null,2))}async function zs(t){let{graph:e,typeFilter:r}=t,s=nt(e);if(r){let n=ot(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 Ue=f(require("path"));function $s(t){let{rootDir:e,entryPoints:r,cachePath:s,configPath:n}=t,o=n?G(n,{isExplicitPath:!0}):G(e),i=Ue.default.join(Ue.default.resolve(e,"mokosh-cache"),"graph.json"),a=r.length>0?r:o.entryPoints??[],c=s!==i?s??i:o.cachePath?Ue.default.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 V=f(require("fs")),Us=f(require("path"));function Bs(t){if(!V.default.existsSync(t))return null;let e=V.default.readFileSync(t,"utf-8");return k.deserialize(JSON.parse(e))}function Js(t,e){let r=Us.default.dirname(e);V.default.existsSync(r)||V.default.mkdirSync(r,{recursive:!0}),V.default.writeFileSync(e,JSON.stringify(t.serialize(),null,2))}async function Ks(t,e,r,s=!1,n=!1){return F(t,e,r,{silent:s,gitStats:n})}var Hs=`
33
+ Usage: mokosh [options] <entry-point1> <entry-point2> ...
34
+
35
+ Options:
36
+ --cache [file] Path to cache file (default: mokosh-cache/graph.json)
37
+ --config <file> Path to mokosh config file (overrides auto-discovery)
38
+ --mermaid Output Mermaid chart instead of JSON
39
+ --propose-tags Propose test tags based on git diff
40
+ --plain Output tags as plain text instead of JSON (use with --propose-tags)
41
+ --affected-tests List test files affected by git diff
42
+ --apply-tags Write @tag annotations into test files from graph tags
43
+ --dry-run Preview tag changes without writing to disk (use with --apply-tags)
44
+ --detect-features Output files with high out-degree (orchestrators/aggregators)
45
+ --feature-threshold <N> Min internal imports to be a feature hub (default: 5)
46
+ --find-unused Find files that are not reachable from entry points
47
+ --exclude-tests Exclude test files from --find-unused output
48
+ --check-cycles Check for circular dependencies; exits non-zero if found (CI gate)
49
+ --type-graph Output type-level graph (interfaces, classes, enums, type aliases)
50
+ --type <name> Filter --type-graph to a single type name
51
+ --module-responsibility Output each file's semantic role, description, and exports
52
+ --paths <a,b,...> Comma-separated file paths to filter --module-responsibility output
53
+ --min-out-degree <N> Min internal imports for hub detection (--module-responsibility, --feature-graph)
54
+ --feature-graph Group files into feature domains under their hub orchestrators
55
+ --call-graph Look up callers and callees for a named function
56
+ --function <name> Function name to look up with --call-graph
57
+ --api-surface Output the public API surface (expands export * chains)
58
+ --silent Suppress progress output on stderr
59
+ --query <query> Filter output using a query (e.g., category:logic,tag:auth)
60
+ --query-help Show all supported query filter keys and examples
61
+ --root <dir> Project root directory (default: current directory)
62
+ --help Show help
63
+
64
+ Notes:
65
+ Add mokosh-cache/ to your .gitignore to avoid committing the cache directory.
66
+ `,qs=`
67
+ Query filter reference (--query "key:value,key:value,...")
68
+ All keys are case-insensitive. Multiple keys are AND'd together.
69
+
70
+ FILTERING
71
+ category:<value> Exact match on file category. Negate with !.
72
+ Values: logic | ui | test | config | barrel | type-only | other
73
+ Examples: category:logic category:!test
74
+
75
+ type:<value> Exact match on language. Negate with !.
76
+ Values: typescript | javascript | css | scss | less | stylus |
77
+ coffeescript | livescript | lua | gherkin
78
+ Example: type:typescript
79
+
80
+ tag:<value> File has this tag (OR across multiple tag: entries).
81
+ Negate with ! to exclude. Use + to require all (AND).
82
+ Examples: tag:auth (has "auth")
83
+ tag:!generated (does not have "generated")
84
+ tag:auth+core (has both "auth" AND "core")
85
+
86
+ path:<substr> File path contains substring. Negate with !.
87
+ Examples: path:src/api path:!__tests__
88
+
89
+ external:<bool> true = node has at least one external (node_modules) import.
90
+ Example: external:true
91
+
92
+ importsFile:<substr> Node directly imports a file whose path contains the substring.
93
+ Example: importsFile:src/utils/logger
94
+
95
+ importedBy:<substr> Node is directly imported by a file whose path contains the substring.
96
+ Example: importedBy:src/index
97
+
98
+ minImports:<N> Out-degree (direct import count) >= N.
99
+ maxImports:<N> Out-degree <= N.
100
+ Examples: minImports:5 maxImports:2
101
+
102
+ minSize:<bytes> File size >= N bytes.
103
+ maxSize:<bytes> File size <= N bytes.
104
+ Examples: minSize:1024 maxSize:4096
105
+
106
+ hasDocstring:<bool> true = node has a JSDoc description on its first statement.
107
+ false = undocumented files only.
108
+ Example: hasDocstring:false
109
+
110
+ SORTING & LIMITING (applied after all filters)
111
+ sort:<field> Sort results descending by one of:
112
+ size \u2014 file size in bytes
113
+ imports \u2014 number of direct imports
114
+ commitCount90d \u2014 commits in the last 90 days (requires gitStats: true)
115
+ Example: sort:imports
116
+
117
+ limit:<N> Return at most N results.
118
+ Example: limit:20
119
+
120
+ COMMON PATTERNS
121
+ Token-efficient context (logic only):
122
+ --query "category:logic"
123
+
124
+ Undocumented logic files:
125
+ --query "category:logic,hasDocstring:false"
126
+
127
+ 10 most-imported files in a subsystem:
128
+ --query "path:src/api,sort:imports,limit:10"
129
+
130
+ Files using a specific library:
131
+ --query "tag:react,category:logic"
132
+
133
+ Files that import a specific module:
134
+ --query "importsFile:src/auth/session"
135
+
136
+ Large TypeScript logic files:
137
+ --query "type:typescript,category:logic,sort:size,limit:5"
138
+ `;async function Vs(){let t=process.argv.slice(2),e=ws(t);e.help&&(console.log(Hs),process.exit(0)),e.queryHelp&&(console.log(qs),process.exit(0));let r=$s(e);Ve(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:N,callers:Q,file:Qs,silent:Xs,featureThreshold:Zs,query:Ys,mermaid:en,typeGraph:$t,typeFilter:tn,moduleResponsibility:Ut,filterPaths:rn,minOutDegree:sn,featureGraph:nn,callGraph:Bt,functionName:on,apiSurface:Jt,applyTags:Kt,dryRun:an}=e,Ht=a||p||Kt||Q||h||$t||Ut||Bt||Jt,ge=Bs(o)??new k(new Map);(n.length>0||!Ht)&&(n.length===0&&!Ht&&!m&&!u&&!N&&(console.error("Error: No entry points provided"),process.exit(1)),ge=await Ks(s,n,ge,Xs,r.rawConfig.gitStats??!1),Js(ge,o));let cn={graph:ge,rootDir:s,entryPoints:n.map(Be=>Be.replace(s+"/","")),scanOptions:i,rawConfig:r.rawConfig,featureThreshold:Zs,queryStr:Ys,mermaidOutput:en,plain:c,excludeTests:x,file:Qs,typeFilter:tn,filterPaths:rn,minOutDegree:sn,functionName:on,dryRun:an};await([[a,Ws],[Kt,Ns],[p,Ts],[u,Rs],[m,Os],[N,Ds],[h,Ls],[Q,Ms],[$t,zs],[Ut,_s],[nn,As],[Bt,Is],[Jt,Ps]].find(([Be])=>Be)?.[1]??js)(cn)}Vs().catch(t=>{console.error(t),process.exit(1)});
139
+ //# sourceMappingURL=cli.js.map