@radicaltools/cli 0.3.0 → 0.3.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.
Files changed (57) hide show
  1. package/README.md +332 -44
  2. package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
  3. package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
  4. package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
  5. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
  6. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
  7. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
  8. package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
  9. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  10. package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
  11. package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
  12. package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
  13. package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
  14. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
  15. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  16. package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
  17. package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
  18. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
  19. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
  20. package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
  21. package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
  22. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  23. package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
  24. package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
  25. package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
  26. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
  27. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
  28. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
  29. package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
  30. package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
  31. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
  32. package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
  33. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
  34. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  35. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
  36. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
  37. package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
  38. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
  39. package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
  40. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  41. package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
  42. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  43. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
  44. package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
  45. package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
  46. package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
  47. package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
  48. package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
  49. package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
  50. package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
  51. package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
  52. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
  53. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
  54. package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
  55. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  56. package/dist/index.js +10608 -6579
  57. package/package.json +1 -1
package/README.md CHANGED
@@ -24,7 +24,7 @@ Connects your coding agents to a model folder, step by step:
24
24
 
25
25
  ```sh
26
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
27
+ npx @radicaltools/cli setup --client claude-code --client codex --yes
28
28
  ```
29
29
 
30
30
  No Node.js yet? Start from an empty folder with the launcher, which finds Node.js or
@@ -40,7 +40,7 @@ The launcher (`radical.sh`, `radical.cmd`) takes Node.js 20.11 or later with `np
40
40
  beside it from the `PATH`, else from `~/.radical/node`. With neither, it asks (or takes
41
41
  `--yes`) and downloads the latest Node.js 24 for the platform from nodejs.org into
42
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
43
+ `sh radical.sh check`, and `sh radical.sh mcp --folder …` runs the MCP
44
44
  server without asking anything. `radical setup` run through it pins its version line
45
45
  (`default_version`, `DEFAULT_VERSION` in `radical.cmd`) to the CLI's, makes `radical.sh`
46
46
  executable, and has every agent and the git hooks start the server and the CLI through
@@ -76,6 +76,21 @@ terminal, or with `--yes`, it asks nothing: the folder `architecture`, the agent
76
76
  finds installed, the hooks in a repository. `--dry-run` prints every change and writes
77
77
  nothing. Exit status: 0 set up and checked, 1 a step or a check failed, 2 it could not run.
78
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
+
79
94
  ### radical setup --status
80
95
 
81
96
  Checks what an agent needs to work on a model folder, and changes nothing:
@@ -117,9 +132,9 @@ publishes it through the Confluence adapter.
117
132
  Find a view and preview it without Confluence credentials:
118
133
 
119
134
  ```sh
120
- radical export confluence architecture --list-views
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
135
+ radical export confluence --list-views
136
+ radical export confluence --view "Specification" --format html --output wiki-preview.html
137
+ radical export confluence --view "Specification" --format markdown --output wiki.md
123
138
  ```
124
139
 
125
140
  `--view` accepts an exact view ID or an unambiguous name. `--format storage`
@@ -133,7 +148,7 @@ To publish to Confluence Cloud, set `CONFLUENCE_URL`, `CONFLUENCE_EMAIL` and
133
148
  `CONFLUENCE_API_TOKEN` in your shell or CI secret environment, then run:
134
149
 
135
150
  ```sh
136
- radical export confluence architecture --view "Specification" --publish --space-id 123 --parent-id 456
151
+ radical export confluence --view "Specification" --publish --space-id 123 --parent-id 456
137
152
  ```
138
153
 
139
154
  Use the numeric space ID, not its key. `--parent-id` is optional. `--url` can
@@ -163,7 +178,7 @@ To move an existing managed export under another page, pass its root page
163
178
  ID with `--parent-id`; its children follow it:
164
179
 
165
180
  ```sh
