archrip 0.2.3 → 0.2.5

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.
@@ -20,9 +20,16 @@ Analyze the current codebase and generate `.archrip/architecture.json`.
20
20
 
21
21
  ## Phase 2: Documentation Discovery
22
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)
23
+ 1. Check for: README.md, CLAUDE.md, docs/, doc/, wiki/, ARCHITECTURE.md, CONTRIBUTING.md, ADR/
24
+ 2. For each document, extract and take notes on:
25
+ - **Business context**: What problem does this system solve? Who are the users?
26
+ - **Component responsibilities**: What each module/service does and why it exists
27
+ - **Design decisions & constraints**: Why certain patterns/libraries were chosen, known limitations
28
+ - **Data flow**: How data moves through the system (request lifecycle, event flow, etc.)
29
+ - **External integrations**: What external services are used, why, and how
30
+ - **Non-functional requirements**: SLAs, performance targets, security policies
31
+ - **Deployment & infrastructure**: Hosting, CI/CD, environment details
32
+ 3. Keep these notes — you will use them in Phase 4 to write rich node/edge descriptions and metadata
26
33
 
27
34
  ## Phase 3: Layer Identification
28
35
  Assign each component a `layer` integer. The rule: **higher layer = closer to domain core (more stable, fewer external dependencies). Lower layer = closer to external world (more volatile, I/O-bound).**
@@ -41,9 +48,10 @@ MVC / Layered:
41
48
  - FastAPI: External(0) → Routers(1) → Services(2) → Repositories(3) → Models(4)
42
49
 
43
50
  DDD / Clean Architecture / Hexagonal (use `"layout": "concentric"`):
44
- - Generic: External(0) → Adapters(1) Controllers(2) → Application Services(3) → Ports(4) → Domain Entities(5)
45
- - Go (Hex): External(0) → Handlers(1) Adapters(2) → Use Cases(3) → Ports(4) → Domain(5)
51
+ - Generic: External(0) → Adapters(1) [Controllers, DB impl, API clients] → Application Services(2) → Ports(3) [domain-defined interfaces] → Domain Entities(4)
52
+ - Go (Hex): External(0) → Adapters(1) [Handlers, Repositories] → Use Cases(2) → Ports(3) → Domain(4)
46
53
  - Flutter (Clean): External(0) → Data Sources(1) → Repositories(2) → Use Cases(3) → Entities(4)
54
+ - Note: Ports are interfaces **defined by the domain** — they belong near domain core, not at the adapter layer. Adapters implement/use Ports from the outside.
47
55
 
48
56
  Serverless / Microservices:
49
57
  - SST/Lambda: External(0) → API Gateway(1) → Lambda Handlers(2) → Services(3) → Domain(4)
@@ -58,6 +66,21 @@ For each layer, read representative files to extract:
58
66
  - Public methods/routes
59
67
  - Database schemas (from migrations or model definitions)
60
68
 
69
+ **Enrich descriptions from documentation:** Cross-reference code with your Phase 2 notes.
70
+ For each component, compose a `description` (1-3 sentences) that covers:
71
+ - **What**: Its responsibility (from code analysis)
72
+ - **Why**: Business context or design rationale (from docs)
73
+ - **How**: Key implementation details, constraints, or patterns worth noting
74
+
75
+ A good description tells the reader something they cannot see from the label alone.
76
+ - BAD: "User service" (just echoes the label)
77
+ - GOOD: "Handles user registration, login, and profile management. Uses JWT for session tokens with 24h expiry. Password hashing via bcrypt (cost=12)."
78
+
79
+ Also identify metadata candidates:
80
+ - SLA/performance notes → `metadata` with `type: "list"`
81
+ - Related doc links → `metadata` with `type: "link"`
82
+ - Infrastructure details (Lambda ARN, DB engine, etc.) → `metadata` with `type: "code"` or `"text"`
83
+
61
84
  **Do NOT read every file.** Focus on entry points, core logic, interfaces, and data models.
