@omfalos/mokosh 0.4.0 → 0.4.1
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 +30 -30
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +30 -30
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +35 -8
- package/dist/index.d.ts +35 -8
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -20
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.js +22 -21
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +23 -22
- package/dist/mcp.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -230,6 +230,13 @@ 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";
|
|
233
240
|
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
234
241
|
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
235
242
|
interface ScanOptions {
|
|
@@ -493,13 +500,6 @@ interface DuplicateGroup {
|
|
|
493
500
|
family?: DuplicateFamily | undefined;
|
|
494
501
|
}
|
|
495
502
|
|
|
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
503
|
/** One file's cached tokenize result, fingerprinted by `mtime`/`size`/`ignoreLiterals` — any
|
|
504
504
|
* mismatch against the current `FileNode` (or against the `ignoreLiterals` this scan is running
|
|
505
505
|
* with) means the entry is stale and must be recomputed, exactly like `GraphBuilder`'s
|
|
@@ -516,6 +516,33 @@ interface CachedFileTokens {
|
|
|
516
516
|
* benefit own the `Map` and pass it in; the CLI's one-shot process has nothing to gain and omits
|
|
517
517
|
* it. See docs/adr-014-duplicate-detection-scale.md. */
|
|
518
518
|
type DuplicationTokenCache = Map<string, CachedFileTokens>;
|
|
519
|
+
/**
|
|
520
|
+
* @description Reads a serialized `DuplicationTokenCache` from a JSON disk file written by
|
|
521
|
+
* `saveTokenCacheToDisk`. Any problem reading or parsing the file — missing, corrupt JSON,
|
|
522
|
+
* or a value that doesn't look like `[path, CachedFileTokens][]` — degrades to an empty `Map`
|
|
523
|
+
* instead of throwing, since a token cache is pure acceleration, never a source of truth.
|
|
524
|
+
* @param cachePath - Path to the JSON file written by `saveTokenCacheToDisk`.
|
|
525
|
+
* @returns The reconstituted `DuplicationTokenCache`, empty if nothing usable was found.
|
|
526
|
+
*/
|
|
527
|
+
declare function loadTokenCacheFromDisk(cachePath: string): DuplicationTokenCache;
|
|
528
|
+
/**
|
|
529
|
+
* @description Serializes a `DuplicationTokenCache` to JSON and writes it to disk, creating any
|
|
530
|
+
* missing parent directories. Callers should save the same `Map` `findDuplicates` already
|
|
531
|
+
* prunes to the current candidate file set after each scan (see `./index.ts`'s post-scan
|
|
532
|
+
* pruning), so the file never grows to hold stale entries beyond what the in-memory cache
|
|
533
|
+
* already holds — no separate pruning step is needed here.
|
|
534
|
+
* @param cache - The token cache to persist.
|
|
535
|
+
* @param cachePath - Destination path; parent directories are created automatically.
|
|
536
|
+
*/
|
|
537
|
+
declare function saveTokenCacheToDisk(cache: DuplicationTokenCache, cachePath: string): void;
|
|
538
|
+
|
|
539
|
+
/** Configures whether/how tokenizing is offloaded to a `piscina` worker pool. `false` always
|
|
540
|
+
* tokenizes in-process. */
|
|
541
|
+
type ParallelTokenizingOption = boolean | {
|
|
542
|
+
minFiles?: number;
|
|
543
|
+
maxThreads?: number;
|
|
544
|
+
};
|
|
545
|
+
|
|
519
546
|
interface FindDuplicatesOptions {
|
|
520
547
|
/** Minimum duplicated block size, in source lines, to report (default 6). */
|
|
521
548
|
minLines?: number | undefined;
|
|
@@ -1442,4 +1469,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1442
1469
|
*/
|
|
1443
1470
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1444
1471
|
|
|
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -230,6 +230,13 @@ 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";
|
|
233
240
|
declare const DEFAULT_IGNORE_DIRS: readonly string[];
|
|
234
241
|
declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
235
242
|
interface ScanOptions {
|
|
@@ -493,13 +500,6 @@ interface DuplicateGroup {
|
|
|
493
500
|
family?: DuplicateFamily | undefined;
|
|
494
501
|
}
|
|
495
502
|
|
|
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
503
|
/** One file's cached tokenize result, fingerprinted by `mtime`/`size`/`ignoreLiterals` — any
|
|
504
504
|
* mismatch against the current `FileNode` (or against the `ignoreLiterals` this scan is running
|
|
505
505
|
* with) means the entry is stale and must be recomputed, exactly like `GraphBuilder`'s
|
|
@@ -516,6 +516,33 @@ interface CachedFileTokens {
|
|
|
516
516
|
* benefit own the `Map` and pass it in; the CLI's one-shot process has nothing to gain and omits
|
|
517
517
|
* it. See docs/adr-014-duplicate-detection-scale.md. */
|
|
518
518
|
type DuplicationTokenCache = Map<string, CachedFileTokens>;
|
|
519
|
+
/**
|
|
520
|
+
* @description Reads a serialized `DuplicationTokenCache` from a JSON disk file written by
|
|
521
|
+
* `saveTokenCacheToDisk`. Any problem reading or parsing the file — missing, corrupt JSON,
|
|
522
|
+
* or a value that doesn't look like `[path, CachedFileTokens][]` — degrades to an empty `Map`
|
|
523
|
+
* instead of throwing, since a token cache is pure acceleration, never a source of truth.
|
|
524
|
+
* @param cachePath - Path to the JSON file written by `saveTokenCacheToDisk`.
|
|
525
|
+
* @returns The reconstituted `DuplicationTokenCache`, empty if nothing usable was found.
|
|
526
|
+
*/
|
|
527
|
+
declare function loadTokenCacheFromDisk(cachePath: string): DuplicationTokenCache;
|
|
528
|
+
/**
|
|
529
|
+
* @description Serializes a `DuplicationTokenCache` to JSON and writes it to disk, creating any
|
|
530
|
+
* missing parent directories. Callers should save the same `Map` `findDuplicates` already
|
|
531
|
+
* prunes to the current candidate file set after each scan (see `./index.ts`'s post-scan
|
|
532
|
+
* pruning), so the file never grows to hold stale entries beyond what the in-memory cache
|
|
533
|
+
* already holds — no separate pruning step is needed here.
|
|
534
|
+
* @param cache - The token cache to persist.
|
|
535
|
+
* @param cachePath - Destination path; parent directories are created automatically.
|
|
536
|
+
*/
|
|
537
|
+
declare function saveTokenCacheToDisk(cache: DuplicationTokenCache, cachePath: string): void;
|
|
538
|
+
|
|
539
|
+
/** Configures whether/how tokenizing is offloaded to a `piscina` worker pool. `false` always
|
|
540
|
+
* tokenizes in-process. */
|
|
541
|
+
type ParallelTokenizingOption = boolean | {
|
|
542
|
+
minFiles?: number;
|
|
543
|
+
maxThreads?: number;
|
|
544
|
+
};
|
|
545
|
+
|
|
519
546
|
interface FindDuplicatesOptions {
|
|
520
547
|
/** Minimum duplicated block size, in source lines, to report (default 6). */
|
|
521
548
|
minLines?: number | undefined;
|
|
@@ -1442,4 +1469,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1442
1469
|
*/
|
|
1443
1470
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1444
1471
|
|
|
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 };
|
|
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 };
|