archik 0.13.0 → 0.14.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/README.md CHANGED
@@ -41,9 +41,10 @@ Actor → Use case → Slice → Tests on disk → Seq diagram → Nodes → Sou
41
41
  - 🤖 **AI-native** — installable Claude Code skill + 12 slash commands, and an MCP server for Cursor, Windsurf, Copilot, Claude Desktop, Zed
42
42
  - ✅ **Validator, not convention** — schema, cross-file references, `sourcePath` existence, use-case/actor/seq integrity, ECB rules
43
43
  - 🔍 **Traceability** — `archik trace` proves which use case slices are tested and realized; `--fail-on` gates CI
44
- - 🌿 **Git-aware** — `archik diff origin/main` shows what a branch changes architecturally; `archik affected` maps changed files to nodes, slices, and tests
45
- - 🤝 **Team-ready** — semantic merge driver for YAML, node ownership, and governance constraints (architecture fitness rules)
46
- - 🚀 **Fast adoption** — `archik import compose` bootstraps a diagram from docker-compose; `/archik:spawn` mirrors an existing source tree
44
+ - 🌿 **Git-aware** — `archik diff origin/main` shows what a branch changes architecturally; `archik affected` maps changed files to nodes, slices, and tests (`--run` executes them); `archik hooks install` gates every commit
45
+ - 🤝 **Team-ready** — semantic merge driver for YAML, node ownership with CODEOWNERS sync, and governance constraints (architecture fitness rules)
46
+ - 🔬 **Verified at every altitude** — `validate` proves the model is consistent, `drift --edges` proves it matches the code's import graph, `otel check` proves it matches production traffic
47
+ - 🚀 **Fast adoption** — `archik import compose` / `import mermaid` bootstrap a diagram from what you already have; `/archik:spawn` mirrors an existing source tree
47
48
  - 📦 **Zero runtime dependencies** in the published package
48
49
 
49
50
  ## Installation
@@ -86,13 +87,14 @@ Day-to-day:
86
87
  | `/archik:usecase <name>` | A use case with flows, slices, and test paths |
87
88
  | `/archik:trace` | "Are we done?" — the coverage matrix |
88
89
 
89
- **Already containerised?** Skip the blank canvas:
90
+ **Already have docker-compose or Mermaid diagrams?** Skip the blank canvas:
90
91
 
91
92
  ```bash
92
93
  npx archik import compose --out .archik/main.archik.yaml
94
+ npx archik import mermaid docs/architecture.mmd --out .archik/main.archik.yaml
93
95
  ```
94
96
 
95
- Compose services become nodes (postgres → `database`, redis → `cache`, kafka → `stream`, …), build contexts become `sourcePath`s, and `depends_on` becomes edges.
97
+ Compose services become nodes (postgres → `database`, redis → `cache`, kafka → `stream`, …), build contexts become `sourcePath`s, and `depends_on` becomes edges. The Mermaid importer parses the flowchart subset: shaped nodes map to kinds, subgraphs become module parents, arrows become labelled edges.
96
98
 
97
99
  ## The YAML
98
100
 
@@ -135,23 +137,35 @@ Full schema: `npx archik schema` (also `schema seq | uc | actors`).
135
137
  # What am I touching on this branch? Which tests cover it?
136
138
  npx archik affected --since main
137
139
 
140
+ # …and run exactly those tests (vitest/jest/playwright/mocha auto-detected)
141
+ npx archik affected --since main --run
142
+
138
143
  # What does this branch change architecturally?
139
144
  npx archik diff origin/main # add --out diff.svg for the visual
140
145
 
141
146
  # Is the diagram still telling the truth?
142
147
  npx archik validate && npx archik drift
143
148
 
149
+ # Do the EDGES match the code? (TS/JS import-graph verification)
150
+ npx archik drift --edges # shadow + phantom edge detection
151
+
144
152
  # Are we done?
145
153
  npx archik trace
146
154
  ```
147
155
 
148
156
  `affected` walks the chain backwards: changed files → nodes (via `sourcePath`) → use case slices (via tests and sequence-diagram participants) → tests to run — and flags changed files no node or test claims.
149
157
 
158
+ `drift --edges` scans the imports under every node's `sourcePath` and reports **shadow edges** (code imports across nodes with no declared edge) and **phantom edges** (structural edges with no import in either direction). Gate every commit locally with:
159
+
160
+ ```bash
161
+ npx archik hooks install # pre-commit: archik validate
162
+ ```
163
+
150
164
  ## AI integration
151
165
 
152
166
  **Claude Code** (deepest integration): `archik init` installs a skill that enforces one hard rule — *Claude talks to archik only through the CLI*, never by editing YAML directly. Reads go through `archik q`, writes through `archik suggest set`, and you approve every structural change on the canvas.
153
167
 
154
- **Everything else** (MCP): `archik mcp` runs a stdio [Model Context Protocol](https://modelcontextprotocol.io) server exposing the same contract — 20 tools covering schema, queries, trace, validate, drift, affected, and the suggestion lifecycle:
168
+ **Everything else** (MCP): `archik mcp` runs a stdio [Model Context Protocol](https://modelcontextprotocol.io) server exposing the same contract — 20 tools covering schema, queries, trace, validate, drift, affected, and the suggestion lifecycle, plus **resources** (`archik://schema`, `archik://stats`, `archik://trace`, `archik://validate`, `archik://drift`) and **prompts** (`propose-change`, `review-architecture`) that encode the same working loop the Claude Code skill teaches:
155
169
 
