@omfalos/mokosh 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +83 -29
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +83 -29
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +147 -195
- package/dist/index.d.ts +147 -195
- package/dist/index.js +17 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -16
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +18 -16
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +18 -16
- package/dist/mcp.mjs.map +1 -1
- package/dist/parse-worker.d.mts +10 -0
- package/dist/parse-worker.d.ts +10 -0
- package/dist/parse-worker.js +2 -0
- package/dist/parse-worker.js.map +1 -0
- package/dist/parse-worker.mjs +2 -0
- package/dist/parse-worker.mjs.map +1 -0
- package/dist/types-C9fLCS45.d.mts +99 -0
- package/dist/types-C9fLCS45.d.ts +99 -0
- package/package.json +5 -2
- package/templates/config/mokosh.config.js +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,174 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @description Top-level configuration for mokosh. All fields are optional; unset fields
|
|
6
|
-
* fall back to built-in defaults. Load this object via `loadMokoshConfig`, then activate
|
|
7
|
-
* it with `applyConfig` before calling `createImportMap`.
|
|
8
|
-
*/
|
|
9
|
-
interface MokoshConfig {
|
|
10
|
-
/** Additional directories to skip when scanning (merged with built-in defaults). */
|
|
11
|
-
ignoreDirs?: string[];
|
|
12
|
-
/** Additional file extensions to scan (merged with built-in defaults). */
|
|
13
|
-
extensions?: string[];
|
|
14
|
-
/** Override the default cache path (`mokosh-cache/graph.json`). */
|
|
15
|
-
cachePath?: string;
|
|
16
|
-
/** Default entry points used when none are provided on the CLI. */
|
|
17
|
-
entryPoints?: string[];
|
|
18
|
-
/** Additional basename substrings that mark a file as `"config"` category. */
|
|
19
|
-
configMatchers?: string[];
|
|
20
|
-
/** Additional basename substrings that mark a file as `"test"` category (e.g. `".unit."`). */
|
|
21
|
-
testPatterns?: string[];
|
|
22
|
-
/** Additional import specifiers that indicate a test file (e.g. `"@my-org/test-utils"`). */
|
|
23
|
-
testLibraries?: string[];
|
|
24
|
-
/** Ratio of export-statements to total statements required for `"barrel"` classification. Default: `0.8`. */
|
|
25
|
-
barrelThreshold?: number;
|
|
26
|
-
/** When true, enriches each node with `commitCount90d` and `lastAuthor` via git log. Only fetched for new/modified files. */
|
|
27
|
-
gitStats?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Tag-applier configuration for `--apply-tags`. Controls which format is written into
|
|
30
|
-
* test files. Defaults to `{ framework: "vitest" }` when unset.
|
|
31
|
-
*/
|
|
32
|
-
tagApplier?: {
|
|
33
|
-
/**
|
|
34
|
-
* Fallback test framework whose tag format to use for TS/JS files. Each file's actual
|
|
35
|
-
* framework is auto-detected from its imports (`@playwright/test`, `cypress`,
|
|
36
|
-
* `@jest/globals`, `vitest`), so a single repo can mix frameworks and each file is tagged
|
|
37
|
-
* in its own native format. This value is only used when a file has no detectable
|
|
38
|
-
* framework import (e.g. `globals: true` configs with no explicit import).
|
|
39
|
-
* - `"vitest"` — injects `{ tags: [...] }` in describe/test/it options (default)
|
|
40
|
-
* - `"playwright"` — injects `{ tag: ["@name"] }` with `@` prefix convention
|
|
41
|
-
* - `"cypress"` — injects `{ tags: ["@name"] }` for use with `@cypress/grep`
|
|
42
|
-
* - `"jest"` — writes a `/** @group name *\/` docblock for use with `jest-runner-groups`
|
|
43
|
-
*/
|
|
44
|
-
framework?: TagFramework;
|
|
45
|
-
/**
|
|
46
|
-
* Path-glob pattern (project-relative, e.g. `"tests/e2e/**"`) to fallback framework. Checked
|
|
47
|
-
* in object key order, first match wins, before falling back further to `framework`. Only
|
|
48
|
-
* consulted when a file's own imports don't reveal a framework — lets different directories
|
|
49
|
-
* default to different frameworks (e.g. e2e tests using Playwright globals, unit tests using
|
|
50
|
-
* Jest globals) instead of sharing one project-wide default.
|
|
51
|
-
*/
|
|
52
|
-
frameworkOverrides?: Record<string, TagFramework>;
|
|
53
|
-
};
|
|
54
|
-
/** Path to the Istanbul/v8 `coverage-summary.json` file, relative to the project root. When set, `coveragePct` is populated on each node after the graph is built. */
|
|
55
|
-
coverageReportPath?: string;
|
|
56
|
-
/** Default line-coverage threshold (0–100) used by `find_uncovered`. Defaults to `80` when not specified. */
|
|
57
|
-
coverageThreshold?: number;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* @description Loads a mokosh config file, probing standard filenames in `rootDirOrPath` or reading an explicit path when `isExplicitPath` is true.
|
|
61
|
-
* JS/CJS configs may export a plain object or a factory function; the MCP server passes `allowJs: false` to prevent arbitrary code execution.
|
|
62
|
-
* @param {string} rootDirOrPath - Directory to probe for standard config filenames, or absolute path to the config file when `isExplicitPath` is true.
|
|
63
|
-
* @param {{ allowJs?: boolean; isExplicitPath?: boolean }} options - `allowJs` (default `true`) controls whether `.js`/`.cjs` files are loaded; `isExplicitPath` treats the first arg as a direct file path.
|
|
64
|
-
* @returns {MokoshConfig} The parsed config, or an empty object when no config file is found.
|
|
65
|
-
*/
|
|
66
|
-
declare function loadMokoshConfig(rootDirOrPath: string, { allowJs, isExplicitPath }?: {
|
|
67
|
-
allowJs?: boolean;
|
|
68
|
-
isExplicitPath?: boolean;
|
|
69
|
-
}): MokoshConfig;
|
|
70
|
-
/**
|
|
71
|
-
* @description Applies a `MokoshConfig` to the global registries that control classification and scanning.
|
|
72
|
-
* Call this after `loadMokoshConfig` and before `createImportMap`.
|
|
73
|
-
* @param {MokoshConfig} config - The loaded config whose matchers, patterns, libraries, and thresholds are registered.
|
|
74
|
-
*/
|
|
75
|
-
declare function applyConfig(config: MokoshConfig): void;
|
|
76
|
-
|
|
77
|
-
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
78
|
-
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
79
|
-
interface ScanOptions {
|
|
80
|
-
/** Replaces the default ignore-dir list. Use `additionalIgnoreDirs` to extend instead. */
|
|
81
|
-
ignoreDirs?: string[];
|
|
82
|
-
/** Replaces the default extension list. Use `additionalExtensions` to extend instead. */
|
|
83
|
-
extensions?: string[];
|
|
84
|
-
/** Merged with `DEFAULT_IGNORE_DIRS` (additive). */
|
|
85
|
-
additionalIgnoreDirs?: string[];
|
|
86
|
-
/** Merged with `DEFAULT_EXTENSIONS` (additive). */
|
|
87
|
-
additionalExtensions?: string[];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @description Reads an Istanbul/v8 `coverage-summary.json` file and returns a map of
|
|
92
|
-
* project-relative file paths to their line-coverage percentage (0–100).
|
|
93
|
-
* Returns an empty map when the file is missing, unreadable, or malformed — the
|
|
94
|
-
* caller can always proceed safely with no coverage data.
|
|
95
|
-
* @param rootDir - Absolute path to the project root; used to make paths relative.
|
|
96
|
-
* @param reportPath - Path to the coverage summary JSON, relative to `rootDir`.
|
|
97
|
-
* @returns A map of `relativePath → lineCoveragePct`.
|
|
98
|
-
*/
|
|
99
|
-
declare function loadCoverageMap(rootDir: string, reportPath: string): Map<string, number>;
|
|
100
|
-
|
|
101
|
-
type FileType = "javascript" | "typescript" | "css" | "scss" | "less" | "stylus" | "coffeescript" | "livescript" | "lua" | "gherkin" | "python" | "go" | "unknown";
|
|
102
|
-
type ImportType = "static" | "dynamic" | "require" | "re-export" | "side-effect";
|
|
103
|
-
type NodeCategory = "logic" | "ui" | "type-only" | "config" | "test" | "barrel" | "other";
|
|
104
|
-
type TagKind = "function" | "class" | "variable" | "type" | "import" | "library" | "comment-marker";
|
|
105
|
-
|
|
106
|
-
interface StructuredTag {
|
|
107
|
-
name: string;
|
|
108
|
-
kind: TagKind;
|
|
109
|
-
}
|
|
110
|
-
interface ExportedSymbol {
|
|
111
|
-
name: string;
|
|
112
|
-
doc?: string;
|
|
113
|
-
flags?: string[];
|
|
114
|
-
signature?: string;
|
|
115
|
-
}
|
|
116
|
-
interface ImportEdge {
|
|
117
|
-
fromPath: string;
|
|
118
|
-
toPath: string;
|
|
119
|
-
isStyle: boolean;
|
|
120
|
-
rawSpecifier: string;
|
|
121
|
-
type: ImportType;
|
|
122
|
-
symbols?: string[] | undefined;
|
|
123
|
-
isExternal?: boolean | undefined;
|
|
124
|
-
version?: string | undefined;
|
|
125
|
-
/** True when this import resolves to a sibling workspace package rather than an external npm dep. */
|
|
126
|
-
isWorkspace?: boolean | undefined;
|
|
127
|
-
/** The workspace package name (e.g. `"@myorg/shared"`) when `isWorkspace` is true. */
|
|
128
|
-
workspacePackage?: string | undefined;
|
|
129
|
-
/** Fraction of the target's exports consumed by this import (0–1). Only present for internal non-side-effect imports where the target has at least one export. */
|
|
130
|
-
exportUsageRatio?: number;
|
|
131
|
-
}
|
|
132
|
-
interface CallEdge {
|
|
133
|
-
from: string;
|
|
134
|
-
to: string;
|
|
135
|
-
toFile: string;
|
|
136
|
-
}
|
|
137
|
-
interface FunctionComplexity {
|
|
138
|
-
name: string;
|
|
139
|
-
line: number;
|
|
140
|
-
complexity: number;
|
|
141
|
-
cognitiveComplexity: number;
|
|
142
|
-
}
|
|
143
|
-
interface GraphNode {
|
|
144
|
-
path: string;
|
|
145
|
-
type: FileType;
|
|
146
|
-
category: NodeCategory;
|
|
147
|
-
imports: ImportEdge[];
|
|
148
|
-
exports: ExportedSymbol[];
|
|
149
|
-
tags: StructuredTag[];
|
|
150
|
-
}
|
|
151
|
-
interface FileNode extends GraphNode {
|
|
152
|
-
mtime: number;
|
|
153
|
-
size: number;
|
|
154
|
-
description?: string;
|
|
155
|
-
testedBy?: string[];
|
|
156
|
-
commitCount90d?: number;
|
|
157
|
-
lastAuthor?: string;
|
|
158
|
-
callEdges?: CallEdge[];
|
|
159
|
-
/** Line coverage percentage (0–100) from the last coverage report. Undefined when no report was loaded. */
|
|
160
|
-
coveragePct?: number;
|
|
161
|
-
/** Average exportUsageRatio across all outgoing internal import edges that have a computable ratio. */
|
|
162
|
-
avgExportUsage?: number;
|
|
163
|
-
/** Highest single-edge exportUsageRatio for this file — identifies the dependency whose API surface is most consumed. */
|
|
164
|
-
maxExportUsage?: number;
|
|
165
|
-
/** McCabe cyclomatic complexity (base 1). Counts independent decision paths through the file. Only present for TypeScript/JavaScript files. */
|
|
166
|
-
complexity?: number;
|
|
167
|
-
/** Cognitive complexity — nesting-penalised difficulty score. Higher values indicate harder-to-read code. Only present for TypeScript/JavaScript files. */
|
|
168
|
-
cognitiveComplexity?: number;
|
|
169
|
-
/** Per-function complexity breakdown. Covers named function declarations, const-assigned arrow/function expressions, and class methods/constructors/accessors — anonymous inline callbacks are not included. Only present for TypeScript/JavaScript files. */
|
|
170
|
-
functions?: FunctionComplexity[];
|
|
171
|
-
}
|
|
1
|
+
import { F as FileNode, C as CallEdge, I as ImportEdge, a as FileType, P as ParseResult, S as StructuredTag } from './types-C9fLCS45.mjs';
|
|
2
|
+
export { E as ExportedSymbol, b as ImportType, N as NodeCategory, T as TagKind } from './types-C9fLCS45.mjs';
|
|
172
3
|
|
|
173
4
|
interface SerializedGraph {
|
|
174
5
|
nodes: FileNode[];
|
|
@@ -283,6 +114,121 @@ declare class Graph {
|
|
|
283
114
|
findCycles(): string[][];
|
|
284
115
|
}
|
|
285
116
|
|
|
117
|
+
/** Configures whether/how `parseFile` calls are offloaded to a `piscina` worker pool. `false` always parses in-process. */
|
|
118
|
+
type ParallelParsingOption = boolean | {
|
|
119
|
+
minFiles?: number;
|
|
120
|
+
maxThreads?: number;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/** Tag applier strategy interface — one implementation per testing framework. */
|
|
124
|
+
type TagFramework = "vitest" | "playwright" | "cypress" | "jest";
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @description Top-level configuration for mokosh. All fields are optional; unset fields
|
|
128
|
+
* fall back to built-in defaults. Load this object via `loadMokoshConfig`, then activate
|
|
129
|
+
* it with `applyConfig` before calling `createImportMap`.
|
|
130
|
+
*/
|
|
131
|
+
interface MokoshConfig {
|
|
132
|
+
/** Additional directories to skip when scanning (merged with built-in defaults). */
|
|
133
|
+
ignoreDirs?: string[];
|
|
134
|
+
/** Additional file extensions to scan (merged with built-in defaults). */
|
|
135
|
+
extensions?: string[];
|
|
136
|
+
/** Override the default cache path (`mokosh-cache/graph.json`). */
|
|
137
|
+
cachePath?: string;
|
|
138
|
+
/** Default entry points used when none are provided on the CLI. */
|
|
139
|
+
entryPoints?: string[];
|
|
140
|
+
/** Additional basename substrings that mark a file as `"config"` category. */
|
|
141
|
+
configMatchers?: string[];
|
|
142
|
+
/** Additional basename substrings that mark a file as `"test"` category (e.g. `".unit."`). */
|
|
143
|
+
testPatterns?: string[];
|
|
144
|
+
/** Additional import specifiers that indicate a test file (e.g. `"@my-org/test-utils"`). */
|
|
145
|
+
testLibraries?: string[];
|
|
146
|
+
/** Ratio of export-statements to total statements required for `"barrel"` classification. Default: `0.8`. */
|
|
147
|
+
barrelThreshold?: number;
|
|
148
|
+
/** When true, enriches each node with `commitCount90d` and `lastAuthor` via git log. Only fetched for new/modified files. */
|
|
149
|
+
gitStats?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Tag-applier configuration for `--apply-tags`. Controls which format is written into
|
|
152
|
+
* test files. Defaults to `{ framework: "vitest" }` when unset.
|
|
153
|
+
*/
|
|
154
|
+
tagApplier?: {
|
|
155
|
+
/**
|
|
156
|
+
* Fallback test framework whose tag format to use for TS/JS files. Each file's actual
|
|
157
|
+
* framework is auto-detected from its imports (`@playwright/test`, `cypress`,
|
|
158
|
+
* `@jest/globals`, `vitest`), so a single repo can mix frameworks and each file is tagged
|
|
159
|
+
* in its own native format. This value is only used when a file has no detectable
|
|
160
|
+
* framework import (e.g. `globals: true` configs with no explicit import).
|
|
161
|
+
* - `"vitest"` — injects `{ tags: [...] }` in describe/test/it options (default)
|
|
162
|
+
* - `"playwright"` — injects `{ tag: ["@name"] }` with `@` prefix convention
|
|
163
|
+
* - `"cypress"` — injects `{ tags: ["@name"] }` for use with `@cypress/grep`
|
|
164
|
+
* - `"jest"` — writes a `/** @group name *\/` docblock for use with `jest-runner-groups`
|
|
165
|
+
*/
|
|
166
|
+
framework?: TagFramework;
|
|
167
|
+
/**
|
|
168
|
+
* Path-glob pattern (project-relative, e.g. `"tests/e2e/**"`) to fallback framework. Checked
|
|
169
|
+
* in object key order, first match wins, before falling back further to `framework`. Only
|
|
170
|
+
* consulted when a file's own imports don't reveal a framework — lets different directories
|
|
171
|
+
* default to different frameworks (e.g. e2e tests using Playwright globals, unit tests using
|
|
172
|
+
* Jest globals) instead of sharing one project-wide default.
|
|
173
|
+
*/
|
|
174
|
+
frameworkOverrides?: Record<string, TagFramework>;
|
|
175
|
+
};
|
|
176
|
+
/** Path to the Istanbul/v8 `coverage-summary.json` file, relative to the project root. When set, `coveragePct` is populated on each node after the graph is built. */
|
|
177
|
+
coverageReportPath?: string;
|
|
178
|
+
/** Default line-coverage threshold (0–100) used by `find_uncovered`. Defaults to `80` when not specified. */
|
|
179
|
+
coverageThreshold?: number;
|
|
180
|
+
/**
|
|
181
|
+
* Controls worker-pool offloading of file parsing (see docs/adr-010-parallel-parsing.md).
|
|
182
|
+
* `true`/unset (default) enables it once a cheap pre-scan finds at least `minFiles`
|
|
183
|
+
* (default 20) files; parsing a file is fast enough in most repos that the pool's
|
|
184
|
+
* per-thread startup cost only pays off past roughly 600-700 files, so small/typical
|
|
185
|
+
* repos may see slightly slower builds under the default — set `false` to always parse
|
|
186
|
+
* in-process, or pass `{ minFiles, maxThreads }` to raise the threshold instead.
|
|
187
|
+
*/
|
|
188
|
+
parallelParsing?: ParallelParsingOption;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @description Loads a mokosh config file, probing standard filenames in `rootDirOrPath` or reading an explicit path when `isExplicitPath` is true.
|
|
192
|
+
* JS/CJS configs may export a plain object or a factory function; the MCP server passes `allowJs: false` to prevent arbitrary code execution.
|
|
193
|
+
* @param {string} rootDirOrPath - Directory to probe for standard config filenames, or absolute path to the config file when `isExplicitPath` is true.
|
|
194
|
+
* @param {{ allowJs?: boolean; isExplicitPath?: boolean }} options - `allowJs` (default `true`) controls whether `.js`/`.cjs` files are loaded; `isExplicitPath` treats the first arg as a direct file path.
|
|
195
|
+
* @returns {MokoshConfig} The parsed config, or an empty object when no config file is found.
|
|
196
|
+
*/
|
|
197
|
+
declare function loadMokoshConfig(rootDirOrPath: string, { allowJs, isExplicitPath }?: {
|
|
198
|
+
allowJs?: boolean;
|
|
199
|
+
isExplicitPath?: boolean;
|
|
200
|
+
}): MokoshConfig;
|
|
201
|
+
/**
|
|
202
|
+
* @description Applies a `MokoshConfig` to the global registries that control classification and scanning.
|
|
203
|
+
* Call this after `loadMokoshConfig` and before `createImportMap`.
|
|
204
|
+
* @param {MokoshConfig} config - The loaded config whose matchers, patterns, libraries, and thresholds are registered.
|
|
205
|
+
*/
|
|
206
|
+
declare function applyConfig(config: MokoshConfig): void;
|
|
207
|
+
|
|
208
|
+
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
209
|
+
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
210
|
+
interface ScanOptions {
|
|
211
|
+
/** Replaces the default ignore-dir list. Use `additionalIgnoreDirs` to extend instead. */
|
|
212
|
+
ignoreDirs?: string[];
|
|
213
|
+
/** Replaces the default extension list. Use `additionalExtensions` to extend instead. */
|
|
214
|
+
extensions?: string[];
|
|
215
|
+
/** Merged with `DEFAULT_IGNORE_DIRS` (additive). */
|
|
216
|
+
additionalIgnoreDirs?: string[];
|
|
217
|
+
/** Merged with `DEFAULT_EXTENSIONS` (additive). */
|
|
218
|
+
additionalExtensions?: string[];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @description Reads an Istanbul/v8 `coverage-summary.json` file and returns a map of
|
|
223
|
+
* project-relative file paths to their line-coverage percentage (0–100).
|
|
224
|
+
* Returns an empty map when the file is missing, unreadable, or malformed — the
|
|
225
|
+
* caller can always proceed safely with no coverage data.
|
|
226
|
+
* @param rootDir - Absolute path to the project root; used to make paths relative.
|
|
227
|
+
* @param reportPath - Path to the coverage summary JSON, relative to `rootDir`.
|
|
228
|
+
* @returns A map of `relativePath → lineCoveragePct`.
|
|
229
|
+
*/
|
|
230
|
+
declare function loadCoverageMap(rootDir: string, reportPath: string): Map<string, number>;
|
|
231
|
+
|
|
286
232
|
/**
|
|
287
233
|
* Coarse kind of a public export derived from its type signature prefix.
|
|
288
234
|
* Used to distinguish runtime values from type-only exports without parsing the full signature.
|
|
@@ -1033,26 +979,6 @@ declare function registerTestPattern(pattern: string): void;
|
|
|
1033
979
|
*/
|
|
1034
980
|
declare function registerTestLibrary(lib: string): void;
|
|
1035
981
|
|
|
1036
|
-
interface RawCallEdge {
|
|
1037
|
-
from: string;
|
|
1038
|
-
to: string;
|
|
1039
|
-
toSpecifier: string;
|
|
1040
|
-
}
|
|
1041
|
-
interface ParseResult {
|
|
1042
|
-
imports: ImportEdge[];
|
|
1043
|
-
exports: ExportedSymbol[];
|
|
1044
|
-
tags: StructuredTag[];
|
|
1045
|
-
category: NodeCategory;
|
|
1046
|
-
rawCallEdges?: RawCallEdge[];
|
|
1047
|
-
description?: string;
|
|
1048
|
-
/** McCabe cyclomatic complexity of the file (base 1, undefined for non-TS/JS files). */
|
|
1049
|
-
complexity?: number;
|
|
1050
|
-
/** Cognitive complexity — nesting-aware difficulty score (undefined for non-TS/JS files). */
|
|
1051
|
-
cognitiveComplexity?: number;
|
|
1052
|
-
/** Per-function complexity breakdown (undefined for non-TS/JS files). */
|
|
1053
|
-
functions?: FunctionComplexity[];
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
982
|
/** Parser registry: maps FileType values to parser functions and provides lookup by file type. */
|
|
1057
983
|
|
|
1058
984
|
type ParserFunction = (filePath: string, content: string) => ParseResult | Promise<ParseResult>;
|
|
@@ -1088,7 +1014,9 @@ interface NodeQuery {
|
|
|
1088
1014
|
maxImports?: number;
|
|
1089
1015
|
minSize?: number;
|
|
1090
1016
|
maxSize?: number;
|
|
1091
|
-
sort?: "size" | "imports" | "commitCount90d" | "exportUsage";
|
|
1017
|
+
sort?: "size" | "imports" | "commitCount90d" | "exportUsage" | "complexity" | "cognitiveComplexity";
|
|
1018
|
+
/** Sort direction for `sort`. Defaults to `"desc"`, matching the pre-existing always-descending behavior. */
|
|
1019
|
+
sortDir?: "asc" | "desc";
|
|
1092
1020
|
limit?: number;
|
|
1093
1021
|
hasDocstring?: boolean;
|
|
1094
1022
|
/** Minimum line-coverage percentage; nodes below this value are excluded. Nodes with no coverage data are excluded. */
|
|
@@ -1099,6 +1027,26 @@ interface NodeQuery {
|
|
|
1099
1027
|
minExportUsage?: number;
|
|
1100
1028
|
/** Maximum avgExportUsage (0–1); nodes above this value are excluded. Nodes with no data are treated as 0. */
|
|
1101
1029
|
maxExportUsage?: number;
|
|
1030
|
+
/** Minimum McCabe cyclomatic complexity. Nodes with no complexity data (non-TS/JS files) are excluded. */
|
|
1031
|
+
minComplexity?: number;
|
|
1032
|
+
/** Maximum McCabe cyclomatic complexity. Nodes with no complexity data are treated as 0. */
|
|
1033
|
+
maxComplexity?: number;
|
|
1034
|
+
/** Minimum cognitive complexity. Nodes with no complexity data (non-TS/JS files) are excluded. */
|
|
1035
|
+
minCognitiveComplexity?: number;
|
|
1036
|
+
/** Maximum cognitive complexity. Nodes with no complexity data are treated as 0. */
|
|
1037
|
+
maxCognitiveComplexity?: number;
|
|
1038
|
+
/** Minimum commitCount90d. Nodes with no git-stats data are excluded. */
|
|
1039
|
+
minCommits?: number;
|
|
1040
|
+
/** Maximum commitCount90d. Nodes with no git-stats data are treated as 0. */
|
|
1041
|
+
maxCommits?: number;
|
|
1042
|
+
/** true = node has at least one markdown doc referencing it (documentedBy non-empty); false = undocumented nodes only. */
|
|
1043
|
+
isDocumented?: boolean;
|
|
1044
|
+
/** true = node is flagged as doc-stale (staleFor non-empty); false = non-stale nodes only. */
|
|
1045
|
+
isStale?: boolean;
|
|
1046
|
+
/** Exact match on FileNode.lastAuthor. Prefix with "!" to negate. Nodes with no author data fail the positive form and pass the negative form. */
|
|
1047
|
+
lastAuthor?: string;
|
|
1048
|
+
/** OR-group: node matches if it satisfies ANY sub-query in this array, ANDed with all other top-level fields on this NodeQuery. Populated by `any(key:val|key:val)` syntax in query strings. */
|
|
1049
|
+
any?: NodeQuery[];
|
|
1102
1050
|
}
|
|
1103
1051
|
|
|
1104
1052
|
/** Filters a graph by applying NodeQuery predicates: category, type, tag, path, imports, coverage, and more. */
|
|
@@ -1119,6 +1067,8 @@ declare function filterGraph(graph: SerializedGraph, query: NodeQuery): Serializ
|
|
|
1119
1067
|
* @description Parses a `"key:value,key:value"` query string into a structured `NodeQuery`.
|
|
1120
1068
|
* String values support `"!"` prefix for negation. The `tag`/`tags` key may appear multiple
|
|
1121
1069
|
* times; values are OR-matched (negated entries act as exclusions). `tag:a+b` maps to `allTags`.
|
|
1070
|
+
* A token of the form `any(key:val|key:val)` is parsed as an OR-group of single-key clauses
|
|
1071
|
+
* and accumulates into `query.any`, ANDed with every other top-level key in the string.
|
|
1122
1072
|
* @param {string} queryString - Comma-separated `key:value` pairs, e.g. `"category:logic,tag:auth"`.
|
|
1123
1073
|
* @returns {NodeQuery} The structured query object ready for use with `filterGraph` or `matchNode`.
|
|
1124
1074
|
*/
|
|
@@ -1224,25 +1174,27 @@ declare function proposeAffectedTests(graph: Graph, changedFiles: string[], opti
|
|
|
1224
1174
|
* @param rootDir - Absolute or relative path to the project root; resolved internally.
|
|
1225
1175
|
* @param entryPoints - File paths (relative to `rootDir`) that seed the graph walk.
|
|
1226
1176
|
* @param previousGraph - An earlier graph to diff against for incremental builds; pass `null` for a full build.
|
|
1227
|
-
* @param options - `silent` suppresses progress output; `gitStats` attaches git churn data; `coverageMap` maps file paths to line-coverage percentages.
|
|
1177
|
+
* @param options - `silent` suppresses progress output; `gitStats` attaches git churn data; `coverageMap` maps file paths to line-coverage percentages; `parallelParsing` controls worker-pool offloading of file parsing (see {@link ParallelParsingOption}).
|
|
1228
1178
|
* @returns The fully-built Graph with all reachable nodes and import edges populated.
|
|
1229
1179
|
*/
|
|
1230
1180
|
declare function createImportMap(rootDir: string, entryPoints: string[], previousGraph?: Graph | null, options?: {
|
|
1231
1181
|
silent?: boolean;
|
|
1232
1182
|
gitStats?: boolean;
|
|
1233
1183
|
coverageMap?: Map<string, number>;
|
|
1184
|
+
parallelParsing?: ParallelParsingOption | undefined;
|
|
1234
1185
|
}): Promise<Graph>;
|
|
1235
1186
|
/**
|
|
1236
1187
|
* @description Auto-detects the monorepo layout under `rootDir` and builds a per-package
|
|
1237
1188
|
* dependency graph, stitching them together into a single WorkspaceGraph.
|
|
1238
1189
|
* @param rootDir - Absolute path to the monorepo root.
|
|
1239
|
-
* @param options - `packages` filters to a named subset of packages; `silent` suppresses progress; `gitStats` attaches git churn data per file.
|
|
1190
|
+
* @param options - `packages` filters to a named subset of packages; `silent` suppresses progress; `gitStats` attaches git churn data per file; `parallelParsing` controls worker-pool offloading of file parsing per package (see {@link ParallelParsingOption}).
|
|
1240
1191
|
* @returns A WorkspaceGraph where each package has its own Graph and cross-package edges are resolved.
|
|
1241
1192
|
*/
|
|
1242
1193
|
declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
1243
1194
|
packages?: string[];
|
|
1244
1195
|
silent?: boolean;
|
|
1245
1196
|
gitStats?: boolean;
|
|
1197
|
+
parallelParsing?: ParallelParsingOption | undefined;
|
|
1246
1198
|
}): Promise<WorkspaceGraph>;
|
|
1247
1199
|
/**
|
|
1248
1200
|
* @description Recursively walks `rootDir` and returns paths of every file whose extension
|
|
@@ -1253,4 +1205,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1253
1205
|
*/
|
|
1254
1206
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1255
1207
|
|
|
1256
|
-
export { type ApiSurface, type ApplyTagsFileResult, type ApplyTagsResult,
|
|
1208
|
+
export { type ApiSurface, type ApplyTagsFileResult, type ApplyTagsResult, CallEdge, type CalleeEntry, type CallerEntry$1 as CallerEntry, type ChangeImpactCache, type ComplexFunctionEntry, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_DIRS, type DependencyGraph, type ExportKind, type FeatureDetectionOptions, type FeatureDomain, type FeatureGraph, type FeatureGraphOptions, type FeatureInfo, FileNode, FileType, type FindComplexFunctionsOptions, type FunctionCallInfo, type GetAffectedOptions, type GetCallersOptions, Graph, type CallerEntry as GraphCallerEntry, type GraphExporter, ImportEdge, MermaidExporter, type ModuleResponsibility, type ModuleRole, type MokoshConfig, type MonorepoDetector, type MonorepoLayout, type NodeQuery, type ParallelParsingOption, type PathWithSymbols, type ProposeTagsOptions, type PublicExport, type ResponsibilityGraph, type ScanOptions, type SerializedGraph, type SerializedWorkspaceGraph, type SlimNode, type SlimSerializedGraph, StructuredTag, SymbolTraversalContext, type TestNodeIdentifier, type TraversalOptions, type TraversalVisitor, type TypeEdge, type TypeGraph, type TypeKind, type TypeNode, type TypeQueryResult, WorkspaceGraph, type WorkspacePackage, type WorkspacePackageSummary, type WorkspacePackagesSummary, applyConfig, applyTags, buildApiSurface, buildChangeImpactCache, buildFeatureGraph, buildResponsibilityGraph, buildTypeGraph, computeGraphHash, createImportMap, createWorkspaceGraph, detectAllEntryPoints, detectEntryPoint, detectFeatures, detectMonorepo, filterGraph, findComplexFunctions, getAffected, getAllProjectFiles, getCallers, getDependencies, getDependents, hasCoverageData, isChangeImpactCacheValid, loadChangeImpactCache, loadCoverageMap, loadMokoshConfig, parseQuery, proposeAffectedTests, proposeTags, queryCallGraph, queryChangeImpact, queryTypeGraph, registerConfigMatcher, registerMonorepoDetector, registerParser, registerTestLibrary, registerTestPattern, saveChangeImpactCache, slimSerialize, summarizeWorkspacePackages, toMermaid };
|