archik 0.19.5 → 0.21.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -5
- package/README.md +32 -30
- package/commands/accept.md +21 -47
- package/commands/bootstrap.md +29 -28
- package/commands/evolve.md +19 -50
- package/commands/migrate.md +60 -60
- package/commands/self-evolving.md +8 -7
- package/commands/spawn.md +36 -38
- package/commands/suggest.md +47 -53
- package/dist/cli/archik.mjs +529 -572
- package/dist/ui/assets/index-B9OpuGHk.js +226 -0
- package/dist/ui/assets/index-DUgLHSFs.css +1 -0
- package/dist/ui/index.html +2 -2
- package/docs/templates/CLAUDE.md +73 -150
- package/docs/templates/principles/functional.md +2 -3
- package/docs/templates/principles/oop.md +3 -4
- package/docs/templates/superpowers.md +4 -4
- package/package.json +1 -7
- package/skills/archik/SKILL.md +71 -311
- package/commands/actor.md +0 -89
- package/commands/alpha.md +0 -73
- package/commands/trace.md +0 -57
- package/commands/usecase.md +0 -134
- package/dist/trace.d.ts +0 -18
- package/dist/trace.js +0 -58
- package/dist/ui/assets/index-BrvxaIkh.css +0 -1
- package/dist/ui/assets/index-C1kLj8Cy.js +0 -226
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"source": "github",
|
|
12
12
|
"repo": "bacharSalleh/archik"
|
|
13
13
|
},
|
|
14
|
-
"description": "Plain-YAML architecture diagrams
|
|
14
|
+
"description": "Plain-YAML architecture diagrams of code structure (nesting, dependency flow, drift, structural smells), all CLI-mediated and validated. The skill enforces CLI-only access; the slash commands wrap the loop.",
|
|
15
15
|
"homepage": "https://github.com/bacharSalleh/archik#readme",
|
|
16
16
|
"license": "MIT",
|
|
17
|
-
"keywords": ["architecture", "diagram", "yaml"
|
|
17
|
+
"keywords": ["architecture", "diagram", "yaml"]
|
|
18
18
|
}
|
|
19
19
|
]
|
|
20
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "archik",
|
|
3
|
-
"description": "The shared vocabulary between you and Claude Code, at the engineering level. Plain-YAML architecture diagrams
|
|
3
|
+
"description": "The shared vocabulary between you and Claude Code, at the engineering level. Plain-YAML architecture diagrams of code structure (nesting, dependency flow, drift, structural smells), all CLI-mediated and validated.",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Bashar",
|
|
6
6
|
"email": "welcomebachar@gmail.com"
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
"architecture",
|
|
13
13
|
"diagram",
|
|
14
14
|
"yaml",
|
|
15
|
-
"jacobson",
|
|
16
|
-
"use-case",
|
|
17
|
-
"ecb",
|
|
18
|
-
"essence",
|
|
19
15
|
"documentation"
|
|
20
16
|
]
|
|
21
17
|
}
|
package/README.md
CHANGED
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
|
|
28
28
|
Your architecture lives in **plain YAML**. You edit it through a **CLI**, a **validator** rejects drift before it merges, and a **live canvas** renders it in the browser. AI agents — Claude Code, or anything that speaks MCP — read the same YAML as the map of your system, so they reason about structure instead of guessing from filenames.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
archik focuses on code **structure**: which parts exist, how they nest, which way dependencies flow, and whether the code still agrees:
|
|
31
31
|
|
|
32
32
|
```
|
|
33
|
-
|
|
33
|
+
Nodes → Nesting (parentId, sub-files) → Edges → Source code
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Every link is checked against the code, so the map can't quietly fall out of sync.
|
|
37
37
|
|
|
38
38
|
## Install
|
|
39
39
|
|
|
@@ -70,8 +70,7 @@ Day to day:
|
|
|
70
70
|
| You type | You get |
|
|
71
71
|
| --- | --- |
|
|
72
72
|
| `/archik:suggest <feature>` | A staged diagram change, shown as a green/red diff on the canvas — accept or reject |
|
|
73
|
-
| `/archik:
|
|
74
|
-
| `/archik:trace` | The coverage matrix — "are we done?" |
|
|
73
|
+
| `/archik:evolve [area]` | A proposed cleaner refactor, backed by drift and smells |
|
|
75
74
|
|
|
76
75
|
Already have docker-compose or Mermaid? Bootstrap from it instead of a blank canvas:
|
|
77
76
|
|
|
@@ -110,12 +109,14 @@ There are no coordinates — layout is computed by [ELK](https://eclipse.dev/elk
|
|
|
110
109
|
| Layer | File | Captures |
|
|
111
110
|
| --- | --- | --- |
|
|
112
111
|
| Structure | `.archik/main.archik.yaml` | Services, databases, queues, agents, LLMs, edges |
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
| Behaviour | `*.archik.seq.yaml` | UML-subset sequence diagrams |
|
|
116
|
-
| Progress | `*.archik.alphas.yaml` | Essence/SEMAT alphas, machine-verified |
|
|
112
|
+
| Sub-architecture | `.archik/*.archik.yaml` | A node's internals, linked via `archikFile` |
|
|
113
|
+
| Decisions | `.archik/decisions/NNNN-*.md` | Why each accepted change was made — context, decision, alternatives, consequences |
|
|
117
114
|
|
|
118
|
-
|
|
115
|
+
The diagram says *what*; decision records say *why*. Every staged change carries one under `metadata.suggestion.decision` — `suggest set` refuses a draft without it — and accepting the change writes it as a numbered markdown record with the node and edge changes listed as evidence. Records are never edited; a later decision that changes course lists the old numbers in `supersedes`.
|
|
116
|
+
|
|
117
|
+
Each change is also labelled by how hard it is to undo. A **one-way door** — a new data store, queue, external system, gateway, LLM or top-level module, a removal, or a boundary move — gets its own canvas review before the build plan; if it adds data, an outside system or public traffic, its record must say how it is secured, observed and rolled back. A **two-way door** goes through one combined review of model and plan.
|
|
118
|
+
|
|
119
|
+
Full schema: `npx archik schema`.
|
|
119
120
|
|
|
120
121
|
## Keeping the model honest
|
|
121
122
|
|
|
@@ -123,14 +124,14 @@ A set of commands prove the diagram still matches reality, at every altitude:
|
|
|
123
124
|
|
|
124
125
|
```bash
|
|
125
126
|
npx archik validate # schema + cross-file integrity + governance constraints
|
|
126
|
-
npx archik drift # nodes
|
|
127
|
+
npx archik drift # nodes vs the source tree
|
|
127
128
|
npx archik drift --edges # edges vs the TS/JS import graph (shadow + phantom edges)
|
|
128
|
-
npx archik
|
|
129
|
-
npx archik
|
|
129
|
+
npx archik smells # folder import loops + oversized files, read from the code
|
|
130
|
+
npx archik affected --since main # changed files → nodes → dependents
|
|
130
131
|
npx archik otel check --graph deps.json # edges vs a production service-dependency graph
|
|
131
132
|
```
|
|
132
133
|
|
|
133
|
-
`validate` proves the model is internally consistent, `drift` that it matches the code, and `otel check` that it matches production traffic. Gate every commit locally:
|
|
134
|
+
`validate` proves the model is internally consistent, `drift` that it matches the code, and `otel check` that it matches production traffic. `smells` needs no model: it reports folder loops with the real imports as evidence (only relative imports are resolved, so every loop is real) and points at the cheapest import to cut. On existing code, `archik smells --update-baseline` saves today's findings as known debt, so `--fail-on-warn` fails only on new loops and growing files. Gate every commit locally:
|
|
134
135
|
|
|
135
136
|
```bash
|
|
136
137
|
npx archik hooks install # pre-commit: archik validate
|
|
@@ -142,7 +143,7 @@ Large models stay readable: `archik complexity` flags over-large files, hub node
|
|
|
142
143
|
|
|
143
144
|
**Claude Code.** `archik init` installs a skill that enforces one rule — *Claude talks to archik only through the CLI*, never by editing YAML directly. Reads go through `archik q`, writes through `archik suggest set`, and you approve every structural change on the canvas.
|
|
144
145
|
|
|
145
|
-
**Everything else (MCP).** `archik mcp` runs a stdio [Model Context Protocol](https://modelcontextprotocol.io) server exposing the same contract — tools for schema, queries,
|
|
146
|
+
**Everything else (MCP).** `archik mcp` runs a stdio [Model Context Protocol](https://modelcontextprotocol.io) server exposing the same contract — tools for schema, queries, validate, drift, smells, and the suggestion lifecycle, plus resources (`archik://schema`, `archik://stats`, `archik://smells`) and prompts that encode the same loop:
|
|
146
147
|
|
|
147
148
|
```jsonc
|
|
148
149
|
// .cursor/mcp.json, claude_desktop_config.json, etc.
|
|
@@ -176,7 +177,7 @@ Intentional exceptions are grandfathered by id in an `except` list — visible i
|
|
|
176
177
|
|
|
177
178
|
## CI
|
|
178
179
|
|
|
179
|
-
Run the commands directly, or use the GitHub Action, which validates, checks drift
|
|
180
|
+
Run the commands directly, or use the GitHub Action, which validates, checks drift, reports smells, and posts a sticky PR comment with the architecture diff against the base branch:
|
|
180
181
|
|
|
181
182
|
```yaml
|
|
182
183
|
# .github/workflows/archik.yml
|
|
@@ -192,10 +193,10 @@ jobs:
|
|
|
192
193
|
- uses: actions/checkout@v4
|
|
193
194
|
- uses: bacharSalleh/archik@main
|
|
194
195
|
with:
|
|
195
|
-
|
|
196
|
+
smells-fail: true # optional gate; with a committed baseline, fails only on new smells
|
|
196
197
|
```
|
|
197
198
|
|
|
198
|
-
Inputs: `path`, `working-directory`, `validate`, `drift`, `
|
|
199
|
+
Inputs: `path`, `working-directory`, `validate`, `drift`, `smells-fail`, `compare-ref`, `comment`, `github-token`, `version`.
|
|
199
200
|
|
|
200
201
|
## Self-evolution
|
|
201
202
|
|
|
@@ -211,16 +212,15 @@ Every command supports `--help`; agent-facing commands support `--json`.
|
|
|
211
212
|
| `archik dev` / `start` / `stop` / `status` | Live canvas lifecycle (foreground / detached) |
|
|
212
213
|
| `archik validate [path]` | Schema + cross-file + constraints (exit 1 on error) |
|
|
213
214
|
| `archik complexity [path]` | Flag over-large files, hub nodes, deep nesting (`--fail-on-warn` to gate) |
|
|
214
|
-
| `archik
|
|
215
|
+
| `archik smells [dir]` | Folder import loops + oversized source files, from the code (`--max-file-lines`, `--fail-on-warn`, `--update-baseline`) |
|
|
216
|
+
| `archik render --out <svg>` | Headless SVG render (`--focus <id>`, `--hide-structural`) |
|
|
215
217
|
| `archik watch` | Re-render SVG on every change |
|
|
216
|
-
| `archik q <sub>` | Query: `describe` `deps` `dependents` `neighbors` `impact` `list` `edges` `stats`
|
|
218
|
+
| `archik q <sub>` | Query: `describe` `deps` `dependents` `neighbors` `impact` `list` `edges` `stats` |
|
|
217
219
|
| `archik diff <a> [b]` | Diff two files **or git refs**; one arg = that ref vs working tree |
|
|
218
|
-
| `archik affected` | Changed files → nodes,
|
|
219
|
-
| `archik
|
|
220
|
-
| `archik drift` | sourcePath / test-path gaps (`--edges` verifies edges vs the import graph) |
|
|
220
|
+
| `archik affected` | Changed files → nodes, dependents, model files, unmapped (`--since <ref>`, `--files`) |
|
|
221
|
+
| `archik drift` | sourcePath gaps (`--edges` verifies edges vs the import graph) |
|
|
221
222
|
| `archik otel check --graph <f>` | Verify edges against a production service-dependency graph |
|
|
222
|
-
| `archik suggest <sub>` | Suggestion sidecar lifecycle: `show` `set` `accept` `reject` |
|
|
223
|
-
| `archik alpha <sub>` | Essence alphas: `show`, `promote`, `demote` |
|
|
223
|
+
| `archik suggest <sub>` | Suggestion sidecar lifecycle: `show` `set` `accept` `reject` — accept writes the decision record to `.archik/decisions/` |
|
|
224
224
|
| `archik evolution <sub>` | Self-evolution loop: `enable` `reflect` `proposals` `approve` `reject` `report` |
|
|
225
225
|
| `archik patterns <sub>` | Pattern library: `list` `show <id>` `apply <id>` |
|
|
226
226
|
| `archik import compose\|mermaid [file]` | Bootstrap from docker-compose or a Mermaid flowchart |
|
|
@@ -228,23 +228,25 @@ Every command supports `--help`; agent-facing commands support `--json`.
|
|
|
228
228
|
| `archik hooks install` | Pre-commit hook running `archik validate` (`--with-drift` optional) |
|
|
229
229
|
| `archik owners sync\|check` | Keep CODEOWNERS in step with node owners |
|
|
230
230
|
| `archik mcp` | MCP server over stdio for non-Claude-Code agents |
|
|
231
|
-
| `archik schema
|
|
232
|
-
| `archik upgrade` | Upgrade + refresh installed skill/commands |
|
|
231
|
+
| `archik schema` | Print the document schema |
|
|
232
|
+
| `archik upgrade` | Upgrade + refresh installed skill/commands (`--migrate` also runs `archik migrate` with the new version) |
|
|
233
|
+
| `archik migrate` | Bring the project's archik files up to the installed version — archives first, validates after (`--dry-run`) |
|
|
233
234
|
|
|
234
235
|
Default file resolution: `.archik/main.archik.yaml`, falling back to the legacy `architecture.archik.yaml` (both present is an error).
|
|
235
236
|
|
|
236
237
|
## When to use it
|
|
237
238
|
|
|
238
|
-
Reach for archik when a project has more than a handful of components, ships with an AI agent you want reasoning about structure,
|
|
239
|
+
Reach for archik when a project has more than a handful of components, ships with an AI agent you want reasoning about structure, wants folder loops caught with real import evidence, or wants CI to fail on architectural drift. Skip it for one-file scripts, slide-deck diagrams (use Mermaid), or projects with no build or CI.
|
|
239
240
|
|
|
240
241
|
| | archik | Mermaid / PlantUML | Structurizr |
|
|
241
242
|
| --- | --- | --- | --- |
|
|
242
243
|
| Source format | Plain YAML | Custom DSL | Structurizr DSL |
|
|
243
244
|
| AI-editor integration | **Skill + MCP** | None | None |
|
|
244
|
-
|
|
|
245
|
+
| Structural smells from code | **Yes** | No | No |
|
|
245
246
|
| Drift detection | **Yes** | No | No |
|
|
247
|
+
| Decision records tied to model changes | **Yes** | No | No |
|
|
246
248
|
| Governance constraints | **Yes** | No | No |
|
|
247
|
-
| Validator | **Schema + cross-file +
|
|
249
|
+
| Validator | **Schema + cross-file + constraints** | Syntax only | Syntax only |
|
|
248
250
|
|
|
249
251
|
## Contributing
|
|
250
252
|
|
package/commands/accept.md
CHANGED
|
@@ -29,31 +29,14 @@ done at step 1 — the diagram changed; the code probably hasn't.
|
|
|
29
29
|
non-code-bearing kind, description-only edit, pure metadata),
|
|
30
30
|
skip steps 3–6 and jump straight to step 7.
|
|
31
31
|
|
|
32
|
-
3. **BUILD —
|
|
32
|
+
3. **BUILD — plan (HITL).**
|
|
33
33
|
|
|
34
|
-
**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
npx archik q usecases
|
|
41
|
-
```
|
|
42
|
-
For each active slice without a `realization.seqFile` that meets
|
|
43
|
-
the above criteria:
|
|
44
|
-
- Author the `.archik.seq.yaml` now (direct-write), including a
|
|
45
|
-
`realizes: { useCase, slice }` block.
|
|
46
|
-
- Run `npx archik validate` — catches ECB violations, broken
|
|
47
|
-
`nodeId` refs, and duplicate step ids.
|
|
48
|
-
- Show the seq YAML inline and wait for confirmation before
|
|
49
|
-
writing the plan.
|
|
50
|
-
|
|
51
|
-
A slice without a seq diagram has no traceable spec — the build
|
|
52
|
-
plan for it is guesswork. Author the seq first; trace it in the
|
|
53
|
-
plan. If the slice is genuinely simple (single node, no
|
|
54
|
-
branching), skip the seq and note why.
|
|
55
|
-
|
|
56
|
-
**Then** translate the diagram delta into a numbered file-level
|
|
34
|
+
**Two-way door shortcut:** if `/archik:suggest` already showed the
|
|
35
|
+
build plan with this sidecar (two-way door), the accept you just
|
|
36
|
+
ran approved it — go straight to step 4. One-way doors always get
|
|
37
|
+
their own plan approval here.
|
|
38
|
+
|
|
39
|
+
Translate the diagram delta into a numbered file-level
|
|
57
40
|
plan and present it for approval **before** touching code:
|
|
58
41
|
- Each new code-bearing node (`service`, `function`, `worker`,
|
|
59
42
|
`module`, `page`, `component`, `store`, `hook`, `model`, `dto`,
|
|
@@ -62,15 +45,12 @@ done at step 1 — the diagram changed; the code probably hasn't.
|
|
|
62
45
|
- Each new edge that requires code → the corresponding code
|
|
63
46
|
change (a new `http_call` needs a client; `subscribes` needs a
|
|
64
47
|
consumer handler; `writes` needs a repository method; etc).
|
|
65
|
-
- Each seq diagram that realizes a slice → trace it: every
|
|
66
|
-
message in the seq must map to a concrete function call in this
|
|
67
|
-
plan. This is the traceability requirement — the seq is the
|
|
68
|
-
spec, the plan is the contract, the code is the proof.
|
|
69
|
-
- Each slice's `tests` paths → include scaffolding those test
|
|
70
|
-
files in the plan; they must exist on disk before the slice
|
|
71
|
-
can be marked active.
|
|
72
48
|
- Any node still `status: proposed` → flag it; code must land
|
|
73
49
|
before flipping to `active`.
|
|
50
|
+
- If the accepted decision record has `crossCutting`, each
|
|
51
|
+
promise becomes a plan item: the security control, the signal
|
|
52
|
+
(log / metric / alert) and the rollback path (flag, revert,
|
|
53
|
+
migration down-step).
|
|
74
54
|
- Default to **tests-first** when behaviour is clearly bounded.
|
|
75
55
|
- If `superpowers:writing-plans` is available, use it; else
|
|
76
56
|
inline.
|
|
@@ -106,15 +86,18 @@ done at step 1 — the diagram changed; the code probably hasn't.
|
|
|
106
86
|
```
|
|
107
87
|
npx archik drift
|
|
108
88
|
```
|
|
109
|
-
Catches
|
|
110
|
-
test files on disk.
|
|
111
|
-
If the project has use cases, run the coverage matrix:
|
|
89
|
+
Catches missing `sourcePath` directories on disk.
|
|
112
90
|
```
|
|
113
|
-
npx archik
|
|
91
|
+
npx archik smells
|
|
114
92
|
```
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
93
|
+
Catches folder loops and oversized files, with the real imports
|
|
94
|
+
as evidence. A new loop is a gap — cut the cheapest import (or
|
|
95
|
+
queue a `/archik:suggest`) before declaring the milestone done.
|
|
96
|
+
With a committed baseline (`.archik/smells-baseline.json`) only
|
|
97
|
+
findings marked **NEW** count; known debt is not this change's job.
|
|
98
|
+
|
|
99
|
+
For a one-way door, confirm each `crossCutting` promise from the
|
|
100
|
+
decision record is in the code before flipping nodes to `active`.
|
|
118
101
|
`superpowers:verification-before-completion` when available.
|
|
119
102
|
If `docs/architecture.svg` is committed, regenerate it:
|
|
120
103
|
```
|
|
@@ -128,12 +111,3 @@ done at step 1 — the diagram changed; the code probably hasn't.
|
|
|
128
111
|
- *"Want me to schedule a drift check in two weeks?"*
|
|
129
112
|
- *"This left `payments-worker` as `status: proposed` — flip it
|
|
130
113
|
to `active` once deployed."*
|
|
131
|
-
- If this milestone completed a significant chunk of work, check
|
|
132
|
-
whether any alpha state can be promoted:
|
|
133
|
-
```
|
|
134
|
-
npx archik alpha show
|
|
135
|
-
```
|
|
136
|
-
If a state is verified and the next rung's criteria are met,
|
|
137
|
-
offer to promote: *"Requirements is at `acceptable` and all
|
|
138
|
-
active slices now have tests — want me to promote it to
|
|
139
|
-
`addressed`?"*
|
package/commands/bootstrap.md
CHANGED
|
@@ -38,8 +38,8 @@ brief and start the DESIGN loop.
|
|
|
38
38
|
|
|
39
39
|
1. Confirm with the user once before writing anything:
|
|
40
40
|
> "I see this is a fresh project. I'll scaffold archik, then ask
|
|
41
|
-
> for a one-paragraph brief so I can model the
|
|
42
|
-
>
|
|
41
|
+
> for a one-paragraph brief so I can model the first piece you
|
|
42
|
+
> should ship. Sound right?"
|
|
43
43
|
2. On confirmation, run:
|
|
44
44
|
```sh
|
|
45
45
|
npx archik@latest init
|
|
@@ -48,9 +48,8 @@ brief and start the DESIGN loop.
|
|
|
48
48
|
and skip step 4. Otherwise:
|
|
49
49
|
4. **Ask for the brief**, in this exact shape (so the user knows
|
|
50
50
|
what fields you actually need). The closing line is the load-
|
|
51
|
-
bearing one — it commits the conversation to
|
|
52
|
-
|
|
53
|
-
that makes the rest of the loop work:
|
|
51
|
+
bearing one — it commits the conversation to pick-exactly-one,
|
|
52
|
+
which is the framing that makes the rest of the loop work:
|
|
54
53
|
> "Send me a project brief in this shape (skip any line that
|
|
55
54
|
> doesn't apply):
|
|
56
55
|
>
|
|
@@ -60,18 +59,17 @@ brief and start the DESIGN loop.
|
|
|
60
59
|
> **Constraints:** budget, deadline, team size, hard-no's.
|
|
61
60
|
> **Out of scope:** things you explicitly DON'T want.
|
|
62
61
|
>
|
|
63
|
-
> **Then end with:** *'Start by modelling the
|
|
64
|
-
> first
|
|
65
|
-
> forces priorities into the open before any code lands.
|
|
66
|
-
>
|
|
67
|
-
> `status:
|
|
68
|
-
>
|
|
69
|
-
>
|
|
70
|
-
> in the chat log."
|
|
62
|
+
> **Then end with:** *'Start by modelling the smallest structure
|
|
63
|
+
> for the first thing I should ship.'* — that single line is what
|
|
64
|
+
> forces priorities into the open before any code lands. New
|
|
65
|
+
> nodes start `status: proposed` (the code doesn't exist on disk
|
|
66
|
+
> yet) and flip to `status: active` when the code lands in BUILD.
|
|
67
|
+
> Only the first milestone is modelled in detail; later areas stay
|
|
68
|
+
> coarse placeholders until their turn.
|
|
69
|
+
> The commitment lives in the YAML, not in the chat log."
|
|
71
70
|
5. When the brief lands, run the standard DESIGN loop:
|
|
72
|
-
`/archik:
|
|
73
|
-
|
|
74
|
-
inline-review gate; don't barrel through.
|
|
71
|
+
`/archik:suggest` (structural sidecar) → `/archik:accept` →
|
|
72
|
+
BUILD. Stop at each inline-review gate; don't barrel through.
|
|
75
73
|
|
|
76
74
|
### B. No `.archik/` yet, but source code exists (existing project)
|
|
77
75
|
|
|
@@ -94,8 +92,10 @@ diagram, then iterate from honest ground truth.
|
|
|
94
92
|
`.claude/commands/archik/spawn.md` for the steps. Don't
|
|
95
93
|
duplicate them here.
|
|
96
94
|
4. After the user accepts the spawn sidecar, suggest the natural
|
|
97
|
-
follow-up: "Want to
|
|
98
|
-
|
|
95
|
+
follow-up: "Want to check the code for structural smells?
|
|
96
|
+
`npx archik smells` finds folder loops and oversized files — and
|
|
97
|
+
`--update-baseline` saves today's findings so CI fails only on new
|
|
98
|
+
ones."
|
|
99
99
|
|
|
100
100
|
### C. `.archik/` exists but the diagram is empty or near-empty
|
|
101
101
|
|
|
@@ -113,19 +113,20 @@ Skip the `init` step in both — the file already exists.
|
|
|
113
113
|
The project is already running the loop. Don't re-bootstrap. Surface
|
|
114
114
|
the current state and let the user pick the next move:
|
|
115
115
|
|
|
116
|
-
1. Run
|
|
116
|
+
1. Run three checks to ground the user in where they are:
|
|
117
117
|
```sh
|
|
118
118
|
npx archik q stats
|
|
119
|
-
npx archik
|
|
119
|
+
npx archik drift
|
|
120
|
+
npx archik smells
|
|
120
121
|
```
|
|
121
|
-
2.
|
|
122
|
-
|
|
122
|
+
2. Sum it up in one sentence: "X nodes, Y drift findings, Z
|
|
123
|
+
smells." Name the worst finding if any.
|
|
123
124
|
3. Suggest the next action based on state:
|
|
124
|
-
- **
|
|
125
|
-
`/archik:suggest <feature>`.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
- **Clean** → "Ready to ship. Want to add a feature?
|
|
126
|
+
`/archik:suggest <feature>`."
|
|
127
|
+
- **Drift or smells** → "The biggest gap is `<finding>` — the
|
|
128
|
+
evidence is `<file imports "specifier">` (or the drift line).
|
|
129
|
+
Want me to fix it?"
|
|
129
130
|
|
|
130
131
|
## Notes
|
|
131
132
|
|
|
@@ -137,7 +138,7 @@ the current state and let the user pick the next move:
|
|
|
137
138
|
- Don't skip `init` if it's needed. The slash commands rely on
|
|
138
139
|
`npx archik` being callable from the project root, and `init`
|
|
139
140
|
also makes sure the skill + slash commands are installed.
|
|
140
|
-
- **Do not** start writing
|
|
141
|
+
- **Do not** start writing sidecars or code before
|
|
141
142
|
the user replies to your "sound right?" check. Bootstrap is the
|
|
142
143
|
one place where confirming-before-acting is more important than
|
|
143
144
|
speed — the user is still calibrating what archik will do.
|
package/commands/evolve.md
CHANGED
|
@@ -45,26 +45,15 @@ any file under `.archik/`.
|
|
|
45
45
|
— there's nothing meaningful to evolve. Suggest `/archik:spawn`
|
|
46
46
|
first.
|
|
47
47
|
|
|
48
|
-
Also
|
|
49
|
-
|
|
48
|
+
Also read the code-level smells, so your proposal rests on real
|
|
49
|
+
imports and not only on the diagram:
|
|
50
50
|
```
|
|
51
|
-
npx archik
|
|
52
|
-
npx archik q usecases
|
|
53
|
-
npx archik trace --json
|
|
51
|
+
npx archik smells --json
|
|
54
52
|
```
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
node list, mentally note which nodes you're likely to remove,
|
|
60
|
-
split, or merge. For each such node, run:
|
|
61
|
-
```
|
|
62
|
-
npx archik q sequences --node <id>
|
|
63
|
-
```
|
|
64
|
-
This returns the seq files whose participants reference that
|
|
65
|
-
node ID. Collect these — you'll need the list in step 6 to
|
|
66
|
-
warn the user. If the list is empty for all affected nodes,
|
|
67
|
-
no seq diagrams are at risk.
|
|
53
|
+
It reports folder loops (sibling folders that import each other,
|
|
54
|
+
with each `file imports "specifier"` as evidence and the cheapest
|
|
55
|
+
import to cut) and oversized files. It needs no model, so it
|
|
56
|
+
works even when the diagram is thin.
|
|
68
57
|
|
|
69
58
|
3. **Identify smells and missing structure.** Don't propose change
|
|
70
59
|
for change's sake — every modification should fix one of:
|
|
@@ -85,30 +74,12 @@ any file under `.archik/`.
|
|
|
85
74
|
introduce a `port` (the abstract contract) and an `adapter`
|
|
86
75
|
(the concrete impl), with `implements` between them.
|
|
87
76
|
- **Cyclic dependencies** between modules — should be inverted
|
|
88
|
-
(events) or broken (extract shared kernel).
|
|
77
|
+
(events) or broken (extract shared kernel). Use the folder loops
|
|
78
|
+
from `archik smells` as evidence: quote the imports, and start
|
|
79
|
+
with the "cheapest to cut" edge.
|
|
89
80
|
- **Anaemic queues.** Two services connected by `http_call`
|
|
90
81
|
for what's clearly an async fire-and-forget → introduce a
|
|
91
82
|
`queue` or `topic` and rewire to `publishes` / `subscribes`.
|
|
92
|
-
- **Missing ECB stereotypes.** Only applies when actor/UC files
|
|
93
|
-
exist (`npx archik q usecases` returns results). Nodes that
|
|
94
|
-
appear in active UC slices (visible in `archik trace` output),
|
|
95
|
-
or that have user-facing relationships (`http_call` from a
|
|
96
|
-
gateway, `writes`/`reads` to a domain DB) but no `stereotype`
|
|
97
|
-
field → classify each as `boundary`, `control`, or `entity`.
|
|
98
|
-
This is a prerequisite for ECB validation on seq diagrams.
|
|
99
|
-
Evolve may **add** a stereotype to nodes spawn left blank, but
|
|
100
|
-
only when this smell is triggered. Never invent stereotypes on
|
|
101
|
-
a pure structural diagram with no UC files.
|
|
102
|
-
- **UC coverage gaps.** Only applies when UC files exist and
|
|
103
|
-
`archik trace --json` returns rows. Active slices that are
|
|
104
|
-
`partial` (tests exist but no seq realization) usually signal
|
|
105
|
-
a missing seq diagram or a missing port/adapter in the
|
|
106
|
-
structural model. Active slices that are `none` (no tests, no
|
|
107
|
-
realization) signal untested behaviour — propose a test
|
|
108
|
-
scaffold or a seq diagram, and flag any architectural gap that
|
|
109
|
-
makes the slice hard to realize (e.g. missing adapter for an
|
|
110
|
-
external call). If trace output is empty or all slices are
|
|
111
|
-
`full`, skip this smell.
|
|
112
83
|
|
|
113
84
|
Aim for 3–8 changes — enough to be meaningful, few enough that
|
|
114
85
|
the user can reason about each. If you'd need more, propose
|
|
@@ -136,6 +107,13 @@ any file under `.archik/`.
|
|
|
136
107
|
# full proposed end-state — every node, not just the delta
|
|
137
108
|
edges:
|
|
138
109
|
# ...
|
|
110
|
+
metadata:
|
|
111
|
+
suggestion:
|
|
112
|
+
decision:
|
|
113
|
+
context: <the smell and its evidence, e.g. the folder loop imports>
|
|
114
|
+
decision: <the refactor you chose>
|
|
115
|
+
alternatives: [<other fixes you weighed, incl. leaving it>]
|
|
116
|
+
consequences: <what gets easier and what it costs>
|
|
139
117
|
YAML
|
|
140
118
|
```
|
|
141
119
|
|
|
@@ -144,7 +122,7 @@ any file under `.archik/`.
|
|
|
144
122
|
ids, never rename. Renames break diff and require the user to
|
|
145
123
|
manually re-link references in code.
|
|
146
124
|
- Don't drop `description`, `responsibilities`, `notes`,
|
|
147
|
-
`
|
|
125
|
+
`owner`, or `sourcePath` fields the user authored. Carry
|
|
148
126
|
them over verbatim.
|
|
149
127
|
- Every new code-bearing node (`service`, `function`, `worker`,
|
|
150
128
|
`module`, `page`, `component`, `store`, `hook`, `model`, `dto`,
|
|
@@ -160,9 +138,6 @@ any file under `.archik/`.
|
|
|
160
138
|
until the code lands.
|
|
161
139
|
- Every node MUST have a non-empty `description` explaining
|
|
162
140
|
what it does. Don't introduce a node without one.
|
|
163
|
-
- When adding a `stereotype` to address the ECB smell, use only
|
|
164
|
-
`boundary`, `control`, or `entity`. Don't add `stereotype` to
|
|
165
|
-
purely infra nodes (`database`, `queue`, `external`, `cloud`).
|
|
166
141
|
- Every change should be motivated by step 3, not by aesthetics.
|
|
167
142
|
|
|
168
143
|
If `suggest set` reports validation errors, re-run with the
|
|
@@ -176,13 +151,7 @@ any file under `.archik/`.
|
|
|
176
151
|
grouped by motivation (e.g. *"1. Extract a `payments`
|
|
177
152
|
bounded context from `orders`. Why: payment logic was leaking
|
|
178
153
|
into order placement…"*). Keep each item to 2–3 sentences.
|
|
179
|
-
c.
|
|
180
|
-
in step 2 references a node that this proposal removes or
|
|
181
|
-
renames, list them explicitly:
|
|
182
|
-
*"⚠️ These seq diagrams reference nodes this refactor
|
|
183
|
-
changes — they will need updating after accept: `<list>`."*
|
|
184
|
-
If no seq files are affected, skip this bullet.
|
|
185
|
-
d. An explicit invitation: *"Tell me what you'd like to keep,
|
|
154
|
+
c. An explicit invitation: *"Tell me what you'd like to keep,
|
|
186
155
|
drop, or rework before you accept. I can re-stage with
|
|
187
156
|
changes — `/archik:accept` is whenever you're ready."*
|
|
188
157
|
|