@omfalos/mokosh 0.4.0 → 0.4.2
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 +36 -32
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +34 -30
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +39 -8
- package/dist/index.d.ts +39 -8
- package/dist/index.js +24 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -20
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +26 -21
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +27 -22
- package/dist/mcp.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -230,6 +230,17 @@ declare function configToGraphOptions(config: MokoshConfig | undefined): {
|
|
|
230
230
|
pathAliases: Record<string, string[]> | undefined;
|
|
231
231
|
};
|
|
232
232
|
|
|
233
|
+
/** Shared by the CLI's disk graph cache (`src/cli/graph-loader.ts`) and the MCP server's
|
|
234
|
+
* disk-persisted duplication token cache (`src/graph/duplication/token-cache-store.ts`) so both
|
|
235
|
+
* consumers agree on where "the cache dir" is — a CLI run and an MCP session against the same
|
|
236
|
+
* root end up sharing the same on-disk files. */
|
|
237
|
+
declare const DEFAULT_CACHE_DIR = "mokosh-cache";
|
|
238
|
+
/** Filename for the disk-persisted `find_duplicates` token cache within `DEFAULT_CACHE_DIR`. */
|
|
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";
|
|
233
244
|
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
234
245
|
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
235
246
|
interface ScanOptions {
|
|
@@ -493,13 +504,6 @@ interface DuplicateGroup {
|
|
|
493
504
|
family?: DuplicateFamily | undefined;
|
|
494
505
|
}
|
|
495
506
|
|
|
496
|
-
/** Configures whether/how tokenizing is offloaded to a `piscina` worker pool. `false` always
|
|
497
|
-
* tokenizes in-process. */
|
|
498
|
-
type ParallelTokenizingOption = boolean | {
|
|
499
|
-
minFiles?: number;
|
|
500
|
-
maxThreads?: number;
|
|
501
|
-
};
|
|
502
|
-
|
|
503
507
|
/** One file's cached tokenize result, fingerprinted by `mtime`/`size`/`ignoreLiterals` — any
|
|
504
508
|
* mismatch against the current `FileNode` (or against the `ignoreLiterals` this scan is running
|
|
505
509
|
* with) means the entry is stale and must be recomputed, exactly like `GraphBuilder`'s
|
|
@@ -516,6 +520,33 @@ interface CachedFileTokens {
|
|
|
516
520
|
* benefit own the `Map` and pass it in; the CLI's one-shot process has nothing to gain and omits
|
|
517
521
|
* it. See docs/adr-014-duplicate-detection-scale.md. */
|
|
518
522
|
type DuplicationTokenCache = Map<string, CachedFileTokens>;
|
|
523
|
+
/**
|
|
524
|
+
* @description Reads a serialized `DuplicationTokenCache` from a JSON disk file written by
|
|
525
|
+
* `saveTokenCacheToDisk`. Any problem reading or parsing the file — missing, corrupt JSON,
|
|
526
|
+
* or a value that doesn't look like `[path, CachedFileTokens][]` — degrades to an empty `Map`
|
|
527
|
+
* instead of throwing, since a token cache is pure acceleration, never a source of truth.
|
|
528
|
+
* @param cachePath - Path to the JSON file written by `saveTokenCacheToDisk`.
|
|
529
|
+
* @returns The reconstituted `DuplicationTokenCache`, empty if nothing usable was found.
|
|
530
|
+
*/
|
|
531
|
+
declare function loadTokenCacheFromDisk(cachePath: string): DuplicationTokenCache;
|
|
532
|
+
/**
|
|
533
|
+
* @description Serializes a `DuplicationTokenCache` to JSON and writes it to disk, creating any
|
|
534
|
+
* missing parent directories. Callers should save the same `Map` `findDuplicates` already
|
|
535
|
+
* prunes to the current candidate file set after each scan (see `./index.ts`'s post-scan
|
|
536
|
+
* pruning), so the file never grows to hold stale entries beyond what the in-memory cache
|
|
537
|
+
* already holds — no separate pruning step is needed here.
|
|
538
|
+
* @param cache - The token cache to persist.
|
|
539
|
+
* @param cachePath - Destination path; parent directories are created automatically.
|
|
540
|
+
*/
|
|
541
|
+
declare function saveTokenCacheToDisk(cache: DuplicationTokenCache, cachePath: string): void;
|
|
542
|
+
|
|
543
|
+
/** Configures whether/how tokenizing is offloaded to a `piscina` worker pool. `false` always
|
|
544
|
+
* tokenizes in-process. */
|
|
545
|
+
type ParallelTokenizingOption = boolean | {
|
|
546
|
+
minFiles?: number;
|
|
547
|
+
maxThreads?: number;
|
|
548
|
+
};
|
|
549
|
+
|
|
519
550
|
interface FindDuplicatesOptions {
|
|
520
551
|
/** Minimum duplicated block size, in source lines, to report (default 6). */
|
|
521
552
|
minLines?: number | undefined;
|
|
@@ -1442,4 +1473,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1442
1473
|
*/
|
|
1443
1474
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1444
1475
|
|
|
1445
|
-
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_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, parseQuery, proposeAffectedTests, proposeTags, queryCallGraph, queryChangeImpact, queryTypeGraph, registerConfigMatcher, registerMonorepoDetector, registerParser, registerTestLibrary, registerTestPattern, saveChangeImpactCache, slimSerialize, summarizeWorkspacePackages, toMermaid };
|
|
1476
|
+
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 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -230,6 +230,17 @@ declare function configToGraphOptions(config: MokoshConfig | undefined): {
|
|
|
230
230
|
pathAliases: Record<string, string[]> | undefined;
|
|
231
231
|
};
|
|
232
232
|
|
|
233
|
+
/** Shared by the CLI's disk graph cache (`src/cli/graph-loader.ts`) and the MCP server's
|
|
234
|
+
* disk-persisted duplication token cache (`src/graph/duplication/token-cache-store.ts`) so both
|
|
235
|
+
* consumers agree on where "the cache dir" is — a CLI run and an MCP session against the same
|
|
236
|
+
* root end up sharing the same on-disk files. */
|
|
237
|
+
declare const DEFAULT_CACHE_DIR = "mokosh-cache";
|
|
238
|
+
/** Filename for the disk-persisted `find_duplicates` token cache within `DEFAULT_CACHE_DIR`. */
|
|
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";
|
|
233
244
|
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
234
245
|
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
235
246
|
interface ScanOptions {
|
|
@@ -493,13 +504,6 @@ interface DuplicateGroup {
|
|
|
493
504
|
family?: DuplicateFamily | undefined;
|
|
494
505
|
}
|
|
495
506
|
|
|
496
|
-
/** Configures whether/how tokenizing is offloaded to a `piscina` worker pool. `false` always
|
|
497
|
-
* tokenizes in-process. */
|
|
498
|
-
type ParallelTokenizingOption = boolean | {
|
|
499
|
-
minFiles?: number;
|
|
500
|
-
maxThreads?: number;
|
|
501
|
-
};
|
|
502
|
-
|
|
503
507
|
/** One file's cached tokenize result, fingerprinted by `mtime`/`size`/`ignoreLiterals` — any
|
|
504
508
|
* mismatch against the current `FileNode` (or against the `ignoreLiterals` this scan is running
|
|
505
509
|
* with) means the entry is stale and must be recomputed, exactly like `GraphBuilder`'s
|
|
@@ -516,6 +520,33 @@ interface CachedFileTokens {
|
|
|
516
520
|
* benefit own the `Map` and pass it in; the CLI's one-shot process has nothing to gain and omits
|
|
517
521
|
* it. See docs/adr-014-duplicate-detection-scale.md. */
|
|
518
522
|
type DuplicationTokenCache = Map<string, CachedFileTokens>;
|
|
523
|
+
/**
|
|
524
|
+
* @description Reads a serialized `DuplicationTokenCache` from a JSON disk file written by
|
|
525
|
+
* `saveTokenCacheToDisk`. Any problem reading or parsing the file — missing, corrupt JSON,
|
|
526
|
+
* or a value that doesn't look like `[path, CachedFileTokens][]` — degrades to an empty `Map`
|
|
527
|
+
* instead of throwing, since a token cache is pure acceleration, never a source of truth.
|
|
528
|
+
* @param cachePath - Path to the JSON file written by `saveTokenCacheToDisk`.
|
|
529
|
+
* @returns The reconstituted `DuplicationTokenCache`, empty if nothing usable was found.
|
|
530
|
+
*/
|
|
531
|
+
declare function loadTokenCacheFromDisk(cachePath: string): DuplicationTokenCache;
|
|
532
|
+
/**
|
|
533
|
+
* @description Serializes a `DuplicationTokenCache` to JSON and writes it to disk, creating any
|
|
534
|
+
* missing parent directories. Callers should save the same `Map` `findDuplicates` already
|
|
535
|
+
* prunes to the current candidate file set after each scan (see `./index.ts`'s post-scan
|
|
536
|
+
* pruning), so the file never grows to hold stale entries beyond what the in-memory cache
|
|
537
|
+
* already holds — no separate pruning step is needed here.
|
|
538
|
+
* @param cache - The token cache to persist.
|
|
539
|
+
* @param cachePath - Destination path; parent directories are created automatically.
|
|
540
|
+
*/
|
|
541
|
+
declare function saveTokenCacheToDisk(cache: DuplicationTokenCache, cachePath: string): void;
|
|
542
|
+
|
|
543
|
+
/** Configures whether/how tokenizing is offloaded to a `piscina` worker pool. `false` always
|
|
544
|
+
* tokenizes in-process. */
|
|
545
|
+
type ParallelTokenizingOption = boolean | {
|
|
546
|
+
minFiles?: number;
|
|
547
|
+
maxThreads?: number;
|
|
548
|
+
};
|
|
549
|
+
|
|
519
550
|
interface FindDuplicatesOptions {
|
|
520
551
|
/** Minimum duplicated block size, in source lines, to report (default 6). */
|
|
521
552
|
minLines?: number | undefined;
|
|
@@ -1442,4 +1473,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1442
1473
|
*/
|
|
1443
1474
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1444
1475
|
|
|
1445
|
-
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_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, parseQuery, proposeAffectedTests, proposeTags, queryCallGraph, queryChangeImpact, queryTypeGraph, registerConfigMatcher, registerMonorepoDetector, registerParser, registerTestLibrary, registerTestPattern, saveChangeImpactCache, slimSerialize, summarizeWorkspacePackages, toMermaid };
|
|
1476
|
+
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 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 };
|