@dialecte/cli 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -28,6 +28,7 @@ shape. Exit codes: 0 an answer or green, 1 nothing found or a failed check,
28
28
  Discover api members schema explain standard
29
29
  Use run fixture new
30
30
  Grow lot
31
+ Plan plan
31
32
  Check gate tdd rules contrib mutants
32
33
  Hand over handover
33
34
  Workspace worktree doctor models skills
@@ -50,6 +51,7 @@ dialecte lot answer <id> <question> "<answer>" [--by <who>] # answer an open q
50
51
  dialecte lot result <id> # the hand-over (card, show and run lines) of a ready lot, or why it stopped; writes nothing
51
52
  dialecte lot stop <id> --reason <text> # end the lot: its pending hand-over abandoned first, then canceled
52
53
  dialecte inbox # what waits on someone across every lot store: questions, ready hand-overs, failed lots
54
+ dialecte plan next|check|mark <plan.md> # what can start now in a plan's lot block; the block checked; a person's mark
53
55
  dialecte lot exempt|accept|revised|gone|mutation # the lot declaration .dialecte/lot.json
54
56
  dialecte lot finding|decide|snapshot|choice|standard <id|folder> ... # a lot's review rounds, in its lot or hand-over folder
55
57
  dialecte lot delta <id|folder> --round <n> # the fix diff since round n-1; --worktree: the old code to run a test on
@@ -62,7 +64,7 @@ dialecte rules # code-rules self-check of the changed files
62
64
  dialecte contrib # the contributor checks, after gate --full and before the hand-over
63
65
  dialecte mutants run|status|schedule|abandon|migrate|judge|record|drop # mutation testing of the declared scope
64
66
  dialecte handover write <lots.json> # the guarded commit-by-lots hand-over a human runs (handover <lots.json> too)
65
- dialecte handover show|run|abandon|list|--legend
67
+ dialecte handover show|review|run|abandon|list|--legend
66
68
  dialecte worktree add|prune # a worktree ready to work in; what a merge left behind
67
69
  dialecte doctor # versions, core API generation, skills and station agents in sync, local checkouts
68
70
  dialecte models # which model each tier (fast, standard, strong, frontier) means for your vendor
