archik 0.4.2 → 0.6.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.
@@ -1,30 +1,41 @@
1
1
  ---
2
2
  name: archik
3
- description: Use whenever 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 of the project between the user and Claude — read it before answering structural questions, and propose updates when work introduces or changes nodes/edges. Also covers the archik CLI for validation and rendering.
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 of the project between the user and Claude — read it before answering structural questions, and propose updates when work introduces or changes nodes/edges. Also covers the archik CLI for validation and rendering.
4
4
  ---
5
5
 
6
6
  # Archik — the project's shared map
7
7
 
8
- `architecture.archik.yaml` at the project root is **the user's source of
9
- truth for what the system looks like**. It lists every meaningful node
10
- (services, databases, queues, frontends, external APIs, …) and the
11
- edges between them. The canvas in the browser is a stateless projection
12
- of this file — when the user says "the orders service" or "the events
13
- queue", they mean the entity with that `id` in the YAML.
8
+ The archik file is **the user's source of truth for what the system
9
+ looks like**. It lists every meaningful node (services, databases,
10
+ queues, frontends, external APIs, …) and the edges between them.
11
+ The canvas in the browser is a stateless projection of this file —
12
+ when the user says "the orders service" or "the events queue", they
13
+ mean the entity with that `id` in the YAML.
14
14
 
15
- Treat this file as a shared vocabulary. It exists so the user and you
16
- can talk about the system without re-explaining it every time.
15
+ The file lives in one of two places, in this order of preference:
16
+
17
+ 1. `.archik/main.archik.yaml` — the new convention. Keeps the
18
+ project root tidy and leaves room for sub-architectures (other
19
+ `.archik/*.archik.yaml` files for individual components).
20
+ 2. `architecture.archik.yaml` — the legacy root location, still
21
+ fully supported.
22
+
23
+ Run `archik validate` (or check both paths) to find which one the
24
+ project uses. Don't assume — small differences here matter.
25
+
26
+ Treat the file as a shared vocabulary. It exists so the user and
27
+ you can talk about the system without re-explaining it every time.
17
28
 
18
29
  ## Protocol
19
30
 
20
31
  1. **Before** answering structural questions — *"what does X do?",
21
32
  "what depends on Y?", "where does data flow when …?"* — read
22
- `architecture.archik.yaml`. Don't guess from filenames or memory.
33
+ the archik file. Don't guess from filenames or memory.
23
34
  2. **When** work introduces, removes, or rewires components, write
24
- the proposed end-state to `architecture.archik.suggested.yaml`
25
- (same schema, plus a `metadata.suggestion` block — see "Suggesting
26
- changes" below). Don't edit `architecture.archik.yaml` directly;
27
- the user reviews and accepts in the canvas or via
35
+ the proposed end-state to a sibling `*.suggested.yaml` next to
36
+ the main file (same schema, plus a `metadata.suggestion` block —
37
+ see "Suggesting changes" below). Don't edit the main file
38
+ directly; the user reviews and accepts in the canvas or via
28
39
  `archik suggest accept`.
29
40
  3. **After** every edit to a YAML, run `archik validate`. Fix any
30
41
  reported errors before declaring the change done.
@@ -35,13 +46,19 @@ relationship vocabulary, and CLI.
35
46
 
36
47
  ## Suggesting changes (the sidecar workflow)
37
48
 
38
- The `archik.yaml` is the user's source of truth. You don't get to
49
+ The archik file is the user's source of truth. You don't get to
39
50
  mutate it directly. Instead, write your proposed end-state to a
40
- sidecar file:
51
+ sidecar file in the same directory, with the same stem plus
52
+ `.suggested`:
41
53
 
42
54
  ```
43
- architecture.archik.yaml ← truth — user owns it
44
- architecture.archik.suggested.yaml ← your draft proposal
55
+ # new convention
56
+ .archik/main.archik.yaml ← truth — user owns it
57
+ .archik/main.archik.suggested.yaml ← your draft proposal
58
+
59
+ # legacy layout — same naming rule, just at the root
60
+ architecture.archik.yaml
61
+ architecture.archik.suggested.yaml
45
62
  ```
46
63
 
47
64
  The sidecar is a complete, valid Archik document — same schema as the
@@ -53,7 +70,7 @@ version: "1.0"
53
70
  name: My Architecture
54
71
  metadata:
55
72
  suggestion:
56
- from: architecture.archik.yaml
73
+ from: .archik/main.archik.yaml
57
74
  at: 2026-04-26T17:00:00Z
58
75
  note: add Stripe payment flow # optional one-liner
59
76
  nodes:
@@ -112,7 +129,7 @@ this file) when the work you're doing changes the structure:
112
129
 
