@radicaltools/cli 0.2.0 → 0.3.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.
Files changed (29) hide show
  1. package/README.md +237 -22
  2. package/dist/hub-catalogue/concern/concern-api-evolution.radical +935 -0
  3. package/dist/hub-catalogue/concern/concern-architecture-style.radical +1112 -0
  4. package/dist/hub-catalogue/concern/concern-authentication.radical +685 -0
  5. package/dist/hub-catalogue/concern/concern-authorization.radical +1464 -0
  6. package/dist/hub-catalogue/concern/concern-availability.radical +804 -0
  7. package/dist/hub-catalogue/concern/concern-backend-stack.radical +1118 -0
  8. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1304 -0
  9. package/dist/hub-catalogue/concern/concern-capacity.radical +802 -0
  10. package/dist/hub-catalogue/concern/concern-communication-style.radical +1202 -0
  11. package/dist/hub-catalogue/concern/concern-data-consistency.radical +1081 -0
  12. package/dist/hub-catalogue/concern/concern-data-store.radical +960 -0
  13. package/dist/hub-catalogue/concern/concern-decomposition.radical +1143 -0
  14. package/dist/hub-catalogue/concern/concern-deployment.radical +952 -0
  15. package/dist/hub-catalogue/concern/concern-encryption.radical +1055 -0
  16. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +1340 -0
  17. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1151 -0
  18. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1079 -0
  19. package/dist/hub-catalogue/concern/concern-messaging.radical +940 -0
  20. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +864 -0
  21. package/dist/hub-catalogue/concern/concern-observability.radical +1048 -0
  22. package/dist/hub-catalogue/concern/concern-personal-data.radical +1434 -0
  23. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1153 -0
  24. package/dist/hub-catalogue/concern/concern-secrets.radical +1026 -0
  25. package/dist/hub-catalogue/concern/concern-supply-chain.radical +1312 -0
  26. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +1306 -0
  27. package/dist/hub-catalogue/concern/concern-test-strategy.radical +1193 -0
  28. package/dist/index.js +9204 -5242
  29. package/package.json +5 -3
package/README.md CHANGED
@@ -18,6 +18,85 @@ 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
+ ### radical setup --status
80
+
81
+ Checks what an agent needs to work on a model folder, and changes nothing:
82
+
83
+ ```sh
84
+ npx @radicaltools/cli setup --status architecture
85
+ sh radical.sh setup --status # through the launcher
86
+ ```
87
+
88
+ It reports Node and the CLI's version; whether the folder reads as a model and the git
89
+ hooks save its base; every agent configuration that holds a Radical MCP server, with the
90
+ folder it serves, a command or folder that is not there, and a server pinned to another
91
+ version than the CLI's; then it starts each server configured for the folder, with the
92
+ agent's own command, arguments and environment, and asks it for `get_model_summary`
93
+ over stdio. `--no-start` only reads the configurations; `--timeout <s>` (default 120,
94
+ as npx may download the package first) limits each server. Without a folder it checks
95
+ the working directory, or `architecture` in it, when it holds a model, else every Radical
96
+ server configured. `--status` takes no option that would change something.
97
+ Exit status: 0 nothing is broken (warnings, marked `!`, allowed), 1 something is
98
+ (marked `✗`), 2 it could not run.
99
+
21
100
  ## radical export confluence
22
101
 
23
102
  Export a particular wiki view from a Radical Markdown model folder. The full
@@ -39,8 +118,8 @@ Find a view and preview it without Confluence credentials:
39
118
 
40
119
  ```sh
41
120
  radical export confluence architecture --list-views
42
- radical export confluence architecture --view "Tes confluence" --format html --output wiki-preview.html
43
- radical export confluence architecture --view "Tes confluence" --format markdown --output wiki.md
121
+ radical export confluence architecture --view "Specification" --format html --output wiki-preview.html
122
+ radical export confluence architecture --view "Specification" --format markdown --output wiki.md
44
123
  ```
45
124
 
46
125
  `--view` accepts an exact view ID or an unambiguous name. `--format storage`
@@ -54,7 +133,7 @@ To publish to Confluence Cloud, set `CONFLUENCE_URL`, `CONFLUENCE_EMAIL` and
54
133
  `CONFLUENCE_API_TOKEN` in your shell or CI secret environment, then run:
