@yalehwang/archguard 0.1.10 → 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 +81 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,12 +15,12 @@ ArchGuard analyzes source code to extract architectural insights and generates *
|
|
|
15
15
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
|
+
- **AI-Native MCP Interface**: Query architecture in natural language from Claude Code or Codex — analyze projects, trace dependencies, find implementers, detect cycles
|
|
18
19
|
- **Multi-Language Support**: TypeScript, Go, Java, Python via plugin system
|
|
19
20
|
- **Multi-Level Diagrams**: Package (high-level), Class (default), Method (low-level)
|
|
20
21
|
- **Go Architecture Atlas**: 4-layer visualization — package graph, capability graph, goroutine topology, flow graph
|
|
21
22
|
- **Parallel Processing**: High-performance parsing with configurable concurrency
|
|
22
23
|
- **Smart Caching**: File-based caching with SHA-256 hashing for fast repeated runs
|
|
23
|
-
- **Query & MCP Workflows**: Persisted architecture data can be inspected via CLI query tools or MCP
|
|
24
24
|
- **Zero External Dependencies**: Local Mermaid rendering using isomorphic-mermaid
|
|
25
25
|
- **Five-Layer Validation**: Automatic syntax, structure, render, quality, and auto-repair validation
|
|
26
26
|
- **Configuration Files**: Project-level config with `archguard.config.json` support
|
|
@@ -34,36 +34,73 @@ ArchGuard analyzes source code to extract architectural insights and generates *
|
|
|
34
34
|
npm install -g @yalehwang/archguard
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### Using with Claude Code
|
|
38
|
+
|
|
39
|
+
Register the MCP server (project scope):
|
|
38
40
|
|
|
39
41
|
```bash
|
|
40
|
-
|
|
42
|
+
claude mcp add --scope project archguard -- archguard mcp
|
|
41
43
|
```
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
Then ask Claude to analyze any project:
|
|
46
|
+
|
|
47
|
+
> Analyze the architecture of `/path/to/my-project` using archguard MCP.
|
|
48
|
+
|
|
49
|
+
Claude will call `archguard_analyze` to parse the project and build a query index. Once done, ask follow-up questions in natural language:
|
|
50
|
+
|
|
51
|
+
> Find all classes that implement `ILanguagePlugin`.
|
|
52
|
+
|
|
53
|
+
> Show me what depends on `ArchJSON`, depth 1.
|
|
54
|
+
|
|
55
|
+
> Detect circular dependencies in this project.
|
|
56
|
+
|
|
57
|
+
> Review this project's code and documentation using the archguard MCP and the `.archguard` output files.
|
|
58
|
+
|
|
59
|
+
> Based on the archguard analysis, suggest refactoring directions for reducing coupling.
|
|
44
60
|
|
|
45
|
-
|
|
61
|
+
**Re-using an existing analysis**: If the project was already analyzed in a previous session, query artifacts persist in `.archguard/query/`. You can skip re-analysis and query the cache directly:
|
|
62
|
+
|
|
63
|
+
> Using the existing archguard cache, show me what depends on `DiagramProcessor`.
|
|
64
|
+
|
|
65
|
+
### Using with Codex
|
|
66
|
+
|
|
67
|
+
Register the MCP server:
|
|
46
68
|
|
|
47
69
|
```bash
|
|
48
|
-
|
|
70
|
+
codex mcp add archguard -- archguard mcp
|
|
49
71
|
```
|
|
50
72
|
|
|
51
|
-
|
|
73
|
+
Or add to `~/.codex/config.toml`:
|
|
52
74
|
|
|
53
|
-
```
|
|
54
|
-
archguard
|
|
75
|
+
```toml
|
|
76
|
+
[mcp_servers.archguard]
|
|
77
|
+
command = "archguard"
|
|
78
|
+
args = ["mcp"]
|
|
55
79
|
```
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
Then prompt Codex in the same way. The same MCP tools are available.
|
|
82
|
+
|
|
83
|
+
### Analyzing an External Project
|
|
84
|
+
|
|
85
|
+
Point archguard at any project path — no configuration file needed:
|
|
86
|
+
|
|
87
|
+
> Analyze the architecture of `/home/user/work/my-project` using archguard MCP.
|
|
88
|
+
|
|
89
|
+
Archguard auto-detects the language and project structure, generates diagrams under `<project>/.archguard/`, and builds the query index for follow-up queries.
|
|
58
90
|
|
|
59
|
-
###
|
|
91
|
+
### Standalone CLI
|
|
92
|
+
|
|
93
|
+
Run directly without an AI assistant:
|
|
60
94
|
|
|
61
95
|
```bash
|
|
62
|
-
#
|
|
63
|
-
archguard analyze
|
|
96
|
+
# Analyze current project (auto-detects language and structure)
|
|
97
|
+
archguard analyze
|
|
98
|
+
|
|
99
|
+
# Analyze an external project
|
|
100
|
+
archguard analyze -s /path/to/project/src
|
|
64
101
|
|
|
65
|
-
#
|
|
66
|
-
archguard analyze -s ./
|
|
102
|
+
# Go project
|
|
103
|
+
archguard analyze -s ./cmd --lang go
|
|
67
104
|
```
|
|
68
105
|
|
|
69
106
|
## CLI Commands
|
|
@@ -186,6 +223,34 @@ archguard mcp [--arch-dir <dir>] [--scope <key>]
|
|
|
186
223
|
|
|
187
224
|
The MCP server exposes the query tools plus `archguard_analyze`, which refreshes query artifacts for the current MCP session. Query tools default to the persisted global scope and return summary entities unless `verbose: true` is requested.
|
|
188
225
|
|
|
226
|
+
**Claude Code** — add via CLI (project scope):
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
claude mcp add --scope project archguard -- archguard mcp
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Codex** — add via CLI or `~/.codex/config.toml`:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
codex mcp add archguard -- archguard mcp
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Available MCP tools:**
|
|
239
|
+
|
|
240
|
+
| Tool | Purpose |
|
|
241
|
+
|------|---------|
|
|
242
|
+
| `archguard_summary` | Project overview: entity/relation counts, scope list |
|
|
243
|
+
| `archguard_find_entity` | Look up a named class, interface, or function |
|
|
244
|
+
| `archguard_get_dependencies` | Outgoing dependencies of an entity (what it uses) |
|
|
245
|
+
| `archguard_get_dependents` | Incoming dependencies of an entity (who uses it) |
|
|
246
|
+
| `archguard_find_implementers` | All implementations of an interface |
|
|
247
|
+
| `archguard_find_subclasses` | All subclasses of a base class |
|
|
248
|
+
| `archguard_get_file_entities` | All entities defined in a source file |
|
|
249
|
+
| `archguard_detect_cycles` | Circular dependency detection |
|
|
250
|
+
| `archguard_analyze` | Refresh query artifacts in the current session |
|
|
251
|
+
|
|
252
|
+
See [MCP Usage Guide](docs/user-guide/mcp-usage.md) for setup, tool reference, and usage patterns.
|
|
253
|
+
|
|
189
254
|
### `init`
|
|
190
255
|
|
|
191
256
|
Initialize configuration file:
|
|
@@ -540,6 +605,7 @@ Quick fixes:
|
|
|
540
605
|
|
|
541
606
|
- [CLI Usage Guide](docs/user-guide/cli-usage.md)
|
|
542
607
|
- [Architecture Checking Scenarios](docs/user-guide/architecture-checking-scenarios.md)
|
|
608
|
+
- [MCP Usage Guide](docs/user-guide/mcp-usage.md)
|
|
543
609
|
- [Configuration Reference](docs/user-guide/configuration.md)
|
|
544
610
|
- [Go Plugin Usage Guide](docs/user-guide/golang-plugin-usage.md)
|
|
545
611
|
- [Architecture Overview](docs/dev-guide/architecture.md)
|