166
- radical export confluence architecture --view "Specification" --publish --page-id 789 --parent-id 456
181
+ radical export confluence --view "Specification" --publish --page-id 789 --parent-id 456
167
182
  ```
168
183
 
169
184
  Use a destination parent in the same Confluence space. Changing the view's
@@ -188,6 +203,25 @@ Exit status: 0 exported/published, 2 could not export/publish. Credentials
188
203
  are not accepted as command-line arguments or included in error output.
189
204
  The transport follows Atlassian's [Cloud page API](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/).
190
205
 
206
+ ## radical implement
207
+
208
+ Says where the repository builds an element of the model, in
209
+ `.radical/radical.json`, which the repository's sensors (`element.paths` in
210
+ their `--context`), `radical check` and Studio's element card read.
211
+
212
+ ```sh
213
+ radical implement "Orders API" --path services/orders-api
214
+ radical implement 8c66e024-… --path apps/cli --path apps/cli-shared
215
+ radical implement "Orders API" # where it is built
216
+ radical implement "Orders API" --remove
217
+ ```
218
+
219
+ The element is its id or its name (an element of another model of the
220
+ federation, as fetched, too); a name two elements share needs the id. Paths
221
+ are from the working directory and kept from the repository's root; they
222
+ replace the element's paths. An element without an entry is built where its
223
+ nearest parent with one is.
224
+
191
225
  ## radical diff
192
226
 
193
227
  ```sh
@@ -208,7 +242,7 @@ change. Exit status: 0 the list was written, 2 it could not be made (not a
208
242
  git repository, an unknown ref).
209
243
 
210
244
  `--save-base` also writes the model at the base (its elements and relations,
211
- the commit, the branch and the time) to `.radical/base.json` in the folder,
245
+ the commit, the branch and the time) to `.state/base.json` in the folder,
212
246
  out of git like the rest of `.radical/`. Studio has no git: it compares the
213
247
  open model with that file as it is edited and shows the changes with
214
248
  Changes on branch, in the list of views, on the properties card and in the
@@ -231,7 +265,11 @@ radical hooks install path/to/model
231
265
 
232
266
  Adds one marked line to the repository's `post-checkout`, `post-commit`,
233
267
  `post-merge` and `post-rewrite` hooks that runs `radical diff <folder> --save-base --quiet`, so
234
- the base Studio compares with follows the branch checked out. The line goes
268
+ the base Studio compares with follows the branch checked out, and then
269
+ `radical check <folder> --from-ci --quiet --detach`, which fetches the test
270
+ results of CI for the commit checked out in the background (a command of its
271
+ own, its output closed: a CLI built before `--from-ci` still saves the
272
+ base, and without the GitHub CLI nothing is fetched). The line goes
235
273
  right after the hook's `#!` line, where an `exit` or `exec` further down
236
274
  cannot skip it; what the hooks already do stays. Each model folder of the