62
85
 
63
86
  ## Phase 5: Map Relationships
@@ -130,9 +153,10 @@ After writing the file:
130
153
 
131
154
  ### Node Rules
132
155
  - `id`: kebab-case, prefixed by category abbreviation (ctrl-, svc-, port-, adpt-, model-, db-, ext-, job-, dto-)
133
- - `layer`: non-negative integer. **Higher = closer to domain core / more stable. Lower = closer to external world / more volatile.** Dagre (TB) places higher layers lower on screen; concentric places them at center. Use as many layers as the architecture requires (typically 3-6). Example for DDD: 0=external, 1=adapters, 2=controllers, 3=app services, 4=ports, 5=domain entities. Example for MVC: 0=external, 1=controllers, 2=services, 3=models.
156
+ - `layer`: non-negative integer. **Higher = closer to domain core / more stable. Lower = closer to external world / more volatile.** Dagre (TB) places higher layers lower on screen; concentric places them at center. Use as many layers as the architecture requires (typically 3-6). Example for DDD: 0=external, 1=adapters (controllers + infra), 2=app services, 3=ports, 4=domain entities. Example for MVC: 0=external, 1=controllers, 2=services, 3=models.
134
157
  - `category`: one of controller, service, port, adapter, model, database, external, job, dto (or custom). Use `model` for domain entities/value objects (core business logic). Use `database` for DB tables, migrations, ORMs, and infrastructure persistence.
135
158
  - `label`: display name for the node
159
+ - `description`: 1-3 sentences explaining responsibility + business context. Do NOT just echo the label. Cross-reference documentation for richer context (see Description Guidelines below)
136
160
  - `filePath`: relative from project root
137
161
  - `depth` (optional): 0=overview, 1=structure, 2=detail. Auto-inferred from `layer` if omitted: with 3+ unique layers, lowest → 0, middle → 1, highest → 2. With 1-2 layers, all nodes get depth 0 (always visible).
138
162
  - `useCases`: array of use case IDs this node participates in
@@ -158,6 +182,31 @@ After writing the file:
158
182
  - DDD / Clean Architecture / Hexagonal / Onion Architecture → add `"layout": "concentric"` to `project`
159
183
  - MVC / standard layered → `"layout": "dagre"` (default, can be omitted)
160
184
 
185
+ ### Description Guidelines
186
+
187
+ #### Node `description`
188
+ Write 1-3 sentences that explain responsibility AND business context.
189
+ Cross-reference project documentation (README, CLAUDE.md, docs/) for richer context.
190
+ - BAD: "User service" (just echoes the label)
191
+ - BAD: "Handles users" (too vague)
192
+ - GOOD: "Handles user registration, authentication, and profile management. Uses JWT for session tokens; password hashing via bcrypt. Rate-limited to 10 req/s per IP."
193
+
194
+ #### Edge `description`
195
+ Explain WHY the dependency exists, not just THAT it exists.
196
+ - BAD: "calls" / "depends on"
197
+ - GOOD: "Delegates payment processing via Stripe SDK; retries on timeout (3x with exponential backoff)"
198
+
199
+ #### `metadata` for supplementary details
200
+ Use `metadata` to capture information from docs that doesn't fit in `description`:
201
+ ```json
202
+ "metadata": [
203
+ { "label": "SLA", "value": ["99.9% uptime", "p95 < 200ms"], "type": "list" },
204
+ { "label": "Design Doc", "value": "https://...", "type": "link" },
205
+ { "label": "Infrastructure", "value": "Lambda + DynamoDB (on-demand)", "type": "text" },
206
+ { "label": "Rate Limit", "value": "10 req/s per IP", "type": "text" }
207
+ ]
208
+ ```
209
+
161
210
  ### Schema Rules
162
211
  - Include table schema only when migration files or model annotations are available
163
212
  - Reference from node data using schema key name
