@omfalos/mokosh 0.1.9 → 0.1.11
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 +28 -23
- 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 +73 -3
- package/dist/index.d.ts +73 -3
- 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[];
|
|
@@ -851,12 +851,50 @@ declare const MermaidExporter: GraphExporter;
|
|
|
851
851
|
*/
|
|
852
852
|
declare function toMermaid(graph: Graph): string;
|
|
853
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
|
+
|
|
854
880
|
/** Pure graph query/shaping functions shared by the MCP handlers and the CLI, so both surfaces return identical JSON shapes. */
|
|
855
881
|
|
|
856
882
|
interface PathWithSymbols {
|
|
857
883
|
path: string;
|
|
858
884
|
symbols?: string[];
|
|
859
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;
|
|
860
898
|
/**
|
|
861
899
|
* @description Outgoing traversal from `file` — all files it imports, up to `depth` hops.
|
|
862
900
|
* @param graph - The graph to traverse.
|
|
@@ -972,6 +1010,38 @@ declare function summarizeWorkspacePackages(wg: WorkspaceGraph): WorkspacePackag
|
|
|
972
1010
|
*/
|
|
973
1011
|
declare function hasCoverageData(graph: Graph): boolean;
|
|
974
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
|
+
|
|
975
1045
|
/** A config matcher: substring, regex, or predicate tested against the lowercase basename. */
|
|
976
1046
|
type ConfigMatcher = string | RegExp | ((baseName: string) => boolean);
|
|
977
1047
|
/**
|
|
@@ -1229,4 +1299,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1229
1299
|
*/
|
|
1230
1300
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1231
1301
|
|
|
1232
|
-
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, configToGraphOptions, 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[];
|
|
@@ -851,12 +851,50 @@ declare const MermaidExporter: GraphExporter;
|
|
|
851
851
|
*/
|
|
852
852
|
declare function toMermaid(graph: Graph): string;
|
|
853
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
|
+
|
|
854
880
|
/** Pure graph query/shaping functions shared by the MCP handlers and the CLI, so both surfaces return identical JSON shapes. */
|
|
855
881
|
|
|
856
882
|
interface PathWithSymbols {
|
|
857
883
|
path: string;
|
|
858
884
|
symbols?: string[];
|
|
859
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;
|
|
860
898
|
/**
|
|
861
899
|
* @description Outgoing traversal from `file` — all files it imports, up to `depth` hops.
|
|
862
900
|
* @param graph - The graph to traverse.
|
|
@@ -972,6 +1010,38 @@ declare function summarizeWorkspacePackages(wg: WorkspaceGraph): WorkspacePackag
|
|
|
972
1010
|
*/
|
|
973
1011
|
declare function hasCoverageData(graph: Graph): boolean;
|
|
974
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
|
+
|
|
975
1045
|
/** A config matcher: substring, regex, or predicate tested against the lowercase basename. */
|
|
976
1046
|
type ConfigMatcher = string | RegExp | ((baseName: string) => boolean);
|
|
977
1047
|
/**
|
|
@@ -1229,4 +1299,4 @@ declare function createWorkspaceGraph(rootDir: string, options?: {
|
|
|
1229
1299
|
*/
|
|
1230
1300
|
declare function getAllProjectFiles(rootDir: string, options?: ScanOptions): string[];
|
|
1231
1301
|
|
|
1232
|
-
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, configToGraphOptions, 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 };
|