55
134
 
56
135
  ```sh
57
- radical export confluence architecture --view "Tes confluence" --publish --space-id 123 --parent-id 456
136
+ radical export confluence architecture --view "Specification" --publish --space-id 123 --parent-id 456
58
137
  ```
59
138
 
60
139
  Use the numeric space ID, not its key. `--parent-id` is optional. `--url` can
@@ -84,7 +163,7 @@ To move an existing managed export under another page, pass its root page
84
163
  ID with `--parent-id`; its children follow it:
85
164
 
86
165
  ```sh
87
- radical export confluence architecture --view "Tes confluence" --publish --page-id 789 --parent-id 456
166
+ radical export confluence architecture --view "Specification" --publish --page-id 789 --parent-id 456
88
167
  ```
89
168
 
90
169
  Use a destination parent in the same Confluence space. Changing the view's
@@ -152,9 +231,13 @@ radical hooks install path/to/model
152
231
 
153
232
  Adds one marked line to the repository's `post-checkout`, `post-commit`,
154
233
  `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. What the hooks
156
- already do stays, a second install adds nothing (or brings the line up to
157
- date when the CLI or node moved), and the line never fails the git command.
234
+ the base Studio compares with follows the branch checked out. The line goes
235
+ right after the hook's `#!` line, where an `exit` or `exec` further down
236
+ cannot skip it; what the hooks already do stays. Each model folder of the
237
+ repository has a line of its own, a second install adds nothing (or brings
238
+ the line up to date when the CLI or node moved), and the line never fails
239
+ the git command. A hook written in another language than sh (Python, say)
240
+ is left as it is: the command exits 2 and says what to call from it.
158
241
  It runs the CLI that installed it, with the `node` on the PATH, else the one
159
242
  that installed it. In this repository `npm run hooks` builds the CLI,
160
243
  installs the hooks for `architecture/` and saves its base once.
@@ -203,7 +286,9 @@ rules by id, or one kind of metamodel issue by `metamodel/<code>`:
203
286
  With `max`, up to that many findings pass as warnings and one more fails the
204
287
  check, so an existing model can adopt a rule before every gap is closed.
205
288
  `--ratchet` lowers each `max` to the count found now and writes the config
206
- back; it never raises one.
289
+ back; it never raises one. A rule that did not run keeps its `max`: the
290
+ `test-*` rules without `--report` (the output marks them `–` and "not run"),
291
+ every rule but the folder's when the folder is no model.
207
292
 
208
293
  ### Goals
209
294
 
@@ -288,6 +373,134 @@ quality and Implementation show the result by dimension, and Settings edit
288
373
  `check.json` (goals, severities, baselines), marking a change that loosens
289
374
  the gate.
290
375
 
