archrip 0.1.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/commands/build.d.ts +2 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +88 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +58 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/serve.d.ts +2 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +27 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/install/slash-commands.d.ts +6 -0
- package/dist/install/slash-commands.d.ts.map +1 -0
- package/dist/install/slash-commands.js +31 -0
- package/dist/install/slash-commands.js.map +1 -0
- package/dist/install/viewer.d.ts +5 -0
- package/dist/install/viewer.d.ts.map +1 -0
- package/dist/install/viewer.js +40 -0
- package/dist/install/viewer.js.map +1 -0
- package/dist/schema/architecture.schema.json +144 -0
- package/dist/templates/skeleton.json +15 -0
- package/dist/templates/slash-commands/claude/archrip-refine.md +17 -0
- package/dist/templates/slash-commands/claude/archrip-scan.md +140 -0
- package/dist/templates/slash-commands/claude/archrip-update.md +34 -0
- package/dist/templates/slash-commands/claude/archrips-refine.md +17 -0
- package/dist/templates/slash-commands/claude/archrips-scan.md +97 -0
- package/dist/templates/slash-commands/claude/archrips-update.md +18 -0
- package/dist/templates/slash-commands/codex/archrip-refine.md +17 -0
- package/dist/templates/slash-commands/codex/archrip-scan.md +140 -0
- package/dist/templates/slash-commands/codex/archrip-update.md +34 -0
- package/dist/templates/slash-commands/codex/archrips-refine.md +17 -0
- package/dist/templates/slash-commands/codex/archrips-scan.md +97 -0
- package/dist/templates/slash-commands/codex/archrips-update.md +18 -0
- package/dist/templates/slash-commands/gemini/archrip-refine.md +17 -0
- package/dist/templates/slash-commands/gemini/archrip-scan.md +140 -0
- package/dist/templates/slash-commands/gemini/archrip-update.md +34 -0
- package/dist/templates/slash-commands/gemini/archrips-refine.md +17 -0
- package/dist/templates/slash-commands/gemini/archrips-scan.md +97 -0
- package/dist/templates/slash-commands/gemini/archrips-update.md +18 -0
- package/dist/utils/detect-agents.d.ts +15 -0
- package/dist/utils/detect-agents.d.ts.map +1 -0
- package/dist/utils/detect-agents.js +29 -0
- package/dist/utils/detect-agents.js.map +1 -0
- package/dist/utils/gitignore.d.ts +5 -0
- package/dist/utils/gitignore.d.ts.map +1 -0
- package/dist/utils/gitignore.js +21 -0
- package/dist/utils/gitignore.js.map +1 -0
- package/dist/utils/layout.d.ts +17 -0
- package/dist/utils/layout.d.ts.map +1 -0
- package/dist/utils/layout.js +121 -0
- package/dist/utils/layout.js.map +1 -0
- package/dist/utils/layout.spec.d.ts +2 -0
- package/dist/utils/layout.spec.d.ts.map +1 -0
- package/dist/utils/layout.spec.js +176 -0
- package/dist/utils/layout.spec.js.map +1 -0
- package/dist/utils/paths.d.ts +3 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +28 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/project-info.d.ts +9 -0
- package/dist/utils/project-info.d.ts.map +1 -0
- package/dist/utils/project-info.js +86 -0
- package/dist/utils/project-info.js.map +1 -0
- package/dist/utils/validate.d.ts +88 -0
- package/dist/utils/validate.d.ts.map +1 -0
- package/dist/utils/validate.js +238 -0
- package/dist/utils/validate.js.map +1 -0
- package/dist/utils/validate.spec.d.ts +2 -0
- package/dist/utils/validate.spec.d.ts.map +1 -0
- package/dist/utils/validate.spec.js +424 -0
- package/dist/utils/validate.spec.js.map +1 -0
- package/dist/utils/verbose.d.ts +3 -0
- package/dist/utils/verbose.d.ts.map +1 -0
- package/dist/utils/verbose.js +8 -0
- package/dist/utils/verbose.js.map +1 -0
- package/dist/viewer-template/index.html +15 -0
- package/dist/viewer-template/package-lock.json +2714 -0
- package/dist/viewer-template/package.json +26 -0
- package/dist/viewer-template/src/App.tsx +168 -0
- package/dist/viewer-template/src/components/DepthFilter.tsx +43 -0
- package/dist/viewer-template/src/components/DetailPanel.tsx +261 -0
- package/dist/viewer-template/src/components/Legend.tsx +41 -0
- package/dist/viewer-template/src/components/ThemeToggle.tsx +37 -0
- package/dist/viewer-template/src/components/UseCaseFilter.tsx +59 -0
- package/dist/viewer-template/src/components/nodes/ArchNode.tsx +37 -0
- package/dist/viewer-template/src/data/loader.ts +140 -0
- package/dist/viewer-template/src/hooks/useArchitecture.ts +32 -0
- package/dist/viewer-template/src/hooks/useDepthFilter.ts +37 -0
- package/dist/viewer-template/src/hooks/useTheme.ts +39 -0
- package/dist/viewer-template/src/hooks/useUseCaseFilter.ts +56 -0
- package/dist/viewer-template/src/index.css +130 -0
- package/dist/viewer-template/src/main.tsx +13 -0
- package/dist/viewer-template/src/types.ts +125 -0
- package/dist/viewer-template/tsconfig.app.json +24 -0
- package/dist/viewer-template/tsconfig.json +7 -0
- package/dist/viewer-template/tsconfig.node.json +22 -0
- package/dist/viewer-template/vite.config.ts +7 -0
- package/package.json +45 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scan codebase and generate architecture diagram data
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrip scan — Analyze codebase architecture
|
|
6
|
+
|
|
7
|
+
Analyze the current codebase and generate `.archrip/architecture.json`.
|
|
8
|
+
|
|
9
|
+
**Language rule:** Respond in the same language as the user's message or `$ARGUMENTS`. If no user text is available, detect the project's primary language from README/docs and match it. The `architecture.json` fields (labels, descriptions) should also use that language.
|
|
10
|
+
|
|
11
|
+
## Phase 1: Project Discovery
|
|
12
|
+
1. Read top-level files (package.json, composer.json, go.mod, Cargo.toml, pom.xml, pyproject.toml, etc.)
|
|
13
|
+
2. Identify language, framework, source root
|
|
14
|
+
3. List directory structure (2 levels deep)
|
|
15
|
+
4. Auto-detect `sourceUrl`: Run `git remote get-url origin` and convert to browse URL:
|
|
16
|
+
- `git@github.com:org/repo.git` → `https://github.com/org/repo/blob/main/{filePath}`
|
|
17
|
+
- `https://github.com/org/repo.git` → `https://github.com/org/repo/blob/main/{filePath}`
|
|
18
|
+
- `git@gitlab.com:org/repo.git` → `https://gitlab.com/org/repo/-/blob/main/{filePath}`
|
|
19
|
+
- If no git remote, leave empty (ask in Phase 7)
|
|
20
|
+
|
|
21
|
+
## Phase 2: Documentation Discovery
|
|
22
|
+
Read existing documentation to understand architecture context:
|
|
23
|
+
1. Check for: README.md, CLAUDE.md, docs/, doc/, wiki/, ARCHITECTURE.md, CONTRIBUTING.md
|
|
24
|
+
2. Extract: system overview, component descriptions, external service integrations, design decisions
|
|
25
|
+
3. Use this knowledge to inform the analysis — documentation often reveals architectural intent that code alone does not show (use cases, business context, external dependencies)
|
|
26
|
+
|
|
27
|
+
## Phase 3: Layer Identification
|
|
28
|
+
Based on the framework, identify architectural layers:
|
|
29
|
+
|
|
30
|
+
**Common patterns:**
|
|
31
|
+
- Laravel: Controllers → Services → Ports → Adapters → Models
|
|
32
|
+
- Express/NestJS: Routes/Controllers → Services → Repositories → Models
|
|
33
|
+
- Next.js: Pages → Components → Hooks → API Routes → Services
|
|
34
|
+
- Django: Views → Serializers → Services → Models
|
|
35
|
+
- Spring Boot: Controllers → Services → Repositories → Entities
|
|
36
|
+
- Go: Handlers → Services → Repositories → Models
|
|
37
|
+
- Generic: Group by directory responsibility
|
|
38
|
+
|
|
39
|
+
## Phase 4: Read Key Files
|
|
40
|
+
For each layer, read representative files to extract:
|
|
41
|
+
- Component names and purposes
|
|
42
|
+
- Dependencies (imports, injections)
|
|
43
|
+
- Public methods/routes
|
|
44
|
+
- Database schemas (from migrations or model definitions)
|
|
45
|
+
|
|
46
|
+
**Do NOT read every file.** Focus on entry points, core logic, interfaces, and data models.
|
|
47
|
+
|
|
48
|
+
## Phase 5: Map Relationships
|
|
49
|
+
For each component, identify:
|
|
50
|
+
- What it depends on (imports, constructor injection)
|
|
51
|
+
- What depends on it
|
|
52
|
+
- External service connections
|
|
53
|
+
|
|
54
|
+
**Connectivity check:** After mapping, verify every node has at least one edge. If a node is orphaned:
|
|
55
|
+
- DTOs/entities → connect to the service or adapter that references them
|
|
56
|
+
- External services → connect to the adapter/controller that integrates with them
|
|
57
|
+
- Models → connect to the adapter/repository that queries them
|
|
58
|
+
|
|
59
|
+
## Phase 6: Identify Use Cases
|
|
60
|
+
Group related components into user-facing features.
|
|
61
|
+
|
|
62
|
+
## Phase 7: Draft Review — STOP and ask the developer
|
|
63
|
+
|
|
64
|
+
**IMPORTANT: Do NOT proceed to Phase 8 until the developer responds. You MUST stop here and wait for input.**
|
|
65
|
+
|
|
66
|
+
Present a summary of what you found:
|
|
67
|
+
- **Documents read**: List all docs you read in Phase 2 (e.g., README.md, CLAUDE.md, docs/architecture.md)
|
|
68
|
+
- List of discovered nodes (grouped by layer/category)
|
|
69
|
+
- List of discovered use cases
|
|
70
|
+
- External services found
|
|
71
|
+
|
|
72
|
+
Then ask:
|
|
73
|
+
- Are there other documents you should read? (e.g., docs/, wiki/, design docs)
|
|
74
|
+
- Are there missing components, external services, or use cases?
|
|
75
|
+
- Should anything be excluded?
|
|
76
|
+
- `sourceUrl` auto-detected as: `<detected-url>` — correct? (If not detected, ask for the `sourceUrl` template, e.g., `https://github.com/org/repo/blob/main/{filePath}`)
|
|
77
|
+
|
|
78
|
+
End your message with: **"Please review and reply with corrections, or type 'go' to generate."**
|
|
79
|
+
|
|
80
|
+
**Do NOT write architecture.json yet. Wait for the developer to respond.**
|
|
81
|
+
|
|
82
|
+
If the developer replies with corrections, apply them and present the updated summary. Repeat until they say "go" / "ok" / "skip".
|
|
83
|
+
|
|
84
|
+
## Phase 8: Generate architecture.json
|
|
85
|
+
Only run this phase AFTER the developer has approved the draft in Phase 7.
|
|
86
|
+
|
|
87
|
+
Create `.archrip/` directory if it doesn't exist, then write the complete `.archrip/architecture.json` following the schema, incorporating developer feedback.
|
|
88
|
+
|
|
89
|
+
After writing the file:
|
|
90
|
+
1. Run `npx archrip serve` in the terminal (auto-builds if needed, opens browser)
|
|
91
|
+
2. Tell the developer: Run `/archrip-update` to make further adjustments (add/remove nodes, fix relationships, etc.)
|
|
92
|
+
|
|
93
|
+
### Required structure (use EXACTLY these field names)
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"version": "1.0",
|
|
98
|
+
"project": { "name": "...", "sourceUrl": "https://github.com/org/repo/blob/main/{filePath}" },
|
|
99
|
+
"nodes": [
|
|
100
|
+
{ "id": "ctrl-users", "category": "controller", "label": "UsersController", "layer": 1, "filePath": "src/controllers/users.ts", "useCases": ["uc-user-mgmt"] }
|
|
101
|
+
],
|
|
102
|
+
"edges": [
|
|
103
|
+
{ "source": "ctrl-users", "target": "svc-users", "type": "dependency" }
|
|
104
|
+
],
|
|
105
|
+
"useCases": [
|
|
106
|
+
{ "id": "uc-user-mgmt", "name": "User Management", "nodeIds": ["ctrl-users", "svc-users"] }
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Critical field names — do NOT use alternatives:**
|
|
112
|
+
- Node: `id`, `category`, `label` (NOT name), `layer` — all required
|
|
113
|
+
- Edge: `source`, `target` (NOT from/to) — all required
|
|
114
|
+
- UseCase: `id`, `name`, `nodeIds` — all required
|
|
115
|
+
|
|
116
|
+
### Node Rules
|
|
117
|
+
- `id`: kebab-case, prefixed by category abbreviation (ctrl-, svc-, port-, adpt-, model-, ext-, job-, dto-)
|
|
118
|
+
- `layer`: 0=external, 1=entry points, 2=application logic, 3=abstractions, 4=implementations, 5=data
|
|
119
|
+
- `category`: one of controller, service, port, adapter, model, external, job, dto (or custom)
|
|
120
|
+
- `label`: display name for the node
|
|
121
|
+
- `filePath`: relative from project root
|
|
122
|
+
- `depth` (optional): 0=overview (boundary), 1=structure (internal), 2=detail (implementation). Auto-inferred from category if omitted
|
|
123
|
+
- `useCases`: array of use case IDs this node participates in
|
|
124
|
+
|
|
125
|
+
### Edge Rules
|
|
126
|
+
- `source`: source node id
|
|
127
|
+
- `target`: target node id
|
|
128
|
+
- `type`: dependency | implements | relation
|
|
129
|
+
- Only include significant architectural dependencies (not utility imports)
|
|
130
|
+
- **Every node MUST have at least one edge.** If a node has no obvious dependency, connect it with a `relation` edge to the component that uses or contains it.
|
|
131
|
+
|
|
132
|
+
### Layout Selection
|
|
133
|
+
- DDD / Clean Architecture / Hexagonal / Onion Architecture → add `"layout": "concentric"` to `project`
|
|
134
|
+
- MVC / standard layered → `"layout": "dagre"` (default, can be omitted)
|
|
135
|
+
|
|
136
|
+
### Schema Rules
|
|
137
|
+
- Include table schema only when migration files or model annotations are available
|
|
138
|
+
- Reference from node data using schema key name
|
|
139
|
+
|
|
140
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Update or refine the architecture diagram
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrip update — Update architecture diagram
|
|
6
|
+
|
|
7
|
+
Read `.archrip/architecture.json` and update it.
|
|
8
|
+
|
|
9
|
+
## Mode 1: Auto-detect from git diff (no arguments)
|
|
10
|
+
|
|
11
|
+
If `$ARGUMENTS` is empty:
|
|
12
|
+
|
|
13
|
+
1. Run `git diff --name-only HEAD~10` to find changed files
|
|
14
|
+
2. Read the current `.archrip/architecture.json`
|
|
15
|
+
3. For each changed file:
|
|
16
|
+
- New component? → Add node + edges
|
|
17
|
+
- Removed component? → Remove node + edges + use case references
|
|
18
|
+
- Changed dependencies? → Update edges
|
|
19
|
+
4. Preserve existing node IDs for unchanged components
|
|
20
|
+
5. Write updated `.archrip/architecture.json`
|
|
21
|
+
|
|
22
|
+
## Mode 2: Apply requested changes (with arguments)
|
|
23
|
+
|
|
24
|
+
If `$ARGUMENTS` is provided, apply the user's requested changes:
|
|
25
|
+
- Add/remove/modify nodes
|
|
26
|
+
- Fix relationships
|
|
27
|
+
- Add/modify use cases
|
|
28
|
+
- Adjust layer assignments
|
|
29
|
+
- Add database schemas
|
|
30
|
+
- Improve descriptions
|
|
31
|
+
|
|
32
|
+
Write the updated `.archrip/architecture.json`.
|
|
33
|
+
|
|
34
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactively refine the architecture diagram
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrips refine — Refine architecture diagram
|
|
6
|
+
|
|
7
|
+
Read `.archrips/architecture.json` and apply the user's requested changes:
|
|
8
|
+
- Add/remove/modify nodes
|
|
9
|
+
- Fix relationships
|
|
10
|
+
- Add/modify use cases
|
|
11
|
+
- Adjust layer assignments
|
|
12
|
+
- Add database schemas
|
|
13
|
+
- Improve descriptions
|
|
14
|
+
|
|
15
|
+
Write the updated `.archrips/architecture.json`.
|
|
16
|
+
|
|
17
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scan codebase and generate architecture diagram data
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrips scan — Analyze codebase architecture
|
|
6
|
+
|
|
7
|
+
Analyze the current codebase and generate `.archrips/architecture.json`.
|
|
8
|
+
|
|
9
|
+
**Language rule:** Respond in the same language as the user's message or `$ARGUMENTS`. If no user text is available, detect the project's primary language from README/docs and match it. The `architecture.json` fields (labels, descriptions) should also use that language.
|
|
10
|
+
|
|
11
|
+
## Phase 1: Project Discovery
|
|
12
|
+
1. Read top-level files (package.json, composer.json, go.mod, Cargo.toml, pom.xml, pyproject.toml, etc.)
|
|
13
|
+
2. Identify language, framework, source root
|
|
14
|
+
3. List directory structure (2 levels deep)
|
|
15
|
+
|
|
16
|
+
## Phase 2: Documentation Discovery
|
|
17
|
+
Read existing documentation to understand architecture context:
|
|
18
|
+
1. Check for: README.md, CLAUDE.md, docs/, doc/, wiki/, ARCHITECTURE.md, CONTRIBUTING.md
|
|
19
|
+
2. Extract: system overview, component descriptions, external service integrations, design decisions
|
|
20
|
+
3. Use this knowledge to inform the analysis — documentation often reveals architectural intent that code alone does not show (use cases, business context, external dependencies)
|
|
21
|
+
|
|
22
|
+
## Phase 3: Layer Identification
|
|
23
|
+
Based on the framework, identify architectural layers:
|
|
24
|
+
|
|
25
|
+
**Common patterns:**
|
|
26
|
+
- Laravel: Controllers → Services → Ports → Adapters → Models
|
|
27
|
+
- Express/NestJS: Routes/Controllers → Services → Repositories → Models
|
|
28
|
+
- Next.js: Pages → Components → Hooks → API Routes → Services
|
|
29
|
+
- Django: Views → Serializers → Services → Models
|
|
30
|
+
- Spring Boot: Controllers → Services → Repositories → Entities
|
|
31
|
+
- Go: Handlers → Services → Repositories → Models
|
|
32
|
+
- Generic: Group by directory responsibility
|
|
33
|
+
|
|
34
|
+
## Phase 4: Read Key Files
|
|
35
|
+
For each layer, read representative files to extract:
|
|
36
|
+
- Component names and purposes
|
|
37
|
+
- Dependencies (imports, injections)
|
|
38
|
+
- Public methods/routes
|
|
39
|
+
- Database schemas (from migrations or model definitions)
|
|
40
|
+
|
|
41
|
+
**Do NOT read every file.** Focus on entry points, core logic, interfaces, and data models.
|
|
42
|
+
|
|
43
|
+
## Phase 5: Map Relationships
|
|
44
|
+
For each component, identify:
|
|
45
|
+
- What it depends on (imports, constructor injection)
|
|
46
|
+
- What depends on it
|
|
47
|
+
- External service connections
|
|
48
|
+
|
|
49
|
+
## Phase 6: Identify Use Cases
|
|
50
|
+
Group related components into user-facing features.
|
|
51
|
+
|
|
52
|
+
## Phase 7: Draft Review — STOP and ask the developer
|
|
53
|
+
|
|
54
|
+
**IMPORTANT: Do NOT proceed to Phase 8 until the developer responds. You MUST stop here and wait for input.**
|
|
55
|
+
|
|
56
|
+
Present a summary of what you found:
|
|
57
|
+
- List of discovered nodes (grouped by layer/category)
|
|
58
|
+
- List of discovered use cases
|
|
59
|
+
- External services found
|
|
60
|
+
|
|
61
|
+
Then ask:
|
|
62
|
+
- Are there missing components, external services, or use cases?
|
|
63
|
+
- Should anything be excluded?
|
|
64
|
+
- What is the `sourceUrl` template? (e.g., `https://github.com/org/repo/blob/main/{filePath}`)
|
|
65
|
+
|
|
66
|
+
End your message with: **"Please review and reply with corrections, or type 'go' to generate."**
|
|
67
|
+
|
|
68
|
+
**Do NOT write architecture.json yet. Wait for the developer to respond.**
|
|
69
|
+
|
|
70
|
+
If the developer replies with corrections, apply them and present the updated summary. Repeat until they say "go" / "ok" / "skip".
|
|
71
|
+
|
|
72
|
+
## Phase 8: Generate architecture.json
|
|
73
|
+
Only run this phase AFTER the developer has approved the draft in Phase 7.
|
|
74
|
+
|
|
75
|
+
Write the complete `.archrips/architecture.json` following the schema, incorporating developer feedback.
|
|
76
|
+
|
|
77
|
+
After writing the file, tell the developer:
|
|
78
|
+
- Run `npx archrips build && npx archrips serve` to preview
|
|
79
|
+
- Run `/archrips-refine` to make further adjustments (add/remove nodes, fix relationships, etc.)
|
|
80
|
+
|
|
81
|
+
### Node Rules
|
|
82
|
+
- `id`: kebab-case, prefixed by category abbreviation (ctrl-, svc-, port-, adpt-, model-, ext-, job-, dto-)
|
|
83
|
+
- `layer`: 0=external, 1=entry points, 2=application logic, 3=abstractions, 4=implementations, 5=data
|
|
84
|
+
- `category`: one of controller, service, port, adapter, model, external, job, dto (or custom)
|
|
85
|
+
- `filePath`: relative from project root
|
|
86
|
+
- `depth` (optional): 0=overview (boundary), 1=structure (internal), 2=detail (implementation). Auto-inferred from category if omitted
|
|
87
|
+
- `useCases`: array of use case IDs this node participates in
|
|
88
|
+
|
|
89
|
+
### Edge Rules
|
|
90
|
+
- `type`: dependency | implements | relation
|
|
91
|
+
- Only include significant architectural dependencies (not utility imports)
|
|
92
|
+
|
|
93
|
+
### Schema Rules
|
|
94
|
+
- Include table schema only when migration files or model annotations are available
|
|
95
|
+
- Reference from node data using schema key name
|
|
96
|
+
|
|
97
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Update architecture diagram after code changes
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrips update — Incremental architecture update
|
|
6
|
+
|
|
7
|
+
Update `.archrips/architecture.json` based on recent code changes.
|
|
8
|
+
|
|
9
|
+
1. Run `git diff --name-only HEAD~10` to find changed files
|
|
10
|
+
2. Read the current `.archrips/architecture.json`
|
|
11
|
+
3. For each changed file:
|
|
12
|
+
- New component? → Add node + edges
|
|
13
|
+
- Removed component? → Remove node + edges + use case references
|
|
14
|
+
- Changed dependencies? → Update edges
|
|
15
|
+
4. Preserve existing node IDs for unchanged components
|
|
16
|
+
5. Write updated `.archrips/architecture.json`
|
|
17
|
+
|
|
18
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactively refine the architecture diagram
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrip refine — Refine architecture diagram
|
|
6
|
+
|
|
7
|
+
Read `.archrip/architecture.json` and apply the user's requested changes:
|
|
8
|
+
- Add/remove/modify nodes
|
|
9
|
+
- Fix relationships
|
|
10
|
+
- Add/modify use cases
|
|
11
|
+
- Adjust layer assignments
|
|
12
|
+
- Add database schemas
|
|
13
|
+
- Improve descriptions
|
|
14
|
+
|
|
15
|
+
Write the updated `.archrip/architecture.json`.
|
|
16
|
+
|
|
17
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scan codebase and generate architecture diagram data
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrip scan — Analyze codebase architecture
|
|
6
|
+
|
|
7
|
+
Analyze the current codebase and generate `.archrip/architecture.json`.
|
|
8
|
+
|
|
9
|
+
**Language rule:** Respond in the same language as the user's message or `$ARGUMENTS`. If no user text is available, detect the project's primary language from README/docs and match it. The `architecture.json` fields (labels, descriptions) should also use that language.
|
|
10
|
+
|
|
11
|
+
## Phase 1: Project Discovery
|
|
12
|
+
1. Read top-level files (package.json, composer.json, go.mod, Cargo.toml, pom.xml, pyproject.toml, etc.)
|
|
13
|
+
2. Identify language, framework, source root
|
|
14
|
+
3. List directory structure (2 levels deep)
|
|
15
|
+
4. Auto-detect `sourceUrl`: Run `git remote get-url origin` and convert to browse URL:
|
|
16
|
+
- `git@github.com:org/repo.git` → `https://github.com/org/repo/blob/main/{filePath}`
|
|
17
|
+
- `https://github.com/org/repo.git` → `https://github.com/org/repo/blob/main/{filePath}`
|
|
18
|
+
- `git@gitlab.com:org/repo.git` → `https://gitlab.com/org/repo/-/blob/main/{filePath}`
|
|
19
|
+
- If no git remote, leave empty (ask in Phase 7)
|
|
20
|
+
|
|
21
|
+
## Phase 2: Documentation Discovery
|
|
22
|
+
Read existing documentation to understand architecture context:
|
|
23
|
+
1. Check for: README.md, CLAUDE.md, docs/, doc/, wiki/, ARCHITECTURE.md, CONTRIBUTING.md
|
|
24
|
+
2. Extract: system overview, component descriptions, external service integrations, design decisions
|
|
25
|
+
3. Use this knowledge to inform the analysis — documentation often reveals architectural intent that code alone does not show (use cases, business context, external dependencies)
|
|
26
|
+
|
|
27
|
+
## Phase 3: Layer Identification
|
|
28
|
+
Based on the framework, identify architectural layers:
|
|
29
|
+
|
|
30
|
+
**Common patterns:**
|
|
31
|
+
- Laravel: Controllers → Services → Ports → Adapters → Models
|
|
32
|
+
- Express/NestJS: Routes/Controllers → Services → Repositories → Models
|
|
33
|
+
- Next.js: Pages → Components → Hooks → API Routes → Services
|
|
34
|
+
- Django: Views → Serializers → Services → Models
|
|
35
|
+
- Spring Boot: Controllers → Services → Repositories → Entities
|
|
36
|
+
- Go: Handlers → Services → Repositories → Models
|
|
37
|
+
- Generic: Group by directory responsibility
|
|
38
|
+
|
|
39
|
+
## Phase 4: Read Key Files
|
|
40
|
+
For each layer, read representative files to extract:
|
|
41
|
+
- Component names and purposes
|
|
42
|
+
- Dependencies (imports, injections)
|
|
43
|
+
- Public methods/routes
|
|
44
|
+
- Database schemas (from migrations or model definitions)
|
|
45
|
+
|
|
46
|
+
**Do NOT read every file.** Focus on entry points, core logic, interfaces, and data models.
|
|
47
|
+
|
|
48
|
+
## Phase 5: Map Relationships
|
|
49
|
+
For each component, identify:
|
|
50
|
+
- What it depends on (imports, constructor injection)
|
|
51
|
+
- What depends on it
|
|
52
|
+
- External service connections
|
|
53
|
+
|
|
54
|
+
**Connectivity check:** After mapping, verify every node has at least one edge. If a node is orphaned:
|
|
55
|
+
- DTOs/entities → connect to the service or adapter that references them
|
|
56
|
+
- External services → connect to the adapter/controller that integrates with them
|
|
57
|
+
- Models → connect to the adapter/repository that queries them
|
|
58
|
+
|
|
59
|
+
## Phase 6: Identify Use Cases
|
|
60
|
+
Group related components into user-facing features.
|
|
61
|
+
|
|
62
|
+
## Phase 7: Draft Review — STOP and ask the developer
|
|
63
|
+
|
|
64
|
+
**IMPORTANT: Do NOT proceed to Phase 8 until the developer responds. You MUST stop here and wait for input.**
|
|
65
|
+
|
|
66
|
+
Present a summary of what you found:
|
|
67
|
+
- **Documents read**: List all docs you read in Phase 2 (e.g., README.md, CLAUDE.md, docs/architecture.md)
|
|
68
|
+
- List of discovered nodes (grouped by layer/category)
|
|
69
|
+
- List of discovered use cases
|
|
70
|
+
- External services found
|
|
71
|
+
|
|
72
|
+
Then ask:
|
|
73
|
+
- Are there other documents you should read? (e.g., docs/, wiki/, design docs)
|
|
74
|
+
- Are there missing components, external services, or use cases?
|
|
75
|
+
- Should anything be excluded?
|
|
76
|
+
- `sourceUrl` auto-detected as: `<detected-url>` — correct? (If not detected, ask for the `sourceUrl` template, e.g., `https://github.com/org/repo/blob/main/{filePath}`)
|
|
77
|
+
|
|
78
|
+
End your message with: **"Please review and reply with corrections, or type 'go' to generate."**
|
|
79
|
+
|
|
80
|
+
**Do NOT write architecture.json yet. Wait for the developer to respond.**
|
|
81
|
+
|
|
82
|
+
If the developer replies with corrections, apply them and present the updated summary. Repeat until they say "go" / "ok" / "skip".
|
|
83
|
+
|
|
84
|
+
## Phase 8: Generate architecture.json
|
|
85
|
+
Only run this phase AFTER the developer has approved the draft in Phase 7.
|
|
86
|
+
|
|
87
|
+
Create `.archrip/` directory if it doesn't exist, then write the complete `.archrip/architecture.json` following the schema, incorporating developer feedback.
|
|
88
|
+
|
|
89
|
+
After writing the file:
|
|
90
|
+
1. Run `npx archrip serve` in the terminal (auto-builds if needed, opens browser)
|
|
91
|
+
2. Tell the developer: Run `/archrip-update` to make further adjustments (add/remove nodes, fix relationships, etc.)
|
|
92
|
+
|
|
93
|
+
### Required structure (use EXACTLY these field names)
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"version": "1.0",
|
|
98
|
+
"project": { "name": "...", "sourceUrl": "https://github.com/org/repo/blob/main/{filePath}" },
|
|
99
|
+
"nodes": [
|
|
100
|
+
{ "id": "ctrl-users", "category": "controller", "label": "UsersController", "layer": 1, "filePath": "src/controllers/users.ts", "useCases": ["uc-user-mgmt"] }
|
|
101
|
+
],
|
|
102
|
+
"edges": [
|
|
103
|
+
{ "source": "ctrl-users", "target": "svc-users", "type": "dependency" }
|
|
104
|
+
],
|
|
105
|
+
"useCases": [
|
|
106
|
+
{ "id": "uc-user-mgmt", "name": "User Management", "nodeIds": ["ctrl-users", "svc-users"] }
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Critical field names — do NOT use alternatives:**
|
|
112
|
+
- Node: `id`, `category`, `label` (NOT name), `layer` — all required
|
|
113
|
+
- Edge: `source`, `target` (NOT from/to) — all required
|
|
114
|
+
- UseCase: `id`, `name`, `nodeIds` — all required
|
|
115
|
+
|
|
116
|
+
### Node Rules
|
|
117
|
+
- `id`: kebab-case, prefixed by category abbreviation (ctrl-, svc-, port-, adpt-, model-, ext-, job-, dto-)
|
|
118
|
+
- `layer`: 0=external, 1=entry points, 2=application logic, 3=abstractions, 4=implementations, 5=data
|
|
119
|
+
- `category`: one of controller, service, port, adapter, model, external, job, dto (or custom)
|
|
120
|
+
- `label`: display name for the node
|
|
121
|
+
- `filePath`: relative from project root
|
|
122
|
+
- `depth` (optional): 0=overview (boundary), 1=structure (internal), 2=detail (implementation). Auto-inferred from category if omitted
|
|
123
|
+
- `useCases`: array of use case IDs this node participates in
|
|
124
|
+
|
|
125
|
+
### Edge Rules
|
|
126
|
+
- `source`: source node id
|
|
127
|
+
- `target`: target node id
|
|
128
|
+
- `type`: dependency | implements | relation
|
|
129
|
+
- Only include significant architectural dependencies (not utility imports)
|
|
130
|
+
- **Every node MUST have at least one edge.** If a node has no obvious dependency, connect it with a `relation` edge to the component that uses or contains it.
|
|
131
|
+
|
|
132
|
+
### Layout Selection
|
|
133
|
+
- DDD / Clean Architecture / Hexagonal / Onion Architecture → add `"layout": "concentric"` to `project`
|
|
134
|
+
- MVC / standard layered → `"layout": "dagre"` (default, can be omitted)
|
|
135
|
+
|
|
136
|
+
### Schema Rules
|
|
137
|
+
- Include table schema only when migration files or model annotations are available
|
|
138
|
+
- Reference from node data using schema key name
|
|
139
|
+
|
|
140
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Update or refine the architecture diagram
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrip update — Update architecture diagram
|
|
6
|
+
|
|
7
|
+
Read `.archrip/architecture.json` and update it.
|
|
8
|
+
|
|
9
|
+
## Mode 1: Auto-detect from git diff (no arguments)
|
|
10
|
+
|
|
11
|
+
If `$ARGUMENTS` is empty:
|
|
12
|
+
|
|
13
|
+
1. Run `git diff --name-only HEAD~10` to find changed files
|
|
14
|
+
2. Read the current `.archrip/architecture.json`
|
|
15
|
+
3. For each changed file:
|
|
16
|
+
- New component? → Add node + edges
|
|
17
|
+
- Removed component? → Remove node + edges + use case references
|
|
18
|
+
- Changed dependencies? → Update edges
|
|
19
|
+
4. Preserve existing node IDs for unchanged components
|
|
20
|
+
5. Write updated `.archrip/architecture.json`
|
|
21
|
+
|
|
22
|
+
## Mode 2: Apply requested changes (with arguments)
|
|
23
|
+
|
|
24
|
+
If `$ARGUMENTS` is provided, apply the user's requested changes:
|
|
25
|
+
- Add/remove/modify nodes
|
|
26
|
+
- Fix relationships
|
|
27
|
+
- Add/modify use cases
|
|
28
|
+
- Adjust layer assignments
|
|
29
|
+
- Add database schemas
|
|
30
|
+
- Improve descriptions
|
|
31
|
+
|
|
32
|
+
Write the updated `.archrip/architecture.json`.
|
|
33
|
+
|
|
34
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactively refine the architecture diagram
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrips refine — Refine architecture diagram
|
|
6
|
+
|
|
7
|
+
Read `.archrips/architecture.json` and apply the user's requested changes:
|
|
8
|
+
- Add/remove/modify nodes
|
|
9
|
+
- Fix relationships
|
|
10
|
+
- Add/modify use cases
|
|
11
|
+
- Adjust layer assignments
|
|
12
|
+
- Add database schemas
|
|
13
|
+
- Improve descriptions
|
|
14
|
+
|
|
15
|
+
Write the updated `.archrips/architecture.json`.
|
|
16
|
+
|
|
17
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scan codebase and generate architecture diagram data
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrips scan — Analyze codebase architecture
|
|
6
|
+
|
|
7
|
+
Analyze the current codebase and generate `.archrips/architecture.json`.
|
|
8
|
+
|
|
9
|
+
**Language rule:** Respond in the same language as the user's message or `$ARGUMENTS`. If no user text is available, detect the project's primary language from README/docs and match it. The `architecture.json` fields (labels, descriptions) should also use that language.
|
|
10
|
+
|
|
11
|
+
## Phase 1: Project Discovery
|
|
12
|
+
1. Read top-level files (package.json, composer.json, go.mod, Cargo.toml, pom.xml, pyproject.toml, etc.)
|
|
13
|
+
2. Identify language, framework, source root
|
|
14
|
+
3. List directory structure (2 levels deep)
|
|
15
|
+
|
|
16
|
+
## Phase 2: Documentation Discovery
|
|
17
|
+
Read existing documentation to understand architecture context:
|
|
18
|
+
1. Check for: README.md, CLAUDE.md, docs/, doc/, wiki/, ARCHITECTURE.md, CONTRIBUTING.md
|
|
19
|
+
2. Extract: system overview, component descriptions, external service integrations, design decisions
|
|
20
|
+
3. Use this knowledge to inform the analysis — documentation often reveals architectural intent that code alone does not show (use cases, business context, external dependencies)
|
|
21
|
+
|
|
22
|
+
## Phase 3: Layer Identification
|
|
23
|
+
Based on the framework, identify architectural layers:
|
|
24
|
+
|
|
25
|
+
**Common patterns:**
|
|
26
|
+
- Laravel: Controllers → Services → Ports → Adapters → Models
|
|
27
|
+
- Express/NestJS: Routes/Controllers → Services → Repositories → Models
|
|
28
|
+
- Next.js: Pages → Components → Hooks → API Routes → Services
|
|
29
|
+
- Django: Views → Serializers → Services → Models
|
|
30
|
+
- Spring Boot: Controllers → Services → Repositories → Entities
|
|
31
|
+
- Go: Handlers → Services → Repositories → Models
|
|
32
|
+
- Generic: Group by directory responsibility
|
|
33
|
+
|
|
34
|
+
## Phase 4: Read Key Files
|
|
35
|
+
For each layer, read representative files to extract:
|
|
36
|
+
- Component names and purposes
|
|
37
|
+
- Dependencies (imports, injections)
|
|
38
|
+
- Public methods/routes
|
|
39
|
+
- Database schemas (from migrations or model definitions)
|
|
40
|
+
|
|
41
|
+
**Do NOT read every file.** Focus on entry points, core logic, interfaces, and data models.
|
|
42
|
+
|
|
43
|
+
## Phase 5: Map Relationships
|
|
44
|
+
For each component, identify:
|
|
45
|
+
- What it depends on (imports, constructor injection)
|
|
46
|
+
- What depends on it
|
|
47
|
+
- External service connections
|
|
48
|
+
|
|
49
|
+
## Phase 6: Identify Use Cases
|
|
50
|
+
Group related components into user-facing features.
|
|
51
|
+
|
|
52
|
+
## Phase 7: Draft Review — STOP and ask the developer
|
|
53
|
+
|
|
54
|
+
**IMPORTANT: Do NOT proceed to Phase 8 until the developer responds. You MUST stop here and wait for input.**
|
|
55
|
+
|
|
56
|
+
Present a summary of what you found:
|
|
57
|
+
- List of discovered nodes (grouped by layer/category)
|
|
58
|
+
- List of discovered use cases
|
|
59
|
+
- External services found
|
|
60
|
+
|
|
61
|
+
Then ask:
|
|
62
|
+
- Are there missing components, external services, or use cases?
|
|
63
|
+
- Should anything be excluded?
|
|
64
|
+
- What is the `sourceUrl` template? (e.g., `https://github.com/org/repo/blob/main/{filePath}`)
|
|
65
|
+
|
|
66
|
+
End your message with: **"Please review and reply with corrections, or type 'go' to generate."**
|
|
67
|
+
|
|
68
|
+
**Do NOT write architecture.json yet. Wait for the developer to respond.**
|
|
69
|
+
|
|
70
|
+
If the developer replies with corrections, apply them and present the updated summary. Repeat until they say "go" / "ok" / "skip".
|
|
71
|
+
|
|
72
|
+
## Phase 8: Generate architecture.json
|
|
73
|
+
Only run this phase AFTER the developer has approved the draft in Phase 7.
|
|
74
|
+
|
|
75
|
+
Write the complete `.archrips/architecture.json` following the schema, incorporating developer feedback.
|
|
76
|
+
|
|
77
|
+
After writing the file, tell the developer:
|
|
78
|
+
- Run `npx archrips build && npx archrips serve` to preview
|
|
79
|
+
- Run `/archrips-refine` to make further adjustments (add/remove nodes, fix relationships, etc.)
|
|
80
|
+
|
|
81
|
+
### Node Rules
|
|
82
|
+
- `id`: kebab-case, prefixed by category abbreviation (ctrl-, svc-, port-, adpt-, model-, ext-, job-, dto-)
|
|
83
|
+
- `layer`: 0=external, 1=entry points, 2=application logic, 3=abstractions, 4=implementations, 5=data
|
|
84
|
+
- `category`: one of controller, service, port, adapter, model, external, job, dto (or custom)
|
|
85
|
+
- `filePath`: relative from project root
|
|
86
|
+
- `depth` (optional): 0=overview (boundary), 1=structure (internal), 2=detail (implementation). Auto-inferred from category if omitted
|
|
87
|
+
- `useCases`: array of use case IDs this node participates in
|
|
88
|
+
|
|
89
|
+
### Edge Rules
|
|
90
|
+
- `type`: dependency | implements | relation
|
|
91
|
+
- Only include significant architectural dependencies (not utility imports)
|
|
92
|
+
|
|
93
|
+
### Schema Rules
|
|
94
|
+
- Include table schema only when migration files or model annotations are available
|
|
95
|
+
- Reference from node data using schema key name
|
|
96
|
+
|
|
97
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Update architecture diagram after code changes
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrips update — Incremental architecture update
|
|
6
|
+
|
|
7
|
+
Update `.archrips/architecture.json` based on recent code changes.
|
|
8
|
+
|
|
9
|
+
1. Run `git diff --name-only HEAD~10` to find changed files
|
|
10
|
+
2. Read the current `.archrips/architecture.json`
|
|
11
|
+
3. For each changed file:
|
|
12
|
+
- New component? → Add node + edges
|
|
13
|
+
- Removed component? → Remove node + edges + use case references
|
|
14
|
+
- Changed dependencies? → Update edges
|
|
15
|
+
4. Preserve existing node IDs for unchanged components
|
|
16
|
+
5. Write updated `.archrips/architecture.json`
|
|
17
|
+
|
|
18
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactively refine the architecture diagram
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# archrip refine — Refine architecture diagram
|
|
6
|
+
|
|
7
|
+
Read `.archrip/architecture.json` and apply the user's requested changes:
|
|
8
|
+
- Add/remove/modify nodes
|
|
9
|
+
- Fix relationships
|
|
10
|
+
- Add/modify use cases
|
|
11
|
+
- Adjust layer assignments
|
|
12
|
+
- Add database schemas
|
|
13
|
+
- Improve descriptions
|
|
14
|
+
|
|
15
|
+
Write the updated `.archrip/architecture.json`.
|
|
16
|
+
|
|
17
|
+
$ARGUMENTS
|