@@ -173,16 +175,31 @@ Every Dialecte package ships the agent skills that describe it in `skills/<name>
173
175
  intent quotes a sentence, since the generated pages republish the JSDoc. A page about several
174
176
  repositories declares `<!-- dialecte-skills workspace -->` and is fully verified with
175
177
  `--workspace <folder>`; a deliberate outside mention goes in `<!-- dialecte-skills ignore: token -->`.
176
- It also verifies every cli invocation a page cites in code (inline code and fenced blocks of any language,
177
- never prose; generated blocks left out): one starting with `dialecte` or `@dialecte/cli`, after `npx`, a
178
+ It also verifies every cli invocation a page cites in code (inline code, fenced blocks tagged `sh`, `bash` or
179
+ `shell`, and in an untagged fence only a line starting `dialecte ` and a command of the map; a fence with any
180
+ other tag - `text`, `mermaid`, a diagram, a sample - is never read; never prose; generated blocks left out): one starting with `dialecte` or `@dialecte/cli`, after `npx`, a
178
181
  `$ ` prompt or a shell operator. Its command, its verb and each `--flag` must be in the command map of the
179
182
  cli the package uses (the cli's own map in the cli itself, else what the installed `@dialecte/cli` answers to
180
183
  `dialecte --help --json`); an unknown one, or an old form of a command renamed in 1.0 (see "Renamed in
181
184
  1.0"), is an error at `page:line` naming the closest valid form, or the new form, on a workspace page too. A quoted word, a
182
185
  `<placeholder>` and what follows a bare `--` are not checked; `ignore:` takes the offending word (`record`,
183
186
  `--fats`). With no installed cli, or one before the map, the invocations are not checked: one warning says
184
- why and the summary line says so. A versioned `@dialecte/cli@<version>` and what follows an unclosed `<` are
185
- not read.
187
+ why and the summary line says so. Inside a `<placeholder>`, an option group `[...]` or a flag group
188
+ `(--a | --b)` a `|` is no pipe; each kind of group is counted on its own (a `)` never closes a `<`), and a
189
+ process substitution `<(dialecte ...)` is read like any invocation. A versioned `@dialecte/cli@<version>` and
190
+ what follows an unclosed `<`, `[` or `(--` are not read.
191
+
192
+ ## What the cli prints
193
+
194
+ Every text the cli prints passes one boundary: each printed line is escaped once, so a value from a record, a
195
+ brief, an argument or an agent can never forge a line nor act on the terminal. Every C0 control (a tab and a line
196
+ feed included), DEL, the C1 controls, the bidi marks, embeddings, overrides and isolates and the line and
197
+ paragraph separators print as `\u{<hex>}` (`\u{a}` for a line feed, `\u{1b}` for an escape). A lot verb's
198
+ refusal, a recap row, a card line and an error the cli catches all print that way. Quoted source (`lot delta`'s
199
+ diff, `mutants judge`'s window) shows a tab as four spaces. `--json` is never escaped: JSON encodes its control
200
+ characters itself and holds every value as written. The lines the cli relays from its own child processes (a
201
+ gate step's, a hook's, a test runner's) keep their colours (SGR sequences, the conceal parameter dropped);
202
+ every other control in them is escaped.
186
203
 
187
204
  ## Lookups for agents (and people)
188
205
 
@@ -205,10 +222,18 @@ Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage
205
222
  installed dialecte (a dependency built on `@dialecte/core` exporting `./<version>` with its `./<version>/test`
206
223
  entry: its namespace is its name capitalized, `Scl` from `@dialecte/scl/v2019C1`); with several, it lists them and
207
224
  `--package <name>` / `--version <v>` picks one. `--namespace <Name> --entry <module>` override.
208
- - `dialecte schema <Tag> [--package <name>]`: parents, children in order with how often each may appear,
209
- attributes (required, identity, default, fixed, enumeration, pattern), text, xsi:type variants - read
210
- through the readers of the core each installed dialecte depends on (how often a child may appear is core's
211
- `childOccurrences`). An unknown tag answers the closest; a dialecte not built is reported as skipped.
225
+ - `dialecte schema <Tag> [--under <Parent>] [--package <name>]`: parents, children in order with how often each
226
+ may appear, attributes (required, identity, default, fixed, enumeration, pattern), text, xsi:type variants,
227
+ the declared type and documentation - read through the readers of the core each installed dialecte depends on
228
+ (how often a child may appear is core's `childOccurrences`). A tag declared several ways prints each declaration
229
+ with the parents that hold it; `--under <Parent>` prints the one that parent holds (or those it holds, when it
230
+ does not decide), and a tag that is not a child of that parent answers its parents (exit 1). With `--json` each
231
+ element carries `declarations` and `resolved`, and when known `type`, `documentation`, `declaration` (the key
232
+ of the declaration described, when the tag is declared several ways) and `ways` (when unresolved). A dialecte
233
+ names the standard it implements in its `package.json`, `"dialecte": { "standard": "<public name>" }` (the
234
+ usual public name, no part or clause); a value that is not a non-empty string skips the dialecte, naming
235
+ `dialecte.standard`. An unknown tag
236
+ answers the closest; a dialecte not built is reported as skipped.
212
237
  - `dialecte doctor`: installed `@dialecte/*` versions, the core API generation of each dialecte (read from
213
238
  the core it resolves; a dialecte on another core than your app's is a warning), whether the synced skills match node_modules (a skill missing; a copied skill of
214
239
  another version than the one installed - linked skills follow node_modules), local checkouts (siblings,
@@ -330,7 +355,17 @@ One field of package.json says what the package is to the cli:
330
355
  the type bench and the release guard, and `skills sync` installs the contributor skills (`--no-contributing`
331
356
  is refused). A contributor never names the tools that consume it: list them once on the machine with
332
357
  `git config --global dialecte.consumerNames "<name>, <name>"` (never committed, so the names stay out of the
333
- repository) and `rules` and `handover` refuse them as whole words (`consumer tool name`).
358
+ repository) and `rules` and `handover` refuse them as whole words (`consumer tool name`). The words a
359
+ contributor never commits at all are listed on the machine the same way, never in the repository:
360
+ `git config --global dialecte.forbiddenWords "<word>, <word>"` and the user file
361
+ `$XDG_CONFIG_HOME/dialecte/forbidden-words` (else `~/.config/dialecte/forbidden-words`; one word per line,
362
+ `#` comments, blank lines skipped), both read and merged. `rules`, `contrib` (its rules row) and the hand-over's
363
+ `references` guard (lot messages and files) refuse them as whole words, whatever the case (`forbidden word`).
364
+ With no list anywhere the check is not run and `rules` says so in one line,
365
+ `forbidden words: no list (git config dialecte.forbiddenWords or <the user file>)`, and passes (a CI machine has
366
+ no list); a user file that cannot be read (a folder at its path, no read permission) is an error, never no list.
367
+ A gate or contrib record of a run that checked the rules is keyed with a hash of the consumer names and the
368
+ forbidden words (never the words), so a list set or changed after a green record runs the check again.
334
369
  - Any other value is refused by every command that reads it:
335
370
  `dialecte.profile: "<value>" is not a profile; profiles: contributor, consumer`.
336
371
 
@@ -388,9 +423,13 @@ the answer.
388
423
  its root (`tmpdir()` handed to a call that lists or scans a folder, or given as `root` / `cwd` /
389
424
  `scratchRoot`...: other tests and processes share it; `mkdtempSync(join(tmpdir(), '<prefix>-'))`
390
425
  gives the test a folder of its own); positional parameters (beyond a leading `query` / `tx`, a
391
- symmetric pair aside) and abbreviated names are warnings. Without file arguments it records its result
392
- in the worktree's git folder (`dialecte-rules.json`: when, HEAD, the state hash, the files, the errors
393
- and warnings), which `dialecte lot recap` reads; a run on named files records nothing.
426
+ symmetric pair aside) and abbreviated names are warnings. A file it cannot read (a file given that is not
427
+ there, no read permission) or a script that does not parse is an error of that file (`unreadable-file`),
428
+ never a silent skip. Without file arguments it reads the changed list a scoped gate step hands
429
+ (`DIALECTE_GATE_CHANGED`: its text files still on disk; a list it cannot read is an error) and writes the
430
+ gate's selection (the files it checked); outside a gate, the files changed against HEAD and the new ones,
431
+ that result recorded in the worktree's git folder (`dialecte-rules.json`: when, HEAD, the state hash, the
432
+ files, the errors and warnings), which `dialecte lot recap` reads; a run on named files records nothing.
394
433
  - `dialecte gate [--fast | --full] [--base <ref>] [--no-reuse] [--declare <path>]... [--json]` runs the Definition of Done: `--fast` (default) `check`,
395
434
  `skills:check` and the tests of the changed files; `--full` adds `build` and the whole suite (the
396
435
  runner's defaults: every file in parallel), then the steps derived from the package's scripts after its
@@ -401,7 +440,19 @@ the answer.
401
440
  `GIT_OPTIONAL_LOCKS=0` (a `git status` inside it never takes the index lock), and is judged on its exit
402
441
  code and on the counts it printed: a step exiting non-zero fails whatever it says, a test step that
403
442
  counts no test fails - except `--fast` on a change that touches no test (a doc edit): the changed-tests
404
- step passes with the note "no test file is affected by the change". A step whose npm script the package lacks is skipped. While a hand-over
443
+ step passes with the note "no test file is affected by the change". A step running an npm script the package lacks
444
+ is _not wired_, judged for the whole list before any step runs (every wiring problem shows at once, and a
445
+ failed one leaves every other step unrun): a step of the default list (the package declares no list for the
446
+ mode) fails `gate --full` and `--release` (`FAIL skills not wired (no npm script "skills:check")`, then the
447
+ line `add the script, or opt out with dialecte.gate.skip: "dialecte": { "gate": { "skip": { "skills": "<reason>" } } }` under it;
448
+ `dialecte contrib` names `"contrib"` there) and is skipped by `--fast` (`skip skills not wired (...)`, the gate stays green); a step the package declares
449
+ fails in every mode, `--fast` included (`declared but not wired (no npm script "<x>")`). The fix is the
450
+ script, the step removed from the list, or, for a default step, an opt-out with a reason (below). The
451
+ hand-over card shows `✗ <step> not wired (no npm script; or dialecte.gate.skip)` for a full or release record
452
+ (`dialecte.contrib.skip` for a contrib one) and `! <step> not
453
+ wired (no npm script)` for a fast one, and `! <step> opted out: <reason>` for an opt-out (a warning). The
454
+ `type-narrowing` step is derived from the package's scripts and is never unwired. A gate record written
455
+ before this check is not reused for a package with an unwired or opted-out step (the key changes). While a hand-over
405
456
  holds the repository (`dialecte handover <lots.json>` wrote its lock), the gate runs only under the
406
457
  hand-over written for this repository - the script the lock names exists and the `lots.json` beside it
407
458
  names this repository, real paths compared - and says so in one line with the command that refreshes
@@ -444,7 +495,12 @@ the answer.
444
495
  serial rerun is green: it is reused with its `flaky in parallel` note. `--no-reuse` runs the steps
445
496
  whatever the store holds. The key leaves out the Node version and the environment (a path given
446
497
  through an environment variable); a `file:` dependency edited and restored to the same size within
447
- the same modification time is not seen either.
498
+ the same modification time is not seen either. `--full` and `--release` hold the machine awake while they
499
+ run (on macOS a `caffeinate -i -w <the cli's pid>` started at their start, detached, ending with the cli;
500
+ nothing on another system, nor when `caffeinate` is not on `PATH`, nor with `DIALECTE_KEEP_AWAKE=0`), and
501
+ measure their wall and monotonic time: a run whose wall time passed its monotonic time by over 60 s spanned
502
+ a sleep of the machine all the same, its record keeps `sleptMs`, and the hand-over card's gates print
503
+ `! slept <duration> during gate --full` for a record of the tree it checks.
448
504
  - `dialecte gate --hook [--no-reuse]` runs in a commit hook: the test steps of `--full` (its steps counting
449
505
  tests), unless a green `--full` record of what is committed answers them. Its key is the one a `--full` run of
450
506
  that state stores - the tree, what npm installed, the `file:` dependencies, the full gate's command hash - with
@@ -476,7 +532,7 @@ the answer.
476
532
  terminal (and never with `NO_COLOR`); the `✓` `!` `✗` marks read the same without it. The command
477
533
  follows the box whole on one line, to copy: `cd <folder> && bash commit.sh`, or
478
534
  `node <this cli> handover run <folder>` when the repository's own cli does not answer
479
- `handover run --probe` within 10 s. "This cli" is the script that runs: when it is a temporary one
535
+ `handover run --probe` within 60 s. "This cli" is the script that runs: when it is a temporary one
480
536
  (`npx` from the registry, `tsx` on the sources), install `@dialecte/cli` in the repository so the
481
537
  card names its own bin.
482
538
  - No runner hangs silently. Every child that `dialecte gate` (its steps), `tdd` (its vitest runs) and
@@ -499,8 +555,9 @@ the answer.
499
555
  `contributor`, after `gate --full` and before `dialecte handover`, one line per row: `rules` on the files
500
556
  changed against HEAD (recorded as `dialecte rules` records it), the package's `dialecte.contrib.steps`
501
557
  (default: `docs`, `npm run doc:build` with the `generatedDocs` restored, and `type-bench`,
502
- `npm run type-bench:check`; `[]` keeps the built-in rows only) run as the gate runs its steps (a missing
503
- npm script skips the step), `type-narrowing` (`npm run type-narrowing`) when the package has that script and
558
+ `npm run type-bench:check`; `[]` keeps the built-in rows only) run as the gate runs its steps (a default
559
+ step whose npm script is missing fails the run before any row, the built-in `rules` and `release` rows
560
+ included, unless `dialecte.contrib.skip` opts it out with a reason; a declared one fails too), `type-narrowing` (`npm run type-narrowing`) when the package has that script and
504
561
  none of its steps runs it (without the script, one line `skip type-narrowing no npm script
505
562
  "type-narrowing"` before `release`, no row), `release` (no dependency named by a local folder), then `mutation` when the
506
563
  package declares a mutation scope (read from the mutation store now, never recorded). A package step a
@@ -533,8 +590,20 @@ the answer.
533
590
  case whose test code changed around it is kept and flagged `test code changed around it` (the next
534
591
  step adding a case to a green file); a case never proven green (only unchanged, accepted or revised)
535
592
  is kept without a flag, and no receipt. A file with a refusal still records its other cases'
536
- receipts, the refusals kept as evidence, but is not frozen: the gate fails on it until no case of
537
- it is refused.
593
+ receipts, the refusals kept as evidence; it is frozen when one of its cases is red (those need no re-red;
594
+ the refused case stays unproven), else not frozen; the gate fails on it until no case of it is refused.
595
+ - Two cases of one run sharing a file, a project and a name share one id, and a receipt names one case: every
596
+ case of such a group is refused (`red` and `green`), whatever its state, with `2 cases share this id
597
+ (lines 12, 12): <hint>` (a case without a location prints `?`). The hint is `rename one` for two plain
598
+ calls; for a case of an `.each` / `.for` table (or under one) it says to spell each title in full:
599
+ vitest cuts a `$` field of an each-title at its `truncateThreshold` and prints any array as `[ Array(n) ]`, so
600
+ two rows can read the same; `truncateThreshold: 0` in the package's vitest config is the other fix. A member
601
+ the run does not judge (skipped, filtered out by `-t`, not targeted by `green`) gets a `duplicate <case>
602
+ <reason>` line and no receipt. The cases of the group stay out of the move matching, the rest of the file is
603
+ judged as usual, and the exit is 1. `--json` holds `duplicates: [{ file, project, name, lines }]` (empty when
604
+ none). The `gate`'s tdd step fails (`duplicate case ids in <n> file(s): <files>`) and the card's tdd section
605
+ lists `✗ duplicate id <file>::<name> lines 12, 12` per group, so the hand-over is BLOCKED. A receipt
606
+ recorded before under an id now shared never counts.
538
607
  - A red records the case (file, full name, project), the hashes of its test file, of its own test call
539
608
  and of the production files, the failing message and the time. It is flagged `rollback` at a
540
609
  production state the case, or the lot, had already left: a production file moved back from the
@@ -562,8 +631,10 @@ the answer.
562
631
  into production, never further, and the module itself is production), its own snapshot. Every
563
632
  dependency found by import is followed in turn, and one found by a name written with its folder
564
633
  (`fixtures/scan.ts`, a full path): it brings the files it imports (`import type` included). A bare
565
- file name (`index.ts`) may be another file: the changed file it names is a dependency, not followed. A
566
- helper no red covers stays unfrozen, and the gate fails on it, unless a `revised` entry names it
634
+ file name (`index.ts`) may be another file: the changed file it names is a dependency, not followed. The
635
+ `setupFiles` of the package's vite or vitest configs (test code no test imports) are a dependency of every
636
+ test file, followed as an import: a red freezes a changed one, a `revised` entry naming it lets a red
637
+ freeze it. A helper no red covers stays unfrozen, and the gate fails on it, unless a `revised` entry names it
567
638
  (below). A Vite import query or fragment (`./x.worker?worker&url`, `?raw`, `?url`, `?inline`, `#part`) is
568
639
  left out of the file the import names; a specifier starting with `#` is a subpath import. The files of
569
640
  the change an `import.meta.glob(...)` of its test code matches (a pattern relative to the file, `/` for
@@ -647,10 +718,11 @@ the answer.
647
718
  red when it fails) and freezes its file and the changed test code it depends on. A file or glob entry
648
719
  may also name a test helper (test code that is not a test file: a helper, a fixture, a constant beside
649
720
  the tests) edited at review while its dependent cases stay green: the next `tdd red` freezes it at its
650
- new hash and prints `revised <helper> <reason>`, when every changed test file depending on it (at
651
- least one) is in the run and frozen by it with no case red (a refused file, a red still waiting for
652
- its green, or no dependent file in the run leaves it unfrozen; a changed dependent outside a targeted
653
- run too, named on an `unfrozen <helper>` line). The new freeze makes the dependent
721
+ new hash and prints `revised <helper> <reason>`, when every changed test file depending on it
722
+ is in the run and frozen by it with no case red (a refused file, a red still waiting for
723
+ its green, or a changed dependent outside a targeted run leaves it unfrozen, named on an
724
+ `unfrozen <helper>` line). A helper that no changed test file depends on (its dependents are all
725
+ unchanged since the base) is frozen by any `tdd red` whatever its files, with the entry's reason. The new freeze makes the dependent
654
726
  cases' earlier green stale: `tdd green` proves them again. Without that red run the gate fails on the
655
727
  edit; `status` lists the revised cases, the gate and the hand-over card list the revisions (cases
656
728
  and helpers) with their reason, an entry (exact, file or glob) no revised case or helper used as a
@@ -674,8 +746,11 @@ the answer.
674
746
  iterating, run the case with `npx vitest run <file> -t "<case>"`), its barrel export and, for a new
675
747
  namespace, the namespace module and its registration. Its JSDoc summary and `@intent` start with
676
748
  `FILL:`, which `skills check` refuses until written; the command prints every placeholder left.
677
- - `dialecte handover write <lots.json> [--release] [--out <id|folder>] [--rehash] [--json]` (or `dialecte handover <lots.json>`) prepares the commit-by-lots
678
- hand-over a human runs. `--release` marks it a release hand-over (`"release": true` in the lots file): its card
749
+ - `dialecte handover write <lots.json> [--release] [--target <branch>] [--out <id|folder>] [--rehash] [--json]` (or `dialecte handover <lots.json>`) prepares the commit-by-lots
750
+ hand-over a human runs. `--target <branch>` names the branch the hand-over must not be behind (default: the
751
+ [base branch](#the-base-branch)); it is written as `target` in the lots file. A branch with no ref, local or on
752
+ origin (`--target nope: no such branch, local or on origin`), a `--target` with no branch after it, or no base
753
+ branch to default to, is refused (exit 2, nothing written). `--release` marks it a release hand-over (`"release": true` in the lots file): its card
679
754
  then holds a required `gate release` row, green only with a green `gate --release` record of the tree it commits.
680
755
  The lots file names the repository, the branch and HEAD expected, and the lots (paths, message):
681
756
 
@@ -709,7 +784,7 @@ the answer.
709
784
  existing ancestor, then the rest) before anything is written, so `commit.sh`, the lock, the card, `--json`'s
710
785
  `folder` and the registry all hold it. A word naming both an existing folder and a lot is the folder: the
711
786
  card's output starts with the note saying so (`outNote` in `--json`). Refused (exit 2, nothing written), when the folder is a lot folder, in
712
- this order: a simulated lot (`a simulated lot has no hand-over`), a `canceled` or `failed` lot, an open
787
+ this order: a damaged lot (`<name> is damaged (<reason>): ...`, naming `lot stop`), a simulated lot (`a simulated lot has no hand-over`), a `canceled` or `failed` lot, an open
713
788
  question (`answer q<k> first: dialecte lot answer <full name> q<k> "<answer>" ...`), a lots file whose
714
789
  repository is not the lot's worktree or whose branch is not the lot's (both named); and for any folder whose
715
790
  registered hand-over is `committed` (`<name> is committed: a committed hand-over is never rewritten`). Every hand-over
@@ -740,7 +815,8 @@ the answer.
740
815
  is `hand-over: <repository folder> <branch>`, with the worktree's index first from a numbered worktree
741
816
  (`hand-over: 0171 cli feat/x`: the repository's own folder name, so the number is shown once). The commit
742
817
  section ends with the `worktree` line: the worktree the lots are committed in, relative to the workspace
743
- when it is inside it (`.worktrees/0171-cli-x`, `cli` for the main checkout), else its absolute path. Its
818
+ when it is inside it (`.worktrees/0171-cli-x`, `cli` for the main checkout), else its absolute path; both
819
+ compared by real path, so a side reached through a link (`/var` and `/private/var`) reads the same. Its
744
820
  first line is the verdict: `READY` when no gate line failed and none ran on another tree, `BLOCKED` with
745
821
  `<n> gates failed: <names>` and `gates ran on another tree: <names>`, `DONE` once a real run committed
746
822
  every lot; then the lots, files and `+<added> −<removed>` (`all gates green` when nothing blocks), and
@@ -759,7 +835,10 @@ the answer.
759
835
  the hook counts tests: a merge hand-over rehearsed or committed reads the hook's lines of the merged
760
836
  tree, the worktree's `tests` of its tree before the merge left out. No check leaves silently: a step
761
837
  the hook did not run reads `! skills not run on the merged tree` (a warning, not of another tree), a
762
- failed one stays `✗ ... (the tree changed since)`, and `tdd` stays the worktree's), then, in a consumer, `mutation` when the package declares a mutation scope (below), then
838
+ failed one stays `✗ ... (the tree changed since)`, and `tdd` stays the worktree's: on the DONE card of a
839
+ merge hand-over the tdd verdict is judged on the worktree's own lot tree (the tree its first merge lot
840
+ merged onto), current while the hook record of the merged tree stands, so no `gates ran on another tree`
841
+ for it), then, in a consumer, `mutation` when the package declares a mutation scope (below), then
763
842
  `review` from the hand-over folder's findings ledger and `round-<n>/` snapshots, then `standard`. `✓`
764
843
  passed; `!` to look at (a step not run here, with its reason, or not run after a failure; no
765
844
  findings ledger, or one holding no row yet: `no findings recorded`; only nits open); `✗` failed (a
@@ -796,7 +875,10 @@ the answer.
796
875
  it). `✓ standard consulted · <note>` when one is configured and the station recorded a consultation;
797
876
  `✗ standard configured, not consulted: dialecte lot standard <folder> consulted <note>` (blocks) when
798
877
  one is configured and none is recorded; `! standard not consulted: none configured (DIALECTE_STANDARD)`
799
- otherwise, with the recorded not-consulted reason when there is one: a warning that never blocks. The station records it
878
+ otherwise, with the recorded not-consulted reason when there is one: a warning that never blocks. A DONE card
879
+ (committed) shows the state recorded on the lot, never one read from the shell that ran the hand-over:
880
+ `✓ standard consulted · <note>`, `! standard not consulted · <reason>`, or
881
+ `! standard not consulted: none recorded on the lot`. The station records it
800
882
  with `dialecte lot standard <id|folder> consulted <note>` or `not-consulted <reason>` (the card's line
801
883
  names the hand-over's folder).
802
884
  - `contrib` (a contributor's): the rows of the `dialecte contrib` record of the tree the hand-over commits,
@@ -839,7 +921,33 @@ the answer.
839
921
  rehearsal's. The command stays under the box until every lot is committed. `dialecte handover --legend` prints every term the card can
840
922
  print, each in two lines: what it means, and whether to look.
841
923
 
842
- - `dialecte handover run <folder>` is what `commit.sh` runs. Each guard prints one line with its result
924
+ - `dialecte handover run <folder>` (and `--rehearse`) holds the machine awake while it runs, as `gate --full`
925
+ does, and writes `last-run.json` in the hand-over folder when it ends (before the card of a real run):
926
+ `sleptMs` when its wall time passed its monotonic time by over 60 s; the DONE card then prints
927
+ `! slept <duration> during handover run` in its gates.
928
+ - A hand-over written behind its target branch is not run. The card (READY or BLOCKED, `handover show <one>`)
929
+ prints `! main moved: merge main first (3 commit(s) on main, now 1a2b3c4d)` under its verdict, which reads
930
+ BLOCKED (`--json`: `targetMoved: { branch, ref, tip, behind }`). The target is held when its tip is an
931
+ ancestor of the lots file's HEAD or of a merge lot's tip. When some lots are committed already the line adds
932
+ `: write a new hand-over on the current HEAD with a merge lot of main`. A hand-over onto the target itself, a
933
+ committed one and an abandoned one are not judged; a lots file written before `target` existed is judged
934
+ against the base branch; a `target` that names no ref gives a `!` line with the refusal and BLOCKED.
935
+ - The card also lists the processes working in the worktree (`handover show <one>`, READY or BLOCKED; `lot
936
+ result`, the run picker and `handover list` never look): `✗ processes 2 left running in the worktree: 4123 node
937
+ …vitest --watch, 4177 npm run dev (stop them: kill 4123 4177)` blocks, `! processes open on the worktree:
938
+ code, zsh` and `! processes not known (<why>)` warn (`--json`: `processes: { leftBehind, tools, unknown? }`).
939
+ The run itself, its shell or agent, what it started and every process of its own process group (the other
940
+ commands of its pipeline, such as a `| grep` after it) are never listed: a leftover started in the same process
941
+ group as the cli (the same non-interactive shell command) therefore counts as the run's own. A process with a terminal, one
942
+ whose command (or an ancestor's) is a known editor or the one `git config dialecte.editor` names, and one
943
+ named in `git config dialecte.personProcesses` (a comma list of command names, never committed) is one of the
944
+ person's tools; every other process is left behind.
945
+ - `dialecte handover run <folder>` is what `commit.sh` runs. Two of its guards, `target` (the target branch's tip is held, as above) and
946
+ `processes` (read at run time, never from the card: a process left behind, or a list that cannot be read,
947
+ refuses; tools only pass with `!`), come after the merges guard. Either refusal
948
+ exits 2 with nothing committed, where every other guard exits 1; `--rehearse` prints `!` for each and goes
949
+ on. The merges guard's note for a merge lot of the target that moved reads `lot <n>: merges main at <sha>; main
950
+ is now <sha> (see target)`. Each guard prints one line with its result
843
951
  and its time (`✓ snapshot 110 file(s) 0.4 s`): repository, the lots file as reviewed, hooks
844
952
  folder, branch, HEAD, empty index, the files against the snapshot, deleted files, files outside the
845
953
  lots, references (citations, declared patterns, and the tags of a contributor), `contrib` in a contributor
@@ -1003,6 +1111,22 @@ the answer.
1003
1111
  card. An unknown name, or a folder that is no hand-over: exit 2, naming it. `--json` answers the card
1004
1112
  as data with its `folder` and `name`, as `dialecte handover --json` does, and `changedSinceReview` (the
1005
1113
  count of that line).
1114
+ - `dialecte handover review <name|index|folder> [--json] [--print]` opens the hand-over's worktree (the lots
1115
+ file's `repository`) in one new editor window and returns at once: the editor is started detached, its output
1116
+ ignored, never waited for. The hand-over is named as `show` names it. For a hand-over holding a merge lot it
1117
+ first writes `<hand-over folder>/review/lot.diff`, the lot's own change against the lots file's `head` (what is
1118
+ committed on top of it, staged, unstaged, and the untracked files git would add; ignored files left out; no
1119
+ colour whatever the git config), read through a scratch index so the repository is left as it was, and opens it
1120
+ in the same window. The editor: the worktree's `git config dialecte.editor` when set (its words, split as a
1121
+ shell splits them, then the paths; no flag added), else the first editor of a fixed list the cli knows found as
1122
+ an executable file on `PATH` (searched by the cli, no shell; opened with its new-window flag), else
1123
+ `code --new-window`; `$EDITOR` and `$VISUAL` are never read. `--print` prints the command line it would run (each word that needs it shell-quoted, so
1124
+ it runs as copied) and starts nothing; with `--json` too it prints that answer and starts nothing; `--json` answers `{ editor, command, opened }`. Exit 2: no
1125
+ argument, an unknown hand-over, a worktree that is gone (naming it), or an editor that is no executable file
1126
+ (`editor <word> not found: set git config dialecte.editor`), nothing started; with `--json` a refusal answers
1127
+ `{ error }`, the message as written. Every READY card gets a `review`
1128
+ section after the gates, `dialecte handover review <name> (opens <editor>)` (`review: { command, editor }` in
1129
+ `--json`), read from `PATH` when the card is built; BLOCKED, DONE and ABANDONED cards have none.
1006
1130
  - `dialecte handover run` without a folder runs the one registered hand-over still to run (its folder
1007
1131
  pending or partly committed; `--rehearse` too): an abandoned, committed, stale or gone one is skipped.
1008
1132
  Two or more: refused, nothing run and no run marker, one `name branch verdict` line each (`READY` or
@@ -1114,12 +1238,18 @@ the answer.
1114
1238
  - `dialecte lot status <id> [--json]` derives the lot's state from its records (`working`, `input-required`,
1115
1239
  `ready`, `committed`, `canceled`, `failed`), with the worktree and link checks and the exact next command (the
1116
1240
  text form adds an `also:` line when there is one, five lines at most); it
1117
- reads files only, runs no git and writes nothing. Exit 0 for a lot found, 2 for an unknown or ambiguous id
1241
+ reads files only, runs no git and writes nothing. A damaged lot (a folder of the store whose name has a lot
1242
+ name's shape and whose records do not hold: no readable `identity.json`, one naming another folder, or a record
1243
+ that fails its check) answers `<name> damaged: <reason>` then `next: dialecte lot stop <name> --reason <text>`
1244
+ (`{ lot, state: "damaged", reason, next }` with `--json`), exit 6, never `no lot`; the reason is a fixed word
1245
+ of the cli, never a field of the record, and a lot with an unreadable identity is named by its folder. Exit 0 for a lot found, 2 for an unknown or ambiguous id
1118
1246
  (`{ error, next: null }` with `--json`) or a usage error (`{ error, usage, next: null }`). An
1119
1247
  `<id>` is an index (`171` = `0171`), a full name, a lot folder or `.dialecte/lot`; a word naming an existing
1120
- folder is that folder. The review rounds' verbs take `<id|folder>` the same way (a write needs an index
1248
+ folder is that folder; a damaged lot is named by its id (index or full name), a path to it does not find it. The review rounds' verbs take `<id|folder>` the same way (a write needs an index
1121
1249
  unique across every store of the list), and a lot folder is accepted as their hand-over folder although it
1122
- sits in the git folder.
1250
+ sits in the git folder. Two workspaces of the store list may give the same full name (the same index,
1251
+ repository folder name and branch tail): that name is then ambiguous (exit 2 listing both); give the lot
1252
+ folder instead.
1123
1253
  - The host loop: `lot start -> lot wait -> (lot answer -> lot wait)* -> lot result`. Every output names the exact
1124
1254
  next command with the lot's full name, and the exit code says what the host does next (section below). Every
1125
1255
  answer of `status`, `wait`, `answer`, `result` and `stop` goes to standard output, whatever its exit code; only
@@ -1133,21 +1263,26 @@ the answer.
1133
1263
  nothing), 4 when the last transition is a limit (run again), 5 when `--timeout` is reached while the lot still
1134
1264
  works. A real lot is looked at every second, by a stat of its folders and of the registry, and read again only
1135
1265
  when one changed, nothing written; on a terminal a `waiting <name> (<state>,
1136
- <elapsed>)` line refreshes (never under `--json`). A simulated lot is played up to its next blocking point.
1266
+ <elapsed>)` line refreshes (never under `--json`). A simulated lot is played up to its next blocking point; one
1267
+ with nothing left to play (no `scenario.json`, or every step played) never waits: it answers its state at once,
1268
+ as `lot result` does (a working lot: exit 5), whatever `--timeout`. A damaged lot answers at once with exit 6,
1269
+ as `lot status` prints it.
1137
1270
  - `dialecte lot answer <id> <question> "<answer>" [--by <who>] [--json]` records the answer to an open question
1138
1271
  once, then prints the status with `next: dialecte lot wait <name>`. The answer is one line; a question with
1139
1272
  options takes one of them (compared trimmed, case-folded, recorded as the option is written); the same answer
1140
1273
  again is `already`, another one is refused. A person's question needs `--by <who>` (not `caller`); a caller's
1141
1274
  defaults to `caller`. `--by` is one line, not empty, checked before the lot is read (exit 2 naming `--by`).
1142
1275
  A refusal's text form escapes the options, answer and `--by` it quotes (a line feed in them prints as
1143
- `\u{a}`, the refusal stays one line); `--json` carries them as stored.
1276
+ `\u{a}`, the refusal stays one line); `--json` carries them as stored. A damaged lot takes no answer (exit 2,
1277
+ naming the lot, its damage and the stop to run; nothing written).
1144
1278
  - `dialecte lot result <id> [--json]` never blocks and writes nothing. A `ready` or `committed` lot exits 0 with
1145
1279
  `{ lot, state, handover: { name, folder, state, card, show, run }, worktree, branch, questions, simulated }`:
1146
1280
  the card is the one `handover show --json` computes, `handover.state` the hand-over's own state read from git
1147
1281
  (`committed` once its lots are committed, even before the registry says so), `questions` the answered ones
1148
1282
  (`{ id, text, answer, by }`); a simulated lot's `handover` is `{ simulated: true }`, nothing to show or run.
1149
1283
  `failed` and `canceled` exit 1 with `{ state, reason, at, position }` of the last transition, `input-required`
1150
- exits 3 with the open questions, `working` exits 5. The text form prints agent text escaped.
1284
+ exits 3 with the open questions, `working` exits 5, a damaged lot exits 6 (as `lot status` prints it). The text
1285
+ form prints agent text escaped.
1151
1286
  - `dialecte lot stop <id> --reason <text> [--by <who>] [--json]` ends a lot. A `committed` lot is refused
1152
1287
  (exit 2). A pending hand-over is abandoned first, as `handover abandon` does (`abandoned.json`, the registry
1153
1288
  entry `abandoned`, the lock released when it names that hand-over); while its run is in progress, or once it is
@@ -1155,7 +1290,19 @@ the answer.
1155
1290
  reason, `--by` or `caller`), and the registry is read once more: a hand-over registered meanwhile is abandoned
1156
1291
  at once. A lot already `canceled` exits 0 writing nothing; one whose entry is still `pending` (a crash inside an
1157
1292
  earlier stop) is repaired. It moves no worktree and deletes nothing; `lot close` and `worktree prune` let the
1158
- worktree go once the lot is canceled. The reason and `--by` are one line, not empty (exit 2).
1293
+ worktree go once the lot is canceled. The reason and `--by` are one line, not empty (exit 2). A damaged lot is
1294
+ stopped by moving its folder aside, never deleted and nothing written into its broken records first: to
1295
+ `<git common folder>/dialecte-lots-aside/<name>` (`-2`, `-3`, ... appended when the name is taken, an empty
1296
+ folder included), with a `stopped.json` (`reason`, `by`, `at`, `damage`) inside the moved folder (a lot folder
1297
+ that is a symbolic link: the link is moved, never its target, and the record is `<aside name>.stopped.json`
1298
+ beside it). It prints `stopped <name>: damaged (<reason>); its folder is now <path>` (`{ lot, state:
1299
+ "moved-aside", damage, folder }` with `--json`). Its index stays claimed, its worktree and branch stay; refused
1300
+ (exit 2, nothing moved) while a live run marker holds the folder or a pending registry entry names it (first:
1301
+ `handover abandon <entry>`); a stop that finds the folder gone (another
1302
+ stop moved it) says `no lot <id>`. Until it is moved aside, a damaged lot holds its paths: the scope of its
1303
+ `brief.json` when that reads as a list of texts, else every path, so `lot start` refuses an overlap with it
1304
+ (`overlap with <name> (damaged: <reason>): ...`, or `its scope cannot be read: it holds every path`); one whose
1305
+ identity reads simulated holds none.
1159
1306
  - `dialecte lot start --simulate <scenario>` starts a simulated lot that plays one of the scenarios (`ready`,
1160
1307
  `question`, `person`, `two-questions`, `limit`, `failure`, `slow`) under `lot wait`, publishing the records a
1161
1308
  real run would: it writes only its lot folder, one line of the store list and one index claim, never a branch,
@@ -1171,12 +1318,36 @@ the answer.
1171
1318
  question, `handover show`, `lot result` or `lot stop`); then `working <n> · simulated <m> (listed with
1172
1319
  --simulated)`. `--repository` keeps the lots whose repository folder has that name, `--simulated` lists the
1173
1320
  simulated lots that wait. A lot folder whose `identity.json` does not read, or whose records do not hold, is a
1174
- `damaged <folder>: <reason>` line. The records are checked once, on read: a question id is `q<k>` (k 1 or
1321
+ `damaged <folder>: <reason>; next: dialecte lot stop <name> --reason <text>` line (a `.tmp-` folder being built,
1322
+ or a folder whose name has no lot name's shape, is no lot). The records are checked once, on read: a question id is `q<k>` (k 1 or
1175
1323
  more), an audience `caller` or `person`, a position's step, of and round non-negative integers, a transition's
1176
- `at` a time, an answer file's question its file's `q<k>`. Every lot verb refuses such a lot (exit 2), so no
1177
- forged field reaches a line or a `next`. It reads files only (each registry once per store), runs no process, writes nothing. `--json`:
1324
+ `at` a time, an answer file's question its file's `q<k>`. Every lot verb names such a lot damaged (exit 6 for
1325
+ `status`, `wait`, `result`; `answer` refuses, exit 2), so no forged field reaches a line or a `next`. It reads files only (each registry once per store), runs no process, writes nothing. `--json`:
1178
1326
  `{ waiting: [<status of each waiting lot>], working, simulated, damaged }`. Exit 0 when something waits or is
1179
1327
  damaged, 1 when nothing does, 2 for a usage error.
1328
+ - `dialecte plan next <plan.md> [--json] [--all]` reads a plan's lot block (one fenced block with the info string
1329
+ `json dialecte-lots` in the plan, or `<plan without .md>.lots.json` beside it; both or neither is refused) and proposes what can
1330
+ start now; it starts, claims and writes nothing. Each entry declares an `id`, a `kind` (`lot`, `fix`, `spec`,
1331
+ `person`), `dependsOn`, a `scope` per repository (`"."` is the whole repository), extra `heavy` steps
1332
+ (`mutation`, `browser`, `release`), a `brief`, and a `match` (`branch`, `handover`, `feature`) by which its
1333
+ records are found; the block's `shared` files (the changelog, the README, the command map) never hold a lot back.
1334
+ An entry's state is read, never declared: done by a committed hand-over or store lot, open by a store lot, a
1335
+ pending hand-over or a worktree on its branch, else ready, waiting, parked, or unknown with the reason when its
1336
+ repository cannot be read (files only: the stores, the registries, `worktrees/*/HEAD`; no git process). The text
1337
+ says the counts, the open lots (and open work no entry accounts for: its repository's proposals are
1338
+ `unverified`), the lots that can start in critical-path order (`unblocks 7 (chain 4)`, `after <id>`, `merge:
1339
+ <open lots>`, `next: dialecte lot start <brief>` or the brief to write), the ready lots held by an open one with
1340
+ each scope pair met, person entries without a mark, the spec work (a spec missing or `DRAFT`), what each entry
1341
+ waits for, the parked ones, then the machine: the live heavy steps with their worktree and age, the load against
1342
+ twice the cores, the free and inactive memory against 2 GB (`vm_stat` on macOS, `/proc/meminfo` on Linux); a
1343
+ proposal whose heavy steps would run beside a live one says `stacks:`, and on a short machine its heavy steps
1344
+ would wait (advice only). `--all` lists the done entries; `--json` answers `{ plan, repositories, counts,
1345
+ entries, proposals, held, specWork, heavy, unknown }`. Exit 0 when a lot or fix can start, 1 when none can, 2
1346
+ for a usage error, no block or an invalid one (every fault listed), or a repository that is not a git checkout.
1347
+ `dialecte plan check <plan.md> [--json]` checks the block alone: one line when valid, else every fault (exit
1348
+ 2). `dialecte plan mark <plan.md> <id> done --by <who> [--reason <text>]` records a person entry's mark once in
1349
+ the machine's state folder (`<state>/dialecte/plans/`); a `lot` entry's state comes from its records and is
1350
+ refused.
1180
1351
  - `.dialecte/lot` reaches the lot folder, whose `round-<n>/` snapshots hold copies of the lot's files, tests
1181
1352
  included. Leave `.dialecte/` out of every tool that walks the worktree: a test runner whose globs include dot
1182
1353
  folders, a formatter, a linter. Git already leaves it out (`worktree add` excludes it).
@@ -1239,28 +1410,124 @@ the answer.
1239
1410
  `node_modules` read against the lockfile where it is; then the links of its `node_modules`
1240
1411
  made absolute where they are, the worktree moved to the trash (`.worktrees/_trash/`, by
1241
1412
  `git worktree move`), its `node_modules` parked in the pool (`.worktrees/_pool-<repository>-<n>`) from
1242
- there, its caches left in the trashed folder, and the trashed worktree removed in the background. Kept,
1413
+ there, its caches (`.vite`, `.cache`) sent to their own `_trash/` entries, and last the trashed worktree
1414
+ removed in the background by `git worktree remove` without `--force`: git refuses a worktree written into
1415
+ since the check, which then stays registered in `.worktrees/_trash/` for you to look at (one line says so
1416
+ when something closed). Paths are compared by their real path as spelled on disk (a path typed in another
1417
+ case on a case-insensitive volume matches). Before the move, the lot's final record is kept: the card line
1418
+ of its `cards.log` (the one `handover run` wrote when it committed; else a recomputed one, marked
1419
+ `recomputed`, built without the probe), read back and parsed, then a `removing` line naming the worktree,
1420
+ its branch and the branch tip; after the move a `removed` line says `trashed` or `kept`. Kept also, with
1421
+ why: `final record not kept: <reason>` when the record cannot be written or read back, and `the lot's
1422
+ commit is not known` (with where to look and how to remove the worktree by hand) when a committed lot's
1423
+ commit can be found neither among its lot commits nor in the worktree's hook record (read only when no
1424
+ other committed hand-over shares the worktree). Every other hand-over of the worktree gets its card line
1425
+ too, `head` its last lot commit or `null`. Kept,
1243
1426
  with why and nothing done for that hand-over: first, a worktree a lot of the repository's store names
1244
1427
  (by real path) while the lot is not `committed` nor `canceled`, reason `lot <full name> <state>` (the
1245
1428
  store read once, no git process per lot); a hand-over still `pending`; its worktree is the main
1246
1429
  checkout (never parked, moved or trashed); no registered worktree at that path (closed already, or one
1247
1430
  in the trash or the pool: never a target again); a worktree on another branch than the hand-over's
1248
- (both branches named: it holds other work now); a `locked` worktree (`git worktree lock`); a mutation
1431
+ (both branches named: it holds other work now); a `locked` worktree (`git worktree lock`); another
1432
+ hand-over registered for the same worktree that is neither `committed` nor `abandoned` (named); a mutation
1249
1433
  run started from it that still runs or died before reporting; `lot close` itself run from inside it
1250
1434
  (run it from another folder); a process whose working folder is in it;
1251
- the processes not known (`lsof` failed or took longer than 20 s); a `dirty` worktree (anything
1435
+ the processes not known (`lsof` failed or took longer than 20 s); a link from outside the worktree
1436
+ pointing into it (`the link <path> points to it`: the links directly in the workspace, `.worktrees/`,
1437
+ `_commit-plan/` and the scratch roots, and those in `node_modules/` and `node_modules/@*/` of every
1438
+ worktree and main checkout of the workspace's repositories, read once per call; the worktree's own links
1439
+ never count); a `dirty` worktree (anything
1252
1440
  `git status --porcelain --untracked-files=normal` lists, untracked files included whatever
1253
- `status.showUntrackedFiles` says). The branch is never touched (`worktree prune` still lists the merged
1441
+ `status.showUntrackedFiles` says); a HEAD reflog reaching commits that neither the hand-over's branch, the
1442
+ base branch nor a remote-tracking ref holds (a commit made on a detached HEAD: the reflog goes with the
1443
+ worktree); ignored files its removal would delete that nothing else holds (`ignored files git worktree
1444
+ remove would delete: .env`, the first three named past three): rebuilt folders (`node_modules/`, `dist/`,
1445
+ the VitePress caches, the hooks folder, the `dialecte.rebuiltIgnored` folders), `.DS_Store`, the
1446
+ `.dialecte/lot` link, a `.dialecte/lot.json` that is empty or byte-equal to the one archived by a
1447
+ committed hand-over of this worktree, and files byte-equal, mode included, to the same path in the main
1448
+ checkout go; anything else keeps it, `.dialecte/notes.md` included. The branch is never touched (`worktree prune` still lists the merged
1254
1449
  ones). Each line names the folder it moved and where `node_modules` went (`closed <name>: 0007-cli-x;
1255
1450
  node_modules pooled in _pool-cli-1`, or `trashed: <why it was not parked>`); a failure part-way keeps
1256
- that hand-over with the error and what was already moved, the others go on. Exit 0 when every named
1257
- hand-over closed, 1 when one was kept, 2 for a name or index the registry does not hold (then nothing is
1258
- closed); `--json` prints `[{ handover, closed: true } | { handover, kept }]`.
1451
+ that hand-over with the error and what was already moved, the others go on. A hand-over it closes gets
1452
+ `closed` (the time) on its registry entry; closing it again prints `<name> already closed`, nothing
1453
+ decided nor moved (an entry without it, a worktree removed by hand, is still kept: `nothing to close`).
1454
+ Exit 0 when every named hand-over closed (or was already closed), 1 when one was kept, 2 for a name or
1455
+ index the registry does not hold (then nothing is closed); `--json` prints
1456
+ `[{ handover, closed: true, already?: true } | { handover, kept }]`.
1457
+ - Recording a lot. Every record below is appended to a file, never rewritten; a reader skips a half line and a line
1458
+ it cannot parse, and counts them.
1459
+ - `dialecte lot station <id> start <station> [flags]` and `lot station <id> end <station> [--run <run>] [flags]`
1460
+ append one station event to the lot's `events.jsonl` (`by: host`): the host says which station ran, with
1461
+ which step, round, attempt, agent, vendor, model, tier, effort, session and skills (`--skill` seen,
1462
+ `--skill-asked` asked by the brief), and, at its end, tokens (`--tokens-in`, `--tokens-out`,
1463
+ `--tokens-cache-read`, `--tokens-cache-write`, `--tokens-total`), `--money <amount> <currency>`,
1464
+ `--duration`, `--exit`, `--verdict` and `--suite <name>=<runs>` for suites the agent ran itself. Nothing but
1465
+ the station is required; a field nobody gave stays unknown. `start` answers a `run` and the `end` command to
1466
+ run; `end` pairs with `--run`, else with the one open start of its station whose step, round and attempt match
1467
+ the ones it gives (several: refused), else is recorded alone. `--event <id>` makes a retry safe: the same id
1468
+ with the same fields answers the first event (`already`) and writes nothing, other fields are refused.
1469
+ `start` is refused on a committed, canceled or failed lot, `end` is accepted in every state. The station
1470
+ names `shared` and `outside` are the report's own labels and are refused. `lot station <id> --from
1471
+ <file.json>` takes the same fields as one JSON object, plus `phase` (`start` or `end`); an unknown key
1472
+ is refused, every fault at once. A line over 4,096 bytes is refused. Exit 1 when the event cannot be written, 2
1473
+ for a usage error or a refusal.
1474
+ - Step events: the cli writes `step.start` and `step.end` events (`by: cli`) into the lot's `events.jsonl` for
1475
+ `gate --fast`, `--full`, `--release` and `--hook`, `contrib`, `tdd red`, `tdd green`, `mutants run`,
1476
+ `handover run` (real and rehearsal), `lot delta --worktree` and `worktree add`: the step, whether it is heavy,
1477
+ its exit, its time, whether a gate reused records, and per gate step its status, counts, time and selection. A
1478
+ step in a worktree that links no lot, or none matching, writes nothing. A write that fails prints one
1479
+ `events: not recorded: <reason>` line and never changes the step's exit; a step killed after its start writes
1480
+ its end as interrupted where it can. Long lists are cut, failing parts first. A step run in a worktree whose
1481
+ link names a lot that lives elsewhere (a copied or moved worktree) is written to that lot as `step.foreign`.
1482
+ - `dialecte.stepEvents` in the cli's own `package.json` (`"stepEvents": 1`) tells a host that this cli writes step
1483
+ events. Each event notes the capability of the cli installed in the lot's worktree; a cli without it (an
1484
+ older release or source) writes none, so the report shows the step counts of such a lot as unknown rather
1485
+ than 0.
1486
+ - Heavy steps (`gate --full`, `--release`, `contrib`, `mutants run`, a rehearsal, a gate step the package
1487
+ declares heavy, and for the last only while that part runs) write a live marker in
1488
+ `<state folder>/dialecte/heavy/` (`$XDG_STATE_HOME`, else `~/.local/state`): the step, the lot, the
1489
+ worktree, the process and its start time. The step removes it at its end; a marker whose process is gone, or
1490
+ runs with another start time, is dead and ignored. A person's run outside any lot writes the marker too, and
1491
+ no event. This is how a host sees which heavy step runs now, and since when.
1492
+ - `dialecte lot report <id> [--json]` reads files only (no git, no process, nothing written) and prints one lot:
1493
+ its state, feature, effort, steps and rounds; per station run the agent, tier, model, tokens, time, suites
1494
+ and skills; totals for tokens (each field with how many stations did not report it, a lower bound when a
1495
+ total is not exact), money per currency (with how many stations reported none), and time (the lot's elapsed time as agents, cli steps, waiting for
1496
+ answers, waiting for the machine and the rest); the suites per step family with their counts, reuse and
1497
+ reruns, attributed to the station whose time holds the step (`shared` when several, `outside stations`
1498
+ when none, and always for the steps the orchestration runs; a step a person runs by hand during a
1499
+ station lands on that station); the heavy steps, the folders (worktree add, throwaways, trash), the review
1500
+ rounds from the findings ledger, the events counted (damaged, duplicates, unknown kinds) and the next
1501
+ command. A number nobody reported is `unknown` in the text and `null` in `--json`, never 0. A step family
1502
+ reads unknown, with the reason, when the worktree's cli writes no step events, when a record of a step has
1503
+ no run in the events, or when nothing of the lot's steps left a trace. `dialecte lot report --feature <name>
1504
+ [--simulated] [--json]` gives one line per lot of the feature, in every store of the store list and the
1505
+ current folder, then the totals by station and by tier; simulated lots are counted apart and listed by
1506
+ `--simulated`; a lot whose folder is gone is listed from its `cards.log` line. Exit 1 when the feature names
1507
+ no lot, 2 for an unknown or ambiguous id.
1508
+ - The hand-over card gains a `usage` row (tokens, agents, runs, agent time, and the report's command) when the
1509
+ hand-over folder is a lot folder holding a station event; `handover show --json` carries `usage`. A folder
1510
+ with no station event shows no row.
1511
+ - `cards.log`, in `<git common folder>/dialecte-handover/`, one per repository: one JSON line per record,
1512
+ appended in one write, never rewritten, never rotated. A `card` line is a lot's final record: its hand-over
1513
+ card, usage and the times of its gate, tdd and hook records (a worktree's records go with it), written by
1514
+ `handover run` once a commit is recorded, or by `lot close` when none exists. A `removing` line is written
1515
+ before a worktree moves (its path, branch, branch tip and record times), a `removed` line after it (the same
1516
+ id; `trashed` or `kept`). A `removing` without its `removed` reads as unknown. The report reads these lines
1517
+ for lots whose worktree or folder is gone.
1518
+ - `dialecte lot export <id> <dir> [--json]` copies a lot folder to `<dir>/<full name>/`, `asks/` left out, links
1519
+ kept as links (one pointing outside the folder is named), with the lot's `cards.log` lines and registry
1520
+ entry added as `cards.log` and `registry.json`. It is refused (exit 2, nothing written) for an unknown or
1521
+ ambiguous id, for a `<dir>` inside a git work tree or a git folder, and when `<dir>/<full name>` exists.
1522
+ The copy is made into a temporary folder beside it and each file's size and checksum compared with the
1523
+ source's (`events.jsonl` as a prefix, since a running lot appends); a difference makes one more copy of
1524
+ that file, a second one removes the temporary folder and exits 1 naming the file; a match renames it. The
1525
+ source is never written; another run's temporary folder is named, never removed.
1259
1526
  - `dialecte mutants run [--mode changed|audit] [--base <ref>]` runs StrykerJS (resolved from the package,
1260
1527
  its devDependency) on the scope `package.json` declares:
1261
1528
  `"dialecte": { "mutation": { "scope": [...], "exclude": [...], "errorFactories": [...], "fast": { "vitestConfig": "..." }, "full": { "command": "..." } } }`.
1262
- `changed` mutates the scope lines changed since the merge base with the base branch (`dialecte.baseBranch`,
1263
- `main` when not said; then the remote's default branch, `refs/remotes/origin/HEAD`; with neither the run
1529
+ `changed` mutates the scope lines changed since the merge base with the base branch (found as
1530
+ [the base branch](#the-base-branch) is; with none found, or a `dialecte.baseBranch` naming no branch, the run
1264
1531
  is refused, exit 2, naming `dialecte.baseBranch` and `--base`) or `--base <ref>`, untracked scope files
1265
1532
  whole; `audit` the whole scope (no base needed). Without `--mode` the lot's switch decides; with no switch,
1266
1533
  `changed` when the change touches the scope, else `mutation off for this lot` and exit 0. A detached HEAD is
@@ -1375,7 +1642,9 @@ on its exit code or its counts is run once more with `--no-file-parallelism`, on
1375
1642
  run named (through `npm run <script>` after one `--`; the whole step when the output names no file). The
1376
1643
  rerun passes when it exits 0, counts no failed test and at least one passed: the step then passes,
1377
1644
  flagged - `serial rerun of <n> file(s): exit 0, <counts> flaky in parallel` on its line, one
1378
- `flaky <file>` line under it per file, the note kept in the gate record. Otherwise the step fails as a
1645
+ `flaky <file>` line under it per file, the note kept in the gate record; the hand-over card's row of such a step,
1646
+ or of a hook's test step `gate --hook` flagged so, reads `✓ <step> <passed> passed · <n> flaky, passed serially`
1647
+ (n the flaky files), never a failed count. Otherwise the step fails as a
1379
1648
  `real failure: <why>`, each file listed under it as `failed <file>` when it failed again or `flaky <file>`
1380
1649
  when it passed serially, the rerun's last lines as the tail. While the rerun runs, the step's line still
1381
1650
  shows its own command. A step that stalled, counts no tests, runs no vitest, or already runs one file at a time
@@ -1392,7 +1661,10 @@ case passes `tdd red` as accepted and does not block its file (a case already pr
1392
1661
  its proof: an acceptance never overrides one, and an accepted receipt counts only while its entry stays in
1393
1662
  the file); the gate lists each acceptance with its
1394
1663
  reason, the hand-over card counts them by reason from the receipts (those of earlier lots, which the file
1395
- no longer names, counted on one line), and both report an acceptance or a `revised` entry no case used. The card
1664
+ no longer names, counted on one line), and both report an acceptance or a `revised` entry no case used (the
1665
+ gate's `unused accept` line adds `; the closest: <file>::<name>` when a case title of the change is close). An
1666
+ entry names a title with its quotes folded: a straight `'` or `"` matches a curly one (`’`, `‘`, `“`, `”`) and
1667
+ the reverse; nothing else (a backtick, a prime, the letter case) compares alike. The card
1396
1668
  lists every `gone` entry with its reason; only the gate reports a `gone` entry that covers no finding. The file is strict: an unknown key, at the top or in
1397
1669
  an `accept` entry, and an exemption without a reason are refused, naming what is wrong. A lot the orchestrator declares exempt - a wording, rename or doc-only lot - passes with its reason
1398
1670
  and what the change touches: `{ "tdd": "exempt: <reason>" }` in `.dialecte/lot.json` at the package root
@@ -1418,15 +1690,20 @@ A package tunes them in its package.json:
1418
1690
  "generatedDocs": [".vitepress/data/elements-catalog.json"],
1419
1691
  "referencePatterns": ["SPEC-[0-9]+"],
1420
1692
  "allowReferences": ["ticket number"],
1421
- "baseBranch": "main"
1693
+ "baseBranch": "main",
1694
+ "rebuiltIgnored": ["coverage/"]
1422
1695
  }
1423
1696
  ```
1424
1697
 
1425
1698
  `gate.fast` / `gate.full` replace the default steps of that mode (`counts: "tests"` makes a step fail
1426
1699
  when it counts no test; `changedOnly: true` marks a step that runs only the tests the change affects,
1427
1700
  so "No test files found" passes with a note instead of failing; `restoresGeneratedDocs: true` restores the `generatedDocs` byte for byte after
1428
- it); `baseBranch` is the branch
1429
- `worktree add` starts from and `worktree prune` compares with (default `main`); `referencePatterns` adds the package's own patterns (extended regular expressions) to the
1701
+ it); `baseBranch` optionally names
1702
+ [the base branch](#the-base-branch); `rebuiltIgnored` lists ignored
1703
+ folders a build or a run rebuilds, which `lot close` may delete with a worktree: each a folder ending with `/`,
1704
+ relative to the package root, read from the `package.json` of the main checkout nearest the ignored path (a
1705
+ worktree's own declaration counts for nothing); an invalid entry (empty, absolute, holding `.` or `..`, without its
1706
+ trailing `/`, not a string) is ignored, and an ignored folder nobody declares keeps the worktree; `referencePatterns` adds the package's own patterns (extended regular expressions) to the
1430
1707
  citations (and, in a contributor, the tags) `rules` and `handover` refuse; `allowReferences` is the contributor's
1431
1708
  opt-out: it lifts generic tags a contributor commits on purpose - `ticket number`, `acceptance criterion`,
1432
1709
  `plan tag` - and refuses any other label in either profile: a citation of a standard is never allowed. A consumer
@@ -1436,7 +1713,7 @@ rehearsal copies it as the same relative link).
1436
1713
 
1437
1714
  **Scoped steps, heavy steps, the release list.** A step of `fast`, `full` or `release` may say `"scoped": true`
1438
1715
  (never with `changedOnly`, never in `contrib.steps`): the gate resolves one base per run - `--base <ref>`, else the
1439
- merge-base of HEAD and `baseBranch` (local, else `origin/`), else the empty tree (everything changed) - and hands the
1716
+ merge-base of HEAD and [the base branch](#the-base-branch), else the empty tree (everything changed) - and hands the
1440
1717
  step `DIALECTE_GATE_BASE`, `DIALECTE_GATE_TREE`, `DIALECTE_GATE_CHANGED` (a file of the changed paths byte for byte,
1441
1718
  NUL-separated, both paths of a rename, relative to the repository top as `git diff --name-only` names them, while a
1442
1719
  declared `failing` path is relative to the package root) and `DIALECTE_GATE_SELECTION` (a path to write). The step writes there
@@ -1469,6 +1746,47 @@ is no list of steps, a step without `name` or `run`, a `scoped` or `heavy` that
1469
1746
  `changedOnly`) is refused naming the list and the step: `gate`, `contrib` and `handover run` exit 2, `gate --hook`
1470
1747
  exits 1, the card prints `✗ gate invalid gate config: <message>`.
1471
1748
 
1749
+ **Opting out of a default step.** A package that has no use for a default step (no skills folder, no type
1750
+ benchmark yet) says so, with a reason, instead of wiring a script:
1751
+
1752
+ ```json
1753
+ "dialecte": {
1754
+ "gate": { "skip": { "skills": "no skills folder in this package" } },
1755
+ "contrib": { "skip": { "type-bench": "no type benchmark yet" } }
1756
+ }
1757
+ ```
1758
+
1759
+ `dialecte.gate.skip` serves the default steps of `fast`, `full` and the release list that follows `full`;
1760
+ `dialecte.contrib.skip` the default `contrib` steps (`docs`, `type-bench`) when `contrib.steps` is not declared.
1761
+ A skip is only for a default step the package cannot run: an `npm run <x>` step whose script `x` is missing. A reason
1762
+ is a non-empty string of one line and at most 200 characters. A name that is no default step of a mode with no
1763
+ declared list, a step the package can run (its script is there, or it runs no npm script, as the default `tests`:
1764
+ `"tests": skip is for a step the package cannot run; remove the skip`), an empty or too long reason, or a `skip`
1765
+ that is no map is refused like any gate config (exit 2, naming the key and the name): an opt-out cannot go stale
1766
+ unseen, and adding the script makes its skip refused until it is removed. An opted-out step runs in no mode (`skip skills
1767
+ opted out: <reason>`; the card warns, never blocks), and a step the package declares has no opt-out: remove it or add its
1768
+ script. Adding or removing an opt-out changes the gate record's key, so the gate runs again.
1769
+
1770
+ ### The base branch
1771
+
1772
+ Every command that reads the base branch (the gate's base, `mutants`, `tdd`, `worktree add` and `worktree prune`,
1773
+ `lot close`, the hand-over's target) finds it the same way, the first rule that answers winning:
1774
+
1775
+ 1. `dialecte.baseBranch` when set (an optional override): the local branch, else origin's. Set to a branch that
1776
+ exists nowhere, it is refused, never replaced by another: exit 2 for the gate's base, `mutants`, `handover write`
1777
+ and `handover run`, exit 1 for `worktree add` of a new branch without `--from`; the commit hook fails, and the
1778
+ tdd step of `gate --full` fails with the same text.
1779
+ 2. The branch `origin/HEAD` names (recorded at clone), when that branch exists; the local one is preferred.
1780
+ 3. `main`, local, else origin's.
1781
+ 4. `master`, local, else origin's.
1782
+ 5. Nothing found: refused with `no base branch found (no dialecte.baseBranch, no origin/HEAD, no main, no master):
1783
+ name it as dialecte.baseBranch in package.json`. The gate alone keeps selecting everything (with a note) in that
1784
+ case; `worktree add` without `--from` refuses, `worktree prune` skips the repository with the text, `lot close`
1785
+ holds nothing through the base, and `tdd` measures from HEAD.
1786
+
1787
+ The repository field of `package.json` is a URL and is never read for this. `mutants` finds `origin/<b>` through
1788
+ the same rule and no longer takes a tag named like the base branch.
1789
+
1472
1790
  ### GitHub text: lot recap and text check
1473
1791
 
1474
1792
  Text written with an assistant tends to retell the diff and grow long. The pull request splits in two:
@@ -1668,6 +1986,14 @@ runs with git's `GIT_DIR`, `GIT_INDEX_FILE` and the commit's identity set: the s
1668
1986
  (`test/git-environment.setup.ts`, vitest `setupFiles`) clears them before any test, so a test's git acts on
1669
1987
  its scratch repository only, and the cli clears git's repository variables at its start.
1670
1988
 
1989
+ The cli gates itself with its own `dialecte.gate` (package.json). `--fast`: `check`, a scoped `tests` step
1990
+ (`node src/scoped-tests.ts`: `vitest related` over the paths changed between the gate base and the tree that a
1991
+ test can import, and an empty selection exits 0 without starting vitest) and a scoped `rules` step on the same
1992
+ changed list. `--full`: the default full steps (`check`, `skills`, `build`, the whole suite), then `rules` on the
1993
+ changes since the gate base. The suite's setup file also points `XDG_CONFIG_HOME` at a folder that does not exist
1994
+ (no person's forbidden words list is read) and sets `DIALECTE_KEEP_AWAKE=0` (no run of the suite holds the machine
1995
+ awake); a case that wants either sets it itself.
1996
+
1671
1997
  The suite leaves no temporary folder behind: every test removes what it makes in its own teardown, also
1672
1998
  when it fails. A vitest global setup (`test/suite-guard/temp-folder-guard.setup.ts`, `globalSetup`) gives
1673
1999
  the run one short folder of its own (`dlt-<random>` under the system's temporary folder) and sets it as