@alfacapital-tech/c4builder 0.9.0 → 0.10.0-rc.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.
- package/README.MD +3 -2
- package/dist/cli/commands/new.js +3 -0
- package/dist/cli/commands/site.js +11 -4
- package/dist/cli/commands/skills.js +80 -0
- package/dist/cli/dispatch.js +55 -6
- package/dist/cli/update.js +1 -1
- package/dist/core/build.js +3 -7
- package/dist/index.js +9 -1
- package/dist/util/utils.js +9 -3
- package/package.json +2 -1
- package/skills/c4builder/SKILL.md +199 -0
- package/skills/c4builder/references/bpmn.md +138 -0
- package/skills/c4builder/references/config.md +111 -0
- package/skills/c4builder/references/diagrams.md +77 -0
- package/skills/c4builder/references/mermaid.md +78 -0
- package/skills/c4builder/references/plugins.md +68 -0
- package/skills/c4builder-review/SKILL.md +97 -0
- package/skills/c4builder-setup/SKILL.md +130 -0
- package/template/AGENTS.md +13 -2
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: c4builder-setup
|
|
3
|
+
description: Install, update and diagnose c4builder (npm package @alfacapital-tech/c4builder), the CLI that builds C4 / PlantUML / D2 architecture docs into a docsify site or markdown, and install its agent skills into a project. Use when asked to install or upgrade c4builder, when the c4builder command is missing or fails to render diagrams, when switching between the stable and release-candidate channels, or when onboarding onto a repository documented with c4builder. Optional argument - channel rc; default is the stable latest. Idempotent - a re-run only verifies.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# c4builder setup
|
|
7
|
+
|
|
8
|
+
Goal: a `c4builder` that really renders diagrams, and its skills in the working project.
|
|
9
|
+
`c4builder --version` alone proves nothing — the smoke build (step 5) does.
|
|
10
|
+
|
|
11
|
+
**Channel.** `latest` — stable (default); `rc` — release candidates (`X.Y.Z-rc.N`). npm
|
|
12
|
+
dist-tags and Docker image tags carry the same names.
|
|
13
|
+
|
|
14
|
+
Every step: check → fix only what is broken.
|
|
15
|
+
|
|
16
|
+
## 1. Node.js
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
node --version # needs >= 22.17
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Missing or older → agree with the user on how to install a current LTS (nvm, OS package
|
|
23
|
+
manager, official installer); do not pick a method silently. Docker users skip to step 3.
|
|
24
|
+
|
|
25
|
+
## 2. Installed version vs. channel
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
c4builder --version
|
|
29
|
+
npm view @alfacapital-tech/c4builder dist-tags
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`npm view` fails with a network or certificate error → the public registry may be closed in
|
|
33
|
+
this network. An organization mirror is configured in the user's npmrc (`npm config get
|
|
34
|
+
registry` shows the current one) or passed per command with `--registry <url>`; ask the user for
|
|
35
|
+
the address, never guess one. The update check of c4builder and `c4builder update` use the same
|
|
36
|
+
npmrc.
|
|
37
|
+
|
|
38
|
+
Installed version equals the channel's tag → skip step 3.
|
|
39
|
+
Installed version is **newer** than the requested channel (an `rc` while `latest` was
|
|
40
|
+
asked for) → that is a downgrade: never do it silently, confirm with the user — they
|
|
41
|
+
probably want the `rc` channel.
|
|
42
|
+
|
|
43
|
+
## 3. Install / update
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install -g @alfacapital-tech/c4builder@latest # stable
|
|
47
|
+
npm install -g @alfacapital-tech/c4builder@rc # release candidate
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- An installed global CLI is updated with `c4builder update`: it installs the newest version
|
|
51
|
+
(`latest`; on a release candidate the newer of `latest` and `rc`). For a project dependency
|
|
52
|
+
or the Docker image it installs nothing and prints the command to use instead. Switching the
|
|
53
|
+
channel is the `npm install -g` line above.
|
|
54
|
+
- Do not pass `--omit=optional`: the D2 engine (`@terrastruct/d2`) is an optional
|
|
55
|
+
dependency; without it a project with `.d2` files stops with an install hint.
|
|
56
|
+
- `c4builder: command not found` after a successful install → the global npm bin folder
|
|
57
|
+
is not on `PATH` (`npm prefix -g` shows the prefix; the binary lives in its `bin`).
|
|
58
|
+
|
|
59
|
+
**Docker instead of npm** — the image ships Node, a JRE, the PlantUML jar, fonts and D2,
|
|
60
|
+
so steps 1 and 4 are not needed. Mount the project into `/pwd`:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
docker run --rm -v "$PWD:/pwd" ghcr.io/alfacapital-tech/c4builder:latest c4builder
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Image tags: `latest`, `rc`, `X.Y.Z`, `edge` (last master commit). The same image works as a
|
|
67
|
+
CI job image — `c4builder` is on `PATH`.
|
|
68
|
+
|
|
69
|
+
## 4. Java for PlantUML
|
|
70
|
+
|
|
71
|
+
Diagrams are rendered by the bundled PlantUML jar → Java 17+ is needed (`JAVA_HOME` is
|
|
72
|
+
checked first, then `PATH`). Graphviz is **not** needed.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
java -version
|
|
76
|
+
c4builder jre install
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`c4builder jre install` reports a suitable system java and stops; otherwise it downloads a
|
|
80
|
+
private Temurin JRE into the user cache once — tell the user it did. A broken system java
|
|
81
|
+
can be bypassed with `c4builder jre install --force` (downloads even when java is present).
|
|
82
|
+
`c4builder jre info` prints the managed JRE parameters as JSON (Temurin major, cache
|
|
83
|
+
folder) — use it to key a CI cache.
|
|
84
|
+
|
|
85
|
+
Download fails with a certificate error (TLS-intercepting proxy) → set
|
|
86
|
+
`NODE_EXTRA_CA_CERTS` to the proxy's CA bundle; Node reads neither the system store nor
|
|
87
|
+
`SSL_CERT_FILE`.
|
|
88
|
+
|
|
89
|
+
## 5. Smoke build
|
|
90
|
+
|
|
91
|
+
Build the bundled template project in a temporary folder:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
cd "$(mktemp -d)"
|
|
95
|
+
c4builder --new --name smoke -y
|
|
96
|
+
cd smoke
|
|
97
|
+
c4builder
|
|
98
|
+
ls docs/index.html docs/context.svg
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`--new --name smoke -y` creates the project with default settings and no prompts; the
|
|
102
|
+
plain `c4builder` run is a one-off build. Both files listed → Node, CLI, Java/PlantUML and
|
|
103
|
+
the site generator work. `index.html` without `context.svg`, or a non-zero exit code →
|
|
104
|
+
rendering problem: read the error, return to step 4 (Java) or step 3 (D2 hint). Remove the
|
|
105
|
+
temporary folder afterwards.
|
|
106
|
+
|
|
107
|
+
With Docker, run the same two commands through the image: `c4builder --new --name smoke -y`
|
|
108
|
+
in the temporary folder, then the plain build with `smoke` mounted as `/pwd`.
|
|
109
|
+
|
|
110
|
+
## 6. Skills in the working project
|
|
111
|
+
|
|
112
|
+
In the root of the user's project (not the temporary one):
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
c4builder skills
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
It installs the skills of the installed CLI version into `.agents/skills/` (and `.claude/skills/`
|
|
119
|
+
under Claude Code or when `.claude/` exists), replacing only the c4builder skills there; each
|
|
120
|
+
installed `SKILL.md` carries `metadata.generatedBy: <version>`. These are files in the user's
|
|
121
|
+
repository — run it when the user asked for the setup of this project, otherwise ask first. A
|
|
122
|
+
stderr line `~/.claude/skills/c4builder (…) overrides project skills` means a stale personal copy
|
|
123
|
+
(for example from `npx skills add -g`) shadows them: tell the user, remove it only with their
|
|
124
|
+
consent. A project created with `c4builder --new` already has the skills.
|
|
125
|
+
|
|
126
|
+
## Report
|
|
127
|
+
|
|
128
|
+
One short summary: Node version / c4builder version and channel / Java (system or managed
|
|
129
|
+
JRE) / smoke build / skills in the project — each OK or fixed. For working on the diagrams
|
|
130
|
+
themselves, use the `c4builder` skill.
|
package/template/AGENTS.md
CHANGED
|
@@ -34,6 +34,9 @@ updates it.
|
|
|
34
34
|
pinned by `uiLanguage`); batches are always in English.
|
|
35
35
|
4. A stderr line `c4builder <new> is available (current <current>). Run: c4builder update`
|
|
36
36
|
means a newer c4builder is out: tell the user, run `c4builder update` only if they ask.
|
|
37
|
+
5. A stderr line ending with `Ask the user, then run: c4builder skills` means the c4builder skills
|
|
38
|
+
here are missing, outdated or shadowed by a personal copy: tell the user, run `c4builder skills`
|
|
39
|
+
(or remove the personal copy) only if they agree.
|
|
37
40
|
|
|
38
41
|
## Layout
|
|
39
42
|
|
|
@@ -60,8 +63,16 @@ updates it.
|
|
|
60
63
|
|
|
61
64
|
## Agent skills
|
|
62
65
|
|
|
63
|
-
Detailed guidance (project layout, config keys, plugins, installation) as skills for
|
|
64
|
-
Claude Code, Codex, Cursor and other agents
|
|
66
|
+
Detailed guidance (project layout, config keys, plugins, page review, installation) as skills for
|
|
67
|
+
Claude Code, Codex, Cursor and other agents. A project created with `c4builder --new` already has
|
|
68
|
+
them in `.agents/skills/` (and `.claude/skills/` under Claude Code). Install or update them to the
|
|
69
|
+
installed CLI version:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
c4builder skills
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Alternative, also for a personal install (`-g`) and other agents' folders:
|
|
65
76
|
|
|
66
77
|
```bash
|
|
67
78
|
npx skills add AlfaCapital-Tech/C4-Builder/skills
|