@omfalos/mokosh 0.4.1 → 0.4.3
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 +43 -34
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +42 -33
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +49 -1
- package/dist/index.d.ts +49 -1
- package/dist/index.js +25 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -21
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +28 -24
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +27 -23
- package/dist/mcp.mjs.map +1 -1
- package/dist/parse-worker.js +2 -2
- package/dist/parse-worker.js.map +1 -1
- package/dist/parse-worker.mjs +2 -2
- package/dist/parse-worker.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/skill/mokosh.md +3 -0
package/dist/index.d.mts
CHANGED
|
@@ -237,6 +237,10 @@ declare function configToGraphOptions(config: MokoshConfig | undefined): {
|
|
|
237
237
|
declare const DEFAULT_CACHE_DIR = "mokosh-cache";
|
|
238
238
|
/** Filename for the disk-persisted `find_duplicates` token cache within `DEFAULT_CACHE_DIR`. */
|
|
239
239
|
declare const DEFAULT_DUPLICATION_TOKEN_CACHE_FILE = "duplication-tokens.json";
|
|
240
|
+
/** Filename for the disk-persisted graph cache within `DEFAULT_CACHE_DIR`. Written by the CLI
|
|
241
|
+
* (`src/cli/graph-loader.ts`) after every build; read by the MCP server (`src/mcp/cache.ts`) to
|
|
242
|
+
* seed a session's first `analyze` call so it reuses unchanged nodes instead of parsing cold. */
|
|
243
|
+
declare const DEFAULT_GRAPH_CACHE_FILE = "graph.json";
|
|
240
244
|
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
241
245
|
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
242
246
|
interface ScanOptions {
|
|
@@ -1177,6 +1181,50 @@ declare function summarizeWorkspacePackages(wg: WorkspaceGraph): WorkspacePackag
|
|
|
1177
1181
|
* @returns Whether any node has a defined `coveragePct`.
|
|
1178
1182
|
*/
|
|
1179
1183
|
declare function hasCoverageData(graph: Graph): boolean;
|
|
1184
|
+
/**
|
|
1185
|
+
* @description Returns `true` if at least one node in the graph has git churn data loaded.
|
|
1186
|
+
* @param graph - The graph to check.
|
|
1187
|
+
* @returns Whether any node has a defined `commitCount90d`.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function hasChurnData(graph: Graph): boolean;
|
|
1190
|
+
interface RiskHotspotEntry {
|
|
1191
|
+
file: string;
|
|
1192
|
+
name: string;
|
|
1193
|
+
line: number;
|
|
1194
|
+
complexity: number;
|
|
1195
|
+
cognitiveComplexity: number;
|
|
1196
|
+
coveragePct: number;
|
|
1197
|
+
commitCount90d?: number;
|
|
1198
|
+
}
|
|
1199
|
+
interface FindRiskHotspotsOptions {
|
|
1200
|
+
metric?: "cognitiveComplexity" | "complexity" | undefined;
|
|
1201
|
+
minComplexity?: number | undefined;
|
|
1202
|
+
maxCoveragePct?: number | undefined;
|
|
1203
|
+
minChurn?: number | undefined;
|
|
1204
|
+
limit?: number | undefined;
|
|
1205
|
+
}
|
|
1206
|
+
interface RiskHotspotsResult {
|
|
1207
|
+
hotspots: RiskHotspotEntry[];
|
|
1208
|
+
count: number;
|
|
1209
|
+
churnDataAvailable: boolean;
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* @description Finds functions that are complex, in a poorly-covered file, and — when git churn
|
|
1213
|
+
* data is loaded — in a frequently-changed file. Coverage and churn are file-level (the
|
|
1214
|
+
* containing file's `coveragePct`/`commitCount90d`), joined against each per-function
|
|
1215
|
+
* complexity entry, since neither is tracked per-function. Callers should check
|
|
1216
|
+
* `hasCoverageData` first and surface an explicit error if it's false, the same way
|
|
1217
|
+
* `find_uncovered` does — this function doesn't self-guard.
|
|
1218
|
+
* @param graph - The graph to scan. Coverage data should already be loaded for useful results.
|
|
1219
|
+
* @param options - `metric` picks which per-function score to filter/sort on (default
|
|
1220
|
+
* `cognitiveComplexity`); `minComplexity` is the minimum score to include (default 10);
|
|
1221
|
+
* `maxCoveragePct` is the maximum containing-file coverage to include (default 50);
|
|
1222
|
+
* `minChurn` is the minimum containing-file 90-day commit count to include (default 0),
|
|
1223
|
+
* ignored entirely when no node has churn data loaded; `limit` caps the results (default 20).
|
|
1224
|
+
* @returns Matching functions sorted worst-first by `metric`, plus whether churn data was
|
|
1225
|
+
* available (and therefore whether `minChurn` was actually applied).
|
|
1226
|
+
*/
|
|
1227
|
+
declare function findRiskHotspots(graph: Graph, options?: FindRiskHotspotsOptions): RiskHotspotsResult;
|
|
1180
1228
|
|
|
1181
1229
|
/** Symbol-name lookup across the whole graph — generalizes queryCallGraph beyond TS/JS functions. */
|
|
1182
1230
|
|
|
@@ -1469,4 +1517,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1469
1517
|
*/
|
|
1470
1518
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1471
1519
|
|
|
1472
|
-
export { type ApiSurface, type ApplyTagsFileResult, type ApplyTagsResult, CALL_EDGE_TYPES, type CachedFileTokens, CallEdge, type CalleeEntry, type CallerEntry$1 as CallerEntry, type ChangeImpactCache, type ComplexFunctionEntry, DEFAULT_CACHE_DIR, DEFAULT_DUPLICATION_TOKEN_CACHE_FILE, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_DIRS, type DependencyGraph, type DuplicateFamily, type DuplicateGroup, type DuplicateOccurrence, type DuplicationTokenCache, EXPORT_TRACKING_TYPES, type ExportKind, type FeatureDetectionOptions, type FeatureDomain, type FeatureGraph, type FeatureGraphOptions, type FeatureInfo, FileNode, FileType, type FindComplexFunctionsOptions, type FindDuplicatesOptions, type FindDuplicatesResult, 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, findDuplicates, findSymbol, getAffected, getAllProjectFiles, getCallers, getDependencies, getDependents, getLanguageCoverage, getNodeMeta, hasCoverageData, isChangeImpactCacheValid, loadChangeImpactCache, loadCoverageMap, loadMokoshConfig, loadTokenCacheFromDisk, parseQuery, proposeAffectedTests, proposeTags, queryCallGraph, queryChangeImpact, queryTypeGraph, registerConfigMatcher, registerMonorepoDetector, registerParser, registerTestLibrary, registerTestPattern, saveChangeImpactCache, saveTokenCacheToDisk, slimSerialize, summarizeWorkspacePackages, toMermaid };
|
|
1520
|
+
export { type ApiSurface, type ApplyTagsFileResult, type ApplyTagsResult, CALL_EDGE_TYPES, type CachedFileTokens, CallEdge, type CalleeEntry, type CallerEntry$1 as CallerEntry, type ChangeImpactCache, type ComplexFunctionEntry, DEFAULT_CACHE_DIR, DEFAULT_DUPLICATION_TOKEN_CACHE_FILE, DEFAULT_EXTENSIONS, DEFAULT_GRAPH_CACHE_FILE, DEFAULT_IGNORE_DIRS, type DependencyGraph, type DuplicateFamily, type DuplicateGroup, type DuplicateOccurrence, type DuplicationTokenCache, EXPORT_TRACKING_TYPES, type ExportKind, type FeatureDetectionOptions, type FeatureDomain, type FeatureGraph, type FeatureGraphOptions, type FeatureInfo, FileNode, FileType, type FindComplexFunctionsOptions, type FindDuplicatesOptions, type FindDuplicatesResult, type FindRiskHotspotsOptions, 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 RiskHotspotEntry, type RiskHotspotsResult, 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, findDuplicates, findRiskHotspots, findSymbol, getAffected, getAllProjectFiles, getCallers, getDependencies, getDependents, getLanguageCoverage, getNodeMeta, hasChurnData, hasCoverageData, isChangeImpactCacheValid, loadChangeImpactCache, loadCoverageMap, loadMokoshConfig, loadTokenCacheFromDisk, parseQuery, proposeAffectedTests, proposeTags, queryCallGraph, queryChangeImpact, queryTypeGraph, registerConfigMatcher, registerMonorepoDetector, registerParser, registerTestLibrary, registerTestPattern, saveChangeImpactCache, saveTokenCacheToDisk, slimSerialize, summarizeWorkspacePackages, toMermaid };
|
package/dist/index.d.ts
CHANGED
|
@@ -237,6 +237,10 @@ declare function configToGraphOptions(config: MokoshConfig | undefined): {
|
|
|
237
237
|
declare const DEFAULT_CACHE_DIR = "mokosh-cache";
|
|
238
238
|
/** Filename for the disk-persisted `find_duplicates` token cache within `DEFAULT_CACHE_DIR`. */
|
|
239
239
|
declare const DEFAULT_DUPLICATION_TOKEN_CACHE_FILE = "duplication-tokens.json";
|
|
240
|
+
/** Filename for the disk-persisted graph cache within `DEFAULT_CACHE_DIR`. Written by the CLI
|
|
241
|
+
* (`src/cli/graph-loader.ts`) after every build; read by the MCP server (`src/mcp/cache.ts`) to
|
|
242
|
+
* seed a session's first `analyze` call so it reuses unchanged nodes instead of parsing cold. */
|
|
243
|
+
declare const DEFAULT_GRAPH_CACHE_FILE = "graph.json";
|
|
240
244
|
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
241
245
|
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
242
246
|
interface ScanOptions {
|
|
@@ -1177,6 +1181,50 @@ declare function summarizeWorkspacePackages(wg: WorkspaceGraph): WorkspacePackag
|
|
|
1177
1181
|
* @returns Whether any node has a defined `coveragePct`.
|
|
1178
1182
|
*/
|
|
1179
1183
|
declare function hasCoverageData(graph: Graph): boolean;
|
|
1184
|
+
/**
|
|
1185
|
+
* @description Returns `true` if at least one node in the graph has git churn data loaded.
|
|
1186
|
+
* @param graph - The graph to check.
|
|
1187
|
+
* @returns Whether any node has a defined `commitCount90d`.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function hasChurnData(graph: Graph): boolean;
|
|
1190
|
+
interface RiskHotspotEntry {
|
|
1191
|
+
file: string;
|
|
1192
|
+
name: string;
|
|
1193
|
+
line: number;
|
|
1194
|
+
complexity: number;
|
|
1195
|
+
cognitiveComplexity: number;
|
|
1196
|
+
coveragePct: number;
|
|
1197
|
+
commitCount90d?: number;
|
|
1198
|
+
}
|
|
1199
|
+
interface FindRiskHotspotsOptions {
|
|
1200
|
+
metric?: "cognitiveComplexity" | "complexity" | undefined;
|
|
1201
|
+
minComplexity?: number | undefined;
|
|
1202
|
+
maxCoveragePct?: number | undefined;
|
|
1203
|
+
minChurn?: number | undefined;
|
|
1204
|
+
limit?: number | undefined;
|
|
1205
|
+
}
|
|
1206
|
+
interface RiskHotspotsResult {
|
|
1207
|
+
hotspots: RiskHotspotEntry[];
|
|
1208
|
+
count: number;
|
|
1209
|
+
churnDataAvailable: boolean;
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* @description Finds functions that are complex, in a poorly-covered file, and — when git churn
|
|
1213
|
+
* data is loaded — in a frequently-changed file. Coverage and churn are file-level (the
|
|
1214
|
+
* containing file's `coveragePct`/`commitCount90d`), joined against each per-function
|
|
1215
|
+
* complexity entry, since neither is tracked per-function. Callers should check
|
|
1216
|
+
* `hasCoverageData` first and surface an explicit error if it's false, the same way
|
|
1217
|
+
* `find_uncovered` does — this function doesn't self-guard.
|
|
1218
|
+
* @param graph - The graph to scan. Coverage data should already be loaded for useful results.
|
|
1219
|
+
* @param options - `metric` picks which per-function score to filter/sort on (default
|
|
1220
|
+
* `cognitiveComplexity`); `minComplexity` is the minimum score to include (default 10);
|
|
1221
|
+
* `maxCoveragePct` is the maximum containing-file coverage to include (default 50);
|
|
1222
|
+
* `minChurn` is the minimum containing-file 90-day commit count to include (default 0),
|
|
1223
|
+
* ignored entirely when no node has churn data loaded; `limit` caps the results (default 20).
|
|
1224
|
+
* @returns Matching functions sorted worst-first by `metric`, plus whether churn data was
|
|
1225
|
+
* available (and therefore whether `minChurn` was actually applied).
|
|
1226
|
+
*/
|
|
1227
|
+
declare function findRiskHotspots(graph: Graph, options?: FindRiskHotspotsOptions): RiskHotspotsResult;
|
|
1180
1228
|
|
|
1181
1229
|
/** Symbol-name lookup across the whole graph — generalizes queryCallGraph beyond TS/JS functions. */
|
|
1182
1230
|
|
|
@@ -1469,4 +1517,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1469
1517
|
*/
|
|
1470
1518
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1471
1519
|
|
|
1472
|
-
export { type ApiSurface, type ApplyTagsFileResult, type ApplyTagsResult, CALL_EDGE_TYPES, type CachedFileTokens, CallEdge, type CalleeEntry, type CallerEntry$1 as CallerEntry, type ChangeImpactCache, type ComplexFunctionEntry, DEFAULT_CACHE_DIR, DEFAULT_DUPLICATION_TOKEN_CACHE_FILE, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_DIRS, type DependencyGraph, type DuplicateFamily, type DuplicateGroup, type DuplicateOccurrence, type DuplicationTokenCache, EXPORT_TRACKING_TYPES, type ExportKind, type FeatureDetectionOptions, type FeatureDomain, type FeatureGraph, type FeatureGraphOptions, type FeatureInfo, FileNode, FileType, type FindComplexFunctionsOptions, type FindDuplicatesOptions, type FindDuplicatesResult, 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, findDuplicates, findSymbol, getAffected, getAllProjectFiles, getCallers, getDependencies, getDependents, getLanguageCoverage, getNodeMeta, hasCoverageData, isChangeImpactCacheValid, loadChangeImpactCache, loadCoverageMap, loadMokoshConfig, loadTokenCacheFromDisk, parseQuery, proposeAffectedTests, proposeTags, queryCallGraph, queryChangeImpact, queryTypeGraph, registerConfigMatcher, registerMonorepoDetector, registerParser, registerTestLibrary, registerTestPattern, saveChangeImpactCache, saveTokenCacheToDisk, slimSerialize, summarizeWorkspacePackages, toMermaid };
|
|
1520
|
+
export { type ApiSurface, type ApplyTagsFileResult, type ApplyTagsResult, CALL_EDGE_TYPES, type CachedFileTokens, CallEdge, type CalleeEntry, type CallerEntry$1 as CallerEntry, type ChangeImpactCache, type ComplexFunctionEntry, DEFAULT_CACHE_DIR, DEFAULT_DUPLICATION_TOKEN_CACHE_FILE, DEFAULT_EXTENSIONS, DEFAULT_GRAPH_CACHE_FILE, DEFAULT_IGNORE_DIRS, type DependencyGraph, type DuplicateFamily, type DuplicateGroup, type DuplicateOccurrence, type DuplicationTokenCache, EXPORT_TRACKING_TYPES, type ExportKind, type FeatureDetectionOptions, type FeatureDomain, type FeatureGraph, type FeatureGraphOptions, type FeatureInfo, FileNode, FileType, type FindComplexFunctionsOptions, type FindDuplicatesOptions, type FindDuplicatesResult, type FindRiskHotspotsOptions, 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 RiskHotspotEntry, type RiskHotspotsResult, 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, findDuplicates, findRiskHotspots, findSymbol, getAffected, getAllProjectFiles, getCallers, getDependencies, getDependents, getLanguageCoverage, getNodeMeta, hasChurnData, hasCoverageData, isChangeImpactCacheValid, loadChangeImpactCache, loadCoverageMap, loadMokoshConfig, loadTokenCacheFromDisk, parseQuery, proposeAffectedTests, proposeTags, queryCallGraph, queryChangeImpact, queryTypeGraph, registerConfigMatcher, registerMonorepoDetector, registerParser, registerTestLibrary, registerTestPattern, saveChangeImpactCache, saveTokenCacheToDisk, slimSerialize, summarizeWorkspacePackages, toMermaid };
|