237
275
  repository has a line of its own, a second install adds nothing (or brings
@@ -240,7 +278,48 @@ the git command. A hook written in another language than sh (Python, say)
240
278
  is left as it is: the command exits 2 and says what to call from it.
241
279
  It runs the CLI that installed it, with the `node` on the PATH, else the one
242
280
  that installed it. In this repository `npm run hooks` builds the CLI,
243
- installs the hooks for `architecture/` and saves its base once.
281
+ installs the hooks for `.radical/model/` and saves its base once.
282
+
283
+ ## radical federation
284
+
285
+ ```sh
286
+ node apps/cli/dist/index.js federation open|sync|watch path/to/model [--force]
287
+ ```
288
+
289
+ One model across many repositories. A model folder names the models it
290
+ depends on in `deps.json`:
291
+
292
+ ```json
293
+ {
294
+ "name": "payments",
295
+ "dependencies": [
296
+ { "name": "orders", "repo": "git@github.com:acme/orders.git", "path": ".radical/model", "ref": "v2.3.0" }
297
+ ]
298
+ }
299
+ ```
300
+
301
+ `repo` is a git address or a path relative to the model folder, `path` the
302
+ model folder in that repository, `ref` a branch, tag or commit.
303
+
304
+ - `open` fetches each dependency at its ref into the cache (`$RADICAL_CACHE`,
305
+ else the user's cache directory; one bare partial clone per repository, so
306
+ only the model files are downloaded) and composes one model folder in
307
+ `.radical/federation/`: the folder's own elements, relations, views and
308
+ metamodel as they are, and every dependency's elements and relations with
309
+ `origin: "<name>@<commit>"`. Studio and the MCP server open that folder;
310
+ they draw elements with an origin dashed and refuse every change to them
311
+ but their place. The composed folder gets a base composed the same way
312
+ (Changes on branch shows only this model's changes), `check.json` and the
313
+ test results. Changes not carried home yet are carried first.
314
+ - `sync` writes what has no origin back to the model folder, and names each
315
+ change to an element or relation with an origin, which it keeps out and
316
+ undoes in the composed folder (exit 1). When the model folder changed too,
317
+ nothing is carried unless `--force`; `open --force` composes again from the
318
+ model folder and drops the composed folder's changes.
319
+ - `watch` opens, then keeps both in step until stopped (Ctrl-C).
320
+
321
+ Dependencies are not composed transitively. With a `deps.json`,
322
+ `radical check` checks the model composed with its dependencies (see below).
244
323
 
245
324
  ## radical check
246
325
 
@@ -258,12 +337,19 @@ Checks one model folder and prints what it finds:
258
337
  - **completeness**: requirements verified by a scenario, satisfied by an
259
338
  element, derived from a need; needs with requirements; accepted ADRs with
260
339
  a fitness function and their date, context, decision and consequences;
261
- fitness functions linked and with a threshold.
340
+ fitness functions linked; scenarios and fitness functions that state their
341
+ checks, in conditions that read.
262
342
 
263
- With test reports it also checks that the tests the model names passed (see
264
- below). `radical check --list-rules` lists every rule and every metric a goal can
343
+ With test reports it also checks that the tests the model names passed, and
344
+ 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
265
345
  be set for. It reads the files only and never writes the model.
266
346
 
347
+ With a `deps.json` the model is checked composed with the models it names,
348
+ at their pinned refs: its relations to their elements hold, one to an element
349
+ no model has is the error `rel-end-missing`, and what is found about their own
350
+ elements is left to their check. It names the dependencies and commits
351
+ (`federation` in the JSON). `--alone` checks the folder without them.
352
+
267
353
  Exit status: 0 no errors (warnings allowed), 1 errors, 2 the check could not
268
354
  run. `--format json` prints the result as JSON, `--format github` as GitHub
269
355
  Actions annotations.
@@ -318,27 +404,39 @@ its meaning as the model grows.
318
404
  names. It looks only at the files its `include` matches, so that unit tests of
319
405
  internals stay out of it; a scenario has to name a test by its title or its
320
406
  describe block, since a fitness function that names a whole file or directory
321
- (`apps/e2e/tests`) is an umbrella over many behaviours:
407
+ (`apps/e2e/tests`) is an umbrella over many behaviours. The files are the
408
+ repository's, so they are set in its `.radical/radical.json`, and the rule's
409
+ severity in the model's `check.json` (one there from before still counts,
410
+ with the warning `repository-settings-in-model`):
322
411
 
323
412
  ```json
324
- { "rules": { "test-unbound": { "severity": "warning", "include": ["apps/e2e/**"], "exclude": ["**/known-issues.spec.ts"] } } }
413
+ { "tests": { "include": ["apps/e2e/**"], "exclude": ["**/known-issues.spec.ts"] } }
325
414
  ```
326
415
 
327
416
  `--verbose` and the Inspector list the titles of those tests.
328
417
 
329
418
  ### Tests and evidence
330
419
 
331
- A scenario or a fitness function names the tests that run it in its `tests`
332
- property, one per line, as Vitest and Playwright print them:
420
+ The model names no test: the repository binds its tests to the model's
421
+ scenarios and fitness functions in `.radical/radical.json` ("verifies"), and
422
+ a scenario or fitness function passes when every test bound to it passed and
423
+ its `metrics` (metric conditions only) hold. A test is named as Vitest and
424
+ Playwright print it, from the repository's root:
333
425
 
334
- ```
335
- apps/cli/src/cli.test.ts › radical check › prints the result as JSON
336
- apps/e2e/tests/studio/forge.spec.ts › Forge files each stage into its view
337
- packages/layout/tests/geometry.test.ts › createBatchPlacer
338
- apps/e2e/tests
426
+ ```sh
427
+ radical verify "Prints JSON" --test "apps/cli/src/cli.test.ts › radical check › prints the result as JSON"
428
+ radical verify "Forge files its stages" --test "apps/e2e/tests/studio/forge.spec.ts › Forge files each stage into its view"
429
+ radical verify "Placement" --test "packages/layout/tests/geometry.test.ts › createBatchPlacer"
430
+ radical verify "E2E regression" --test apps/e2e/tests
431
+ radical verify "Prints JSON" # its tests
432
+ radical verify "Prints JSON" --drop "<test>" # take one off
339
433
  ```
340
434
 
341
- An id names the test whose title it ends, otherwise every test in the
435
+ `radical check` warns about a scenario the repository must verify (an
436
+ element it builds satisfies its requirement) that has no test bound and no
437
+ metric condition (`scenario-not-verified-here`), and about a test still
438
+ named in Metrics (`model-names-tests`; it still counts, and `radical setup`
439
+ moves such tests into the file). An id names the test whose title it ends, otherwise every test in the
342
440
  describe block it starts; one without a title names every test in a file or
343
441
  directory. File paths match by suffix, so absolute paths in a report and
344
442
  workspace-relative ones in a JUnit file both do.
@@ -355,39 +453,124 @@ directory of them (its .json and .xml files), and may be repeated.
355
453
  In this repository `npm run test:reports` runs every workspace's tests and
356
454
  leaves a report per workspace in `reports/`, the e2e suite adds
357
455
  `reports/e2e.json`, and `npm run check:architecture` checks the local
358
- `architecture/` model against them. CI keeps `reports/` as the
456
+ `.radical/model/` model against them. CI keeps `reports/` as the
359
457
  `test-reports` artifact (and `reports/e2e.json` in `e2e-report`). A named
360
458
  test that failed or is gone from the report of its file (renamed, deleted)
361
459
  is an error; one that was skipped, or whose file no report has, a warning.
362
460
  The text output sums up how many requirements, scenarios, ADRs and fitness
363
461
  functions the reports verify. `--evidence` writes that status per element
364
462
  as JSON (`verified`, `broken`, `unverified` for requirements and ADRs;
365
- `passed`, `failed`, `not-run`, `no-tests` for scenarios and fitness
366
- functions); it never writes into the model.
463
+ `passed`, `failed`, `stale`, `not-run`, `no-checks` for scenarios and
464
+ fitness functions, with each condition's outcome); it never writes into the
465
+ model.
367
466
 
368
467
  With `--report` the command also keeps the test cases it read in the model
369
- folder's `.radical/test-results.json` (out of git, like the rest of
370
- `.radical/`). Studio's Inspector perspective reads them and the model's
468
+ folder's `.state/test-results.json` (out of git, like the rest of
469
+ `.state/`). Studio's Inspector perspective reads them and the model's
371
470
  `check.json`, and runs the same check on the model as it is edited: Model
372
471
  quality and Implementation show the result by dimension, and Settings edit
373
472
  `check.json` (goals, severities, baselines), marking a change that loosens
374
473
  the gate.
375
474
 
475
+ ### Test results from CI
476
+
477
+ ```sh
478
+ radical check path/to/model --from-ci
479
+ ```
480
+
481
+ reads the test reports of CI instead of `--report`. Test results never go
482
+ into git, since a commit cannot hold the results of its own tests; CI runs
483
+ every suite on every pull request and keeps the reports as artifacts. The
484
+ command finds, with the GitHub CLI (`gh`, signed in), the nearest commit in
485
+ HEAD's first-parent history that a completed GitHub Actions run tested; a
486
+ commit merged from a pull request (a squash merge has no run of its own)
487
+ stands for the pull request's head. For each artifact it takes the latest
488
+ completed run that kept it, downloads it, and reads the `.json` and `.xml`
489
+ test reports in it. Which artifacts hold reports is set in the repository's
490
+ `.radical/radical.json` (`check.json`'s still counts):
491
+
492
+ ```json
493
+ { "ci": { "artifacts": ["test-reports", "e2e-report"] } }
494
+ ```
495
+
496
+ (every artifact of the run without it). The results are kept in
497
+ `.state/test-results.json` with the commit they stand for, the runs, when
498
+ each ran and how many commits HEAD is past it, which the Inspector's *Tests*
499
+ chip shows; the same runs a second time download nothing. Results read with
500
+ `--report` at that commit or a later one are kept, and checked. `--quiet`
501
+ prints nothing; `--detach` starts the check in the background and returns,
502
+ as the git hooks of `radical hooks install` do after every checkout, commit,
503
+ pull and rebase.
504
+
505
+ ### Measured values
506
+
507
+ A condition can also hold a value to a threshold, which a sensor measures:
508
+
509
+ ```
510
+ api.latency.p95{env=staging} <= 300 ms
511
+ workspaces.exit_code == 0
512
+ ```
513
+
514
+ `<metric>{<labels>} <op> <number> [unit]`, with `< <= > >= == !=`. It is
515
+ judged by the latest measurement of the metric whose labels include the
516
+ condition's; units of one kind convert (ms and s, KB and MB). The element's
517
+ `combine` says how its conditions make its status (`all`, the default;
518
+ `any`; `at least N`), and `max_age` (`7d`, `12h`) how old a measurement may
519
+ be: an older one is stale, and never passes.
520
+
521
+ `radical check` reads the measurements kept in the model folder's
522
+ `.state/measurements.json`, and with `--metrics <file|dir>` the
523
+ radical-metrics/1 files another job wrote, which it adds there. A condition
524
+ that does not hold is an error (`metric-failed`); a stale one
525
+ (`metric-stale`) or one nothing measured (`metric-not-measured`) a warning;
526
+ a line that reads as no condition, or a unit that does not convert, an error
527
+ (`metric-invalid`).
528
+
529
+ ## radical sense
530
+
531
+ Measures with a sensor adapter and keeps the values beside the model, for
532
+ the conditions above. A sensor only measures: it takes no threshold and
533
+ exits 0 whatever it measured, 2 when it could not measure.
534
+
535
+ ```sh
536
+ radical sense command --name workspaces -- node tools/check-workspaces.mjs
537
+ radical sense json k6-summary.json --metric 'api.latency.p95=/metrics/http_req_duration/p(95)@ms' --label env=staging
538
+ radical sense json coverage-summary.json --metric 'coverage.lines=total.lines.pct@%' --out reports/metrics/coverage.json
539
+ ```
540
+
541
+ - `command [--name <metric>] -- <command…>`: the command's exit code
542
+ (`<metric>.exit_code`) and duration in seconds (`<metric>.duration`).
543
+ - `json <file> --metric <metric>=<path>[@<unit>]`: a number from a JSON file,
544
+ by dotted keys with `[index]` or a JSON pointer starting with `/`.
545
+ - `--folder <dir>`: the model folder (default: the working directory); the
546
+ values go into its `.state/measurements.json`, the latest of each metric
547
+ and labels.
548
+ - `--out <file>`: a radical-metrics/1 file instead, for `radical check
549
+ --metrics` in another job.
550
+ - `--label k=v` labels every measurement (conditions match labels);
551
+ `--context k=v` says where it was measured (a commit, a run).
552
+
553
+ An adapter for another tool is one module in `src/sensors/` with the
554
+ `SensorAdapter` interface, one line in `src/sensors/registry.ts` and a fixture
555
+ of its tool's real output; `src/sensors/contract.test.ts` runs every adapter on
556
+ its fixture and checks that it writes valid radical-metrics/1 and takes no
557
+ threshold. Pull requests welcome.
558
+
376
559
  ## radical fuzz
377
560
 
378
561
  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`
562
+ of actions to a system and check its rules after every step. `.radical/crucible/crucible.json`
380
563
  in the working directory lists them, and the folder findings go to:
381
564
 
382
565
  ```json
383
566
  {
384
- "findings": "crucible/findings",
567
+ "findings": ".radical/crucible/findings",
385
568
  "fuzz": [{ "file": "packages/ui/tests/invariants.test.ts", "cwd": "packages/ui" }]
386
569
  }
387
570
  ```
388
571
 
389
572
  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.
573
+ `command` (a list). Paths are from the repository's root.
391
574
 
392
575
  ```sh
393
576
  radical fuzz # plan ci: each file's fixed seeds and runs
@@ -400,7 +583,7 @@ radical fuzz --report reports # a Vitest JSON report per file, for radical che
400
583
 
401
584
  `--survey` goes on after each failure and writes each one whose signature (its
402
585
  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
586
+ finding has yet as `.radical/crucible/findings/F-NNNN.md`, status `open`, with the
404
587
  world, seed, path and length that replay it, the steps and what differs.
405
588
  `--no-known` lets the fuzz files' known failures filter nothing, `--no-shrink`
406
589
  reports the first failure as found.
@@ -409,7 +592,7 @@ A fuzz file is written with the engine, `@radical/crucible`, which is not
409
592
  published yet: so far the fuzz files are this repository's own
410
593
  (`packages/ui/tests/invariants.test.ts`). It reports a test case per world and
411
594
  one per world and rule (`on the bookstore model: undoRestores holds`), which a
412
- scenario or a fitness function can name in its Tests.
595
+ scenario or a fitness function can name in its Metrics.
413
596
 
414
597
  Exit status: 0 every file passed, 1 one failed, 2 radical fuzz could not run.
415
598
 
@@ -426,18 +609,19 @@ radical harden --gate --test "apps/e2e/tests/studio/views.spec.ts › a view kee
426
609
  A fuzz finding is hardened by its own steps: the finding is marked `hardened`,
427
610
  and its fuzz file replays the shrunk sequence as the test
428
611
  `<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.
612
+ failures, so it fails until the bug is fixed. With `--scenario` it binds that
613
+ test to the scenario in `.radical/radical.json` (as `radical verify` does) and
614
+ keeps the scenario's name in the finding; it does not change the model's
615
+ files.
432
616
 
433
617
  `--gate` checks a test before it is bound: with the source files changed since
434
618
  the base (default: the merge base with `origin/main`) set back to it, the test
435
619
  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
620
+ (default 5). Tests, findings and `.radical/crucible/crucible.json` are not set back, and the
437
621
  working tree is left as it was (files are copied aside, never stashed), also
438
622
  when the gate is interrupted: Ctrl+C, `kill` or a closed terminal stops the
439
623
  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
624
+ runs through the runner `.radical/crucible/crucible.json` gives for its folder, else with
441
625
  `npx vitest run <file> -t <name>` in the file's package:
442
626
 
443
627
  ```json
@@ -448,7 +632,7 @@ runs through the runner `crucible.json` gives for its folder, else with
448
632
  "--repeat-each", "{runs}", "--workers", "{runs}", "--reporter", "line"] }] }
449
633
  ```
450
634
 
451
- A runner's `build` (commands run from `crucible.json`'s folder) is made before
635
+ A runner's `build` (commands run from the repository's root) is made before
452
636
  the run without the fix and before the run with it, so a test of a build (an
453
637
  e2e test) runs on what the files are at each step; its `repeat` (with
454
638
  `{runs}`) makes the runs at once one run of that command, for runs that