376
+ ## radical fuzz
377
+
378
+ Runs a project's fuzz files (Radical Crucible): tests that do random sequences
379
+ of actions to a system and check its rules after every step. `crucible.json`
380
+ in the working directory lists them, and the folder findings go to:
381
+
382
+ ```json
383
+ {
384
+ "findings": "crucible/findings",
385
+ "fuzz": [{ "file": "packages/ui/tests/invariants.test.ts", "cwd": "packages/ui" }]
386
+ }
387
+ ```
388
+
389
+ Each file runs with `npx vitest run <file>` in its `cwd`, or with its own
390
+ `command` (a list). Paths are from the folder `crucible.json` is in.
391
+
392
+ ```sh
393
+ radical fuzz # plan ci: each file's fixed seeds and runs
394
+ radical fuzz night # a random seed and 2000 runs of each world
395
+ radical fuzz --world bookstore --runs 300 --seed 7
396
+ radical fuzz night --survey # record each new failure as a finding
397
+ radical fuzz --replay F-0003 # run a finding again
398
+ radical fuzz --report reports # a Vitest JSON report per file, for radical check
399
+ ```
400
+
401
+ `--survey` goes on after each failure and writes each one whose signature (its
402
+ rule, its last action and the shape of what differs, with the ids taken out) no
403
+ finding has yet as `crucible/findings/F-NNNN.md`, status `open`, with the
404
+ world, seed, path and length that replay it, the steps and what differs.
405
+ `--no-known` lets the fuzz files' known failures filter nothing, `--no-shrink`
406
+ reports the first failure as found.
407
+
408
+ A fuzz file is written with the engine, `@radical/crucible`, which is not
409
+ published yet: so far the fuzz files are this repository's own
410
+ (`packages/ui/tests/invariants.test.ts`). It reports a test case per world and
411
+ one per world and rule (`on the bookstore model: undoRestores holds`), which a
412
+ scenario or a fitness function can name in its Tests.
413
+
414
+ Exit status: 0 every file passed, 1 one failed, 2 radical fuzz could not run.
415
+
416
+ ## radical harden
417
+
418
+ Turns a finding into a test bound to the model (Radical Crucible).
419
+
420
+ ```sh
421
+ radical harden F-0003 --scenario "Undo is exact"
422
+ radical harden --gate F-0003
423
+ radical harden --gate --test "apps/e2e/tests/studio/views.spec.ts › a view keeps its places" --base main --runs 5
424
+ ```
425
+
426
+ A fuzz finding is hardened by its own steps: the finding is marked `hardened`,
427
+ and its fuzz file replays the shrunk sequence as the test
428
+ `<fuzz file> › F-0003 stays fixed: <title>`, once and without the known
429
+ failures, so it fails until the bug is fixed. The command prints that test id
430
+ for the scenario's Tests and keeps the scenario's name in the finding; it does
431
+ not change the model's files.
432
+
433
+ `--gate` checks a test before it is bound: with the source files changed since
434
+ the base (default: the merge base with `origin/main`) set back to it, the test
435
+ must fail; put back, it must pass; and it must pass `--runs` runs at once
436
+ (default 5). Tests, findings and `crucible.json` are not set back, and the
437
+ working tree is left as it was (files are copied aside, never stashed), also
438
+ when the gate is interrupted: Ctrl+C, `kill` or a closed terminal stops the
439
+ test, puts the changed files back and ends with exit status 2. A test
440
+ runs through the runner `crucible.json` gives for its folder, else with
441
+ `npx vitest run <file> -t <name>` in the file's package:
442
+
443
+ ```json
444
+ { "runners": [{ "files": "apps/e2e/", "cwd": "apps/e2e",
445
+ "command": ["npx", "playwright", "test", "{file}", "-g", "{name}", "--reporter", "line"],
446
+ "build": [["npm", "run", "build:web"], ["npm", "run", "build:hub"]],
447
+ "repeat": ["npx", "playwright", "test", "{file}", "-g", "{name}",
448
+ "--repeat-each", "{runs}", "--workers", "{runs}", "--reporter", "line"] }] }
449
+ ```
450
+
451
+ A runner's `build` (commands run from `crucible.json`'s folder) is made before
452
+ the run without the fix and before the run with it, so a test of a build (an
453
+ e2e test) runs on what the files are at each step; its `repeat` (with
454
+ `{runs}`) makes the runs at once one run of that command, for runs that
455
+ cannot go side by side (web servers on fixed ports). `--test` takes the
456
+ test's title with its describe blocks (`"<file> › <describe> › <name>"`);
457
+ Vitest and Playwright get the parts joined by spaces, as they match them.
458
+
459
+ Exit status: 0 done (the gate passed), 1 the gate failed, 2 radical harden
460
+ could not run or was interrupted.
461
+
462
+ ## radical explore
463
+
464
+ An exploratory round (Radical Crucible): agents look for bugs no test
465
+ describes, each run in its own area. `radical explore` prepares the round and
466
+ checks what comes back; a coding agent's session starts the agents.
467
+
468
+ ```sh
469
+ radical explore prepare --runs 5 --areas "layout under edits; milestones and undo"
470
+ radical explore verify 70 "f1-row.mjs 2" "f2-undo.mjs"
471
+ radical explore record .crucible/rounds/round-70-74/run-70/REPORT.md
472
+ ```
473
+
474
+ `prepare` builds the project once, copies what the runs need into
475
+ `.crucible/rounds/round-<from>-<to>/build`, and gives each run a folder, its
476
+ ports (`<ports>+NN`, `+100+NN`, `+200+NN`) and a `PROMPT.md` with its area;
477
+ `BRIEF.md` names the commit, the commits and the model elements changed since
478
+ the last round (by area), the open findings, the setup, the rules and the
479
+ report's JSON form. `--since`, `--from` and `--no-build` change what it
480
+ counts from, the first run's number and whether it builds. The brief asks
481
+ that scripts name no absolute path (they find the repository by walking up to
482
+ `crucible.json`), since a finding's script is copied out of the round.
483
+ `verify` serves a run's build on its ports (each server `serve` lists, on the
484
+ run's port it names: `app`, `hub` or `other`), runs its scripts from its
485
+ folder and stops the servers. `record` writes a report's findings (`open`, or
486
+ `question`) with copies of their scripts and of the screenshot each names,
487
+ and warns about a copied script that names the repository's or the round's
488
+ absolute paths.
489
+
490
+ ```json
491
+ { "explore": {
492
+ "rounds": ".crucible/rounds", "brief": "docs/EXPLORATORY-TESTING.md",
493
+ "known": ["docs/IMPROVEMENTS.md"], "model": "architecture",
494
+ "build": [["npm", "run", "build:web"]],
495
+ "copy": { "renderer": "apps/studio/out/renderer" },
496
+ "serve": [
497
+ { "cwd": "apps/studio", "command": ["npx", "vite", "preview", "--port", "{port}", "--strictPort", "--outDir", "{build}/renderer"] },
498
+ { "cwd": "apps/hub", "command": ["npx", "vite", "preview", "--port", "{hubPort}", "--strictPort", "--outDir", "{build}/hub"], "port": "hub" } ],
499
+ "ports": 4500, "rules": ["…"] } }
500
+ ```
501
+
502
+ Exit status: 0 done, 2 radical explore could not run.
503
+
291
504
  ## Publishing (maintainers)