@@ -20,9 +20,16 @@ Analyze the current codebase and generate `.archrip/architecture.json`.
20
20
 
21
21
  ## Phase 2: Documentation Discovery
22
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)
23
+ 1. Check for: README.md, CLAUDE.md, docs/, doc/, wiki/, ARCHITECTURE.md, CONTRIBUTING.md, ADR/
24
+ 2. For each document, extract and take notes on:
25
+ - **Business context**: What problem does this system solve? Who are the users?
26
+ - **Component responsibilities**: What each module/service does and why it exists
27
+ - **Design decisions & constraints**: Why certain patterns/libraries were chosen, known limitations
28
+ - **Data flow**: How data moves through the system (request lifecycle, event flow, etc.)
29
+ - **External integrations**: What external services are used, why, and how
30
+ - **Non-functional requirements**: SLAs, performance targets, security policies
31
+ - **Deployment & infrastructure**: Hosting, CI/CD, environment details
32
+ 3. Keep these notes — you will use them in Phase 4 to write rich node/edge descriptions and metadata
26
33
 
27
34
  ## Phase 3: Layer Identification
28
35
  Assign each component a `layer` integer. The rule: **higher layer = closer to domain core (more stable, fewer external dependencies). Lower layer = closer to external world (more volatile, I/O-bound).**
@@ -41,9 +48,10 @@ MVC / Layered:
41
48
  - FastAPI: External(0) → Routers(1) → Services(2) → Repositories(3) → Models(4)
42
49
 
43
50
  DDD / Clean Architecture / Hexagonal (use `"layout": "concentric"`):
44
- - Generic: External(0) → Adapters(1) Controllers(2) → Application Services(3) → Ports(4) → Domain Entities(5)
45
- - Go (Hex): External(0) → Handlers(1) Adapters(2) → Use Cases(3) → Ports(4) → Domain(5)
51
+ - Generic: External(0) → Adapters(1) [Controllers, DB impl, API clients] → Application Services(2) → Ports(3) [domain-defined interfaces] → Domain Entities(4)
52
+ - Go (Hex): External(0) → Adapters(1) [Handlers, Repositories] → Use Cases(2) → Ports(3) → Domain(4)
46
53
  - Flutter (Clean): External(0) → Data Sources(1) → Repositories(2) → Use Cases(3) → Entities(4)
54
+ - Note: Ports are interfaces **defined by the domain** — they belong near domain core, not at the adapter layer. Adapters implement/use Ports from the outside.
47
55
 
48
56
  Serverless / Microservices:
49
57
  - SST/Lambda: External(0) → API Gateway(1) → Lambda Handlers(2) → Services(3) → Domain(4)
@@ -58,6 +66,21 @@ For each layer, read representative files to extract:
58
66
  - Public methods/routes
59
67
  - Database schemas (from migrations or model definitions)
60
68
 
69
+ **Enrich descriptions from documentation:** Cross-reference code with your Phase 2 notes.
70
+ For each component, compose a `description` (1-3 sentences) that covers:
71
+ - **What**: Its responsibility (from code analysis)
72
+ - **Why**: Business context or design rationale (from docs)
73
+ - **How**: Key implementation details, constraints, or patterns worth noting
74
+
75
+ A good description tells the reader something they cannot see from the label alone.
76
+ - BAD: "User service" (just echoes the label)
77
+ - GOOD: "Handles user registration, login, and profile management. Uses JWT for session tokens with 24h expiry. Password hashing via bcrypt (cost=12)."
78
+
79
+ Also identify metadata candidates:
80
+ - SLA/performance notes → `metadata` with `type: "list"`
81
+ - Related doc links → `metadata` with `type: "link"`
82
+ - Infrastructure details (Lambda ARN, DB engine, etc.) → `metadata` with `type: "code"` or `"text"`
83
+
61
84
  **Do NOT read every file.** Focus on entry points, core logic, interfaces, and data models.
62
85
 