@@ -468,18 +652,18 @@ checks what comes back; a coding agent's session starts the agents.
468
652
  ```sh
469
653
  radical explore prepare --runs 5 --areas "layout under edits; milestones and undo"
470
654
  radical explore verify 70 "f1-row.mjs 2" "f2-undo.mjs"
471
- radical explore record .crucible/rounds/round-70-74/run-70/REPORT.md
655
+ radical explore record .radical/crucible/rounds/round-70-74/run-70/REPORT.md
472
656
  ```
473
657
 
474
658
  `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
659
+ `.radical/crucible/rounds/round-<from>-<to>/build`, and gives each run a folder, its
476
660
  ports (`<ports>+NN`, `+100+NN`, `+200+NN`) and a `PROMPT.md` with its area;
477
661
  `BRIEF.md` names the commit, the commits and the model elements changed since
478
662
  the last round (by area), the open findings, the setup, the rules and the
479
663
  report's JSON form. `--since`, `--from` and `--no-build` change what it
480
664
  counts from, the first run's number and whether it builds. The brief asks
481
665
  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.
666
+ `.radical/crucible/crucible.json`), since a finding's script is copied out of the round.
483
667
  `verify` serves a run's build on its ports (each server `serve` lists, on the
484
668
  run's port it names: `app`, `hub` or `other`), runs its scripts from its
485
669
  folder and stops the servers. `record` writes a report's findings (`open`, or
@@ -489,8 +673,8 @@ absolute paths.
489
673
 
490
674
  ```json