292
505
 
293
506
  The public npm package is `@radicaltools/cli`. Its private `@radical/*`
@@ -323,11 +536,11 @@ workspace, `prepublishOnly` runs the type check, unit tests and package check;
323
536
  already verified tarball uploads that exact archive. The monorepo root and
324
537
  the shared workspaces remain private.
325
538
 
326
- For later releases, bump the CLI version and lockfile before publishing:
327
-
328
- ```sh
329
- npm version patch -w @radicaltools/cli --no-git-tag-version
330
- ```
539
+ The CLI shares one product version with the MCP server, the Desktop app and
540
+ the VS Code extension: set it for all of them with `npm run release` (see
541
+ *Releasing* in the root README), never in this workspace alone. `radical
542
+ --version` prints it, with the commit it was built from unless the build is the
543
+ release tagged `v<version>`.
331
544
 
332
545
  Each package version can be published only once. After the first publish,
333
546
  the npm organization's team settings can grant the `developers` team
@@ -356,14 +569,16 @@ Configure a new publisher when a release is ready: its first successful
356
569
  publish must happen within two days; a dry run does not validate it.
357
570
  See [npm's Trusted Publishing instructions](https://docs.npmjs.com/trusted-publishers/).
358
571
 
359
- Push and merge these changes first. In GitHub **Actions → Publish to npm
360
- → Run workflow**, select `main`, choose **package: cli**, and leave **dry-run**
361
- enabled to validate and upload the npm archive without releasing. After a reviewed version bump,
362
- run with **dry-run** disabled to publish. A package version can only be
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
572
+ A release tag `v<version>` (see *Releasing* in the root README) starts the
573
+ workflow for the CLI and the MCP server together. It checks that the tagged
574
+ commit is on `main` and that the four released packages carry the tag's
575
+ version, type-checks and tests the monorepo, installs and checks the CLI
366
576
  tarball outside the repository, uploads that archive as an artifact, and
367
- publishes the same archive with provenance. Publishing is refused outside
368
- `main`; branch pushes and desktop release tags do not publish the CLI.
577
+ publishes the same archive with provenance, on the dist-tag `next` for a
578
+ pre-release. A package version can only be published once; a version npm
579
+ already has is skipped, so a rerun publishes what is left.
580
+
581
+ To validate the archive without a release, use **Actions → Publish to npm →
582
+ Run workflow**, select `main`, choose **package: cli**, and leave **dry-run**
583
+ enabled. With **dry-run** disabled it publishes, but only from `main`.
369
584