63
86
  ## Phase 5: Map Relationships
@@ -130,9 +153,10 @@ After writing the file:
130
153
 
131
154
  ### Node Rules
132
155
  - `id`: kebab-case, prefixed by category abbreviation (ctrl-, svc-, port-, adpt-, model-, db-, ext-, job-, dto-)
133
- - `layer`: non-negative integer. **Higher = closer to domain core / more stable. Lower = closer to external world / more volatile.** Dagre (TB) places higher layers lower on screen; concentric places them at center. Use as many layers as the architecture requires (typically 3-6). Example for DDD: 0=external, 1=adapters, 2=controllers, 3=app services, 4=ports, 5=domain entities. Example for MVC: 0=external, 1=controllers, 2=services, 3=models.
156
+ - `layer`: non-negative integer. **Higher = closer to domain core / more stable. Lower = closer to external world / more volatile.** Dagre (TB) places higher layers lower on screen; concentric places them at center. Use as many layers as the architecture requires (typically 3-6). Example for DDD: 0=external, 1=adapters (controllers + infra), 2=app services, 3=ports, 4=domain entities. Example for MVC: 0=external, 1=controllers, 2=services, 3=models.
134
157
  - `category`: one of controller, service, port, adapter, model, database, external, job, dto (or custom). Use `model` for domain entities/value objects (core business logic). Use `database` for DB tables, migrations, ORMs, and infrastructure persistence.
135
158
  - `label`: display name for the node
159
+ - `description`: 1-3 sentences explaining responsibility + business context. Do NOT just echo the label. Cross-reference documentation for richer context (see Description Guidelines below)
136
160
  - `filePath`: relative from project root
137
161
  - `depth` (optional): 0=overview, 1=structure, 2=detail. Auto-inferred from `layer` if omitted: with 3+ unique layers, lowest → 0, middle → 1, highest → 2. With 1-2 layers, all nodes get depth 0 (always visible).
138
162
  - `useCases`: array of use case IDs this node participates in
@@ -158,6 +182,31 @@ After writing the file:
158
182
  - DDD / Clean Architecture / Hexagonal / Onion Architecture → add `"layout": "concentric"` to `project`
159
183
  - MVC / standard layered → `"layout": "dagre"` (default, can be omitted)
160
184
 
185
+ ### Description Guidelines
186
+
187
+ #### Node `description`
188
+ Write 1-3 sentences that explain responsibility AND business context.
189
+ Cross-reference project documentation (README, CLAUDE.md, docs/) for richer context.
190
+ - BAD: "User service" (just echoes the label)
191
+ - BAD: "Handles users" (too vague)
192
+ - GOOD: "Handles user registration, authentication, and profile management. Uses JWT for session tokens; password hashing via bcrypt. Rate-limited to 10 req/s per IP."
193
+
194
+ #### Edge `description`
195
+ Explain WHY the dependency exists, not just THAT it exists.
196
+ - BAD: "calls" / "depends on"
197
+ - GOOD: "Delegates payment processing via Stripe SDK; retries on timeout (3x with exponential backoff)"
198
+
199
+ #### `metadata` for supplementary details
200
+ Use `metadata` to capture information from docs that doesn't fit in `description`:
201
+ ```json
202
+ "metadata": [
203
+ { "label": "SLA", "value": ["99.9% uptime", "p95 < 200ms"], "type": "list" },
204
+ { "label": "Design Doc", "value": "https://...", "type": "link" },
205
+ { "label": "Infrastructure", "value": "Lambda + DynamoDB (on-demand)", "type": "text" },
206
+ { "label": "Rate Limit", "value": "10 req/s per IP", "type": "text" }
207
+ ]
208
+ ```
209
+
161
210
  ### Schema Rules
162
211
  - Include table schema only when migration files or model annotations are available
163
212
  - Reference from node data using schema key name
@@ -20,9 +20,16 @@ Analyze the current codebase and generate `.archrip/architecture.json`.
20
20
 