491
675
  { "explore": {
492
- "rounds": ".crucible/rounds", "brief": "docs/EXPLORATORY-TESTING.md",
493
- "known": ["docs/IMPROVEMENTS.md"], "model": "architecture",
676
+ "rounds": ".radical/crucible/rounds", "brief": "docs/EXPLORATORY-TESTING.md",
677
+ "known": ["docs/IMPROVEMENTS.md"], "model": ".radical/model",
494
678
  "build": [["npm", "run", "build:web"]],
495
679
  "copy": { "renderer": "apps/studio/out/renderer" },
496
680
  "serve": [
@@ -582,3 +766,107 @@ To validate the archive without a release, use **Actions → Publish to npm →
582
766
  Run workflow**, select `main`, choose **package: cli**, and leave **dry-run**
583
767
  enabled. With **dry-run** disabled it publishes, but only from `main`.
584
768
 
769
+
770
+ ## Sync node discussions with Confluence (experimental)
771
+
772
+ Publish a wiki as a managed page tree first (`export confluence --publish
773
+ --structure tree`). Run discussion sync from one designated machine or CI job.
774
+ Configure `CONFLUENCE_EMAIL` and `CONFLUENCE_API_TOKEN` in that runner's environment.
775
+ The account needs read access to the landing and node pages and permission to
776
+ create footer comments in the space. Tokens never belong in command arguments,
777
+ model files, sync journals, or source control.
778
+
779
+ ```sh
780
+ radical discussions confluence connect ./model --view <wiki-id> --page <landing-url>
781
+ # Read the preview, including existing conversations, account and limitations.
782
+ # Repeat the same command with the returned confirmation token:
783
+ radical discussions confluence connect ./model --view <wiki-id> --page <landing-url> --apply --expect <token>
784
+ radical discussions confluence sync ./model
785
+ radical discussions confluence sync ./model --apply --expect <fresh-token>
786
+ radical discussions confluence status ./model
787
+ ```
788
+
789
+ Preview writes neither local sync state nor remote comments. Apply reads again
790
+ and refuses if the preview token no longer matches. A preview token authorizes
791
+ only that snapshot and its exclusions. Add `--json` for structured output.
792
+ Use `--node <node-id>` (repeatable) on both preview and apply to limit a run to
793
+ selected nodes within the current wiki view. Other node pages are not read or
794
+ written. The filter applies to that invocation; use it again on subsequent runs.
795
+
796
+ Exit 0 means success, 1 means review/partial results or exclusions, and 2 means
797
+ an operational error. Review can be required even when some comments succeeded.
798
+
799
+ All supported existing footer comments on the currently selected node pages are
800
+ imported, including pre-connection comments. Existing local and remote threads
801
+ remain separate even when their text matches. To leave a conversation out,
802
+ repeat `--exclude local:<thread-uuid>` or `--exclude remote:<comment-id>` on the
803
+ preview and apply commands. Exclusions are stored and include descendants on
804
+ later runs; they are not automatically removed. Landing, inline, retained pages
805
+ outside the current view and unmanaged page comments are excluded. Missing or
806
+ replaced pages need review; sync never recreates or rebinds them.
807
+
808
+ The supported comment subset is paragraphs, bold, italic, inline code, line
809
+ breaks and absolute HTTP(S) links without credentials. Images, tables, macros,
810
+ mentions, attachments, raw HTML, lists and other unsupported content are held
811
+ with their source page for review; descendants are held too. The original remote
812
+ body is never modified or partially imported. This subset has automated tests
813
+ but **has not passed a live Confluence editor round trip yet**. Do not treat
814
+ these tests as evidence that editor normalization, republishing, permissions or
815
+ rate limits have been verified on a live site.
816
+
817
+ The connected account authors outbound posts. Local email addresses are never
818
+ exported or inferred as remote identity. Imported authors use Confluence account
819
+ IDs; display names are shown if present in provenance. The first import upgrades
820
+ discussions.json losslessly to version 2, preserving local UUIDs, email, nesting,
821
+ resolution and timestamps. **Older Studio versions cannot read version 2.**
822
+ Update all writers first and back up the folder before importing. Local-only
823
+ files keep their existing format. Studio displays source links, imported account
824
+ identity and resolved-thread review warnings; sync itself runs through the CLI.
825
+
826
+ Edits, deletions and resolution are not synchronized. Linked local/remote edits
827
+ and remote disappearance are reported for manual review without overwriting.
828
+ A remote reply to a resolved local thread is imported and flagged; the thread
829
+ stays resolved. After reviewing it, reopen the thread in Studio to acknowledge the imported
830
+ reply. Until then the preview continues to report it for review.
831
+
832
+ ### Interrupted runs and runner handoff
833
+
834
+ Keep these files together as durable collaboration state:
835
+
836
+ - `discussions.json`: human content and imported provenance;
837
+ - `discussions-confluence-sync.json`: checksummed, versioned mappings, pending
838
+ imports, exact staged outbound payloads, exclusions and last result;
839
+ - `discussions-confluence-connection.json`: connection receipt detecting a missing
840
+ or mismatched journal.
841
+
842
+ Choose whether to commit all three. Never merge competing journals in Git or
843
+ start another clone while the designated runner is running. Stop the old runner
844
+ before transferring these files together. Local process locks do not coordinate
845
+ different computers. Do not discard a missing/corrupt/conflicted journal and
846
+ reconnect: restore a consistent backup and review the corresponding remote
847
+ comments. A crash creating the first connection receipt before its journal also
848
+ stops safely for manual review, before any comments are posted or imported.
849
+
850
+ Imports stage a stable local ID before acquiring the ordinary short discussion
851
+ writer lock. Recovery verifies or finishes the same import, preserving concurrent
852
+ Studio posts. Network calls never hold that writer lock. Outbound posts are staged
853
+ as uncertain before the request. No create is automatically retried, even for a
854
+ 429. If its acknowledgement is lost, sync pauses the entire affected page:
855
+ inspect Confluence and the intended payload in the journal, then preview and
856
+ apply one of these recovery commands:
857
+
858
+ ```sh
859
+ radical discussions confluence sync ./model --bind <local-comment-uuid>=<verified-remote-id>
860
+ # Repeat with --apply --expect <token> after inspecting the remote page/parent.
861
+ # Only if you checked and decided to post again:
862
+ radical discussions confluence sync ./model --retry <local-comment-uuid>
863
+ ```
864
+
865
+ Binding verifies page, parent and uniqueness, retaining the original local UUID.
866
+ An explicit retry can duplicate a comment if the first request actually succeeded;
867
+ never retry merely because the CLI timed out. Recovery returns review status and
868
+ requires a fresh sync preview afterward. Other pages can continue when one page
869
+ is held. Stale `.discussions-confluence-sync.lock` files may be removed only after
870
+ verifying their recorded process has stopped; locks are never automatically stolen.
871
+ External editors and Git do not honor locks: observed changes stop the runner,
872
+ but ordinary filesystems cannot prevent every change in the final rename window.