@radicaltools/cli 0.2.0 → 0.3.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/README.md +353 -33
- package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
- package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
- package/dist/hub-catalogue/concern/concern-api-evolution.radical +1174 -0
- package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
- package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
- package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
- package/dist/hub-catalogue/concern/concern-architecture-style.radical +1268 -0
- package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
- package/dist/hub-catalogue/concern/concern-authentication.radical +895 -0
- package/dist/hub-catalogue/concern/concern-authorization.radical +1686 -0
- package/dist/hub-catalogue/concern/concern-availability.radical +1028 -0
- package/dist/hub-catalogue/concern/concern-backend-stack.radical +1037 -0
- package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1560 -0
- package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
- package/dist/hub-catalogue/concern/concern-capacity.radical +915 -0
- package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
- package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
- package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
- package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
- package/dist/hub-catalogue/concern/concern-communication-style.radical +1508 -0
- package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
- package/dist/hub-catalogue/concern/concern-data-consistency.radical +1112 -0
- package/dist/hub-catalogue/concern/concern-data-store.radical +1282 -0
- package/dist/hub-catalogue/concern/concern-decomposition.radical +1318 -0
- package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
- package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
- package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
- package/dist/hub-catalogue/concern/concern-deployment.radical +1203 -0
- package/dist/hub-catalogue/concern/concern-encryption.radical +1318 -0
- package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
- package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
- package/dist/hub-catalogue/concern/concern-frontend-stack.radical +1647 -0
- package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
- package/dist/hub-catalogue/concern/concern-infrastructure.radical +2183 -0
- package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1116 -0
- package/dist/hub-catalogue/concern/concern-messaging.radical +973 -0
- package/dist/hub-catalogue/concern/concern-module-boundaries.radical +867 -0
- package/dist/hub-catalogue/concern/concern-observability.radical +997 -0
- package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
- package/dist/hub-catalogue/concern/concern-personal-data.radical +1949 -0
- package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
- package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1445 -0
- package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
- package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
- package/dist/hub-catalogue/concern/concern-secrets.radical +1284 -0
- package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
- package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
- package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
- package/dist/hub-catalogue/concern/concern-supply-chain.radical +1386 -0
- package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
- package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
- package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +1440 -0
- package/dist/hub-catalogue/concern/concern-test-strategy.radical +1212 -0
- package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
- package/dist/index.js +12712 -7144
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -18,6 +18,100 @@ Or run it without a global install:
|
|
|
18
18
|
npx @radicaltools/cli check path/to/model
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
## radical setup
|
|
22
|
+
|
|
23
|
+
Connects your coding agents to a model folder, step by step:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx @radicaltools/cli setup # asks for the folder, the agents and the hooks
|
|
27
|
+
npx @radicaltools/cli setup architecture --client claude-code --client codex --yes
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
No Node.js yet? Start from an empty folder with the launcher, which finds Node.js or
|
|
31
|
+
downloads it, then runs the CLI:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
mkdir my-system && cd my-system
|
|
35
|
+
curl -fsSLO https://radical.tools/radical.sh && sh radical.sh setup # macOS, Linux
|
|
36
|
+
curl.exe -fsSLO https://radical.tools/radical.cmd && radical.cmd setup # Windows
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The launcher (`radical.sh`, `radical.cmd`) takes Node.js 20.11 or later with `npx`
|
|
40
|
+
beside it from the `PATH`, else from `~/.radical/node`. With neither, it asks (or takes
|
|
41
|
+
`--yes`) and downloads the latest Node.js 24 for the platform from nodejs.org into
|
|
42
|
+
`~/.radical/node`, checked against its SHA-256 sum. It runs any command:
|
|
43
|
+
`sh radical.sh check architecture`, and `sh radical.sh mcp --folder …` runs the MCP
|
|
44
|
+
server without asking anything. `radical setup` run through it pins its version line
|
|
45
|
+
(`default_version`, `DEFAULT_VERSION` in `radical.cmd`) to the CLI's, makes `radical.sh`
|
|
46
|
+
executable, and has every agent and the git hooks start the server and the CLI through
|
|
47
|
+
it, so they find the same Node.js. Commit it with the model; `RADICAL_VERSION=latest sh
|
|
48
|
+
radical.sh setup` moves the project to the latest release. `RADICAL_HOME` and
|
|
49
|
+
`RADICAL_NODE_MIRROR` change where Node.js goes and where it comes from.
|
|
50
|
+
|
|
51
|
+
1. **Node**: checks the version (20.11 or later).
|
|
52
|
+
2. **Folder**: a missing or empty folder becomes a new model (`--metamodel radical`, the
|
|
53
|
+
default, or `c4`); a folder that holds other files and no `radical.md` is refused.
|
|
54
|
+
3. **Agents**: adds the MCP server for the folder to each agent's configuration, pinned
|
|
55
|
+
to the CLI's version (`@radicaltools/mcp@<version>`), keeping every other entry.
|
|
56
|
+
|
|
57
|
+
| Agent | File | Names |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| Claude Code (`claude-code`) | `.mcp.json` at the top of the repository | `npx`, the folder by its path from the top |
|
|
60
|
+
| VS Code (`vscode`) | `.vscode/mcp.json` at the top of the repository | `npx`, `${workspaceFolder}/<folder>` |
|
|
61
|
+
| Claude Desktop (`claude-desktop`) | `claude_desktop_config.json` in the app's settings folder | `npx` by its absolute path, node's directory on `PATH`, the absolute folder |
|
|
62
|
+
| Cursor (`cursor`) | `~/.cursor/mcp.json` | as Claude Desktop |
|
|
63
|
+
| Codex (`codex`) | `~/.codex/config.toml` (or `$CODEX_HOME`) | as Claude Desktop, in `[mcp_servers.<name>]` |
|
|
64
|
+
|
|
65
|
+
The project files are meant to be committed, so teammates get the server too. A user
|
|
66
|
+
file is copied to `<file>.bak` before it changes. An entry that is already there is
|
|
67
|
+
left alone; another server of the same name is replaced only when you say so
|
|
68
|
+
(`--name <name>` adds this one beside it).
|
|
69
|
+
4. **Hooks**: `radical hooks install` for the folder, so Studio's *Changes on branch*
|
|
70
|
+
has the branch's base (`--no-hooks` leaves them alone). Outside a git repository it
|
|
71
|
+
asks, in a terminal, to start one in the working directory first.
|
|
72
|
+
5. **Check**: the checks of `--status` for the folder (`--no-check` skips them).
|
|
73
|
+
|
|
74
|
+
In a terminal each question shows its default; press Enter to take it. Without a
|
|
75
|
+
terminal, or with `--yes`, it asks nothing: the folder `architecture`, the agents it
|
|
76
|
+
finds installed, the hooks in a repository. `--dry-run` prints every change and writes
|
|
77
|
+
nothing. Exit status: 0 set up and checked, 1 a step or a check failed, 2 it could not run.
|
|
78
|
+
|
|
79
|
+
**Several models.** One server serves one folder. To connect more models to the same
|
|
80
|
+
agents, run setup once per folder with a name of its own:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
radical setup payments/architecture --name radical-payments
|
|
84
|
+
radical setup billing/architecture --name radical-billing
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The agent sees each server's tools under its name (in Claude Code
|
|
88
|
+
`mcp__radical-payments__get_model_summary`), so they never collide; a name that says
|
|
89
|
+
which model it is helps the agent pick the right one. Without `--name` the second setup
|
|
90
|
+
finds `radical` taken and replaces it, asking first in a terminal (with `--yes`, it does not ask). Keep one server per folder: two
|
|
91
|
+
servers writing the same folder get in each other's way (Studio on the same folder is
|
|
92
|
+
fine).
|
|
93
|
+
|
|
94
|
+
### radical setup --status
|
|
95
|
+
|
|
96
|
+
Checks what an agent needs to work on a model folder, and changes nothing:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
npx @radicaltools/cli setup --status architecture
|
|
100
|
+
sh radical.sh setup --status # through the launcher
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
It reports Node and the CLI's version; whether the folder reads as a model and the git
|
|
104
|
+
hooks save its base; every agent configuration that holds a Radical MCP server, with the
|
|
105
|
+
folder it serves, a command or folder that is not there, and a server pinned to another
|
|
106
|
+
version than the CLI's; then it starts each server configured for the folder, with the
|
|
107
|
+
agent's own command, arguments and environment, and asks it for `get_model_summary`
|
|
108
|
+
over stdio. `--no-start` only reads the configurations; `--timeout <s>` (default 120,
|
|
109
|
+
as npx may download the package first) limits each server. Without a folder it checks
|
|
110
|
+
the working directory, or `architecture` in it, when it holds a model, else every Radical
|
|
111
|
+
server configured. `--status` takes no option that would change something.
|
|
112
|
+
Exit status: 0 nothing is broken (warnings, marked `!`, allowed), 1 something is
|
|
113
|
+
(marked `✗`), 2 it could not run.
|
|
114
|
+
|
|
21
115
|
## radical export confluence
|
|
22
116
|
|
|
23
117
|
Export a particular wiki view from a Radical Markdown model folder. The full
|
|
@@ -39,8 +133,8 @@ Find a view and preview it without Confluence credentials:
|
|
|
39
133
|
|
|
40
134
|
```sh
|
|
41
135
|
radical export confluence architecture --list-views
|
|
42
|
-
radical export confluence architecture --view "
|
|
43
|
-
radical export confluence architecture --view "
|
|
136
|
+
radical export confluence architecture --view "Specification" --format html --output wiki-preview.html
|
|
137
|
+
radical export confluence architecture --view "Specification" --format markdown --output wiki.md
|
|
44
138
|
```
|
|
45
139
|
|
|
46
140
|
`--view` accepts an exact view ID or an unambiguous name. `--format storage`
|
|
@@ -54,7 +148,7 @@ To publish to Confluence Cloud, set `CONFLUENCE_URL`, `CONFLUENCE_EMAIL` and
|
|
|
54
148
|
`CONFLUENCE_API_TOKEN` in your shell or CI secret environment, then run:
|
|
55
149
|
|
|
56
150
|
```sh
|
|
57
|
-
radical export confluence architecture --view "
|
|
151
|
+
radical export confluence architecture --view "Specification" --publish --space-id 123 --parent-id 456
|
|
58
152
|
```
|
|
59
153
|
|
|
60
154
|
Use the numeric space ID, not its key. `--parent-id` is optional. `--url` can
|
|
@@ -84,7 +178,7 @@ To move an existing managed export under another page, pass its root page
|
|
|
84
178
|
ID with `--parent-id`; its children follow it:
|
|
85
179
|
|
|
86
180
|
```sh
|
|
87
|
-
radical export confluence architecture --view "
|
|
181
|
+
radical export confluence architecture --view "Specification" --publish --page-id 789 --parent-id 456
|
|
88
182
|
```
|
|
89
183
|
|
|
90
184
|
Use a destination parent in the same Confluence space. Changing the view's
|
|
@@ -152,9 +246,17 @@ radical hooks install path/to/model
|
|
|
152
246
|
|
|
153
247
|
Adds one marked line to the repository's `post-checkout`, `post-commit`,
|
|
154
248
|
`post-merge` and `post-rewrite` hooks that runs `radical diff <folder> --save-base --quiet`, so
|
|
155
|
-
the base Studio compares with follows the branch checked out
|
|
156
|
-
|
|
157
|
-
|
|
249
|
+
the base Studio compares with follows the branch checked out, and then
|
|
250
|
+
`radical check <folder> --from-ci --quiet --detach`, which fetches the test
|
|
251
|
+
results of CI for the commit checked out in the background (a command of its
|
|
252
|
+
own, its output closed: a CLI built before `--from-ci` still saves the
|
|
253
|
+
base, and without the GitHub CLI nothing is fetched). The line goes
|
|
254
|
+
right after the hook's `#!` line, where an `exit` or `exec` further down
|
|
255
|
+
cannot skip it; what the hooks already do stays. Each model folder of the
|
|
256
|
+
repository has a line of its own, a second install adds nothing (or brings
|
|
257
|
+
the line up to date when the CLI or node moved), and the line never fails
|
|
258
|
+
the git command. A hook written in another language than sh (Python, say)
|
|
259
|
+
is left as it is: the command exits 2 and says what to call from it.
|
|
158
260
|
It runs the CLI that installed it, with the `node` on the PATH, else the one
|
|
159
261
|
that installed it. In this repository `npm run hooks` builds the CLI,
|
|
160
262
|
installs the hooks for `architecture/` and saves its base once.
|
|
@@ -175,10 +277,11 @@ Checks one model folder and prints what it finds:
|
|
|
175
277
|
- **completeness**: requirements verified by a scenario, satisfied by an
|
|
176
278
|
element, derived from a need; needs with requirements; accepted ADRs with
|
|
177
279
|
a fitness function and their date, context, decision and consequences;
|
|
178
|
-
fitness functions linked and
|
|
280
|
+
fitness functions linked; scenarios and fitness functions that state their
|
|
281
|
+
checks, in conditions that read.
|
|
179
282
|
|
|
180
|
-
With test reports it also checks that the tests the model names passed
|
|
181
|
-
below). `radical check --list-rules` lists every rule and every metric a goal can
|
|
283
|
+
With test reports it also checks that the tests the model names passed, and
|
|
284
|
+
with measurements that the values it holds to were met (see below). `radical check --list-rules` lists every rule and every metric a goal can
|
|
182
285
|
be set for. It reads the files only and never writes the model.
|
|
183
286
|
|
|
184
287
|
Exit status: 0 no errors (warnings allowed), 1 errors, 2 the check could not
|
|
@@ -203,7 +306,9 @@ rules by id, or one kind of metamodel issue by `metamodel/<code>`:
|
|
|
203
306
|
With `max`, up to that many findings pass as warnings and one more fails the
|
|
204
307
|
check, so an existing model can adopt a rule before every gap is closed.
|
|
205
308
|
`--ratchet` lowers each `max` to the count found now and writes the config
|
|
206
|
-
back; it never raises one.
|
|
309
|
+
back; it never raises one. A rule that did not run keeps its `max`: the
|
|
310
|
+
`test-*` rules without `--report` (the output marks them `–` and "not run"),
|
|
311
|
+
every rule but the folder's when the folder is no model.
|
|
207
312
|
|
|
208
313
|
### Goals
|
|
209
314
|
|
|
@@ -243,14 +348,15 @@ describe block, since a fitness function that names a whole file or directory
|
|
|
243
348
|
|
|
244
349
|
### Tests and evidence
|
|
245
350
|
|
|
246
|
-
A scenario or a fitness function
|
|
247
|
-
property, one per line
|
|
351
|
+
A scenario or a fitness function says what checks it in its `metrics`
|
|
352
|
+
property, one condition per line. A test that has to pass is named as Vitest
|
|
353
|
+
and Playwright print it:
|
|
248
354
|
|
|
249
355
|
```
|
|
250
|
-
apps/cli/src/cli.test.ts › radical check › prints the result as JSON
|
|
251
|
-
apps/e2e/tests/studio/forge.spec.ts › Forge files each stage into its view
|
|
252
|
-
packages/layout/tests/geometry.test.ts › createBatchPlacer
|
|
253
|
-
apps/e2e/tests
|
|
356
|
+
test(apps/cli/src/cli.test.ts › radical check › prints the result as JSON) passed
|
|
357
|
+
test(apps/e2e/tests/studio/forge.spec.ts › Forge files each stage into its view) passed
|
|
358
|
+
test(packages/layout/tests/geometry.test.ts › createBatchPlacer) passed
|
|
359
|
+
test(apps/e2e/tests) passed
|
|
254
360
|
```
|
|
255
361
|
|
|
256
362
|
An id names the test whose title it ends, otherwise every test in the
|
|
@@ -277,8 +383,9 @@ is an error; one that was skipped, or whose file no report has, a warning.
|
|
|
277
383
|
The text output sums up how many requirements, scenarios, ADRs and fitness
|
|
278
384
|
functions the reports verify. `--evidence` writes that status per element
|
|
279
385
|
as JSON (`verified`, `broken`, `unverified` for requirements and ADRs;
|
|
280
|
-
`passed`, `failed`, `not-run`, `no-
|
|
281
|
-
functions); it never writes into the
|
|
386
|
+
`passed`, `failed`, `stale`, `not-run`, `no-checks` for scenarios and
|
|
387
|
+
fitness functions, with each condition's outcome); it never writes into the
|
|
388
|
+
model.
|
|
282
389
|
|
|
283
390
|
With `--report` the command also keeps the test cases it read in the model
|
|
284
391
|
folder's `.radical/test-results.json` (out of git, like the rest of
|
|
@@ -288,6 +395,217 @@ quality and Implementation show the result by dimension, and Settings edit
|
|
|
288
395
|
`check.json` (goals, severities, baselines), marking a change that loosens
|
|
289
396
|
the gate.
|
|
290
397
|
|
|
398
|
+
### Test results from CI
|
|
399
|
+
|
|
400
|
+
```sh
|
|
401
|
+
radical check path/to/model --from-ci
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
reads the test reports of CI instead of `--report`. Test results never go
|
|
405
|
+
into git, since a commit cannot hold the results of its own tests; CI runs
|
|
406
|
+
every suite on every pull request and keeps the reports as artifacts. The
|
|
407
|
+
command finds, with the GitHub CLI (`gh`, signed in), the nearest commit in
|
|
408
|
+
HEAD's first-parent history that a completed GitHub Actions run tested; a
|
|
409
|
+
commit merged from a pull request (a squash merge has no run of its own)
|
|
410
|
+
stands for the pull request's head. For each artifact it takes the latest
|
|
411
|
+
completed run that kept it, downloads it, and reads the `.json` and `.xml`
|
|
412
|
+
test reports in it. Which artifacts hold reports is set in `check.json`:
|
|
413
|
+
|
|
414
|
+
```json
|
|
415
|
+
{ "ci": { "artifacts": ["test-reports", "e2e-report"] } }
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
(every artifact of the run without it). The results are kept in
|
|
419
|
+
`.radical/test-results.json` with the commit they stand for, the runs, when
|
|
420
|
+
each ran and how many commits HEAD is past it, which the Inspector's *Tests*
|
|
421
|
+
chip shows; the same runs a second time download nothing. Results read with
|
|
422
|
+
`--report` at that commit or a later one are kept, and checked. `--quiet`
|
|
423
|
+
prints nothing; `--detach` starts the check in the background and returns,
|
|
424
|
+
as the git hooks of `radical hooks install` do after every checkout, commit,
|
|
425
|
+
pull and rebase.
|
|
426
|
+
|
|
427
|
+
### Measured values
|
|
428
|
+
|
|
429
|
+
A condition can also hold a value to a threshold, which a sensor measures:
|
|
430
|
+
|
|
431
|
+
```
|
|
432
|
+
api.latency.p95{env=staging} <= 300 ms
|
|
433
|
+
workspaces.exit_code == 0
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
`<metric>{<labels>} <op> <number> [unit]`, with `< <= > >= == !=`. It is
|
|
437
|
+
judged by the latest measurement of the metric whose labels include the
|
|
438
|
+
condition's; units of one kind convert (ms and s, KB and MB). The element's
|
|
439
|
+
`combine` says how its conditions make its status (`all`, the default;
|
|
440
|
+
`any`; `at least N`), and `max_age` (`7d`, `12h`) how old a measurement may
|
|
441
|
+
be: an older one is stale, and never passes.
|
|
442
|
+
|
|
443
|
+
`radical check` reads the measurements kept in the model folder's
|
|
444
|
+
`.radical/measurements.json`, and with `--metrics <file|dir>` the
|
|
445
|
+
radical-metrics/1 files another job wrote, which it adds there. A condition
|
|
446
|
+
that does not hold is an error (`metric-failed`); a stale one
|
|
447
|
+
(`metric-stale`) or one nothing measured (`metric-not-measured`) a warning;
|
|
448
|
+
a line that reads as no condition, or a unit that does not convert, an error
|
|
449
|
+
(`metric-invalid`).
|
|
450
|
+
|
|
451
|
+
## radical sense
|
|
452
|
+
|
|
453
|
+
Measures with a sensor adapter and keeps the values beside the model, for
|
|
454
|
+
the conditions above. A sensor only measures: it takes no threshold and
|
|
455
|
+
exits 0 whatever it measured, 2 when it could not measure.
|
|
456
|
+
|
|
457
|
+
```sh
|
|
458
|
+
radical sense command --name workspaces -- node tools/check-workspaces.mjs
|
|
459
|
+
radical sense json k6-summary.json --metric 'api.latency.p95=/metrics/http_req_duration/p(95)@ms' --label env=staging
|
|
460
|
+
radical sense json coverage-summary.json --metric 'coverage.lines=total.lines.pct@%' --out reports/metrics/coverage.json
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
- `command [--name <metric>] -- <command…>`: the command's exit code
|
|
464
|
+
(`<metric>.exit_code`) and duration in seconds (`<metric>.duration`).
|
|
465
|
+
- `json <file> --metric <metric>=<path>[@<unit>]`: a number from a JSON file,
|
|
466
|
+
by dotted keys with `[index]` or a JSON pointer starting with `/`.
|
|
467
|
+
- `--folder <dir>`: the model folder (default: the working directory); the
|
|
468
|
+
values go into its `.radical/measurements.json`, the latest of each metric
|
|
469
|
+
and labels.
|
|
470
|
+
- `--out <file>`: a radical-metrics/1 file instead, for `radical check
|
|
471
|
+
--metrics` in another job.
|
|
472
|
+
- `--label k=v` labels every measurement (conditions match labels);
|
|
473
|
+
`--context k=v` says where it was measured (a commit, a run).
|
|
474
|
+
|
|
475
|
+
An adapter for another tool is one module in `src/sensors/` with the
|
|
476
|
+
`SensorAdapter` interface, one line in `src/sensors/registry.ts` and a fixture
|
|
477
|
+
of its tool's real output; `src/sensors/contract.test.ts` runs every adapter on
|
|
478
|
+
its fixture and checks that it writes valid radical-metrics/1 and takes no
|
|
479
|
+
threshold. Pull requests welcome.
|
|
480
|
+
|
|
481
|
+
## radical fuzz
|
|
482
|
+
|
|
483
|
+
Runs a project's fuzz files (Radical Crucible): tests that do random sequences
|
|
484
|
+
of actions to a system and check its rules after every step. `crucible.json`
|
|
485
|
+
in the working directory lists them, and the folder findings go to:
|
|
486
|
+
|
|
487
|
+
```json
|
|
488
|
+
{
|
|
489
|
+
"findings": "crucible/findings",
|
|
490
|
+
"fuzz": [{ "file": "packages/ui/tests/invariants.test.ts", "cwd": "packages/ui" }]
|
|
491
|
+
}
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
Each file runs with `npx vitest run <file>` in its `cwd`, or with its own
|
|
495
|
+
`command` (a list). Paths are from the folder `crucible.json` is in.
|
|
496
|
+
|
|
497
|
+
```sh
|
|
498
|
+
radical fuzz # plan ci: each file's fixed seeds and runs
|
|
499
|
+
radical fuzz night # a random seed and 2000 runs of each world
|
|
500
|
+
radical fuzz --world bookstore --runs 300 --seed 7
|
|
501
|
+
radical fuzz night --survey # record each new failure as a finding
|
|
502
|
+
radical fuzz --replay F-0003 # run a finding again
|
|
503
|
+
radical fuzz --report reports # a Vitest JSON report per file, for radical check
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
`--survey` goes on after each failure and writes each one whose signature (its
|
|
507
|
+
rule, its last action and the shape of what differs, with the ids taken out) no
|
|
508
|
+
finding has yet as `crucible/findings/F-NNNN.md`, status `open`, with the
|
|
509
|
+
world, seed, path and length that replay it, the steps and what differs.
|
|
510
|
+
`--no-known` lets the fuzz files' known failures filter nothing, `--no-shrink`
|
|
511
|
+
reports the first failure as found.
|
|
512
|
+
|
|
513
|
+
A fuzz file is written with the engine, `@radical/crucible`, which is not
|
|
514
|
+
published yet: so far the fuzz files are this repository's own
|
|
515
|
+
(`packages/ui/tests/invariants.test.ts`). It reports a test case per world and
|
|
516
|
+
one per world and rule (`on the bookstore model: undoRestores holds`), which a
|
|
517
|
+
scenario or a fitness function can name in its Metrics.
|
|
518
|
+
|
|
519
|
+
Exit status: 0 every file passed, 1 one failed, 2 radical fuzz could not run.
|
|
520
|
+
|
|
521
|
+
## radical harden
|
|
522
|
+
|
|
523
|
+
Turns a finding into a test bound to the model (Radical Crucible).
|
|
524
|
+
|
|
525
|
+
```sh
|
|
526
|
+
radical harden F-0003 --scenario "Undo is exact"
|
|
527
|
+
radical harden --gate F-0003
|
|
528
|
+
radical harden --gate --test "apps/e2e/tests/studio/views.spec.ts › a view keeps its places" --base main --runs 5
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
A fuzz finding is hardened by its own steps: the finding is marked `hardened`,
|
|
532
|
+
and its fuzz file replays the shrunk sequence as the test
|
|
533
|
+
`<fuzz file> › F-0003 stays fixed: <title>`, once and without the known
|
|
534
|
+
failures, so it fails until the bug is fixed. The command prints that test as a
|
|
535
|
+
`test(…) passed` line for the scenario's Metrics and keeps the scenario's name
|
|
536
|
+
in the finding; it does not change the model's files.
|
|
537
|
+
|
|
538
|
+
`--gate` checks a test before it is bound: with the source files changed since
|
|
539
|
+
the base (default: the merge base with `origin/main`) set back to it, the test
|
|
540
|
+
must fail; put back, it must pass; and it must pass `--runs` runs at once
|
|
541
|
+
(default 5). Tests, findings and `crucible.json` are not set back, and the
|
|
542
|
+
working tree is left as it was (files are copied aside, never stashed), also
|
|
543
|
+
when the gate is interrupted: Ctrl+C, `kill` or a closed terminal stops the
|
|
544
|
+
test, puts the changed files back and ends with exit status 2. A test
|
|
545
|
+
runs through the runner `crucible.json` gives for its folder, else with
|
|
546
|
+
`npx vitest run <file> -t <name>` in the file's package:
|
|
547
|
+
|
|
548
|
+
```json
|
|
549
|
+
{ "runners": [{ "files": "apps/e2e/", "cwd": "apps/e2e",
|
|
550
|
+
"command": ["npx", "playwright", "test", "{file}", "-g", "{name}", "--reporter", "line"],
|
|
551
|
+
"build": [["npm", "run", "build:web"], ["npm", "run", "build:hub"]],
|
|
552
|
+
"repeat": ["npx", "playwright", "test", "{file}", "-g", "{name}",
|
|
553
|
+
"--repeat-each", "{runs}", "--workers", "{runs}", "--reporter", "line"] }] }
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
A runner's `build` (commands run from `crucible.json`'s folder) is made before
|
|
557
|
+
the run without the fix and before the run with it, so a test of a build (an
|
|
558
|
+
e2e test) runs on what the files are at each step; its `repeat` (with
|
|
559
|
+
`{runs}`) makes the runs at once one run of that command, for runs that
|
|
560
|
+
cannot go side by side (web servers on fixed ports). `--test` takes the
|
|
561
|
+
test's title with its describe blocks (`"<file> › <describe> › <name>"`);
|
|
562
|
+
Vitest and Playwright get the parts joined by spaces, as they match them.
|
|
563
|
+
|
|
564
|
+
Exit status: 0 done (the gate passed), 1 the gate failed, 2 radical harden
|
|
565
|
+
could not run or was interrupted.
|
|
566
|
+
|
|
567
|
+
## radical explore
|
|
568
|
+
|
|
569
|
+
An exploratory round (Radical Crucible): agents look for bugs no test
|
|
570
|
+
describes, each run in its own area. `radical explore` prepares the round and
|
|
571
|
+
checks what comes back; a coding agent's session starts the agents.
|
|
572
|
+
|
|
573
|
+
```sh
|
|
574
|
+
radical explore prepare --runs 5 --areas "layout under edits; milestones and undo"
|
|
575
|
+
radical explore verify 70 "f1-row.mjs 2" "f2-undo.mjs"
|
|
576
|
+
radical explore record .crucible/rounds/round-70-74/run-70/REPORT.md
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
`prepare` builds the project once, copies what the runs need into
|
|
580
|
+
`.crucible/rounds/round-<from>-<to>/build`, and gives each run a folder, its
|
|
581
|
+
ports (`<ports>+NN`, `+100+NN`, `+200+NN`) and a `PROMPT.md` with its area;
|
|
582
|
+
`BRIEF.md` names the commit, the commits and the model elements changed since
|
|
583
|
+
the last round (by area), the open findings, the setup, the rules and the
|
|
584
|
+
report's JSON form. `--since`, `--from` and `--no-build` change what it
|
|
585
|
+
counts from, the first run's number and whether it builds. The brief asks
|
|
586
|
+
that scripts name no absolute path (they find the repository by walking up to
|
|
587
|
+
`crucible.json`), since a finding's script is copied out of the round.
|
|
588
|
+
`verify` serves a run's build on its ports (each server `serve` lists, on the
|
|
589
|
+
run's port it names: `app`, `hub` or `other`), runs its scripts from its
|
|
590
|
+
folder and stops the servers. `record` writes a report's findings (`open`, or
|
|
591
|
+
`question`) with copies of their scripts and of the screenshot each names,
|
|
592
|
+
and warns about a copied script that names the repository's or the round's
|
|
593
|
+
absolute paths.
|
|
594
|
+
|
|
595
|
+
```json
|
|
596
|
+
{ "explore": {
|
|
597
|
+
"rounds": ".crucible/rounds", "brief": "docs/EXPLORATORY-TESTING.md",
|
|
598
|
+
"known": ["docs/IMPROVEMENTS.md"], "model": "architecture",
|
|
599
|
+
"build": [["npm", "run", "build:web"]],
|
|
600
|
+
"copy": { "renderer": "apps/studio/out/renderer" },
|
|
601
|
+
"serve": [
|
|
602
|
+
{ "cwd": "apps/studio", "command": ["npx", "vite", "preview", "--port", "{port}", "--strictPort", "--outDir", "{build}/renderer"] },
|
|
603
|
+
{ "cwd": "apps/hub", "command": ["npx", "vite", "preview", "--port", "{hubPort}", "--strictPort", "--outDir", "{build}/hub"], "port": "hub" } ],
|
|
604
|
+
"ports": 4500, "rules": ["…"] } }
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
Exit status: 0 done, 2 radical explore could not run.
|
|
608
|
+
|
|
291
609
|
## Publishing (maintainers)
|
|
292
610
|
|
|
293
611
|
The public npm package is `@radicaltools/cli`. Its private `@radical/*`
|
|
@@ -323,11 +641,11 @@ workspace, `prepublishOnly` runs the type check, unit tests and package check;
|
|
|
323
641
|
already verified tarball uploads that exact archive. The monorepo root and
|
|
324
642
|
the shared workspaces remain private.
|
|
325
643
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
644
|
+
The CLI shares one product version with the MCP server, the Desktop app and
|
|
645
|
+
the VS Code extension: set it for all of them with `npm run release` (see
|
|
646
|
+
*Releasing* in the root README), never in this workspace alone. `radical
|
|
647
|
+
--version` prints it, with the commit it was built from unless the build is the
|
|
648
|
+
release tagged `v<version>`.
|
|
331
649
|
|
|
332
650
|
Each package version can be published only once. After the first publish,
|
|
333
651
|
the npm organization's team settings can grant the `developers` team
|
|
@@ -356,14 +674,16 @@ Configure a new publisher when a release is ready: its first successful
|
|
|
356
674
|
publish must happen within two days; a dry run does not validate it.
|
|
357
675
|
See [npm's Trusted Publishing instructions](https://docs.npmjs.com/trusted-publishers/).
|
|
358
676
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
published once, so bump past any version already published locally.
|
|
364
|
-
|
|
365
|
-
The workflow type-checks and tests the monorepo, installs and checks the CLI
|
|
677
|
+
A release tag `v<version>` (see *Releasing* in the root README) starts the
|
|
678
|
+
workflow for the CLI and the MCP server together. It checks that the tagged
|
|
679
|
+
commit is on `main` and that the four released packages carry the tag's
|
|
680
|
+
version, type-checks and tests the monorepo, installs and checks the CLI
|
|
366
681
|
tarball outside the repository, uploads that archive as an artifact, and
|
|
367
|
-
publishes the same archive with provenance
|
|
368
|
-
|
|
682
|
+
publishes the same archive with provenance, on the dist-tag `next` for a
|
|
683
|
+
pre-release. A package version can only be published once; a version npm
|
|
684
|
+
already has is skipped, so a rerun publishes what is left.
|
|
685
|
+
|
|
686
|
+
To validate the archive without a release, use **Actions → Publish to npm →
|
|
687
|
+
Run workflow**, select `main`, choose **package: cli**, and leave **dry-run**
|
|
688
|
+
enabled. With **dry-run** disabled it publishes, but only from `main`.
|
|
369
689
|
|