archik 0.8.0 → 0.9.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/evolve.md +10 -2
- package/.claude/commands/archik/spawn.md +25 -4
- package/.claude/commands/archik/suggest.md +10 -1
- package/.claude/skills/archik/SKILL.md +38 -0
- package/dist/cli/archik.mjs +260 -257
- package/dist/ui/assets/index-B5PVNzmR.js +220 -0
- package/dist/ui/assets/index-X8X8JCwV.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/ui/assets/index-28AaAr7I.js +0 -220
- package/dist/ui/assets/index-s04yHjLy.css +0 -1
|
@@ -102,8 +102,16 @@ any file under `.archik/`.
|
|
|
102
102
|
- Preserve every existing node id you keep — only add or remove
|
|
103
103
|
ids, never rename. Renames break diff and require the user to
|
|
104
104
|
manually re-link references in code.
|
|
105
|
-
- Don't drop `description`, `responsibilities`,
|
|
106
|
-
fields the user authored. Carry them over verbatim.
|
|
105
|
+
- Don't drop `description`, `responsibilities`, `notes`, or
|
|
106
|
+
`sourcePath` fields the user authored. Carry them over verbatim.
|
|
107
|
+
- Every new code-bearing node (`service`, `function`, `worker`,
|
|
108
|
+
`module`, `page`, `component`, `store`, `hook`) needs a
|
|
109
|
+
`sourcePath:` that exists on disk — the validator rejects
|
|
110
|
+
fabricated paths. If the refactor proposes a not-yet-built
|
|
111
|
+
module (e.g. extracting a `payments` context that doesn't have
|
|
112
|
+
a directory yet), describe it in prose for the user to
|
|
113
|
+
consider, then either skip that node or move the work to a
|
|
114
|
+
`*.archik.discussion.yaml` file via `--main`.
|
|
107
115
|
- Every change should be motivated by step 3, not by aesthetics.
|
|
108
116
|
|
|
109
117
|
If `suggest set` reports validation errors, re-run with the
|
|
@@ -89,7 +89,28 @@ archik suggest set` stages it.
|
|
|
89
89
|
When unsure, pick the closest fit and add a `notes:` entry
|
|
90
90
|
explaining the inference rather than picking `custom`.
|
|
91
91
|
|
|
92
|
-
6. **
|
|
92
|
+
6. **Attach `sourcePath` to every code-bearing node.** This is
|
|
93
|
+
non-negotiable in a normal/suggested file — the validator rejects
|
|
94
|
+
any `service`, `function`, `worker`, `module`, `page`, `component`,
|
|
95
|
+
`store`, or `hook` without a `sourcePath` that points at an
|
|
96
|
+
existing file or directory. The whole point of `spawn` is "mirror
|
|
97
|
+
the source tree", so the path you used to discover the node is
|
|
98
|
+
exactly what goes into `sourcePath:`. Verify each path with `ls`
|
|
99
|
+
before authoring; do not paste a path you haven't seen on disk.
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
- id: orders-api
|
|
103
|
+
kind: service
|
|
104
|
+
name: Orders API
|
|
105
|
+
stack: Fastify
|
|
106
|
+
sourcePath: services/orders/api # must exist on disk
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
For non-code-bearing kinds (`external`, `database`, `queue`,
|
|
110
|
+
`cloud`, etc.) `sourcePath` is optional — they typically map to
|
|
111
|
+
third-party systems or infra rather than checked-in files.
|
|
112
|
+
|
|
113
|
+
7. **Nest by structure**, mirroring the directories.
|
|
93
114
|
- Top-level grouping dir (e.g. `services/`) → a `module` container.
|
|
94
115
|
- Each child dir → a node with `parentId` pointing at the container.
|
|
95
116
|
- If a node has substantial internal structure (e.g.
|
|
@@ -98,7 +119,7 @@ archik suggest set` stages it.
|
|
|
98
119
|
sub-file. Don't nest beyond two levels in the main file —
|
|
99
120
|
drill-down is what `archikFile` is for.
|
|
100
121
|
|
|
101
|
-
|
|
122
|
+
8. **Wire the edges.** Be conservative — only add an edge when you
|
|
102
123
|
have actual evidence:
|
|
103
124
|
- Cross-package imports → `depends_on` or a more specific
|
|
104
125
|
relationship (`uses`, `invokes`).
|
|
@@ -112,7 +133,7 @@ archik suggest set` stages it.
|
|
|
112
133
|
When in doubt, leave the edge out. The user will add it via
|
|
113
134
|
`/archik:suggest` later.
|
|
114
135
|
|
|
115
|
-
|
|
136
|
+
9. **Stage the draft.** Pipe the YAML straight into `npx archik
|
|
116
137
|
suggest set -` via a heredoc — no temp files, no `/tmp/` paths.
|
|
117
138
|
Sub-files come first because the main draft references them via
|
|
118
139
|
`archikFile`, and `suggest set` validates that those targets
|
|
@@ -172,7 +193,7 @@ archik suggest set` stages it.
|
|
|
172
193
|
c. If `suggest set` reports validation errors, re-run with the
|
|
173
194
|
corrected YAML. Never edit the sidecar by hand.
|
|
174
195
|
|
|
175
|
-
|
|
196
|
+
10. **Tell the user how to review and what's next.** Surface the
|
|
176
197
|
canvas URL plus the natural follow-up:
|
|
177
198
|
- "📝 Initial diagram staged from source tree — open the
|
|
178
199
|
canvas at <URL> and use Review to see the proposed nodes."
|
|
@@ -58,7 +58,16 @@ the contract with the user.
|
|
|
58
58
|
`npx archik suggest set -` via a heredoc — no temp file, no
|
|
59
59
|
`/tmp/` paths. The CLI validates the schema, checks cross-file
|
|
60
60
|
references, stamps `metadata.suggestion`, and atomically writes
|
|
61
|
-
`.archik/main.archik.suggested.yaml
|
|
61
|
+
`.archik/main.archik.suggested.yaml`.
|
|
62
|
+
|
|
63
|
+
**Every new code-bearing node** (`service`, `function`, `worker`,
|
|
64
|
+
`module`, `page`, `component`, `store`, `hook`) must declare a
|
|
65
|
+
`sourcePath:` that you have verified exists on disk. The
|
|
66
|
+
validator rejects fabricated paths. If the source doesn't exist
|
|
67
|
+
yet (you're proposing a not-yet-built component), suggest the
|
|
68
|
+
user run with `--main .archik/<name>.archik.discussion.yaml`
|
|
69
|
+
instead — discussion files relax the sourcePath rule for
|
|
70
|
+
greenfield drafts.
|
|
62
71
|
|
|
63
72
|
```bash
|
|
64
73
|
npx archik suggest set --note "$ARGUMENTS" - <<'YAML'
|
|
@@ -27,6 +27,42 @@ You MUST NOT use `Read`, `Write`, or `Edit` against any file under `.archik/`, a
|
|
|
27
27
|
|
|
28
28
|
If `npx archik` is unreachable (offline, sandboxed, missing), STOP and tell the user. Do NOT fall back to reading or editing YAML by hand.
|
|
29
29
|
|
|
30
|
+
## File modes — pick the right one before authoring
|
|
31
|
+
|
|
32
|
+
Archik files have **three modes**, selected by filename suffix. Validation strictness differs per mode — picking the wrong one will either reject your draft or pollute the canonical architecture with greenfield speculation.
|
|
33
|
+
|
|
34
|
+
| Suffix | Mode | When to use | sourcePath rule |
|
|
35
|
+
| ---------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
36
|
+
| `*.archik.yaml` | **normal** | The canonical architecture of code that exists. | Required for code-bearing kinds; **must exist on disk** (validated). |
|
|
37
|
+
| `*.archik.suggested.yaml` | **suggested**| A pending change to a normal file. Owned by `suggest set`. Becomes normal on `suggest accept`. | Same rules as normal — it'll become normal when accepted. |
|
|
38
|
+
| `*.archik.discussion.yaml` | **discussion**| Greenfield / exploratory drafts: a brand-new project, an "what if we built X?" sketch, an option. | `sourcePath` is **optional**, and may point at paths that don't exist yet. |
|
|
39
|
+
|
|
40
|
+
**Code-bearing kinds** (those that must declare `sourcePath` in normal/suggested files): `service`, `function`, `worker`, `module`, `page`, `component`, `store`, `hook`. Other kinds (`external`, `cloud`, `prompt`, `llm`, `route`, `interface`, `adapter`, `port`, `database`, `cache`, `queue`, `topic`, `stream`, `gateway`, `cdn`, `agent`, `frontend`, `vectordb`, `storage`, `auth`, `observability`, `tool`, `custom`) are exempt.
|
|
41
|
+
|
|
42
|
+
**Picking the mode:**
|
|
43
|
+
- Are you describing real code that exists in this repo? → **normal** (or **suggested** if proposing a change).
|
|
44
|
+
- Are you sketching a not-yet-built system, or proposing an architecture for a new project? → **discussion**. Don't pollute the main file with speculation.
|
|
45
|
+
- Are you adding a `sourcePath` for a node whose code is going to be created soon? → **discussion**, then move to **normal** once the code exists.
|
|
46
|
+
|
|
47
|
+
If `suggest set` rejects your draft with a `sourcePath` error, the right answer is usually one of: (a) fix the path to point at real code, (b) move the work into `*.archik.discussion.yaml`, (c) use a non-code-bearing kind (e.g., `external` for a third-party service), or (d) mark the node `status: proposed` if it's a planned-but-not-built component (see "Lifecycle status" below).
|
|
48
|
+
|
|
49
|
+
## Lifecycle status — `proposed`, `active`, `deprecated`
|
|
50
|
+
|
|
51
|
+
Nodes carry an optional `status` field. Use it to keep the canonical diagram honest about what's built vs. what's planned vs. what's going away — without dropping nodes from the file or shoving them into a discussion sketch.
|
|
52
|
+
|
|
53
|
+
| status | When | sourcePath rule | Visual |
|
|
54
|
+
| ------------------------- | --------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------- |
|
|
55
|
+
| absent / `active` | Built and live (default). | Required for code-bearing kinds, must exist on disk. | Standard solid stroke. |
|
|
56
|
+
| `proposed` | Planned for the next iteration — node belongs in the canonical map but the code isn't there yet. | Optional. If you supply one, it must still exist on disk. | Dashed stroke + reduced opacity. |
|
|
57
|
+
| `deprecated` | Being phased out; reads/writes shouldn't depend on it going forward. | Optional. Same on-disk rule as `proposed` if you set one. | Dashed stroke + amber + strikethrough name. |
|
|
58
|
+
|
|
59
|
+
**`proposed` vs. a discussion file.** They're complementary, not interchangeable:
|
|
60
|
+
|
|
61
|
+
- A `*.archik.discussion.yaml` file is for **whole hypothetical architectures** — a sketch the team is exploring, a diagram for a not-yet-started project, a "what if we built X?" option. The whole file is a draft.
|
|
62
|
+
- `status: proposed` on a node lives inside the **canonical normal file**. The architecture as a whole is real; this one node is the next thing to build. `archik drift` skips proposed nodes so they don't trigger orphan warnings before their code lands.
|
|
63
|
+
|
|
64
|
+
When in doubt: if the user is adding a single planned component to a real project, use `status: proposed` in the normal file. If they're sketching something with no anchor in the existing codebase, use a discussion file.
|
|
65
|
+
|
|
30
66
|
## Slash commands (user-facing entry points)
|
|
31
67
|
|
|
32
68
|
| Command | Purpose |
|
|
@@ -68,6 +104,8 @@ Then `ls -F . src/ services/ packages/ apps/ 2>/dev/null` for the source tree. B
|
|
|
68
104
|
|
|
69
105
|
When the user asks "where would I add X?", you should already have the answer because you ran the queries above.
|
|
70
106
|
|
|
107
|
+
**Every code-bearing node you propose for a normal/suggested file must declare a `sourcePath` that you have verified exists on disk** (e.g. `ls src/payments/worker.ts` before authoring `sourcePath: src/payments/worker.ts`). The validator rejects fabricated paths — and the rejection is non-negotiable, exactly so hallucinated nodes can't slip into the canonical architecture. If the source doesn't exist yet, draft in `*.archik.discussion.yaml` first.
|
|
108
|
+
|
|
71
109
|
## Authoring drafts (sidecar workflow)
|
|
72
110
|
|
|
73
111
|
When work introduces, removes, or rewires components, you stage a proposal as a sidecar via the CLI. The user reviews on the canvas and accepts / rejects.
|