archik 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/commands/accept.md +3 -1
- package/commands/bootstrap.md +8 -1
- package/commands/evolve.md +6 -0
- package/commands/realize.md +92 -0
- package/commands/spawn.md +7 -0
- package/commands/suggest.md +11 -1
- package/dist/cli/archik.mjs +460 -367
- package/dist/ui/assets/index-C3mFLYOG.js +228 -0
- package/dist/ui/assets/index-D6TFArum.css +1 -0
- package/dist/ui/index.html +2 -2
- package/docs/templates/CLAUDE.md +13 -7
- package/package.json +1 -1
- package/skills/archik/SKILL.md +12 -1
- package/dist/ui/assets/index-B9OpuGHk.js +0 -226
- package/dist/ui/assets/index-DUgLHSFs.css +0 -1
package/README.md
CHANGED
|
@@ -70,6 +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:realize` | Make the code match the model the architect changed (works `archik gap` until empty) |
|
|
73
74
|
| `/archik:evolve [area]` | A proposed cleaner refactor, backed by drift and smells |
|
|
74
75
|
|
|
75
76
|
Already have docker-compose or Mermaid? Bootstrap from it instead of a blank canvas:
|
|
@@ -112,6 +113,18 @@ There are no coordinates — layout is computed by [ELK](https://eclipse.dev/elk
|
|
|
112
113
|
| Sub-architecture | `.archik/*.archik.yaml` | A node's internals, linked via `archikFile` |
|
|
113
114
|
| Decisions | `.archik/decisions/NNNN-*.md` | Why each accepted change was made — context, decision, alternatives, consequences |
|
|
114
115
|
|
|
116
|
+
**Steer by moving boxes.** The architect changes the architecture directly on the canvas — drag a node into another module (or out to the top level), draw or delete an edge, set a layer — and saves it with a short "why" (the decision record). A moved component becomes a *pending move*. `archik gap` (and the **Code gap** panel on the canvas) then lists exactly what the code must change: move or create code, remove or add imports, fix style breaks, finish nodes whose code landed. "Copy task for your agent" hands it to Claude Code as `/archik:realize`; the agent works the list until the code matches the model.
|
|
117
|
+
|
|
118
|
+
**Architecture style.** The architect picks the structure the code must follow — `layered`, `hexagonal`, `clean`, `modular-monolith` or `feature-slices` — with `style:` in the root file and a `layer:` on top-level nodes. archik enforces it on every change (validate, suggest set, canvas save reject a dependency that breaks it), draws the board in the style's lanes, and tells agents where each node sits and what it may depend on (`archik style`, `archik q describe`).
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
style:
|
|
122
|
+
kind: hexagonal # adapters → ports / core; the core never depends on an adapter
|
|
123
|
+
nodes:
|
|
124
|
+
- { id: rest-api, kind: module, name: REST API, layer: adapters, ... }
|
|
125
|
+
- { id: core, kind: module, name: Ordering core, layer: core, ... }
|
|
126
|
+
```
|
|
127
|
+
|
|
115
128
|
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
129
|
|
|
117
130
|
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.
|
|
@@ -212,6 +225,8 @@ Every command supports `--help`; agent-facing commands support `--json`.
|
|
|
212
225
|
| `archik dev` / `start` / `stop` / `status` | Live canvas lifecycle (foreground / detached) |
|
|
213
226
|
| `archik validate [path]` | Schema + cross-file + constraints (exit 1 on error) |
|
|
214
227
|
| `archik complexity [path]` | Flag over-large files, hub nodes, deep nesting (`--fail-on-warn` to gate) |
|
|
228
|
+
| `archik gap` | What the code must change to match the model — move / create code, imports, style breaks, finish (`--json`, `--all`, `--fail-on-gap`) |
|
|
229
|
+
| `archik style [list]` | The architecture style: rule, layers / modules, where nodes sit, violations; `list` shows every style |
|
|
215
230
|
| `archik smells [dir]` | Folder import loops + oversized source files, from the code (`--max-file-lines`, `--fail-on-warn`, `--update-baseline`) |
|
|
216
231
|
| `archik render --out <svg>` | Headless SVG render (`--focus <id>`, `--hide-structural`) |
|
|
217
232
|
| `archik watch` | Re-render SVG on every change |
|
|
@@ -246,6 +261,7 @@ Reach for archik when a project has more than a handful of components, ships wit
|
|
|
246
261
|
| Drift detection | **Yes** | No | No |
|
|
247
262
|
| Decision records tied to model changes | **Yes** | No | No |
|
|
248
263
|
| Governance constraints | **Yes** | No | No |
|
|
264
|
+
| Enforced architecture style (layered, hexagonal, clean, modular) | **Yes** | No | No |
|
|
249
265
|
| Validator | **Schema + cross-file + constraints** | Syntax only | Syntax only |
|
|
250
266
|
|
|
251
267
|
## Contributing
|
package/commands/accept.md
CHANGED
|
@@ -36,7 +36,9 @@ done at step 1 — the diagram changed; the code probably hasn't.
|
|
|
36
36
|
ran approved it — go straight to step 4. One-way doors always get
|
|
37
37
|
their own plan approval here.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Start from `npx archik gap --json` — it lists the code work the
|
|
40
|
+
accepted model now asks for (moves, new code, imports, style
|
|
41
|
+
breaks). Then translate the diagram delta into a numbered file-level
|
|
40
42
|
plan and present it for approval **before** touching code:
|
|
41
43
|
- Each new code-bearing node (`service`, `function`, `worker`,
|
|
42
44
|
`module`, `page`, `component`, `store`, `hook`, `model`, `dto`,
|
package/commands/bootstrap.md
CHANGED
|
@@ -67,7 +67,14 @@ brief and start the DESIGN loop.
|
|
|
67
67
|
> Only the first milestone is modelled in detail; later areas stay
|
|
68
68
|
> coarse placeholders until their turn.
|
|
69
69
|
> The commitment lives in the YAML, not in the chat log."
|
|
70
|
-
5. When the brief lands,
|
|
70
|
+
5. When the brief lands, agree the **architecture style** first:
|
|
71
|
+
show `npx archik style list`, recommend one that fits the brief
|
|
72
|
+
(small service → layered; rich domain with many integrations →
|
|
73
|
+
hexagonal or clean; several teams in one deployable → modular
|
|
74
|
+
monolith; many independent features → feature slices), and ask
|
|
75
|
+
the user to pick. The first sidecar sets `style:` and puts each
|
|
76
|
+
top-level node in its layer or module.
|
|
77
|
+
6. Then run the standard DESIGN loop:
|
|
71
78
|
`/archik:suggest` (structural sidecar) → `/archik:accept` →
|
|
72
79
|
BUILD. Stop at each inline-review gate; don't barrel through.
|
|
73
80
|
|
package/commands/evolve.md
CHANGED
|
@@ -30,10 +30,16 @@ any file under `.archik/`.
|
|
|
30
30
|
|
|
31
31
|
2. **Ground yourself in the current shape** via the query CLI:
|
|
32
32
|
```
|
|
33
|
+
npx archik style
|
|
33
34
|
npx archik q stats
|
|
34
35
|
npx archik q list
|
|
35
36
|
npx archik q edges
|
|
36
37
|
```
|
|
38
|
+
If no style is declared, one of the best improvements you can
|
|
39
|
+
offer is to adopt one (`npx archik style list`): pick the style the
|
|
40
|
+
code is closest to, set it in the draft with layers on the
|
|
41
|
+
top-level nodes, and let the violations it reports become the
|
|
42
|
+
refactor plan.
|
|
37
43
|
If `$ARGUMENTS` names a specific area, also:
|
|
38
44
|
```
|
|
39
45
|
npx archik q describe <id>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Make the code match the architecture the architect changed
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /archik:realize — make the code match the model
|
|
6
|
+
|
|
7
|
+
The architect steers the architecture on the canvas: moves a box into
|
|
8
|
+
another module, draws or deletes an edge, sets a layer or a style. The
|
|
9
|
+
model changes first; the code has not caught up. Your job is to close
|
|
10
|
+
that gap — and only that gap.
|
|
11
|
+
|
|
12
|
+
`$ARGUMENTS` (optional) narrows the work to one node or area.
|
|
13
|
+
|
|
14
|
+
## CLI-only for architecture
|
|
15
|
+
|
|
16
|
+
Read the model only through `npx archik`. Change it only through
|
|
17
|
+
`npx archik suggest set` (the lifecycle flips below). Never edit
|
|
18
|
+
`.archik/*.yaml` by hand.
|
|
19
|
+
|
|
20
|
+
## Steps
|
|
21
|
+
|
|
22
|
+
1. **Get the work list.**
|
|
23
|
+
```bash
|
|
24
|
+
npx archik gap --json
|
|
25
|
+
```
|
|
26
|
+
Each task has a `type` and a `text`:
|
|
27
|
+
- `move-code` — move the node's code from `from` to `to`, then fix
|
|
28
|
+
every import that pointed at the old path.
|
|
29
|
+
- `create-code` — create the code for a planned node at `path`.
|
|
30
|
+
- `style-break` — an import breaks the architecture style. Fix it
|
|
31
|
+
the way the message says (usually: add an interface / port in the
|
|
32
|
+
inner layer and depend on that).
|
|
33
|
+
- `remove-import` — the architect deleted that edge. Remove the
|
|
34
|
+
import (move the logic, or call through an allowed node).
|
|
35
|
+
- `add-dependency` — the model says A uses B; wire the import.
|
|
36
|
+
- `finish` — the node's code now exists; flip it to `active`.
|
|
37
|
+
|
|
38
|
+
If the list is empty, say so and stop.
|
|
39
|
+
|
|
40
|
+
2. **Read why.** For each node in the list, read the newest decision
|
|
41
|
+
record that mentions it in `.archik/decisions/` (plain markdown —
|
|
42
|
+
read it directly). Keep to the intent: a move into `billing` means
|
|
43
|
+
the code now belongs to billing, not just a new folder name.
|
|
44
|
+
|
|
45
|
+
3. **Check the rules before you edit.**
|
|
46
|
+
```bash
|
|
47
|
+
npx archik style
|
|
48
|
+
npx archik q describe <id> # the "style:" line: layer / module, may depend on
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
4. **Plan, then wait for "approve".** A numbered, file-level plan:
|
|
52
|
+
which folders move, which imports change, which files are created.
|
|
53
|
+
Keep it to the gap. No drive-by refactors.
|
|
54
|
+
|
|
55
|
+
5. **Do it in small commits.** Move with `git mv` so history follows
|
|
56
|
+
the code. After each step run the project's tests and typecheck.
|
|
57
|
+
|
|
58
|
+
6. **Flip finished nodes to active.** When `gap` lists `finish`
|
|
59
|
+
tasks, stage one sidecar that removes `status: proposed` from those
|
|
60
|
+
nodes, with a short decision record (context: the code landed;
|
|
61
|
+
decision: mark it active; alternative: keep it proposed until
|
|
62
|
+
deploy; consequence: drift now checks it):
|
|
63
|
+
```bash
|
|
64
|
+
npx archik suggest set --note "<nodes> are built" - <<'YAML'
|
|
65
|
+
... full document, those nodes without status: proposed ...
|
|
66
|
+
metadata:
|
|
67
|
+
suggestion:
|
|
68
|
+
decision: { context: ..., decision: ..., alternatives: [...], consequences: ... }
|
|
69
|
+
YAML
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
7. **Verify — the gap must be empty.**
|
|
73
|
+
```bash
|
|
74
|
+
npx archik gap # ✓ the code matches the model
|
|
75
|
+
npx archik validate
|
|
76
|
+
npx archik drift
|
|
77
|
+
npx archik smells # no NEW folder loops
|
|
78
|
+
```
|
|
79
|
+
Plus the project's tests, lint and build.
|
|
80
|
+
|
|
81
|
+
## If the model is wrong
|
|
82
|
+
|
|
83
|
+
If moving the code shows the architect's change cannot work (a cycle,
|
|
84
|
+
a missing port, a hidden caller), STOP. Explain what you found with the
|
|
85
|
+
file evidence, and propose the fix with `/archik:suggest` — don't bend
|
|
86
|
+
the code around the model, and don't change the model silently.
|
|
87
|
+
|
|
88
|
+
## Done when
|
|
89
|
+
|
|
90
|
+
`npx archik gap` prints "the code matches the model", tests pass, and
|
|
91
|
+
the finished nodes are `active`. End with one line on what changed and
|
|
92
|
+
the next step.
|
package/commands/spawn.md
CHANGED
|
@@ -223,6 +223,13 @@ archik suggest set` stages it.
|
|
|
223
223
|
- "Looks wrong? Run `/archik:reject` and we'll iterate. Or run
|
|
224
224
|
`/archik:evolve` after accepting if you want a cleaner
|
|
225
225
|
bounded-context version."
|
|
226
|
+
- Offer an **architecture style** next: name the style the code is
|
|
227
|
+
closest to (`npx archik style list` — e.g. `controllers/`,
|
|
228
|
+
`services/`, `repositories/` folders → layered; `ports/` +
|
|
229
|
+
`adapters/` → hexagonal; one folder per feature → feature
|
|
230
|
+
slices) and offer to stage it with layers on the top-level
|
|
231
|
+
nodes. Spawn itself stays descriptive — don't add the style in
|
|
232
|
+
the spawn draft.
|
|
226
233
|
|
|
227
234
|
**Offer a smells check at the end of this step** (not after
|
|
228
235
|
accept — you won't be there). Run it now so the offer is concrete:
|
package/commands/suggest.md
CHANGED
|
@@ -66,11 +66,21 @@ start Build phase here; that's gated on accept.
|
|
|
66
66
|
2. **Ground yourself in the current models** using the query CLI
|
|
67
67
|
(do not `cat` the YAML):
|
|
68
68
|
```
|
|
69
|
+
npx archik style
|
|
69
70
|
npx archik q stats
|
|
70
71
|
npx archik q list
|
|
71
72
|
```
|
|
72
73
|
If `$ARGUMENTS` mentions a specific node by name, also run
|
|
73
|
-
`npx archik q describe <id>` for it
|
|
74
|
+
`npx archik q describe <id>` for it (its `style:` line says which
|
|
75
|
+
layer or module it sits in and what it may depend on).
|
|
76
|
+
|
|
77
|
+
If the model declares a style, the draft must follow it: give each
|
|
78
|
+
new top-level node its `layer` (layered, hexagonal, clean) or put
|
|
79
|
+
it in the right module (modular monolith, feature slices), and keep
|
|
80
|
+
every new edge inside the style's rule. `suggest set` rejects a
|
|
81
|
+
draft that breaks it. If the feature truly needs a forbidden
|
|
82
|
+
dependency, stop and ask the user — the fix is usually a port /
|
|
83
|
+
interface, not an exception.
|
|
74
84
|
|
|
75
85
|
3. **Lock in the schema.** Run this before drafting any YAML —
|
|
76
86
|
the prose in this file describes the workflow, not the field
|