113
130
  Frame it as: *"This adds a `payments-worker` that reads from the
114
131
  `order-events` queue and writes to `payments-db`. Want me to update
115
- `architecture.archik.yaml` to capture that?"*
132
+ the archik file to capture that?"*
116
133
 
117
134
  ## When to defer
118
135
 
@@ -181,18 +198,71 @@ metadata: # optional
181
198
  notes: # optional, list of free-text notes
182
199
  - "Migrated from monolith in 2024."
183
200
  parentId: platform # optional, must reference a real node
201
+ archikFile: .archik/orders.archik.yaml # optional drill-down
184
202
  metadata: # optional, free record
185
203
  team: fulfillment
186
204
  ```
187
205
 
188
- ## Node kinds (26 total, grouped by purpose)
206
+ ### Cross-file edges (`fromFile` / `toFile`)
207
+
208
+ Edges can also point at a node that lives in a peer file. Set
209
+ `toFile` (or `fromFile`) to that file's relative path; the canvas
210
+ won't draw the edge itself but will hang an "↗" badge on the local
211
+ endpoint, with the target file in the tooltip. Click → navigate.
212
+
213
+ ```yaml
214
+ edges:
215
+ - id: api-pays
216
+ from: api # local node
217
+ to: charge-handler
218
+ toFile: .archik/payments.archik.yaml # peer file
219
+ relationship: http_call
220
+ label: charge
221
+ ```
222
+
223
+ Constraints (the schema enforces them):
224
+
225
+ - The cross-file path follows the same rules as `archikFile` (relative,
226
+ forward slashes, no `..`, ends in `.archik.yaml`).
227
+ - The *local* endpoint id must still match a node in this file.
228
+ - An edge with **both** `fromFile` and `toFile` is rejected — author
229
+ it inside one of the two referenced files instead.
230
+
231
+ ### Drilling into a sub-architecture (`archikFile`)
232
+
233
+ A node can point at *its own* archik file via `archikFile`. The
234
+ canvas shows a small "↓ open" badge on those nodes; clicking it
235
+ loads the linked file and adds a breadcrumb so the user can come
236
+ back. Use it when a component is meaty enough to deserve its own
237
+ diagram (a service with internal modules, a frontend with several
238
+ panes, etc.).
239
+
240
+ Constraints (the schema enforces them):
241
+ - Relative path only — no leading `/`, no Windows drive letter.
242
+ - Must use forward slashes; `..` segments are rejected.
243
+ - Must end in `.archik.yaml` (the suggestion sidecar is derived
244
+ automatically as `<stem>.suggested.yaml` next to it).
245
+ - Cycles aren't checked at parse time (each file validates on its
246
+ own); if you wire a loop the canvas just lets the user navigate
247
+ in and out.
248
+
249
+ Conventional layout: keep sub-files under `.archik/` next to
250
+ `main.archik.yaml`. Example:
251
+
252
+ ```
253
+ .archik/main.archik.yaml # entry point
254
+ .archik/orders.archik.yaml # Orders service internals
255
+ .archik/payments.archik.yaml # Payments service internals
256
+ ```
257
+
258
+ ## Node kinds (27 total, grouped by purpose)
189
259
 
190
260
  | Group | Kinds |
191
261
  | ----------- | --------------------------------- |
192
262
  | Compute | `service`, `function`, `worker`, `agent` |
193
263
  | Data | `database`, `cache`, `vectordb`, `storage` |
194
264
  | Messaging | `queue`, `topic`, `stream` |
195
- | Networking | `gateway`, `cdn` |
265
+ | Networking | `gateway`, `cdn`, `route` |
196
266
  | Hexagonal | `interface`, `adapter`, `port` |
197
267
  | AI / ML | `llm`, `prompt`, `tool` |
198
268
  | Identity | `auth` |
@@ -217,6 +287,7 @@ Picking the right kind:
217
287
  - Kafka / Kinesis stream-of-events → `stream`
218
288
  - API gateway, ingress, edge proxy → `gateway`
219
289
  - CloudFront / Fastly → `cdn`
290
+ - A specific HTTP route / URL endpoint (e.g. `POST /v1/orders`) → `route`
220
291
  - An abstract contract → `interface`
221
292
  - A concrete impl of an interface → `adapter`
222
293
  - A hexagonal-architecture port → `port`
@@ -463,8 +534,10 @@ edges:
463
534
  ## CLI
464
535
 
465
536
  These commands are available globally if archik was installed via
466
- `npm link`. Each defaults to `architecture.archik.yaml` in the current
467
- directory unless given a positional path.
537
+ `npm link`. Without a positional path, each command resolves the
538
+ archik file in this order: `.archik/main.archik.yaml` (preferred),
539
+ then `architecture.archik.yaml` (legacy). If both exist the
540
+ command errors and asks the user to pick one.
468
541
 
469
542
  ```