156
170
  ```jsonc
157
171
  // .cursor/mcp.json, claude_desktop_config.json, etc.
@@ -172,7 +186,7 @@ npx archik merge-driver --install # once per clone; .gitattributes line is co
172
186
 
173
187
  Both branches added nodes → keep both. One side changed a field → take it. Same field changed differently, or modify-vs-delete → a real conflict, reported precisely.
174
188
 
175
- **Ownership.** `owner: team-billing` on a node answers "who do I talk to": `archik q describe payments-db`, `archik q list --owner team-billing`.
189
+ **Ownership.** `owner: team-billing` on a node answers "who do I talk to": `archik q describe payments-db`, `archik q list --owner team-billing`. And `archik owners sync` writes one CODEOWNERS rule per owned node into a managed block (hand-authored rules untouched), with `archik owners check` as the CI gate so review routing can't drift from the model.
176
190
 
177
191
  **Governance constraints.** Architecture fitness rules, enforced by `archik validate` on every run:
178
192
 
@@ -191,6 +205,17 @@ constraints:
191
205
 
192
206
  Intentional exceptions are grandfathered by id in an `except` list — visible in review, never silent.
193
207
 
208
+ ## Verified against production
209
+
210
+ Map nodes to your tracing backend's service names (`metadata.otelService`, node id as the fallback), export the service-dependency graph, and let archik compare:
211
+
212
+ ```bash
213
+ curl -s "http://jaeger:16686/api/dependencies?endTs=$(date +%s)000&lookback=86400000" > deps.json
214
+ npx archik otel check --graph deps.json
215
+ ```
216
+
217
+ Undeclared production calls — traffic the diagram doesn't admit to — fail the check; declared wire edges that saw no traffic are reported informationally. That completes the truth chain: `validate` proves the model is consistent, `drift --edges` proves it matches the code, `otel check` proves it matches production.
218
+
194
219
  ## CI
195
220
 
196
221
  Plain commands:
@@ -236,14 +261,17 @@ Every command supports `--help`; agent-facing commands support `--json`.
236
261
  | `archik watch` | Re-render SVG on every change |
237
262
  | `archik q <sub>` | Query: `describe` `deps` `dependents` `impact` `list` `edges` `stats` `usecases` `describe-usecase` `actors` `sequences` |
238
263
  | `archik diff <a> [b]` | Diff two files **or git refs**; one arg = that ref vs working tree |
239
- | `archik affected` | Changed files → nodes, slices, tests to run (`--since <ref>`, `--files`) |
264
+ | `archik affected` | Changed files → nodes, slices, tests to run (`--since <ref>`, `--files`, `--run` to execute them) |
240
265
  | `archik trace` | Coverage matrix (`--fail-on partial\|none` for CI) |
241
- | `archik drift` | sourcePath / test-path gaps vs the source tree |
266
+ | `archik drift` | sourcePath / test-path gaps vs the source tree (`--edges` verifies edges vs the TS/JS import graph) |
267
+ | `archik otel check --graph <f>` | Verify edges against a production service-dependency graph |
242
268
  | `archik suggest <sub>` | Suggestion sidecar lifecycle: `show` `set` `accept` `reject` |
243
269
  | `archik alpha <sub>` | Essence alphas: `show`, `promote` (machine-checked), `demote` |
244
- | `archik import compose [file]` | Bootstrap a document from docker-compose |
270
+ | `archik import compose\|mermaid [file]` | Bootstrap a document from docker-compose or a Mermaid flowchart |
245
271
  | `archik merge-driver --install` | Semantic git merge for `*.archik.yaml` |
246
- | `archik mcp` | MCP server over stdio for non-Claude-Code agents |
272
+ | `archik hooks install` | Pre-commit hook running `archik validate` (`--with-drift` optional) |
273
+ | `archik owners sync\|check` | Keep CODEOWNERS in step with node owners |
274
+ | `archik mcp` | MCP server over stdio (tools + resources + prompts) for non-Claude-Code agents |
247
275
  | `archik schema [seq\|uc\|actors]` | Print the document schemas |
248
276
  | `archik upgrade` | Upgrade + refresh installed skill/commands |
249
277