archik 0.19.4 → 0.20.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 +23 -28
- package/commands/accept.md +7 -47
- package/commands/bootstrap.md +25 -28
- package/commands/evolve.md +12 -50
- package/commands/migrate.md +35 -59
- package/commands/self-evolving.md +6 -6
- package/commands/spawn.md +10 -37
- package/commands/suggest.md +0 -42
- package/dist/cli/archik.mjs +453 -585
- package/dist/ui/assets/index-Bn3qR7Cx.js +223 -0
- package/dist/ui/assets/index-DUgLHSFs.css +1 -0
- package/dist/ui/index.html +2 -2
- package/docs/templates/CLAUDE.md +55 -148
- 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 +19 -304
- 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-DIOFE2Wo.js +0 -226
package/skills/archik/SKILL.md
CHANGED
|
@@ -10,7 +10,7 @@ description: Use whenever .archik/main.archik.yaml or architecture.archik.yaml e
|
|
|
10
10
|
- **The YAML is the source of truth.** `.archik/main.archik.yaml` (and any `*.archik.yaml` sub-files) describe the system the user is building. The browser canvas is just a stateless projection of that file.
|
|
11
11
|
- **The CLI is your only interface to it.** You never read, write, or edit archik files directly. Every read goes through `npx archik q ...`; every write goes through `npx archik suggest set` → user accepts via `/archik:accept`.
|
|
12
12
|
- **Two command surfaces:** the user types `/archik:*` slash commands; you run `npx archik ...` directly. They're not interchangeable — see the tables below.
|
|
13
|
-
- **
|
|
13
|
+
- **One change to ship, not the whole system.** When a user hands you a brief on a fresh project, never say "let me sketch your whole system." Propose the smallest structure that delivers the first piece of value. New code-bearing nodes start `status: proposed` (the code doesn't exist on disk yet) and flip to `status: active` when the code lands in BUILD. The project's commitments live in the YAML, not in the chat log.
|
|
14
14
|
- **Read the learned overlay at session start.** If `.archik/evolution/learned.md` exists, read it (with the Read tool — it is docs, not an archik YAML) before your first archik action and treat every note as binding guidance. Each note is a lesson this project's evolution loop gathered from real usage and a human approved. After a suggestion of yours is rejected, run `npx archik evolution reflect` — repeated rejections become proposals the user can review.
|
|
15
15
|
|
|
16
16
|
## Command surfaces
|
|
@@ -21,7 +21,7 @@ These are the user's entry points. They're triggered by the user typing `/archik
|
|
|
21
21
|
|
|
22
22
|
| Slash command | What the user is asking for |
|
|
23
23
|
| --------------------------------- | ----------------------------------------------------------------- |
|
|
24
|
-
| `/archik:bootstrap` | **Start here on a new project.** Detect state (fresh / has-code / already-modelled) and route to the right next action — ask for a brief, suggest `/archik:spawn`, or surface
|
|
24
|
+
| `/archik:bootstrap` | **Start here on a new project.** Detect state (fresh / has-code / already-modelled) and route to the right next action — ask for a brief, suggest `/archik:spawn`, or surface drift and smells. |
|
|
25
25
|
| `/archik:spawn` | Mirror the source tree as a first-pass diagram (descriptive) |
|
|
26
26
|
| `/archik:evolve` | Propose a cleaner bounded-context refactor (prescriptive) |
|
|
27
27
|
| `/archik:suggest <…>` | Apply one feature-sized change from a description (targeted) |
|
|
@@ -29,10 +29,6 @@ These are the user's entry points. They're triggered by the user typing `/archik
|
|
|
29
29
|
| `/archik:dev` | Open the live canvas |
|
|
30
30
|
| `/archik:accept` | Apply the pending sidecar suggestion |
|
|
31
31
|
| `/archik:reject` | Discard the pending sidecar suggestion |
|
|
32
|
-
| `/archik:actor <id>` | Add or update an actor in the actor index (direct-write) |
|
|
33
|
-
| `/archik:usecase <name>` | Author a use case — flows + slices + tests (direct-write) |
|
|
34
|
-
| `/archik:trace` | Coverage matrix + concrete next action |
|
|
35
|
-
| `/archik:alpha [show \| promote]` | Read or move project alphas with a machine-checked criteria |
|
|
36
32
|
| `/archik:self-evolving <idea>` | Design a self-evolving architecture for the user's idea, using the pattern library |
|
|
37
33
|
|
|
38
34
|
The full protocol for each lives at `commands/<name>.md` in the repo (or `.claude/commands/archik/<name>.md` once installed in a project). Follow it when invoked.
|
|
@@ -48,22 +44,15 @@ These are the verbs you reach for during the loop. Default to `npx archik` (no g
|
|
|
48
44
|
| Look up one node | `npx archik q describe <id>` |
|
|
49
45
|
| Find dependencies / impact | `npx archik q deps \| dependents \| impact <id>` |
|
|
50
46
|
| See one node + its neighbors | `npx archik q neighbors <id> [--depth N]` |
|
|
51
|
-
| List use cases (filter by actor) | `npx archik q usecases [--actor <id>]` |
|
|
52
|
-
| Describe one use case | `npx archik q describe-usecase <id>` |
|
|
53
|
-
| List actors | `npx archik q actors` |
|
|
54
|
-
| List concrete run traces | `npx archik q traces [--usecase <id>] [--slice <id>]` |
|
|
55
|
-
| Use case coverage matrix | `npx archik trace [--json] [--fail-on partial\|none]` |
|
|
56
47
|
| Map changed files onto the model | `npx archik affected [--since <ref>] [--files <list>] [--json]` |
|
|
57
|
-
| Run the tests a change touches | `npx archik affected --run [--runner '<cmd>']` |
|
|
58
48
|
| Verify edges against the code | `npx archik drift --edges [--json]` |
|
|
59
|
-
| Alpha state snapshot | `npx archik alpha show [--json]` |
|
|
60
|
-
| Promote / demote an alpha state | `npx archik alpha promote\|demote <alpha> <state>` |
|
|
61
49
|
| Validate a file | `npx archik validate <path>` |
|
|
62
50
|
| Spot over-complex files / hubs | `npx archik complexity [--fail-on-warn]` |
|
|
51
|
+
| Find folder loops / oversized files | `npx archik smells [dir] [--json] [--fail-on-warn]` |
|
|
63
52
|
| Stage a proposed change | `npx archik suggest set --note '…' - <<'YAML' … YAML` |
|
|
64
53
|
| Show / accept / reject pending | `npx archik suggest show \| accept \| reject` |
|
|
65
54
|
| Render an SVG | `npx archik render --out diagram.svg` |
|
|
66
|
-
| Render
|
|
55
|
+
| Render one area / drop weak edges | `npx archik render --focus <id>` / `--hide-structural` |
|
|
67
56
|
| Diff two files or git refs | `npx archik diff a.yaml b.yaml` / `npx archik diff origin/main` |
|
|
68
57
|
| Detect drift vs source tree | `npx archik drift` |
|
|
69
58
|
| Open the live canvas (foreground) | `npx archik dev` |
|
|
@@ -80,12 +69,6 @@ You MUST NOT use `Read`, `Write`, or `Edit` against any file under `.archik/`, a
|
|
|
80
69
|
|
|
81
70
|
If `npx archik` is unreachable (offline, sandboxed, missing), STOP and tell the user. Do NOT fall back to reading or editing YAML by hand.
|
|
82
71
|
|
|
83
|
-
**Exception:** four file types have **no sidecar workflow** — create or edit them directly with `Write` / `Edit`, then validate via `npx archik validate`:
|
|
84
|
-
- `*.archik.seq.yaml` — sequence diagrams (see "Sequence diagrams" below)
|
|
85
|
-
- `*.archik.actors.yaml` — actor definitions (see "Actors" below)
|
|
86
|
-
- `*.archik.uc.yaml` — use cases (see "Use cases and slices" below)
|
|
87
|
-
- `*.archik.alphas.yaml` — Essence alpha snapshot (see "Alpha state" below)
|
|
88
|
-
|
|
89
72
|
## The engineering loop (how archik fits into delivering work)
|
|
90
73
|
|
|
91
74
|
Every structural change runs the loop. Don't skip phases; don't silently retry on rejection; don't paper over a wrong design mid-build — go back.
|
|
@@ -117,11 +100,11 @@ Every structural change runs the loop. Don't skip phases; don't silently retry o
|
|
|
117
100
|
|
|
118
101
|
| Phase | Driver | Tool you reach for |
|
|
119
102
|
| -------- | ------------- | --------------------------------------------------- |
|
|
120
|
-
| Discover | Claude | `npx archik q ...` + `
|
|
121
|
-
| Design | Claude → User |
|
|
103
|
+
| Discover | Claude | `npx archik q ...` + `npx archik affected` + `npx archik smells` + `ls` |
|
|
104
|
+
| Design | Claude → User | sidecar via `suggest set` |
|
|
122
105
|
| Decide | User | `/archik:accept` or `/archik:reject` (HITL gate) |
|
|
123
106
|
| Build | Claude → User | numbered plan (HITL approval), then small commits |
|
|
124
|
-
| Verify | Claude | `npx archik validate` +
|
|
107
|
+
| Verify | Claude | `npx archik validate` + tests + `drift` + `smells` + SVG regen |
|
|
125
108
|
|
|
126
109
|
**Two non-obvious feedback edges:**
|
|
127
110
|
|
|
@@ -205,14 +188,15 @@ The CLI parses, schema-validates, checks cross-file references, stamps `metadata
|
|
|
205
188
|
```bash
|
|
206
189
|
npx archik validate .archik/main.archik.yaml # schema + cross-file + constraints
|
|
207
190
|
npx archik drift # diagram vs source tree
|
|
208
|
-
npx archik affected --json # what did this change touch?
|
|
191
|
+
npx archik affected --json # what did this change touch? who depends on it?
|
|
192
|
+
npx archik smells # folder loops + oversized files, from the code
|
|
209
193
|
npx archik render --out docs/architecture.svg # if the project commits an SVG
|
|
210
194
|
```
|
|
211
195
|
|
|
212
196
|
`affected` is also the right opener in DISCOVER when work starts from
|
|
213
197
|
an existing branch: `npx archik affected --since origin/main --json`
|
|
214
|
-
tells you which nodes,
|
|
215
|
-
touches — ground your plan in that instead of re-deriving it.
|
|
198
|
+
tells you which nodes, and which dependents of those nodes, the branch
|
|
199
|
+
already touches — ground your plan in that instead of re-deriving it.
|
|
216
200
|
|
|
217
201
|
### 4. Sub-architecture (a brand-new `archikFile`)
|
|
218
202
|
|
|
@@ -246,46 +230,12 @@ YAML
|
|
|
246
230
|
|
|
247
231
|
When you auto-accept the sub-file, **narrate the rationale** so the user can tell you're not bypassing their `/archik:accept` review on the main draft. The main draft is always left as a sidecar.
|
|
248
232
|
|
|
249
|
-
### 5. Sequence diagrams (direct-write, no sidecar)
|
|
250
|
-
|
|
251
|
-
Sequence diagrams live in `.archik/` as `*.archik.seq.yaml` files and document a specific runtime flow at the call level. They are the **only** archik file mode you write directly.
|
|
252
|
-
|
|
253
|
-
```bash
|
|
254
|
-
# 1. Write the seq file directly with the Write tool
|
|
255
|
-
# 2. Validate (this also checks every seqFiles reference)
|
|
256
|
-
npx archik validate .archik/main.archik.yaml
|
|
257
|
-
|
|
258
|
-
# 3. Link it from an architecture node via `suggest set` (sidecar workflow)
|
|
259
|
-
npx archik suggest set --note "link login-flow seq diagram to api-gateway" - <<'YAML'
|
|
260
|
-
version: "1.0"
|
|
261
|
-
name: My Architecture
|
|
262
|
-
nodes:
|
|
263
|
-
- id: api-gateway
|
|
264
|
-
...
|
|
265
|
-
seqFiles:
|
|
266
|
-
- .archik/login-flow.archik.seq.yaml
|
|
267
|
-
... (every other node)
|
|
268
|
-
edges: [ ... ]
|
|
269
|
-
YAML
|
|
270
|
-
|
|
271
|
-
# 4. Render to SVG (optional, useful for CI / docs)
|
|
272
|
-
npx archik render --seq .archik/login-flow.archik.seq.yaml --out login-flow.svg
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
`seqFiles` is a non-empty array of relative paths from project root. The validator checks each path exists.
|
|
276
|
-
|
|
277
|
-
The seq schema (UML subset) is documented at the bottom of this file under "Sequence diagram schema reference".
|
|
278
|
-
|
|
279
233
|
## File modes — two modes, picked by filename
|
|
280
234
|
|
|
281
235
|
| Suffix | Mode | When to use |
|
|
282
236
|
| --------------------------- | ------------- | ----------------------------------------------------------------------------------- |
|
|
283
237
|
| `*.archik.yaml` | **normal** | The canonical architecture of code that exists. |
|
|
284
238
|
| `*.archik.suggested.yaml` | **suggested** | A pending change to a normal file. Owned by `suggest set`. Becomes normal on accept. |
|
|
285
|
-
| `*.archik.seq.yaml` | **sequence** | A runtime flow diagram. Direct-write. No sidecar. |
|
|
286
|
-
| `*.archik.actors.yaml` | **actors** | Who acts on the system (human / external-system / time / device). Direct-write. |
|
|
287
|
-
| `*.archik.uc.yaml` | **use case** | One use case: flows + slices + test paths. Lives under `.archik/usecases/`. Direct-write. |
|
|
288
|
-
| `*.archik.alphas.yaml` | **alphas** | Project-wide Essence alpha state snapshot. Direct-write. |
|
|
289
239
|
|
|
290
240
|
There is no separate "discussion" file mode. Greenfield / exploratory work is expressed via `status: proposed` on the affected nodes and edges (see Lifecycle below). The diagram stays canonical.
|
|
291
241
|
|
|
@@ -325,18 +275,6 @@ Both **nodes and edges** carry an optional `status`. Same enum, same defaults, s
|
|
|
325
275
|
|
|
326
276
|
For edges, `status: proposed` expresses "this dependency is planned" (e.g. *"orders-api will start subscribing to `payments.completed` next sprint"*). `archik drift` and the validator both respect lifecycle so proposed nodes don't trigger missing-source warnings before they're built.
|
|
327
277
|
|
|
328
|
-
### Node stereotype — ECB classification
|
|
329
|
-
|
|
330
|
-
Nodes that participate in a use case flow may carry an optional `stereotype` field:
|
|
331
|
-
|
|
332
|
-
```yaml
|
|
333
|
-
stereotype: boundary # accepts requests from actors / external systems
|
|
334
|
-
stereotype: control # orchestrates; implements the use case logic
|
|
335
|
-
stereotype: entity # stores data; domain model
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
The validator enforces the ECB transition rules on **seq diagrams that carry a `realizes` block**: actors call boundaries, boundaries call controls, controls call entities or other controls. Direct actor→entity or entity→boundary messages are errors. Untagged nodes are silently skipped so adoption is incremental.
|
|
339
|
-
|
|
340
278
|
### Node owner — who to talk to
|
|
341
279
|
|
|
342
280
|
Nodes may carry `owner: <team-or-person>` (free text — match the
|
|
@@ -373,7 +311,7 @@ constraints:
|
|
|
373
311
|
maxDependencies: { node: { kind: service }, max: 6 }
|
|
374
312
|
```
|
|
375
313
|
|
|
376
|
-
- Selectors: `{ id?, kind?, parent?, notParent
|
|
314
|
+
- Selectors: `{ id?, kind?, parent?, notParent? }` — all
|
|
377
315
|
set fields must match; `parent`/`notParent` walk the whole parentId
|
|
378
316
|
chain.
|
|
379
317
|
- Exactly one rule per constraint: `forbidEdge`, `requireOwner`,
|
|
@@ -405,10 +343,10 @@ Run a candidate through this checklist before staging a sidecar. Each item is a
|
|
|
405
343
|
- **Bounded contexts.** Name the context this change belongs to. A change spanning two contexts usually means a missing third (orchestrator, port, gateway).
|
|
406
344
|
- **Async at context boundaries.** Default cross-context coupling to `publishes` / `subscribes` over a stream/queue. `http_call` across contexts is allowed but should be justified (sync-required RPC, query for read-side data).
|
|
407
345
|
- **Composition over sprawl.** Group related nodes under a `module` parent via `parentId`. Flat top-level lists past ~8 nodes are a smell. Run `npx archik complexity` to catch this objectively — it flags over-large files, over-stuffed containers, hub nodes, and deep nesting, each with a concrete fix.
|
|
346
|
+
- **No folder loops.** Dependencies between sibling folders should flow one way. Run `npx archik smells` — it reads the code (no model needed) and reports folder loops with the real `file imports "specifier"` lines as evidence, plus the cheapest import to cut. Name smells by that evidence; don't invent labels.
|
|
408
347
|
- **Ports & adapters at the edge.** External integrations sit behind an `external` node, never inline in a service. Port (interface) + adapter (concrete) is preferred when the integration could swap.
|
|
409
348
|
- **Public traffic → gateway/auth upstream.** Anything user-facing routes through a `gateway`/`auth` node, not directly to a service.
|
|
410
349
|
- **Failure modes.** Async producers imply DLQ/retry on the consumer; `http_call` implies timeout + circuit. Don't draw the happy path alone.
|
|
411
|
-
- **Use case participation → ECB classification.** If a node appears in any active use case slice (check `npx archik q usecases` or trace output), it needs a `stereotype: boundary | control | entity` before the seq diagram is authored. An unclassified node in a `realizes`-linked seq passes structurally but defeats ECB rule enforcement. Classify now; the validator will catch violations at seq-authoring time, not at code-review time.
|
|
412
350
|
- **Lifecycle honesty.** Code-bearing node without code on disk → `status: proposed`. About to be removed → `status: deprecated`.
|
|
413
351
|
|
|
414
352
|
## Keep views small
|
|
@@ -417,7 +355,7 @@ A big model isn't read by staring at one giant map — it's read one question at
|
|
|
417
355
|
|
|
418
356
|
- **Answer questions with a query, not the whole diagram.** "What does X talk to?" → `npx archik q neighbors X` (or `q describe X`). Don't render the full map to answer a local question.
|
|
419
357
|
- **Let `complexity` tell you when to split.** Run `npx archik complexity` (advisory; `--fail-on-warn` for CI/hooks). When it flags a file or container, decompose: move a subsystem into its own `archikFile`, or group nodes under a `module` parent via `parentId`. Strict default limits — 15 nodes/file, 20 edges/file, 6 children/container, degree 6, nesting depth 3. These are hints, not blockers.
|
|
420
|
-
- **
|
|
358
|
+
- **Focus when rendering.** `npx archik render --focus <id> [--depth N]` renders only a node's neighborhood; `--hide-structural` (or `--hide-rel`/`--only-rel`) drops weak edges (`uses`, `depends_on`, `has_a`, `implements`, `extends`) so the runtime shape stands out.
|
|
421
359
|
- **For humans on the canvas:** the live canvas has matching controls — collapse/expand containers, hide weak edges, and focus mode (select a node → "Focus on this node", with a depth stepper, Esc to exit). These are view-only and never change the YAML.
|
|
422
360
|
|
|
423
361
|
## When to propose, when to defer
|
|
@@ -472,211 +410,6 @@ The loop is self-contained, but these sharpen specific phases when the user has
|
|
|
472
410
|
| | `superpowers:requesting-code-review` |
|
|
473
411
|
| Verify | `superpowers:verification-before-completion` |
|
|
474
412
|
|
|
475
|
-
## Actors
|
|
476
|
-
|
|
477
|
-
Actors live in `.archik/actors.archik.actors.yaml` (one file per project). Direct-write — no sidecar. Schema: `npx archik schema actors`.
|
|
478
|
-
|
|
479
|
-
```yaml
|
|
480
|
-
version: "1.0"
|
|
481
|
-
actors:
|
|
482
|
-
- id: customer
|
|
483
|
-
kind: human # human | external-system | time | device
|
|
484
|
-
description: End-user buying products.
|
|
485
|
-
goals: [place-orders, view-history] # optional free text
|
|
486
|
-
- id: payments-gw
|
|
487
|
-
kind: external-system
|
|
488
|
-
description: Stripe — charges cards and issues refunds.
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
Use cases reference actors by `id`. The validator rejects a use case whose `primaryActor` isn't in the actor index.
|
|
492
|
-
|
|
493
|
-
## Use cases and slices
|
|
494
|
-
|
|
495
|
-
One file per use case under `.archik/usecases/<id>.archik.uc.yaml`. Direct-write — no sidecar. Schema: `npx archik schema uc`.
|
|
496
|
-
|
|
497
|
-
```yaml
|
|
498
|
-
version: "1.0"
|
|
499
|
-
id: place-order
|
|
500
|
-
kind: useCase
|
|
501
|
-
name: Place an order
|
|
502
|
-
status: active
|
|
503
|
-
primaryActor: customer
|
|
504
|
-
secondaryActors: [payments-gw]
|
|
505
|
-
goal: Customer pays for items in cart and receives confirmation.
|
|
506
|
-
flows:
|
|
507
|
-
basic:
|
|
508
|
-
steps:
|
|
509
|
-
- Customer submits cart.
|
|
510
|
-
- System reserves inventory.
|
|
511
|
-
- System charges payment method.
|
|
512
|
-
- System persists order and emits OrderPlaced.
|
|
513
|
-
alternates:
|
|
514
|
-
- id: payment-declined
|
|
515
|
-
branchFrom: basic.3
|
|
516
|
-
steps: [Payment gateway returns decline, System releases inventory.]
|
|
517
|
-
slices:
|
|
518
|
-
- id: happy-path
|
|
519
|
-
description: Full successful purchase.
|
|
520
|
-
flows: [basic]
|
|
521
|
-
tests: [tests/e2e/place-order.happy.spec.ts] # must exist on disk for active slices
|
|
522
|
-
realization:
|
|
523
|
-
seqFile: .archik/place-order.happy.archik.seq.yaml
|
|
524
|
-
- id: declined
|
|
525
|
-
description: Payment gateway declines.
|
|
526
|
-
flows: [basic, payment-declined]
|
|
527
|
-
tests: [tests/e2e/place-order.declined.spec.ts]
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
**Validation rules:**
|
|
531
|
-
- `primaryActor` and `secondaryActors` must resolve in the actor index.
|
|
532
|
-
- Active slice `tests` paths must exist on disk (same discipline as `sourcePath`).
|
|
533
|
-
- If `realization.seqFile` is set, the named seq file must exist AND carry a matching `realizes` block (bidirectional).
|
|
534
|
-
- `flows.basic` is required; `alternates[].branchFrom` must reference an existing flow + step number.
|
|
535
|
-
|
|
536
|
-
Query: `npx archik q usecases [--actor <id>]` | `npx archik q describe-usecase <id>`
|
|
537
|
-
|
|
538
|
-
## Concrete run traces
|
|
539
|
-
|
|
540
|
-
A sequence diagram is the **abstract** flow (boxes and arrows, no values). A **concrete trace** is one real run of a slice with the **actual data at each step** — captured from the slice's tests and shown on the canvas as an expandable dataflow **timeline** (each step's real in/out values, expandable to the full JSON). It's the concrete counterpart to the slice's abstract seq diagram (a bound trace links to that diagram; it doesn't redraw onto it). Use it when someone asks to *see a real example of a use case running, with the data at each step*.
|
|
541
|
-
|
|
542
|
-
- **Tests record it via the `archik/trace` recorder** (a zero-dep import archik ships). Add it to the slice's test:
|
|
543
|
-
```ts
|
|
544
|
-
import { trace } from "archik/trace";
|
|
545
|
-
const t = trace({
|
|
546
|
-
useCase: "place-order",
|
|
547
|
-
slice: "happy-path",
|
|
548
|
-
seqFile: ".archik/place-order.happy.archik.seq.yaml", // optional → binds to the diagram
|
|
549
|
-
});
|
|
550
|
-
t.step({ id: "m1", from: "browser", to: "api", label: "POST /orders", in: cart, out: res });
|
|
551
|
-
t.step({ id: "m2", from: "api", to: "db", label: "insert order", in: order });
|
|
552
|
-
// auto-flushes on process exit → .archik/traces/place-order.happy-path.archik.trace.json
|
|
553
|
-
```
|
|
554
|
-
When `seqFile` is set, `id`/`from`/`to` must match the diagram's message + participant ids (so the run is checked against the declared flow); omit `seqFile` for a standalone trace.
|
|
555
|
-
- **Passive — archik never runs your tests.** Run them however you like (`npm test`, `archik affected --run`); the recorder writes the file, archik only reads it. The canvas shows a "Concrete run" affordance on each slice that has one.
|
|
556
|
-
- **Query / shape:** `npx archik q traces [--usecase <id>] [--slice <id>]` lists captured runs; `npx archik schema trace` prints the schema (the file is JSON, machine-generated — never hand-author it).
|
|
557
|
-
- **Validated:** `npx archik validate` checks each trace — its use case/slice resolves, and (when bound) its step ids + participants exist in the seq diagram; seq steps the run didn't exercise are reported informationally, not as errors.
|
|
558
|
-
|
|
559
|
-
**Two different "trace"s — don't confuse them:** `npx archik trace` is the use-case **coverage matrix** (use case × slice × test × seq). **Concrete run traces** are `*.archik.trace.json` files captured by the recorder and listed by `npx archik q traces`.
|
|
560
|
-
|
|
561
|
-
## Alpha state
|
|
562
|
-
|
|
563
|
-
One file per project: `<name>.archik.alphas.yaml`. Direct-write. Tracks four Essence alphas that archik can directly evidence: **stakeholders**, **requirements**, **softwareSystem**, **work**.
|
|
564
|
-
|
|
565
|
-
```yaml
|
|
566
|
-
version: "1.0"
|
|
567
|
-
alphas:
|
|
568
|
-
stakeholders:
|
|
569
|
-
state: represented # conceived | recognised | represented | involved | in-agreement | satisfied
|
|
570
|
-
evidence: ["developer (human) + claude (external-system) in actors file"]
|
|
571
|
-
requirements:
|
|
572
|
-
state: acceptable # conceived | bounded | coherent | acceptable | addressed | fulfilled
|
|
573
|
-
note: "All active slices test-backed; rejected slice still needs a realization seq."
|
|
574
|
-
softwareSystem:
|
|
575
|
-
state: usable # architecture-selected | demonstrable | usable | ready | operational | retired
|
|
576
|
-
work:
|
|
577
|
-
state: under-control # initiated | prepared | started | under-control | concluded | closed
|
|
578
|
-
```
|
|
579
|
-
|
|
580
|
-
Manage states with:
|
|
581
|
-
```bash
|
|
582
|
-
npx archik alpha show # verification badges: ✓ verified | ✗ over-claimed | ? subjective
|
|
583
|
-
npx archik alpha promote requirements addressed # runs machine check before writing
|
|
584
|
-
npx archik alpha demote softwareSystem usable # no check on demote
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
The validator checks machine-checkable states (e.g. `requirements.acceptable` requires every active slice to have on-disk tests). Over-claimed states are flagged `✗` — downgrade or fix the artifacts.
|
|
588
|
-
|
|
589
|
-
## Sequence diagram schema reference
|
|
590
|
-
|
|
591
|
-
```yaml
|
|
592
|
-
version: "1.0" # required, literal
|
|
593
|
-
name: "Login flow" # required, non-empty
|
|
594
|
-
description: "..." # optional
|
|
595
|
-
|
|
596
|
-
realizes: # optional — links this seq to a use case slice
|
|
597
|
-
useCase: place-order # use case id (must exist in .archik/usecases/)
|
|
598
|
-
slice: happy-path # slice id within that use case
|
|
599
|
-
# validator enforces bidirectional integrity:
|
|
600
|
-
# the slice's realization.seqFile must name THIS file
|
|
601
|
-
|
|
602
|
-
participants: # required, at least one
|
|
603
|
-
- id: browser # participant ref id (used in steps)
|
|
604
|
-
nodeId: frontend # architecture node id this participant maps to
|
|
605
|
-
# node's kind drives the participant header icon/color
|
|
606
|
-
label: Browser # optional display label (defaults to nodeId)
|
|
607
|
-
status: proposed # optional — proposed | active | deprecated
|
|
608
|
-
|
|
609
|
-
steps: # ordered list of messages, notes, groups
|
|
610
|
-
# --- message ---
|
|
611
|
-
- type: message
|
|
612
|
-
id: m1
|
|
613
|
-
from: browser # participant id
|
|
614
|
-
to: api # participant id
|
|
615
|
-
label: POST /login
|
|
616
|
-
arrow: sync # sync | async | return | create | destroy
|
|
617
|
-
activate: true # optional — draws activation box on receiver
|
|
618
|
-
status: proposed # optional
|
|
619
|
-
|
|
620
|
-
# --- note ---
|
|
621
|
-
- type: note
|
|
622
|
-
id: n1
|
|
623
|
-
position: over # over | left_of | right_of
|
|
624
|
-
participants: [api] # list of participant ids the note spans
|
|
625
|
-
text: "JWT issued here"
|
|
626
|
-
status: proposed # optional
|
|
627
|
-
|
|
628
|
-
# --- group (alt / opt / loop / par / break / ref) ---
|
|
629
|
-
- type: group
|
|
630
|
-
id: g1
|
|
631
|
-
kind: alt
|
|
632
|
-
condition: "[authenticated]" # optional — shown in group header
|
|
633
|
-
branches:
|
|
634
|
-
- label: "[success]" # optional branch label
|
|
635
|
-
steps:
|
|
636
|
-
- type: message
|
|
637
|
-
id: m2
|
|
638
|
-
from: api
|
|
639
|
-
to: browser
|
|
640
|
-
label: "200 OK"
|
|
641
|
-
arrow: return
|
|
642
|
-
- label: "[failure]"
|
|
643
|
-
steps:
|
|
644
|
-
- type: message
|
|
645
|
-
id: m3
|
|
646
|
-
from: api
|
|
647
|
-
to: browser
|
|
648
|
-
label: "401 Unauthorized"
|
|
649
|
-
arrow: return
|
|
650
|
-
status: proposed # optional
|
|
651
|
-
|
|
652
|
-
# --- ref group (drill-down to another seq file) ---
|
|
653
|
-
- type: group
|
|
654
|
-
id: g2
|
|
655
|
-
kind: ref
|
|
656
|
-
label: "checkout flow"
|
|
657
|
-
seqFile: .archik/checkout-flow.archik.seq.yaml
|
|
658
|
-
# makes the frame clickable in the UI
|
|
659
|
-
branches: [] # required (can be empty for ref)
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
**Arrow types:**
|
|
663
|
-
|
|
664
|
-
| arrow | meaning |
|
|
665
|
-
| --------- | ----------------------------------------------------------- |
|
|
666
|
-
| `sync` | synchronous call (solid line, filled arrowhead) |
|
|
667
|
-
| `async` | fire-and-forget (solid line, open arrowhead) |
|
|
668
|
-
| `return` | return value (dashed line, open arrowhead) |
|
|
669
|
-
| `create` | object creation (dashed line, filled arrowhead + `«create»`) |
|
|
670
|
-
| `destroy` | object destruction (solid line, × marker at target) |
|
|
671
|
-
|
|
672
|
-
**Group kinds:** `alt` (conditional), `opt` (optional), `loop`, `par` (parallel), `break`, `ref` (reference)
|
|
673
|
-
|
|
674
|
-
**Validator checks for seq diagrams:**
|
|
675
|
-
- All seq files referenced in `seqFiles` exist on disk.
|
|
676
|
-
- Each seq file parses as valid YAML and matches the seq schema.
|
|
677
|
-
- Participant `nodeId` fields reference real node ids from the architecture.
|
|
678
|
-
- No duplicate step ids within a seq file.
|
|
679
|
-
|
|
680
413
|
## Full CLI reference
|
|
681
414
|
|
|
682
415
|
Run `npx archik <cmd> --help` for the per-command surface.
|
|
@@ -684,48 +417,30 @@ Run `npx archik <cmd> --help` for the per-command surface.
|
|
|
684
417
|
```
|
|
685
418
|
npx archik schema # the document shape (start here when authoring)
|
|
686
419
|
--json # structured shape for piping into jq
|
|
687
|
-
--seq # seq diagram schema instead of arch schema
|
|
688
|
-
uc # use case schema
|
|
689
|
-
actors # actors schema
|
|
690
|
-
trace # concrete run-trace schema
|
|
691
420
|
|
|
692
421
|
npx archik q describe <id> | deps <id> | dependents <id>
|
|
693
422
|
list | edges | impact <id> | stats
|
|
694
423
|
neighbors <id> [--depth <n>] # node + everything within N hops (default 1)
|
|
695
|
-
sequences [--node <id>] # list seq diagrams; --node filters to flows involving a node
|
|
696
|
-
usecases [--actor <id>] # list use cases; filter by actor
|
|
697
|
-
describe-usecase <id> # one use case in detail
|
|
698
|
-
actors # list actors
|
|
699
|
-
traces [--usecase <id>] [--slice <id>] # concrete run traces (.archik.trace.json)
|
|
700
424
|
--json # stable machine-readable shape
|
|
701
425
|
|
|
702
|
-
npx archik trace [--json] # coverage matrix: use case × slice × test × seq × ECB
|
|
703
|
-
--use-case <id> # filter to one use case
|
|
704
|
-
--actor <id> # filter by actor
|
|
705
|
-
--status active|proposed|deprecated
|
|
706
|
-
--coverage full|partial|none
|
|
707
|
-
--fail-on partial|none # exit 1 for CI gates
|
|
708
|
-
|
|
709
|
-
npx archik alpha show [--json] # alpha state snapshot with verification badges
|
|
710
|
-
alpha promote <alpha> <state> [--note <text>] # runs machine check first
|
|
711
|
-
alpha demote <alpha> <state>
|
|
712
|
-
|
|
713
426
|
npx archik validate <path> [--json] # schema + cross-file + governance constraints
|
|
714
427
|
# prints an advisory complexity-hint count (never fails on it)
|
|
715
428
|
npx archik complexity [path] [--json] # advisory report: over-large files, hub nodes, deep nesting
|
|
716
429
|
[--fail-on-warn] # exit 1 if any finding (CI / pre-commit gate)
|
|
717
430
|
[--max-nodes N] [--max-edges N] [--max-children N]
|
|
718
431
|
[--max-degree N] [--max-depth N] # override the strict defaults
|
|
432
|
+
npx archik smells [dir] [--json] # folder loops + oversized files, read from TS/JS code
|
|
433
|
+
[--max-file-lines N] # line limit per file (default 500)
|
|
434
|
+
[--fail-on-warn] # exit 1 if any smell (CI gate)
|
|
719
435
|
npx archik render --out diagram.svg --theme light|dark
|
|
720
|
-
render --seq <path> --out seq.svg --theme light|dark
|
|
721
436
|
render --focus <id> [--depth N] # render only a node's neighborhood
|
|
722
437
|
render --hide-structural | --hide-rel <a,b> | --only-rel <a,b> # filter edges
|
|
723
438
|
npx archik diff <a> [b] [--out diff.svg] [--json]
|
|
724
439
|
# each side: YAML file OR git ref;
|
|
725
440
|
# one arg = that ref vs working tree
|
|
726
441
|
npx archik affected [--since <ref>] [--files <list>] [--json]
|
|
727
|
-
# changed files → nodes /
|
|
728
|
-
|
|
442
|
+
# changed files → nodes / dependents /
|
|
443
|
+
# model files / unmapped
|
|
729
444
|
npx archik drift [--json] [--ignore <file>] # diagram vs source tree
|
|
730
445
|
[--edges] # + verify edges vs the TS/JS import
|
|
731
446
|
# graph (shadow / phantom edges)
|
package/commands/actor.md
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Add or update an actor in the actor index
|
|
3
|
-
argument-hint: <actor id> [— description]
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# /archik:actor — author an entry in `*.archik.actors.yaml`
|
|
7
|
-
|
|
8
|
-
The user wants you to add (or update) an actor in the project's actor
|
|
9
|
-
index. Actors are *who* initiates use cases — humans (end users,
|
|
10
|
-
operators, customers) or non-human systems (other services, schedulers,
|
|
11
|
-
external APIs). The user-facing description is:
|
|
12
|
-
|
|
13
|
-
**$ARGUMENTS**
|
|
14
|
-
|
|
15
|
-
This slash command IS the user's confirmation. Skip "want me to add
|
|
16
|
-
this?" and produce the change now.
|
|
17
|
-
|
|
18
|
-
## Direct-write — not the sidecar workflow
|
|
19
|
-
|
|
20
|
-
Actors live in `.archik/actors.archik.actors.yaml` (one file per
|
|
21
|
-
project, conventionally). Authored with `Write` / `Edit` directly,
|
|
22
|
-
then validated via `npx archik validate`.
|
|
23
|
-
|
|
24
|
-
## Steps
|
|
25
|
-
|
|
26
|
-
0. **Frame.** Restate the user's intent in one sentence and ask 1–2
|
|
27
|
-
sharp questions only if any of these are unclear:
|
|
28
|
-
- **Actor kind** — `human` (end user / operator / customer),
|
|
29
|
-
`external-system` (third-party service we don't own),
|
|
30
|
-
`time` (scheduler / cron), or `device` (sensor / hardware)?
|
|
31
|
-
- **Goals** — one short sentence per goal the actor pursues
|
|
32
|
-
against this system. Optional but useful.
|
|
33
|
-
|
|
34
|
-
Skip questions `$ARGUMENTS` already answers.
|
|
35
|
-
|
|
36
|
-
1. **Ground in current actors:**
|
|
37
|
-
```
|
|
38
|
-
npx archik q actors
|
|
39
|
-
```
|
|
40
|
-
If the id already exists, this is an UPDATE — read the existing
|
|
41
|
-
entry's fields and preserve everything the user didn't ask to
|
|
42
|
-
change. Otherwise it's a NEW addition.
|
|
43
|
-
|
|
44
|
-
2. **Lock in the schema:**
|
|
45
|
-
```
|
|
46
|
-
npx archik schema actors
|
|
47
|
-
```
|
|
48
|
-
Required: `id`, `kind`, `description`. Optional: `goals`.
|
|
49
|
-
|
|
50
|
-
3. **Edit the file.** If `.archik/actors.archik.actors.yaml` doesn't
|
|
51
|
-
exist yet, `Write` a new file with the standard header. If it
|
|
52
|
-
exists, `Edit` to add/update the one actor you're touching — do
|
|
53
|
-
NOT rewrite the whole file unless you're consolidating.
|
|
54
|
-
|
|
55
|
-
```yaml
|
|
56
|
-
version: "1.0"
|
|
57
|
-
actors:
|
|
58
|
-
- id: <kebab-id>
|
|
59
|
-
kind: human # human | external-system | time | device
|
|
60
|
-
description: One sentence — who they are and why they touch the system.
|
|
61
|
-
goals:
|
|
62
|
-
- "Verb-first short outcome they pursue."
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
4. **Validate:**
|
|
66
|
-
```
|
|
67
|
-
npx archik validate
|
|
68
|
-
```
|
|
69
|
-
Common failures:
|
|
70
|
-
- Duplicate `id` across actor files
|
|
71
|
-
- Missing `description` (required, non-empty)
|
|
72
|
-
- `kind` not in the allowed enum
|
|
73
|
-
|
|
74
|
-
5. **Confirm inline.** Print the actor's id, kind, and description.
|
|
75
|
-
Ask: "Looks right? Want me to author a use case (`/archik:usecase`)
|
|
76
|
-
that has this actor as `primaryActor`?"
|
|
77
|
-
|
|
78
|
-
Don't auto-proceed. Inline-review gate.
|
|
79
|
-
|
|
80
|
-
## Notes
|
|
81
|
-
|
|
82
|
-
- Actors must exist BEFORE any use case can reference them. The
|
|
83
|
-
use case validator rejects dangling `primaryActor` / `secondaryActors`
|
|
84
|
-
references with the actor id named in the error.
|
|
85
|
-
- The `external` node kind in the structural model is for third-party
|
|
86
|
-
systems that participate in the *runtime* graph. The `external-system`
|
|
87
|
-
actor kind is for systems that *initiate* use cases. They overlap
|
|
88
|
-
conceptually but live in different files — actor file for "who acts
|
|
89
|
-
on us", structural file for "what we integrate with".
|
package/commands/alpha.md
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Show alpha state snapshot, or promote one with criteria check
|
|
3
|
-
argument-hint: [show | promote <alpha> <state> | demote <alpha> <state>]
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# /archik:alpha — read or move project alphas
|
|
7
|
-
|
|
8
|
-
Alphas (Essence / SEMAT) are the universal progress dials of the
|
|
9
|
-
project. The user wants either a snapshot of all alphas, or a
|
|
10
|
-
deliberate promotion / demotion with the underlying criteria
|
|
11
|
-
verified mechanically. Argument:
|
|
12
|
-
|
|
13
|
-
**$ARGUMENTS**
|
|
14
|
-
|
|
15
|
-
## Branches
|
|
16
|
-
|
|
17
|
-
### No args / `show`
|
|
18
|
-
|
|
19
|
-
Run:
|
|
20
|
-
```
|
|
21
|
-
npx archik alpha show
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Read the table. For each alpha:
|
|
25
|
-
- `✓` means the claimed state is satisfied by the current artifacts
|
|
26
|
-
- `?` means the state can't be fully verified (manual review needed)
|
|
27
|
-
- `✗ over-claimed` means the artifacts don't meet the criteria —
|
|
28
|
-
surface this as a blocker
|
|
29
|
-
|
|
30
|
-
Translate the table into a short paragraph: which alphas are honest,
|
|
31
|
-
which are over-claimed, and what one concrete next action would
|
|
32
|
-
unblock the most progress (usually whichever alpha is closest to
|
|
33
|
-
its next state and just needs one more artifact).
|
|
34
|
-
|
|
35
|
-
### `promote <alpha> <state>`
|
|
36
|
-
|
|
37
|
-
Run the promotion (it runs the criteria check first and refuses if
|
|
38
|
-
the state isn't satisfied):
|
|
39
|
-
```
|
|
40
|
-
npx archik alpha promote <alpha> <state>
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
If it succeeds, narrate which evidence satisfied the criteria. If it
|
|
44
|
-
refuses, name the specific criterion that failed and the concrete
|
|
45
|
-
artifact that would satisfy it (e.g. "to promote `requirements` to
|
|
46
|
-
`addressed`, every active slice needs `realization.seqFile` — slice
|
|
47
|
-
X currently has none. Author `.archik/X.archik.seq.yaml` with
|
|
48
|
-
`realizes: { useCase, slice }` and re-run.").
|
|
49
|
-
|
|
50
|
-
### `demote <alpha> <state>`
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
npx archik alpha demote <alpha> <state>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Demotion is a deliberate admission that the project no longer meets
|
|
57
|
-
a previously-claimed state. Before running it, prompt the user for
|
|
58
|
-
the reason and surface it in your reply (and, if appropriate, in a
|
|
59
|
-
follow-up commit message) — the CLI doesn't persist a note for
|
|
60
|
-
demotions, so the audit trail has to live in chat / git history.
|
|
61
|
-
|
|
62
|
-
## Notes
|
|
63
|
-
|
|
64
|
-
- Alphas tracked: `stakeholders`, `requirements`, `softwareSystem`,
|
|
65
|
-
`work` (the four Essence alphas most directly evidenced by archik
|
|
66
|
-
artifacts). State ladders match the Essence kernel — see
|
|
67
|
-
`npx archik alpha show --json` for the full enum.
|
|
68
|
-
- The alpha file lives at `.archik/alphas.archik.alphas.yaml` —
|
|
69
|
-
direct-write only via this command (or the underlying CLI). Don't
|
|
70
|
-
edit it by hand; the criteria check is the discipline.
|
|
71
|
-
- Over-claiming is fixed by EITHER advancing artifacts OR demoting
|
|
72
|
-
the state. Whichever is easier given the project's actual
|
|
73
|
-
trajectory. Don't fudge.
|