archik 0.1.0 → 0.1.3

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
@@ -1,106 +1,138 @@
1
1
  # Archik
2
2
 
3
- A JSON-native architecture diagram tool. The YAML file is the source of
4
- truth; the canvas is a stateless projection of it. Both humans and LLMs
5
- edit the same file. Layout is computed by ELK; coordinates never appear
6
- in the YAML.
3
+ > An architecture diagram tool where the file is the source of truth — and Claude can edit it alongside you.
7
4
 
8
- ## Install once, use in every project
5
+ <p align="center">
6
+ <img src="docs/hero.svg" alt="Sample Archik diagram of an LLM-assisted support system" width="780">
7
+ </p>
9
8
 
10
- Inside this repo:
9
+ You write a small YAML file describing your nodes (services, databases, queues, agents, LLMs, …) and the edges between them. Archik gives you a live browser canvas, a CLI for CI, and an installable AI skill so Claude Code understands your architecture file the same way you do — no proprietary format, no coordinates in the YAML, no manual layout.
10
+
11
+ ## Quickstart
11
12
 
12
13
  ```bash
13
- npm install
14
- npm link # exposes the `archik` binary on your PATH
14
+ npx archik init # scaffold architecture.archik.yaml in cwd
15
+ npx archik start # canvas at http://localhost:5173 (background)
16
+ npx archik stop # done
15
17
  ```
16
18
 
17
- `npm link` creates a symlink from your global node binaries to
18
- `bin/archik.js` in this directory. The bin script resolves through the
19
- symlink (via `realpath`), spawns `tsx` against `src/cli/index.ts`, and
20
- runs the CLI without a separate build step.
19
+ That's the whole onboarding. The canvas saves edits straight back to the YAML; the file is the truth, the canvas is a projection.
20
+
21
+ ## What you write
22
+
23
+ ```yaml
24
+ version: "1.0"
25
+ name: Support Hub
26
+ nodes:
27
+ - id: api
28
+ kind: service
29
+ name: Support API
30
+ stack: Go + Postgres
31
+ - id: agent
32
+ kind: agent
33
+ name: Support Agent
34
+ description: Drafts replies, escalates risky ones.
35
+ - id: claude
36
+ kind: llm
37
+ name: Claude
38
+ edges:
39
+ - id: api-agent
40
+ from: api
41
+ to: agent
42
+ relationship: invokes
43
+ - id: agent-claude
44
+ from: agent
45
+ to: claude
46
+ relationship: invokes
47
+ label: draft reply
48
+ ```
21
49
 