470
543
  archik validate # schema check (run after every edit)
@@ -492,7 +565,7 @@ archik checkout.
492
565
 
493
566
  ## Verification workflow
494
567
 
495
- After **every** edit you make to `architecture.archik.yaml`:
568
+ After **every** edit you make to the archik file:
496
569
 
497
570
  1. Run `archik validate` — fix any reported errors before declaring
498
571
  the change done. Schema errors include the path of the offending
package/README.md CHANGED
@@ -11,7 +11,7 @@ You write a small YAML file describing your nodes (services, databases, queues,
11
11
  ## Quickstart
12
12
 
13
13
  ```bash
14
- npx archik init # scaffold architecture.archik.yaml in cwd
14
+ npx archik init # scaffold .archik/main.archik.yaml in cwd
15
15
  npx archik start # canvas at http://localhost:5173 (background)
16
16
  npx archik stop # done
17
17
  ```
@@ -52,7 +52,7 @@ No `x` / `y` / `width` — layout is computed by [ELK](https://eclipse.dev/elk/)
52
52
  ## What it gives you
53
53
 
54
54
  - **Live canvas** — `archik dev` (foreground) or `archik start` / `stop` (detached, multi-project).
55
- - **26 node kinds** across compute, data, messaging, hexagonal, AI/ML, identity, observability, cloud, UI, and external.
55
+ - **27 node kinds** across compute, data, messaging, networking, hexagonal, AI/ML, identity, observability, cloud, UI, and external.
56
56
  - **12 relationships** with distinct visual styling — `http_call`, `invokes`, `reads`, `writes`, `publishes`, `subscribes`, `streams_to`, `routes_to`, `implements`, `depends_on`, `has_a`, `uses`.
57
57
  - **Drag-to-connect, multi-select, undo/redo, compact view, themed (dark / light), notes per node, color overrides on edges.**
58
58
  - **CI-ready CLI** — `validate`, `render` (headless SVG), `watch`, `check` (drift between YAML and source dirs).
@@ -77,7 +77,7 @@ So conversations like *"add a payments worker that subscribes to the orders queu
77
77
  ## Commands
78
78
 
79
79
  ```
80
- archik init [path] Scaffold a starter architecture.archik.yaml
80
+ archik init [path] Scaffold a starter .archik/main.archik.yaml
81
81
  (also installs the Claude skill by default)
82
82
  --no-skill skip installing the Claude skill
83
83
 
@@ -102,7 +102,14 @@ archik skill Install the Claude skill for AI editing
102
102
  --force overwrite an existing skill
103
103
  ```
104
104
 
105
- Default path is `architecture.archik.yaml` in the current directory. Single instance per file is enforced via a lock file in `$TMPDIR/archik-cli/`, so parallel `dev` and `start` against the same YAML are rejected with a friendly error.
105
+ Without a `[path]` argument, archik resolves the file in this order:
106
+
107
+ 1. `.archik/main.archik.yaml` (preferred new convention — keeps the project root tidy)
108
+ 2. `architecture.archik.yaml` (legacy root location — still fully supported)
109
+
110
+ If both exist the command errors out and asks you to pick one. New projects get the `.archik/` layout from `archik init`; existing projects keep working without any migration.
111
+
112
+ Single instance per file is enforced via a lock file in `$TMPDIR/archik-cli/`, so parallel `dev` and `start` against the same YAML are rejected with a friendly error.
106
113
 
107
114
  ## Use it in CI
108
115