21
21
  ## Phase 2: Documentation Discovery
22
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)
23
+ 1. Check for: README.md, CLAUDE.md, docs/, doc/, wiki/, ARCHITECTURE.md, CONTRIBUTING.md, ADR/
24
+ 2. For each document, extract and take notes on:
25
+ - **Business context**: What problem does this system solve? Who are the users?
26
+ - **Component responsibilities**: What each module/service does and why it exists
27
+ - **Design decisions & constraints**: Why certain patterns/libraries were chosen, known limitations
28
+ - **Data flow**: How data moves through the system (request lifecycle, event flow, etc.)
29
+ - **External integrations**: What external services are used, why, and how
30
+ - **Non-functional requirements**: SLAs, performance targets, security policies
31
+ - **Deployment & infrastructure**: Hosting, CI/CD, environment details
32
+ 3. Keep these notes — you will use them in Phase 4 to write rich node/edge descriptions and metadata
26
33
 
27
34
  ## Phase 3: Layer Identification
28
35
  Assign each component a `layer` integer. The rule: **higher layer = closer to domain core (more stable, fewer external dependencies). Lower layer = closer to external world (more volatile, I/O-bound).**
@@ -41,9 +48,10 @@ MVC / Layered:
41
48
  - FastAPI: External(0) → Routers(1) → Services(2) → Repositories(3) → Models(4)
42
49
 
43
50
  DDD / Clean Architecture / Hexagonal (use `"layout": "concentric"`):
44
- - Generic: External(0) → Adapters(1) Controllers(2) → Application Services(3) → Ports(4) → Domain Entities(5)
45
- - Go (Hex): External(0) → Handlers(1) Adapters(2) → Use Cases(3) → Ports(4) → Domain(5)
51
+ - Generic: External(0) → Adapters(1) [Controllers, DB impl, API clients] → Application Services(2) → Ports(3) [domain-defined interfaces] → Domain Entities(4)
52
+ - Go (Hex): External(0) → Adapters(1) [Handlers, Repositories] → Use Cases(2) → Ports(3) → Domain(4)
46
53
  - Flutter (Clean): External(0) → Data Sources(1) → Repositories(2) → Use Cases(3) → Entities(4)
54
+ - Note: Ports are interfaces **defined by the domain** — they belong near domain core, not at the adapter layer. Adapters implement/use Ports from the outside.
47
55
 
48
56
  Serverless / Microservices:
49
57
  - SST/Lambda: External(0) → API Gateway(1) → Lambda Handlers(2) → Services(3) → Domain(4)
@@ -58,6 +66,21 @@ For each layer, read representative files to extract:
58
66
  - Public methods/routes
59
67
  - Database schemas (from migrations or model definitions)
60
68
 
69
+ **Enrich descriptions from documentation:** Cross-reference code with your Phase 2 notes.
70
+ For each component, compose a `description` (1-3 sentences) that covers:
71
+ - **What**: Its responsibility (from code analysis)
72
+ - **Why**: Business context or design rationale (from docs)
73
+ - **How**: Key implementation details, constraints, or patterns worth noting
74
+
75
+ A good description tells the reader something they cannot see from the label alone.
76
+ - BAD: "User service" (just echoes the label)
77
+ - GOOD: "Handles user registration, login, and profile management. Uses JWT for session tokens with 24h expiry. Password hashing via bcrypt (cost=12)."
78
+
79
+ Also identify metadata candidates:
80
+ - SLA/performance notes → `metadata` with `type: "list"`
81
+ - Related doc links → `metadata` with `type: "link"`
82
+ - Infrastructure details (Lambda ARN, DB engine, etc.) → `metadata` with `type: "code"` or `"text"`
83
+
61
84
  **Do NOT read every file.** Focus on entry points, core logic, interfaces, and data models.
62
85
 
63
86
  ## Phase 5: Map Relationships
