archik 0.12.4 → 0.12.6

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.
@@ -315,6 +315,148 @@ Then loop back to step 2 (Clarify) of the engineering loop with the rejection re
315
315
 
316
316
  The goal: every accepted change ends with the user knowing what's next, not "ok, accepted". Every rejection ends with one specific question, not silence.
317
317
 
318
+ ## Sequence diagrams
319
+
320
+ Sequence diagrams live alongside architecture files in `.archik/` as `*.archik.seq.yaml` files. Each one documents a specific runtime flow (e.g. a request path, an event chain, an auth handshake) at the call level, using a subset of UML.
321
+
322
+ ### How they connect to architecture nodes
323
+
324
+ A node in the architecture YAML declares which flows it participates in via the `seqFiles` field:
325
+
326
+ ```yaml
327
+ - id: api-gateway
328
+ kind: gateway
329
+ label: API Gateway
330
+ description: ...
331
+ seqFiles:
332
+ - .archik/login-flow.archik.seq.yaml
333
+ - .archik/checkout-flow.archik.seq.yaml
334
+ ```
335
+
336
+ `seqFiles` is an **array of relative paths** from the project root. The validator checks each path exists on disk. Nodes without `seqFiles` are unaffected.
337
+
338
+ **UI effect:** nodes with `seqFiles` get clickable diagram links in the node inspector. The toolbar shows a "glow" button that highlights all nodes with seq diagrams so they're easy to spot on large canvases.
339
+
340
+ ### Authoring rule — seq files are direct-write (not `suggest set`)
341
+
342
+ `suggest set` is for architecture files only. Seq files have **no sidecar workflow** — create or edit them directly with `Write` / `Edit`. Then validate:
343
+
344
+ ```bash
345
+ npx archik validate .archik/main.archik.yaml # validates seq files referenced by seqFiles fields too
346
+ ```
347
+
348
+ ### Seq YAML schema
349
+
350
+ ```yaml
351
+ version: "1.0" # required, literal
352
+ name: "Login flow" # required, non-empty
353
+ description: "..." # optional
354
+
355
+ participants: # required, at least one
356
+ - id: browser # participant ref id (used in steps)
357
+ nodeId: frontend # architecture node id this participant maps to
358
+ label: Browser # optional display label (defaults to nodeId)
359
+
360
+ steps: # ordered list of messages, notes, groups
361
+ # --- message ---
362
+ - type: message
363
+ id: m1
364
+ from: browser # participant id
365
+ to: api # participant id
366
+ label: POST /login
367
+ arrow: sync # sync | async | return | create | destroy
368
+ activate: true # optional — draws activation box on receiver
369
+ status: proposed # optional — proposed | active | deprecated
370
+
371
+ # --- note ---
372
+ - type: note
373
+ id: n1
374
+ position: over # over | left_of | right_of (currently all render as "over")
375
+ participants: [api] # list of participant ids the note spans
376
+ text: "JWT issued here"
377
+ status: proposed # optional
378
+
379
+ # --- group (alt / opt / loop / par / break / ref) ---
380
+ - type: group
381
+ id: g1
382
+ kind: alt
383
+ condition: "[authenticated]" # optional — shown in group header
384
+ branches:
385
+ - label: "[success]" # optional branch label
386
+ steps:
387
+ - type: message
388
+ id: m2
389
+ from: api
390
+ to: browser
391
+ label: "200 OK"
392
+ arrow: return
393
+ - label: "[failure]"
394
+ steps:
395
+ - type: message
396
+ id: m3
397
+ from: api
398
+ to: browser
399
+ label: "401 Unauthorized"
400
+ arrow: return
401
+ status: proposed # optional
402
+ ```
403
+
404
+ **Arrow types:**
405
+ | arrow | meaning |
406
+ |-------|---------|
407
+ | `sync` | synchronous call (solid line, filled arrowhead) |
408
+ | `async` | fire-and-forget (solid line, open arrowhead) |
409
+ | `return` | return value (dashed line, open arrowhead) |
410
+ | `create` | object creation (dashed line, filled arrowhead + `«create»` label prefix) |
411
+ | `destroy` | object destruction (solid line, × marker at target) |
412
+
413
+ **Group kinds:** `alt` (conditional), `opt` (optional), `loop`, `par` (parallel), `break`, `ref` (reference)
414
+
415
+ ### Linking a new seq file (full workflow)
416
+
417
+ ```bash
418
+ # 1. Write the seq file directly
419
+ # (use Write tool — no suggest set for seq files)
420
+
421
+ # 2. Validate the seq file is well-formed
422
+ npx archik validate .archik/main.archik.yaml
423
+
424
+ # 3. Add seqFiles to the relevant architecture node via suggest set
425
+ npx archik suggest set --note "link login-flow seq diagram to api-gateway" - <<'YAML'
426
+ version: "1.0"
427
+ name: My Architecture
428
+ nodes:
429
+ - id: api-gateway
430
+ ...
431
+ seqFiles:
432
+ - .archik/login-flow.archik.seq.yaml
433
+ ... (all other nodes)
434
+ edges:
435
+ ... (all edges)
436
+ YAML
437
+
438
+ # 4. Validate again — now checks the seqFiles path exists
439
+ npx archik validate .archik/main.archik.yaml
440
+
441
+ # 5. User accepts on canvas → node gets seq diagram link in inspector
442
+ ```
443
+
444
+ ### What the validator checks for seq diagrams
445
+
446
+ - All seq files referenced in `seqFiles` exist on disk
447
+ - Each seq file parses as valid YAML
448
+ - Each seq file matches the seq schema (version, participants, steps structure)
449
+ - Participant `nodeId` fields reference real node ids from the architecture
450
+ - No duplicate step ids within a seq file
451
+
452
+ ### CLI render
453
+
454
+ ```bash
455
+ npx archik render --seq .archik/login-flow.archik.seq.yaml --out login-flow.svg
456
+ ```
457
+
458
+ Renders a headless SVG of the sequence diagram. Useful for CI or docs.
459
+
318
460
  ## Verification workflow
319
461
 
320
462
  After every `suggest set` or `suggest accept`: