@dialecte/cli 0.4.0 → 0.6.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
@@ -25,9 +25,10 @@ shape. Exit codes: 0 an answer or green, 1 nothing found or a failed check,
25
25
  2 usage or refused; a command's help says when it differs.
26
26
 
27
27
  ```
28
- Discover api members schema explain standard
28
+ Discover api members schema explain standard facts
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
@@ -40,18 +41,20 @@ dialecte members <expr> # what an expression of the live types holds
40
41
  dialecte schema <Tag> # what an element may hold and where
41
42
  dialecte explain <code> # what an error or diagnostic code means, when it is raised, the usual fix
42
43
  dialecte standard index|find|show|eval # index and search the standards kept on this machine, outside every repository
44
+ dialecte facts list|show|forget # the facts recorded in your data folder: their state now, their history; forget one
43
45
  dialecte run <script.ts> # run a script on an in-memory project of the installed dialecte: one structured outcome
44
46
  dialecte fixture <Tag> # the smallest valid XML document holding an element, built by the dialecte's engine
45
47
  dialecte new verb <namespace> <query|transaction> <name>
46
48
  dialecte lot start <brief.json> # a lot from its brief: the lot folder in the store, the numbered worktree, .dialecte/lot
47
- dialecte lot status <id> # its state derived from the records, the checks, the exact next command; reads only
49
+ dialecte lot status <id> # its state derived from the records, the checks, the next station and its exact command; reads only
48
50
  dialecte lot wait <id> [--timeout <seconds>] # until the lot needs someone: ready, a question, failed, a limit
49
51
  dialecte lot answer <id> <question> "<answer>" [--by <who>] # answer an open question of the lot, once
50
52
  dialecte lot result <id> # the hand-over (card, show and run lines) of a ready lot, or why it stopped; writes nothing
51
53
  dialecte lot stop <id> --reason <text> # end the lot: its pending hand-over abandoned first, then canceled
52
54
  dialecte inbox # what waits on someone across every lot store: questions, ready hand-overs, failed lots
55
+ 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
56
  dialecte lot exempt|accept|revised|gone|mutation # the lot declaration .dialecte/lot.json
54
- dialecte lot finding|decide|snapshot|choice|standard <id|folder> ... # a lot's review rounds, in its lot or hand-over folder
57
+ dialecte lot finding|decide|snapshot|choice|standard|verify <id|folder> ... # a lot's review rounds and late fixes, in its lot or hand-over folder
55
58
  dialecte lot delta <id|folder> --round <n> # the fix diff since round n-1; --worktree: the old code to run a test on
56
59
  dialecte lot recap <id|folder> # the pull request's expandable part, built from the hand-over's records only
57
60
  dialecte lot close <name|index> # a finished lot: node_modules to the pool, its worktree to the trash
@@ -62,7 +65,7 @@ dialecte rules # code-rules self-check of the changed files
62
65
  dialecte contrib # the contributor checks, after gate --full and before the hand-over
63
66
  dialecte mutants run|status|schedule|abandon|migrate|judge|record|drop # mutation testing of the declared scope
64
67
  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
68
+ dialecte handover show|review|run|abandon|list|--legend
66
69
  dialecte worktree add|prune # a worktree ready to work in; what a merge left behind
67
70
  dialecte doctor # versions, core API generation, skills and station agents in sync, local checkouts
68
71
  dialecte models # which model each tier (fast, standard, strong, frontier) means for your vendor
@@ -148,10 +151,15 @@ Every Dialecte package ships the agent skills that describe it in `skills/<name>
148
151
  - **Session-start check, every agent**: when `dialecte-lot` is installed by the sync (whatever the targets),
149
152
  `skills sync` writes a section in the project's root `AGENTS.md`, between `<!-- dialecte-skills:session-check -->`
150
153
  and `<!-- /dialecte-skills:session-check -->`, telling the agent to run `npx --no-install @dialecte/cli doctor --brief`
151
- at a session start. It is created when there is no `AGENTS.md`, else appended after one blank line (every byte of
152
- your text stays, line ends included), replaced when an older release wrote another sentence, and removed (with the
153
- blank line it added, the file deleted when nothing else is left) by `--no-session-check`, `--no-contributing` or
154
- a sync without `dialecte-lot`. A marker without its pair, or a doubled one, leaves the file alone with a warning.
154
+ at a session start. It is written with a blank line inside each marker, the form a markdown formatter keeps, so a
155
+ formatted `AGENTS.md` stays formatted. An existing `AGENTS.md` gets it appended after one blank line; the body
156
+ between the markers is compared tolerantly (whitespace does not matter: line ends, blank lines, a wrapped
157
+ sentence), and only the marked block is replaced when an older release wrote another sentence: every byte outside
158
+ it stays, line ends included. A missing `AGENTS.md` is created only when you answer yes on a terminal or pass `--agents-file`; without
159
+ either, the sync says it was not created. The section and the file are never removed nor deleted by a sync:
160
+ `--no-session-check`, `--no-contributing` or a sync without `dialecte-lot` leave them in place (delete the section
161
+ by hand if you do not want it). `--no-agents-file` leaves `AGENTS.md` alone altogether (it excludes
162
+ `--agents-file`). A marker without its pair, or a doubled one, leaves the file alone with a warning.
155
163
  An `AGENTS.md` holding only the section is no evidence of a vendor.
156
164
  - **Session-start check (Claude Code)**: the same check as an adapter: `skills sync` adds a `SessionStart` hook running
157
165
  `npx --no-install @dialecte/cli doctor --brief` (the installed cli: no download at a session start) to
@@ -173,16 +181,31 @@ Every Dialecte package ships the agent skills that describe it in `skills/<name>
173
181
  intent quotes a sentence, since the generated pages republish the JSDoc. A page about several
174
182
  repositories declares `<!-- dialecte-skills workspace -->` and is fully verified with
175
183
  `--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
184
+ It also verifies every cli invocation a page cites in code (inline code, fenced blocks tagged `sh`, `bash` or
185
+ `shell`, and in an untagged fence only a line starting `dialecte ` and a command of the map; a fence with any
186
+ 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
187
  `$ ` prompt or a shell operator. Its command, its verb and each `--flag` must be in the command map of the
179
188
  cli the package uses (the cli's own map in the cli itself, else what the installed `@dialecte/cli` answers to
180
189
  `dialecte --help --json`); an unknown one, or an old form of a command renamed in 1.0 (see "Renamed in
181
190
  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
191
  `<placeholder>` and what follows a bare `--` are not checked; `ignore:` takes the offending word (`record`,
183
192
  `--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.
193
+ why and the summary line says so. Inside a `<placeholder>`, an option group `[...]` or a flag group
194
+ `(--a | --b)` a `|` is no pipe; each kind of group is counted on its own (a `)` never closes a `<`), and a
195
+ process substitution `<(dialecte ...)` is read like any invocation. A versioned `@dialecte/cli@<version>` and
196
+ what follows an unclosed `<`, `[` or `(--` are not read.
197
+
198
+ ## What the cli prints
199
+
200
+ Every text the cli prints passes one boundary: each printed line is escaped once, so a value from a record, a
201
+ brief, an argument or an agent can never forge a line nor act on the terminal. Every C0 control (a tab and a line
202
+ feed included), DEL, the C1 controls, the bidi marks, embeddings, overrides and isolates and the line and
203
+ paragraph separators print as `\u{<hex>}` (`\u{a}` for a line feed, `\u{1b}` for an escape). A lot verb's
204
+ refusal, a recap row, a card line and an error the cli catches all print that way. Quoted source (`lot delta`'s
205
+ diff, `mutants judge`'s window) shows a tab as four spaces. `--json` is never escaped: JSON encodes its control
206
+ characters itself and holds every value as written. The lines the cli relays from its own child processes (a
207
+ gate step's, a hook's, a test runner's) keep their colours (SGR sequences, the conceal parameter dropped);
208
+ every other control in them is escaped.
186
209
 
187
210
  ## Lookups for agents (and people)
188
211
 
@@ -195,6 +218,20 @@ Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage
195
218
  need the method's `@intent` tags hold, then its summary, then its name - one intent word beats any number
196
219
  of summary words; stop words dropped, word forms reduced to a light stem (`copied`, `copies`, `copying`
197
220
  → `copy`); ties put a dialecte's verb before core's, then sort by route.
221
+ - `dialecte api find --source "<need>"` also searches the exported functions of the package you are in (the
222
+ nearest `package.json` at or above the folder): every exported function declaration, arrow or function-expression
223
+ `const` of its tracked and untracked-not-ignored `src/**/*.ts` files, tests left out, read from the syntax alone
224
+ (a local `export { name }` counts, a re-export does not; an overload set is one function, at its first overload).
225
+ A source row prints `<file>#<name> source <file>:<line>`, then the intent that matched, its summary or
226
+ `(no summary)`. A function without `@intent` ranks on the words its summary and name hold together; at equal
227
+ hits an indexed method comes first, and a function the package's `api.json` already lists is shown once, by its
228
+ route. A file that does not parse is left out with a `note:` line. What each file holds is cached by its content
229
+ hash in `dialecte-source-index.json` in the worktree's git folder, shared by the packages of the repository and
230
+ rebuilt by another cli version (outside a git work tree, every file is read).
231
+ `dialecte api show <file>#<name>` (`src/lib/git.ts#readGit`) prints one source function's signature, summary,
232
+ intents and declaration, with or without `--source`; an unknown name in a file that was read names up to five of
233
+ that file's functions, the closest first; an unknown file names the closest source paths, or the
234
+ `api find --source` call that lists them.
198
235
  - `dialecte api show <path>` (`info.of`, `doc.query.info.of`, `tx.reference.applyUuidRemap`): signature as
199
236
  declared, summary, intents, other routes, where it is declared in its repository, and one call: the
200
237
  method's JSDoc `@example` when it is short and calls the method, else a call from the test next to it
@@ -205,10 +242,18 @@ Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage
205
242
  installed dialecte (a dependency built on `@dialecte/core` exporting `./<version>` with its `./<version>/test`
206
243
  entry: its namespace is its name capitalized, `Scl` from `@dialecte/scl/v2019C1`); with several, it lists them and
207
244
  `--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.
245
+ - `dialecte schema <Tag> [--under <Parent>] [--package <name>]`: parents, children in order with how often each
246
+ may appear, attributes (required, identity, default, fixed, enumeration, pattern), text, xsi:type variants,
247
+ the declared type and documentation - read through the readers of the core each installed dialecte depends on
248
+ (how often a child may appear is core's `childOccurrences`). A tag declared several ways prints each declaration
249
+ with the parents that hold it; `--under <Parent>` prints the one that parent holds (or those it holds, when it
250
+ does not decide), and a tag that is not a child of that parent answers its parents (exit 1). With `--json` each
251
+ element carries `declarations` and `resolved`, and when known `type`, `documentation`, `declaration` (the key
252
+ of the declaration described, when the tag is declared several ways) and `ways` (when unresolved). A dialecte
253
+ names the standard it implements in its `package.json`, `"dialecte": { "standard": "<public name>" }` (the
254
+ usual public name, no part or clause); a value that is not a non-empty string skips the dialecte, naming
255
+ `dialecte.standard`. An unknown tag
256
+ answers the closest; a dialecte not built is reported as skipped.
212
257
  - `dialecte doctor`: installed `@dialecte/*` versions, the core API generation of each dialecte (read from
213
258
  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
259
  another version than the one installed - linked skills follow node_modules), local checkouts (siblings,
@@ -308,6 +353,65 @@ characters, never split nor stemmed; its plural (the acronym and one lowercase `
308
353
  `show`, `find` and `eval` build the index first when it is missing. Every verb answers exit 2 with how to set
309
354
  `DIALECTE_STANDARD` when no standard is configured.
310
355
 
356
+ ## The facts ledger
357
+
358
+ `dialecte facts` reads the facts an agent recorded when it answered a question about a dialecte or a standard,
359
+ and retires the ones that no longer hold. A fact is a question (its words, its subject, its kind), its answer,
360
+ where the answer comes from (`schema`, `dialecte`, `standard`, `person` or `outside`), the effort it took, the
361
+ evidence and the sources it rests on. One question has one current fact; a better answer replaces it (an answer
362
+ checked against the documents always replaces an unchecked one, whatever the efforts), and the replaced fact is
363
+ kept, marked `superseded by F-<n>`.
364
+
365
+ **Where the ledger is.** In your data folder only: `$XDG_DATA_HOME/dialecte/facts/` (else
366
+ `$HOME/.local/share/dialecte/facts/`), one ledger per person, shared by every repository you work in. Each fact is a
367
+ file `F-<n>.json` and its history `F-<n>.history.jsonl`, one line per event (`created`, `reused`, `stale`,
368
+ `superseded`, `forgotten`, `rechecked`); `by-key/` holds one pointer per question to its current fact. Nothing is
369
+ ever deleted: a fact file is written once, afterwards only its state, its `supersededBy` and its sources change,
370
+ and its history only grows (a history line is at most 4,096 bytes: longer lists and strings in it are cut, and
371
+ a line still too long has each list replaced by its length, `fromCount` for `from`; the line marked `cut`, the
372
+ fact file always holding its sources whole). Every verb refuses (exit 2, nothing written) a ledger inside a git work tree, naming
373
+ the folder, the work tree and the fix: set `XDG_DATA_HOME` to a folder outside the repository. Only the data
374
+ folder counts, never the folder the command runs in.
375
+
376
+ **States.** A fact's state is the state now, checked on every read:
377
+
378
+ - `valid` - its sources still hold;
379
+ - `stale` - a source moved since it was recorded: the files of the standard it quotes (any file changed, added or
380
+ removed), or the definition of the dialecte it read. Written to the fact once, with a `stale` line holding why
381
+ (the source that failed and the fix), which every later read shows;
382
+ - `unverifiable` - a source cannot be compared now (no standard configured, its folder gone, the dialecte not
383
+ installed). Shown only, never written;
384
+ - `unchecked` - an answer from outside the documents; a person's answer given without them is `valid` and marked
385
+ `unchecked` on its line;
386
+ - `forgotten` - retired by `facts forget`.
387
+
388
+ A person's fact is never checked. A fact file no question points to (a record a crash stopped) is an `orphan`; a
389
+ file that is not readable JSON is `unreadable`. A read repairs what a crash or two writers at once left: the
390
+ previous fact of a question gets its `supersededBy`, with a `superseded` line marked `repaired`.
391
+
392
+ - `dialecte facts list [--about <Tag>] [--state <state>|all] [--json]`: one line per question, its current fact
393
+ whatever its state: `<id> <state> <effort> <source> <question>` (the question cut). A `stale` fact (found by
394
+ this read, or by an earlier one: the reason its `stale` line keeps) or one this read found `unverifiable` ends
395
+ its line with `- <why>`: the source that failed and the fix (for example: set `DIALECTE_STANDARD`, the expected
396
+ layout of a refused standard root, run from the package that installs the dialecte). `--state valid`, `stale`, `unverifiable`,
397
+ `unchecked` or `forgotten`: the current facts in that state now; `--state orphan`: the fact files no question
398
+ points to; `--state all`: every fact file, superseded, orphan and unreadable ones (with their path) included, a
399
+ superseded fact's line holding `superseded by F-<n>` before its question:
400
+ `<id> <state> <effort> <source> superseded by F-<n> <question>`. `--about <Tag>`: the facts whose subject
401
+ holds that tag. `--json` answers `{ facts: [{ id, path, fact?, state, current, reason? }] }` (no `fact` for an
402
+ unreadable file). An unknown state is
403
+ a usage error naming the states. The schema sources are compared with the dialectes installed in the folder the
404
+ command runs in; run from a folder with no `package.json`, they are `unverifiable`, never an error.
405
+ - `dialecte facts show <id> [--json]`: the fact's question, answer, source, effort, state now (with `- <why>` when
406
+ stale or unverifiable), sources and number of pieces of evidence, then its history in order; `--json` answers
407
+ `{ fact, state, current, reason?, history }`.
408
+ - `dialecte facts forget <id> --reason <text> [--json]`: marks the fact `forgotten` and appends a `forgotten` line
409
+ holding the reason (cut at 200 characters, the line then marked `cut`); the file is kept. Forgetting it again says so and writes nothing.
410
+ `--json` answers `{ id, state, already }`. No reason, or a blank one, is a usage error.
411
+
412
+ `show` and `forget` answer exit 1 for an id with no fact (the closest ids named) or a fact file that is not
413
+ readable JSON (its path named).
414
+
311
415
  ## MCP server
312
416
 
313
417
  The MCP server of the read-only lookups is its own package: [`@dialecte/mcp`](https://github.com/dialecte/mcp) (`npx @dialecte/mcp`). It builds on the pure answer functions this package exports at `@dialecte/cli/lookups`.
@@ -330,7 +434,17 @@ One field of package.json says what the package is to the cli:
330
434
  the type bench and the release guard, and `skills sync` installs the contributor skills (`--no-contributing`
331
435
  is refused). A contributor never names the tools that consume it: list them once on the machine with
332
436
  `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`).
437
+ repository) and `rules` and `handover` refuse them as whole words (`consumer tool name`). The words a
438
+ contributor never commits at all are listed on the machine the same way, never in the repository:
439
+ `git config --global dialecte.forbiddenWords "<word>, <word>"` and the user file
440
+ `$XDG_CONFIG_HOME/dialecte/forbidden-words` (else `~/.config/dialecte/forbidden-words`; one word per line,
441
+ `#` comments, blank lines skipped), both read and merged. `rules`, `contrib` (its rules row) and the hand-over's
442
+ `references` guard (lot messages and files) refuse them as whole words, whatever the case (`forbidden word`).
443
+ With no list anywhere the check is not run and `rules` says so in one line,
444
+ `forbidden words: no list (git config dialecte.forbiddenWords or <the user file>)`, and passes (a CI machine has
445
+ no list); a user file that cannot be read (a folder at its path, no read permission) is an error, never no list.
446
+ A gate or contrib record of a run that checked the rules is keyed with a hash of the consumer names and the
447
+ forbidden words (never the words), so a list set or changed after a green record runs the check again.
334
448
  - Any other value is refused by every command that reads it:
335
449
  `dialecte.profile: "<value>" is not a profile; profiles: contributor, consumer`.
336
450
 
@@ -388,9 +502,13 @@ the answer.
388
502
  its root (`tmpdir()` handed to a call that lists or scans a folder, or given as `root` / `cwd` /
389
503
  `scratchRoot`...: other tests and processes share it; `mkdtempSync(join(tmpdir(), '<prefix>-'))`
390
504
  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.
505
+ symmetric pair aside) and abbreviated names are warnings. A file it cannot read (a file given that is not
506
+ there, no read permission) or a script that does not parse is an error of that file (`unreadable-file`),
507
+ never a silent skip. Without file arguments it reads the changed list a scoped gate step hands
508
+ (`DIALECTE_GATE_CHANGED`: its text files still on disk; a list it cannot read is an error) and writes the
509
+ gate's selection (the files it checked); outside a gate, the files changed against HEAD and the new ones,
510
+ that result recorded in the worktree's git folder (`dialecte-rules.json`: when, HEAD, the state hash, the
511
+ files, the errors and warnings), which `dialecte lot recap` reads; a run on named files records nothing.
394
512
  - `dialecte gate [--fast | --full] [--base <ref>] [--no-reuse] [--declare <path>]... [--json]` runs the Definition of Done: `--fast` (default) `check`,
395
513
  `skills:check` and the tests of the changed files; `--full` adds `build` and the whole suite (the
396
514
  runner's defaults: every file in parallel), then the steps derived from the package's scripts after its
@@ -401,7 +519,19 @@ the answer.
401
519
  `GIT_OPTIONAL_LOCKS=0` (a `git status` inside it never takes the index lock), and is judged on its exit
402
520
  code and on the counts it printed: a step exiting non-zero fails whatever it says, a test step that
403
521
  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
522
+ step passes with the note "no test file is affected by the change". A step running an npm script the package lacks
523
+ is _not wired_, judged for the whole list before any step runs (every wiring problem shows at once, and a
524
+ failed one leaves every other step unrun): a step of the default list (the package declares no list for the
525
+ mode) fails `gate --full` and `--release` (`FAIL skills not wired (no npm script "skills:check")`, then the
526
+ line `add the script, or opt out with dialecte.gate.skip: "dialecte": { "gate": { "skip": { "skills": "<reason>" } } }` under it;
527
+ `dialecte contrib` names `"contrib"` there) and is skipped by `--fast` (`skip skills not wired (...)`, the gate stays green); a step the package declares
528
+ fails in every mode, `--fast` included (`declared but not wired (no npm script "<x>")`). The fix is the
529
+ script, the step removed from the list, or, for a default step, an opt-out with a reason (below). The
530
+ hand-over card shows `✗ <step> not wired (no npm script; or dialecte.gate.skip)` for a full or release record
531
+ (`dialecte.contrib.skip` for a contrib one) and `! <step> not
532
+ wired (no npm script)` for a fast one, and `! <step> opted out: <reason>` for an opt-out (a warning). The
533
+ `type-narrowing` step is derived from the package's scripts and is never unwired. A gate record written
534
+ before this check is not reused for a package with an unwired or opted-out step (the key changes). While a hand-over
405
535
  holds the repository (`dialecte handover <lots.json>` wrote its lock), the gate runs only under the
406
536
  hand-over written for this repository - the script the lock names exists and the `lots.json` beside it
407
537
  names this repository, real paths compared - and says so in one line with the command that refreshes
@@ -444,7 +574,12 @@ the answer.
444
574
  serial rerun is green: it is reused with its `flaky in parallel` note. `--no-reuse` runs the steps
445
575
  whatever the store holds. The key leaves out the Node version and the environment (a path given
446
576
  through an environment variable); a `file:` dependency edited and restored to the same size within
447
- the same modification time is not seen either.
577
+ the same modification time is not seen either. `--full` and `--release` hold the machine awake while they
578
+ run (on macOS a `caffeinate -i -w <the cli's pid>` started at their start, detached, ending with the cli;
579
+ nothing on another system, nor when `caffeinate` is not on `PATH`, nor with `DIALECTE_KEEP_AWAKE=0`), and
580
+ measure their wall and monotonic time: a run whose wall time passed its monotonic time by over 60 s spanned
581
+ a sleep of the machine all the same, its record keeps `sleptMs`, and the hand-over card's gates print
582
+ `! slept <duration> during gate --full` for a record of the tree it checks.
448
583
  - `dialecte gate --hook [--no-reuse]` runs in a commit hook: the test steps of `--full` (its steps counting
449
584
  tests), unless a green `--full` record of what is committed answers them. Its key is the one a `--full` run of
450
585
  that state stores - the tree, what npm installed, the `file:` dependencies, the full gate's command hash - with
@@ -476,7 +611,7 @@ the answer.
476
611
  terminal (and never with `NO_COLOR`); the `✓` `!` `✗` marks read the same without it. The command
477
612
  follows the box whole on one line, to copy: `cd <folder> && bash commit.sh`, or
478
613
  `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
614
+ `handover run --probe` within 60 s. "This cli" is the script that runs: when it is a temporary one
480
615
  (`npx` from the registry, `tsx` on the sources), install `@dialecte/cli` in the repository so the
481
616
  card names its own bin.
482
617
  - No runner hangs silently. Every child that `dialecte gate` (its steps), `tdd` (its vitest runs) and
@@ -499,8 +634,9 @@ the answer.
499
634
  `contributor`, after `gate --full` and before `dialecte handover`, one line per row: `rules` on the files
500
635
  changed against HEAD (recorded as `dialecte rules` records it), the package's `dialecte.contrib.steps`
501
636
  (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
637
+ `npm run type-bench:check`; `[]` keeps the built-in rows only) run as the gate runs its steps (a default
638
+ step whose npm script is missing fails the run before any row, the built-in `rules` and `release` rows
639
+ 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
640
  none of its steps runs it (without the script, one line `skip type-narrowing no npm script
505
641
  "type-narrowing"` before `release`, no row), `release` (no dependency named by a local folder), then `mutation` when the
506
642
  package declares a mutation scope (read from the mutation store now, never recorded). A package step a
@@ -525,7 +661,19 @@ the answer.
525
661
  test proves nothing yet"); a passing case with a receipt whose own test call changed; a passing case
526
662
  still waiting for its green whose test file, or test code it imports, changed since its red ("test
527
663
  code changed since its red and it passes"); a failure on a missing export, a type or syntax error, a
528
- timeout, a stub thrown at import or before the assertion; a file holding `.only` or `only: true`. A
664
+ timeout, a stub thrown at import or before the assertion; a file holding `.only` or `only: true`; a
665
+ file whose run reports no case, `red` and `green` alike, with why the package's vitest configs (every
666
+ `vitest*.config.*` and their `projects`, read as files) give: `ran no case: the file belongs to
667
+ <config>, which the default config does not list (projects)`, `ran no case of the file` (the default
668
+ config holds it: an empty describe, no test call; or a config cannot be fully read - an `include`,
669
+ `exclude` or `projects` entry that is no string literal or inline object, such as an imported constant,
670
+ a spread, a call or a glob of config files - and may hold it), `every case is skipped` (only `.skip` /
671
+ `.todo` / `.skipIf(true)` cases; the gate, which only collects, maps each case the run reports to its
672
+ test call, so a case a helper registers counts as run). A refused file is never frozen, and the gate's
673
+ tdd step fails on it with the same reason. A file
674
+ no vitest config includes (a Playwright spec, a type test) is no vitest test file: it leaves the
675
+ selection with `outside <file> not a vitest test file (no vitest config includes it)`, is never
676
+ refused nor frozen, and never fails the gate. A
529
677
  case the same as at the base is marked unchanged; a case the lot accepts is marked accepted, unless
530
678
  it is proven red then green at its current test call (an acceptance never overrides a proof: it goes
531
679
  the normal path, no accepted receipt, and the line adds `acceptance not needed (proven red → green): it
@@ -533,8 +681,20 @@ the answer.
533
681
  case whose test code changed around it is kept and flagged `test code changed around it` (the next
534
682
  step adding a case to a green file); a case never proven green (only unchanged, accepted or revised)
535
683
  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.
684
+ receipts, the refusals kept as evidence; it is frozen when one of its cases is red (those need no re-red;
685
+ the refused case stays unproven), else not frozen; the gate fails on it until no case of it is refused.
686
+ - Two cases of one run sharing a file, a project and a name share one id, and a receipt names one case: every
687
+ case of such a group is refused (`red` and `green`), whatever its state, with `2 cases share this id
688
+ (lines 12, 12): <hint>` (a case without a location prints `?`). The hint is `rename one` for two plain
689
+ calls; for a case of an `.each` / `.for` table (or under one) it says to spell each title in full:
690
+ vitest cuts a `$` field of an each-title at its `truncateThreshold` and prints any array as `[ Array(n) ]`, so
691
+ two rows can read the same; `truncateThreshold: 0` in the package's vitest config is the other fix. A member
692
+ the run does not judge (skipped, filtered out by `-t`, not targeted by `green`) gets a `duplicate <case>
693
+ <reason>` line and no receipt. The cases of the group stay out of the move matching, the rest of the file is
694
+ judged as usual, and the exit is 1. `--json` holds `duplicates: [{ file, project, name, lines }]` (empty when
695
+ none). The `gate`'s tdd step fails (`duplicate case ids in <n> file(s): <files>`) and the card's tdd section
696
+ lists `✗ duplicate id <file>::<name> lines 12, 12` per group, so the hand-over is BLOCKED. A receipt
697
+ recorded before under an id now shared never counts.
538
698
  - A red records the case (file, full name, project), the hashes of its test file, of its own test call
539
699
  and of the production files, the failing message and the time. It is flagged `rollback` at a
540
700
  production state the case, or the lot, had already left: a production file moved back from the
@@ -562,8 +722,10 @@ the answer.
562
722
  into production, never further, and the module itself is production), its own snapshot. Every
563
723
  dependency found by import is followed in turn, and one found by a name written with its folder
564
724
  (`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
725
+ file name (`index.ts`) may be another file: the changed file it names is a dependency, not followed. The
726
+ `setupFiles` of the package's vite or vitest configs (test code no test imports) are a dependency of every
727
+ test file, followed as an import: a red freezes a changed one, a `revised` entry naming it lets a red
728
+ freeze it. A helper no red covers stays unfrozen, and the gate fails on it, unless a `revised` entry names it
567
729
  (below). A Vite import query or fragment (`./x.worker?worker&url`, `?raw`, `?url`, `?inline`, `#part`) is
568
730
  left out of the file the import names; a specifier starting with `#` is a subpath import. The files of
569
731
  the change an `import.meta.glob(...)` of its test code matches (a pattern relative to the file, `/` for
@@ -609,14 +771,30 @@ the answer.
609
771
  looks deleted) prints `deleted <file> a test call of the base is gone`; when a `gone` entry of
610
772
  `.dialecte/lot.json` names its file (a path or a glob), it prints
611
773
  `gone <file> a test call of the base is gone (<reason>)` instead, in the gate's details too. A titled
612
- test gone and a deleted test file stay `deleted`. A ledger that cannot be read is refused with its
613
- path.
774
+ test gone and a deleted test file stay `deleted`. A changed test file whose run reports no case prints
775
+ `refused <file> <reason>` (the reasons of `red` above), one no vitest config includes `outside <file>
776
+ not a vitest test file (no vitest config includes it)`. A ledger that cannot be read is refused with its
777
+ path. `--json` answers the state: `cases`, `duplicates`, `unfrozen`, `findings`, `unlisted`, and, only
778
+ when there are some, `zeroCases: [{ file, reason }]` (the refused files) and `notVitest: [<file>]` (the
779
+ files out of the selection).
614
780
  - `status --flags` prints only the cases whose receipts carry a flag, with their flags.
615
781
  - `status --legend` prints the tdd terms of the hand-over card, each in two lines: what it means, and
616
782
  whether to look. It needs no package: it works from any folder.
617
783
  - The lot is the uncommitted work: the change is measured from HEAD, so the cases of lots already
618
784
  committed on the branch are not asked again. `--base <ref>` (`tdd` and `gate`) gives the
619
- whole-branch view; `gate --full` measures from where the branch left its base branch.
785
+ whole-branch view; `gate --full` (and `--release`) measures the tdd step from the lot's base: the
786
+ branch the lot was started on (the store lot's base, else the branch `worktree add` recorded it was cut
787
+ from; a base given as a commit id stands for the resolved base branch), from where HEAD now leaves it,
788
+ so a lot that merged or rebased onto its base's new commits is not asked for them. When that base is
789
+ not found, is behind the cut, never held the cut (a stacked lot), was rewritten or has merged the lot's own commits, it measures from the
790
+ worktree's cut and says why; a worktree with no recorded base measures from its cut, one not made by
791
+ `worktree add` from where the branch left its base branch. The first details line of the gate's tdd step
792
+ (none when the step is skipped) reads `tdd base: <short sha> (<source>)`, the source one of `--base`,
793
+ `lot base <ref>`, `worktree from <ref>`, `base branch <b> (the lot's base is a commit)`, `worktree cut`,
794
+ `base branch <b>`, `HEAD`; a fallback reads `tdd base: the worktree's cut (<why>)`, the why one of `no
795
+ base branch recorded`, `<ref> not found`, `<ref> is behind the cut`, `<ref> does not hold the cut: a
796
+ stacked lot` (the ref's reflog never reached the cut), `<ref> was rewritten: the cut <sha>
797
+ is no ancestor of the merge-base <sha>`, `<ref> holds the lot's own commits`.
620
798
  - Test code is compared by the leaves of the parser's syntax tree, each file parsed by its extension
621
799
  (a `.ts` file is no TSX): whitespace, comments (except the ones a tool reads:
622
800
  `@vitest-environment`, `@jest-environment`, `@vite-ignore`), quote style, statement semicolons,
@@ -647,10 +825,11 @@ the answer.
647
825
  red when it fails) and freezes its file and the changed test code it depends on. A file or glob entry
648
826
  may also name a test helper (test code that is not a test file: a helper, a fixture, a constant beside
649
827
  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
828
+ new hash and prints `revised <helper> <reason>`, when every changed test file depending on it
829
+ is in the run and frozen by it with no case red (a refused file, a red still waiting for
830
+ its green, or a changed dependent outside a targeted run leaves it unfrozen, named on an
831
+ `unfrozen <helper>` line). A helper that no changed test file depends on (its dependents are all
832
+ 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
833
  cases' earlier green stale: `tdd green` proves them again. Without that red run the gate fails on the
655
834
  edit; `status` lists the revised cases, the gate and the hand-over card list the revisions (cases
656
835
  and helpers) with their reason, an entry (exact, file or glob) no revised case or helper used as a
@@ -674,8 +853,11 @@ the answer.
674
853
  iterating, run the case with `npx vitest run <file> -t "<case>"`), its barrel export and, for a new
675
854
  namespace, the namespace module and its registration. Its JSDoc summary and `@intent` start with
676
855
  `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
856
+ - `dialecte handover write <lots.json> [--release] [--target <branch>] [--out <id|folder>] [--rehash] [--json]` (or `dialecte handover <lots.json>`) prepares the commit-by-lots
857
+ hand-over a human runs. `--target <branch>` names the branch the hand-over must not be behind (default: the
858
+ [base branch](#the-base-branch)); it is written as `target` in the lots file. A branch with no ref, local or on
859
+ origin (`--target nope: no such branch, local or on origin`), a `--target` with no branch after it, or no base
860
+ 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
861
  then holds a required `gate release` row, green only with a green `gate --release` record of the tree it commits.
680
862
  The lots file names the repository, the branch and HEAD expected, and the lots (paths, message):
681
863
 
@@ -709,7 +891,7 @@ the answer.
709
891
  existing ancestor, then the rest) before anything is written, so `commit.sh`, the lock, the card, `--json`'s
710
892
  `folder` and the registry all hold it. A word naming both an existing folder and a lot is the folder: the
711
893
  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
894
+ 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
895
  question (`answer q<k> first: dialecte lot answer <full name> q<k> "<answer>" ...`), a lots file whose
714
896
  repository is not the lot's worktree or whose branch is not the lot's (both named); and for any folder whose
715
897
  registered hand-over is `committed` (`<name> is committed: a committed hand-over is never rewritten`). Every hand-over
@@ -740,7 +922,8 @@ the answer.
740
922
  is `hand-over: <repository folder> <branch>`, with the worktree's index first from a numbered worktree
741
923
  (`hand-over: 0171 cli feat/x`: the repository's own folder name, so the number is shown once). The commit
742
924
  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
925
+ when it is inside it (`.worktrees/0171-cli-x`, `cli` for the main checkout), else its absolute path; both
926
+ compared by real path, so a side reached through a link (`/var` and `/private/var`) reads the same. Its
744
927
  first line is the verdict: `READY` when no gate line failed and none ran on another tree, `BLOCKED` with
745
928
  `<n> gates failed: <names>` and `gates ran on another tree: <names>`, `DONE` once a real run committed
746
929
  every lot; then the lots, files and `+<added> −<removed>` (`all gates green` when nothing blocks), and
@@ -759,12 +942,38 @@ the answer.
759
942
  the hook counts tests: a merge hand-over rehearsed or committed reads the hook's lines of the merged
760
943
  tree, the worktree's `tests` of its tree before the merge left out. No check leaves silently: a step
761
944
  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
763
- `review` from the hand-over folder's findings ledger and `round-<n>/` snapshots, then `standard`. `✓`
945
+ failed one stays `✗ ... (the tree changed since)`, and `tdd` stays the worktree's: on the DONE card of a
946
+ merge hand-over the tdd verdict is judged on the worktree's own lot tree (the tree its first merge lot
947
+ merged onto), current while the hook record of the merged tree stands, so no `gates ran on another tree`
948
+ for it), then, in a consumer, `mutation` when the package declares a mutation scope (below), then
949
+ `review` from the hand-over folder's findings ledger and `round-<n>/` snapshots (below), then `late
950
+ fixes` on a card still to run (below), then `standard`. `✓`
764
951
  passed; `!` to look at (a step not run here, with its reason, or not run after a failure; no
765
952
  findings ledger, or one holding no row yet: `no findings recorded`; only nits open); `✗` failed (a
766
- failed step, a blocking or should-fix finding open, `gate never run on this tree` when there is no
767
- record). The records read are the worktree's last runs and the store's records of the tree the
953
+ failed step, a blocking or should-fix finding open, no independent review after the last round, `gate
954
+ never run on this tree` when there is no record).
955
+ - `review`: the review rounds are the `round-<n>/` snapshots only, against the cap of the lot's effort
956
+ (low 1, medium 2, high 3; the identity's effort, else the folder's `brief.json`), then the independent
957
+ review, then the open findings: `✓ review 2 review rounds of 2 · independent review approve · approved`.
958
+ The independent review must come after the last snapshot: an `independent-reviewer` station end with a
959
+ verdict strictly after the snapshot's time (`round-<n>.state`'s `at`, else `round-<n>.base`'s mtime; a
960
+ tie is not after), shown `independent review <verdict>`; or, for a folder without step events (no
961
+ `events.jsonl`, or events saying the worktree's cli writes none), a ledger row of a round above it,
962
+ shown `independent review: round 3 in the ledger` (`rounds 3-4`). None: `✗ review no independent
963
+ review after round <n>`, the card BLOCKED. Beyond the cap each round names its first go-ahead row
964
+ (`3 review rounds (cap 1, round 2 by <who>, round 3 by <who>)`), a round without one gives `! review
965
+ 3 review rounds, cap 2, no go-ahead recorded` (a warning); no effort recorded: `2 review rounds (no
966
+ effort recorded)`. A folder with step events and no review round snapshot reads `✗ review no review
967
+ round snapshot: dialecte lot snapshot <lot> --round 1` (the ledger never stands in there). A folder with
968
+ no snapshot, no ledger row and no independent end, a folder without step events and with no snapshot
969
+ (its ledger rows claim no independent review), and a release hand-over keep the ledger-only line
970
+ (`<n> rounds · approved · findings ledger`).
971
+ - `late fixes`: a change of the tree after the last snapshot (the worktree's state hash against
972
+ `round-<n>.state`'s) reads `! late fixes unverified since round <n> (<k> files): dialecte lot verify
973
+ <lot> --by <who> --note <text>`, a `lot verify` of the current state `✓ late fixes verified by <who>:
974
+ <note>`, a last snapshot without `.state` (an older cli) `! late fixes not checked (round <n> has no
975
+ state)`; the last snapshot's tree, or no snapshot, prints no line. A warning only: `handover run`'s
976
+ `verify` guard refuses. The records read are the worktree's last runs and the store's records of the tree the
768
977
  hand-over commits - the worktree's tree, or for a hand-over holding a merge lot the tree its last lot
769
978
  leaves (the trial merge with its resolutions) - the newest record of each step winning; a tdd step
770
979
  another worktree recorded is left out (its verdict is that worktree's), and a stored record counts
@@ -796,7 +1005,10 @@ the answer.
796
1005
  it). `✓ standard consulted · <note>` when one is configured and the station recorded a consultation;
797
1006
  `✗ standard configured, not consulted: dialecte lot standard <folder> consulted <note>` (blocks) when
798
1007
  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
1008
+ otherwise, with the recorded not-consulted reason when there is one: a warning that never blocks. A DONE card
1009
+ (committed) shows the state recorded on the lot, never one read from the shell that ran the hand-over:
1010
+ `✓ standard consulted · <note>`, `! standard not consulted · <reason>`, or
1011
+ `! standard not consulted: none recorded on the lot`. The station records it
800
1012
  with `dialecte lot standard <id|folder> consulted <note>` or `not-consulted <reason>` (the card's line
801
1013
  names the hand-over's folder).
802
1014
  - `contrib` (a contributor's): the rows of the `dialecte contrib` record of the tree the hand-over commits,
@@ -839,7 +1051,35 @@ the answer.
839
1051
  rehearsal's. The command stays under the box until every lot is committed. `dialecte handover --legend` prints every term the card can
840
1052
  print, each in two lines: what it means, and whether to look.
841
1053
 
842
- - `dialecte handover run <folder>` is what `commit.sh` runs. Each guard prints one line with its result
1054
+ - `dialecte handover run <folder>` (and `--rehearse`) holds the machine awake while it runs, as `gate --full`
1055
+ does, and writes `last-run.json` in the hand-over folder when it ends (before the card of a real run):
1056
+ `sleptMs` when its wall time passed its monotonic time by over 60 s; the DONE card then prints
1057
+ `! slept <duration> during handover run` in its gates.
1058
+ - A hand-over written behind its target branch is not run. The card (READY or BLOCKED, `handover show <one>`)
1059
+ prints `! main moved: merge main first (3 commit(s) on main, now 1a2b3c4d)` under its verdict, which reads
1060
+ BLOCKED (`--json`: `targetMoved: { branch, ref, tip, behind }`). The target is held when its tip is an
1061
+ ancestor of the lots file's HEAD or of a merge lot's tip. When some lots are committed already the line adds
1062
+ `: write a new hand-over on the current HEAD with a merge lot of main`. A hand-over onto the target itself, a
1063
+ committed one and an abandoned one are not judged; a lots file written before `target` existed is judged
1064
+ against the base branch; a `target` that names no ref gives a `!` line with the refusal and BLOCKED.
1065
+ - The card also lists the processes working in the worktree (`handover show <one>`, READY or BLOCKED; `lot
1066
+ result`, the run picker and `handover list` never look): `✗ processes 2 left running in the worktree: 4123 node
1067
+ …vitest --watch, 4177 npm run dev (stop them: kill 4123 4177)` blocks, `! processes open on the worktree:
1068
+ code, zsh` and `! processes not known (<why>)` warn (`--json`: `processes: { leftBehind, tools, unknown? }`).
1069
+ The run itself, its shell or agent, what it started and every process of its own process group (the other
1070
+ commands of its pipeline, such as a `| grep` after it) are never listed: a leftover started in the same process
1071
+ group as the cli (the same non-interactive shell command) therefore counts as the run's own. A process with a terminal, one
1072
+ whose command (or an ancestor's) is a known editor or the one `git config dialecte.editor` names, and one
1073
+ named in `git config dialecte.personProcesses` (a comma list of command names, never committed) is one of the
1074
+ person's tools; every other process is left behind.
1075
+ - `dialecte handover run <folder>` is what `commit.sh` runs. Three of its guards, `target` (the target branch's tip is held, as above),
1076
+ `processes` (read at run time, never from the card: a process left behind, or a list that cannot be read,
1077
+ refuses; tools only pass with `!`) and `verify` (late fixes nobody verified: `✗ verify late fixes
1078
+ unverified since round <n>`; `! verify late fixes not checked (round <n> has no state)` never refuses;
1079
+ `✓ verify no late fixes`, or `verified by <who>: <note>`), come after the merges guard. Each refusal
1080
+ exits 2 with nothing committed, where every other guard exits 1; `--rehearse` prints `!` for each and goes
1081
+ on. The merges guard's note for a merge lot of the target that moved reads `lot <n>: merges main at <sha>; main
1082
+ is now <sha> (see target)`. Each guard prints one line with its result
843
1083
  and its time (`✓ snapshot 110 file(s) 0.4 s`): repository, the lots file as reviewed, hooks
844
1084
  folder, branch, HEAD, empty index, the files against the snapshot, deleted files, files outside the
845
1085
  lots, references (citations, declared patterns, and the tags of a contributor), `contrib` in a contributor
@@ -1003,6 +1243,22 @@ the answer.
1003
1243
  card. An unknown name, or a folder that is no hand-over: exit 2, naming it. `--json` answers the card
1004
1244
  as data with its `folder` and `name`, as `dialecte handover --json` does, and `changedSinceReview` (the
1005
1245
  count of that line).
1246
+ - `dialecte handover review <name|index|folder> [--json] [--print]` opens the hand-over's worktree (the lots
1247
+ file's `repository`) in one new editor window and returns at once: the editor is started detached, its output
1248
+ ignored, never waited for. The hand-over is named as `show` names it. For a hand-over holding a merge lot it
1249
+ first writes `<hand-over folder>/review/lot.diff`, the lot's own change against the lots file's `head` (what is
1250
+ committed on top of it, staged, unstaged, and the untracked files git would add; ignored files left out; no
1251
+ colour whatever the git config), read through a scratch index so the repository is left as it was, and opens it
1252
+ in the same window. The editor: the worktree's `git config dialecte.editor` when set (its words, split as a
1253
+ shell splits them, then the paths; no flag added), else the first editor of a fixed list the cli knows found as
1254
+ an executable file on `PATH` (searched by the cli, no shell; opened with its new-window flag), else
1255
+ `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
1256
+ 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
1257
+ argument, an unknown hand-over, a worktree that is gone (naming it), or an editor that is no executable file
1258
+ (`editor <word> not found: set git config dialecte.editor`), nothing started; with `--json` a refusal answers
1259
+ `{ error }`, the message as written. Every READY card gets a `review`
1260
+ section after the gates, `dialecte handover review <name> (opens <editor>)` (`review: { command, editor }` in
1261
+ `--json`), read from `PATH` when the card is built; BLOCKED, DONE and ABANDONED cards have none.
1006
1262
  - `dialecte handover run` without a folder runs the one registered hand-over still to run (its folder
1007
1263
  pending or partly committed; `--rehearse` too): an abandoned, committed, stale or gone one is skipped.
1008
1264
  Two or more: refused, nothing run and no run marker, one `name branch verdict` line each (`READY` or
@@ -1114,12 +1370,45 @@ the answer.
1114
1370
  - `dialecte lot status <id> [--json]` derives the lot's state from its records (`working`, `input-required`,
1115
1371
  `ready`, `committed`, `canceled`, `failed`), with the worktree and link checks and the exact next command (the
1116
1372
  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
1373
+ reads files only, runs no git and writes nothing. A real working lot's next station is walked from its
1374
+ records (`nextStation`: per step test-writer, `tdd red`, test-reviewer at medium or high effort,
1375
+ implementer, `tdd green` and `gate --fast`; per review round its snapshot, reviewer, fixer or adjudicator
1376
+ and `gate --fast`; then `gate --full` after the last edit station, `contrib` for a producer, the
1377
+ independent review, the hand-over to write; the first unmet one wins): the text form prints it after the
1378
+ state line, `station implementer step 2 of 3 · round -/2 · effort medium` (`<what>` may be `reviewer
1379
+ round 1`, `tdd green and gate --fast (implementer step 2 ended, claim unchecked)`, `implementer running
1380
+ since <at> (run <run>)`, `lot snapshot round 2`, `question to the person (round cap 2 reached)`, `handover write (no
1381
+ hand-over written)`, `unknown (<why>)`), the position line given up first, and `next` is that station's
1382
+ command (`dialecte lot station <name> start implementer --step 2`, `... end <station> --run <run>`, the
1383
+ check's command, `dialecte lot snapshot <name> --round <r>`, at the cap its `--beyond-cap` form), `also`
1384
+ keeping the manual line; a hand-over to write and an unknown position keep the manual line. A station
1385
+ is ended by an end with exit 0 or none and a verdict other than `failed` or `limit`; a start with no end
1386
+ is running until a later station start or end or a snapshot comes (a check never closes it: the
1387
+ station's own `tdd red`, `tdd green` and `gate --fast` run inside it), `no end` after; an end that names
1388
+ its run and gives no `--step`/`--round` takes its start's; an end of another name, or one with no start
1389
+ that places it, is `unplaced`. A claim is checked by a later `step.end` of its kind with exit 0 in
1390
+ the lot's own worktree (never `throwaway`, no later failed run of the kind, no newer failed gate
1391
+ record), or by one inside the station's run whose `stateHash` is the one its end recorded (the tree it
1392
+ handed over); when the events say the worktree's cli writes no step events, its tdd ledger and green gate
1393
+ records after the end stand in (a later green record of a gate mode covers every earlier claim of that
1394
+ mode), else `unknown (the worktree's cli records no steps)`. A reviewer or test-reviewer end approves only
1395
+ with `approve`: none or another word reads `unknown (<station> ended without a verdict)` or `unknown
1396
+ (<station> ended with <word>)`. `--json` adds `station` (`{ kind, station, check, step, round, why,
1397
+ unplaced, noEnd }`, `null` for a simulated lot) and `rounds` (`{ review, cap, effort, steps, beyondCap:
1398
+ [{ round, by, reason }], independent }`, `effort` the level the cap is taken from or `null`, `steps` the
1399
+ brief's count; the text form prints from them). Other states, a
1400
+ simulated lot and `lot start` keep their next. A damaged lot (a folder of the store whose name has a lot
1401
+ name's shape and whose records do not hold: no readable `identity.json`, one naming another folder, or a record
1402
+ that fails its check) answers `<name> damaged: <reason>` then `next: dialecte lot stop <name> --reason <text>`
1403
+ (`{ lot, state: "damaged", reason, next }` with `--json`), exit 6, never `no lot`; the reason is a fixed word
1404
+ 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
1405
  (`{ error, next: null }` with `--json`) or a usage error (`{ error, usage, next: null }`). An
1119
1406
  `<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
1407
+ 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
1408
  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.
1409
+ sits in the git folder. Two workspaces of the store list may give the same full name (the same index,
1410
+ repository folder name and branch tail): that name is then ambiguous (exit 2 listing both); give the lot
1411
+ folder instead.
1123
1412
  - The host loop: `lot start -> lot wait -> (lot answer -> lot wait)* -> lot result`. Every output names the exact
1124
1413
  next command with the lot's full name, and the exit code says what the host does next (section below). Every
1125
1414
  answer of `status`, `wait`, `answer`, `result` and `stop` goes to standard output, whatever its exit code; only
@@ -1133,21 +1422,26 @@ the answer.
1133
1422
  nothing), 4 when the last transition is a limit (run again), 5 when `--timeout` is reached while the lot still
1134
1423
  works. A real lot is looked at every second, by a stat of its folders and of the registry, and read again only
1135
1424
  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.
1425
+ <elapsed>)` line refreshes (never under `--json`). A simulated lot is played up to its next blocking point; one
1426
+ with nothing left to play (no `scenario.json`, or every step played) never waits: it answers its state at once,
1427
+ as `lot result` does (a working lot: exit 5), whatever `--timeout`. A damaged lot answers at once with exit 6,
1428
+ as `lot status` prints it.
1137
1429
  - `dialecte lot answer <id> <question> "<answer>" [--by <who>] [--json]` records the answer to an open question
1138
1430
  once, then prints the status with `next: dialecte lot wait <name>`. The answer is one line; a question with
1139
1431
  options takes one of them (compared trimmed, case-folded, recorded as the option is written); the same answer
1140
1432
  again is `already`, another one is refused. A person's question needs `--by <who>` (not `caller`); a caller's
1141
1433
  defaults to `caller`. `--by` is one line, not empty, checked before the lot is read (exit 2 naming `--by`).
1142
1434
  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.
1435
+ `\u{a}`, the refusal stays one line); `--json` carries them as stored. A damaged lot takes no answer (exit 2,
1436
+ naming the lot, its damage and the stop to run; nothing written).
1144
1437
  - `dialecte lot result <id> [--json]` never blocks and writes nothing. A `ready` or `committed` lot exits 0 with
1145
1438
  `{ lot, state, handover: { name, folder, state, card, show, run }, worktree, branch, questions, simulated }`:
1146
1439
  the card is the one `handover show --json` computes, `handover.state` the hand-over's own state read from git
1147
1440
  (`committed` once its lots are committed, even before the registry says so), `questions` the answered ones
1148
1441
  (`{ id, text, answer, by }`); a simulated lot's `handover` is `{ simulated: true }`, nothing to show or run.
1149
1442
  `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.
1443
+ exits 3 with the open questions, `working` exits 5, a damaged lot exits 6 (as `lot status` prints it). The text
1444
+ form prints agent text escaped.
1151
1445
  - `dialecte lot stop <id> --reason <text> [--by <who>] [--json]` ends a lot. A `committed` lot is refused
1152
1446
  (exit 2). A pending hand-over is abandoned first, as `handover abandon` does (`abandoned.json`, the registry
1153
1447
  entry `abandoned`, the lock released when it names that hand-over); while its run is in progress, or once it is
@@ -1155,7 +1449,19 @@ the answer.
1155
1449
  reason, `--by` or `caller`), and the registry is read once more: a hand-over registered meanwhile is abandoned
1156
1450
  at once. A lot already `canceled` exits 0 writing nothing; one whose entry is still `pending` (a crash inside an
1157
1451
  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).
1452
+ worktree go once the lot is canceled. The reason and `--by` are one line, not empty (exit 2). A damaged lot is
1453
+ stopped by moving its folder aside, never deleted and nothing written into its broken records first: to
1454
+ `<git common folder>/dialecte-lots-aside/<name>` (`-2`, `-3`, ... appended when the name is taken, an empty
1455
+ folder included), with a `stopped.json` (`reason`, `by`, `at`, `damage`) inside the moved folder (a lot folder
1456
+ that is a symbolic link: the link is moved, never its target, and the record is `<aside name>.stopped.json`
1457
+ beside it). It prints `stopped <name>: damaged (<reason>); its folder is now <path>` (`{ lot, state:
1458
+ "moved-aside", damage, folder }` with `--json`). Its index stays claimed, its worktree and branch stay; refused
1459
+ (exit 2, nothing moved) while a live run marker holds the folder or a pending registry entry names it (first:
1460
+ `handover abandon <entry>`); a stop that finds the folder gone (another
1461
+ stop moved it) says `no lot <id>`. Until it is moved aside, a damaged lot holds its paths: the scope of its
1462
+ `brief.json` when that reads as a list of texts, else every path, so `lot start` refuses an overlap with it
1463
+ (`overlap with <name> (damaged: <reason>): ...`, or `its scope cannot be read: it holds every path`); one whose
1464
+ identity reads simulated holds none.
1159
1465
  - `dialecte lot start --simulate <scenario>` starts a simulated lot that plays one of the scenarios (`ready`,
1160
1466
  `question`, `person`, `two-questions`, `limit`, `failure`, `slow`) under `lot wait`, publishing the records a
1161
1467
  real run would: it writes only its lot folder, one line of the store list and one index claim, never a branch,
@@ -1171,12 +1477,42 @@ the answer.
1171
1477
  question, `handover show`, `lot result` or `lot stop`); then `working <n> · simulated <m> (listed with
1172
1478
  --simulated)`. `--repository` keeps the lots whose repository folder has that name, `--simulated` lists the
1173
1479
  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
1480
+ `damaged <folder>: <reason>; next: dialecte lot stop <name> --reason <text>` line (a `.tmp-` folder being built,
1481
+ 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
1482
  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`:
1483
+ `at` a time, an answer file's question its file's `q<k>`. Every lot verb names such a lot damaged (exit 6 for
1484
+ `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
1485
  `{ waiting: [<status of each waiting lot>], working, simulated, damaged }`. Exit 0 when something waits or is
1179
1486
  damaged, 1 when nothing does, 2 for a usage error.
1487
+ - `dialecte plan next <plan.md> [--json] [--all]` reads a plan's lot block (one fenced block with the info string
1488
+ `json dialecte-lots` in the plan, or `<plan without .md>.lots.json` beside it; both or neither is refused) and proposes what can
1489
+ start now; it starts, claims and writes nothing. Each entry declares an `id`, a `kind` (`lot`, `fix`, `spec`,
1490
+ `person`), `dependsOn`, a `scope` per repository (`"."` is the whole repository), extra `heavy` steps
1491
+ (`mutation`, `browser`, `release`), a `brief`, and a `match` (`branch`, `handover`, `feature`) by which its
1492
+ records are found; the block's `shared` files (the changelog, the README, the command map) never hold a lot back.
1493
+ An entry's state is read, never declared: done by a committed hand-over or store lot, open by a store lot, a
1494
+ pending hand-over or a worktree on its branch, else ready, waiting, parked, or unknown with the reason when its
1495
+ repository cannot be read (files only: the stores, the registries, `worktrees/*/HEAD`; no git process, except
1496
+ one probe per lot whose hand-over was committed outside its folder and not closed yet: once its branch is past
1497
+ the lot's base commit and on the base branch that lot reads `committed`, is no longer open nor holds anything,
1498
+ and is listed under `landed` as `lot <full name> committed: hand-over committed in <folder>, branch on
1499
+ <target>`; once `lot close` closes that hand-over every reader reads it `committed`, files only, with no
1500
+ `landed` line; a lot with a live run or a transition later than that hand-over reads from its own records). The
1501
+ text says the counts, the open lots (and open work no entry accounts for: its repository's proposals are
1502
+ `unverified`), the lots that can start in critical-path order (`unblocks 7 (chain 4)`, `after <id>`, `merge:
1503
+ <open lots>`, `next: dialecte lot start <brief>` or the brief to write), the ready lots held by an open one with
1504
+ each scope pair met, person entries without a mark, the spec work (a spec missing or `DRAFT`), what each entry
1505
+ waits for, the parked ones, then the machine: the live heavy steps with their worktree and age, the load against
1506
+ twice the cores, the free and inactive memory against 2 GB (`vm_stat` on macOS, `/proc/meminfo` on Linux); a
1507
+ proposal whose heavy steps would run beside a live one says `stacks:`, and on a short machine its heavy steps
1508
+ would wait (advice only). `--all` lists the done entries; `--json` answers `{ plan, repositories, counts,
1509
+ entries, proposals, held, landed, specWork, heavy, unknown }`, `landed` always a list (`[{ repository, lot,
1510
+ folder, target }]`, `[]` when none). Exit 0 when a lot or fix can start, 1 when none can, 2
1511
+ for a usage error, no block or an invalid one (every fault listed), or a repository that is not a git checkout.
1512
+ `dialecte plan check <plan.md> [--json]` checks the block alone: one line when valid, else every fault (exit
1513
+ 2). `dialecte plan mark <plan.md> <id> done --by <who> [--reason <text>]` records a person entry's mark once in
1514
+ the machine's state folder (`<state>/dialecte/plans/`); a `lot` entry's state comes from its records and is
1515
+ refused.
1180
1516
  - `.dialecte/lot` reaches the lot folder, whose `round-<n>/` snapshots hold copies of the lot's files, tests
1181
1517
  included. Leave `.dialecte/` out of every tool that walks the worktree: a test runner whose globs include dot
1182
1518
  folders, a formatter, a linter. Git already leaves it out (`worktree add` excludes it).
@@ -1192,7 +1528,7 @@ the answer.
1192
1528
  (`{ state, note, at }`, the note's words joined by single spaces) for the card's `standard` line; the line
1193
1529
  references of what was read stay in the findings ledger. Another state, or no note, is a usage error
1194
1530
  (exit 2); a folder inside a repository is refused as below.
1195
- - `dialecte lot finding`, `decide`, `snapshot`, `choice` and `delta` keep a lot's review rounds in its
1531
+ - `dialecte lot finding`, `decide`, `snapshot`, `choice`, `delta` and `verify` keep a lot's review rounds in its
1196
1532
  lot folder, or in a hand-over folder (`_commit-plan/<topic>-<date>/`) that stays outside every repository:
1197
1533
  each refuses any other folder inside a git work tree or a git folder (`.git/`, a bare repository). `--` ends the options: the
1198
1534
  words after it are taken as they are, so a finding or a reason may start with `--`. Each writes its file
@@ -1216,7 +1552,23 @@ the answer.
1216
1552
  `round-<n>.base`. An existing round, an untracked nested repository and a submodule (a gitlink in the
1217
1553
  index or at HEAD) are refused; a run that
1218
1554
  stops part-way leaves only `.partial` names, which the next run removes. `.dialecte/lot.json` is
1219
- never part of it.
1555
+ never part of it. `round-<n>.state` (`{ "schema": 1, "at", "stateHash" }`, the worktree's state hash)
1556
+ is written and renamed with the others. A round above the cap of the lot's effort (low 1, medium 2,
1557
+ high 3; the identity's effort, else the folder's `brief.json`, else none recorded and a cap of 1; an
1558
+ interim read until the risk class lands) is refused, exit 2, naming `dialecte lot snapshot <folder>
1559
+ --round <n> --beyond-cap --by <who> --reason <text>`. With them the row `| round <n> beyond the cap of
1560
+ <cap>: <reason> | <who> | <day> |` goes to `decisions.md` first, then the snapshot (a retry finds the
1561
+ row of that round and adds none; once it stands, the plain `--round <n>` takes the round too). `--beyond-cap` within the cap, `--by` or `--reason` without it or
1562
+ blank, and a `--by` or `--reason` holding a forbidden word (`lot snapshot: --by holds a forbidden word:
1563
+ nothing written`, the word never printed) are refused, exit 2, nothing written; an existing round
1564
+ stays exit 1.
1565
+ - `lot verify <id|folder> --by <who> --note <text>`, run inside the lot's worktree, appends `{ schema: 1,
1566
+ at, by, note, state }` to `<folder>/verify.jsonl` in one write, `state` the worktree's state hash: the
1567
+ late fixes of that tree verified (the card's `late fixes` line, the `verify` guard). One later change
1568
+ needs a new verify. Exit 0 recorded; 2 for `--by` or `--note` missing, blank or not one line, a
1569
+ forbidden word in either, a run in another work tree than the lot identity's worktree (both named), or
1570
+ no snapshot yet (nothing is late), nothing written; 1 outside a git work tree, or a line over the event
1571
+ line limit.
1220
1572
  - `lot delta <id|folder> --round <n> [--worktree] [--json]` (n ≥ 2) prints, for each file of
1221
1573
  `round-<n-1>/`, of `round-<n-1>.deleted` or of the worktree's status, what changed since round n-1,
1222
1574
  in the form that fits where the file is: the snapshot copy against the worktree file (or
@@ -1239,28 +1591,137 @@ the answer.
1239
1591
  `node_modules` read against the lockfile where it is; then the links of its `node_modules`
1240
1592
  made absolute where they are, the worktree moved to the trash (`.worktrees/_trash/`, by
1241
1593
  `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,
1594
+ there, its caches (`.vite`, `.cache`) sent to their own `_trash/` entries, and last the trashed worktree
1595
+ removed in the background by `git worktree remove` without `--force`: git refuses a worktree written into
1596
+ since the check, which then stays registered in `.worktrees/_trash/` for you to look at (one line says so
1597
+ when something closed). Paths are compared by their real path as spelled on disk (a path typed in another
1598
+ case on a case-insensitive volume matches). Before the move, the lot's final record is kept: the card line
1599
+ of its `cards.log` (the one `handover run` wrote when it committed; else a recomputed one, marked
1600
+ `recomputed`, built without the probe), read back and parsed, then a `removing` line naming the worktree,
1601
+ its branch and the branch tip; after the move a `removed` line says `trashed` or `kept`. Kept also, with
1602
+ why: `final record not kept: <reason>` when the record cannot be written or read back, and `the lot's
1603
+ commit is not known` (with where to look and how to remove the worktree by hand) when a committed lot's
1604
+ commit can be found neither among its lot commits nor in the worktree's hook record (read only when no
1605
+ other committed hand-over shares the worktree). Every other hand-over of the worktree gets its card line
1606
+ too, `head` its last lot commit or `null`. Kept,
1243
1607
  with why and nothing done for that hand-over: first, a worktree a lot of the repository's store names
1244
1608
  (by real path) while the lot is not `committed` nor `canceled`, reason `lot <full name> <state>` (the
1245
- store read once, no git process per lot); a hand-over still `pending`; its worktree is the main
1609
+ store read once, no git process per lot but the one probe below). A lot whose hand-over was committed
1610
+ outside its own folder (no registry entry for the lot folder, every entry naming its worktree and branch
1611
+ `committed`) reads `committed` once its branch is past the lot's base commit (the base an ancestor of the
1612
+ tip, the tip not the base) and on the base branch. Such a lot keeps nothing, and every outcome of its
1613
+ worktree carries the line `lot <full name> committed: hand-over committed in <folder>, branch on <target>`
1614
+ (under the outcome's line, indented; `landed` in `--json`); the other keep rules below still apply to it.
1615
+ Once `lot close` has closed that hand-over, every reader (`lot status`, `lot wait`, the overlap at `lot
1616
+ start`, `worktree prune`, `plan next` among them) reads the lot `committed`, files only and without the
1617
+ probe, so a branch deleted afterwards never reopens it. A lot with a live run, or a transition later than
1618
+ that hand-over (resumed after it), reads from its own records, never landed nor closed by it. A hand-over
1619
+ still `pending`; its worktree is the main
1246
1620
  checkout (never parked, moved or trashed); no registered worktree at that path (closed already, or one
1247
1621
  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
1622
+ (both branches named: it holds other work now); a `locked` worktree (`git worktree lock`); another
1623
+ hand-over registered for the same worktree that is neither `committed` nor `abandoned` (named); a mutation
1249
1624
  run started from it that still runs or died before reporting; `lot close` itself run from inside it
1250
1625
  (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
1626
+ the processes not known (`lsof` failed or took longer than 20 s); a link from outside the worktree
1627
+ pointing into it (`the link <path> points to it`: the links directly in the workspace, `.worktrees/`,
1628
+ `_commit-plan/` and the scratch roots, and those in `node_modules/` and `node_modules/@*/` of every
1629
+ worktree and main checkout of the workspace's repositories, read once per call; the worktree's own links
1630
+ never count); a `dirty` worktree (anything
1252
1631
  `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
1632
+ `status.showUntrackedFiles` says); a HEAD reflog reaching commits that neither the hand-over's branch, the
1633
+ base branch nor a remote-tracking ref holds (a commit made on a detached HEAD: the reflog goes with the
1634
+ worktree); ignored files its removal would delete that nothing else holds (`ignored files git worktree
1635
+ remove would delete: .env`, the first three named past three): rebuilt folders (`node_modules/`, `dist/`,
1636
+ the VitePress caches, the hooks folder, the `dialecte.rebuiltIgnored` folders), `.DS_Store`, the
1637
+ `.dialecte/lot` link, a `.dialecte/lot.json` that is empty or byte-equal to the one archived by a
1638
+ committed hand-over of this worktree, and files byte-equal, mode included, to the same path in the main
1639
+ checkout go; anything else keeps it, `.dialecte/notes.md` included. The branch is never touched (`worktree prune` still lists the merged
1254
1640
  ones). Each line names the folder it moved and where `node_modules` went (`closed <name>: 0007-cli-x;
1255
1641
  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 }]`.
1642
+ that hand-over with the error and what was already moved, the others go on. A hand-over it closes gets
1643
+ `closed` (the time) on its registry entry; closing it again prints `<name> already closed`, nothing
1644
+ decided nor moved (an entry without it, a worktree removed by hand, is still kept: `nothing to close`).
1645
+ Exit 0 when every named hand-over closed (or was already closed), 1 when one was kept, 2 for a name or
1646
+ index the registry does not hold (then nothing is closed); `--json` prints
1647
+ `[{ handover, closed: true, already?: true, landed? } | { handover, kept, landed? }]`.
1648
+ - Recording a lot. Every record below is appended to a file, never rewritten; a reader skips a half line and a line
1649
+ it cannot parse, and counts them.
1650
+ - `dialecte lot station <id> start <station> [flags]` and `lot station <id> end <station> [--run <run>] [flags]`
1651
+ append one station event to the lot's `events.jsonl` (`by: host`): the host says which station ran, with
1652
+ which step, round, attempt, agent, vendor, model, tier, effort, session and skills (`--skill` seen,
1653
+ `--skill-asked` asked by the brief), and, at its end, tokens (`--tokens-in`, `--tokens-out`,
1654
+ `--tokens-cache-read`, `--tokens-cache-write`, `--tokens-total`), `--money <amount> <currency>`,
1655
+ `--duration`, `--exit`, `--verdict` and `--suite <name>=<runs>` for suites the agent ran itself. Nothing but
1656
+ the station is required; a field nobody gave stays unknown. `start` answers a `run` and the `end` command to
1657
+ run; `end` pairs with `--run` (an end that gives no `--step`/`--round` then takes its start's), else with the one open start of its station whose step, round and attempt match
1658
+ the ones it gives (several: refused), else is recorded alone. `--event <id>` makes a retry safe: the same id
1659
+ with the same fields answers the first event (`already`) and writes nothing, other fields are refused.
1660
+ `start` is refused on a committed, canceled or failed lot, `end` is accepted in every state. An `end`
1661
+ records `stateHash`, the state hash of the lot's worktree (left out when it cannot be read; a retry does
1662
+ not compare it): a check the station ran on that tree inside its run counts for its claim. The station
1663
+ names `shared` and `outside` are the report's own labels and are refused. `lot station <id> --from
1664
+ <file.json>` takes the same fields as one JSON object, plus `phase` (`start` or `end`); an unknown key
1665
+ is refused, every fault at once. A line over 4,096 bytes is refused. Exit 1 when the event cannot be written, 2
1666
+ for a usage error or a refusal.
1667
+ - Step events: the cli writes `step.start` and `step.end` events (`by: cli`) into the lot's `events.jsonl` for
1668
+ `gate --fast`, `--full`, `--release` and `--hook`, `contrib`, `tdd red`, `tdd green`, `mutants run`,
1669
+ `handover run` (real and rehearsal), `lot delta --worktree` and `worktree add`: the step, whether it is heavy,
1670
+ its exit, its time, whether a gate reused records, and per gate step its status, counts, time and selection. A
1671
+ step in a worktree that links no lot, or none matching, writes nothing. The `step.end` of `tdd red` and
1672
+ `tdd green` carries `stateHash`, the worktree's state hash after the run (computed only in a lot). A write that fails prints one
1673
+ `events: not recorded: <reason>` line and never changes the step's exit; a step killed after its start writes
1674
+ its end as interrupted where it can. Long lists are cut, failing parts first. A step run in a worktree whose
1675
+ link names a lot that lives elsewhere (a copied or moved worktree) is written to that lot as `step.foreign`.
1676
+ - `dialecte.stepEvents` in the cli's own `package.json` (`"stepEvents": 1`) tells a host that this cli writes step
1677
+ events. Each event notes the capability of the cli installed in the lot's worktree; a cli without it (an
1678
+ older release or source) writes none, so the report shows the step counts of such a lot as unknown rather
1679
+ than 0.
1680
+ - Heavy steps (`gate --full`, `--release`, `contrib`, `mutants run`, a rehearsal, a gate step the package
1681
+ declares heavy, and for the last only while that part runs) write a live marker in
1682
+ `<state folder>/dialecte/heavy/` (`$XDG_STATE_HOME`, else `~/.local/state`): the step, the lot, the
1683
+ worktree, the process and its start time. The step removes it at its end; a marker whose process is gone, or
1684
+ runs with another start time, is dead and ignored. A person's run outside any lot writes the marker too, and
1685
+ no event. This is how a host sees which heavy step runs now, and since when.
1686
+ - `dialecte lot report <id> [--json]` reads files only (no git, no process, nothing written) and prints one lot:
1687
+ its state, feature, effort, steps and rounds; per station run the agent, tier, model, tokens, time, suites
1688
+ and skills; totals for tokens (each field with how many stations did not report it, a lower bound when a
1689
+ 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
1690
+ answers, waiting for the machine and the rest); the suites per step family with their counts, reuse and
1691
+ reruns, attributed to the station whose time holds the step (`shared` when several, `outside stations`
1692
+ when none, and always for the steps the orchestration runs; a step a person runs by hand during a
1693
+ station lands on that station); the heavy steps, the folders (worktree add, throwaways, trash), the review
1694
+ rounds from the findings ledger, the events counted (damaged, duplicates, unknown kinds) and the next
1695
+ command. A number nobody reported is `unknown` in the text and `null` in `--json`, never 0. A step family
1696
+ reads unknown, with the reason, when the worktree's cli writes no step events, when a record of a step has
1697
+ no run in the events, or when nothing of the lot's steps left a trace. `dialecte lot report --feature <name>
1698
+ [--simulated] [--json]` gives one line per lot of the feature, in every store of the store list and the
1699
+ current folder, then the totals by station and by tier; simulated lots are counted apart and listed by
1700
+ `--simulated`; a lot whose folder is gone is listed from its `cards.log` line. Exit 1 when the feature names
1701
+ no lot, 2 for an unknown or ambiguous id.
1702
+ - The hand-over card gains a `usage` row (tokens, agents, runs, agent time, and the report's command) when the
1703
+ hand-over folder is a lot folder holding a station event; `handover show --json` carries `usage`. A folder
1704
+ with no station event shows no row.
1705
+ - `cards.log`, in `<git common folder>/dialecte-handover/`, one per repository: one JSON line per record,
1706
+ appended in one write, never rewritten, never rotated. A `card` line is a lot's final record: its hand-over
1707
+ card, usage and the times of its gate, tdd and hook records (a worktree's records go with it), written by
1708
+ `handover run` once a commit is recorded, or by `lot close` when none exists. A `removing` line is written
1709
+ before a worktree moves (its path, branch, branch tip and record times), a `removed` line after it (the same
1710
+ id; `trashed` or `kept`). A `removing` without its `removed` reads as unknown. The report reads these lines
1711
+ for lots whose worktree or folder is gone.
1712
+ - `dialecte lot export <id> <dir> [--json]` copies a lot folder to `<dir>/<full name>/`, `asks/` left out, links
1713
+ kept as links (one pointing outside the folder is named), with the lot's `cards.log` lines and registry
1714
+ entry added as `cards.log` and `registry.json`. It is refused (exit 2, nothing written) for an unknown or
1715
+ ambiguous id, for a `<dir>` inside a git work tree or a git folder, and when `<dir>/<full name>` exists.
1716
+ The copy is made into a temporary folder beside it and each file's size and checksum compared with the
1717
+ source's (`events.jsonl` as a prefix, since a running lot appends); a difference makes one more copy of
1718
+ that file, a second one removes the temporary folder and exits 1 naming the file; a match renames it. The
1719
+ source is never written; another run's temporary folder is named, never removed.
1259
1720
  - `dialecte mutants run [--mode changed|audit] [--base <ref>]` runs StrykerJS (resolved from the package,
1260
1721
  its devDependency) on the scope `package.json` declares:
1261
1722
  `"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
1723
+ `changed` mutates the scope lines changed since the merge base with the base branch (found as
1724
+ [the base branch](#the-base-branch) is; with none found, or a `dialecte.baseBranch` naming no branch, the run
1264
1725
  is refused, exit 2, naming `dialecte.baseBranch` and `--base`) or `--base <ref>`, untracked scope files
1265
1726
  whole; `audit` the whole scope (no base needed). Without `--mode` the lot's switch decides; with no switch,
1266
1727
  `changed` when the change touches the scope, else `mutation off for this lot` and exit 0. A detached HEAD is
@@ -1375,7 +1836,9 @@ on its exit code or its counts is run once more with `--no-file-parallelism`, on
1375
1836
  run named (through `npm run <script>` after one `--`; the whole step when the output names no file). The
1376
1837
  rerun passes when it exits 0, counts no failed test and at least one passed: the step then passes,
1377
1838
  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
1839
+ `flaky <file>` line under it per file, the note kept in the gate record; the hand-over card's row of such a step,
1840
+ or of a hook's test step `gate --hook` flagged so, reads `✓ <step> <passed> passed · <n> flaky, passed serially`
1841
+ (n the flaky files), never a failed count. Otherwise the step fails as a
1379
1842
  `real failure: <why>`, each file listed under it as `failed <file>` when it failed again or `flaky <file>`
1380
1843
  when it passed serially, the rerun's last lines as the tail. While the rerun runs, the step's line still
1381
1844
  shows its own command. A step that stalled, counts no tests, runs no vitest, or already runs one file at a time
@@ -1392,7 +1855,10 @@ case passes `tdd red` as accepted and does not block its file (a case already pr
1392
1855
  its proof: an acceptance never overrides one, and an accepted receipt counts only while its entry stays in
1393
1856
  the file); the gate lists each acceptance with its
1394
1857
  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
1858
+ no longer names, counted on one line), and both report an acceptance or a `revised` entry no case used (the
1859
+ gate's `unused accept` line adds `; the closest: <file>::<name>` when a case title of the change is close). An
1860
+ entry names a title with its quotes folded: a straight `'` or `"` matches a curly one (`’`, `‘`, `“`, `”`) and
1861
+ the reverse; nothing else (a backtick, a prime, the letter case) compares alike. The card
1396
1862
  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
1863
  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
1864
  and what the change touches: `{ "tdd": "exempt: <reason>" }` in `.dialecte/lot.json` at the package root
@@ -1418,15 +1884,20 @@ A package tunes them in its package.json:
1418
1884
  "generatedDocs": [".vitepress/data/elements-catalog.json"],
1419
1885
  "referencePatterns": ["SPEC-[0-9]+"],
1420
1886
  "allowReferences": ["ticket number"],
1421
- "baseBranch": "main"
1887
+ "baseBranch": "main",
1888
+ "rebuiltIgnored": ["coverage/"]
1422
1889
  }
1423
1890
  ```
1424
1891
 
1425
1892
  `gate.fast` / `gate.full` replace the default steps of that mode (`counts: "tests"` makes a step fail
1426
1893
  when it counts no test; `changedOnly: true` marks a step that runs only the tests the change affects,
1427
1894
  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
1895
+ it); `baseBranch` optionally names
1896
+ [the base branch](#the-base-branch); `rebuiltIgnored` lists ignored
1897
+ folders a build or a run rebuilds, which `lot close` may delete with a worktree: each a folder ending with `/`,
1898
+ relative to the package root, read from the `package.json` of the main checkout nearest the ignored path (a
1899
+ worktree's own declaration counts for nothing); an invalid entry (empty, absolute, holding `.` or `..`, without its
1900
+ 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
1901
  citations (and, in a contributor, the tags) `rules` and `handover` refuse; `allowReferences` is the contributor's
1431
1902
  opt-out: it lifts generic tags a contributor commits on purpose - `ticket number`, `acceptance criterion`,
1432
1903
  `plan tag` - and refuses any other label in either profile: a citation of a standard is never allowed. A consumer
@@ -1436,7 +1907,7 @@ rehearsal copies it as the same relative link).
1436
1907
 
1437
1908
  **Scoped steps, heavy steps, the release list.** A step of `fast`, `full` or `release` may say `"scoped": true`
1438
1909
  (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
1910
+ merge-base of HEAD and [the base branch](#the-base-branch), else the empty tree (everything changed) - and hands the
1440
1911
  step `DIALECTE_GATE_BASE`, `DIALECTE_GATE_TREE`, `DIALECTE_GATE_CHANGED` (a file of the changed paths byte for byte,
1441
1912
  NUL-separated, both paths of a rename, relative to the repository top as `git diff --name-only` names them, while a
1442
1913
  declared `failing` path is relative to the package root) and `DIALECTE_GATE_SELECTION` (a path to write). The step writes there
@@ -1469,6 +1940,47 @@ is no list of steps, a step without `name` or `run`, a `scoped` or `heavy` that
1469
1940
  `changedOnly`) is refused naming the list and the step: `gate`, `contrib` and `handover run` exit 2, `gate --hook`
1470
1941
  exits 1, the card prints `✗ gate invalid gate config: <message>`.
1471
1942
 
1943
+ **Opting out of a default step.** A package that has no use for a default step (no skills folder, no type
1944
+ benchmark yet) says so, with a reason, instead of wiring a script:
1945
+
1946
+ ```json
1947
+ "dialecte": {
1948
+ "gate": { "skip": { "skills": "no skills folder in this package" } },
1949
+ "contrib": { "skip": { "type-bench": "no type benchmark yet" } }
1950
+ }
1951
+ ```
1952
+
1953
+ `dialecte.gate.skip` serves the default steps of `fast`, `full` and the release list that follows `full`;
1954
+ `dialecte.contrib.skip` the default `contrib` steps (`docs`, `type-bench`) when `contrib.steps` is not declared.
1955
+ A skip is only for a default step the package cannot run: an `npm run <x>` step whose script `x` is missing. A reason
1956
+ 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
1957
+ declared list, a step the package can run (its script is there, or it runs no npm script, as the default `tests`:
1958
+ `"tests": skip is for a step the package cannot run; remove the skip`), an empty or too long reason, or a `skip`
1959
+ that is no map is refused like any gate config (exit 2, naming the key and the name): an opt-out cannot go stale
1960
+ unseen, and adding the script makes its skip refused until it is removed. An opted-out step runs in no mode (`skip skills
1961
+ opted out: <reason>`; the card warns, never blocks), and a step the package declares has no opt-out: remove it or add its
1962
+ script. Adding or removing an opt-out changes the gate record's key, so the gate runs again.
1963
+
1964
+ ### The base branch
1965
+
1966
+ Every command that reads the base branch (the gate's base, `mutants`, `tdd`, `worktree add` and `worktree prune`,
1967
+ `lot close`, the hand-over's target) finds it the same way, the first rule that answers winning:
1968
+
1969
+ 1. `dialecte.baseBranch` when set (an optional override): the local branch, else origin's. Set to a branch that
1970
+ exists nowhere, it is refused, never replaced by another: exit 2 for the gate's base, `mutants`, `handover write`
1971
+ and `handover run`, exit 1 for `worktree add` of a new branch without `--from`; the commit hook fails, and the
1972
+ tdd step of `gate --full` fails with the same text.
1973
+ 2. The branch `origin/HEAD` names (recorded at clone), when that branch exists; the local one is preferred.
1974
+ 3. `main`, local, else origin's.
1975
+ 4. `master`, local, else origin's.
1976
+ 5. Nothing found: refused with `no base branch found (no dialecte.baseBranch, no origin/HEAD, no main, no master):
1977
+ name it as dialecte.baseBranch in package.json`. The gate alone keeps selecting everything (with a note) in that
1978
+ case; `worktree add` without `--from` refuses, `worktree prune` skips the repository with the text, `lot close`
1979
+ holds nothing through the base, and `tdd` measures from HEAD.
1980
+
1981
+ The repository field of `package.json` is a URL and is never read for this. `mutants` finds `origin/<b>` through
1982
+ the same rule and no longer takes a tag named like the base branch.
1983
+
1472
1984
  ### GitHub text: lot recap and text check
1473
1985
 
1474
1986
  Text written with an assistant tends to retell the diff and grow long. The pull request splits in two:
@@ -1668,6 +2180,14 @@ runs with git's `GIT_DIR`, `GIT_INDEX_FILE` and the commit's identity set: the s
1668
2180
  (`test/git-environment.setup.ts`, vitest `setupFiles`) clears them before any test, so a test's git acts on
1669
2181
  its scratch repository only, and the cli clears git's repository variables at its start.
1670
2182
 
2183
+ The cli gates itself with its own `dialecte.gate` (package.json). `--fast`: `check`, a scoped `tests` step
2184
+ (`node src/scoped-tests.ts`: `vitest related` over the paths changed between the gate base and the tree that a
2185
+ test can import, and an empty selection exits 0 without starting vitest) and a scoped `rules` step on the same
2186
+ changed list. `--full`: the default full steps (`check`, `skills`, `build`, the whole suite), then `rules` on the
2187
+ changes since the gate base. The suite's setup file also points `XDG_CONFIG_HOME` at a folder that does not exist
2188
+ (no person's forbidden words list is read) and sets `DIALECTE_KEEP_AWAKE=0` (no run of the suite holds the machine
2189
+ awake); a case that wants either sets it itself.
2190
+
1671
2191
  The suite leaves no temporary folder behind: every test removes what it makes in its own teardown, also
1672
2192
  when it fails. A vitest global setup (`test/suite-guard/temp-folder-guard.setup.ts`, `globalSetup`) gives
1673
2193
  the run one short folder of its own (`dlt-<random>` under the system's temporary folder) and sets it as