archik 0.6.0 → 0.6.2

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.
@@ -44,6 +44,41 @@ The sections below are the detailed reference behind these three
44
44
  rules — *when* to consult, *when* to propose, schema, taxonomy,
45
45
  relationship vocabulary, and CLI.
46
46
 
47
+ ## Grounding (do this once per session, before structural work)
48
+
49
+ The archik file tells you *what* exists. The source tree tells you
50
+ *where* it lives. The mapping between the two is the whole reason
51
+ the file is valuable — without it you just know there's "an Orders
52
+ service" but not where to go to read or edit it. So:
53
+
54
+ 1. **Read the archik file in full.** Use `archik validate` first to
55
+ find the canonical path (it prefers `.archik/main.archik.yaml`,
56
+ falls back to `architecture.archik.yaml`). Then `cat` it —
57
+ don't grep, you want the whole shape in your head.
58
+ 2. **List the source tree.** A single `ls` of the top-level project
59
+ directory plus the most likely source roots is usually enough:
60
+ `ls -F . src/ services/ packages/ apps/ 2>/dev/null`. If the
61
+ project has sub-architectures under `.archik/`, list those too
62
+ (`ls .archik/`) — they're how the user breaks the diagram up by
63
+ component.
64
+ 3. **Build the mapping in your head.** Most projects follow one of
65
+ two patterns: each top-level archik node id matches a folder
66
+ under `src/` (or `services/` / `packages/`), or the `stack` /
67
+ `description` field hints at the location. Note the mismatches
68
+ — those are the places where moving a folder will outgrow the
69
+ diagram, and where new code is most likely to need a YAML
70
+ update too.
71
+ 4. **Run `archik check`** if it's available — it walks `src/`,
72
+ `services/`, `packages/`, and `apps/` and flags nodes that
73
+ don't have a matching folder (and folders that look like
74
+ services but aren't in the diagram). Cheap drift detector;
75
+ worth running before any non-trivial edit.
76
+
77
+ When the user asks "where would I add X?" or "what's the right
78
+ place for Y?", you should already have the answer because step 3
79
+ gave it to you. When they ask "what would `archik render` show?",
80
+ the answer is in step 1.
81
+
47
82
  ## Suggesting changes (the sidecar workflow)
48
83
 
49
84
  The archik file is the user's source of truth. You don't get to
@@ -82,9 +117,14 @@ edges:
82
117
  Once you've written the sidecar:
83
118
 
84
119
  * The canvas shows a **📝 Suggestion pending** banner with `Review`,
85
- `Accept`, `Reject` buttons. Review opens a colour-coded SVG diff in
86
- a new tab; Accept renames the sidecar over the main file; Reject
87
- deletes the sidecar.
120
+ `Accept`, `Reject` buttons. Review **toggles an in-canvas overlay
121
+ on the same page** — added nodes/edges get green frames, removed
122
+ ones get red dashed frames and dim out, changed ones get amber
123
+ frames, and each gets a `+` / `−` / `~` badge. The button label
124
+ flips to "Hide diff" while the overlay is on; click again to drop
125
+ back to the regular view. Accept renames the sidecar over the main
126
+ file; Reject deletes the sidecar. Both also clear review mode so
127
+ the canvas snaps back to the new truth.
88
128
  * From the terminal: `archik suggest show | accept | reject`.
89
129
 
90
130
  If the user has no canvas open and asks "apply it", run
@@ -555,7 +595,7 @@ archik dev # open the live editor in the browser (foregr
555
595
  archik start # same as dev, detached — returns the prompt
556
596
  archik stop # stop the background server
557
597
  archik status # list running archik instances
558
- archik init # scaffold a starter file
598
+ archik init # scaffold a starter file (also installs this skill into ./.claude/skills/archik/ unless --no-skill)
559
599
  archik skill # install/refresh this skill in cwd
560
600
  ```
561
601
 
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Friendly post-install banner. npm 10+ stopped echoing the package
4
+ * version ("added 1 package in 3s" is all the user sees), so this
5
+ * gives them a confirmation, the version they got, and where to go
6
+ * next. Stays quiet under CI / non-TTY / inside a parent npm install
7
+ * so it doesn't pollute logs.
8
+ */
9
+ import { readFileSync } from "node:fs";
10
+ import { dirname, resolve } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+
13
+ // Skip when noise would hurt more than help.
14
+ if (
15
+ process.env["CI"] !== undefined ||
16
+ process.env["ARCHIK_NO_BANNER"] !== undefined ||
17
+ !process.stdout.isTTY ||
18
+ // Inside `npm install` / yarn / pnpm of a host project — only
19
+ // show the banner for global installs and direct local installs.
20
+ process.env["npm_config_global"] !== "true" &&
21
+ process.env["npm_command"] === "install" &&
22
+ process.env["npm_config_save"] !== undefined
23
+ ) {
24
+ process.exit(0);
25
+ }
26
+
27
+ const here = dirname(fileURLToPath(import.meta.url));
28
+ const pkg = JSON.parse(
29
+ readFileSync(resolve(here, "..", "package.json"), "utf8"),
30
+ );
31
+
32
+ const enabled = process.env["NO_COLOR"] === undefined;
33
+ const c = (open, close) => (s) =>
34
+ enabled ? `\x1b[${open}m${s}\x1b[${close}m` : s;
35
+ const bold = c("1", "22");
36
+ const dim = c("2", "22");
37
+ const cyan = c("36", "39");
38
+ const green = c("32", "39");
39
+ const magenta = c("35", "39");
40
+
41
+ const line = dim("─".repeat(56));
42
+ const tick = bold(green("✓"));
43
+ const arrow = cyan("▸");
44
+
45
+ process.stdout.write(
46
+ [
47
+ "",
48
+ line,
49
+ ` ${tick} ${bold(magenta("archik"))} ${dim("v" + pkg.version)} ${dim("installed")}`,
50
+ line,
51
+ ` ${arrow} ${bold("archik init")} ${dim("scaffold .archik/main.archik.yaml")}`,
52
+ ` ${arrow} ${bold("archik dev")} ${dim("open the live canvas in your browser")}`,
53
+ ` ${arrow} ${bold("archik --help")} ${dim("full command list")}`,
54
+ "",
55
+ ` ${dim("Docs: https://npmjs.com/package/archik")}`,
56
+ "",
57
+ ].join("\n"),
58
+ );