@omfalos/mokosh 0.1.8 → 0.1.10
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/README.md +1 -0
- package/dist/cli.js +30 -25
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +30 -25
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +99 -5
- package/dist/index.d.ts +99 -5
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +18 -18
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +18 -18
- package/dist/mcp.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/skill/SKILL.md +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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,
|
|
1
|
+
import { F as FileNode, C as CallEdge, I as ImportEdge, a as FileType, N as NodeCategory, P as ParseResult, S as StructuredTag } from './types-C9fLCS45.mjs';
|
|
2
|
+
export { E as ExportedSymbol, b as ImportType, T as TagKind } from './types-C9fLCS45.mjs';
|
|
3
3
|
|
|
4
4
|
interface SerializedGraph {
|
|
5
5
|
nodes: FileNode[];
|
|
@@ -143,6 +143,14 @@ interface MokoshConfig {
|
|
|
143
143
|
testPatterns?: string[];
|
|
144
144
|
/** Additional import specifiers that indicate a test file (e.g. `"@my-org/test-utils"`). */
|
|
145
145
|
testLibraries?: string[];
|
|
146
|
+
/**
|
|
147
|
+
* Explicit path-alias map for import resolution, same shape as tsconfig's
|
|
148
|
+
* `compilerOptions.paths` (e.g. `{ "@app/*": ["src/app/*"] }`). Takes precedence over
|
|
149
|
+
* any aliases declared in `tsconfig.json`. Useful for JS-only projects without a
|
|
150
|
+
* tsconfig, or to mirror Vite/webpack alias configs. Substitution paths are resolved
|
|
151
|
+
* relative to the project root.
|
|
152
|
+
*/
|
|
153
|
+
pathAliases?: Record<string, string[]>;
|
|
146
154
|
/** Ratio of export-statements to total statements required for `"barrel"` classification. Default: `0.8`. */
|
|
147
155
|
barrelThreshold?: number;
|
|
148
156
|
/** When true, enriches each node with `commitCount90d` and `lastAuthor` via git log. Only fetched for new/modified files. */
|
|
@@ -204,6 +212,20 @@ declare function loadMokoshConfig(rootDirOrPath: string, { allowJs, isExplicitPa
|
|
|
204
212
|
* @param {MokoshConfig} config - The loaded config whose matchers, patterns, libraries, and thresholds are registered.
|
|
205
213
|
*/
|
|
206
214
|
declare function applyConfig(config: MokoshConfig): void;
|
|
215
|
+
/**
|
|
216
|
+
* @description Extracts the subset of `MokoshConfig` fields that affect graph
|
|
217
|
+
* construction (`gitStats`, `parallelParsing`, `pathAliases`) into a plain options
|
|
218
|
+
* object, ready to spread into `createImportMap`/`createWorkspaceGraph` calls. Single
|
|
219
|
+
* source of truth for this mapping so every graph-building call site — CLI, MCP,
|
|
220
|
+
* and secondary command-level rebuilds — stays in sync as new config fields are added.
|
|
221
|
+
* @param config - The loaded config, or `undefined` when none has been loaded yet.
|
|
222
|
+
* @returns Graph-build options with defaults applied (`gitStats` defaults to `false`).
|
|
223
|
+
*/
|
|
224
|
+
declare function configToGraphOptions(config: MokoshConfig | undefined): {
|
|
225
|
+
gitStats: boolean;
|
|
226
|
+
parallelParsing: ParallelParsingOption | undefined;
|
|
227
|
+
pathAliases: Record<string, string[]> | undefined;
|
|
228
|
+
};
|
|
207
229
|
|
|
208
230
|
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
209
231
|
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
@@ -829,12 +851,50 @@ declare const MermaidExporter: GraphExporter;
|
|
|
829
851
|
*/
|
|
830
852
|
declare function toMermaid(graph: Graph): string;
|
|
831
853
|
|
|
854
|
+
/** Single source of truth for which languages' parsers track which precision-relevant data. */
|
|
855
|
+
|
|
856
|
+
/** File types whose parser ever populates `FileNode.exports`. */
|
|
857
|
+
declare const EXPORT_TRACKING_TYPES: ReadonlySet<FileType>;
|
|
858
|
+
/** File types whose parser records which named symbols each import edge pulls in (`ImportEdge.symbols`). */
|
|
859
|
+
declare const IMPORT_SYMBOL_TYPES: ReadonlySet<FileType>;
|
|
860
|
+
/** File types whose parser records function-level call edges (`FileNode.callEdges`). */
|
|
861
|
+
declare const CALL_EDGE_TYPES: ReadonlySet<FileType>;
|
|
862
|
+
interface LanguageCoverage {
|
|
863
|
+
type: FileType;
|
|
864
|
+
fileCount: number;
|
|
865
|
+
exportsTracked: boolean;
|
|
866
|
+
importSymbolsTracked: boolean;
|
|
867
|
+
callEdgesTracked: boolean;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* @description Reports which precision-relevant data mokosh actually tracks for each language
|
|
871
|
+
* present in `graph` — so a caller can tell upfront whether tools like `find_symbol` or
|
|
872
|
+
* `get_call_graph` will give call-level precision, degrade to import-level, or find nothing
|
|
873
|
+
* at all for a given file, before running a query and being surprised by the result.
|
|
874
|
+
* @param graph - The graph to summarize.
|
|
875
|
+
* @returns One entry per `FileType` actually present in `graph`, sorted by file count
|
|
876
|
+
* descending. Languages with zero files in this graph are omitted.
|
|
877
|
+
*/
|
|
878
|
+
declare function getLanguageCoverage(graph: Graph): LanguageCoverage[];
|
|
879
|
+
|
|
832
880
|
/** Pure graph query/shaping functions shared by the MCP handlers and the CLI, so both surfaces return identical JSON shapes. */
|
|
833
881
|
|
|
834
882
|
interface PathWithSymbols {
|
|
835
883
|
path: string;
|
|
836
884
|
symbols?: string[];
|
|
837
885
|
}
|
|
886
|
+
interface NodeMeta {
|
|
887
|
+
category: FileNode["category"];
|
|
888
|
+
exports: string[];
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* @description Looks up a node's category and export names, for augmenting traversal
|
|
892
|
+
* results with `withMeta` so the AI doesn't need a follow-up `query` call.
|
|
893
|
+
* @param graph - The graph to look up in.
|
|
894
|
+
* @param path - Project-relative path of the node.
|
|
895
|
+
* @returns `{ category, exports }` for the node, or undefined if `path` isn't in the graph.
|
|
896
|
+
*/
|
|
897
|
+
declare function getNodeMeta(graph: Graph, path: string): NodeMeta | undefined;
|
|
838
898
|
/**
|
|
839
899
|
* @description Outgoing traversal from `file` — all files it imports, up to `depth` hops.
|
|
840
900
|
* @param graph - The graph to traverse.
|
|
@@ -950,6 +1010,38 @@ declare function summarizeWorkspacePackages(wg: WorkspaceGraph): WorkspacePackag
|
|
|
950
1010
|
*/
|
|
951
1011
|
declare function hasCoverageData(graph: Graph): boolean;
|
|
952
1012
|
|
|
1013
|
+
/** Symbol-name lookup across the whole graph — generalizes queryCallGraph beyond TS/JS functions. */
|
|
1014
|
+
|
|
1015
|
+
type SymbolPrecision = "call" | "import-symbol" | "file-level";
|
|
1016
|
+
interface SymbolCaller {
|
|
1017
|
+
file: string;
|
|
1018
|
+
callerFunction: string;
|
|
1019
|
+
}
|
|
1020
|
+
interface SymbolImporter {
|
|
1021
|
+
file: string;
|
|
1022
|
+
symbols?: string[];
|
|
1023
|
+
}
|
|
1024
|
+
interface SymbolMatch {
|
|
1025
|
+
path: string;
|
|
1026
|
+
category: NodeCategory;
|
|
1027
|
+
precision: SymbolPrecision;
|
|
1028
|
+
callers?: SymbolCaller[];
|
|
1029
|
+
importers?: SymbolImporter[];
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* @description Finds every file that exports a symbol by name, with the best available
|
|
1033
|
+
* usage info per match. Precision depends on what the defining file's language parser
|
|
1034
|
+
* tracks: TS/JS gets function-level callers via call edges, Python gets named-import
|
|
1035
|
+
* tracking, everything else falls back to whole-file dependents (import-level, not
|
|
1036
|
+
* symbol-level — the file might not even use this specific export).
|
|
1037
|
+
* @param graph - The graph to search.
|
|
1038
|
+
* @param name - Exact export name to look up.
|
|
1039
|
+
* @returns One entry per file that exports `name`; empty if no file does (including
|
|
1040
|
+
* languages — CoffeeScript, LiveScript, Lua, Gherkin, Markdown, CSS/SCSS/Stylus — whose
|
|
1041
|
+
* parsers never populate `exports` at all).
|
|
1042
|
+
*/
|
|
1043
|
+
declare function findSymbol(graph: Graph, name: string): SymbolMatch[];
|
|
1044
|
+
|
|
953
1045
|
/** A config matcher: substring, regex, or predicate tested against the lowercase basename. */
|
|
954
1046
|
type ConfigMatcher = string | RegExp | ((baseName: string) => boolean);
|
|
955
1047
|
/**
|
|
@@ -1174,7 +1266,7 @@ declare function proposeAffectedTests(graph: Graph, changedFiles: string[], opti
|
|
|
1174
1266
|
* @param rootDir - Absolute or relative path to the project root; resolved internally.
|
|
1175
1267
|
* @param entryPoints - File paths (relative to `rootDir`) that seed the graph walk.
|
|
1176
1268
|
* @param previousGraph - An earlier graph to diff against for incremental builds; pass `null` for a full build.
|
|
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}).
|
|
1269
|
+
* @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}); `pathAliases` overrides/extends tsconfig path-alias resolution (see `MokoshConfig.pathAliases`).
|
|
1178
1270
|
* @returns The fully-built Graph with all reachable nodes and import edges populated.
|
|
1179
1271
|
*/
|
|
1180
1272
|
declare function createImportMap(rootDir: string, entryPoints: string[], previousGraph?: Graph | null, options?: {
|
|
@@ -1182,12 +1274,13 @@ declare function createImportMap(rootDir: string, entryPoints: string[], previou
|
|
|
1182
1274
|
gitStats?: boolean;
|
|
1183
1275
|
coverageMap?: Map<string, number>;
|
|
1184
1276
|
parallelParsing?: ParallelParsingOption | undefined;
|
|
1277
|
+
pathAliases?: Record<string, string[]> | undefined;
|
|
1185
1278
|
}): Promise<Graph>;
|
|
1186
1279
|
/**
|
|
1187
1280
|
* @description Auto-detects the monorepo layout under `rootDir` and builds a per-package
|
|
1188
1281
|
* dependency graph, stitching them together into a single WorkspaceGraph.
|
|
1189
1282
|
* @param rootDir - Absolute path to the monorepo root.
|
|
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}).
|
|
1283
|
+
* @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}); `pathAliases` overrides/extends tsconfig path-alias resolution for every package (see `MokoshConfig.pathAliases`).
|
|
1191
1284
|
* @returns A WorkspaceGraph where each package has its own Graph and cross-package edges are resolved.
|
|
1192
1285
|
*/
|
|
1193
1286
|
declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
@@ -1195,6 +1288,7 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1195
1288
|
silent?: boolean;
|
|
1196
1289
|
gitStats?: boolean;
|
|
1197
1290
|
parallelParsing?: ParallelParsingOption | undefined;
|
|
1291
|
+
pathAliases?: Record<string, string[]> | undefined;
|
|
1198
1292
|
}): Promise<WorkspaceGraph>;
|
|
1199
1293
|
/**
|
|
1200
1294
|
* @description Recursively walks `rootDir` and returns paths of every file whose extension
|
|
@@ -1205,4 +1299,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1205
1299
|
*/
|
|
1206
1300
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1207
1301
|
|
|
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 };
|
|
1302
|
+
export { type ApiSurface, type ApplyTagsFileResult, type ApplyTagsResult, CALL_EDGE_TYPES, CallEdge, type CalleeEntry, type CallerEntry$1 as CallerEntry, type ChangeImpactCache, type ComplexFunctionEntry, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_DIRS, type DependencyGraph, EXPORT_TRACKING_TYPES, 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, IMPORT_SYMBOL_TYPES, ImportEdge, type LanguageCoverage, MermaidExporter, type ModuleResponsibility, type ModuleRole, type MokoshConfig, type MonorepoDetector, type MonorepoLayout, NodeCategory, type NodeMeta, type NodeQuery, type ParallelParsingOption, type PathWithSymbols, type ProposeTagsOptions, type PublicExport, type ResponsibilityGraph, type ScanOptions, type SerializedGraph, type SerializedWorkspaceGraph, type SlimNode, type SlimSerializedGraph, StructuredTag, type SymbolCaller, type SymbolImporter, type SymbolMatch, type SymbolPrecision, 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, configToGraphOptions, createImportMap, createWorkspaceGraph, detectAllEntryPoints, detectEntryPoint, detectFeatures, detectMonorepo, filterGraph, findComplexFunctions, findSymbol, getAffected, getAllProjectFiles, getCallers, getDependencies, getDependents, getLanguageCoverage, getNodeMeta, hasCoverageData, isChangeImpactCacheValid, loadChangeImpactCache, loadCoverageMap, loadMokoshConfig, parseQuery, proposeAffectedTests, proposeTags, queryCallGraph, queryChangeImpact, queryTypeGraph, registerConfigMatcher, registerMonorepoDetector, registerParser, registerTestLibrary, registerTestPattern, saveChangeImpactCache, slimSerialize, summarizeWorkspacePackages, toMermaid };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FileNode, C as CallEdge, I as ImportEdge, a as FileType, P as ParseResult, S as StructuredTag } from './types-C9fLCS45.js';
|
|
2
|
-
export { E as ExportedSymbol, b as ImportType,
|
|
1
|
+
import { F as FileNode, C as CallEdge, I as ImportEdge, a as FileType, N as NodeCategory, P as ParseResult, S as StructuredTag } from './types-C9fLCS45.js';
|
|
2
|
+
export { E as ExportedSymbol, b as ImportType, T as TagKind } from './types-C9fLCS45.js';
|
|
3
3
|
|
|
4
4
|
interface SerializedGraph {
|
|
5
5
|
nodes: FileNode[];
|
|
@@ -143,6 +143,14 @@ interface MokoshConfig {
|
|
|
143
143
|
testPatterns?: string[];
|
|
144
144
|
/** Additional import specifiers that indicate a test file (e.g. `"@my-org/test-utils"`). */
|
|
145
145
|
testLibraries?: string[];
|
|
146
|
+
/**
|
|
147
|
+
* Explicit path-alias map for import resolution, same shape as tsconfig's
|
|
148
|
+
* `compilerOptions.paths` (e.g. `{ "@app/*": ["src/app/*"] }`). Takes precedence over
|
|
149
|
+
* any aliases declared in `tsconfig.json`. Useful for JS-only projects without a
|
|
150
|
+
* tsconfig, or to mirror Vite/webpack alias configs. Substitution paths are resolved
|
|
151
|
+
* relative to the project root.
|
|
152
|
+
*/
|
|
153
|
+
pathAliases?: Record<string, string[]>;
|
|
146
154
|
/** Ratio of export-statements to total statements required for `"barrel"` classification. Default: `0.8`. */
|
|
147
155
|
barrelThreshold?: number;
|
|
148
156
|
/** When true, enriches each node with `commitCount90d` and `lastAuthor` via git log. Only fetched for new/modified files. */
|
|
@@ -204,6 +212,20 @@ declare function loadMokoshConfig(rootDirOrPath: string, { allowJs, isExplicitPa
|
|
|
204
212
|
* @param {MokoshConfig} config - The loaded config whose matchers, patterns, libraries, and thresholds are registered.
|
|
205
213
|
*/
|
|
206
214
|
declare function applyConfig(config: MokoshConfig): void;
|
|
215
|
+
/**
|
|
216
|
+
* @description Extracts the subset of `MokoshConfig` fields that affect graph
|
|
217
|
+
* construction (`gitStats`, `parallelParsing`, `pathAliases`) into a plain options
|
|
218
|
+
* object, ready to spread into `createImportMap`/`createWorkspaceGraph` calls. Single
|
|
219
|
+
* source of truth for this mapping so every graph-building call site — CLI, MCP,
|
|
220
|
+
* and secondary command-level rebuilds — stays in sync as new config fields are added.
|
|
221
|
+
* @param config - The loaded config, or `undefined` when none has been loaded yet.
|
|
222
|
+
* @returns Graph-build options with defaults applied (`gitStats` defaults to `false`).
|
|
223
|
+
*/
|
|
224
|
+
declare function configToGraphOptions(config: MokoshConfig | undefined): {
|
|
225
|
+
gitStats: boolean;
|
|
226
|
+
parallelParsing: ParallelParsingOption | undefined;
|
|
227
|
+
pathAliases: Record<string, string[]> | undefined;
|
|
228
|
+
};
|
|
207
229
|
|
|
208
230
|
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
209
231
|
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
@@ -829,12 +851,50 @@ declare const MermaidExporter: GraphExporter;
|
|
|
829
851
|
*/
|
|
830
852
|
declare function toMermaid(graph: Graph): string;
|
|
831
853
|
|
|
854
|
+
/** Single source of truth for which languages' parsers track which precision-relevant data. */
|
|
855
|
+
|
|
856
|
+
/** File types whose parser ever populates `FileNode.exports`. */
|
|
857
|
+
declare const EXPORT_TRACKING_TYPES: ReadonlySet<FileType>;
|
|
858
|
+
/** File types whose parser records which named symbols each import edge pulls in (`ImportEdge.symbols`). */
|
|
859
|
+
declare const IMPORT_SYMBOL_TYPES: ReadonlySet<FileType>;
|
|
860
|
+
/** File types whose parser records function-level call edges (`FileNode.callEdges`). */
|
|
861
|
+
declare const CALL_EDGE_TYPES: ReadonlySet<FileType>;
|
|
862
|
+
interface LanguageCoverage {
|
|
863
|
+
type: FileType;
|
|
864
|
+
fileCount: number;
|
|
865
|
+
exportsTracked: boolean;
|
|
866
|
+
importSymbolsTracked: boolean;
|
|
867
|
+
callEdgesTracked: boolean;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* @description Reports which precision-relevant data mokosh actually tracks for each language
|
|
871
|
+
* present in `graph` — so a caller can tell upfront whether tools like `find_symbol` or
|
|
872
|
+
* `get_call_graph` will give call-level precision, degrade to import-level, or find nothing
|
|
873
|
+
* at all for a given file, before running a query and being surprised by the result.
|
|
874
|
+
* @param graph - The graph to summarize.
|
|
875
|
+
* @returns One entry per `FileType` actually present in `graph`, sorted by file count
|
|
876
|
+
* descending. Languages with zero files in this graph are omitted.
|
|
877
|
+
*/
|
|
878
|
+
declare function getLanguageCoverage(graph: Graph): LanguageCoverage[];
|
|
879
|
+
|
|
832
880
|
/** Pure graph query/shaping functions shared by the MCP handlers and the CLI, so both surfaces return identical JSON shapes. */
|
|
833
881
|
|
|
834
882
|
interface PathWithSymbols {
|
|
835
883
|
path: string;
|
|
836
884
|
symbols?: string[];
|
|
837
885
|
}
|
|
886
|
+
interface NodeMeta {
|
|
887
|
+
category: FileNode["category"];
|
|
888
|
+
exports: string[];
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* @description Looks up a node's category and export names, for augmenting traversal
|
|
892
|
+
* results with `withMeta` so the AI doesn't need a follow-up `query` call.
|
|
893
|
+
* @param graph - The graph to look up in.
|
|
894
|
+
* @param path - Project-relative path of the node.
|
|
895
|
+
* @returns `{ category, exports }` for the node, or undefined if `path` isn't in the graph.
|
|
896
|
+
*/
|
|
897
|
+
declare function getNodeMeta(graph: Graph, path: string): NodeMeta | undefined;
|
|
838
898
|
/**
|
|
839
899
|
* @description Outgoing traversal from `file` — all files it imports, up to `depth` hops.
|
|
840
900
|
* @param graph - The graph to traverse.
|
|
@@ -950,6 +1010,38 @@ declare function summarizeWorkspacePackages(wg: WorkspaceGraph): WorkspacePackag
|
|
|
950
1010
|
*/
|
|
951
1011
|
declare function hasCoverageData(graph: Graph): boolean;
|
|
952
1012
|
|
|
1013
|
+
/** Symbol-name lookup across the whole graph — generalizes queryCallGraph beyond TS/JS functions. */
|
|
1014
|
+
|
|
1015
|
+
type SymbolPrecision = "call" | "import-symbol" | "file-level";
|
|
1016
|
+
interface SymbolCaller {
|
|
1017
|
+
file: string;
|
|
1018
|
+
callerFunction: string;
|
|
1019
|
+
}
|
|
1020
|
+
interface SymbolImporter {
|
|
1021
|
+
file: string;
|
|
1022
|
+
symbols?: string[];
|
|
1023
|
+
}
|
|
1024
|
+
interface SymbolMatch {
|
|
1025
|
+
path: string;
|
|
1026
|
+
category: NodeCategory;
|
|
1027
|
+
precision: SymbolPrecision;
|
|
1028
|
+
callers?: SymbolCaller[];
|
|
1029
|
+
importers?: SymbolImporter[];
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* @description Finds every file that exports a symbol by name, with the best available
|
|
1033
|
+
* usage info per match. Precision depends on what the defining file's language parser
|
|
1034
|
+
* tracks: TS/JS gets function-level callers via call edges, Python gets named-import
|
|
1035
|
+
* tracking, everything else falls back to whole-file dependents (import-level, not
|
|
1036
|
+
* symbol-level — the file might not even use this specific export).
|
|
1037
|
+
* @param graph - The graph to search.
|
|
1038
|
+
* @param name - Exact export name to look up.
|
|
1039
|
+
* @returns One entry per file that exports `name`; empty if no file does (including
|
|
1040
|
+
* languages — CoffeeScript, LiveScript, Lua, Gherkin, Markdown, CSS/SCSS/Stylus — whose
|
|
1041
|
+
* parsers never populate `exports` at all).
|
|
1042
|
+
*/
|
|
1043
|
+
declare function findSymbol(graph: Graph, name: string): SymbolMatch[];
|
|
1044
|
+
|
|
953
1045
|
/** A config matcher: substring, regex, or predicate tested against the lowercase basename. */
|
|
954
1046
|
type ConfigMatcher = string | RegExp | ((baseName: string) => boolean);
|
|
955
1047
|
/**
|
|
@@ -1174,7 +1266,7 @@ declare function proposeAffectedTests(graph: Graph, changedFiles: string[], opti
|
|
|
1174
1266
|
* @param rootDir - Absolute or relative path to the project root; resolved internally.
|
|
1175
1267
|
* @param entryPoints - File paths (relative to `rootDir`) that seed the graph walk.
|
|
1176
1268
|
* @param previousGraph - An earlier graph to diff against for incremental builds; pass `null` for a full build.
|
|
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}).
|
|
1269
|
+
* @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}); `pathAliases` overrides/extends tsconfig path-alias resolution (see `MokoshConfig.pathAliases`).
|
|
1178
1270
|
* @returns The fully-built Graph with all reachable nodes and import edges populated.
|
|
1179
1271
|
*/
|
|
1180
1272
|
declare function createImportMap(rootDir: string, entryPoints: string[], previousGraph?: Graph | null, options?: {
|
|
@@ -1182,12 +1274,13 @@ declare function createImportMap(rootDir: string, entryPoints: string[], previou
|
|
|
1182
1274
|
gitStats?: boolean;
|
|
1183
1275
|
coverageMap?: Map<string, number>;
|
|
1184
1276
|
parallelParsing?: ParallelParsingOption | undefined;
|
|
1277
|
+
pathAliases?: Record<string, string[]> | undefined;
|
|
1185
1278
|
}): Promise<Graph>;
|
|
1186
1279
|
/**
|
|
1187
1280
|
* @description Auto-detects the monorepo layout under `rootDir` and builds a per-package
|
|
1188
1281
|
* dependency graph, stitching them together into a single WorkspaceGraph.
|
|
1189
1282
|
* @param rootDir - Absolute path to the monorepo root.
|
|
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}).
|
|
1283
|
+
* @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}); `pathAliases` overrides/extends tsconfig path-alias resolution for every package (see `MokoshConfig.pathAliases`).
|
|
1191
1284
|
* @returns A WorkspaceGraph where each package has its own Graph and cross-package edges are resolved.
|
|
1192
1285
|
*/
|
|
1193
1286
|
declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
@@ -1195,6 +1288,7 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1195
1288
|
silent?: boolean;
|
|
1196
1289
|
gitStats?: boolean;
|
|
1197
1290
|
parallelParsing?: ParallelParsingOption | undefined;
|
|
1291
|
+
pathAliases?: Record<string, string[]> | undefined;
|
|
1198
1292
|
}): Promise<WorkspaceGraph>;
|
|
1199
1293
|
/**
|
|
1200
1294
|
* @description Recursively walks `rootDir` and returns paths of every file whose extension
|
|
@@ -1205,4 +1299,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1205
1299
|
*/
|
|
1206
1300
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1207
1301
|
|
|
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 };
|
|
1302
|
+
export { type ApiSurface, type ApplyTagsFileResult, type ApplyTagsResult, CALL_EDGE_TYPES, CallEdge, type CalleeEntry, type CallerEntry$1 as CallerEntry, type ChangeImpactCache, type ComplexFunctionEntry, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_DIRS, type DependencyGraph, EXPORT_TRACKING_TYPES, 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, IMPORT_SYMBOL_TYPES, ImportEdge, type LanguageCoverage, MermaidExporter, type ModuleResponsibility, type ModuleRole, type MokoshConfig, type MonorepoDetector, type MonorepoLayout, NodeCategory, type NodeMeta, type NodeQuery, type ParallelParsingOption, type PathWithSymbols, type ProposeTagsOptions, type PublicExport, type ResponsibilityGraph, type ScanOptions, type SerializedGraph, type SerializedWorkspaceGraph, type SlimNode, type SlimSerializedGraph, StructuredTag, type SymbolCaller, type SymbolImporter, type SymbolMatch, type SymbolPrecision, 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, configToGraphOptions, createImportMap, createWorkspaceGraph, detectAllEntryPoints, detectEntryPoint, detectFeatures, detectMonorepo, filterGraph, findComplexFunctions, findSymbol, getAffected, getAllProjectFiles, getCallers, getDependencies, getDependents, getLanguageCoverage, getNodeMeta, hasCoverageData, isChangeImpactCacheValid, loadChangeImpactCache, loadCoverageMap, loadMokoshConfig, parseQuery, proposeAffectedTests, proposeTags, queryCallGraph, queryChangeImpact, queryTypeGraph, registerConfigMatcher, registerMonorepoDetector, registerParser, registerTestLibrary, registerTestPattern, saveChangeImpactCache, slimSerialize, summarizeWorkspacePackages, toMermaid };
|