archik 0.6.21 → 0.7.1
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/commands/archik/accept.md +21 -0
- package/.claude/commands/archik/describe.md +28 -0
- package/.claude/commands/archik/dev.md +24 -0
- package/.claude/commands/archik/evolve.md +127 -0
- package/.claude/commands/archik/reject.md +16 -0
- package/.claude/commands/archik/spawn.md +144 -0
- package/.claude/commands/archik/suggest.md +73 -0
- package/.claude/skills/archik/SKILL.md +210 -104
- package/README.md +71 -18
- package/dist/cli/archik.mjs +328 -274
- package/dist/ui/assets/index-s04yHjLy.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +2 -1
- package/dist/ui/assets/index--WU38v9Y.css +0 -1
- /package/dist/ui/assets/{index-8KJeg2t9.js → index-DnHchl8n.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: archik
|
|
3
|
-
description: Use whenever .archik/main.archik.yaml or architecture.archik.yaml exists in the project, or the user asks about the system's architecture, services, dependencies, or data flow. The YAML is the shared map
|
|
3
|
+
description: Use whenever .archik/main.archik.yaml or architecture.archik.yaml exists in the project, or the user asks about the system's architecture, services, dependencies, or data flow. The YAML is the shared map between the user and Claude. Interact with it ONLY through the `npx archik` CLI — `q` for queries, `suggest set` for proposals, `validate` after every change. Never read, write, or edit archik files manually.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Archik — the project's shared map
|
|
@@ -20,29 +20,86 @@ The file lives in one of two places, in this order of preference:
|
|
|
20
20
|
2. `architecture.archik.yaml` — the legacy root location, still
|
|
21
21
|
fully supported.
|
|
22
22
|
|
|
23
|
-
Run `archik validate` (or check both paths) to find which one the
|
|
23
|
+
Run `npx archik validate` (or check both paths) to find which one the
|
|
24
24
|
project uses. Don't assume — small differences here matter.
|
|
25
25
|
|
|
26
26
|
Treat the file as a shared vocabulary. It exists so the user and
|
|
27
27
|
you can talk about the system without re-explaining it every time.
|
|
28
28
|
|
|
29
|
+
## Hard rule: the CLI is the only interface to archik files
|
|
30
|
+
|
|
31
|
+
You MUST NOT use `Read`, `Write`, `Edit`, or any other file-touching
|
|
32
|
+
tool against `.archik/main.archik.yaml`, `architecture.archik.yaml`,
|
|
33
|
+
any `*.archik.yaml` sub-file, or any sidecar. The `npx archik` CLI is
|
|
34
|
+
the contract — it owns reads, writes, validation, and lifecycle.
|
|
35
|
+
|
|
36
|
+
| Need | Use |
|
|
37
|
+
| ----------------------------- | ----------------------------------------- |
|
|
38
|
+
| Inspect structure | `npx archik q ...` |
|
|
39
|
+
| Validate | `npx archik validate <path>` |
|
|
40
|
+
| Propose a change | `npx archik suggest set <draft>` |
|
|
41
|
+
| Apply / discard a suggestion | `npx archik suggest accept | reject` |
|
|
42
|
+
| Render or diff | `npx archik render` / `npx archik diff` |
|
|
43
|
+
|
|
44
|
+
`.archik/main.archik.yaml` is the user's source of truth — only
|
|
45
|
+
`npx archik suggest accept` is allowed to mutate it. The sidecar
|
|
46
|
+
`.archik/main.archik.suggested.yaml` is owned by the CLI too — only
|
|
47
|
+
`npx archik suggest set` (writes it) and `accept` / `reject`
|
|
48
|
+
(consumes it) may touch it.
|
|
49
|
+
|
|
50
|
+
If `npx archik` is unreachable (offline, sandboxed, missing), STOP
|
|
51
|
+
and tell the user. Do NOT fall back to reading or editing YAML by
|
|
52
|
+
hand — that breaks the contract and silently desyncs the canvas.
|
|
53
|
+
|
|
54
|
+
The user-facing slash commands are thin shims over this same CLI:
|
|
55
|
+
|
|
56
|
+
| Command | Purpose |
|
|
57
|
+
| ---------------------- | --------------------------------------------- |
|
|
58
|
+
| `/archik:spawn` | Bootstrap a diagram from the source tree |
|
|
59
|
+
| `/archik:evolve` | Propose a cleaner bounded-context refactor |
|
|
60
|
+
| `/archik:suggest <…>` | Propose changes from a feature description |
|
|
61
|
+
| `/archik:describe <id>`| Explain a node and its connections |
|
|
62
|
+
| `/archik:accept` | Apply the pending suggestion |
|
|
63
|
+
| `/archik:reject` | Discard the pending suggestion |
|
|
64
|
+
| `/archik:dev` | Start the live canvas |
|
|
65
|
+
|
|
66
|
+
When a user types `/archik:suggest <description>`, `/archik:spawn`,
|
|
67
|
+
or `/archik:evolve`, treat it as direct authorisation to run the
|
|
68
|
+
sidecar workflow now — skip the "want me to update the YAML?"
|
|
69
|
+
question. Each command's body file under `.claude/commands/archik/`
|
|
70
|
+
has the detailed protocol for that specific verb; follow it.
|
|
71
|
+
|
|
72
|
+
Three things separate the proposal commands:
|
|
73
|
+
|
|
74
|
+
- **`spawn`** is *descriptive* — mirror the source tree as it is.
|
|
75
|
+
- **`evolve`** is *prescriptive* — propose a cleaner shape, then
|
|
76
|
+
wait for the user to discuss before they accept. Never
|
|
77
|
+
auto-accepts.
|
|
78
|
+
- **`suggest`** is *targeted* — apply one feature-sized change
|
|
79
|
+
from a user description.
|
|
80
|
+
|
|
29
81
|
## Protocol
|
|
30
82
|
|
|
31
83
|
1. **Before** answering structural questions — *"what does X do?",
|
|
32
|
-
"what depends on Y?", "where does data flow when …?"* —
|
|
33
|
-
the archik
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
84
|
+
"what depends on Y?", "where does data flow when …?"* — query
|
|
85
|
+
the diagram with `npx archik q ...` (see CLI section). The CLI
|
|
86
|
+
walks the root file plus every `.archik/*.archik.yaml` sub-file
|
|
87
|
+
and returns focused, deterministic answers. Don't guess from
|
|
88
|
+
filenames or memory, and don't read the YAML directly — see the
|
|
89
|
+
hard rule above.
|
|
90
|
+
2. **When** work introduces, removes, or rewires components, author
|
|
91
|
+
the proposed end-state in a workspace temp file (e.g.
|
|
92
|
+
`/tmp/archik-draft-<id>.yaml`) and stage it as the sidecar with
|
|
93
|
+
`npx archik suggest set <tmp> --note "<one-liner>"`. Do NOT
|
|
94
|
+
write `.archik/main.archik.suggested.yaml` directly — the CLI is
|
|
95
|
+
the only thing allowed to put files in `.archik/`. The user
|
|
96
|
+
reviews and accepts in the canvas or via
|
|
97
|
+
`npx archik suggest accept`.
|
|
98
|
+
3. **After** every `suggest set`, the CLI has already validated for
|
|
99
|
+
you — schema, cross-file existence, the lot. If it exits non-zero,
|
|
100
|
+
fix the temp draft and re-run; never patch the sidecar directly.
|
|
101
|
+
For files outside `.archik/` (none, in a normal flow), use
|
|
102
|
+
`npx archik validate <path>`.
|
|
46
103
|
|
|
47
104
|
The sections below are the detailed reference behind these three
|
|
48
105
|
rules — *when* to consult, *when* to propose, schema, taxonomy,
|
|
@@ -55,16 +112,21 @@ The archik file tells you *what* exists. The source tree tells you
|
|
|
55
112
|
the file is valuable — without it you just know there's "an Orders
|
|
56
113
|
service" but not where to go to read or edit it. So:
|
|
57
114
|
|
|
58
|
-
1. **
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
115
|
+
1. **Pull the diagram shape from the CLI.** Don't `cat` the YAML —
|
|
116
|
+
use the query CLI:
|
|
117
|
+
```
|
|
118
|
+
npx archik q stats # files, node and edge counts, kind histogram
|
|
119
|
+
npx archik q list # every node, with kind and parent
|
|
120
|
+
npx archik q edges # every edge, with relationship and endpoints
|
|
121
|
+
```
|
|
122
|
+
That gives you the same picture as reading the file, without
|
|
123
|
+
touching it.
|
|
62
124
|
2. **List the source tree.** A single `ls` of the top-level project
|
|
63
125
|
directory plus the most likely source roots is usually enough:
|
|
64
|
-
`ls -F . src/ services/ packages/ apps/ 2>/dev/null`.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
126
|
+
`ls -F . src/ services/ packages/ apps/ 2>/dev/null`. (`ls
|
|
127
|
+
.archik/` is fine for *finding out which sub-architectures
|
|
128
|
+
exist*; don't open the YAMLs themselves — query them via
|
|
129
|
+
`npx archik q list --file <name>`.)
|
|
68
130
|
3. **Build the mapping in your head.** Most projects follow one of
|
|
69
131
|
two patterns: each top-level archik node id matches a folder
|
|
70
132
|
under `src/` (or `services/` / `packages/`), or the `stack` /
|
|
@@ -81,74 +143,63 @@ service" but not where to go to read or edit it. So:
|
|
|
81
143
|
When the user asks "where would I add X?" or "what's the right
|
|
82
144
|
place for Y?", you should already have the answer because step 3
|
|
83
145
|
gave it to you. When they ask "what would `archik render` show?",
|
|
84
|
-
|
|
146
|
+
run `npx archik render --out /tmp/preview.svg` and describe it.
|
|
85
147
|
|
|
86
148
|
## Suggesting changes (the sidecar workflow)
|
|
87
149
|
|
|
88
|
-
The archik file is the user's source of truth. You don't
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
150
|
+
The archik file is the user's source of truth. You don't mutate it
|
|
151
|
+
directly, and you don't write the sidecar directly either — both are
|
|
152
|
+
under `.archik/` and only the CLI is allowed to touch that
|
|
153
|
+
directory (see the hard rule).
|
|
92
154
|
|
|
93
|
-
|
|
94
|
-
# new convention
|
|
95
|
-
.archik/main.archik.yaml ← truth — user owns it
|
|
96
|
-
.archik/main.archik.suggested.yaml ← your draft proposal
|
|
155
|
+
The flow is always the same:
|
|
97
156
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
157
|
+
1. Author the *full proposed end-state* document in a workspace temp
|
|
158
|
+
file outside `.archik/`. Pick a path like
|
|
159
|
+
`/tmp/archik-draft-<short-id>.yaml`.
|
|
160
|
+
2. Run `npx archik suggest set <tmp> --note "<one-liner>"`. The CLI
|
|
161
|
+
parses, schema-validates, checks cross-file references, stamps
|
|
162
|
+
`metadata.suggestion`, and atomically renames the draft into
|
|
163
|
+
place as `.archik/main.archik.suggested.yaml` (or the legacy
|
|
164
|
+
`architecture.archik.suggested.yaml`).
|
|
165
|
+
3. If `set` exits non-zero, fix the temp file based on the reported
|
|
166
|
+
errors and re-run. Never patch the sidecar with `Edit`/`Write`.
|
|
102
167
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
proposal:
|
|
168
|
+
A minimal draft looks exactly like a normal archik document — the
|
|
169
|
+
CLI fills in the suggestion marker for you, so you don't have to:
|
|
106
170
|
|
|
107
171
|
```yaml
|
|
108
172
|
version: "1.0"
|
|
109
173
|
name: My Architecture
|
|
110
|
-
metadata:
|
|
111
|
-
suggestion:
|
|
112
|
-
from: .archik/main.archik.yaml
|
|
113
|
-
at: 2026-04-26T17:00:00Z
|
|
114
|
-
note: add Stripe payment flow # optional one-liner
|
|
115
174
|
nodes:
|
|
116
175
|
# ... entire proposed end-state, not just the delta
|
|
117
176
|
edges:
|
|
118
177
|
# ...
|
|
119
178
|
```
|
|
120
179
|
|
|
121
|
-
Once
|
|
180
|
+
Once `suggest set` has succeeded:
|
|
122
181
|
|
|
123
182
|
* The canvas shows a **📝 Suggestion pending** banner with `Review`,
|
|
124
183
|
`Accept`, `Reject` buttons. Review **toggles an in-canvas overlay
|
|
125
184
|
on the same page** — added nodes/edges get green frames, removed
|
|
126
185
|
ones get red dashed frames and dim out, changed ones get amber
|
|
127
|
-
frames, and each gets a `+` / `−` / `~` badge.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
file; Reject deletes the sidecar. Both also clear review mode so
|
|
131
|
-
the canvas snaps back to the new truth.
|
|
132
|
-
* From the terminal: `archik suggest show | accept | reject`.
|
|
186
|
+
frames, and each gets a `+` / `−` / `~` badge. Accept renames the
|
|
187
|
+
sidecar over the main file; Reject deletes the sidecar.
|
|
188
|
+
* From the terminal: `npx archik suggest show | accept | reject`.
|
|
133
189
|
|
|
134
190
|
If the user has no canvas open and asks "apply it", run
|
|
135
|
-
`archik suggest accept` for them (only after they've explicitly
|
|
191
|
+
`npx archik suggest accept` for them (only after they've explicitly
|
|
136
192
|
asked).
|
|
137
193
|
|
|
138
194
|
**Key rules:**
|
|
139
195
|
|
|
140
196
|
* Write the *full proposed document*, not a patch. The diff is
|
|
141
197
|
computed by archik between the main file and the sidecar.
|
|
142
|
-
*
|
|
143
|
-
`.archik
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
`toFile` resolved against the project root). Silent failures are
|
|
148
|
-
not OK — re-edit and re-run until it passes.
|
|
149
|
-
* If a suggestion sidecar already exists, treat it as your previous
|
|
150
|
-
proposal — extend or replace it. Don't write a new sidecar with a
|
|
151
|
-
different name.
|
|
198
|
+
* Don't call `Write`/`Edit` against `.archik/main.archik.suggested.yaml`
|
|
199
|
+
or any peer file under `.archik/`. The CLI owns that directory.
|
|
200
|
+
* If a suggestion sidecar already exists, `npx archik suggest set`
|
|
201
|
+
overwrites it. Tell the user you're replacing their previous
|
|
202
|
+
pending suggestion.
|
|
152
203
|
|
|
153
204
|
## When to consult the YAML
|
|
154
205
|
|
|
@@ -189,7 +240,7 @@ The YAML tracks **shape**, not implementation detail.
|
|
|
189
240
|
|
|
190
241
|
## Hard rules for editing
|
|
191
242
|
|
|
192
|
-
The schema enforces these — `archik validate` will reject the file
|
|
243
|
+
The schema enforces these — `npx archik validate` will reject the file
|
|
193
244
|
if you break any of them, so don't bother trying.
|
|
194
245
|
|
|
195
246
|
- **Never put coordinates** (`x`, `y`, `width`, `height`, `viewport`) in
|
|
@@ -274,7 +325,7 @@ Constraints (the schema enforces them):
|
|
|
274
325
|
forward slashes, no `..`, ends in `.archik.yaml`).
|
|
275
326
|
- The path is resolved against the **project root** (parent of
|
|
276
327
|
`.archik/` under the new layout, the doc's own directory under the
|
|
277
|
-
legacy one) — same rule as `archikFile`. `archik validate` exits
|
|
328
|
+
legacy one) — same rule as `archikFile`. `npx archik validate` exits
|
|
278
329
|
1 if the file isn't on disk.
|
|
279
330
|
- The *local* endpoint id must still match a node in this file.
|
|
280
331
|
- An edge with **both** `fromFile` and `toFile` is rejected — author
|
|
@@ -297,7 +348,7 @@ Constraints (the schema enforces them):
|
|
|
297
348
|
- **Resolved against the project root**, not the file's own
|
|
298
349
|
directory. With the new layout the project root is the parent of
|
|
299
350
|
`.archik/`, so a sibling sub-file is `.archik/orders.archik.yaml`
|
|
300
|
-
(with the prefix), NOT `orders.archik.yaml`. `archik validate`
|
|
351
|
+
(with the prefix), NOT `orders.archik.yaml`. `npx archik validate`
|
|
301
352
|
exits 1 if the target file isn't on disk — catch it there instead
|
|
302
353
|
of as a 404 in the canvas.
|
|
303
354
|
- Cycles aren't checked at parse time (each file validates on its
|
|
@@ -601,51 +652,106 @@ edges:
|
|
|
601
652
|
|
|
602
653
|
## CLI
|
|
603
654
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
655
|
+
The CLI is the agent-friendly bridge to archik. Prefer it over
|
|
656
|
+
re-reading the YAML when answering structural questions — the answers
|
|
657
|
+
are deterministic, focused, and don't pollute your context with the
|
|
658
|
+
whole diagram.
|
|
659
|
+
|
|
660
|
+
### Running the CLI
|
|
661
|
+
|
|
662
|
+
The CLI ships as the `archik` npm package. Two equivalent ways to
|
|
663
|
+
invoke any command:
|
|
609
664
|
|
|
610
665
|
```
|
|
611
|
-
archik
|
|
612
|
-
archik
|
|
613
|
-
archik render --out diagram.svg # headless layout → SVG
|
|
614
|
-
archik render --theme light --out diagram-light.svg
|
|
615
|
-
archik diff a.yaml b.yaml # text + colour-coded SVG diff
|
|
616
|
-
archik diff a.yaml b.yaml --out diff.svg
|
|
617
|
-
archik suggest show # summary of pending sidecar (default)
|
|
618
|
-
archik suggest accept # apply the sidecar over the main file
|
|
619
|
-
archik suggest reject # discard the sidecar
|
|
620
|
-
archik watch # re-render SVG on save
|
|
621
|
-
archik dev # open the live editor in the browser (foreground)
|
|
622
|
-
archik start # same as dev, detached — returns the prompt
|
|
623
|
-
archik stop # stop the background server
|
|
624
|
-
archik status # list running archik instances
|
|
625
|
-
archik init # scaffold a starter file (also installs this skill into ./.claude/skills/archik/ unless --no-skill)
|
|
626
|
-
archik skill # install/refresh this skill in cwd
|
|
666
|
+
npx archik <command> # works without installing — caches after first use
|
|
667
|
+
archik <command> # if the user has run `npm i -g archik`
|
|
627
668
|
```
|
|
628
669
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
670
|
+
**Default to `npx archik` in your suggestions and shell calls.** It
|
|
671
|
+
just works in fresh repos, doesn't require a global install, and
|
|
672
|
+
falls through to the cached binary on subsequent runs. Suggest
|
|
673
|
+
`npm i -g archik` only when the user wants the live canvas
|
|
674
|
+
(`archik dev`) on a fast keystroke.
|
|
675
|
+
|
|
676
|
+
If neither form is reachable (offline, sandboxed shell), fall back to
|
|
677
|
+
reading the YAML directly with the same schema documented above —
|
|
678
|
+
the file is always the source of truth.
|
|
679
|
+
|
|
680
|
+
### Without a positional path
|
|
681
|
+
|
|
682
|
+
Every read command resolves the archik file in this order:
|
|
683
|
+
`.archik/main.archik.yaml` (preferred), then
|
|
684
|
+
`architecture.archik.yaml` (legacy). If both exist the command errors
|
|
685
|
+
and asks the user to pick one.
|
|
686
|
+
|
|
687
|
+
### Querying the diagram (use this for structural questions)
|
|
688
|
+
|
|
689
|
+
```
|
|
690
|
+
npx archik q describe <id> # node + its incoming/outgoing edges
|
|
691
|
+
npx archik q deps <id> # outgoing edges (what this node uses)
|
|
692
|
+
npx archik q dependents <id> # incoming edges (what uses this node)
|
|
693
|
+
npx archik q list # all nodes
|
|
694
|
+
--kind <k> # filter by kind (service, function, …)
|
|
695
|
+
--parent <id> # filter by container
|
|
696
|
+
--file <p> # filter by file (substring match)
|
|
697
|
+
npx archik q edges # all edges
|
|
698
|
+
--from <id> # filter by source
|
|
699
|
+
--to <id> # filter by target
|
|
700
|
+
--rel <name> # filter by relationship
|
|
701
|
+
npx archik q impact <id> # what would break if this node were removed
|
|
702
|
+
npx archik q stats # files, nodes, edges, kind histogram
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
Add `--json` to any `q` subcommand for a stable machine-readable
|
|
706
|
+
shape (object on stdout). Exit codes: `0` found, `1` empty / unknown
|
|
707
|
+
id, `2` could not load. Walks the root file plus every
|
|
708
|
+
`.archik/*.archik.yaml` sub-file. Cross-file id collisions error
|
|
709
|
+
rather than silently picking — surface the ambiguity.
|
|
710
|
+
|
|
711
|
+
### Authoring & lifecycle
|
|
712
|
+
|
|
713
|
+
```
|
|
714
|
+
npx archik validate # schema + cross-file existence (CI-friendly, exit 1 on error)
|
|
715
|
+
npx archik validate --json # structured { ok, file, nodes, edges, errors }
|
|
716
|
+
npx archik render --out diagram.svg
|
|
717
|
+
--theme light # "dark" (default) or "light"
|
|
718
|
+
npx archik diff a.yaml b.yaml # text summary
|
|
719
|
+
npx archik diff a.yaml b.yaml --out diff.svg
|
|
720
|
+
npx archik diff a.yaml b.yaml --json
|
|
721
|
+
npx archik suggest show # summary of pending sidecar (default)
|
|
722
|
+
--json # structured output
|
|
723
|
+
npx archik suggest set <draft> # validate a draft YAML and stage it as the sidecar
|
|
724
|
+
--note '<text>' # set metadata.suggestion.note
|
|
725
|
+
--main <path> # override main file detection
|
|
726
|
+
--json # structured output
|
|
727
|
+
- # draft path "-" reads from stdin
|
|
728
|
+
npx archik suggest accept # apply the sidecar over the main file
|
|
729
|
+
npx archik suggest reject # discard the sidecar
|
|
730
|
+
npx archik watch # re-render SVG on save
|
|
731
|
+
npx archik dev # open the live editor in the browser
|
|
732
|
+
npx archik start | stop | status # detached canvas server lifecycle
|
|
733
|
+
npx archik init # scaffold a starter file + install skill + slash commands
|
|
734
|
+
npx archik skill # install/refresh the Claude skill in cwd
|
|
735
|
+
npx archik commands # install/refresh the /archik:* slash commands in cwd
|
|
736
|
+
```
|
|
632
737
|
|
|
633
738
|
## Verification workflow
|
|
634
739
|
|
|
635
|
-
After **every**
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
1.
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
3. If the project commits a rendered SVG (e.g.
|
|
647
|
-
regenerate it with `archik render
|
|
648
|
-
the committed picture matches the
|
|
740
|
+
After **every** `npx archik suggest set` or `npx archik suggest
|
|
741
|
+
accept`:
|
|
742
|
+
|
|
743
|
+
1. The CLI has already validated the schema and cross-file references
|
|
744
|
+
for you — `set` refuses to write a broken sidecar, `accept` runs
|
|
745
|
+
over a sidecar that was validated when it was staged. If `set`
|
|
746
|
+
reported errors, fix them in the temp draft and re-run; never
|
|
747
|
+
reach for `Write`/`Edit` on the sidecar.
|
|
748
|
+
2. If the project has an `archik dev` server running, the file
|
|
749
|
+
watcher broadcasts the change to the canvas automatically — no
|
|
750
|
+
restart needed. Surface the URL so the user can click through.
|
|
751
|
+
3. If the project commits a rendered SVG (e.g.
|
|
752
|
+
`docs/architecture.svg`), regenerate it with `npx archik render
|
|
753
|
+
--out docs/architecture.svg` so the committed picture matches the
|
|
754
|
+
YAML.
|
|
649
755
|
|
|
650
756
|
## Things to avoid
|
|
651
757
|
|
package/README.md
CHANGED
|
@@ -26,10 +26,11 @@ queues, agents, LLMs, the edges between them. Plain YAML, schema-
|
|
|
26
26
|
validated, no coordinates, no proprietary format.
|
|
27
27
|
|
|
28
28
|
Open it in your browser for a live canvas. Render it in CI for a
|
|
29
|
-
self-contained SVG.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
self-contained SVG. The [Claude Code skill and `/archik:*` slash
|
|
30
|
+
commands](#for-claude-code--other-llms) install automatically with
|
|
31
|
+
`archik init`, so the model edits the same file you do — *the
|
|
32
|
+
diagram and the codebase stop drifting because Claude treats the
|
|
33
|
+
diagram as the spec*.
|
|
33
34
|
|
|
34
35
|
If you've ever asked an AI agent "where would I add X?" and watched
|
|
35
36
|
it guess from filenames, archik is the fix: the YAML answers the
|
|
@@ -38,13 +39,25 @@ work.
|
|
|
38
39
|
|
|
39
40
|
## Quickstart
|
|
40
41
|
|
|
42
|
+
Two terminal commands, then talk to Claude:
|
|
43
|
+
|
|
41
44
|
```bash
|
|
42
|
-
npx archik init #
|
|
43
|
-
|
|
44
|
-
npx archik
|
|
45
|
+
npx archik@latest init # scaffolds .archik/main.archik.yaml +
|
|
46
|
+
# installs the Claude skill + /archik:* slash commands
|
|
47
|
+
npx archik@latest start # opens the live canvas at http://localhost:5173
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Then in Claude Code, type:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
/archik:spawn # mirror your real source tree as the first diagram
|
|
54
|
+
/archik:evolve # propose a cleaner bounded-context refactor
|
|
55
|
+
/archik:suggest <feature> # propose changes for a specific feature
|
|
45
56
|
```
|
|
46
57
|
|
|
47
|
-
|
|
58
|
+
Each `/archik:*` command stages a suggestion sidecar — **Review** in the canvas, then **Accept** or **Reject**. No manual YAML editing on either side: you click in the browser, Claude drives through the CLI.
|
|
59
|
+
|
|
60
|
+
Done with the canvas? `npx archik stop`.
|
|
48
61
|
|
|
49
62
|
<p align="center">
|
|
50
63
|
<video src="https://github.com/bacharSalleh/archik/raw/main/docs/record.mp4" poster="https://cdn.jsdelivr.net/gh/bacharSalleh/archik@main/docs/archik.gif" width="780" controls muted autoplay loop playsinline>
|
|
@@ -90,30 +103,57 @@ No `x` / `y` / `width` — layout is computed by [ELK](https://eclipse.dev/elk/)
|
|
|
90
103
|
- **12 relationships** with distinct visual styling — `http_call`, `invokes`, `reads`, `writes`, `publishes`, `subscribes`, `streams_to`, `routes_to`, `implements`, `depends_on`, `has_a`, `uses`.
|
|
91
104
|
- **Drag-to-connect, multi-select, undo/redo, compact view, themed (dark / light), notes per node, color overrides on edges.**
|
|
92
105
|
- **CI-ready CLI** — `validate`, `render` (headless SVG), `watch`, `check` (drift between YAML and source dirs).
|
|
93
|
-
- **AI skill** — `archik
|
|
106
|
+
- **AI skill + slash commands** — `archik init` installs both automatically. Seven `/archik:*` commands (`spawn`, `evolve`, `suggest`, `describe`, `dev`, `accept`, `reject`) drive the diagram entirely through the CLI, so Claude never edits YAML by hand.
|
|
94
107
|
|
|
95
108
|
## For Claude Code & other LLMs
|
|
96
109
|
|
|
97
|
-
The whole reason
|
|
110
|
+
The whole reason archik uses YAML instead of a binary format: **the file is the shared map between you and the model**. `npx archik@latest init` drops both the Claude skill and the seven slash commands into your project — no separate setup.
|
|
111
|
+
|
|
112
|
+
The skill enforces a hard rule: **Claude talks to archik only through the `npx archik` CLI** — never `Read`, `Write`, or `Edit` on a YAML directly. Queries go through `npx archik q`, suggestions through `npx archik suggest set`, lifecycle through `npx archik suggest accept | reject`. You own the file; the CLI is the contract.
|
|
113
|
+
|
|
114
|
+
### The seven slash commands
|
|
115
|
+
|
|
116
|
+
| Command | What it does |
|
|
117
|
+
| --------------------------- | ----------------------------------------------------------- |
|
|
118
|
+
| `/archik:spawn` | Bootstrap a diagram by mirroring your real source tree |
|
|
119
|
+
| `/archik:evolve` | Propose a cleaner bounded-context refactor |
|
|
120
|
+
| `/archik:suggest <feature>` | Propose changes for a specific feature |
|
|
121
|
+
| `/archik:describe <id>` | Explain a node and its connections |
|
|
122
|
+
| `/archik:dev` | Open the live canvas |
|
|
123
|
+
| `/archik:accept` | Apply the pending suggestion |
|
|
124
|
+
| `/archik:reject` | Discard the pending suggestion |
|
|
125
|
+
|
|
126
|
+
A typical first-day flow:
|
|
98
127
|
|
|
99
|
-
```bash
|
|
100
|
-
archik skill --user # install once into ~/.claude/skills
|
|
101
128
|
```
|
|
129
|
+
/archik:spawn # mirror what's there now
|
|
130
|
+
# → review on the canvas, accept
|
|
131
|
+
/archik:evolve # propose a cleaner shape
|
|
132
|
+
# → discuss with Claude, accept (or iterate)
|
|
133
|
+
/archik:suggest add Stripe webhook handler
|
|
134
|
+
# → small, targeted change
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Each command stages a sidecar via `npx archik suggest set`. The canvas shows a green/red/amber diff overlay; you click Accept or Reject — or `/archik:accept` / `/archik:reject` from the terminal. Same outcome either way.
|
|
102
138
|
|
|
103
|
-
|
|
139
|
+
### Manual install (existing projects without `archik init`)
|
|
104
140
|
|
|
105
|
-
|
|
106
|
-
2. **Propose** YAML updates whenever new work introduces or rewires components.
|
|
107
|
-
3. **Run `archik validate`** after every edit to fail fast on schema errors.
|
|
141
|
+
If you already have an archik file and just want to add the Claude integration:
|
|
108
142
|
|
|
109
|
-
|
|
143
|
+
```bash
|
|
144
|
+
npx archik@latest skill --user # install skill into ~/.claude/skills (all projects)
|
|
145
|
+
npx archik@latest commands --user # install /archik:* into ~/.claude/commands (all projects)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Drop the `--user` flag to scope to the current project only.
|
|
110
149
|
|
|
111
150
|
## Commands
|
|
112
151
|
|
|
113
152
|
```
|
|
114
153
|
archik init [path] Scaffold a starter .archik/main.archik.yaml
|
|
115
|
-
(also installs the Claude skill by default)
|
|
154
|
+
(also installs the Claude skill + /archik:* slash commands by default)
|
|
116
155
|
--no-skill skip installing the Claude skill
|
|
156
|
+
--no-commands skip installing the /archik:* slash commands
|
|
117
157
|
|
|
118
158
|
archik dev [path] Open the canvas in your browser (foreground, Ctrl+C to stop)
|
|
119
159
|
archik start [path] Same as dev, but detached — prompt returns immediately
|
|
@@ -130,9 +170,22 @@ archik render [path] Render to a self-contained SVG file
|
|
|
130
170
|
--theme <name> "dark" (default) or "light"
|
|
131
171
|
archik watch [path] Re-render to SVG on every file change (Ctrl+C to stop)
|
|
132
172
|
|
|
173
|
+
archik suggest [sub] Manage Claude's pending architecture suggestion
|
|
174
|
+
show summarise the pending sidecar (default; --json supported)
|
|
175
|
+
set <draft> validate a draft YAML and stage it as the sidecar
|
|
176
|
+
--note '<text>' set metadata.suggestion.note
|
|
177
|
+
--main <path> override main file detection
|
|
178
|
+
--json structured output
|
|
179
|
+
- read draft from stdin
|
|
180
|
+
accept apply the sidecar over the main file
|
|
181
|
+
reject discard the sidecar
|
|
182
|
+
|
|
133
183
|
archik skill Install the Claude skill for AI editing
|
|
134
184
|
--user install into ~/.claude/skills (all projects)
|
|
135
185
|
--force overwrite an existing skill
|
|
186
|
+
archik commands Install the /archik:* slash commands for Claude Code
|
|
187
|
+
--user install into ~/.claude/commands (all projects)
|
|
188
|
+
--force overwrite existing commands
|
|
136
189
|
```
|
|
137
190
|
|
|
138
191
|
Without a `[path]` argument, archik resolves the file in this order:
|