archtracker-mcp 0.4.2 → 0.5.0
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 +189 -14
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/cli/index.js +1549 -125
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +94 -4
- package/dist/index.js +624 -32
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.js +716 -74
- package/dist/mcp/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/arch-analyze/SKILL.md +6 -2
- package/skills/arch-check/SKILL.md +11 -8
- package/skills/arch-context/SKILL.md +8 -6
- package/skills/arch-search/SKILL.md +7 -7
- package/skills/arch-serve/SKILL.md +27 -0
- package/skills/arch-snapshot/SKILL.md +9 -6
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ArchTracker core schema definitions.
|
|
3
3
|
* Snapshot format is versioned for backward compatibility.
|
|
4
4
|
*/
|
|
5
|
-
declare const SCHEMA_VERSION: "1.
|
|
5
|
+
declare const SCHEMA_VERSION: "1.1";
|
|
6
6
|
/** A single dependency edge: source imports target */
|
|
7
7
|
interface DependencyEdge {
|
|
8
8
|
source: string;
|
|
@@ -29,12 +29,33 @@ interface DependencyGraph {
|
|
|
29
29
|
totalFiles: number;
|
|
30
30
|
totalEdges: number;
|
|
31
31
|
}
|
|
32
|
+
/** Metadata about a single layer within a multi-layer graph */
|
|
33
|
+
interface LayerMetadata {
|
|
34
|
+
name: string;
|
|
35
|
+
originalRootDir: string;
|
|
36
|
+
language: string;
|
|
37
|
+
color: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
fileCount: number;
|
|
40
|
+
edgeCount: number;
|
|
41
|
+
}
|
|
42
|
+
/** A multi-layer dependency graph combining multiple single-layer analyses */
|
|
43
|
+
interface MultiLayerGraph {
|
|
44
|
+
/** Individual layer graphs (un-prefixed paths, original rootDirs) */
|
|
45
|
+
layers: Record<string, DependencyGraph>;
|
|
46
|
+
/** Layer metadata for rendering */
|
|
47
|
+
layerMetadata: LayerMetadata[];
|
|
48
|
+
/** Merged graph with layer-prefixed paths ("LayerName/path.ts") */
|
|
49
|
+
merged: DependencyGraph;
|
|
50
|
+
}
|
|
32
51
|
/** Persisted snapshot with schema version */
|
|
33
52
|
interface ArchSnapshot {
|
|
34
|
-
version: typeof SCHEMA_VERSION;
|
|
53
|
+
version: typeof SCHEMA_VERSION | "1.0";
|
|
35
54
|
timestamp: string;
|
|
36
55
|
rootDir: string;
|
|
37
56
|
graph: DependencyGraph;
|
|
57
|
+
/** Present only when layers.json was used */
|
|
58
|
+
multiLayer?: MultiLayerGraph;
|
|
38
59
|
}
|
|
39
60
|
/** Diff result between two snapshots */
|
|
40
61
|
interface ArchDiff {
|
|
@@ -64,6 +85,41 @@ interface ArchContext {
|
|
|
64
85
|
declare const LANGUAGE_IDS: readonly ["javascript", "python", "rust", "go", "java", "c-cpp", "c-sharp", "ruby", "php", "swift", "kotlin", "dart", "scala"];
|
|
65
86
|
type LanguageId = (typeof LANGUAGE_IDS)[number];
|
|
66
87
|
|
|
88
|
+
/** Definition of a single architecture layer */
|
|
89
|
+
interface LayerDefinition {
|
|
90
|
+
/** Unique layer name (used as path prefix: "Backend/worker.py") */
|
|
91
|
+
name: string;
|
|
92
|
+
/** Target directory to analyze (relative to project root) */
|
|
93
|
+
targetDir: string;
|
|
94
|
+
/** Language for this layer (auto-detected if omitted) */
|
|
95
|
+
language?: LanguageId;
|
|
96
|
+
/** Exclude patterns specific to this layer */
|
|
97
|
+
exclude?: string[];
|
|
98
|
+
/** Display color (CSS color, e.g. "#58a6ff"). Auto-assigned if omitted. */
|
|
99
|
+
color?: string;
|
|
100
|
+
/** Optional description shown in the viewer */
|
|
101
|
+
description?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Layer configuration schema (.archtracker/layers.json).
|
|
105
|
+
* The `connections` field is reserved for future cross-layer edge support.
|
|
106
|
+
*/
|
|
107
|
+
interface LayerConfig {
|
|
108
|
+
version: "1.0";
|
|
109
|
+
layers: LayerDefinition[];
|
|
110
|
+
/** Reserved for future cross-layer connection definitions */
|
|
111
|
+
connections?: CrossLayerConnection[];
|
|
112
|
+
}
|
|
113
|
+
/** Cross-layer edge definition */
|
|
114
|
+
interface CrossLayerConnection {
|
|
115
|
+
fromLayer: string;
|
|
116
|
+
fromFile: string;
|
|
117
|
+
toLayer: string;
|
|
118
|
+
toFile: string;
|
|
119
|
+
type: "api-call" | "event" | "data-flow" | "manual" | "auto";
|
|
120
|
+
label?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
67
123
|
/** Options for the dependency analyzer */
|
|
68
124
|
interface AnalyzeOptions {
|
|
69
125
|
/** Regex patterns to exclude from analysis (e.g. ["node_modules", "\\.test\\.ts$"]) */
|
|
@@ -94,13 +150,37 @@ declare function formatAnalysisReport(graph: DependencyGraph, options?: {
|
|
|
94
150
|
topN?: number;
|
|
95
151
|
}): string;
|
|
96
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Analyze multiple layers and produce a MultiLayerGraph.
|
|
155
|
+
*
|
|
156
|
+
* Each layer is analyzed independently via analyzeProject().
|
|
157
|
+
* Results are merged into a unified graph with layer-prefixed node paths.
|
|
158
|
+
*/
|
|
159
|
+
declare function analyzeMultiLayer(projectRoot: string, layerDefs: LayerDefinition[]): Promise<MultiLayerGraph>;
|
|
160
|
+
/**
|
|
161
|
+
* Auto-detect cross-layer connections by scanning file contents
|
|
162
|
+
* for references to identifiers defined in other layers.
|
|
163
|
+
*
|
|
164
|
+
* Strategies:
|
|
165
|
+
* 1. Unique type-name matching — PascalCase/snake_case names unique to exactly
|
|
166
|
+
* one target layer, with context validation (not self-definitions, not
|
|
167
|
+
* local imports, not ambiguous across layers).
|
|
168
|
+
* 2. Typed reference patterns — "StorageClient", "AuthService", etc.
|
|
169
|
+
* 3. Cross-layer import/URL patterns — import paths or URL patterns referencing
|
|
170
|
+
* another layer's directory, with strict context for short names.
|
|
171
|
+
*
|
|
172
|
+
* Results are deduplicated to max 1 connection per (sourceLayer → targetLayer) pair,
|
|
173
|
+
* keeping the highest-scoring match. A minimum score threshold is enforced.
|
|
174
|
+
*/
|
|
175
|
+
declare function detectCrossLayerConnections(layers: Record<string, DependencyGraph>, layerDefs: LayerDefinition[]): CrossLayerConnection[];
|
|
176
|
+
|
|
97
177
|
/**
|
|
98
178
|
* Save a dependency graph as a versioned snapshot.
|
|
99
179
|
*
|
|
100
180
|
* Creates .archtracker/ directory if it doesn't exist.
|
|
101
181
|
* Writes snapshot.json with schema version and timestamp.
|
|
102
182
|
*/
|
|
103
|
-
declare function saveSnapshot(projectRoot: string, graph: DependencyGraph): Promise<ArchSnapshot>;
|
|
183
|
+
declare function saveSnapshot(projectRoot: string, graph: DependencyGraph, multiLayer?: MultiLayerGraph): Promise<ArchSnapshot>;
|
|
104
184
|
/**
|
|
105
185
|
* Load the most recent snapshot from .archtracker/snapshot.json.
|
|
106
186
|
*
|
|
@@ -128,6 +208,16 @@ declare function computeDiff(oldGraph: DependencyGraph, newGraph: DependencyGrap
|
|
|
128
208
|
/** Generate a human-readable report from an ArchDiff */
|
|
129
209
|
declare function formatDiffReport(diff: ArchDiff): string;
|
|
130
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Load layers.json from .archtracker/ if it exists.
|
|
213
|
+
* Returns null if no config file found.
|
|
214
|
+
*/
|
|
215
|
+
declare function loadLayerConfig(projectRoot: string): Promise<LayerConfig | null>;
|
|
216
|
+
/**
|
|
217
|
+
* Save a LayerConfig to .archtracker/layers.json.
|
|
218
|
+
*/
|
|
219
|
+
declare function saveLayerConfig(projectRoot: string, config: LayerConfig): Promise<void>;
|
|
220
|
+
|
|
131
221
|
type Locale = "en" | "ja";
|
|
132
222
|
/** Get the current locale */
|
|
133
223
|
declare function getLocale(): Locale;
|
|
@@ -136,4 +226,4 @@ declare function setLocale(locale: Locale): void;
|
|
|
136
226
|
/** Get a translated message by key */
|
|
137
227
|
declare function t(key: string, vars?: Record<string, string | number>): string;
|
|
138
228
|
|
|
139
|
-
export { type AnalyzeOptions, AnalyzerError, type ArchContext, type ArchDiff, type ArchSnapshot, type CircularDependency, type DependencyEdge, type DependencyGraph, type FileNode, type Locale, SCHEMA_VERSION, StorageError, analyzeProject, computeDiff, formatAnalysisReport, formatDiffReport, getLocale, hasArchtrackerDir, loadSnapshot, saveSnapshot, setLocale, t };
|
|
229
|
+
export { type AnalyzeOptions, AnalyzerError, type ArchContext, type ArchDiff, type ArchSnapshot, type CircularDependency, type CrossLayerConnection, type DependencyEdge, type DependencyGraph, type FileNode, type LayerConfig, type LayerDefinition, type LayerMetadata, type Locale, type MultiLayerGraph, SCHEMA_VERSION, StorageError, analyzeMultiLayer, analyzeProject, computeDiff, detectCrossLayerConnections, formatAnalysisReport, formatDiffReport, getLocale, hasArchtrackerDir, loadLayerConfig, loadSnapshot, saveLayerConfig, saveSnapshot, setLocale, t };
|