@@ -130,9 +153,10 @@ After writing the file:
130
153
 
131
154
  ### Node Rules
132
155
  - `id`: kebab-case, prefixed by category abbreviation (ctrl-, svc-, port-, adpt-, model-, db-, ext-, job-, dto-)
133
- - `layer`: non-negative integer. **Higher = closer to domain core / more stable. Lower = closer to external world / more volatile.** Dagre (TB) places higher layers lower on screen; concentric places them at center. Use as many layers as the architecture requires (typically 3-6). Example for DDD: 0=external, 1=adapters, 2=controllers, 3=app services, 4=ports, 5=domain entities. Example for MVC: 0=external, 1=controllers, 2=services, 3=models.
156
+ - `layer`: non-negative integer. **Higher = closer to domain core / more stable. Lower = closer to external world / more volatile.** Dagre (TB) places higher layers lower on screen; concentric places them at center. Use as many layers as the architecture requires (typically 3-6). Example for DDD: 0=external, 1=adapters (controllers + infra), 2=app services, 3=ports, 4=domain entities. Example for MVC: 0=external, 1=controllers, 2=services, 3=models.
134
157
  - `category`: one of controller, service, port, adapter, model, database, external, job, dto (or custom). Use `model` for domain entities/value objects (core business logic). Use `database` for DB tables, migrations, ORMs, and infrastructure persistence.
135
158
  - `label`: display name for the node
159
+ - `description`: 1-3 sentences explaining responsibility + business context. Do NOT just echo the label. Cross-reference documentation for richer context (see Description Guidelines below)
136
160
  - `filePath`: relative from project root
137
161
  - `depth` (optional): 0=overview, 1=structure, 2=detail. Auto-inferred from `layer` if omitted: with 3+ unique layers, lowest → 0, middle → 1, highest → 2. With 1-2 layers, all nodes get depth 0 (always visible).
138
162
  - `useCases`: array of use case IDs this node participates in
@@ -158,6 +182,31 @@ After writing the file:
158
182
  - DDD / Clean Architecture / Hexagonal / Onion Architecture → add `"layout": "concentric"` to `project`
159
183
  - MVC / standard layered → `"layout": "dagre"` (default, can be omitted)
160
184
 
185
+ ### Description Guidelines
186
+
187
+ #### Node `description`
188
+ Write 1-3 sentences that explain responsibility AND business context.
189
+ Cross-reference project documentation (README, CLAUDE.md, docs/) for richer context.
190
+ - BAD: "User service" (just echoes the label)
191
+ - BAD: "Handles users" (too vague)
192
+ - GOOD: "Handles user registration, authentication, and profile management. Uses JWT for session tokens; password hashing via bcrypt. Rate-limited to 10 req/s per IP."
193
+
194
+ #### Edge `description`
195
+ Explain WHY the dependency exists, not just THAT it exists.
196
+ - BAD: "calls" / "depends on"
197
+ - GOOD: "Delegates payment processing via Stripe SDK; retries on timeout (3x with exponential backoff)"
198
+
199
+ #### `metadata` for supplementary details
200
+ Use `metadata` to capture information from docs that doesn't fit in `description`:
201
+ ```json
202
+ "metadata": [
203
+ { "label": "SLA", "value": ["99.9% uptime", "p95 < 200ms"], "type": "list" },
204
+ { "label": "Design Doc", "value": "https://...", "type": "link" },
205
+ { "label": "Infrastructure", "value": "Lambda + DynamoDB (on-demand)", "type": "text" },
206
+ { "label": "Rate Limit", "value": "10 req/s per IP", "type": "text" }
207
+ ]
208
+ ```
209
+
161
210
  ### Schema Rules
162
211
  - Include table schema only when migration files or model annotations are available
163
212
  - Reference from node data using schema key name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archrip",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Generate interactive architecture diagrams from your codebase using AI agents",
5
5
  "type": "module",
6
6
  "bin": {