22
- If you ever want to remove it:
50
+ No `x` / `y` / `width` — layout is computed by [ELK](https://eclipse.dev/elk/) on every render. The schema rejects coordinates so diffs stay meaningful.
23
51
 
24
- ```bash
25
- npm unlink -g archik
26
- ```
52
+ ## What it gives you
53
+
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.
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
+ - **Drag-to-connect, multi-select, undo/redo, compact view, themed (dark / light), notes per node, color overrides on edges.**
58
+ - **CI-ready CLI** — `validate`, `render` (headless SVG), `watch`, `check` (drift between YAML and source dirs).
59
+ - **AI skill** — `archik skill --user` installs a Claude Code skill that teaches Claude the schema, the protocol, and the verification workflow.
27
60
 
28
- ## Per-project workflow
61
+ ## For Claude Code & other LLMs
29
62
 
30
- The YAML lives in your target project, not here. From any project
31
- directory:
63
+ The whole reason Archik uses YAML instead of a binary format: **the file is the shared map between you and the model**. Run:
32
64
 
33
65
  ```bash
34
- cd ~/projects/my-app
35
- archik init # only the first time — scaffolds architecture.archik.yaml
36
- archik dev # opens the live canvas in your browser
66
+ archik skill --user # install once into ~/.claude/skills
37
67
  ```
38
68
 
39
- `archik dev` starts the Vite dev server from Archik's install dir, but
40
- points it at the current working directory's `architecture.archik.yaml`
41
- via the `ARCHIK_DOC_PATH` env var. The browser canvas loads, the file
42
- watcher sees your edits, the inspector saves back to your project's
43
- file. Nothing about Archik lives inside your project.
69
+ …and Claude Code in any project gets the right vocabulary automatically. The skill defines a 3-rule protocol:
44
70
 
45
- ## All commands
71
+ 1. **Read** `architecture.archik.yaml` before answering structural questions.
72
+ 2. **Propose** YAML updates whenever new work introduces or rewires components.
73
+ 3. **Run `archik validate`** after every edit to fail fast on schema errors.
74
+
75
+ So conversations like *"add a payments worker that subscribes to the orders queue"* end with both the code change **and** the matching YAML diff — kept in sync without anyone having to remember.
76
+
77
+ ## Commands
46
78
 
47
79
  ```
48
- archik init Scaffold a starter architecture.archik.yaml
49
- archik dev [path] Open the canvas in your browser (foreground)
50
- --port <n> dev server port
51
- --host <addr> bind to host
52
- --no-open don't auto-open the browser
80
+ archik init [path] Scaffold a starter architecture.archik.yaml
81
+ --skill also install the Claude skill into ./.claude/skills
82
+
83
+ archik dev [path] Open the canvas in your browser (foreground, Ctrl+C to stop)
53
84
  archik start [path] Same as dev, but detached — prompt returns immediately
54
- --port <n> dev server port
55
- --host <addr> bind to host
56
85
  archik stop [path] Stop the background server started with `archik start`
57
- archik status List running archik instances (across all projects)
58
- archik validate [path] Validate a document against the schema
86
+ archik status List running archik instances across all projects
87
+ (dev / start share these flags)
88
+ --port <n> dev server port (default 5173)
89
+ --host <addr> bind address (default 127.0.0.1)
90
+ --no-open don't auto-open the browser
91
+
92
+ archik validate [path] Validate against the schema (CI-friendly, exit code 1 on error)
59
93
  archik render [path] Render to a self-contained SVG file
60
94
  --out <file> output path (default: diagram.svg)
61
95
  --theme <name> "dark" (default) or "light"
62
- archik watch [path] Re-render to SVG on file changes
63
- archik check [path] Drift detection — flag nodes without source dirs
64
- ```
96
+ archik watch [path] Re-render to SVG on every file change (Ctrl+C to stop)
97
+ archik check [path] Drift detection — flag nodes without matching source dirs
65
98
 
66
- Use `archik dev` for an interactive session you'll Ctrl+C to end, and
67
- `archik start` / `archik stop` when you want the canvas running in the
68
- background while you keep working in the same terminal. State is kept in
69
- `$TMPDIR/archik-cli/` keyed by the YAML path, so you can run several
70
- projects' canvases at once.
99
+ archik skill Install the Claude skill for AI editing
100
+ --user install into ~/.claude/skills (all projects)
101
+ --force overwrite an existing skill
102
+ ```
71
103
 
72
- Default path is `architecture.archik.yaml` in the current directory.
104
+ 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.
73
105
 
74
- ## CI usage
106
+ ## Use it in CI
75
107
 
76
108
  ```bash
77
- # Fail the build if the diagram has schema errors:
109
+ # Fail the build on schema errors
78
110
  archik validate
79
111
 
80
- # Generate an SVG of your architecture for the docs:
112
+ # Generate a committable SVG of your architecture for the docs site
81
113
  archik render --theme light --out docs/architecture.svg
82
114
 
83
- # Compare nodes to source dirs and warn about drift:
115
+ # Warn when nodes don't have a matching source folder under src/, services/, packages/, or apps/
84
116
  archik check
85
117
  ```
86
118
 
87
- ## Directory layout (this repo)
119
+ ## Schema
88
120
 
121
+ The full schema reference (every node kind, every relationship, common patterns, hard rules) lives in the AI skill. After installing it locally:
122
+
123
+ ```bash
124
+ archik skill --user
125
+ $EDITOR ~/.claude/skills/archik.md
89
126
  ```
90
- src/
91
- domain/ Pure schema + commands (no React, no ELK)
92
- layout/ ELK adapter behind a LayoutEngine interface
93
- render/ Pure SVG renderer (DiagramSvg, per-kind shapes, edges)
94
- io/ YAML/JSON, exporters, file adapter, live-reload
95
- ui/ React app — toolbar, inspectors, modals, popovers
96
- cli/ The `archik` binary you just installed
97
- vite/ Vite plugin that watches + serves the YAML over HTTP/WS
98
- .claude/skills/ archik.md — schema + patterns for AI editors
99
- ```
100
127
 
101
- ## For AI editors
128
+ Or read it directly in this repo: [`.claude/skills/archik.md`](.claude/skills/archik.md).
129
+
130
+ ## Design notes
131
+
132
+ - The YAML is the only persistent truth. The canvas is a stateless projection that reloads on every file change (live-reload via SSE).
133
+ - Layout is non-negotiable: ELK lays out every render. Putting an `x` / `y` / `width` field at any level fails schema validation. No more "the diagram drifted because someone dragged a box."
134
+ - The published npm package ships only the bundled binary — no source files, no build tooling. Zero runtime dependencies.
135
+
136
+ ## License
102
137
 
103
- `.claude/skills/archik.md` documents the schema, all 26 node kinds, all
104
- 12 relationships, common editing patterns, and the verification
105
- workflow. Claude Code in this repo (or any project that copies the
106
- skill) gets the right vocabulary automatically.
138
+ MIT © [Bashar](https://github.com/bacharSalleh)